@liquidcommerce/elements-sdk 2.6.0-beta.32 → 2.6.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/index.esm.js +11079 -10847
  2. package/dist/types/clients/base.d.ts +6 -0
  3. package/dist/types/clients/checkout.d.ts +2 -0
  4. package/dist/types/constants/core.constant.d.ts +1 -0
  5. package/dist/types/enums/core.enum.d.ts +1 -0
  6. package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -0
  7. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  8. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  9. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  10. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  11. package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -3
  12. package/dist/types/modules/product-list/components/index.d.ts +2 -1
  13. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +6 -0
  14. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +0 -1
  15. package/dist/types/modules/product-list/product-list-card.component.d.ts +2 -2
  16. package/dist/types/modules/product-list/product-list.component.d.ts +1 -1
  17. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  18. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  19. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  20. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  21. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  22. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  23. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +2 -1
  24. package/dist/types/modules/ui-components/modal/modal.component.d.ts +3 -1
  25. package/package.json +4 -3
  26. package/umd/elements-checkout.js +1 -1
  27. package/umd/elements.js +1 -1
  28. package/dist/index.checkout.esm.js +0 -16000
  29. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  30. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  31. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  32. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  33. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  34. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -4
  35. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  36. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  37. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  38. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  39. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  40. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  41. /package/dist/types/modules/product-list/components/{product-list-retailers.d.ts → product-list-retailers.component.d.ts} +0 -0
  42. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  43. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  44. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  45. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/modal.style.d.ts +0 -0
  46. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
package/umd/elements.js CHANGED
@@ -1 +1 @@
1
- (function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,i]of t)e[n]=i;return e})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(bt){console.warn("DOM polyfills initialization failed:",bt)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}const t={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},e={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},n={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={NONE:"none",CONSOLE:"console",PANEL:"panel"},s={PROMO_CODE:"promo-code"},a={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},c={SUCCESS:"success",WARNING:"warning",ERROR:"error"},p={[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},m={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},f={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040,MODAL:2147483640};class SDKError extends Error{constructor(t,e=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=e,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,e){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return e?isSDKSource(e):![];const n=String((null==t?void 0:t.message)||""),i=/liquidcommerce\s+elements/i.test(n),o=String((null==t?void 0:t.stack)||""),r=(null==t?void 0:t.source)||e||"",s=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],a=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],c=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\/(?:main|checkout)\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],p=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],m=isSDKSource(r),f=s.some(t=>t.test(o)),g=a.some(t=>t.test(o)),v=c.some(t=>t.test(o)),b=p.some(t=>t.test(o));return i||m||f||g||v||b}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const e=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return e.some(e=>e.test(t))}class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const i=n.get(t);if(!i)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,i=SingletonManager.getInstances();if(i.has(n))return i.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(n,o),o}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const g="lce",v={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},b={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:o.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},x={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},w={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},S={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},E={checkout:{injection:null,returnUrl:null}},_={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},F={products:{},cart:x,address:v,checkout:w,ui:S,metadata:E,productsList:_};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===r.CONSOLE||t===r.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===r.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===r.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}getProxyConfig(){return this.get("proxy")}validateInputs(e,n){if(!(null==e?void 0:e.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(t).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(r).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(r).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.checkout&&("object"!=typeof n.checkout?(console.warn("[LiquidCommerce Elements] checkout must be an object. Skipping checkout configuration."),n.checkout=void 0):n.checkout.pageUrl&&"string"==typeof n.checkout.pageUrl?n.checkout.pageUrl.trim()?n.checkout.pageUrl.includes("{id}")||console.warn('[LiquidCommerce Elements] checkout.pageUrl does not include "{id}" placeholder and will not include cart IDs.'):(console.warn("[LiquidCommerce Elements] checkout.pageUrl cannot be empty. Skipping checkout configuration."),n.checkout=void 0):(console.warn("[LiquidCommerce Elements] checkout.pageUrl is required and must be a string. Skipping checkout configuration."),n.checkout=void 0)),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if(!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const i="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return i instanceof Date&&!Number.isNaN(i.getTime())?n>=i?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(e,n){var i,o,s,a;const c=n.env||t.PRODUCTION;let m=p[c];const f=c===t.PRODUCTION,v=n.isBuilder||![],b=g+(f?"":"_"+c)+(v?"builder":"");return(null===(i=n.development)||void 0===i?void 0:i.customApiUrl)&&(m=n.development.customApiUrl),{apiKey:e.trim(),env:c,isBuilder:v,debugMode:n.debugMode||r.NONE,baseUrl:m,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:b,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(o=n.development)||void 0===o?void 0:o.paymentMethodId)||void 0,openShadowDom:f?![]:(null===(s=n.development)||void 0===s?void 0:s.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(a=n.development)||void 0===a?void 0:a.customApiUrl),checkout:n.checkout||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,s=Math.max(o,r),a=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return a.some(t=>t.test(n))?"tablet":c.some(t=>t.test(n))||i&&s<768?"mobile":i&&s>=768&&s<=1200||i&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&i&&s>=768||/windows nt/i.test(n)&&i&&s>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("debug");void 0!==e?console.debug(n,...i,t,e):console.debug(n,...i,t)}info(t,e){if(!this.enableLogging)return;const[n,...i]=this.getPrefix("info");void 0!==e?console.info(n,...i,t,e):console.info(n,...i,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("warn");void 0!==e?console.warn(n,...i,t,e):console.warn(n,...i,t)}error(t,e){const n=e instanceof Error;let i=n?e:void 0,o=!n&&e?e:void 0;if(o&&o.error instanceof Error){i=o.error;const{error:t,...e}=o;o=Object.keys(e).length>0?e:void 0}if(this.sendToTelemetry("error",t,i,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("error");if(console.group(r+" "+t,...s),i){console.log("Type:",i.name||"Error"),console.log("Message:",i.message),i.stack&&console.log("Stack:",i.stack),i.cause&&console.log("Caused by:",i.cause);const t=Object.keys(i).filter(t=>!["name","message","stack","cause"].includes(t));if(t.length>0){const e={};for(const n of t)e[n]=i[n];console.log("Additional:",e)}}o&&Object.keys(o).length>0&&console.log("Context:",o),console.groupEnd()}sendToTelemetry(t,e,n,i){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:i})}catch(o){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const i=n.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent='\n div {\n padding: 10px;\n background-color: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const r=document.createElement("div"),s=document.createElement("h3");s.textContent="Component </"+t+">";const a=document.createElement("p");return a.textContent=e,r.appendChild(o),r.appendChild(s),r.appendChild(a),i.appendChild(r),n}function productionComponentError({title:t,message:e,componentType:n}){const i=document.createElement("div");i.setAttribute("data-component-type",n);const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent="\n div {\n padding: 20px;\n background-color: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const s=document.createElement("div"),a=document.createElement("h2");a.textContent=t;const c=document.createElement("p");return c.textContent=e,s.appendChild(r),s.appendChild(a),s.appendChild(c),o.appendChild(s),i}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new SDKError("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:i,wrapInLceElement:r,...s}=t,a={type:e,tagName:n,useShadowDom:i&&r!==!![]};o.initialize({data:s,config:a})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const r=document.createElement(n);return r.initialize(t.type,o),r}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.MODAL]:"modal-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.PRODUCT_LIST]:"product-list-lc",[i.PRODUCT_LIST_CARD]:"product-list-card-lc",[i.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[i.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[i.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[i.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION]:"checkout-information-lc",[i.CHECKOUT_PAYMENT]:"checkout-payment-lc",[i.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[i.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING]:"checkout-billing-lc",[i.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[i.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[i.CHECKOUT_BUYER]:"checkout-buyer-lc",[i.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[i.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,i]=t.includes(".")?t.split(".",2):["actions",t];let o=i.split("_")[0];["product","cart","address","checkout"].includes(o)||(o="other");const r=Date.now(),s={eventId:"evt_"+r+"_"+Math.random().toString(36).slice(2,9),namespace:n,event:i,originalEvent:t,actionNamespace:"actions"===n?o:void 0,timestamp:r},a={data:e,metadata:s};this.dispatchNativeEvents(t,a)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=e);const i=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const o=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(o)}catch(i){this.logger.error("Error dispatching native events for "+t,i)}}setupClientReadyBuffering(){try{const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,i,o)=>{if(n!==e)return t.call(window,n,i,o);if(!this.clientReadyEvent)return t.call(window,n,i,o);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof i?i(t):i&&"function"==typeof i.handleEvent&&i.handleEvent(t)}catch(r){this.logger.error("Error replaying CLIENT_READY event",r)}return t.call(window,n,i,o)}}catch(bt){this.logger.error("Error setting up CLIENT_READY buffering",bt)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),i=t%100;let o="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||i>0)&&(o+=".",o+=i<10?"0"+i:i.toString()),o}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),o=e.getFullYear().toString();return n+"/"+i+"/"+o}catch(e){return""}}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async setPersistedStore(t,e){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:e})}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(e){this.logger.error("Error deleting persisted store",e)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const e=await this.client.post("/address/autocomplete",{body:{input:t}});return e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const e=await this.client.post("/address/details",{body:{id:t}});return e.data}catch(e){throw this.logger.error("Error fetching address details",e),new SDKError("Failed to fetch address details: "+(null==e?void 0:e.message))}}async getProductsData(t,e){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const n={identifiers:t,location:e},i=await this.client.post("/product/availability",{body:n});return i.data}catch(n){return this.logger.error("Error fetching product data",n),null}}async catalogSearch(t){try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(e){return this.logger.error("Error fetching catalog search data",e),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const e=await this.client.post("/cart/get",{body:{id:t||void 0}});return e.data}catch(e){throw this.logger.error("Error fetching cart data",e),new SDKError("Failed to fetch cart data: "+e.message)}}async updateCart(t){try{const e=await this.client.post("/cart/update",{body:t});return e.data}catch(e){throw this.logger.error("Error updating cart",e),new SDKError("Failed to update cart: "+(null==e?void 0:e.message))}}async prepareCheckout(t){try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(e){throw this.logger.error("Error fetching prepare checkout data",e),new SDKError("Failed to fetch prepare checkout data: "+(null==e?void 0:e.message))}}async updateCheckoutItems(t){try{const e=await this.client.post("/checkout/items",{body:t});return e.data}catch(e){throw this.logger.error("Error updating checkout items",e),new SDKError("Failed to update checkout items: "+(null==e?void 0:e.message))}}async getPaymentSession(t){try{const e=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return e.data}catch(e){throw this.logger.error("Error fetching payment session",e),new SDKError("Failed to get payment session: "+(null==e?void 0:e.message))}}async confirmPaymentSession(t){try{const e=await this.client.post("/checkout/payment/confirm",{body:t});return e.data}catch(e){throw this.logger.error("Error confirming payment session",e),new SDKError("Failed to confirm payment session: "+(null==e?void 0:e.message))}}async checkoutComplete(t){try{const e=await this.client.post("/checkout/complete",{body:{token:t}});return e.data}catch(e){if(this.logger.error("Error completing checkout",e),null==e?void 0:e.error)throw new SDKError("Failed to complete checkout: "+(null==e?void 0:e.message));throw e}}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const i=performance.now();try{const o=n(),r=performance.now()-i;return this.logger.info("🏪 Store "+t+" ✓ "+r.toFixed(3)+"ms",e),o}catch(o){const n=performance.now()-i;throw this.logger.error("🏪 Store "+t+" ✗ "+n.toFixed(3)+"ms",{payload:e,error:o}),o}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),i=e(),o=performance.now()-n;return o>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+o.toFixed(2)+"ms"),i},this.state=F,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.state={...this.state,metadata:E},this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const i of e){if(null==n)return;n=n[i]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),i=e(n);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let i=this.state;const o=n.pop();for(const r of n){if(void 0===i[r])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[r]}if(Array.isArray(i))i=i.filter((t,e)=>e!==Number.parseInt(o,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+o+'" from non-object type at path "'+t+'".'),![];{const{[o]:t,...e}=i;i=e}}return this.state=this.immutableSet(this.state,n.join("."),i),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,i]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[n,i]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,i)}for(const{path:t,oldValue:n,newValue:i}of e)this.notifyListeners(t,i,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let i;const o=t.map(t=>this.watch(t,(o,r)=>{n.push({path:t,value:o,oldValue:r}),clearTimeout(i),i=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of o)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,b)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...i}=e;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let i=0;const k=()=>{if(i>=this.middleware.length)return n();const o=this.middleware[i++];return o({action:t,payload:e,state:this.getState(),next:k})};return k()}immutableSet(t,e,n){const i=e.split(".");if(1===i.length){if(Array.isArray(t)){const e=[...t];return e[i[0]]=n,e}return{...t,[i[0]]:n}}const[o,...r]=i,s=t[o],a=Array.isArray(s)?[]:{};if(Array.isArray(t)){const e=[...t];return e[o]=this.immutableSet(s||a,r.join("."),n),e}return{...t,[o]:this.immutableSet(s||a,r.join("."),n)}}notifyListeners(t,e,n){const i=this.listeners.get(t);if(i)for(const a of i)try{a(e,n)}catch(r){this.logger.error('Error in store listener for path "'+t+'"',r)}const o=t.split(".");for(let a=o.length-1;a>0;a--){const t=o.slice(0,a).join("."),e=this.listeners.get(t);if(e){const i=this.get(t),r=o.slice(a).join("."),c=this.immutableSet(i,r,n);for(const n of e)try{n(i,c)}catch(s){this.logger.error('Error in store listener for parent path "'+t+'"',s)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const e=this.get("address.id")||"",n=this.get("cart.id");if(!e&&!n)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(i,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:e,cartId:n})}catch(i){this.logger.error("Failed to persist session data to DB",i)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(bt){this.logger.error("Failed to clear localStorage entry",bt)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id");(e||n)&&(t=e+":"+n)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes(":")){const[t,n]=e.split(":");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}async getAddressDataFromId(t){if(!t||""===t.trim())return v;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{latitude:e.coordinates.latitude,longitude:e.coordinates.longitude}}:{...v,id:t}}catch(e){return{...v,id:t}}}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const e=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:e===t.PRODUCTION?5:10,batchInterval:e===t.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const i=Date.now();try{const o={eventId:"event_"+i,timestamp:i,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(o)}catch(o){this.handleInternalError(o)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++,this.handleInternalError(i),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now();return{batchId:"batch_"+e,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new SDKError("XHR request failed with status: "+e.status)}catch(e){throw new SDKError("Both sendBeacon and XHR failed: "+e.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(e){this.stats.failedBatches++}}}}const I=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],O=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],R=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],M=[i.CHECKOUT,i.CHECKOUT_INFORMATION,i.CHECKOUT_STRIPE_HANDLER,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT,i.CHECKOUT_BILLING,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_DELIVER_TO_SUMMARY,i.CHECKOUT_BUYER,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN,i.CHECKOUT_PRESALE_EXPIRED,i.CHECKOUT_SEND_AS_GIFT],B=[i.PRODUCT_LIST,i.PRODUCT_LIST_CARD,i.PRODUCT_LIST_CARD_LOADING,i.PRODUCT_LIST_FILTERS,i.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],i=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),o="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+o,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+f.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-height: 400px;\n height: 100%;\n padding: 8px;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .product-list-card.sharp {\n border-radius: 0px;\n }\n\n .product-list-card.card {\n background: var(--base-background, #FAFAFA);\n border: 1px solid var(--base-accent, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .product-list-card.ghost {\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n .product-list-card.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n position: relative;\n }\n\n .product-list-card .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-card .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n /* Pre-Order Badge Styles */\n .plc__presale-badge {\n position: absolute;\n top: 16px;\n left: 16px;\n padding: 4px 12px;\n background-color: #18181B;\n color: #FFFFFF;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n z-index: 10;\n text-transform: capitalize;\n letter-spacing: 0.5px;\n }\n\n .plc__presale-badge.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__presale-badge.sharp {\n border-radius: 0px;\n }\n\n .plc__content {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n padding-top: 16px;\n }\n\n .plc__badges-wrapper {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n gap: 8px;\n line-height: 14px;\n }\n\n .plc__badge-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\n }\n\n .plc__content .plc__title {\n width: 100%;\n font-size: 24px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 70px;\n }\n\n .plc__price-personalization-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .plc__price {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 24px;\n }\n\n .plc__personalize {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__dropdown-size-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n align-items: flex-start;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n overflow: visible;\n position: relative;\n }\n\n .plc__dropdown-size-wrapper.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.sharp {\n border-radius: 0px;\n }\n\n .plc__dropdown-default-size-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n background: none;\n border: none;\n padding: 4px 8px;\n cursor: pointer;\n transition: opacity 0.2s ease;\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n }\n\n .plc__dropdown-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-chevron svg {\n display: block;\n }\n\n .plc__dropdown-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-check svg {\n display: block;\n }\n\n .plc__sizes-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease;\n background: var(--base-background, #FFFFFF);\n border: 1px solid var(--base-accent, #E4E4E7);\n border-top: none;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n z-index: 1000;\n }\n\n .plc__sizes-list.rounded {\n border-bottom-left-radius: var(--border-radius-rounded, 6px);\n border-bottom-right-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__sizes-list.sharp {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-wrapper.expanded .plc__sizes-list {\n max-height: 200px;\n opacity: 1;\n overflow-y: auto;\n }\n\n .plc__size-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 8px;\n background: var(--base-background, #FFFFFF);\n border: none;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .plc__size-option:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .plc__size-option:hover .plc__size-option-text {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option:hover .plc__size-option-check svg {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n transition: color 0.2s ease;\n }\n\n .plc__size-option-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: color 0.2s ease;\n width: 12px;\n }\n\n .plc__size-option-check svg {\n display: block;\n }\n\n .plc__fulfillment-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n align-self: stretch;\n }\n\n .plc__fulfillment-text {\n color: var(--base-foreground, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 48px;\n }\n\n .plc__fulfillment-delivery {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__add-to-cart-wrapper {\n display: flex;\n align-items: center;\n align-content: flex-start;\n gap: 8px;\n align-self: stretch;\n flex-wrap: nowrap;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n display: flex;\n min-width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n user-select: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text.ghost {\n border: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n display: flex;\n width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n background: transparent;\n border: 1px solid var(--accent-color, #E4E4E7);\n transition: background-color 0.15s ease, opacity 0.15s ease;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease {\n border-right: 1px solid var(--accent-color, #E4E4E7); \n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n border-left: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.disabled,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.rounded {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.rounded {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n \n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.ghost,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.ghost {\n border: none;\n }\n\n .product-list-card .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n height: 36px;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n font-family: var(--paragraph-font-family, Poppins);\n padding: 0 0.75rem;\n border: none;\n cursor: pointer;\n transition-property: background-color, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button.rounded {\n border-radius: var(--button-border-radius, 6px);\n }\n\n .plc__button.sharp {\n border-radius: 0px;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .plc__button:active {\n transform: translateY(1px);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Product List Card Drawer */\n .product-list-card {\n position: relative;\n overflow: visible;\n }\n\n .product-list-card-drawer-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--drawer-background-color, #ffffff);\n z-index: 100;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n overflow: hidden;\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n }\n\n .product-list-card-drawer-container.open {\n transform: translateX(0);\n }\n\n .product-list-card-drawer-content {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n padding: 16px;\n position: relative;\n }\n\n\n /* Retailers Popup Styles */\n .retailers-popup-wrapper {\n padding: 16px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .retailers-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .retailers-popup-title {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n line-height: 24px;\n margin: 0;\n }\n\n .retailers-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n .retailers-popup-no-data {\n padding: 24px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .popup-fulfillment-list-container {\n margin-top: 16px;\n max-height: 445px;\n overflow-y: auto;\n }\n\n /* Prevent background scroll when dialog is active */\n body:has(dialog[open]) {\n overflow: hidden;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+f.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+f.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+f.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+f.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+f.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+f.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+f.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+f.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n /* Hosted checkout header - non-sticky */\n .checkout-header-wrapper.hosted {\n position: relative;\n background-color: transparent;\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Spacer to maintain layout balance when close button is hidden */\n .checkout-header-spacer {\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+f.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+f.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+f.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+f.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n max-height: 418px;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+f.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+f.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+f.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getModalStyles(){return"\n /* Modal dialog */\n .modal {\n position: fixed;\n border: none;\n padding: 0;\n margin: auto;\n background: transparent;\n max-width: 90vw;\n max-height: 90vh;\n z-index: "+f.MODAL+";\n overflow: visible;\n }\n\n .modal::backdrop {\n background-color: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(2px);\n animation: modal-backdrop-fade-in 150ms ease-out;\n }\n\n @keyframes modal-backdrop-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n /* Modal content */\n .modal-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n }\n\n /* Specific modal sizes based on content type */\n .modal.product-list-retailers {\n width: 512px;\n height: 576px;\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const q={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},U={backgroundColor:"--product-background-color"},V={backgroundColor:"--cart-background-color"},K={backgroundColor:"--address-background-color"},H={backgroundColor:"--checkout-background-color"},W={backgroundColor:"--product-list-background-color"},X={global:q,product:U,cart:V,address:K,checkout:H,productList:W};function getCSSVariableMapping(t){return X[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i))if(this.hasValueAtPath(t,o)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,i]of Object.entries(e))n.style.setProperty(t,String(i))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let i=t;for(const o of n){if(null==i||!(o in i))return![];i=i[o]}return!![]}findOrCreateRule(t){const e=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===e)return i;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const i of this.opacityLevels){const o=e+"-"+i.suffix,r=this.addOpacityToHexColor(n,i.value);r&&(t[o]=r)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(e);return n&&i}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const i=Math.round(255*e),o=i.toString(16).padStart(2,"0");return"#"+n+o}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),i=this.cssProcessor.generateCSSVariablesString(n),o=this.getStylesheetStyles(t).join("\n\n"),r=0===i.length?"":":host { "+i+" }",s=("\n "+r+"\n\n "+o+"\n ").trim();this.createStylesheet(t,s)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(bt){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles(),getModalStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];case"product-list":return[getProductListStyles(),getProductRetailersStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(t){var e,n;const i=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=i,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}updateProductListComponent(t){this.data.productList=this.deepMerge(this.getConfigs("productList"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",t.theme,"product-list")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==I.indexOf(t)?this.getConfigs("product"):-1!==O.indexOf(t)?this.getConfigs("address"):-1!==R.indexOf(t)?this.getConfigs("cart"):-1!==M.indexOf(t)?this.getConfigs("checkout"):-1!==B.indexOf(t)?this.getConfigs("productList"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===i.DRAWER||t===i.MODAL){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address"),s=this.stylesheetGenerator.getStylesheet("product-list");return n&&t.push(n),i&&t.push(i),o&&t.push(o),r&&t.push(r),s&&t.push(s),t}let n;if(O.includes(t)||t===i.ADDRESS)n="address";else if(I.includes(t)||t===i.PRODUCT)n="product";else if(R.includes(t)||t===i.CART)n="cart";else if(M.includes(t)||t===i.CHECKOUT)n="checkout";else{if(!B.includes(t)&&t!==i.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="product-list"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const i in e)null!==e[i]&&void 0!==e[i]&&("object"!=typeof e[i]||Array.isArray(e[i])||"object"!=typeof t[i]||Array.isArray(t[i])?n[i]=e[i]:n[i]=this.deepMerge(t[i],e[i]));return n}}const Z="@liquidcommerce/elements-sdk",J="LiquidCommerce Elements SDK",$="UNLICENSED",tt="LiquidCommerce Team",et="2.6.0-beta.32",nt="https://docs.liquidcommerce.co/elements-sdk",it={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},ot={url:"https://github.com/liquidcommerce/elements-sdk/issues"},rt="./dist/index.esm.js",st="./umd/elements.js",at="./dist/types/index.d.ts",ct="pnpm@10.0.0",lt={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./checkout":{types:"./dist/types/index.checkout.d.ts",import:"./dist/index.checkout.esm.js",browser:"./umd/elements-checkout.js",default:"./dist/index.checkout.esm.js"},"./package.json":"./package.json"},dt=["dist","umd","docs","README.md","LICENSE"],ht={access:"public",registry:"https://registry.npmjs.org/"},ut="module",pt=["dist/index.esm.js","dist/index.checkout.esm.js","umd/elements.js","umd/elements-checkout.js","src/index.ts","src/index.umd.ts","src/index.checkout.ts","src/index.checkout.umd.ts"],mt={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},ft=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],gt={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.10","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.56.0","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},vt={node:">=22"},yt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},bt={name:Z,description:J,license:$,author:tt,version:et,homepage:nt,repository:it,bugs:ot,module:rt,browser:st,types:at,packageManager:ct,exports:lt,files:dt,publishConfig:ht,type:ut,sideEffects:pt,scripts:mt,keywords:ft,devDependencies:gt,engines:vt,pnpm:yt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const e=await this.waitForContainerInit(t,1e4);return e?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(e){return this.checkFallbackGTM(t)}}waitForContainerInit(t,e){return new Promise(n=>{let i;const o=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(o),clearTimeout(i),n(!![]))},100);i=setTimeout(()=>{clearInterval(o),n(![])},e)})}injectGTMScript(t){return new Promise((e,n)=>{const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![],i.crossOrigin="anonymous";let o=![];const r=setTimeout(()=>{o||(o=!![],this.isContainerInitialized(t)?e():n(new Error("GTM script timeout")))},15e3);i.onload=()=>{o||setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?e():n(new Error("GTM script loaded but failed to initialize")))},500)},i.onerror=()=>{setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?e():n(new Error("GTM script failed to load")))},100)},document.head.appendChild(i)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const i of e)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t)}catch(n){this.logger.error("Error processing queued event "+i.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const e=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!e.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+e.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(e.message),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),o={...n,...i.length>0&&{send_to:i},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:bt.description+" v"+bt.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:o,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const r={event:e,...o};window.dataLayer.push(r)}catch(i){this.logger.error("GTM "+t+" error",i)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,n){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+n),new SDKError("Item not found");const r=o.quantity+n;if(r<1)return this.removeItem(t,!![]);const s=this.buildItemUpdate(o,r),a=await this.api.updateCart({id:i,items:[s],location:this.getLocation()});this.syncItemsFromApiResponse(a,[t]),this.updateFulfillment(o.fulfillmentId,a),this.syncRetailersFromApiResponse(a),this.syncCartMetaFromApiResponse(a),this.pubSub.publishAction(n<0?e.CART_ITEM_QUANTITY_DECREASE:e.CART_ITEM_QUANTITY_INCREASE,{cartId:i,itemId:o.id,quantity:r,previousQuantity:o.quantity});const c=splitCategoryPath(o.catPath),p={item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:Math.abs(n),price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};n<0?this.googleTagManager.removeFromCart(p):n>0&&this.googleTagManager.addToCart(p)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const r=this.buildItemUpdate(o,0),s=await this.api.updateCart({id:i,items:[r],location:this.getLocation()}),a={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId};this.syncItemsFromApiResponse(s,[]),this.cleanupAfterItemRemoval(a,s),this.syncCartMetaFromApiResponse(s),this.pubSub.publishAction(e.CART_ITEM_REMOVED,{cartId:i,itemId:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,n){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c=this.getDetails(),p={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:n},m=await this.api.updateCart({id:s.id||"",items:[p],location:this.getLocation()});this.syncItemsFromApiResponse(m,[t]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const f=this.getDetails();this.pubSub.publishAction(e.CART_ITEM_ENGRAVING_UPDATED,{cartId:f.cartId,itemId:a.id,engravingLines:n,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]}),this.pubSub.publishAction(e.CART_UPDATED,{previous:c,current:f})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to update item engraving",s),s}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var n,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),r=this.getDetails(),s=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],a=s.length>0,c=Object.values(o.items||{}).find(e=>{var n,i,o,r,c;const p=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!p)return![];if(a){const t=(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[];return s.join(",")===t.join(",")}return!(null===(c=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.length)}),p={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:c?t.quantity+c.quantity:t.quantity};a&&(p.engravingLines=s);const m=await this.api.updateCart({id:o.id||"",items:[p],location:this.getLocation()}),f=null===(i=Object.values(m.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===p.fulfillmentId&&t.partNumber===p.partNumber);if(!f)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(m,[]);const g=this.store.get("cart.fulfillments."+t.fulfillmentId);g?this.updateFulfillment(t.fulfillmentId,m):this.addNewFulfillmentAndRetailer(t.fulfillmentId,m),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const v=this.getDetails();this.pubSub.publishAction(e.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(e.CART_ITEM_ADDED,{cartId:v.cartId,itemId:f.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(e.CART_UPDATED,{previous:r,current:v});const b=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,quantity:f.quantity,price:centToDollar(f.unitPrice||0),item_image:f.mainImage,upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=this.clientConfig.get("checkout");if(n){this.trackBeginCheckout(t);const e=await this.api.prepareCheckout({cartId:t.id||""}),i=this.resolveCheckoutRedirectUrl(n.pageUrl,e.token);return window.location.assign(i),void 0}this.pubSub.publishAction(e.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var e;const n=(null===(e=t.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}resolveCheckoutRedirectUrl(t,e){return t.includes("{id}")?e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}async applyPromoCode(t){var n,i,o,r,s;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const a=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const c=await this.api.updateCart({id:t,items:[],promoCode:a,location:this.getLocation()});this.store.batch({"cart.subtotal":c.subtotal,"cart.itemsQuantity":c.itemsQuantity,"cart.events":c.events});const p=(null===(i=null===(n=c.promoCode)||void 0===n?void 0:n.code)||void 0===i?void 0:i.toLowerCase())===a.toLowerCase();p?(this.store.set("cart.promoCode",{code:a,discount:(null===(o=c.promoCode)||void 0===o?void 0:o.discount)||0}),this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(r=c.promoCode)||void 0===r?void 0:r.discount)||0,newSubtotal:c.subtotal||0}),this.googleTagManager.promoCodeApplied(a,(null===(s=c.promoCode)||void 0===s?void 0:s.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:n,error:t}),this.googleTagManager.promoCodeFailed(a,t),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const t=this.store.get("cart.id"),n=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":n.subtotal,"cart.itemsQuantity":n.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(e.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:n.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const n=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",n);const i=this.store.get("cart.promoCode"),o=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:o,error:n}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,n),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...x,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartState(n,!![]),n.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(e.CART_RESET,!![])}catch(t){const n=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",n);const i=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_FAILED,{cartId:i,message:n}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),i={};for(const o in e.items||{}){const t=e.items[o];i[o]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:e.id||"",promoCodeDiscount:(null===(t=e.promoCode)||void 0===t?void 0:t.discount)||null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:i,retailers:e.retailers||{},location:n.id?{placesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}buildItemUpdate(t,e){var n,i,o;const r={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},s=(null===(o=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}syncItemsFromApiResponse(t,e=[]){const n=this.store.get("cart.items")||{},i=new Set(Object.keys(t.items));for(const r of Object.keys(n))i.has(r)||this.store.remove("cart.items."+r);const o={};for(const r of Object.values(t.items))0!==e.length&&!e.includes(r.id)&&n[r.id]||(o["cart.items."+r.id]=r);Object.keys(o).length>0&&this.store.batch(o)}syncCartMetaFromApiResponse(t){var e,n;const i={"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":t.events},o=null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discount:(null===(n=t.promoCode)||void 0===n?void 0:n.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var e,n;const i=this.store.get("cart.retailers")||{},o=this.store.get("cart.fulfillments")||{},r=new Set(Object.keys(t.retailers)),s=new Set;for(const a of Object.values(t.retailers))if(a.fulfillments)for(const t of Object.keys(a.fulfillments))s.add(t);for(const a of Object.keys(i))r.has(a)||this.store.remove("cart.retailers."+a);for(const a of Object.keys(o))s.has(a)||this.store.remove("cart.fulfillments."+a);if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const i of Object.values(t.retailers))if(e["cart.retailers."+i.id]=i,(null===(n=Object.values(i.fulfillments))||void 0===n?void 0:n.length)>0)for(const t of Object.values(i.fulfillments))e["cart.fulfillments."+t.id]=t;this.store.batch(e)}}updateFulfillment(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),o=null==i?void 0:i.fulfillments[t];o&&i&&this.store.set("cart.fulfillments."+t,o)}addNewFulfillmentAndRetailer(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),o=null==i?void 0:i.fulfillments[t];if(o&&i){const e={["cart.fulfillments."+t]:o,["cart.retailers."+i.id]:i};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,i;const o=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.some(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t.fulfillmentId)}),r=null===(i=Object.keys(e.retailers))||void 0===i?void 0:i.some(e=>e===t.retailerId);if(o){this.updateFulfillment(t.fulfillmentId,e);const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),r){const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,n=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const e of Object.keys(c.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const p={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.items))p["cart.items."+e.id]=e;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const e of Object.values(t.retailers))if(p["cart.retailers."+e.id]=e,(null===(s=Object.values(e.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(e.fulfillments))p["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(p["cart.events"]=t.events),this.store.batch(p),n){const t=this.store.get("cart"),n=this.buildCartLoadedEventData(t);this.pubSub.publishAction(e.CART_LOADED,n)}}buildCartLoadedEventData(t){var e,n;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const e=t.items[r];o[r]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,n){const o={type:t,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART&&this.pubSub.publishAction(e.CART_OPENED,!![]),t===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(e.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_CLOSED,!![])}openModal(t,e){const n={type:t,data:e||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:n})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+e.INTERNAL_CART_TO_CHECKOUT,async()=>{this.store.set("metadata.checkout",E.checkout),await this.loadCheckout({}),this.uiCommands.openDrawer(i.CHECKOUT)}),window.addEventListener("lce:actions."+e.CART_RESET,()=>{this.store.set("checkout",{...w,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const e={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},n=await this.api.updateCart({id:"",items:[e],location:this.getLocation()});await this.loadCheckout({cartId:n.id,isForPresale:!![]})}catch(e){throw this.store.set("checkout.error",e.message),this.logger.error("Failed to add presale item to checkout",e),e}}async loadCheckout(t){try{this.store.set("checkout.loading",!![]);const n=void 0!==t.cartId?t.cartId:this.store.get("cart.id");if(!t.checkoutId&&!n)return this.store.set("checkout.error","Checkout token or Cart ID is required"),void 0;const i=this.themeProvider.getConfigs("checkout"),o=await this.api.prepareCheckout({token:t.checkoutId||void 0,cartId:t.checkoutId?void 0:n,marketingPreferences:{canEmail:i.layout.emailOptIn.checked,canSms:i.layout.smsOptIn.checked}});if(t.isForPresale===!![]&&0===o.itemsQuantity)return this.showPresaleExpired("items_unavailable"),void 0;const r={"checkout.cartId":o.cartId,"checkout.isGift":o.isGift,"checkout.marketingPreferences":o.marketingPreferences,"checkout.customerForm":w.customerForm,"checkout.giftRecipientForm":w.giftRecipientForm,"checkout.paymentForm":w.paymentForm,"checkout.paymentForm.billingSameAsShipping":o.billingSameAsShipping,"checkout.shippingAddress":o.shippingAddress,"checkout.presale":o.presale,"checkout.giftRecipientForm.data":o.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":o.itemsQuantity};this.store.batch(r),this.syncCheckoutState(o),this.pubSub.publishAction(e.CHECKOUT_LOADED,this.getDetails())}catch(n){this.store.set("checkout.error",n.message),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:n.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),i=null!=t?t:!n,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o});const r=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_IS_GIFT_TOGGLED,{cartId:r,isActive:i,previousIsActive:n})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!n;this.store.set("checkout.paymentForm.billingSameAsShipping",i);const o=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:o,isActive:i,previousIsActive:n})}async toggleMarketingPreferences(t,n){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=n?n:!i,r=this.store.get("checkout.marketingPreferences"),s=this.dataForCheckoutPrepare({marketingPreferences:{...r,[t]:o}}),a=await this.api.prepareCheckout(s);this.store.set("checkout.marketingPreferences",a.marketingPreferences);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:c,fieldName:t,isActive:o,previousIsActive:i})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":e,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const n=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:e});return{id:n.id,card:{brand:n.card.brand,last4:n.card.last4,expMonth:n.card.expMonth,expYear:n.card.expYear}}}catch(n){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const n=this.dataForCheckoutPrepare({}),i=await this.api.prepareCheckout({...n,promoCode:t}),o=0!==i.amounts.discounts,r=i.events.some(t=>t.type===a.PROMO_CODE)?i.events[0]:null;if(!o){this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist');const n=this.store.get("checkout.cartId");return this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:n,error:(null==r?void 0:r.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==r?void 0:r.message)||"not_applied"),void 0}const s=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{cartId:s,discount:i.amounts.discounts,newTotal:i.amounts.total}),this.googleTagManager.promoCodeApplied(t,i.amounts.discounts),await this.refreshCheckout({response:i})}catch(n){const i=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",i);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:i}),this.googleTagManager.promoCodeFailed(t,i),n}}async removePromoCode(){var t,n;try{const i=this.dataForCheckoutPrepare({}),o=(null===(n=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===n?void 0:n.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const s=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_REMOVED,{cartId:s,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.refreshCheckout({response:r})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const n=this.store.get("checkout.promoCode.code")||"",o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:t}),n&&this.googleTagManager.promoCodeFailed(n,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(bt){const e=bt.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),bt}}async applyGiftCard(t){const n=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(n);const t=this.dataForCheckoutPrepare({}),i=t.giftCards||[],o=await this.api.prepareCheckout({...t,giftCards:[...i,n]}),r=o.events.some(t=>t.type===a.GIFT_CARD&&t.level===c.ERROR)?o.events[0]:null;r&&this.store.set("checkout.giftCardError",r.message);const s=o.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(!s){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==r?void 0:r.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(n,(null==r?void 0:r.message)||"not_applied"),void 0}const p=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{cartId:p,newTotal:o.amounts.total}),this.googleTagManager.giftCardApplied(n,s.applied),await this.refreshCheckout({response:o})}catch(i){const t=(null==i?void 0:i.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:o,error:t}),this.googleTagManager.giftCardFailed(n,t),i}}async removeGiftCard(t){var n;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(n=t.giftCards)||void 0===n?void 0:n.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],r=await this.api.prepareCheckout({...t,giftCards:o}),s=r.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(s)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_REMOVED,{cartId:a,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.refreshCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const n=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:n,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(bt){throw this.store.set("checkout.error",(null==bt?void 0:bt.message)||"Failed to clear gift card error. Please try again."),bt}}showPresaleExpired(t="time_expired"){this.store.set("checkout",{...w,rerender:![]});const e=this.store.get("metadata.checkout.injection");if(null==e?void 0:e.containerId){const n=document.getElementById(e.containerId);if(n){const e=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_EXPIRED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],reason:t});safeReplaceChildren(n,e)}return}this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED,{reason:t})}openCheckout(){const t=this.clientConfig.get("checkout");if(null==t?void 0:t.pageUrl){this.store.set("metadata.checkout.returnUrl",window.location.href);const e=this.store.get("checkout.token")||"",n=this.resolveCheckoutPageUrl(t.pageUrl,e);return window.location.assign(n),void 0}this.uiCommands.openDrawer(i.CHECKOUT)}getReturnUrl(){return this.store.get("metadata.checkout.returnUrl")}resolveCheckoutPageUrl(t,e){return t.includes("{id}")?e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout page URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,n){var i,o,r;try{this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c=a.quantity,p=a.quantity+n;if(p<1)return this.removeItem(t,!![]);const m={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:p},f=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];f.length>0&&(m.engravingLines=f);const g=await this.api.updateCheckoutItems({cartId:s,items:[m],location:this.getLocation()});this.syncFromItemUpdate(g.cart,g.checkout),this.pubSub.publishAction(n>0?e.CHECKOUT_ITEM_QUANTITY_INCREASE:e.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:s,cartItemId:a.cartItemId,quantity:p,previousQuantity:c});const v=splitCategoryPath(a.catPath),b={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,quantity:Math.abs(n),price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};n<0?this.googleTagManager.removeFromCart(b):n>0&&this.googleTagManager.addToCart(b)}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var n,i,o;try{const r=this.store.get("checkout.items."+t);if(!r)throw new SDKError("Item not found in checkout");if(!(null===(n=r.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const s=(null===(o=null===(i=r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],a={id:r.cartItemId,fulfillmentId:r.fulfillmentId,partNumber:r.partNumber,quantity:r.quantity,engravingLines:[]},c=this.store.get("checkout.cartId"),p=await this.api.updateCheckoutItems({cartId:c,items:[a],location:this.getLocation()});this.syncFromItemUpdate(p.cart,p.checkout),this.pubSub.publishAction(e.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:c,cartItemId:r.cartItemId,engravingLines:[],previousEngravingLines:s})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r}),r}}async removeItem(t,n){var i,o,r;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:0},p=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];p.length>0&&(c.engravingLines=p);const m=await this.api.updateCheckoutItems({cartId:s,items:[c],location:this.getLocation()});this.syncFromItemUpdate(m.cart,m.checkout),this.pubSub.publishAction(e.CHECKOUT_ITEM_REMOVED,{cartId:s,cartItemId:a.cartItemId})}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const n=this.store.get("checkout.fulfillments"),i=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:Math.round(e.amounts.subtotal*t/100)})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to update tips. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.fulfillments"),r=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),s=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?n:e.amounts.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(a);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:c,deliveryTips:s,previousDeliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.fulfillments"),i=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?0:e.amounts.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove fulfillment tip. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:n,customerData:i}){var o;try{this.store.set("checkout.customerForm.isSaving",!![]);const r=this.store.get("checkout.customerForm.data"),s=this.store.get("checkout.isGift"),a=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,customer:{...r,...i},isGift:s}),c=await this.api.prepareCheckout(a);this.store.batch({"checkout.customerForm.data":c.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":c.shippingAddress,"checkout.deliveryInstructions":n});const p=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:p});const m=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(m.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=m.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:n,...i}){var o;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const r=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,isGift:!![],giftRecipient:i}),s=await this.api.prepareCheckout(r);this.store.batch({"checkout.giftRecipientForm.data":s.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":s.shippingAddress,"checkout.deliveryInstructions":n});const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:a});const c=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(c.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=c.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:n}){var i,o,r;try{this.store.set("checkout.paymentForm.isSaving",!![]);const s=this.store.get("checkout"),a={},c=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let p=null,m=null;if(c||n){const t=await this.confirmPaymentSession((null==n?void 0:n.confirmationTokenId)||"",(null==n?void 0:n.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");p=t.card,m=t.id}const f=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:m||void 0}),g=await this.api.prepareCheckout(f);if(g.payment&&p&&(a["checkout.paymentForm.paymentMethod"]={id:g.payment,card:p}),t&&g.billingAddress){a["checkout.paymentForm.data"]={firstName:g.billingAddress.firstName||"",lastName:g.billingAddress.lastName||"",email:g.billingAddress.email||"",phone:g.billingAddress.phone||"",company:g.billingAddress.company||"",addressOne:g.billingAddress.one||"",addressTwo:g.billingAddress.two||"",city:g.billingAddress.city||"",state:g.billingAddress.state||"",zipCode:g.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}a["checkout.paymentForm.isEditing"]=![],a["checkout.paymentForm.isValid"]=!![],this.store.batch(a);const v=a["checkout.paymentForm.paymentMethod"]||(null===(i=s.paymentForm)||void 0===i?void 0:i.paymentMethod),b=(null===(o=null==v?void 0:v.card)||void 0===o?void 0:o.brand)?v.card.brand+" ****"+v.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(s.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),b,(null===(r=s.promoCode)||void 0===r?void 0:r.code)||void 0)}catch(s){throw this.logger.error("Failed to save payment form",s),this.store.set("checkout.error",s.message),s}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,n,o,r,s,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout"),{orderNumber:p}=await this.api.checkoutComplete(c.token);c.presale||this.store.set("cart.shouldReset",!![]);const m={orderNumber:p,orderTotal:c.amounts.total,cardLast4:(null===(o=null===(n=null===(t=null==c?void 0:c.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===n?void 0:n.card)||void 0===o?void 0:o.last4)||"",customerEmail:c.customerForm.data.email,giftRecipientEmail:(null===(s=null===(r=null==c?void 0:c.giftRecipientForm)||void 0===r?void 0:r.data)||void 0===s?void 0:s.email)||null},f=this.store.get("metadata.checkout.injection");if(null==f?void 0:f.containerId){const t=document.getElementById(f.containerId);if(t){const e=ComponentFactoryService.createElement({type:i.CHECKOUT_COMPLETED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...m});safeReplaceChildren(t,e)}}else this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,m);this.pubSub.publishAction(e.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:p,orderTotal:c.amounts.total}),this.googleTagManager.purchase({transaction_id:p,tax:centToDollar(c.amounts.tax+c.amounts.service+c.amounts.platform),shipping:centToDollar(c.amounts.shipping||0),coupon:(null===(a=c.promoCode)||void 0===a?void 0:a.code)||void 0,items:[...Object.values(c.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(c.amounts.total),subtotal:centToDollar(c.amounts.subtotal),total_before_discounts:centToDollar(c.amounts.subtotal+c.amounts.tax+c.amounts.service+c.amounts.platform+c.amounts.shipping+c.amounts.delivery),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)})}catch(c){const t=(null==c?void 0:c.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const e={"checkout.amounts":t.amounts,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const n of Object.values(t.retailers))for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t;this.store.batch(e)}syncFromItemUpdate(t,e){var n,i,o,r,s;try{this.store.set("checkout.updating",!![]);const a=this.store.get("cart");for(const t of Object.keys(a.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(a.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(a.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const c={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(n=t.promoCode)||void 0===n?void 0:n.code)?{...t.promoCode,error:null}:null};if((null===(i=Object.values(t.items))||void 0===i?void 0:i.length)>0)for(const e of Object.values(t.items))c["cart.items."+e.id]=e;if((null===(o=Object.values(t.retailers))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.retailers))if(c["cart.retailers."+e.id]=e,(null===(r=Object.values(e.fulfillments))||void 0===r?void 0:r.length)>0)for(const t of Object.values(e.fulfillments))c["cart.fulfillments."+t.id]=t;this.store.batch(c);const p={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.shippingAddress":e.shippingAddress,"checkout.itemsQuantity":e.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(s=null==e?void 0:e.promoCode)||void 0===s?void 0:s.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(e.items))p["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(e.retailers)){p["checkout.retailers."+t.id]=t;for(const e of Object.values(t.fulfillments))p["checkout.fulfillments."+e.id]=e}}this.store.batch(p)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var e;const n={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.shippingAddress":t.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(t.items))n["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(t.retailers)){n["checkout.retailers."+e.id]=e;for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t}}this.store.batch(n)}async refreshCheckout(t){var n;try{let e;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)e=t.response;else{const i=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});e=await this.api.prepareCheckout({...o,cartId:i})}this.syncCheckoutState(e)}catch(i){const t=(null==i?void 0:i.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:t}),i}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:i,shippingAddressTwo:r,deliveryInstructions:s,deliveryTips:a,paymentMethodId:c,isGift:p}){var m,f,g,v,b,x,w,S,E,_,F,I,O,R,M,B,q,U,V,K,H,W,X;const Z=this.store.get("checkout"),J=null!==(f=null===(m=Z.paymentForm)||void 0===m?void 0:m.billingSameAsShipping)&&void 0!==f?f:!![],$=void 0!==p?p:Z.isGift,tt=e?!![]:null!==(v=null===(g=Z.giftRecipientForm)||void 0===g?void 0:g.isValid)&&void 0!==v?v:![],et=$&&tt,nt={cartId:Z.cartId,shippingAddressTwo:r,billingSameAsShipping:J,marketingPreferences:i||Z.marketingPreferences,promoCode:(null===(b=Z.promoCode)||void 0===b?void 0:b.code)||void 0,isGift:et,giftCards:(null===(x=null==Z?void 0:Z.giftCards)||void 0===x?void 0:x.map(t=>t.code))||[],deliveryTips:a||Object.values(Z.fulfillments||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};c?nt.payment=c:(null===(S=null===(w=Z.paymentForm)||void 0===w?void 0:w.paymentMethod)||void 0===S?void 0:S.id)&&(nt.payment=Z.paymentForm.paymentMethod.id);const it=s||Z.deliveryInstructions;if(it&&(nt.deliveryInstructions=Object.values(Z.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:it}))),nt.customer=t||((null===(_=null===(E=null==Z?void 0:Z.customerForm)||void 0===E?void 0:E.data)||void 0===_?void 0:_.email)?{firstName:null===(I=null===(F=Z.customerForm)||void 0===F?void 0:F.data)||void 0===I?void 0:I.firstName,lastName:null===(R=null===(O=Z.customerForm)||void 0===O?void 0:O.data)||void 0===R?void 0:R.lastName,email:null===(B=null===(M=Z.customerForm)||void 0===M?void 0:M.data)||void 0===B?void 0:B.email,phone:null===(U=null===(q=Z.customerForm)||void 0===q?void 0:q.data)||void 0===U?void 0:U.phone,birthDate:null===(K=null===(V=Z.customerForm)||void 0===V?void 0:V.data)||void 0===K?void 0:K.birthDate,company:null===(W=null===(H=Z.customerForm)||void 0===H?void 0:H.data)||void 0===W?void 0:W.company}:void 0),et){const t=e||(null===(X=Z.giftRecipientForm)||void 0===X?void 0:X.data);t&&(nt.giftOptions=t)}return J||(n?nt.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip}:Z.paymentForm.data&&(nt.billingAddress=Z.paymentForm.data)),nt}getDetails(){var t,e,n,i;const o=this.store.get("checkout"),r={};for(const s in o.items||{}){const t=o.items[s];r[s]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:s,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:o.cartId,isGift:o.isGift||![],billingSameAsShipping:(null===(t=o.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(e=o.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(n=o.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:Boolean(null===(i=o.promoCode)||void 0===i?void 0:i.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,amounts:o.amounts,itemCount:Object.values(r).reduce((t,e)=>t+(e.quantity||0),0),items:r}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const i=[];for(const r of n.products){const o=Object.values(r.sizes).filter(e=>t.some(t=>t===(e.upc||e.id||r.salsifyGrouping))),s=t.find(t=>o.some(e=>t===e.upc||t===e.id)||t===r.salsifyGrouping),a=s||(null===(e=null==o?void 0:o[0])||void 0===e?void 0:e.upc);await this.loadProduct(a,{products:[r],retailers:n.retailers}),i.push(a)}const o=t.filter(t=>-1===i.indexOf(t));this.store.batch(o.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,n=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(n&&(s=n),n||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(e.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],p=a.sizes[a.selectedSizeId||""],m=Boolean(this.getLocation()),f=a.selectedFulfillment,g=m&&(null==f?void 0:f.variant.price)?f.variant.price:a.noAvailabilityPrice,v=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:c.name,item_brand:c.brand,item_size:null==p?void 0:p.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(g),item_type:c.type,item_subtype:c.subType,item_image:(null==p?void 0:p.image)||(null===(o=c.images)||void 0===o?void 0:o[0]),upc:null==p?void 0:p.upc,grouping_id:c.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(r){this.store.set("products."+t+".error",r.message),this.logger.error("Failed to load product data for ID "+t,r)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,n){var i,r,s;const a=this.store.get("products."+t),c=a.sizes[n],p=Object.values(c.shippingFulfillments),m=Object.values(c.onDemandFulfillments),f=p.length>0,g=m.length>0,v=f||g;let b=a.selectedFulfillmentType,x=null,w=null;const S=b===o.SHIPPING?f:g;!S&&v&&(b=b===o.SHIPPING?o.ON_DEMAND:o.SHIPPING);const E=b===o.SHIPPING?p:m;E.length>0&&(x=E[0],w=x.id);const _=E.length>0,F=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==c?void 0:c.id,item_name:a.name,item_brand:a.brand,item_size:null==c?void 0:c.size,item_category:F.category,item_category2:F.category2,item_category3:F.category3,price:centToDollar((null==x?void 0:x.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==c?void 0:c.image)||(null===(i=a.images)||void 0===i?void 0:i[0]),upc:null==c?void 0:c.upc,grouping_id:a.salsifyGrouping,product_id:null==c?void 0:c.id}),v||this.googleTagManager.productSizeNoAvailability({productId:null==c?void 0:c.id,productName:a.name,productBrand:a.brand,productCategory:F.category,productCategory2:F.category2,productCategory3:F.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:n,sizeName:null==c?void 0:c.size,upc:null==c?void 0:c.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(e.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,selectedSize:(null===(r=a.sizes[n])||void 0===r?void 0:r.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(s=a.sizes[a.selectedSizeId])||void 0===s?void 0:s.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".productHasAvailability"]:v,["products."+t+".fulfillmentHasAvailability"]:_,["products."+t+".selectedFulfillmentType"]:b,["products."+t+".selectedFulfillment"]:x,["products."+t+".selectedFulfillmentId"]:w})}async selectFulfillment(t,n){var i;const r=this.store.get("products."+t),s=r.sizes[r.selectedSizeId],a=r.selectedFulfillmentType===o.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,c=a[n];this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId||"",previousFulfillmentType:r.selectedFulfillmentType});const p=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:r.name,item_brand:r.brand,item_size:null==s?void 0:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,price:centToDollar((null==c?void 0:c.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,item_image:(null==s?void 0:s.image)||(null===(i=r.images)||void 0===i?void 0:i[0]),upc:null==s?void 0:s.upc,grouping_id:r.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".quantity"]:1})}async updateQuantity(t,n){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+n,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,p=Math.max(a,Math.min(c,s));this.pubSub.publishAction(n<0?e.PRODUCT_QUANTITY_DECREASE:e.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:p,previousQuantity:r}),this.store.set("products."+t+".quantity",p)}async changeFulfillmentType(t,n){var i,r;const s=this.store.get("products."+t),a=s.sizes[s.selectedSizeId],c=n===o.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,p=Object.values(c);if(0===p.length){const t=splitCategoryPath(s.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:s.name,productBrand:s.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:null!==(i=s.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:n,upc:null==a?void 0:a.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+n+" fulfillments available for selected size"}),void 0}const m=p[0]||null,f=(null==m?void 0:m.id)||null;this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:f,previousFulfillmentType:s.selectedFulfillmentType,previousFulfillmentId:s.selectedFulfillmentId,fulfillmentHasAvailability:p.length>0});const g=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:s.name,item_brand:s.brand,item_size:null==a?void 0:a.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==m?void 0:m.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,item_image:(null==a?void 0:a.image)||(null===(r=s.images)||void 0===r?void 0:r[0]),upc:null==a?void 0:a.upc,grouping_id:s.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:n,["products."+t+".selectedFulfillment"]:m,["products."+t+".selectedFulfillmentId"]:f,["products."+t+".fulfillmentHasAvailability"]:p.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const i={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout(),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding presale item to checkout",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t);if(!e)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[e,n])=>(t[e]={...n},t),{}):{},n=Object.entries(e.sizes||{}).reduce((t,[e,n])=>{const{loading:i,error:o,shippingFulfillments:r,onDemandFulfillments:s,...a}=n;return t[e]={...a,shippingFulfillments:fulfillmentEventData(r),onDemandFulfillments:fulfillmentEventData(s)},t},{});return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentType:e.selectedFulfillmentType,selectedFulfillmentId:e.selectedFulfillmentId||null,productHasAvailability:Boolean(e.productHasAvailability),fulfillmentHasAvailability:Boolean(e.fulfillmentHasAvailability),id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,images:e.images||[],region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,noAvailabilityPrice:e.noAvailabilityPrice,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},i=Object.values(t).length,o=Object.values(e).length;if(i+o>0)return n.id}return null}loadProductStoreUpdate({products:[t,...e],retailers:n}){var i,r,s,a,c;try{const e=this.themeProvider.getConfigs("product"),p={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:e.layout.enableShippingFulfillment?o.SHIPPING:o.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:o,...r}of Object.values(t.sizes)){p.sizes[r.id]={...r,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(i)){const e=n[t.retailerId];(null==e?void 0:e.shippingFulfillment)&&(p.sizes[r.id].shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}for(const t of Object.values(o)){const e=n[t.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(p.sizes[r.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const m=Object.values(p.sizes),f=this.findFirstAvailableSize(p.sizes);p.selectedSizeId=f||(null===(i=m[0])||void 0===i?void 0:i.id)||"";const g=(null===(r=p.sizes[p.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},v=(null===(s=p.sizes[p.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments)||{};p.productHasAvailability=Object.values(g).length+Object.values(v).length>0;const b=p.selectedFulfillmentType===o.SHIPPING?Object.values(g):Object.values(v);if(p.fulfillmentHasAvailability=b.length>0,p.selectedFulfillment=b[0]||null,p.selectedFulfillmentId=(null===(a=p.selectedFulfillment)||void 0===a?void 0:a.id)||null,!p.fulfillmentHasAvailability){const t=p.selectedFulfillmentType===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,e=t===o.SHIPPING?Object.values(g):Object.values(v);e.length>0&&(p.selectedFulfillmentType=t,p.selectedFulfillment=e[0],p.selectedFulfillmentId=(null===(c=p.selectedFulfillment)||void 0===c?void 0:c.id)||null,p.fulfillmentHasAvailability=!![])}if(!p.productHasAvailability){const e=splitCategoryPath(t.catPath),n=p.sizes[p.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:t.name,productBrand:t.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==n?void 0:n.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return p}catch(p){throw this.logger.error("Product data processing error",p),p}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),await this.cartCommands.resetCart(),await this.store.persist()}catch(n){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),n}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(e.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,n){try{const e=this.buildFormattedAddressString(t),i={id:"",formattedAddress:e,address:t,coordinates:n};await this.setSelectedAddress(i)}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:n,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",v),this.pubSub.publishAction(e.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var e,n,i,o,r,s;const a=[],c=[];(null===(e=t.one)||void 0===e?void 0:e.trim())&&c.push(t.one.trim()),(null===(n=t.two)||void 0===n?void 0:n.trim())&&c.push(t.two.trim()),c.length>0&&a.push(c.join(" ")),(null===(i=t.city)||void 0===i?void 0:i.trim())&&a.push(t.city.trim());const p=[];return(null===(o=t.state)||void 0===o?void 0:o.trim())&&p.push(t.state.trim()),(null===(r=t.zip)||void 0===r?void 0:r.trim())&&p.push(t.zip.trim()),p.length>0&&a.push(p.join(" ")),(null===(s=t.country)||void 0===s?void 0:s.trim())&&a.push(t.country.trim()),a.join(", ")}}const xt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},wt={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},kt={MIN:"0",MAX:"1000"},Ct={YES:"YES",NO:"NO"},St={IDLE:"idle",LOADING_INITIAL:"loading_initial",LOADING_MORE:"loading_more",ERROR:"error"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[xt.BRANDS]:m.BRANDS,[xt.CATEGORIES]:m.CATEGORIES,[xt.FLAVOR]:m.FLAVOR,[xt.REGION]:m.REGION,[xt.VARIETY]:m.VARIETY,[xt.VINTAGE]:m.VINTAGE,[xt.COUNTRY]:m.COUNTRY,[xt.APPELLATION]:m.APPELLATION,[xt.MATERIALS]:m.MATERIALS,[xt.SIZES]:m.SIZES,[xt.PRESALE]:m.PRESALE,[xt.ENGRAVING]:m.ENGRAVING,[xt.FULFILLMENT]:m.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(t,e)=>{var n;const i=this.getStoreState(),r=i.products.find(e=>(e.salsifyGrouping||e.id)===t),s=i.userProducts[t].selectedSizeId,a=r?Object.values(r.sizes).find(t=>t.id===s):void 0;if(!a)return;const c=e===o.SHIPPING?Object.values(a.shippingFulfillments):Object.values(a.onDemandFulfillments),p=c[0];if(!p)return;const m=p.variant,f=i.retailers,g=f[m.retailerId];if(!g)return;const v=e===o.SHIPPING?g.shippingFulfillment:g.onDemandFulfillment,b={...i.userProducts,[t]:{...i.userProducts[t],selectedFulfillmentType:e,selectedFulfillment:v?{...v,id:null!==(n=v.id)&&void 0!==n?n:"",retailerName:g.name,retailerAddress:g.address,retailerAddressFormatted:g.addressFormatted,variant:m,image:a.image}:null}};this.store.set("productsList.userProducts",b),this.notifyListeners()},this.selectFulfillment=async(t,e)=>{var n,i;const r=this.getStoreState(),s=r.products.find(e=>(e.salsifyGrouping||e.id)===t),a=r.userProducts[t].selectedSizeId,c=s?Object.values(s.sizes).find(t=>t.id===a):void 0;if(!c)return;const p=Object.values(c.shippingFulfillments||{}).find(t=>t.id===e),m=Object.values(c.onDemandFulfillments||{}).find(t=>t.id===e),f=p||m;if(!f)return;const g=p?o.SHIPPING:o.ON_DEMAND,v=null===(n=f.variant)||void 0===n?void 0:n.retailerId,b=v?r.retailers[v]:void 0;if(!b)return;const x=g===o.SHIPPING?b.shippingFulfillment:b.onDemandFulfillment,w={...r.userProducts,[t]:{...r.userProducts[t],selectedFulfillmentType:g,selectedFulfillment:x?{...x,id:null!==(i=x.id)&&void 0!==i?i:"",retailerName:b.name,retailerAddress:b.address,retailerAddressFormatted:b.addressFormatted,variant:f.variant,image:c.image}:null}};this.store.set("productsList.userProducts",w),this.notifyListeners()},this.selectSize=async(t,e)=>{var n;const i=this.getStoreState(),o=i.products.find(e=>(e.salsifyGrouping||e.id)===t);if(!o)return;const r=Object.values(o.sizes).find(t=>t.id===e);if(!r)return;const{fulfillment:s,fulfillmentType:a}=this.getFulfillmentForSize(r,i.userProducts[t].selectedFulfillmentType),c={...i.userProducts,[t]:{...i.userProducts[t],selectedSizeId:e,...a?{selectedFulfillmentType:a}:{},...s?{selectedFulfillment:s?{...s,image:null!==(n=s.image)&&void 0!==n?n:null}:null}:{}}};this.store.set("productsList.userProducts",c),this.notifyListeners()},this.updateQuantity=(t,e)=>{const n=this.getStoreState(),i={...n.userProducts,[t]:{...n.userProducts[t],selectedQuantity:e}};this.store.set("productsList.userProducts",i),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(t){this.listeners.add(t);const e=this.getStoreState();try{t(e)}catch(n){this.logger.error("Error in initial state listener call:",n)}return()=>{this.listeners.delete(t)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(t){this.store.set("productsList.searchTerm",t),this.notifyListeners()}setLoading(t){this.store.set("productsList.loading",t),this.notifyListeners()}notifyListeners(){const t=this.getStoreState();this.listeners.forEach(e=>{try{e(t)}catch(n){this.logger.error("Error in state listener:",n)}})}initializeProductFulfillment(t){const e=Object.values(t.sizes)[0];if(!e)return{sizeId:"",fulfillmentType:null,fulfillment:null};const n=e.id,i=Object.values(e.shippingFulfillments)[0];if(i)return{sizeId:n,fulfillmentType:"shipping",fulfillment:{...i,image:Object.values(t.sizes)[0].image}};const o=Object.values(e.onDemandFulfillments)[0];return o?{sizeId:n,fulfillmentType:"onDemand",fulfillment:{...o,image:t.sizes[0].image}}:{sizeId:n,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(t,e){return t.map(t=>this.transformSingleProduct(t,e))}transformSingleProduct(t,e){const n={...t,sizes:{}};if(!t.sizes||0===Object.values(t.sizes).length)return n;for(const[i,o]of Object.entries(t.sizes))n.sizes[i]=this.transformProductSize(o,e);return n}transformProductSize(t,e){const{shippingVariants:n,onDemandVariants:i,...o}=t,r={...o,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(r,n,e),this.addOnDemandFulfillments(r,i,e),r}addShippingFulfillments(t,e,n){if(e)for(const i of Object.values(e)){const e=n[i.retailerId];(null==e?void 0:e.shippingFulfillment)&&(t.shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:i})}}addOnDemandFulfillments(t,e,n){if(e)for(const i of Object.values(e)){const e=n[i.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(t.onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:i})}}async loadInitialProducts(t,e,n,i,o){try{this.setLoading(!![]);const r=this.buildSearchParams(t,e,n,i,o),s=await this.getProductList(r),a=this.transformProductVariantsToFulfillments(s.products||[],s.retailers||{}),c={};a&&a.length>0&&a.forEach(t=>{var e;const n=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);c[n]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(e=i.fulfillment.image)&&void 0!==e?e:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":a,"productsList.retailers":s.retailers,"productsList.filters":s.navigation.filters,"productsList.pagination":this.updatePagination(s.navigation),"productsList.loading":![],"productsList.userProducts":c}),this.notifyListeners()}catch(r){throw this.logger.error("Error loading initial products:",r),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),r}}async loadMoreProducts(t,e,n,i){try{const o=this.getStoreState(),r=o.pagination;if(!r.hasMorePages)return;this.setLoading(!![]);const s=r.currentPage+1,a=this.buildSearchParams(s,t,e,n,i),c=await this.getProductList(a);if(c.products&&c.products.length>0){const t=o.products,e=o.retailers,n=o.userProducts,i=this.mergeRetailers(e,c.retailers||{}),r=this.transformProductVariantsToFulfillments(c.products,c.retailers||{}),s={...n};r.forEach(t=>{var e;const n=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);s[n]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(e=i.fulfillment.image)&&void 0!==e?e:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...t,...r],"productsList.retailers":i,"productsList.filters":c.navigation.filters,"productsList.pagination":this.updatePagination(c.navigation),"productsList.loading":![],"productsList.userProducts":s}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...r,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(o){throw this.logger.error("Error loading more products:",o),this.setLoading(![]),o}}async getProductList(t){t.location=this.getLocation();const e=await this.api.catalogSearch(t);return e.products&&e.products.length>0&&this.trackViewItemList(e.products),e}syncFiltersFromComponent(t){const e={};for(const[n,i]of Object.entries(t))null!=i&&(Array.isArray(i)?e[n]=i:e[n]="object"==typeof i?[JSON.stringify(i)]:[String(i)]);this.store.set("productsList.appliedFilters",e),this.notifyListeners()}getSanitizedFilters(t,e){return e&&0!==e.length?t.filter(t=>{const n=this.FILTER_TYPE_MAP[t.type];return n&&e.includes(n)}):[]}buildSearchParams(t,e,n,i,o){const r={page:t,perPage:e,filters:this.buildFilters(i,o)};return n&&n.trim().length>0&&(r.search=n.trim()),r}buildFilters(t,e){const n=[];return this.addToggleFilters(n,t,e),this.addPriceFilter(n,t,e),this.addDynamicFilters(n,t,e),n}addToggleFilters(t,e,n){this.addEngravingFilter(t,e,n),this.addPresaleFilter(t,e,n),this.addFulfillmentFilter(t,e,n)}getBooleanFilterValue(t){return"boolean"==typeof t?t:Array.isArray(t)&&t.length>0?"true"===t[0]:"string"==typeof t?"true"===t:![]}addEngravingFilter(t,e,n){if(n.includes(m.ENGRAVING)){const n=this.getBooleanFilterValue(e[xt.ENGRAVING]);t.push({key:xt.ENGRAVING,values:[n?Ct.YES:Ct.NO]})}}addPresaleFilter(t,e,n){if(n.includes(m.PRESALE)){const n=this.getBooleanFilterValue(e[xt.PRESALE]);t.push({key:xt.PRESALE,values:[n?Ct.YES:Ct.NO]})}}addFulfillmentFilter(t,e,n){if(n.includes(m.FULFILLMENT)){const n=e[xt.FULFILLMENT],i=Array.isArray(n)?n[0]:n||wt.ALL,o=i===wt.ALL?[wt.ON_DEMAND,wt.SHIPPING]:[i];t.push({key:xt.FULFILLMENT,values:o})}}addPriceFilter(t,e,n){var i,o,r,s;n.includes(m.PRICE)&&t.push({key:xt.PRICE,values:{min:null!==(o=null===(i=e.price)||void 0===i?void 0:i.min)&&void 0!==o?o:kt.MIN,max:null!==(s=null===(r=e.price)||void 0===r?void 0:r.max)&&void 0!==s?s:kt.MAX}})}addDynamicFilters(t,e,n){const i=[xt.PRICE,xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT],o=Object.keys(e).filter(t=>!i.includes(t)),r=new Set;for(const a of o)t.push({key:a,values:e[a]}),r.add(a);const s=this.getFilterKeyToTypeMap();for(const a of n){const e=s[a];!e||r.has(e)||i.includes(e)||t.push({key:e,values:[]})}}setGridConfig(t,e){this.store.set("productsList.gridConfig",{rows:t,columns:e})}getItemsPerPage(){const t=this.getStoreState(),e=t.gridConfig;return e?e.rows*e.columns:16}updatePagination(t){var e,n,i,o,r;return t?{currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,totalCount:null!==(i=t.totalCount)&&void 0!==i?i:0,hasMorePages:(null!==(o=t.currentPage)&&void 0!==o?o:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(t,e){const n={...t};for(const[i,o]of Object.entries(e))n[i]||(n[i]=o);return n}extractProductCardData(t,e){const n=Object.values(t.sizes)[0];if(!n)return this.logger.warn("Product "+t.id+" has no sizes"),null;const i=Object.values(n.shippingFulfillments),o=Object.values(n.onDemandFulfillments),r=i[0],s=o[0],a=(null==r?void 0:r.variant)||(null==s?void 0:s.variant);if(!a)return this.logger.warn("Product "+t.id+" has no variants"),null;const c=e[a.retailerId];return c?{product:t,retailer:c}:(this.logger.warn("Retailer "+a.retailerId+" not found for product "+t.id),null)}getFilterKeyToTypeMap(){const t={};for(const[e,n]of Object.entries(this.FILTER_TYPE_MAP))t[n]=e;return t}async addToCart(t){try{this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(t)}catch(e){throw this.logger.error("Error adding product to cart from product list",e),e}}async addPresaleToCart(t){try{await this.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout()}catch(e){throw this.logger.error("Error adding presale product to checkout from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=this.getStoreState(),n=this.transformProductVariantsToFulfillments(t,e.retailers),i=n.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(e){this.logger.error("Error tracking view_item_list event",e)}}trackSelectItem(t){try{const e=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking select_item event",e)}}convertProductToBaseItem(t){var e,n;const i=null===(e=t.sizes)||void 0===e?void 0:e[0],o=null==i?void 0:i.shippingFulfillments[Object.keys(i.shippingFulfillments)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==o?void 0:o.variant.price)?centToDollar(o.variant.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==i?void 0:i.image)||(null===(n=t.images)||void 0===n?void 0:n[0]),upc:null==i?void 0:i.upc,grouping_id:t.salsifyGrouping,product_id:null==i?void 0:i.id,item_list_id:"product_list",item_list_name:"Product List"}}openProductListModal(t,e,n){const i={type:e,data:n};this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:!![],["productsList.userProducts."+t+".modal.contentConfig"]:i}),this.notifyListeners()}closeProductListModal(t){this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:![],["productsList.userProducts."+t+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(t,e){const n=Object.values(t.shippingFulfillments||{}),i=Object.values(t.onDemandFulfillments||{}),r=n[0],s=i[0];return e===o.SHIPPING&&r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:e===o.ON_DEMAND&&s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,n=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const e of Object.keys(c.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const p={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.items))p["cart.items."+e.id]=e;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const e of Object.values(t.retailers))if(p["cart.retailers."+e.id]=e,(null===(s=Object.values(e.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(e.fulfillments))p["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(p["cart.events"]=t.events),this.store.batch(p),n){const t=this.store.get("cart"),n=this.buildCartLoadedEventData(t);this.pubSub.publishAction(e.CART_LOADED,n)}}buildCartLoadedEventData(t){var e,n;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const e=t.items[r];o[r]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){const n=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",n);const i=this.store.get("cart.id");this.pubSub.publishAction(e.CART_FAILED,{cartId:i,message:n}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.o=Object.freeze(t),this.l=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const i=this.o[n];return null==i?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(i)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.l.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(i){this.logger.error("Component setup error in "+((null===(n=this.l)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),i=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(i)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;null===(e=this.beforeAutoDestroy)||void 0===e?void 0:e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.l.tagName,e),e instanceof Error&&this.captureComponentError(e,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.o)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),i="store:["+n+"]",o=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);o!==![]&&this.triggerRender(i)}catch(i){this.logger.error("Store watcher callback error in "+((null===(n=this.l)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.l)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.o)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(i){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.l)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.l)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const o=performance.now()-n;this.logRenderInfo(o);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(i){this.logger.error("❌ afterRender hook error in "+this.l.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(o){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.l.tagName,o),this.captureComponentError(o,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.l.type,message:o instanceof Error?o.message:String(o)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,o,"render")}catch(r){this.logger.error("❌ onError hook error in "+this.l.tagName,r)}}}logRenderInfo(t){const e=this.l.type,n=this.l.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.l.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.l.tagName+":"+e,component:{type:this.l.type,tagName:this.l.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.l.useShadowDom}})}catch(i){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.o}get config(){return this.themeProvider.getComponentConfig(this.l.type)}get elementConfig(){return this.l}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}const createAddToCartButton=({isPresale:t,hasAvailability:e,state:n,disabled:i=![],borderRadius:o,hasAddress:r,onClick:s})=>{const a=document.createElement("button");return a.type="button",a.className="plc__button "+o,a.disabled=r&&(i||!e),a.textContent=t?"Pre Order":r?e?"Add to Cart":"Not Available In "+n.toUpperCase():"Buy Now",s&&a.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await s(t)}),a},createFulfillmentSection=t=>{const{shippingVariants:e,onDemandVariants:n,enableShippingFulfillment:i,enableOnDemandFulfillment:r,selectedFulfillmentType:s,selectedFulfillmentRetailerName:a,productId:c,onDeliveryOptionsClick:p}=t,m=document.createElement("div");m.className="plc__fulfillment-wrapper";const f=document.createElement("span");f.className="plc__fulfillment-text",f.textContent=s===o.SHIPPING?"Ships from: "+(a||""):"Delivered from: "+(a||""),m.appendChild(f);const g=Object.values(e),v=Object.values(n),b=(i?g.length:0)+(r?v.length:0),x=document.createElement("button");return x.className="plc__fulfillment-delivery",x.textContent="Delivery Options ("+b+")",x.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),0!==b&&await p(c)}),m.appendChild(x),m},createQuantitySelector=({initialQuantity:t,minQuantity:e,maxQuantity:n,cornerRadius:i,cardStyle:o,onChange:r})=>{let s=t;const a=document.createElement("div");a.className="plc__quantity-container";const c=document.createElement("button");c.type="button",c.className="quantity-decrease "+i+" "+o,c.textContent="-",c.setAttribute("aria-label","Decrease quantity");const p=document.createElement("span");p.className="quantity-text "+o,p.textContent=s.toString(),p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true");const m=document.createElement("button");m.type="button",m.className="quantity-increase "+i+" "+o,m.textContent="+",m.setAttribute("aria-label","Increase quantity");const j=t=>{const i=t>e,o=t<n;i?(c.disabled=![],c.classList.remove("disabled")):(c.disabled=!![],c.classList.add("disabled")),o?(m.disabled=![],m.classList.remove("disabled")):(m.disabled=!![],m.classList.add("disabled"))},d=t=>{s=Math.max(e,Math.min(n,t)),p.textContent=s.toString(),j(s),null==r||r(s)},P=t=>{t.preventDefault(),t.stopPropagation(),s>e&&d(s-1)},l=t=>{t.preventDefault(),t.stopPropagation(),s<n&&d(s+1)};return c.addEventListener("click",P),m.addEventListener("click",l),j(s),a.appendChild(c),a.appendChild(p),a.appendChild(m),a},ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:e=24,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckIcon=({width:t=12,height:e=12,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M11.8047 0.195262C12.0651 0.455612 12.0651 0.877722 11.8047 1.13807L4.4714 8.4714C4.21106 8.73175 3.78894 8.73175 3.5286 8.4714L0.195262 5.13807C-0.0650874 4.87772 -0.0650874 4.45561 0.195262 4.19526C0.455612 3.93491 0.877722 3.93491 1.13807 4.19526L4 7.05719L10.8619 0.195262C11.1223 -0.0650874 11.5444 -0.0650874 11.8047 0.195262Z" fill="#18181B"/>\n </svg>\n '},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+o+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+o+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '},createProductSizesList=({sizes:t,selectedSize:e,cornerRadius:n,onSelect:i})=>{let o=e;const r=document.createElement("div");r.className="plc__dropdown-size-wrapper "+n;const s=document.createElement("button");s.type="button",s.className="plc__dropdown-default-size-wrapper";const a=document.createElement("span");a.className="plc__dropdown-size-text",a.textContent=o.size;const c=document.createElement("span");c.className="plc__dropdown-chevron",c.innerHTML=ChevronDownIcon({className:"chevron-down-icon"}),c.style.display="none";const p=document.createElement("span");p.className="plc__dropdown-check",p.innerHTML=CheckIcon({className:"check-icon"}),s.appendChild(a),s.appendChild(c),s.appendChild(p),r.appendChild(s);const m=Object.values(t);if(m.length<=1)return s.setAttribute("aria-haspopup","false"),s.setAttribute("aria-expanded","false"),s.disabled=!![],c.style.display="none",p.style.display="flex",r;s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-expanded","false");const f=document.createElement("div");f.className="plc__sizes-list "+n,f.setAttribute("role","listbox");const L=()=>{r.classList.remove("expanded"),s.setAttribute("aria-expanded","false"),c.style.display="none",p.style.display="flex"},openDropdown=()=>{r.classList.add("expanded"),s.setAttribute("aria-expanded","true"),c.style.display="flex",p.style.display="none"},j=()=>r.classList.contains("expanded"),d=()=>{f.innerHTML="",m.forEach(t=>{const e=document.createElement("div");e.className="plc__size-option",e.setAttribute("role","option");const n=(null==o?void 0:o.id)===t.id;e.setAttribute("aria-selected",String(n));const r=document.createElement("span");if(r.className="plc__size-option-text",r.textContent=t.size,e.appendChild(r),n){const t=document.createElement("span");t.className="plc__size-option-check",t.innerHTML=CheckIcon({width:16,height:16,className:"check-icon"}),e.appendChild(t)}e.addEventListener("click",e=>{e.stopPropagation(),o=t,a.textContent=t.size,null==i||i(t),d(),L()}),f.appendChild(e)})};d(),r.appendChild(f),s.addEventListener("click",t=>{t.stopPropagation(),j()?L():openDropdown()});const P=t=>{const e=t.target;e&&(r.contains(e)||L())};return document.addEventListener("click",P),r};class ProductListCardComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress","productsList.userProducts"]}),this.selectedSize=null,this.DESKTOP_BREAKPOINT=1024}get hostClasses(){return["product-list-card",this.config.layout.productCard.cornerRadius,""+this.config.layout.productCard.style]}async connected(){var t;null===(t=super.connected)||void 0===t?void 0:t.call(this);const e=this.params.product.salsifyGrouping||this.params.product.id||"";this.unsubscribeFromState=this.commands.productList.subscribe(t=>{var n,i;const o=t.userProducts[e];if(!o)return;const r=o.selectedFulfillment,s=o.selectedFulfillmentType;if(o){const t=Object.values(this.params.product.sizes).find(t=>t.id===o.selectedSizeId);t&&(null===(n=this.selectedSize)||void 0===n?void 0:n.id)!==t.id&&(this.selectedSize=t)}(r||s)&&this.reRender(),(null===(i=o.modal)||void 0===i?void 0:i.isOpen)&&this.reRender()})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0)}reRender(){const elements=this.template();this.innerHTML="";const t=document.createDocumentFragment();for(const e of elements)t.appendChild(e);this.appendChild(t)}getAvailabilityData(t){var e;const n=this.params.product,i=this.getStoreValue("address.address"),o={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==i?void 0:i.state)||"",isPresale:![],isPresaleActive:![]},r=t||Object.values(n.sizes)[0];if(!r)return o;const s=Object.values(r.shippingFulfillments||{}),a=s[0],c=null==a?void 0:a.variant;if(!c)return o;o.upc=r.upc;const p=r.attributes||{};return o.isPresale=(null===(e=p.presale)||void 0===e?void 0:e.isActive)===!![],o.isPresaleActive=this.isPresaleActive(p),this.params.shippingFulfillment&&c.shippingFulfillmentId===this.params.shippingFulfillment.id&&c.stock>0?(o.hasAvailability=!![],o.fulfillmentId=this.params.shippingFulfillment.id,o.partNumber=c.partNumber):this.params.onDemandFulfillment&&c.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&c.stock>0&&(o.hasAvailability=!![],o.fulfillmentId=this.params.onDemandFulfillment.id,o.partNumber=c.partNumber),o}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e||!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){var e,n,i;if(!t.hasAvailability)return;const o=this.params.product.salsifyGrouping||this.params.product.id||"",r=this.getStoreValue("productsList"),s=null===(e=r.userProducts[o])||void 0===e?void 0:e.selectedFulfillment,a=(null===(n=r.userProducts[o])||void 0===n?void 0:n.selectedQuantity)||1,c=(null==s?void 0:s.id)||t.fulfillmentId,p=(null===(i=null==s?void 0:s.variant)||void 0===i?void 0:i.partNumber)||t.partNumber;t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:c,partNumber:p,quantity:a,identifier:o}):await this.commands.productList.addToCart({fulfillmentId:c,partNumber:p,quantity:a,identifier:o}),this.commands.productList.updateQuantity(o,1)}template(){var t,e,n,i,o,r,s,a,c;const p=this.params.product,m=this.params.product.salsifyGrouping||this.params.product.id||"",f=this.getStoreValue("productsList"),g=null===(t=f.userProducts[m])||void 0===t?void 0:t.selectedSizeId,v=g?Object.values(p.sizes).find(t=>t.id===g):this.selectedSize||Object.values(p.sizes)[0];this.selectedSize=v||Object.values(p.sizes)[0];const b=null===(e=f.userProducts[m])||void 0===e?void 0:e.selectedFulfillment,x=(null===(n=f.userProducts[m])||void 0===n?void 0:n.selectedQuantity)||1,w=(null==b?void 0:b.image)||(null===(i=this.selectedSize)||void 0===i?void 0:i.image),S=p.name,E=this.selectedSize?this.selectedSize.size:null;let _=p.noAvailabilityPrice;if(null===(o=null==b?void 0:b.variant)||void 0===o?void 0:o.price)_=b.variant.price;else{const t=Object.values((null===(r=this.selectedSize)||void 0===r?void 0:r.shippingFulfillments)||{});_=null!==(a=null===(s=t[0])||void 0===s?void 0:s.variant.price)&&void 0!==a?a:p.noAvailabilityPrice}const F=_*x,I=this.getAvailabilityData(this.selectedSize),O=(null==b?void 0:b.variant.isEngravable)||![],R=p.sizes,M=null===(c=this.selectedSize)||void 0===c?void 0:c.maxQuantityPerOrder,elements=this.createVariantStandard({image:w,name:S,size:E,price:F,availability:I,hasPersonalization:O,sizes:R,maxQuantityPerOrder:M,shippingVariants:{},onDemandVariants:{}});return elements}generateProductUrl(){if(!this.params.productUrl)return null;const t=this.params.product,e=this.selectedSize||Object.values(t.sizes)[0],n=this.params.productUrl;if(n.includes("{upc}")){const t=(null==e?void 0:e.upc)||"";return t?n.replace("{upc}",t):null}if(n.includes("{grouping}")){const e=t.salsifyGrouping||"";return e?n.replace("{grouping}",e):null}return n}createVariantStandard(t){const{image:e,name:n,price:i,availability:o,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a}=t,c=this.params.product.salsifyGrouping||this.params.product.id||"",p=this.generateProductUrl();return[this.createImageSection(e,n,o,p),this.createContentSection({name:n,price:i,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a,availability:o,productId:c,productUrl:p})]}createImageSection(t,e,n,i){const o=document.createElement("div");o.className="plc__image-content";const r=document.createElement("div");r.className="plc__image-wrapper";const s=document.createElement("img");if(s.className="plc__image",s.src=t,s.alt=e,s.loading="lazy",r.appendChild(s),n.isPresale){const t=document.createElement("div");t.className="plc__presale-badge "+this.config.layout.productCard.cornerRadius,t.textContent="Pre-Order",r.appendChild(t)}if(o.appendChild(r),i){const t=document.createElement("a");return t.href=i,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(o),t}return o}createContentSection(t){const e=this.getStoreValue("address.formattedAddress"),n=!!(e&&e.trim().length>0),i=document.createElement("div");i.className="plc__content",this.config.layout.productCard.showCollections&&n&&i.appendChild(this.createBadgesSection()),i.appendChild(this.createTitleSection(t.name,t.productUrl));const o=this.createPricePersonalizationSection(t.price,t.hasPersonalization,n);return o&&i.appendChild(o),this.config.layout.productCard.showSizeSelector&&n&&i.appendChild(this.createSizesSection(t.sizes)),this.config.layout.productCard.showFulfillment&&n&&i.appendChild(this.createFulfillmentSectionWrapper(t.productId)),i.appendChild(this.createAddToCartSection(t.availability,t.maxQuantityPerOrder,n)),i}createBadgesSection(){const t=document.createElement("div");t.className="plc__badges-wrapper";const e=document.createElement("span");e.className="plc__badge-text",e.textContent="First Bottle Free",t.appendChild(e);const n=document.createElement("span");n.textContent="•",t.appendChild(n);const i=document.createElement("span");return i.className="plc__badge-text",i.textContent="Same-Day Delivery",t.appendChild(i),t}createTitleSection(t,e){const n=document.createElement("h3");if(n.className="plc__title",n.textContent=t,e){const t=document.createElement("a");return t.href=e,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(n),t}return n}createPricePersonalizationSection(t,e,n){const i=this.config.layout.productCard.showPrice,o=this.config.layout.productCard.enablePersonalization&&e;if(!i&&!o)return null;const r=document.createElement("div");if(r.className="plc__price-personalization-wrapper",i){const e=document.createElement("span");e.className="plc__price",e.textContent=formatCentToDollarText(t),r.appendChild(e)}if(o&&n){const t=document.createElement("span");t.className="plc__personalize",t.textContent="Personalize Bottle",r.appendChild(t)}return r}createSizesSection(t){return createProductSizesList({sizes:t,selectedSize:this.selectedSize||Object.values(t)[0],cornerRadius:this.config.layout.productCard.cornerRadius,onSelect:t=>{this.selectedSize=t;const e=this.params.product.salsifyGrouping||this.params.product.id||"";this.commands.productList.selectSize(e,t.id),this.reRender()}})}handleDeliveryOptionsClick(t){const e=window.innerWidth;e>=this.DESKTOP_BREAKPOINT?this.commands.ui.openModal(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config}):this.commands.ui.openDrawer(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config})}createFulfillmentSectionWrapper(t){var e,n;const i=this.getStoreValue("productsList"),o=this.params.product,r=this.selectedSize||Object.values(o.sizes)[0];return createFulfillmentSection({shippingVariants:(null==r?void 0:r.shippingFulfillments)||{},onDemandVariants:(null==r?void 0:r.onDemandFulfillments)||{},enableShippingFulfillment:this.config.layout.productCard.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.productCard.enableOnDemandFulfillment,selectedFulfillmentType:i.userProducts[t].selectedFulfillmentType,selectedFulfillmentRetailerName:(null===(n=null===(e=i.userProducts[t])||void 0===e?void 0:e.selectedFulfillment)||void 0===n?void 0:n.retailerName)||"",productId:t,onDeliveryOptionsClick:t=>this.handleDeliveryOptionsClick(t)})}createAddToCartSection(t,e,n){var o;const r=this.getStoreValue("productsList"),s=document.createElement("div");s.className="plc__add-to-cart-wrapper";const a=this.params.product.salsifyGrouping||this.params.product.id||"",c=(null===(o=r.userProducts[a])||void 0===o?void 0:o.selectedQuantity)||1;this.config.layout.productCard.showQuantityCounter&&n&&s.appendChild(createQuantitySelector({initialQuantity:c,minQuantity:1,maxQuantity:e,cornerRadius:this.config.layout.productCard.cornerRadius,cardStyle:this.config.layout.productCard.style,onChange:t=>this.commands.productList.updateQuantity(a,t)}));const p=createAddToCartButton({isPresale:t.isPresale,hasAvailability:t.hasAvailability,state:t.state,borderRadius:this.config.layout.productCard.cornerRadius,hasAddress:n,onClick:async()=>{n?await this.handleAddToCart(t):this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]})}});return t.hasAvailability||this.addHostClasses("not-available"),s.appendChild(p),s}}class ModalComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.modal"]}),this.isOpen=![],this.modalElement=null,this.contentContainer=null,this.currentContentType=null,this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.modalElement&&(this.modalElement.removeEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.removeEventListener("click",this.handleBackdropClick.bind(this))),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.modal"===t.path);if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Modal opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateModalContentTypeClass(e),this.open(),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Modal content loading failed",e),this.commands.ui.closeModal()}}open(){this.isOpen=!![],requestAnimationFrame(()=>{this.modalElement&&!this.modalElement.open&&this.modalElement.showModal()})}close(){var t;this.isOpen=![],(null===(t=this.modalElement)||void 0===t?void 0:t.open)&&this.modalElement.close(),this.cleanupCurrentContent()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleCancel(t){t.preventDefault(),this.commands.ui.closeModal()}handleBackdropClick(t){t.target===this.modalElement&&this.commands.ui.closeModal()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeModal()}updateModalContentTypeClass(t){if(!this.modalElement)return;const e=["modal"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.modalElement.className=e.join(" ")}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.modalElement=document.createElement("dialog"),this.modalElement.classList.add("modal"),this.modalElement.addEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("modal-content"),this.modalElement.appendChild(this.contentContainer),document.addEventListener("keydown",this.boundHandleKeydown),this.modalElement}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,e)=>t||e&&e.status>=500&&e.status<600?!![]:![],this.xhrFetch=(t,e)=>new Promise((n,i)=>{const o=new XMLHttpRequest;o.open(e.method||"GET",t);for(const[t,r]of Object.entries(e.headers))o.setRequestHeader(t,r);o.onload=()=>{const t={ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,i]=e.split(": ");return n&&i&&(t[n]=i),t},{}),h:o.responseText,json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)};n(t)},o.onerror=()=>{i(new TypeError("Network request failed"))},o.ontimeout=()=>{i(new TypeError("Network request timed out"))},o.timeout=3e4,o.send(e.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var e,n,i;const{url:o,options:r,retryConfig:s}=t,a=null!==(e=null==s?void 0:s.maxRetries)&&void 0!==e?e:3,c=null!==(n=null==s?void 0:s.retryDelay)&&void 0!==n?n:1e3,p=null!==(i=null==s?void 0:s.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let m;const f=Date.now();for(let v=0;v<=a;v++){let t=Date.now();try{t=Date.now();const e=await this.fetchImpl(o,r),n=Date.now()-t;if(e.ok)return e;if(await this.logFailedResponse(o,r,e,n,v,a),v<a&&p(null,e)){await this.delay(c*2**v);continue}return e}catch(g){const e=Date.now()-t;if(m=g,this.logNetworkError(o,r,g,e,v,a),v<a&&p(g,void 0)){await this.delay(c*2**v);continue}throw this.enhanceError(g,o,r,Date.now()-f)}}throw this.enhanceError(m,o,r,Date.now()-f)}async logFailedResponse(t,e,n,i,o,r){const s=o<r;let a,c;try{n.h||(n.h=await n.text());try{a=JSON.parse(n.h)}catch(p){a=n.h}}catch(m){a="[Unable to read response body]"}if(e.body)try{c=JSON.parse(e.body)}catch(f){c=e.body}this.logger.error("HTTP request failed",{method:e.method,url:t,status:n.status,statusText:n.statusText,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:s,requestHeaders:e.headers,requestBody:c,responseHeaders:n.headers,responseBody:a})}logNetworkError(t,e,n,i,o,r){var s;const a=o<r;this.logger.error("Network request failed",{method:e.method,url:t,error:n,errorType:(null===(s=null==n?void 0:n.constructor)||void 0===s?void 0:s.name)||typeof n,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:a,possibleCauses:this.diagnosePossibleCauses(n)})}diagnosePossibleCauses(t){var e,n,i,o,r;const s=[];return((null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timeout"))||(null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timed out")))&&s.push("Request timeout - server took too long to respond"),((null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("Failed to fetch"))||(null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Network request failed")))&&(s.push("Network connectivity issue"),s.push("CORS policy blocking the request"),s.push("Server is not responding"),s.push("Request was blocked by browser or firewall")),(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("aborted"))&&s.push("Request was aborted"),0===s.length&&s.push("Unknown network error"),s}enhanceError(t,e,n,i){const o=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return o.url=e,o.method=n.method,o.totalDuration=i+"ms",o.isNetworkError=!![],o.originalError=t,o.possibleCauses=this.diagnosePossibleCauses(t),o}delay(t){return new Promise(e=>setTimeout(e,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(e,n)=>{var i;const o=await t(e,n);let r;if("function"==typeof(null===(i=o.headers)||void 0===i?void 0:i.entries))r=Object.fromEntries(o.headers.entries());else{r={};for(const[t,e]of o.headers)r[t]=e}const s={ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:async()=>(s.h||(s.h=await o.text()),JSON.parse(s.h)),text:async()=>(s.h||(s.h=await o.text()),s.h)};return s}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(t,e)=>t?!![]:e&&this.isAuthError(e)?![]:e&&e.status>=500&&e.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticateAndGetConfigs(){var t,e,n,i,o,r,s,a,c;try{this.logger.info("Authenticating and fetching configurations in single request");const p=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(e=null===(t=null==p?void 0:p.data)||void 0===t?void 0:t.auth)||void 0===e?void 0:e.accessToken)&&(null===(i=null===(n=null==p?void 0:p.data)||void 0===n?void 0:n.auth)||void 0===i?void 0:i.expiration)?(null===(c=null==p?void 0:p.data)||void 0===c?void 0:c.configs)?(this.accessToken=p.data.auth.accessToken,this.tokenExpiration=p.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:{...p.data.configs,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==p?void 0:p.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(r=null===(o=null==p?void 0:p.data)||void 0===o?void 0:o.auth)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(a=null===(s=null==p?void 0:p.data)||void 0===s?void 0:s.auth)||void 0===a?void 0:a.expiration),response:null==p?void 0:p.data}),{success:![]})}catch(p){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:p,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers})}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}async performAuthentication(){var t,e,n,i;try{const o=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:o,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,e,n,i;try{this.logger.info("Attempting to refresh access token");const o=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:o,status:null==o?void 0:o.status,endpoint:"/auth/refresh"}),![]}}async request(t,e,n=![],i=![]){if(!n&&!i&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const o=this.buildUrl(t),r=this.buildHeaders(e.headers,n),s=await this.httpClient.request({url:o,options:{method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return s.ok?this.handleSuccessResponse(s,t,e.method):!this.isAuthError(s)||n||i?this.handleErrorResponse(s):this.handleAuthError(s,t,e)}async handleSuccessResponse(t,e,n){try{return await t.json()}catch(i){const o=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:e,method:n,status:t.status,responsePreview:o.substring(0,1e3),error:i}),{message:o}}}async handleAuthError(t,e,n){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:e,method:n.method});let i=await this.refreshToken();return i||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),i=await this.authenticate()),i?this.request(e,n,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:e,method:n.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let e;try{e=await t.json()}catch(n){const i=await t.text().catch(()=>"HTTP error status: "+t.status);e={message:i||"Unknown error"}}throw{...e,status:t.status,message:(null==e?void 0:e.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}buildHeaders(t,e=![]){const n={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return e?n["X-Liquid-Api-Key"]=this.apiKey:n.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(n["X-Liquid-Api-Builder"]="true"),n}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;class BaseActionService{constructor(t){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get(t)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}class ClientAddressActionService extends BaseActionService{constructor(){super("AddressAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientAddressActionService",()=>new ClientAddressActionService)}get actions(){return{setAddressByPlacesId:this.setAddressByPlacesId.bind(this),setAddressManually:this.setAddressManually.bind(this),clear:this.clear.bind(this),getDetails:this.getDetails.bind(this)}}async setAddressByPlacesId(t){try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}}async setAddressManually(t,e){try{if(!t||!e)throw new SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof e.latitude||"number"!=typeof e.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.latitude+", long: "+typeof e.longitude,!![]);if(e.latitude<-90||e.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.latitude,!![]);if(e.longitude<-180||e.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.longitude,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}}async clear(){await this.command.address.clearSelectedAddress()}getDetails(){return this.command.address.getDetails()}}class ClientCartActionService extends BaseActionService{constructor(){super("CartAction"),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.command=CommandService.getInstance(),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientCartActionService",()=>new ClientCartActionService)}get actions(){return{openCart:this.openCart.bind(this),closeCart:this.closeCart.bind(this),toggleCart:this.toggleCart.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),resetCart:this.resetCart.bind(this),getDetails:this.getDetails.bind(this)}}setupAddressUpdateListener(){const y=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+e.ADDRESS_UPDATED,y)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}openCart(){this.command.ui.openDrawer(i.CART)}closeCart(){this.command.ui.closeDrawer()}toggleCart(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CART)}async addProduct(t,n){var r,s;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const e of t){if(!e.identifier||"string"!=typeof e.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(e.fulfillmentType||(e.fulfillmentType=o.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==o.SHIPPING&&e.fulfillmentType!==o.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+e.fulfillmentType+'" for product "'+e.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(e.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+e.identifier+'"',!![])}const a=this.getLocation();if(void 0===a)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=n?n:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(i.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(i.CART);const c=[...new Set(t.map(t=>t.identifier))],p=await this.api.getProductsData(c,a);if(!p||!p.products||0===p.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const e of t){let t=null;for(let o=0;o<p.products.length;o++){const n=p.products[o];let i=![];const r=Object.values(n.sizes);for(let t=0;t<r.length;t++){const o=r[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){i=!![];break}}if(i){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=Object.values(t.sizes)[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(s=null===(r=null==n?void 0:n.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let i=null;const a=e.fulfillmentType===o.SHIPPING?n.shippingVariants:n.onDemandVariants,c=Object.values(a);for(let e=0;e<c.length;e++)if(c[e]){i=c[e];break}if(!i){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const m=e.fulfillmentType===o.ON_DEMAND?i.onDemandFulfillmentId:i.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:m,partNumber:i.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation();const m=this.store.get("cart.id");this.pubSub.publishAction(e.CART_PRODUCT_ADD_SUCCESS,{cartId:m,itemsAdded:t.length,identifiers:c}),this.logger.info("Products added to cart successfully:",c)}catch(a){this.logger.error("Error adding products to cart:",a),this.clearPendingCartOperation();const n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{cartId:n,identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}}async applyPromoCode(t){try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const n=t.trim().toUpperCase(),i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const r=this.store.get("cart.promoCode");if(r&&r.code===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const s=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{cartId:s.cartId,discount:s.promoCodeDiscount||0,newSubtotal:s.subtotal}),this.logger.info("Promo code applied successfully")}catch(n){this.logger.error("Failed to apply promo code:",n);const t=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),n}}async removePromoCode(){try{const t=this.themeProvider.getConfigs("global"),n=t.layout.allowPromoCodes;if(!n)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_REMOVED,{cartId:i.cartId,newSubtotal:i.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}}async resetCart(){await this.command.cart.resetCart(),this.pubSub.publishAction(e.CART_RESET,!![])}getDetails(){return this.command.cart.getDetails()}}const Et="lce-checkout-stripe-slot",_t={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Pt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},Ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientCheckoutActionService extends BaseActionService{constructor(){super("CheckoutAction"),this.allowedCustomerFields=new Set(Object.values(_t)),this.allowedBillingFields=new Set(Object.values(Ft)),this.allowedGiftFields=new Set(Object.values(Pt)),this.cartActionsAddProduct=null,this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientCheckoutActionService",()=>new ClientCheckoutActionService)}setCartActionsAddProduct(t){this.cartActionsAddProduct=t}get actions(){return{openCheckout:this.openCheckout.bind(this),closeCheckout:this.closeCheckout.bind(this),toggleCheckout:this.toggleCheckout.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),applyGiftCard:this.applyGiftCard.bind(this),removeGiftCard:this.removeGiftCard.bind(this),toggleIsGift:this.toggleIsGift.bind(this),toggleBillingSameAsShipping:this.toggleBillingSameAsShipping.bind(this),toggleMarketingPreferences:this.toggleMarketingPreferences.bind(this),updateCustomerInfo:this.updateCustomerInfo.bind(this),updateBillingInfo:this.updateBillingInfo.bind(this),updateGiftInfo:this.updateGiftInfo.bind(this),getDetails:this.getDetails.bind(this)}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}openCheckout(){this.command.ui.openDrawer(i.CHECKOUT)}closeCheckout(){this.command.ui.closeDrawer()}toggleCheckout(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)}async addProduct(t,n){var r;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const s=t.map(t=>t.identifier);if(this.cartActionsAddProduct)await this.cartActionsAddProduct(t);else for(const e of t){const t=this.getLocation();if(!t)throw new SDKError("Location is required to add products to checkout",!![]);const n=await this.api.getProductsData([e.identifier],t);if(!(null===(r=null==n?void 0:n.products)||void 0===r?void 0:r[0])){this.logger.warn("No product data found for identifier: "+e.identifier);continue}const i=n.products[0],s=Object.values(i.sizes)[0];if(!s)continue;const a=e.fulfillmentType===o.SHIPPING?s.shippingVariants:s.onDemandVariants,c=Object.values(a)[0];if(!c)continue;const p=e.fulfillmentType===o.ON_DEMAND?c.onDemandFulfillmentId:c.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:p,partNumber:c.partNumber,quantity:e.quantity,identifier:e.identifier})}await this.command.checkout.loadCheckout({});const a=this.store.get("cart.id");this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:a,itemsAdded:t.length,identifiers:s}),this.logger.info("Products added to checkout successfully:",s)}catch(s){this.logger.error("Error adding products to checkout:",s);const n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to checkout"}),s}}async applyPromoCode(t){var n;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const s=this.store.get("checkout.promoCode");if(s&&s.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const a=this.store.get("checkout"),c=a.promoCode;this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{cartId:a.cartId,discount:(null==c?void 0:c.discount)||0,newTotal:(null===(n=null==a?void 0:a.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){this.logger.error("Failed to apply checkout promo code:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),i}}async removePromoCode(){var t;try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_REMOVED,{cartId:o.cartId,newTotal:(null===(t=null==o?void 0:o.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove checkout promo code:",n),n}}async applyGiftCard(t){var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{cartId:r.cartId,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){this.logger.error("Failed to apply gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),i}}async removeGiftCard(t){var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_REMOVED,{cartId:r.cartId,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){this.logger.error("Failed to remove gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),i}}async toggleIsGift(t){await this.command.checkout.toggleIsGift(t)}async toggleBillingSameAsShipping(t){await this.command.checkout.toggleBillingSameAsShipping(t)}async toggleMarketingPreferences(t,e){await this.command.checkout.toggleMarketingPreferences(t,e)}updateCustomerInfo(t){const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t)){if(!this.allowedCustomerFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(i);n===_t.addressTwo?e["checkout.shippingAddress.address.two"]=t:e["checkout.customerForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(e)}updateBillingInfo(t){const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t))this.allowedBillingFields.has(n)&&(e["checkout.paymentForm.data."+n]=this.normalizeCheckoutFieldValue(i));if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(e)}updateGiftInfo(t){const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t)){if(!this.allowedGiftFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(i);n===Pt.addressTwo?e["checkout.shippingAddress.address.two"]=t:e["checkout.giftRecipientForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(e)}getDetails(){return this.command.checkout.getDetails()}}class ClientProductActionService extends BaseActionService{constructor(){super("ProductAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientProductActionService",()=>new ClientProductActionService)}get actions(){return{getDetails:this.getDetails.bind(this)}}getDetails(t){if(!t||""===t.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(t)}catch(e){throw this.logger.error('Unable to retrieve product details for identifier "'+t+'"',e),new SDKError('Product "'+t+'" has not been loaded yet.',!![])}}}class ClientActionService{constructor(){this.productActionService=ClientProductActionService.getInstance(),this.addressActionService=ClientAddressActionService.getInstance(),this.cartActionService=ClientCartActionService.getInstance(),this.checkoutActionService=ClientCheckoutActionService.getInstance(),this.checkoutActionService.setCartActionsAddProduct(this.cartActionService.actions.addProduct)}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}get actions(){return{product:this.productActionService.actions,address:this.addressActionService.actions,cart:this.cartActionService.actions,checkout:this.checkoutActionService.actions}}}const It="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",Dt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,e=t.instances;if(e)for(const[i,o]of e)this.interceptLoggerInstance(o,i);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.u)return;const n=t.debug.bind(t),i=t.info.bind(t),o=t.warn.bind(t),r=t.error.bind(t),C=(t,n,i)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:i,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(C("debug",t,e))},t.info=(t,e)=>{i(t,e),this.addLogEntry(C("info",t,e))},t.warn=(t,e)=>{o(t,e),this.addLogEntry(C("warn",t,e))},t.error=(t,e)=>{r(t,e),this.addLogEntry(C("error",t,e))},t.u=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,i)=>{e(t,n,i),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:i,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(Dt);t&&t.remove(),this.panelElement=document.createElement(Dt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),e=document.createElement("style");e.textContent=It,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const i=this.createToggles();this.panelContainer.appendChild(i),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const o=this.createResizeHandle();this.panelContainer.appendChild(o),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const i=document.createElement("div");i.className="title",i.textContent="Elements Debug Console";const o=document.createElement("div");o.className="subtitle",o.textContent="Live SDK logs, events & GTM tracking",n.appendChild(i),n.appendChild(o);const r=document.createElement("button");return r.className="minimize",r.innerHTML="−",r.title="Minimize debug panel",r.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(r),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];e.forEach(({key:e,label:n,description:i,color:o})=>{const r=document.createElement("label");r.className="toggle",r.title=i;const s=document.createElement("input");s.type="checkbox",s.checked="showLogs"!==e,s.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const a=document.createElement("span");a.textContent=n,a.style.color=o,r.appendChild(s),r.appendChild(a),t.appendChild(r)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,i=0,o=0,r=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,i=t.clientY,o=Number.parseInt(this.panelElement.style.width,10)||500,r=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",A),document.addEventListener("mouseup",z),t.preventDefault()});const A=t=>{if(!e||!this.panelElement)return;const s=t.clientX-n,a=t.clientY-i,c=window.innerWidth<=768,p=window.innerWidth<=480;let m,f,g,v;p?(m=280,f=window.innerWidth-20,g=200,v=.4*window.innerHeight):c?(m=300,f=window.innerWidth-30,g=200,v=.4*window.innerHeight):(m=300,f=800,g=200,v=600);const b=Math.max(m,Math.min(f,o+s)),x=Math.max(g,Math.min(v,r+a));this.panelElement.style.width=b+"px",this.panelElement.style.height=x+"px"},z=()=>{e=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,i=0,o=0,r=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,i=e.clientY;const s=this.panelElement.getBoundingClientRect();o=s.left,r=s.top,document.addEventListener("mousemove",A),document.addEventListener("mouseup",z),e.preventDefault()});const A=e=>{if(!t||!this.panelElement)return;const s=e.clientX-n,a=e.clientY-i;this.panelElement.style.left=o+s+"px",this.panelElement.style.top=r+a+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},z=()=>{t=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.m()){const e=this.v(t);if(e)return this.k(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.C()),this.k(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.S(),browser:this._(),timezone:this.P()}}isLocalStorageWebApiAvailable(){return this.m()}k(t,e){return(t+"_"+e).toLowerCase()}m(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,e="__localStorage_test_"+Date.now()+"__",n="test";t.setItem(e,n);const i=t.getItem(e);return i!==n?(this.isLocalStorageAvailable=![],![]):(t.removeItem(e),this.isLocalStorageAvailable=!![],!![])}catch(t){const n=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(n)try{const t=window.localStorage;return t&&t.length>0?(this.F()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(e){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const e={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},n=e[t.name]||"Storage error: "+t.name,i=this.F()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}v(t){try{const e=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}C(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.I(e)}S(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.D(),o=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(bt){}return"srgb"}_(){var t;try{const e=navigator,n=[],i=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(i),n.push(e.hardwareConcurrency||4);const o=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(o),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.T()),n.push(this.F()?"webview":"browser");const r=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(r.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}T(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}F(){try{const t=navigator.userAgent.toLowerCase(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}P(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}I(t){const e=16777619;let n=2166136261,i=2166136261,o=2166136261,r=2166136261;for(let s=0;s<t.length;s++){const a=t.charCodeAt(s);n^=a,n=Math.imul(n,e),i^=a<<1,i=Math.imul(i,e),o^=a<<2,o=Math.imul(o,e),r^=a<<3,r=Math.imul(r,e)}return n=Math.abs(n),i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),n.toString(16)+i.toString(16)+o.toString(16)+r.toString(16)}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const r=this.getStoreValue("address"),s=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],a=null!==(e=this.params.productId)&&void 0!==e?e:"",c=null!==(n=this.params.options)&&void 0!==n?n:{},p=null!==(o=c.showLabel)&&void 0!==o?o:!![],elements=[];if(p){const t=document.createElement("span");t.textContent="Delivers to:",elements.push(t)}const m=document.createElement("button");m.type="button",m.textContent=r.formattedAddress||"Select an address";const f=r.formattedAddress?"Change delivery address, currently set to "+r.formattedAddress:"Select delivery address";return m.setAttribute("aria-label",f),m.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,i.ADDRESS_INPUT,{productId:a}))}),elements.push(m),elements}}class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");e.value=n;const i=n.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(i);if(i.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(bt){this.logger.error("Address edit cancellation failed",bt)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const i=this.getConfigs("global"),o=null!==(t=this.params.options)&&void 0!==t?t:{},r=null!==(e=o.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),r){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const s=this.createElement("div",{className:"input-wrapper "+i.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),s.appendChild(this.inputElement);const a=this.createElement("span");a.className="input-icon",a.innerHTML=SearchIcon({width:16,height:16,className:""}),s.appendChild(a),this.inputContainer.appendChild(s),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const c=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),p=[this.inputContainer,c,this.errorContainer],m=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();m.appendChild(f);const g=this.createCheckButton();return m.appendChild(g),p.push(m),document.addEventListener("click",this.handleDocumentClick),p}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const elements=[],t=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!t){const t=ComponentFactoryService.createElement({type:i.CART_HEADER});elements.push(t)}const e=ComponentFactoryService.createElement({type:i.CART_BODY});elements.push(e);const n=ComponentFactoryService.createElement({type:i.CART_FOOTER});return elements.push(n),elements}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=this.config.layout.drawerHeaderText,e=document.createElement("div");e.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your "+t.toLowerCase()+" is empty",e.appendChild(n),e}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:i.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const i=this.createRetailerElement(e);i.setAttribute("data-retailer-id",t),n.replaceWith(i)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,i]of Object.entries(t))i&&"object"==typeof i&&i.id&&(e[n]=i);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),i=this.getValidRetailerIds(e.oldValue),o=this.getValidRetailerIds(e.value),r=i.size,s=o.size,a=this.getValidRetailers(this.getStoreValue("cart.retailers")),c=Object.keys(a).length;if(s>0&&0===c)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===r&&s>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(r>0&&0===s)this.showEmptyCartState();else if(s>0){for(const t of i)o.has(t)||this.removeRetailerElement(t);for(const e of o){const o=n[e],r=t[e];i.has(e)?this.hasRetailerDataChanged(r,o)&&this.updateRetailerElement(e,o):this.addRetailerElement(e,o)}}else 0===r&&0===s&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const i of e){const t=this.createRetailerElement(i);t.setAttribute("data-retailer-id",i.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.subtotal")),i=t.some(t=>t.path.includes("cart.fulfillments")),o=t.some(t=>"cart.loading"===t.path),r=t.some(t=>t.path.includes("cart.retailers"));e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(i||n||o||e||r)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const i=this.getStoreValue("cart.fulfillments")||{},o=Object.values(i).some(t=>t.updating);if(o)return!![];const r=this.getStoreValue("cart.retailers")||{},s=Object.values(r).some(t=>t.updating);return s?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),i=t||n||!e;this.checkoutButton.disabled=i,this.checkoutButton.classList.toggle("checkout-btn-disabled",i),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.subtotal"),elements=[],n=document.createElement("div");n.className="cart-footer-header";const o=document.createElement("div");o.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",o.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e),o.appendChild(this.subtotalPrice);const r=document.createElement("p");if(r.textContent="Taxes & fees will be calculated at checkout",r.className="taxes-fees-info",n.appendChild(o),n.appendChild(r),elements.push(n),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:i.CART_PROMO_CODE});elements.push(t)}const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(elements.push(s),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),elements.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const i of n)if(!o.has(i)){const t=this.container.querySelector('[data-item-id="'+i+'"]');t&&t.remove()}for(const r of o)if(!n.has(r)){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:o});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t),n=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(n&&n.remove(),null==e?void 0:e.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.itemIds)||void 0===t?void 0:t.length)?n.itemIds.some(t=>this.getStoreValue("cart.items."+t+".updating")):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,i=t.find(t=>t.path===n),o=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(o.length>0&&this.checkAndUpdateLoadingState(),i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.itemIds)||[],o=(null==e?void 0:e.itemIds)||[],r=JSON.stringify(n)!==JSON.stringify(o);r&&(this.handleItemsUpdate(n,o),this.checkAndUpdateLoadingState());const s=(null==t?void 0:t.subtotal)!==(null==e?void 0:e.subtotal),a=this.hasFulfillmentDataChanged(t,e,["itemIds","updating"]);if(s&&!a&&this.setupMinimumPurchaseAlert(),!a)return![]}return![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const i=["type","canEngrave"];for(const o of i)if(!n.includes(o)&&t[o]!==e[o])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const Tt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},At="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=Tt[e];return n||At}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return At}}function getCurrentTimeInTimezone(t){try{const e=new Date,n=e.getTime(),i=6e4*e.getTimezoneOffset(),o=new Date(n+i),r=new Date(o.toLocaleString("en-US",{timeZone:t})),s=o.getTime()-r.getTime();return new Date(n+s)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),o=!e||t>=new Date(e),r=!n||t<=new Date(n);return o&&r}catch(o){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const o=this.config.layout.drawerHeaderText,r=this.getConfigs("global"),s=document.createElement("div");s.className="cart-header-content";const a=document.createElement("h2");a.className="cart-title",a.textContent=o,s.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cart-header-close-btn",c.innerHTML=CloseIcon({width:16,height:16}),c.setAttribute("aria-label","Close cart drawer"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s.appendChild(c);const p=this.clientConfig.get("promoTicker"),m=null!==(e=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],f=null!=p?p:m,g=this.store.get("address"),v=hasActiveItems(f,null===(n=null==g?void 0:g.address)||void 0===n?void 0:n.state);if(!f.length||!v)return[s];const b=ComponentFactoryService.createElement({context:"cart",type:i.PROMO_CODE_TICKER,tickers:f});return[s,b]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){this.commands.ui.openDrawer(i.ENGRAVING_FORM,{identifier:t,context:"cart",lines:e.attributes.engraving.lines,maxLines:e.attributes.engraving.maxLines,maxCharsPerLine:e.attributes.engraving.maxCharsPerLine,fee:e.attributes.engraving.fee,location:e.attributes.engraving.location})}template(){var t,e;const n=this.params.itemId,o=this.getStoreValue("cart.items."+n),r=this.getConfigs("global"),s=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),a=document.createElement("article");a.className="cart-item";const c=document.createElement("div");c.className="item-image";const p=document.createElement("img");p.src=o.mainImage,p.alt=o.name,c.appendChild(p);const m=document.createElement("div");m.className="item-details";const f=document.createElement("div");f.className="item-header";const g=document.createElement("h3");g.className="item-title",g.textContent=o.name;const v=document.createElement("button");v.className="item-delete",v.innerHTML=TrashIcon({}),v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","Remove "+o.name+" from cart"),v.setAttribute("aria-expanded","true"),v.addEventListener("click",async()=>{await this.commands.cart.removeItem(n)}),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(n))}),f.appendChild(g),f.appendChild(v);const b=document.createElement("div");b.className="item-specs",b.textContent=o.size+", "+o.container;const x=document.createElement("div");x.className="item-shipping-container";const w=document.createElement("div");if(w.className="item-shipping",w.textContent=o.attributes.engraving.hasEngraving?s.engravingExpectation:s.expectation,x.appendChild(w),r.layout.enablePersonalization&&(null==o?void 0:o.attributes.engraving.isEngravable)&&(null==o?void 0:o.attributes.engraving.hasEngraving)===![]&&s.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=r.layout.personalizationText+" +"+formatCentToDollarText(o.attributes.engraving.fee,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+o.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(n,o)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(n,o))}),x.appendChild(t)}m.appendChild(f),m.appendChild(b),m.appendChild(x),a.appendChild(c),a.appendChild(m);const elements=[a],S=ComponentFactoryService.createElement({type:i.CART_ITEM_QUANTITY_PRICE,itemId:n});if((null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:n,context:"cart"});elements.push(t)}return elements.push(S),elements}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),i=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:i,canDecrease:!![]}}getAvailableQuantity(){var t,e;const n=this.getItemStore();if(!n)return 0;const i=n.partNumber,o=n.fulfillmentId,r=this.getStoreValue("cart.items")||{},s=Object.values(r).filter(t=>t.partNumber===i&&t.fulfillmentId===o),a=s.reduce((t,e)=>t+e.quantity,0),c=this.getStoreValue("products."+n.upc)||this.getStoreValue("products."+n.salsifyGrouping);if(!c)return n.maxQuantity-a;const p=(null===(e=null===(t=null==c?void 0:c.sizes)||void 0===t?void 0:t[n.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder)||0;return!p||p<=0?n.maxQuantity-a:p-a}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer();elements.push(t)}const t=this.createPriceContainer();return elements.push(t),elements}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(null==n?void 0:n.code),o=Boolean(null==t?void 0:t.code);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;if(o&&this.promoCodePill&&t.discount!==(null==n?void 0:n.discount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),i=this.getStoreValue("cart.promoCode"),o=this.getStoreValue("cart.events"),r=o.some(t=>t.type===s.PROMO_CODE);this.applyButton.disabled=!e||n||Boolean(null==i?void 0:i.discount)||this.isApplying||r}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const y=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:i.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const o of n)i.has(o)||this.removeFulfillmentElement(o);for(const o of i)n.has(o)||this.addFulfillmentElement(o)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const o of n)o.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&e&&t.insertBefore(i,e)}for(const o of Object.keys(e))this.addFulfillmentElement(o)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:i.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,i=t.find(t=>t.path===n);if(i){const t=i.oldValue,e=i.value,n=Object.keys((null==t?void 0:t.fulfillments)||{}),o=Object.keys(e.fulfillments||{});JSON.stringify(n)!==JSON.stringify(o)&&this.handleFulfillmentsUpdate(n,o)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const Q=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),Q()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),Q()}}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const i=document.createElement("div");i.className="cart-retailer-header";const o=document.createElement("div");o.className="retailer-info";const r=document.createElement("h2");r.className="section-title",r.textContent=e.name,o.appendChild(r);const s=document.createElement("input");s.type="checkbox",s.id=e.id,s.className="section-toggle",o.appendChild(s);const a=document.createElement("label");a.htmlFor=e.id,a.className="section-header-label",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Collapse retailer section"),a.setAttribute("aria-expanded","true");const c=document.createElement("span");c.className="chevron",c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),a.appendChild(c),o.appendChild(a),i.appendChild(o),n.appendChild(i);const p=document.createElement("div");p.className="retailer-body-container";const m=document.createElement("div");m.id="retailer-fulfillment-container",p.appendChild(m);const f=document.createElement("div");return f.id="retailer-subtotal-container",p.appendChild(f),n.appendChild(p),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let i=0;for(const o of n)i+=o.quantity;return i}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,i=this.getStoreValue("cart.items"),o=this.getRetailerItemCount(i,t),r=1===o?"item":"items",s=document.createElement("h3");s.className="retailer-subtotal-header",s.textContent="Subtotal ("+o+" "+r+"):";const a=document.createElement("span");return a.className="retailer-subtotal-amount",a.textContent=formatCentToDollarText(e+n),[s,a]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){const t=this.store.get("checkout.presale"),e=this.getPromoTickerData(),n=this.checkForActiveTickers(e),o=document.createElement("div");o.classList.add("checkout-container"),this.params.isIndependentComponent&&o.classList.add("independent"),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION})),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_ORDER_SUMMARY}));const r=this.createHeaderWrapper(t,e,n);return[r,o]}getPromoTickerData(){var t,e;const n=this.getConfigs("global"),i=this.clientConfig.get("promoTicker"),o=null!==(e=null===(t=null==n?void 0:n.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[];return null!=i?i:o}checkForActiveTickers(t){var e;const n=this.store.get("address");return hasActiveItems(t,null===(e=null==n?void 0:n.address)||void 0===e?void 0:e.state)}createHeaderWrapper(t,e,n){const o=this.params.isIndependentComponent,r=document.createElement("div");return r.classList.add("checkout-header-wrapper"),o&&r.classList.add("hosted"),r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER,isHostedCheckout:o})),e.length>0&&n&&!t&&r.appendChild(ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:e})),t&&r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN})),r}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const i=this.getStoreValue("checkout"),r=Boolean(i.promoCode),s=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),a=this.getConfigs("global"),c=Object.values(i.fulfillments).some(t=>t.type===o.SHIPPING),p=Object.values(i.fulfillments).some(t=>t.type===o.ON_DEMAND),elements=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+i.itemsQuantity+" item"+(i.itemsQuantity>1?"s":"")+")",m.appendChild(f);const g=document.createElement("span");if(g.textContent=formatCentToDollarText(i.amounts.subtotal),m.appendChild(g),elements.push(m),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Shipping",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.shipping),t.appendChild(n),elements.push(t)}if(p){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Delivery",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.delivery),t.appendChild(n),elements.push(t)}if((null===(e=null==i?void 0:i.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(n),elements.push(t)}const v=document.createElement("div");v.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Taxes & Fees",v.appendChild(b);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),v.appendChild(x),elements.push(v),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=i.promoCode)||void 0===n?void 0:n.code.toUpperCase())+")",t.appendChild(e);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),elements.push(t)}if(s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(n),elements.push(t)}if(p){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.tip),t.appendChild(n),elements.push(t)}const w=document.createElement("div");w.classList.add("checkout-separator"),elements.push(w);const S=document.createElement("div");S.classList.add("checkout-amount-total");const E=document.createElement("span");E.textContent="Total",S.appendChild(E);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(i.amounts.total),S.appendChild(_),elements.push(S),i.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),elements.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:a.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),elements.push(i)}return elements}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),i.setAttribute("role","checkbox"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Billing same as shipping checkbox"),i.setAttribute("aria-checked",t?"true":"false"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const o=document.createElement("label");return o.textContent="Billing address same as shipping address",o.setAttribute("for","billingSameAsShipping"),o.classList.add("billing-checkbox-label"),n.appendChild(i),n.appendChild(o),e.appendChild(n),e}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),e={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),elements=[],e=this.billingSameAsShippingToggle();if(elements.push(e),t.billingSameAsShipping)return elements;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Your billing info",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),o.appendChild(s),elements.push(o);const a=document.createElement("div");a.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","First name input"),c.appendChild(p);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","Last name input"),c.appendChild(m),a.appendChild(c);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:Ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","Email input"),a.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:Ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Phone input"),g.appendChild(v);const b=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Company input"),g.appendChild(b),a.appendChild(g);const x=document.createElement("div");x.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});w.setAttribute("aria-label","Street address input"),x.appendChild(w);const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Apt, suite, etc. (optional) input"),x.appendChild(S),a.appendChild(x);const E=document.createElement("div");E.classList.add("checkout-three-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","City input"),E.appendChild(_);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});F.setAttribute("aria-label","State input"),E.appendChild(F);const I=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return I.setAttribute("aria-label","Zip Code input"),E.appendChild(I),a.appendChild(E),elements.push(a),elements}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path);e&&(e.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const elements=[],e=document.createElement("div");e.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),e.appendChild(o);const r=document.createElement("p");r.textContent="Buyer information is used to process your order and for delivery purposes.",r.classList.add("section-subtitle"),e.appendChild(r),elements.push(e);const s=document.createElement("div");s.classList.add("section-form-container");const a=document.createElement("div");a.classList.add("checkout-two-col-container");const c=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});a.appendChild(c);const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});a.appendChild(p),s.appendChild(a);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});s.appendChild(m);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});s.appendChild(f);const g=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});s.appendChild(g);const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return s.appendChild(v),elements.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const elements=[],t=this.getStoreValue("checkout.customerForm.data"),e=document.createElement("div");e.classList.add("checkout-summary-form-header");const n=document.createElement("h2");n.textContent="Buyer: "+t.firstName+" "+t.lastName,e.appendChild(n);const i=document.createElement("span");if(i.textContent="Edit",i.setAttribute("aria-label","Edit Buyer Information"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),i.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),e.appendChild(i),elements.push(e),t.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=t.company,elements.push(e)}const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=t.email,elements.push(o);const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=t.phone,elements.push(r);const s=document.createElement("p");return s.classList.add("checkout-summary-form-line"),s.textContent=formatISODateToMMDDYYYY(t.birthDate),elements.push(s),elements}}const Ot=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],zt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(Ot.includes(n)){const t=document.createElement(n),i=zt[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(i.includes(e)){const i=sanitizeAttributeValue(e,n.value);null!==i&&t.setAttribute(e,i)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const i=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&i.appendChild(e)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),i=n.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const o=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&o.appendChild(e)}const r=document.createElement("div");return r.appendChild(o),r.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,o,r,s;const elements=[],a=this.getConfigs("configurations"),c=this.getConfigs("global"),p=this.getConfigs("checkout"),m=this.config.layout.continueShoppingUrl||window.location.host,f=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(e=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=null===(o=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===o?void 0:o.customLogo,e.alt=a.partnerName+" Logo",t.appendChild(e),elements.push(t)}const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-section");const x=document.createElement("h3");x.innerHTML=(null===(s=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===s?void 0:s.customText)||"Thank You for Your Order!",b.appendChild(x);const w=document.createElement("p");w.textContent="Your payment has been successfully processed.",b.appendChild(w),v.appendChild(b),g.appendChild(v);const S=document.createElement("div");S.classList.add("checkout-completed-sub-section");const E=document.createElement("div");E.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Number",E.appendChild(_);const F=document.createElement("span");F.textContent=this.params.orderNumber,E.appendChild(F),S.appendChild(E);const I=document.createElement("div");I.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Order Amount",I.appendChild(O);const R=document.createElement("span");R.textContent=""+formatCentToDollarText(this.params.orderTotal),I.appendChild(R),S.appendChild(I);const M=document.createElement("div");M.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",M.appendChild(B);const q=document.createElement("span");q.textContent="** "+this.params.cardLast4,M.appendChild(q),S.appendChild(M),g.appendChild(S);const U=document.createElement("div");U.classList.add("checkout-completed-sub-section");const V=document.createElement("p");V.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",U.appendChild(V),g.appendChild(U),elements.push(g);const K=document.createElement("div");K.classList.add("checkout-completed-section-container");const H=document.createElement("button");H.type="button";const W=document.createElement("span");W.textContent=f,H.setAttribute("tabindex","0"),H.setAttribute("role","button"),H.setAttribute("aria-label",f),H.appendChild(W);const X=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:c.theme.selectedTextColor}));H.appendChild(X),H.addEventListener("click",()=>{window.location.href=m}),H.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=m)}),K.appendChild(H),elements.push(K);const Z=document.createElement("div");Z.classList.add("checkout-completed-section-container");const J=document.createElement("div");J.classList.add("checkout-completed-help-section"),Z.appendChild(J);const $=document.createElement("p");$.textContent="Questions about your order? Contact us at ";const tt=document.createElement("a");tt.href="mailto:"+a.supportEmail,tt.textContent=a.supportEmail,$.appendChild(tt),J.appendChild($);const et=document.createElement("p"),nt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(et.textContent="Order placed on "+nt,J.appendChild(et),elements.push(Z),p.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(p.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),elements.push(t),elements.push(e),elements.push(n)}if(c.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path),n=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==e?void 0:e.value)||(null==n?void 0:n.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let e;e=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=e}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift"),r=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("checkout.shippingAddress"),c=e?r:s,p=this.store.get("checkout.deliveryInstructions");s.firstName&&(this.customerData.firstName={isValid:!![],value:s.firstName}),s.lastName&&(this.customerData.lastName={isValid:!![],value:s.lastName}),s.email&&(this.customerData.email={isValid:!![],value:s.email}),s.phone&&(this.customerData.phone={isValid:!![],value:s.phone}),s.company&&(this.customerData.company={isValid:!![],value:s.company}),s.birthDate&&(this.customerData.birthDate={isValid:!![],value:s.birthDate}),r.firstName&&(this.giftData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.giftData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.giftData.email={isValid:!![],value:r.email}),r.phone&&(this.giftData.phone={isValid:!![],value:r.phone}),r.message&&(this.giftData.message={isValid:!![],value:r.message}),a.address.two&&(this.customerData.addressTwo={isValid:!![],value:a.address.two},this.giftData.addressTwo={isValid:!![],value:a.address.two}),p&&(this.customerData.deliveryInstructions={isValid:!![],value:p},this.giftData.deliveryInstructions={isValid:!![],value:p});const m=this.store.get("checkout.fulfillments")||{},f=Object.values(m).some(t=>t.type===o.ON_DEMAND),elements=[],g=document.createElement("div");g.classList.add("delivery-header-container");const v=document.createElement("div");v.classList.add("delivery-header-content");const b=document.createElement("div");b.classList.add("delivery-title-container");const x=document.createElement("h3");x.textContent="Deliver to",x.classList.add("delivery-title");const w=document.createElement("p");w.textContent="Package recipient must be 21+",w.classList.add("delivery-subtitle"),b.appendChild(x),b.appendChild(w),g.appendChild(b),elements.push(g);const S=document.createElement("div");S.classList.add("section-form-container");const E=document.createElement("div");E.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.firstName:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","First Name Input"),E.appendChild(_);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.lastName:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(F.setAttribute("aria-label","Last Name Input"),E.appendChild(F),S.appendChild(E),!e){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),S.appendChild(t)}const I=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:e?Pt.email:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});I.setAttribute("aria-label","Email Input"),S.appendChild(I);const O=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:e?Pt.phone:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(O.setAttribute("aria-label","Phone Input"),S.appendChild(O),!e){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),S.appendChild(t)}const R=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a.formattedAddress,disabled:!![],className:"disabled-input"});R.setAttribute("aria-label","Delivery Address Input"),S.appendChild(R);const M=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.addressTwo:_t.addressTwo,label:"Apt, suite, etc. (optional)",value:a.address.two,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(M.setAttribute("aria-label","Address Line 2 Input"),S.appendChild(M),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",Pt.message);const o=document.createElement("textarea");o.name=Pt.message,o.id=Pt.message,o.rows=4,o.value=r.message||"",o.setAttribute("aria-label","Gift Message Textarea"),o.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.message}),this.updateSaveButtonState()});const s=document.createElement("p");s.textContent="Your gift message will be emailed to the recipient along with delivery details.",s.classList.add("textarea-message-disclaimer"),e.appendChild(i),e.appendChild(o),e.appendChild(s),S.appendChild(e)}if(f){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const o=document.createElement("textarea");o.id="delivery_instructions",o.name="delivery_instructions",o.rows=4,o.setAttribute("aria-label","Delivery Instructions Textarea"),o.value=p,o.addEventListener("input",async t=>{const n=t.target.value;e?(this.giftData.deliveryInstructions.value=n,this.giftData.deliveryInstructions.isValid=n.length>0):(this.customerData.deliveryInstructions.value=n,this.customerData.deliveryInstructions.isValid=n.length>0)});const r=document.createElement("p");r.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",r.classList.add("textarea-message-disclaimer"),n.appendChild(i),n.appendChild(o),n.appendChild(r),S.appendChild(n)}elements.push(S),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const T=async()=>{e?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",T),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await T())}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const elements=[],t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.data"),n=this.getStoreValue("checkout.giftRecipientForm.data"),i=this.getStoreValue("checkout.shippingAddress"),o=this.getStoreValue("checkout.deliveryInstructions"),r=document.createElement("div");r.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent=t?"Delivering to "+n.firstName+" "+n.lastName:"Delivering to "+e.firstName+" "+e.lastName,r.appendChild(s);const a=document.createElement("span");a.textContent="Edit",a.setAttribute("aria-label","Edit Delivery Information"),a.setAttribute("role","button"),a.setAttribute("tabindex","0");const C=async()=>{t?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(a.addEventListener("click",C),a.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await C())}),r.appendChild(a),elements.push(r),!t&&e.company){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=e.company,elements.push(t)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=i.formattedAddress,elements.push(c);const p=document.createElement("p");p.classList.add("checkout-summary-form-line"),p.textContent=t?n.email:e.email,elements.push(p);const m=document.createElement("p");if(m.classList.add("checkout-summary-form-line"),m.textContent=t?n.phone:e.phone,elements.push(m),!t&&e.birthDate){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=formatISODateToMMDDYYYY(e.birthDate),elements.push(t)}if(t){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Gift Message:",t.appendChild(e);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=n.message||"No message provided.",t.appendChild(i),elements.push(t)}if(o){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Delivery Instructions:",t.appendChild(e);const n=document.createElement("span");n.classList.add("checkout-summary-form-line"),n.textContent=o||"No instructions provided.",t.appendChild(n),elements.push(t)}return elements}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const y=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const elements=[];return elements.push(this.createGiftCardInput()),elements.push(this.createApplyButton()),elements}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){var t,e;const n=this.store.get("checkout.presale"),o=this.getConfigs("checkout"),r=null!==(e=null===(t=this.params)||void 0===t?void 0:t.isHostedCheckout)&&void 0!==e?e:![];let s=null;if(!n){s=document.createElement("button"),s.type="button",s.classList.add("checkout-header-button"),s.setAttribute("aria-label",r?"Back":"Back to Cart"),s.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back Button Is Disabled In Builder Mode"),void 0;if(r){const t=null==o?void 0:o.layout.continueShoppingUrl;t&&(window.location.href=t)}else this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),s.appendChild(t)}const a=document.createElement("h1");if(a.textContent=(null==o?void 0:o.layout.drawerHeaderText)||"Checkout",a.classList.add("checkout-header-title"),a.setAttribute("aria-label","Checkout Page"),r){const t=document.createElement("div");return t.classList.add("checkout-header-spacer"),s?[s,a,t]:[a,t]}const c=document.createElement("button");return c.innerHTML=CloseIcon({width:16,height:16}),c.classList.add("checkout-header-button-close"),c.setAttribute("aria-label","Close Checkout"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s?[s,a,c]:[a,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.isEditing"),n=this.getStoreValue("checkout.giftRecipientForm.isEditing"),i=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=e?"block":"none",this.buyerSummary.style.display=e?"none":"block",this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block"):(this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=i?"block":"none",this.paymentSummary.style.display=i?"none":"block"}template(){const elements=[],t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm"),n=this.getStoreValue("checkout.giftRecipientForm"),o=this.getStoreValue("checkout.paymentForm"),r=ComponentFactoryService.createElement({type:i.CHECKOUT_SEND_AS_GIFT});return elements.push(r),this.deliveryToForm=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=t?n.isEditing?"block":"none":e.isEditing?"block":"none",elements.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=t?n.isEditing?"none":"block":e.isEditing?"none":"block",elements.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER}),this.buyerForm.style.display=t&&e.isEditing?"block":"none",elements.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=t&&!e.isEditing?"block":"none",elements.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT}),this.paymentForm.style.display=o.isEditing?"block":"none",elements.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=o.isEditing?"none":"block",elements.push(this.paymentSummary),elements}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var e,n,i,o;const r=t.find(t=>"checkout.items"===t.path);r&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const s=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(s){const t=s.oldValue,r=s.value;if(r.updating)return![];const a=(null==t?void 0:t.quantity)!==(null==r?void 0:r.quantity),c=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],p=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],m=JSON.stringify(c)!==JSON.stringify(p);(a||m)&&this.updateEngravingElement(r)}return![]}updateEngravingElement(t){var e,n;const o=this.getConfigs("global"),r=this.container.querySelector(".engraving-view-container");if(r&&r.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const t=this.getStoreValue("cart.fulfillments."+e),o=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(o&&o.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","checkout-retailer-alert"),n.before(e)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const o=this.getConfigs("global"),r=this.getStoreValue("checkout.items."+this.params.itemId),s=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.presale,a=(null==s?void 0:s.isActive)&&(null==s?void 0:s.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(s.estimatedShipBy):"";if(!r)return[];const c=this.getStoreValue("checkout.fulfillments."+r.fulfillmentId),p=this.getStoreValue("checkout.retailers."+r.retailerId),m=document.createElement("div");m.classList.add("checkout-item-card-header");const f=document.createElement("div");f.classList.add("checkout-item-image");const g=document.createElement("img");g.src=r.mainImage,g.alt=r.name,g.loading="lazy",f.appendChild(g),m.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-item-details-container");const b=document.createElement("h4");b.classList.add("checkout-item-title"),b.textContent=r.name,v.appendChild(b);const x=document.createElement("div");x.classList.add("checkout-item-subtitle");const w=document.createElement("span");w.textContent=s.isActive?a+",":(r.attributes.engraving.hasEngraving?null==c?void 0:c.engravingExpectation:null==c?void 0:c.expectation)+",",x.appendChild(w);const S=document.createElement("span");S.textContent="From "+((null==p?void 0:p.name)||"Retailer"),x.appendChild(S),v.appendChild(x),m.appendChild(v),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(r.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),m.appendChild(this.trashButton);const E=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),_=[];if(_.push(m),o.layout.enablePersonalization&&(null===(n=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout"});_.push(t)}return _.push(E),_}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,s=i.fulfillmentId,a=null===(n=null===(e=null===(t=Object.values(o).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[i.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("checkout.items")||{},p=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===s),m=p.reduce((t,e)=>t+e.quantity,0);return a-m}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),o=e.quantity,r=this.getAvailableQuantity(),s=r>0,a=!(i&&1===o);return{currentQuantity:o,availableQuantity:r,isTheOnlyItem:i,canIncrease:s,canDecrease:a}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",i)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.calculateQuantityLimits(),n=document.createElement("div");n.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const i=document.createElement("span");if(i.classList.add("checkout-item-price-text"),i.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",i.appendChild(e)}return[n,i]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of Object.values(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){if(!this.itemsList)return;const t=this.getCurrentItemsMap(),e=this.itemsList.querySelectorAll("[data-item-id]"),n=new Set;for(const i of e){const t=i.getAttribute("data-item-id");t&&n.add(t)}for(const i of e){const e=i.getAttribute("data-item-id");e&&!t.has(e)&&i.remove()}for(const[i]of t)if(!n.has(i)){const t=this.createItemElement(i);t.setAttribute("data-item-id",i),this.itemsList.appendChild(t)}if(this.togglerLabel){const t=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=t+" item"+(t>1?"s":"")}}onStoreChanged(t){let e=null;for(let n=0;n<t.length;n++){const i=t[n];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){e=i;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),t?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",t?"true":"false"),this.togglerButton.setAttribute("aria-label",t?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.itemsQuantity"),e=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=t+" item"+(t>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const n of Object.values(e)){const t=this.createItemElement(n.cartItemId);t.setAttribute("data-item-id",n.cartItemId),this.itemsList.appendChild(t)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let i;e.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const o=document.createElement("span");o.id="emailOptIn",o.classList.add("checkout-checkbox-visual"),i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Email opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleEmailToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(o))});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked"))}),e.appendChild(o),e.appendChild(r),n.appendChild(e)}if(e.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const o=document.createElement("span");o.classList.add("checkout-checkbox-visual"),o.id="smsOptIn",i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","SMS opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleSmsToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(o))});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(e.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked"))}),t.appendChild(o),t.appendChild(r),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).some(t=>t.type===o.ON_DEMAND)}template(){var t;const elements=[],e=this.getConfigs("global"),n=this.getConfigs("checkout"),o=this.getConfigs("global"),r=n.layout.allowGiftCards,s=null===(t=null==o?void 0:o.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Order Summary",c.classList.add("section-title"),a.appendChild(c),elements.push(a);const p=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});elements.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),elements.push(m),r||s){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});elements.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});elements.push(t),elements.push(f)}const g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="100% Secure Payments",v.classList.add("disclaimer-header"),g.appendChild(v);const b=document.createElement("p");b.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",b.classList.add("disclaimer-description"),g.appendChild(b),elements.push(g);const x=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});elements.push(x);const w=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});elements.push(w);const S=this.marketingOptInsContainer();if(S&&elements.push(S),n.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(n.layout.legalMessage.text),elements.push(t),elements.push(e)}const E=document.createElement("div");if(E.classList.add("checkout-separator"),elements.push(E),e.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});elements.push(t)}return elements}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=e.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(e.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],e="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)e="Saving...",t=!![];else if(this.stripeFormStatus.hasError)e="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!e}else{const e=this.stripeFormStatus.isFormComplete,n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(e&&n)}this.saveButton.disabled=t,this.saveButton.textContent=e,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const elements=[],t=document.createElement("div");t.classList.add("section-title-container");const e=document.createElement("h3");e.textContent="Payment",e.classList.add("section-title"),t.appendChild(e);const n=document.createElement("p");if(n.textContent="All transactions are secure and encrypted.",n.classList.add("section-subtitle"),t.appendChild(n),elements.push(t),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const t=document.createElement("p");t.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(t),elements.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),elements.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),elements.push(this.errorMessageElement);const o=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return elements.push(o),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),elements.push(this.saveButton),elements}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in edit mode",e),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in beta mode",n),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,e,n,i,o,r,s,a,c;const elements=[],p=this.getStoreValue("checkout.paymentForm"),m=document.createElement("div");m.classList.add("checkout-summary-form-header");const f=document.createElement("h2");f.textContent="Paying with "+(null!==(n=null===(e=null===(t=p.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(o=null===(i=p.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),m.appendChild(f);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Payment Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),m.appendChild(g),elements.push(m);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(s=null===(r=p.paymentMethod)||void 0===r?void 0:r.card)||void 0===s?void 0:s.expMonth)+"/"+(null===(c=null===(a=p.paymentMethod)||void 0===a?void 0:a.card)||void 0===c?void 0:c.expYear),elements.push(v),elements}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const e=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);e&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],e=this.store.get("checkout.error")||null;this.updateErrorDisplay(e);const n=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!e});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:e}){const n=this.config.layout.placeOrderButtonText,i=this.store.get("checkout.presale");let o=![];if(!i){const t=this.getStoreValue("cart.fulfillments")||{};o=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const r=this.store.get("checkout.isGift"),s=this.store.get("checkout.customerForm.isValid"),a=this.store.get("checkout.giftRecipientForm.isValid"),c=this.store.get("checkout.paymentForm.isValid");return o||r&&!a||!s||!c?{state:"disabled",text:n,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:e?{state:"disabled",text:n,disabled:!![]}:{state:"ready",text:n,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),n.appendChild(o),n.appendChild(r),e.appendChild(n);const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,s,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presale"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value.expiresAt),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,e=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&n>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&n<e&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var t,e;const n=[".drawer-content"];for(const o of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(o);if(e&&this.isScrollable(e))return e}let i=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null}setScrolledState(t){var e,n;this.isCurrentlyScrolled=t,t?(null===(e=this.rootElement)||void 0===e?void 0:e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(n=this.rootElement)||void 0===n?void 0:n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);this.initialDurationSeconds=Math.min(n,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,i=this.initialDurationSeconds-n,o=Math.max(0,Math.min(100,i/this.initialDurationSeconds*100)),r=n<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;r!==this.isUnderOneMinute&&(this.isUnderOneMinute=r,this.updateWarningState()),this.updateTimerDisplay(e),this.updateProgressBar(o),0===e&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-timer]");e&&(e.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-progress-fill]");e&&(e.style.width=t+"%")}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=e%60,o=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.showPresaleExpired())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=this.createTextContainer(),n=this.createProgressBar();return t.appendChild(e),t.appendChild(n),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const e=this.createHeader(),n=this.createSubtitle();return t.appendChild(e),t.appendChild(n),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const e=document.createElement("h2");e.textContent="LIMITED PRE-ORDER:";const n=document.createElement("div");return n.classList.add("checkout-presale-timer"),n.setAttribute("data-timer",""),n.textContent="00:00:00",t.appendChild(e),t.appendChild(n),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const e=document.createElement("div");return e.className="checkout-presale-progress-fill",e.setAttribute("data-progress-fill",""),e.style.width="0%",t.appendChild(e),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,e;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(e=this.params)||void 0===e?void 0:e.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown();const t=this.commands.checkout.getReturnUrl();if(t)return window.location.assign(t),void 0;this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const elements=[],t=this.getConfigs("global"),e=document.createElement("div");e.classList.add("checkout-completed-section-container");const n=document.createElement("div");n.classList.add("checkout-completed-title-section");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("p");r.classList.add("presale-expired-title");const s=document.createElement("p"),a=document.createElement("div");a.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(r.textContent="Items No Longer Available",s.textContent="The presale items you were trying to purchase are no longer available.",a.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(r.textContent="Session Expired",s.textContent="Your reservation time has ended. The item has been released for other customers.",a.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),o.appendChild(r),o.appendChild(s),n.appendChild(o),e.appendChild(n),e.appendChild(a),elements.push(e);const c=document.createElement("div");c.classList.add("checkout-completed-section-container");const p=document.createElement("button");p.setAttribute("aria-label","Continue shopping"),p.type="button";const m=document.createElement("span");m.textContent="Continue Shopping",p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label","Continue Shopping"),p.appendChild(m);const f=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:t.theme.selectedTextColor}));if(p.appendChild(f),p.addEventListener("click",()=>this.handleExit()),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),c.appendChild(p),elements.push(c),this.isTimeExpired()){const t=document.createElement("div");t.classList.add("checkout-completed-section-container");const e=document.createElement("p");e.classList.add("checkout-completed-auto-close-text"),e.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const n=document.createElement("span");n.classList.add("checkout-completed-auto-close-text"),n.textContent="seconds",t.appendChild(e),t.appendChild(this.autoCloseElement),t.appendChild(n),elements.push(t)}if(t.layout.showPoweredBy){const t=document.createElement("div");t.classList.add("checkout-completed-powered-by-container");const e=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});t.appendChild(e),elements.push(t)}return elements}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(n),o=Boolean(t);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;o&&this.promoCodeText&&t.discount!==(null==n?void 0:n.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),o=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(i)||Boolean(o)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const y=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const elements=[];return elements.push(this.createPromoInput()),elements.push(this.createApplyButton()),elements}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),e=document.createElement("div");e.classList.add("gift-label-wrapper");const n=document.createElement("span");n.textContent="Send as Gift? (Free)",n.classList.add("gift-toggle-label"),e.appendChild(n);const i=document.createElement("span");i.textContent="With personalized note & gift receipt.",i.classList.add("gift-toggle-description"),e.appendChild(i);const o=document.createElement("div");o.classList.add("toggle-switch"),o.classList.toggle("active",t);const r=document.createElement("div");return r.classList.add("toggle-slider"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Toggle Gift Option"),o.setAttribute("role","switch"),o.setAttribute("aria-checked",t?"true":"false"),o.appendChild(r),o.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[e,o]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.L=null,this.R=null,this.M=![],this.j=![],this.N=![],this.B=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.L=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.L.create("payment",t.elementOptions),this.R.mount(this),this.R.on("change",async t=>{const e=!!t.error,n=t.complete,i=e?t.error.message:null;this.j=n,this.M||await this.updateStripeFormStatus({isFormComplete:n,isProcessing:![],hasCompletedPayment:![],errorMessage:i,hasError:e})}),this.R.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.N=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){var t,e;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.j)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.N&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.N=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:n},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(n){console.error("Payment submission error:",n),this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"Payment processing failed. Please try again."}),((null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.includes("expired"))||(null===(e=null==n?void 0:n.message)||void 0===e?void 0:e.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",G),this.B=null,e(new Error("Session refresh timeout"))},1e4),G=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",G),this.B=null,t()};this.addEventListener("lce:s:refreshSession",G,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.L&&this.L.update({clientSecret:this.q.clientSecret}),this.N=![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(bt){console.error("Failed to refresh payment session:",bt),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.j=![],this.N=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(bt){console.error("Failed to reset form:",bt)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.L)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.L.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.L,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:i}=await this.O.createConfirmationToken(e);if(n)throw new SDKError(n.message||"Failed to create confirmation token");if(!i||!i.id)throw new SDKError("Invalid confirmation token received");return i.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.B=null,this.R&&(this.R.unmount(),this.R=null),this.L&&(null===(e=(t=this.L).destroy)||void 0===e?void 0:e.call(t),this.L=null),this.O=null,this.M=![],this.j=![],this.N=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.querySelector('script[src*="stripe.com"]');if(n)return n.addEventListener("load",()=>t()),n.addEventListener("error",()=>e(new Error("Failed to load Stripe.js"))),void 0;const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.async=!![],i.onload=()=>t(),i.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(e.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(e.value)}}handleSavedCardChange(t){var e,n,i,o;(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.brand)&&(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(o=(i=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(i,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,e,n,i,o,r;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(e=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===e||e.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(i=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(n,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(r=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===r||r.call(o,![]))}async afterRender(){var t,e,n,i;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const o=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(e=null==o?void 0:o.card)||void 0===e?void 0:e.brand)&&o.card.last4&&(this.savedCardInfo={brand:o.card.brand,last4:o.card.last4}),null===(i=(n=this.callbacks).onSavedCardInfoChanged)||void 0===i||i.call(n,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var e,n;this.stripeFormStatus=t.detail.status,null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var e,n,i,o,r;try{const{confirmationTokenId:i,setupIntentId:o}=t.detail;await(null===(n=(e=this.callbacks).onPaymentSessionConfirmed)||void 0===n?void 0:n.call(e,i,o)),this.isChangingPayment=![]}catch(s){this.logger.error("Failed to save payment form",s),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==s?void 0:s.message)||"Failed to save payment information. Please try again."},null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus),null===(r=this.stripeFormElement)||void 0===r||r.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}}))}catch(e){this.logger.error("Failed to refresh payment session",e)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const e=document.createElement("button");e.type="button",e.classList.add("change-payment-link"),e.textContent="Change",e.setAttribute("aria-label","Change Payment Method"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>this.handleChangePayment()),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,e),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,e;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(e=(t=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const elements=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",elements.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const t=document.createElement("slot");return t.setAttribute("name",Et),this.stripeFormContainer.appendChild(t),elements.push(this.stripeFormContainer),elements}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),a="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&r&&s&&a)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.paymentForm.paymentSession"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"dark"===n.layout.poweredByMode?"night":"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,e,n;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const r=o.querySelectorAll('[slot="'+Et+'"]');if(r.length>0)for(const i of r)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",Et),o.appendChild(this.stripeFormElement)}catch(s){this.logger.error("Stripe form element creation failed",s),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===o.ON_DEMAND)}getRetailerNameForFulfillment(t){const e=this.getStoreValue("checkout.items")||{},n=this.getStoreValue("checkout.retailers")||{},i=Object.values(e).find(e=>e.fulfillmentId===t);if(!i)return"Retailer";const o=n[i.retailerId];return(null==o?void 0:o.name)||"Retailer"}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillments();if(!i.find(e=>e.id===t))return;const o=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,o)}catch(r){this.logger.error("Checkout fulfillment tip update failed",r)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillments();if(n.find(e=>e.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",i)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const o of e){const e=document.createElement("button");e.type="button",e.textContent=o+"%",e.classList.add("checkout-tip-button"),e.disabled=n,i===o&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(o)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getOnDemandFulfillments();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),n.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(o),t.appendChild(n);const r=document.createElement("div");r.classList.add("retailers-tips-list","show");for(const s of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=this.getRetailerNameForFulfillment(s.id),e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const o=document.createElement("span");o.classList.add("dollar-sign"),o.textContent="$";const a=document.createElement("input");let c;a.type="number",a.id="tip-input-"+s.id,a.name="tip-"+s.id,a.min="0",a.step="0.01",a.placeholder="0.00",a.classList.add("dollar-input"),a.value=s.amounts.tip>0?(s.amounts.tip/100).toFixed(2):"",a.disabled=this.getStoreValue("checkout.updating")||![],a.addEventListener("wheel",t=>{t.preventDefault()}),a.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),a.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),a.addEventListener("paste",t=>{t.preventDefault()}),a.addEventListener("contextmenu",t=>{t.preventDefault()}),a.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),a.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;c&&clearTimeout(c),c=setTimeout(()=>{this.handleFulfillmentTipInput(s.id,n)},500)}),i.appendChild(o),i.appendChild(a),n.appendChild(i);const p=document.createElement("button");p.type="button",p.textContent="Remove",p.classList.add("checkout-tip-remove-button"),p.disabled=this.getStoreValue("checkout.updating")||![],p.addEventListener("click",()=>this.removeTipFromFulfillment(s.id)),n.appendChild(p),t.appendChild(n),r.appendChild(t)}return t.appendChild(r),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getOnDemandFulfillments();if(t&&e.length>0){const i=e.every(t=>t.amounts.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",i),this.isInitialized=![]}}template(){const elements=[],t=this.getOnDemandFulfillments();if(0===t.length)return elements;t.length>0&&this.initializeDefaultTip();const e=document.createElement("section");e.classList.add("checkout-tip-container");const n=document.createElement("h3");n.classList.add("checkout-sub-header"),n.textContent="Add a tip",e.appendChild(n);const i=document.createElement("div");i.classList.add("checkout-tip-config-container");const o=this.createTipSelectionButtons();i.appendChild(o),e.appendChild(i);const r=document.createElement("p");r.classList.add("checkout-tip-disclaimer"),r.textContent="Tips will be split proportionally between retailers.",e.appendChild(r);const s=this.createTipDistribution();return elements.push(e,s),elements}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const i=t.find(t=>"checkout.giftCardError"===t.path),o=t.find(t=>"checkout.promoCodeError"===t.path),r=t.find(t=>"checkout.giftCards"===t.path);if(r&&this.updateAppliedGiftCards(r.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),i.value){const e=this.createErrorElement(i.value);t.after(e)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(i.value))}}if(o){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),o.value){const e=this.createErrorElement(o.value);t.after(e)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(o.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.applied)+")",e.appendChild(n);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(i),e}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),o=e.layout.allowGiftCards,r=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,s=document.createElement("div");s.classList.add("checkout-pc-gc-sub-container");const a=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),c=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});r&&s.appendChild(a);const p=this.getStoreValue("checkout.promoCodeError");if(p){const t=this.createErrorElement(p);t.classList.add("promo-code-error-wrapper"),s.appendChild(t)}o&&s.appendChild(c);const m=this.getStoreValue("checkout.giftCardError");if(m){const t=this.createErrorElement(m);s.appendChild(t)}return s}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),e.appendChild(n),e.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const elements=[];return elements.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),elements.push(this.appliedGiftCardsContainer)),elements}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var r,s,a,c,p,m;const f=e===o.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=f&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="popup-retailer-card "+(n?"selected":"")+" "+v,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===o.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const w=document.createElement("div");w.className="row";const S=document.createElement("span");S.className="name",S.textContent=t.retailerName,w.appendChild(S);const E=document.createElement("span");E.className="price",E.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0),w.appendChild(E),b.appendChild(w);const _=document.createElement("div");_.className="row";const F=document.createElement("span");F.className="expectation",F.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,_.appendChild(F);const I=document.createElement("span");if(I.className="fee",I.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",_.appendChild(I),b.appendChild(_),f){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=t.retailerAddressFormatted,e.appendChild(n),b.appendChild(e)}return b}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:i,onTabClick:r,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=e.length>0,p=document.createElement("div");if(p.className="fulfillment-tabs-container",p.setAttribute("role","tablist"),p.setAttribute("aria-label","Delivery method options"),s){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",o.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",r),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const i=document.createElement("span");i.className="fulfillment-tab-label "+(n?"selected":""),i.textContent="Shipping ("+t.length+")",e.appendChild(i),p.appendChild(e)}if(a){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(c?"":"disabled"),t.setAttribute("data-fulfillment-type",o.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",i?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),c||t.setAttribute("aria-disabled","true"),t.addEventListener("click",r),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(i?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),p.appendChild(t)}return p}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const i=n.selectedFulfillment.variant.partNumber,o=n.selectedFulfillment.id,r=null===(t=n.sizes[n.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!r)return 0;const s=this.getStoreValue("cart.items")||{},a=Object.values(s).filter(t=>t.partNumber===i&&t.fulfillmentId===o),c=a.reduce((t,e)=>t+e.quantity,0);return r-c}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);return e.selectedFulfillment?e.selectedFulfillmentType===o.ON_DEMAND&&e.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:i,selectedSizeId:o.selectedSizeId}),void 0;const r=this.getSizeAttributes(),s=(null===(t=null==r?void 0:r.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(r);s&&a?await this.commands.product.addPresaleToCart(i,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(e=o.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:o.quantity,identifier:i}):await this.commands.product.addToCart(i,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(n=o.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:o.quantity,identifier:i})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,i=n.variant.price*e.quantity;return{quantity:e.quantity,totalPrice:i}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),i=this.calculateQuantityLimits(),o=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],r=this.isPresaleActive(n),s=o?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?s+" - "+formatCentToDollarText(e):s;const a=o&&!r||0===i.availableQuantity||this.isFulfillmentClosed(),c=this.isButtonLoading(),p=this.config.layout.addToCartButtonShowTotalPrice?s+" for "+formatCentToDollarText(e):s;return this.addToCartButton.setAttribute("aria-label",p),this.addToCartButton.setAttribute("aria-busy",c.toString()),this.addToCartButton.setAttribute("aria-disabled",a.toString()),a&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),c&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);elements.push(t)}const i=this.createAddToCartButton();return elements.push(i),elements}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),i="About this product:",o="See More",r="See Less",s=document.createElement("h3");s.className="title",s.textContent=i;const a=document.createElement("div");a.className="content collapsed",a.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const c=document.createElement("span");c.className="collapse-button",c.textContent=o,c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Show more product information"),c.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,a.classList.toggle("collapsed"),c.textContent=this.isCollapsed?o:r,c.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),c.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return c.addEventListener("click",toggleContent),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[s,a,c]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:i}=t||{},o=ComponentFactoryService.createElement({type:n,...i});this.contentContainer&&this.contentContainer.appendChild(o),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay,e=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",t,e]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var e;const n=this.params.productId,i=t.find(t=>t.path==="products."+n+".selectedSizeId");if(null==i?void 0:i.value){const t=this.getStoreValue("products."+n),o=null===(e=null==t?void 0:t.sizes)||void 0===e?void 0:e[i.value],r=null==o?void 0:o.image;if(r){const t=this.params.images.indexOf(r);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+r+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const i=this.container.querySelectorAll(".carousel-dot");for(let o=0;o<i.length;o++){const e=i[o];e.classList.toggle("active",o===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,i=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,i=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,o=t.changedTouches[0].clientY-i;Math.abs(e)>Math.abs(o)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const elements=[],t=this.params.images.length>1,e=this.config.layout.showOnlyMainImage,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",t&&!e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}if(this.mainImageElement=n,elements.push(n),!e){const t=document.createElement("div");t.className="gallery-viewport";const e=document.createElement("div");e.className="gallery-container";for(let n=0;n<this.params.images.length;n++){const t=this.params.images[n],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===n?"selected":"");const o=document.createElement("img");o.src=t,o.className="gallery-image",o.alt="Product thumbnail "+(n+1),o.loading="lazy",i.appendChild(o),e.appendChild(i)}t.appendChild(e),elements.push(t)}return elements}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e;const n=this.getProductId();if(!t.some(t=>t.path==="products."+n+".selectedFulfillmentType"))return;const i=this.getStoreValue("products."+n),r=this.getConfigs("global");this.addPersonalizationSpan&&(i.selectedFulfillmentType===o.SHIPPING&&r.layout.enablePersonalization&&i.productHasAvailability&&(null===(e=null==i?void 0:i.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const i=n.textContent||"",o=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+i),n.setAttribute("aria-pressed",o?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var i;const o=n.dataset.sizeId;if(!o)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,o);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const r=this.getStoreValue("products."+t),s=this.getConfigs("global");this.addPersonalizationSpan&&(s.layout.enablePersonalization&&r.productHasAvailability&&(null===(i=r.selectedFulfillment)||void 0===i?void 0:i.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",i.id="size-label",n.appendChild(i);const o=document.createElement("div");o.className="size-buttons-container",o.setAttribute("role","group"),o.setAttribute("aria-labelledby","size-label");for(const r of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",r.id),e.setAttribute("select-size",""),e.className="size-button "+(r.id===t?"selected":"");const n=r.packDesc?" ("+r.packDesc+")":"";e.textContent=""+r.size+n,o.appendChild(e)}return n.appendChild(o),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e;const n=this.getProductId(),o=this.getStoreValue("products."+n),r=o.sizes[o.selectedSizeId],s=this.getConfigs("global"),elements=[],a=document.createElement("div");a.className="price-personalization-container";const c=ComponentFactoryService.createElement({type:i.PRODUCT_PRICE,productId:n});if(a.appendChild(c),s.layout.enablePersonalization&&o.productHasAvailability&&(null===(t=null==o?void 0:o.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=s.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",s.layout.personalizationText);const addPersonalization=async()=>{var t,e,r,s,a,c,p,m;const f=o.sizes[o.selectedSizeId];await this.commands.product.openProductDrawer(n,i.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=f.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(s=null===(r=f.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(c=null===(a=f.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,location:null===(m=null===(p=f.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),a.appendChild(this.addPersonalizationSpan)}elements.push(a);const p=this.renderProductSizes(o.selectedSizeId,o.sizes);if(elements.push(p),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,productId:n});elements.push(t)}const m=ComponentFactoryService.createElement({type:i.PRODUCT_RETAILERS,productId:n});elements.push(m);const f=ComponentFactoryService.createElement({type:i.PRODUCT_ADD_TO_CART_SECTION,productId:n});elements.push(f);const g=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.presale;if((null==g?void 0:g.isActive)===!![]&&(null==g?void 0:g.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==g?void 0:g.language)||""),elements.push(t)}if(this.config.layout.showDescription&&(o.description.trim().length>0||o.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:i.PRODUCT_DESCRIPTION,productId:n});elements.push(t)}return elements}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:i,fulfillmentDisplay:o,showImages:r,showOnlyMainImage:s}=this.config.layout,a=document.createElement("div");a.classList.add("product-content-wrapper");const c=document.createElement("div");if(c.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),c.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),c.appendChild(t),c}const p=document.createElement("div");p.classList.add("wave","sc-price"),c.appendChild(p);const m=document.createElement("div");m.classList.add("sc-sizes");const f=document.createElement("div");f.classList.add("wave","sc-size-button"),m.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),m.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),m.appendChild(v);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),m.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),m.appendChild(x),c.appendChild(m);const w=document.createElement("div");w.classList.add("sc-row");const S=document.createElement("div");S.classList.add("wave","sc-price"),w.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-personalization"),w.appendChild(E),c.appendChild(w);const _=document.createElement("div");_.classList.add("wave","sc-deliver-to"),c.appendChild(_);const F=document.createElement("div");F.classList.add("wave","sc-address"),c.appendChild(F);const I=document.createElement("div");I.classList.add("wave","sc-retailers",o),c.appendChild(I);const O=document.createElement("div");if(O.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),O.appendChild(t)}const R=document.createElement("div");if(R.classList.add("wave","sc-add-to-cart"),O.appendChild(R),c.appendChild(O),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),c.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),c.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),c.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),c.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-more"),c.appendChild(o)}const M=document.createElement("div");if(M.classList.add("product-content"),M.appendChild(c),a.appendChild(M),r){a.classList.add("has-images");const t=this.createImageSkeletons(s);a.prepend(t)}return a}createImageSkeletons(t){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");if(n.classList.add("wave","sc-main-image"),n.title="Product main image loading",!t){const t=document.createElement("div");t.classList.add("carousel-dots");for(let e=0;e<3;e++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),t.appendChild(e)}n.appendChild(t)}if(e.appendChild(n),!t){const t=document.createElement("div");t.classList.add("gallery-viewport");const n=document.createElement("div");n.classList.add("gallery-container");for(let e=0;e<4;e++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),n.appendChild(t)}t.appendChild(n),e.appendChild(t)}return e}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:i.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t);let n=e.noAvailabilityPrice;return e.selectedFulfillment&&(n=e.selectedFulfillment.variant.price),formatCentToDollarText(n)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),elements=[],o=this.getConfigs("configurations");if(!e.productHasAvailability||!o.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),elements.push(t),elements}const r="carousel"===n.layout.fulfillmentDisplay?i.PRODUCT_RETAILERS_CAROUSEL:i.PRODUCT_RETAILERS_POPUP,s=ComponentFactoryService.createElement({type:r,productId:t});return elements.push(s),elements}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.id===n)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var r,s,a,c,p,m;const f=e===o.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=f&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="carousel-retailer-card "+(n?"selected":"")+" "+v,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===o.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const w=document.createElement("div");w.className="retailer-header";const S=document.createElement("h3");if(S.className="name",S.textContent=t.retailerName,w.appendChild(S),f){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,w.appendChild(e)}const E=document.createElement("div");E.className="retailer-body";const _=document.createElement("span");_.className="product-price",_.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0);const F=document.createElement("span");F.className="shipping-price",F.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const I=document.createElement("span");return I.className="expectation",I.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,E.append(_,F,I),b.append(w,E),b}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const o in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)&&r.push(n.shippingFulfillments[o]);const s=[];for(const o in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)&&s.push(n.onDemandFulfillments[o]);const a=e.selectedFulfillmentType===o.SHIPPING,c=e.selectedFulfillmentType===o.ON_DEMAND,p=a?r:s,m=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===p.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const f of p){const t=this.generateRetailerCard({fulfillment:f,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:f.id===e.selectedFulfillmentId,selectedSizeAttributes:i}),n=e.selectedFulfillmentType===o.ON_DEMAND&&f.hourStatus.isClosed;n?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[m,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),r=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,c=Object.values(n.shippingFulfillments),p=Object.values(n.onDemandFulfillments),m=(s?c.length:0)+(a?p.length:0),f=document.createElement("div");f.className="header";const g=document.createElement("span");g.className="header-label",g.textContent=e.selectedFulfillmentType===o.SHIPPING?"Shipping From:":"Delivering From:";const v=document.createElement("button");if(v.className="delivery-options",v.type="button",v.textContent="See Delivery Options ("+m+")",v.setAttribute("aria-label","View all "+m+" delivery options"),v.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),f.appendChild(g),f.appendChild(v),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,t]}const b=document.createElement("div");b.className="popup-fulfillment-list-container";const x=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:r});return b.appendChild(x),[f,b]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const Q=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.id===n)return await Q(),void 0;await this.commands.product.selectFulfillment(e,n),await Q()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const o in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)&&r.push(n.shippingFulfillments[o]);const s=[];for(const o in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)&&s.push(n.onDemandFulfillments[o]);const a=e.selectedFulfillmentType===o.SHIPPING,c=e.selectedFulfillmentType===o.ON_DEMAND,p=a?r:s,m=document.createElement("h5");m.className="popup-retailers-section-title",m.textContent="Delivery Options";const f=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===p.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,f,t]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";for(const o of p){const t=renderPopupRetailerCard({fulfillment:o,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:o.id===e.selectedFulfillmentId,selectedSizeAttributes:i});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),g.appendChild(t)}return[m,f,g]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),i=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==i?void 0:i.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:i.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper"),r.setAttribute("role","region"),r.setAttribute("aria-label",""+n.name);const s=document.createElement("div");if(s.classList.add("product-content"),s.setAttribute("role","region"),s.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,s.appendChild(t)}const a=ComponentFactoryService.createElement({type:i.PRODUCT_OPTIONS,productId:e});s.appendChild(a);const c=ComponentFactoryService.createElement({type:i.PRODUCT_DRAWER,productId:e});if(s.appendChild(c),r.appendChild(s),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return r;r.classList.add("has-images");const p=ComponentFactoryService.createElement({type:i.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return r.prepend(p),p.setAttribute("aria-label","Product images"),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}function createApplyFiltersButton(t){const e=document.createElement("div");e.className="product-list-filters-apply-container";const n=document.createElement("button");return n.className="product-list-filters-apply-btn",n.textContent="Apply Filters",n.addEventListener("click",()=>t()),e.appendChild(n),e}function createCheckboxItem(t){const{filter:e,state:n,item:i,onChange:o}=t,r=document.createElement("div");r.className="checkbox-filter-item";const s=document.createElement("input");s.type="checkbox",s.id=e.type+"-"+i.value,s.value=i.value.toString(),s.className="checkbox-filter-checkbox",s.checked=n.selectedValues.has(i.value.toString()),s.addEventListener("change",o);const a=document.createElement("label");a.htmlFor=s.id,a.className="checkbox-filter-item-label";const c=i.count||0,p=document.createElement("span");p.className="checkbox-filter-item-text",p.textContent=i.name;const m=document.createElement("span");return m.className="checkbox-filter-item-count",m.textContent="("+c+")",a.appendChild(p),a.appendChild(m),r.appendChild(s),r.appendChild(a),r}function handleCheckboxFilterSearch(t){const{filter:e,state:n,searchTerm:i,renderCheckboxItems:o}=t,r=i.toLowerCase().trim();n.filteredItems=r?e.values.filter(t=>{const e=(t.name||t.value.toString()).toLowerCase();return e.includes(r)}):[...e.values],o()}function createCheckboxFilterHeader(t){const{filter:e,state:n,onToggle:i}=t,o=document.createElement("div");o.className="checkbox-filter-header";const r=document.createElement("button");r.className="checkbox-filter-label",r.type="button";const s=document.createElement("span");s.textContent=formatFilterLabel(e.type);const a=document.createElement("span");return a.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),a.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),n.iconElement=a,r.appendChild(s),r.appendChild(a),r.addEventListener("click",()=>i(e.type)),o.appendChild(r),o}function createCheckboxFilterSearchContainer(t){const{state:e,onSearch:n}=t,i=document.createElement("div");i.className="checkbox-filter-search-wrapper",e.searchInput=document.createElement("input"),e.searchInput.type="text",e.searchInput.className="checkbox-filter-search",e.searchInput.placeholder="Search";const o=document.createElement("span");return o.className="checkbox-filter-search-icon",o.innerHTML=SearchIcon({}),e.searchInput.addEventListener("input",t=>{const e=t.target;n(e.value)}),i.appendChild(e.searchInput),i.appendChild(o),i}function renderCheckboxItems(t){const{filter:e,state:n,onCheckboxChange:i}=t;if(n.checkboxList&&(n.checkboxList.innerHTML="",n.filteredItems.forEach(t=>{const o=createCheckboxItem({filter:e,state:n,item:t,onChange:()=>{const e=o.querySelector("input");i(t.value.toString(),e.checked)}});n.checkboxList.appendChild(o)}),0===n.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",n.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createChip(t){const{text:e,onRemove:n}=t,i=document.createElement("div");i.className="chip";const o=document.createElement("span");o.className="chip-text",o.textContent=e,i.appendChild(o);const r=document.createElement("button");return r.className="chip-close",r.type="button",r.innerHTML=CloseIcon({width:16,height:16}),r.setAttribute("aria-label","Remove"),n&&r.addEventListener("click",t=>{t.stopPropagation(),n()}),i.appendChild(r),i}function createChipsContainer(t){const{currentFilters:e,sanitizedFilters:n,onRemoveFilter:i,onClearAllFilters:o}=t,r=document.createElement("div");r.className="product-list-filters-chips-container";const s=getActiveFilters(e,n);if(0===s.length)return r.style.display="none",r;if(r.style.display="flex",s.forEach(t=>{const e=createChip({text:t.label,onRemove:()=>i(t.key,t.value)});r.appendChild(e)}),s.length>0){const t=createClearAllButton(o);r.appendChild(t)}return r}function getActiveFilters(t,e){const n=[];return addBooleanFilters(n,t),addDeliveryFilter(n,t),addPriceFilter(n,t),addDynamicFilters(n,t,e),n}function addBooleanFilters(t,e){(null==e?void 0:e[xt.ENGRAVING])&&t.push({key:m.ENGRAVING,value:"true",label:"Engravable"}),(null==e?void 0:e[xt.PRESALE])&&t.push({key:m.PRESALE,value:"true",label:"Presale"})}function addDeliveryFilter(t,e){if(!(null==e?void 0:e.fulfillment)||(null==e?void 0:e.fulfillment)===wt.ALL)return;const n=(null==e?void 0:e.fulfillment)===wt.ON_DEMAND?"Same-day Delivery":"Shipping";t.push({key:m.FULFILLMENT,value:null==e?void 0:e.fulfillment.toString(),label:n})}function addPriceFilter(t,e){const n=null==e?void 0:e.price;if(!n)return;const i=n.min&&n.min!==kt.MIN,o=n.max&&n.max!==kt.MAX;if(!i&&!o)return;const r=i?"$"+n.min:"$0",s=o?"$"+n.max:"$"+kt.MAX+"+";t.push({key:m.PRICE,value:"price",label:r+" - "+s})}function addDynamicFilters(t,e,n){if(!e)return;const i=getDynamicFilterKeys(e);for(const o of i)addDynamicFilterChips(o,t,e,n)}function getDynamicFilterKeys(t){const e=[xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT,xt.PRICE];return Object.keys(t).filter(t=>!e.includes(t))}function addDynamicFilterChips(t,e,n,i){const o=n[t];if(!Array.isArray(o)||0===o.length)return;const r=null==i?void 0:i.find(e=>e.type===t);o.forEach(n=>{const i=null==r?void 0:r.values.find(t=>t.value.toString()===n),o=(null==i?void 0:i.name)||n;e.push({key:t,value:n,label:o})})}function createClearAllButton(t){const e=document.createElement("button");return e.className="product-list-filters-clear-all",e.textContent="CLEAR ALL FILTERS",e.type="button",e.addEventListener("click",()=>{t()}),e}function createFulfillmentFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:i,onFulfillmentOptionsChange:o,onToggleCollapse:r}=t,elements=[],s=document.createElement("div");s.className="product-list-filters-fulfillment-options";const a=[{value:wt.ALL,label:"All"},{value:wt.SHIPPING,label:"Shipping"},{value:wt.ON_DEMAND,label:"Same-Day Delivery"}],c=document.createElement("div");c.className="product-list-filters-fulfillment-options-header",c.style.cursor="pointer";const p=document.createElement("h3");p.className="product-list-filters-fulfillment-options-label",p.textContent="Fulfillment Options";const m=document.createElement("div");m.className="product-list-filters-chevron",m.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),c.appendChild(p),c.appendChild(m),s.appendChild(c);const f=document.createElement("div");f.className="product-list-filters-fulfillment-options-list",n&&f.classList.add("collapsed");for(const g of a){const t=document.createElement("div");t.className="product-list-filters-fulfillment-option";const n=document.createElement("input");n.type="radio",n.id="fulfillment-"+g.value,n.name="fulfillment-options",n.value=g.value,n.className="product-list-filters-fulfillment-radio";const r="onDemand"===g.value&&i;n.disabled=r;const s=(null==e?void 0:e.fulfillment)||wt.ALL;n.checked=g.value===s,n.addEventListener("change",t=>{const e=t.target;null==o?void 0:o(e.value)});const a=document.createElement("label");a.htmlFor="fulfillment-"+g.value,a.className="product-list-filters-fulfillment-radio-label "+(r?"disabled":""),a.textContent=g.label,t.appendChild(n),t.appendChild(a),f.appendChild(t)}return s.appendChild(f),c.addEventListener("click",()=>{r()}),elements.push(s),{elements,chevronContainer:m,fulfillmentList:f}}function createPriceFilter(t){var e,n,i,o,r,s,a,c;const{priceConfig:p,currentFilters:m,priceCollapsed:f,onPriceChange:g,onToggleCollapse:v,DEFAULT_MIN:b,DEFAULT_MAX:x}=t,elements=[],w=document.createElement("div");w.className="product-list-filters-price";const S=Number.parseInt(null!==(e=null==p?void 0:p.min)&&void 0!==e?e:b,10),E=Number.parseInt(null!==(n=null==p?void 0:p.max)&&void 0!==n?n:x,10),_=Number.parseInt(null!==(r=null!==(o=null===(i=null==m?void 0:m.price)||void 0===i?void 0:i.min)&&void 0!==o?o:null==p?void 0:p.min)&&void 0!==r?r:b,10),F=Number.parseInt(null!==(c=null!==(a=null===(s=null==m?void 0:m.price)||void 0===s?void 0:s.max)&&void 0!==a?a:null==p?void 0:p.max)&&void 0!==c?c:x,10),I=document.createElement("div");I.className="product-list-filters-price-header",I.style.cursor="pointer";const O=document.createElement("h3");O.className="product-list-filters-price-title",O.textContent="Price Range",I.appendChild(O);const R=document.createElement("div");R.className="product-list-filters-chevron",R.innerHTML=f?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),I.appendChild(R),w.appendChild(I);const M=document.createElement("div");M.className="product-list-filters-price-slider-container",f&&M.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const q=document.createElement("div");q.className="product-list-filters-price-track";const U=document.createElement("div");U.className="product-list-filters-price-track-active",q.appendChild(U),B.appendChild(q);const V=document.createElement("input");V.type="range",V.min=S.toString(),V.max=E.toString(),V.value=_.toString(),V.step="1",V.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(V);const K=document.createElement("input");K.type="range",K.min=S.toString(),K.max=E.toString(),K.value=F.toString(),K.step="1",K.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(K),M.appendChild(B);const H=document.createElement("div");H.className="product-list-filters-price-inputs-container";const W=document.createElement("div");W.className="product-list-filters-price-input-wrapper";const X=document.createElement("span");X.className="product-list-filters-price-input-prefix",X.textContent="$";const Z=document.createElement("input");Z.type="number",Z.min=S.toString(),Z.max=E.toString(),Z.value=_.toString(),Z.className="product-list-filters-price-input",Z.placeholder=S.toString(),W.appendChild(X),W.appendChild(Z);const J=document.createElement("span");J.className="product-list-filters-price-separator",J.textContent="to";const $=document.createElement("div");$.className="product-list-filters-price-input-wrapper";const tt=document.createElement("span");tt.className="product-list-filters-price-input-prefix",tt.textContent="$";const et=document.createElement("input");et.type="number",et.min=S.toString(),et.max=E.toString(),et.value=F.toString(),et.className="product-list-filters-price-input",et.placeholder=E+"+",$.appendChild(tt),$.appendChild(et),H.appendChild(W),H.appendChild(J),H.appendChild($),M.appendChild(H),w.appendChild(M);const D=()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10),n=E-S,i=(t-S)/n*100,o=(e-S)/n*100;U.style.left=i+"%",U.style.width=o-i+"%"},h=(t,e)=>{V.value=t.toString(),K.value=e.toString(),Z.value=t.toString(),et.value=e.toString(),D()};return V.addEventListener("input",()=>{let t=Number.parseInt(V.value,10);const e=Number.parseInt(K.value,10);t>e&&(t=e),h(t,e)}),V.addEventListener("change",()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10);null==g?void 0:g(t.toString(),e.toString())}),K.addEventListener("input",()=>{const t=Number.parseInt(V.value,10);let e=Number.parseInt(K.value,10);e<t&&(e=t),h(t,e)}),K.addEventListener("change",()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10);null==g?void 0:g(t.toString(),e.toString())}),Z.addEventListener("input",()=>{let t=Number.parseInt(Z.value,10)||S;const e=Number.parseInt(et.value,10)||E;t=Math.max(S,Math.min(t,E)),t>e&&(t=e),h(t,e),null==g||g(t.toString(),e.toString())}),et.addEventListener("input",()=>{const t=Number.parseInt(Z.value,10)||S;let e=Number.parseInt(et.value,10)||E;e=Math.max(S,Math.min(e,E)),e<t&&(e=t),h(t,e),null==g||g(t.toString(),e.toString())}),D(),I.addEventListener("click",()=>{v()}),elements.push(w),{elements,chevronContainer:R,sliderContainer:M}}function createEngravingFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onEngravingChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-engraving";const r=document.createElement("label");r.className="product-list-filters-engraving-label",r.setAttribute("for","engraving-switch"),r.textContent="Engraved Bottles",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==e?void 0:e.engraving);a&&s.classList.add("active");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="engraving-switch",s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Toggle Engraved Bottles"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.appendChild(c);const u=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},L=()=>{const t=s.classList.contains("active"),e=!t;u(e),null==i||i(e)};if(s.addEventListener("click",()=>{n||L()}),s.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),L())}),o.appendChild(s),n){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}function createPresaleFilter(t){const{currentFilters:e,isPresaleDisabled:n,onPresaleChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-presale";const r=document.createElement("label");r.className="product-list-filters-presale-label",r.setAttribute("for","presale-switch"),r.textContent="Presale",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==e?void 0:e.presale);a&&s.classList.add("active"),n&&s.classList.add("disabled");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="presale-switch",s.setAttribute("tabindex",n?"-1":"0"),s.setAttribute("aria-label","Toggle Presale"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.setAttribute("aria-disabled",n?"true":"false"),s.appendChild(c);const u=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},L=()=>{const t=s.classList.contains("active"),e=!t;u(e),null==i||i(e)};if(s.addEventListener("click",()=>{n||L()}),s.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),L())}),o.appendChild(s),n){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const e=document.createElement("div");e.classList.add("slc__card");const n=document.createElement("div");n.className="slc__image-content";const i=document.createElement("div");i.className="slc__image-wrapper";const o=document.createElement("div");o.classList.add("wave","slc__image"),i.appendChild(o),n.appendChild(i);const r=document.createElement("div");r.className="slc__content";const s=document.createElement("div");s.className="slc__title-container";const a=document.createElement("div");a.classList.add("wave","slc__title","slc__title-line-1"),s.appendChild(a);const c=document.createElement("div");c.classList.add("wave","slc__title","slc__title-line-2"),s.appendChild(c),r.appendChild(s);const p=document.createElement("div");p.className="slc__size-price-wrapper";const m=document.createElement("div");m.classList.add("wave","slc__price"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","slc__size"),p.appendChild(f),r.appendChild(p);const g=document.createElement("div");return g.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(r),e.appendChild(g),e}template(){const elements=[],t=100/this.params.columns;this.container.style.setProperty("--card-width",t+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const e=this.params.rows*this.params.columns;for(let n=0;n<e;n++){const t=this.createSkeletonCard(n);elements.push(t)}return elements}}const FilterIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 24 24" class="filter-icon '+n+'" style="'+o+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};class ProductListFiltersComponent extends BaseComponent{constructor(){super({watchStorePaths:["address","address.formattedAddress","productsList.filters","productsList.appliedFilters"]}),this.DEFAULT_MIN_PRICE=kt.MIN,this.DEFAULT_MAX_PRICE=kt.MAX,this.FILTER_DEBOUNCE_DELAY_MS=500,this.DESKTOP_BREAKPOINT=1024,this.isRenderedInDrawerMode=![],this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![]},this.availableDynamicFilters=[],this.checkboxFilterStateMap=new Map,this.isPriceFilterCollapsed=![],this.isFulfillmentFilterCollapsed=![],this.appliedFiltersChipsContainer=null,this.resizeHandler=null,this.priceFilterDebounceTimer=null}get hostClasses(){const t=["product-list-filters-container"];return this.isRenderedInDrawerMode&&t.push("drawer-mode"),t}async connected(){var t;null===(t=super.connected)||void 0===t?void 0:t.call(this),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.setupResizeListener(),this.setupDrawerCloseListener(),this.syncFiltersFromStore(),this.onStoreWatch()}setupDrawerCloseListener(){document.addEventListener("drawerClosed",()=>{this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.isRenderedInDrawerMode||(this.syncFiltersFromStore(),this.refreshUIStates())})}setupResizeListener(){this.resizeHandler=()=>{const t=window.innerWidth;t>=this.DESKTOP_BREAKPOINT&&(this.commands.ui.closeDrawer(),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.syncFiltersFromStore(),this.refreshUIStates())},window.addEventListener("resize",this.resizeHandler)}detectIfRenderedInDrawer(){var t,e,n;let i=this.parentElement;for(;i;){if((null===(t=i.classList)||void 0===t?void 0:t.contains("drawer"))||(null===(e=i.hasAttribute)||void 0===e?void 0:e.call(i,"data-drawer"))||"drawer-component"===(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase()))return!![];i=i.parentElement}return![]}onStoreWatch(){const{filters:t}=this.getStoreValue("productsList");t&&Array.isArray(t)&&t.length>0&&(this.availableDynamicFilters=t),this.syncFiltersFromStore(),this.refreshUIStates()}syncFiltersFromStore(){const{appliedFilters:t}=this.getStoreValue("productsList");if(t){const e={};for(const[n,i]of Object.entries(t))e[n]=this.transformFilterValue(n,i);this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![],...e},this.checkboxFilterStateMap.clear()}}refreshUIStates(){!this.isRenderedInDrawerMode&&this.appliedFiltersChipsContainer&&(this.appliedFiltersChipsContainer.innerHTML="",this.appliedFiltersChipsContainer.appendChild(this.buildAppliedFiltersChipsContainer())),this.engravingFiltersContainer&&(this.engravingFiltersContainer.innerHTML="",this.buildEngravingFilterElements().forEach(t=>{var e;null===(e=this.engravingFiltersContainer)||void 0===e?void 0:e.appendChild(t)})),this.presaleFilterContainer&&(this.presaleFilterContainer.innerHTML="",this.buildPresaleFilterElements().forEach(t=>{var e;null===(e=this.presaleFilterContainer)||void 0===e?void 0:e.appendChild(t)})),this.dynamicFiltersContainer&&(this.dynamicFiltersContainer.innerHTML="",this.buildDynamicFiltersElements().forEach(t=>{var e;null===(e=this.dynamicFiltersContainer)||void 0===e?void 0:e.appendChild(t)}))}transformFilterValue(t,e){if(t===xt.ENGRAVING||t===xt.PRESALE)return Array.isArray(e)?"true"===e[0]:"true"===e;if(t===xt.FULFILLMENT)return Array.isArray(e)?e[0]:e;if(t!==xt.PRICE)return e;if(Array.isArray(e)&&e[0])try{return JSON.parse(e[0])}catch(n){this.logger.error("Error fetching products with updated filters:",n)}}async fetchFilters(){const{searchTerm:t}=this.getStoreValue("productsList");try{this.store.set("productsList.loading",!![]),this.store.batch({"productsList.products":[],"productsList.retailers":{}}),this.commands.productList.syncFiltersFromComponent(this.permanentFilters),await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),t,this.permanentFilters,this.params.filters);const{filters:e}=this.getStoreValue("productsList");this.availableDynamicFilters=e}catch(e){throw this.logger.error("Error fetching products with updated filters:",e),this.store.set("productsList.loading",![]),e}}async applyFiltersAndCloseDrawer(){await this.fetchFilters(),this.syncFiltersFromStore(),this.commands.ui.closeDrawer()}template(){const t=[];if(!this.isRenderedInDrawerMode){this.filterButtonContainer=document.createElement("div"),this.filterButtonContainer.className="product-list-filter-button-host";const e=this.getStoreValue("productsList"),n=null==e?void 0:e.filters;(null==n?void 0:n.length)>0&&this.filterButtonContainer.appendChild(this.buildFilterButton()),t.push(this.filterButtonContainer)}const e=document.createElement("div");e.className=this.isRenderedInDrawerMode?"product-list-filters-content-wrapper drawer-mode":"product-list-filters-content-wrapper";const n=this.buildFilterHeader();e.appendChild(n),this.appliedFiltersChipsContainer=this.buildAppliedFiltersChipsContainer(),e.appendChild(this.appliedFiltersChipsContainer),this.engravingFiltersContainer=document.createElement("div"),this.engravingFiltersContainer.className="product-list-engraving-filters-container";const i=this.buildEngravingFilterElements();for(const c of i)this.engravingFiltersContainer.appendChild(c);e.appendChild(this.engravingFiltersContainer),this.presaleFilterContainer=document.createElement("div"),this.presaleFilterContainer.className="product-list-presale-filters-container";const o=this.buildPresaleFilterElements();for(const c of o)this.presaleFilterContainer.appendChild(c);e.appendChild(this.presaleFilterContainer),this.fulfillmentFilterContainer=document.createElement("div"),this.fulfillmentFilterContainer.className="product-list-fulfillment-filters-container";const r=this.buildFulfillmentFilterElements();for(const c of r)this.fulfillmentFilterContainer.appendChild(c);e.appendChild(this.fulfillmentFilterContainer),this.priceFiltersContainer=document.createElement("div"),this.priceFiltersContainer.className="product-list-price-filters-container";const s=this.buildPriceFilterElements();for(const c of s)this.priceFiltersContainer.appendChild(c);e.appendChild(this.priceFiltersContainer),this.dynamicFiltersContainer=document.createElement("div"),this.dynamicFiltersContainer.className="product-list-dynamic-filters-container";const a=this.buildDynamicFiltersElements();for(const c of a)this.dynamicFiltersContainer.appendChild(c);return e.appendChild(this.dynamicFiltersContainer),this.isRenderedInDrawerMode&&e.appendChild(createApplyFiltersButton(()=>{void this.applyFiltersAndCloseDrawer()})),t.push(e),t}buildFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const e=document.createElement("div");e.className="product-list-filter-icon",e.innerHTML=FilterIcon({}),e.style.cursor="pointer",e.addEventListener("click",()=>{this.openFilterDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",n.style.cursor="pointer",n.addEventListener("click",()=>{this.openFilterDrawer()}),t.appendChild(e),t.appendChild(n),t}openFilterDrawer(){this.commands.ui.openDrawer(i.PRODUCT_LIST_FILTERS,{filters:this.params.filters||[]})}buildFilterHeader(){const t=document.createElement("div");t.className="product-list-filters-header",this.isRenderedInDrawerMode&&t.classList.add("drawer-mode");const e=document.createElement("h3");if(e.className="product-list-filters-title",e.textContent="Filters",t.appendChild(e),this.isRenderedInDrawerMode){const e=document.createElement("button");e.className="product-list-filters-close-btn",e.innerHTML=CloseIcon({}),e.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),t.appendChild(e)}return t}async clearAllActiveFilters(){this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![]},await this.fetchFilters()}async removeSingleFilter(t,e){switch(t){case m.ENGRAVING:this.permanentFilters[xt.ENGRAVING]=![];break;case m.PRESALE:this.permanentFilters[xt.PRESALE]=![];break;case m.FULFILLMENT:this.permanentFilters[xt.FULFILLMENT]=wt.ALL;break;case m.PRICE:delete this.permanentFilters.price;break;default:{const n=this.checkboxFilterStateMap.get(t);if(n){n.selectedValues.delete(e);const i=Array.from(n.selectedValues);i.length>0?this.permanentFilters[t]=i:delete this.permanentFilters[t]}break}}await this.fetchFilters()}getFilteredAndSanitizedFilters(){return this.params.filters&&0!==this.params.filters.length?this.commands.productList.getSanitizedFilters(this.availableDynamicFilters,this.params.filters):[]}buildAppliedFiltersChipsContainer(){return createChipsContainer({currentFilters:this.permanentFilters,sanitizedFilters:this.getFilteredAndSanitizedFilters(),onRemoveFilter:(t,e)=>this.removeSingleFilter(t,e),onClearAllFilters:()=>this.clearAllActiveFilters()})}async handleFilterChange(){this.commands.productList.syncFiltersFromComponent(this.permanentFilters),this.isRenderedInDrawerMode||await this.fetchFilters()}isEngravingCurrentlyDisabled(){return this.permanentFilters[xt.FULFILLMENT]===wt.ON_DEMAND}buildEngravingFilterElements(){return createEngravingFilter({currentFilters:this.permanentFilters,isPersonalizationDisabled:this.isEngravingCurrentlyDisabled(),onEngravingChange:async t=>{this.permanentFilters[xt.ENGRAVING]=t,await this.handleFilterChange()}})}buildPresaleFilterElements(){return createPresaleFilter({currentFilters:this.permanentFilters,isPresaleDisabled:this.permanentFilters[xt.FULFILLMENT]===wt.ON_DEMAND,onPresaleChange:async t=>{this.permanentFilters[xt.PRESALE]=t,await this.handleFilterChange()}})}isSameDayDeliveryCurrentlyDisabled(){return!(!this.permanentFilters[xt.ENGRAVING]&&!this.permanentFilters[xt.PRESALE])}toggleFulfillmentFilterCollapse(){this.isFulfillmentFilterCollapsed=!this.isFulfillmentFilterCollapsed,this.fulfillmentOptionsList&&this.fulfillmentOptionsList.classList.toggle("collapsed"),this.fulfillmentFilterChevronIcon&&(this.fulfillmentFilterChevronIcon.innerHTML=this.isFulfillmentFilterCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}buildFulfillmentFilterElements(){const t=createFulfillmentFilter({currentFilters:this.permanentFilters,deliveryCollapsed:this.isFulfillmentFilterCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryCurrentlyDisabled(),onFulfillmentOptionsChange:async t=>{this.permanentFilters[xt.FULFILLMENT]=t,t===wt.ON_DEMAND&&(this.permanentFilters[xt.ENGRAVING]=![],this.permanentFilters[xt.PRESALE]=![]),await this.handleFilterChange()},onToggleCollapse:()=>this.toggleFulfillmentFilterCollapse()});return this.fulfillmentFilterChevronIcon=t.chevronContainer,this.fulfillmentOptionsList=t.fulfillmentList,t.elements}togglePriceFilterCollapse(){this.isPriceFilterCollapsed=!this.isPriceFilterCollapsed,this.priceSliderWrapper&&this.priceSliderWrapper.classList.toggle("collapsed"),this.priceFilterChevronIcon&&(this.priceFilterChevronIcon.innerHTML=this.isPriceFilterCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}buildPriceFilterElements(){const t=createPriceFilter({priceConfig:{min:kt.MIN,max:kt.MAX},currentFilters:this.permanentFilters,priceCollapsed:this.isPriceFilterCollapsed,onPriceChange:async(t,e)=>{this.permanentFilters.price||(this.permanentFilters.price={}),t!==kt.MIN?this.permanentFilters.price.min=t:delete this.permanentFilters.price.min,e!==kt.MAX?this.permanentFilters.price.max=e:delete this.permanentFilters.price.max,this.priceFilterDebounceTimer&&clearTimeout(this.priceFilterDebounceTimer),this.isRenderedInDrawerMode||(this.priceFilterDebounceTimer=setTimeout(async()=>{await this.handleFilterChange()},this.FILTER_DEBOUNCE_DELAY_MS))},onToggleCollapse:()=>this.togglePriceFilterCollapse(),DEFAULT_MIN:this.DEFAULT_MIN_PRICE,DEFAULT_MAX:this.DEFAULT_MAX_PRICE});return this.priceFilterChevronIcon=t.chevronContainer,this.priceSliderWrapper=t.sliderContainer,t.elements}buildDynamicFiltersElements(){const elements=[],t=this.getFilteredAndSanitizedFilters(),e=new Set([xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT]);for(const n of t)if(!e.has(n.type)){const t=this.getFilterElements(n);elements.push(...t)}return elements}getFilterElements(t){return this.buildCheckboxFilterElements(t)}buildCheckboxFilterElements(t){const elements=[];if(!this.checkboxFilterStateMap.has(t.type)){const e=this.permanentFilters[t.type],n=Array.isArray(e)?new Set(e):new Set;this.checkboxFilterStateMap.set(t.type,{isExpanded:n.size>0,selectedValues:n,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:n.size>0})}const e=this.checkboxFilterStateMap.get(t.type);e.filteredItems=[...t.values];const n=document.createElement("div");n.className="product-list-checkbox-filter",n.setAttribute("data-filter-category",t.type);const i=document.createElement("div");i.className="checkbox-filter-container";const o=createCheckboxFilterHeader({filter:t,state:e,onToggle:t=>this.toggleCheckboxFilterExpansion(t)});i.appendChild(o);const r=document.createElement("div");r.className="checkbox-filter-content "+(e.isExpanded?"expanded":"collapsed"),e.contentElement=r;const s=createCheckboxFilterSearchContainer({state:e,onSearch:n=>{handleCheckboxFilterSearch({filter:t,state:e,searchTerm:n,renderCheckboxItems:()=>this.renderCheckboxItemsForFilter(t,e)})}});return r.appendChild(s),e.checkboxList=document.createElement("div"),e.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsForFilter(t,e),r.appendChild(e.checkboxList),i.appendChild(r),n.appendChild(i),elements.push(n),elements}toggleCheckboxFilterExpansion(t){const e=this.checkboxFilterStateMap.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}renderCheckboxItemsForFilter(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,i)=>this.handleCheckboxSelectionChange(t.type,e,n,i)})}async handleCheckboxSelectionChange(t,e,n,i){i?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e));const o=Array.from(e.selectedValues);o.length>0?this.permanentFilters[t]=o:delete this.permanentFilters[t],await this.handleFilterChange()}}class ProductListRetailersComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["productsList.userProducts"]})}getProductId(){return this.params.productId}template(){var t,e,n,i,r,s,a,c,p,m;const f=this.getProductId(),g=this.params.config||this.config,v=this.getStoreValue("productsList"),b=v.products.find(t=>(t.salsifyGrouping||t.id)===f);if(!b)return[];const x=null===(t=v.userProducts[f])||void 0===t?void 0:t.selectedSizeId,w=Object.values(b.sizes).find(t=>t.id===x);if(!w)return[];const S=document.createElement("div");S.className="retailers-popup-wrapper";const E=w.attributes||null,_=this.extractFulfillments(w.shippingFulfillments),F=this.extractFulfillments(w.onDemandFulfillments),I=null===(e=v.userProducts[f])||void 0===e?void 0:e.selectedFulfillmentType,O=I===o.SHIPPING,R=I===o.ON_DEMAND,M=O?_:F;S.appendChild(this.createHeader());const B=renderFulfillmentTabsContainer({shippingFulfillments:_,onDemandFulfillments:F,shippingSelected:O,onDemandSelected:R,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:null!==(r=null===(i=null===(n=null==g?void 0:g.layout)||void 0===n?void 0:n.productCard)||void 0===i?void 0:i.enableShippingFulfillment)&&void 0!==r?r:!![],enableOnDemandFulfillment:null!==(c=null===(a=null===(s=null==g?void 0:g.layout)||void 0===s?void 0:s.productCard)||void 0===a?void 0:a.enableOnDemandFulfillment)&&void 0!==c?c:!![]});if(S.appendChild(B),0===M.length)S.appendChild(this.createNoAvailabilityMessage());else{const t=null===(m=null===(p=v.userProducts[f])||void 0===p?void 0:p.selectedFulfillment)||void 0===m?void 0:m.id,e=document.createElement("div");e.className="popup-fulfillment-list-container";for(const n of M){const i=renderPopupRetailerCard({fulfillment:n,selectedFulfillmentType:I,isSelected:n.id===t,selectedSizeAttributes:E});i.addEventListener("click",async()=>{await this.onRetailerCardClick(n.id)}),e.appendChild(i)}S.appendChild(e)}return[S]}extractFulfillments(t){return t?Object.values(t):[]}onFulfillmentTabClick(t){const e=t.currentTarget,n=e.getAttribute("data-fulfillment-type");n&&this.commands.productList.selectFulfillmentType(this.getProductId(),n)}async onRetailerCardClick(t){const e=this.getProductId();t&&(await this.commands.productList.selectFulfillment(e,t),this.commands.productList.updateQuantity(e,1),this.clientConfig.isMobile()?this.commands.ui.closeDrawer():this.commands.ui.closeModal())}createHeader(){const t=document.createElement("div");t.className="retailers-popup-header";const e=document.createElement("h5");e.className="retailers-popup-title",e.textContent="Select a Retailer",t.appendChild(e);const n=document.createElement("button");return n.className="retailers-popup-close",n.innerHTML=CloseIcon({}),n.addEventListener("click",()=>this.commands.ui.closeModal()),t.appendChild(n),t}createNoAvailabilityMessage(){const t=document.createElement("p");return t.className="retailers-popup-no-data",t.innerHTML=sanitizeHTML("No delivery options available at this time."),t}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.debounceTimer=null,this.currentSearchTerm="",this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100,this.DEFAULT_DEBOUNCE_MS=500}get hostClasses(){return["product-list-search__control-container"]}disconnectedCallback(){super.disconnectedCallback(),this.cleanupDebounceTimer()}getCurrentSearchTerm(){return this.currentSearchTerm}async fetchProducts(){try{this.commands.productList.setLoading(!![]),this.store.batch({"productList.products":[],"productList.retailers":{}});const t=this.getStoreValue("productsList"),e=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),this.currentSearchTerm,e,[])}catch(t){throw this.logger.error("Error fetching products with search term:",t),this.commands.productList.setLoading(![]),t}}buildCurrentFiltersFromState(t){const e={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL};for(const[n,i]of Object.entries(t))n===xt.PRICE?e.price=i:n===xt.FULFILLMENT?e.fulfillment=i:e[n]=i;return e}template(){const elements=[],t=document.createElement("div");t.className="product-list-search-box";const e=document.createElement("span");return e.className="product-list-search-icon",e.innerHTML=SearchIcon({}),e.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.id="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,i=this.cleanInput(n);i!==n&&(e.value=i),this.updateClearButtonVisibility(i);const o=this.normalizeForSearch(i);o!==this.currentSearchTerm&&this.handleDebouncedSearch(o)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display="none",this.clearButton.addEventListener("click",()=>{this.handleClearSearch()}),t.appendChild(e),t.appendChild(this.searchInput),t.appendChild(this.clearButton),elements.push(t),elements}handleDebouncedSearch(t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.currentSearchTerm=t,this.commands.productList.updateSearchTerm(t),this.fetchProducts()},this.DEFAULT_DEBOUNCE_MS)}handleClearSearch(){var t;const e=""!==(null===(t=this.searchInput)||void 0===t?void 0:t.value);this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),e&&(this.currentSearchTerm="",this.commands.productList.updateSearchTerm(""),this.fetchProducts())}cleanInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}normalizeForSearch(t){return t?t.trim().replace(/\s+/g," "):""}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}cleanupDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}}class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},this.cardsContainer=null,this.sentinelElement=null,this.loadingState=St.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise,this.unsubscribeFromState=this.commands.productList.subscribe(t=>{this.handleStateUpdate(t)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(St.LOADING_INITIAL),this.commands.productList.setGridConfig(this.params.rows,this.params.columns),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(St.IDLE)}catch(bt){this.logger.error("Error initializing product list:",bt),this.setLoadingState(St.ERROR),this.showErrorState("Failed to load products")}}handleStateUpdate(t){this.updateLoadingState(t.loading);const e=this.hasProductsChanged(t.products);!e&&t.loading||(this.updateProductData(t),this.handleProductRendering(t.products))}updateLoadingState(t){const e=this.loadingState===St.LOADING_INITIAL||this.loadingState===St.LOADING_MORE;t&&0===this.products.length?this.setLoadingState(St.LOADING_INITIAL):t&&this.products.length>0?this.setLoadingState(St.LOADING_MORE):!t&&e&&this.setLoadingState(St.IDLE)}hasProductsChanged(t){return t.length!==this.products.length||t.some((t,e)=>{var n;return t.id!==(null===(n=this.products[e])||void 0===n?void 0:n.id)})}updateProductData(t){this.products=t.products,this.retailers=t.retailers,this.pagination=t.pagination}handleProductRendering(t){var e;if(!this.cardsContainer)return;const n=this.getStoreValue("address.formattedAddress");t.length>0&&n?(this.renderProducts(),this.setupInfiniteScroll()):!n&&t.length>0&&(this.renderSimplifiedProducts(t),this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:null===(e=this.getStoreValue("productsList").products[0])||void 0===e?void 0:e.id,isIndependentComponent:!![]}))}renderSimplifiedProducts(t){this.clearCardsContainer();const e=t.map(t=>ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:t,shippingFulfillment:{},onDemandFulfillment:{},productUrl:this.params.productUrl}));e.forEach(t=>{this.cardsContainer.appendChild(t)}),this.setupInfiniteScroll()}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case St.LOADING_INITIAL:this.renderLoadingState();break;case St.ERROR:break;case St.IDLE:case St.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){try{const t=this.getStoreValue("productsList");await this.commands.productList.loadInitialProducts(0,this.params.rows*this.params.columns,t.searchTerm,t.appliedFilters,this.params.filters);const e=this.getStoreValue("productsList");this.products=e.products,this.retailers=e.retailers,this.pagination=e.pagination}catch(t){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],t}}async loadMoreProducts(){if(this.loadingState!==St.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(St.LOADING_MORE);const t=this.getStoreValue("productsList"),e=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadMoreProducts(this.params.rows*this.params.columns,t.searchTerm,e,this.params.filters);const n=this.getStoreValue("productsList"),i=this.products.length;this.products=n.products,this.retailers=n.retailers,this.pagination=n.pagination;const o=this.products.slice(i);o.length>0&&this.appendNewProducts(o),this.setLoadingState(St.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(St.ERROR),this.showSentinelError("Error loading products")}}buildCurrentFiltersFromState(t){const e={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL};for(const[n,i]of Object.entries(t))this.mapStateFilterToComponentFilter(e,n,i);return e}mapStateFilterToComponentFilter(t,e,n){switch(e){case xt.PRICE:"object"!=typeof n||Array.isArray(n)||(t.price=n);break;case xt.FULFILLMENT:"string"==typeof n&&(t.fulfillment=n);break;case xt.ENGRAVING:"boolean"==typeof n&&(t[xt.ENGRAVING]=n);break;case xt.PRESALE:"boolean"==typeof n&&(t[xt.PRESALE]=n);break;default:Array.isArray(n)&&(t[e]=n)}}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const e=100/this.params.columns;return t.style.setProperty("--card-width",e+"%"),t.style.setProperty("--columns",""+this.params.columns),t}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD_LOADING,rows:this.params.rows,columns:this.getResponsiveColumns(),filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const e=this.createProductCard(t);e&&this.cardsContainer.appendChild(e)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const e of t){const t=this.createProductCard(e);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const e=this.commands.productList.extractProductCardData(t,this.retailers);return e?ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:e.product,shippingFulfillment:e.retailer.shippingFulfillment,onDemandFulfillment:e.retailer.onDemandFulfillment,productUrl:this.params.productUrl}):null}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const e=t[0];e.isIntersecting&&this.loadingState===St.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let e;t.innerHTML="",e=this.loadingState===St.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(e)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const e=this.createErrorElement(t);this.sentinelElement.appendChild(e)}createLoadingElement(t){const e=document.createElement("div");e.className="product-list-sentinel-container";const n=document.createElement("div");n.className="product-list-sentinel-spinner";const i=document.createElement("div");return i.className="product-list-sentinel-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createErrorElement(t){const e=document.createElement("div");e.className="product-list-sentinel-error-container";const n=document.createElement("div");n.className="product-list-sentinel-error-icon",n.innerHTML="⚠";const i=document.createElement("div");return i.className="product-list-sentinel-error-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createInfoElement(t,e=![]){const n=document.createElement("div");if(n.className="product-list-sentinel-info-container",!e&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",n.appendChild(t)}else if(e){const t=document.createElement("div");t.className="product-list-sentinel-divider",n.appendChild(t)}const i=document.createElement("div");return i.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",i.textContent=t,n.appendChild(i),n}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const e=this.createErrorElement(t);this.cardsContainer.appendChild(e)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.sentinelElement=null,this.initializationPromise=null}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.pagination=this.commands.productList.createInitialPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(n){this.logger.error("Error refetching products after address change:",n),this.setLoadingState(St.ERROR),this.cardsContainer&&this.showErrorState("Failed to refetch products")}}template(){const elements=[],t=document.createElement("div");return t.className="product-list-controls",this.cardsContainer=this.createCardsContainer(),t.appendChild(this.cardsContainer),elements.push(t),this.renderCurrentState(),elements}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?e.slice(0,1):e}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,e.appendChild(n),e.appendChild(i),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(i.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(i,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var t,e,n,i;if(this.engravingLines=this.params.lines,"product"===this.params.context){const o=this.store.get("products."+this.params.identifier);this.fulfillmentId=o.selectedFulfillmentId,this.partNumber=(null===(t=o.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null,this.isPresale=(null===(i=null===(n=null===(e=o.sizes[o.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.presale)||void 0===i?void 0:i.isActive)||![]}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),i=n.sizes[n.selectedSizeId],o=i.shippingFulfillments[this.fulfillmentId],r=o.variant.price,s=(null===(e=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return r+s}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier);i.sizes[i.selectedSizeId].image?t.push(i.sizes[i.selectedSizeId].image):t.push(...i.images||[]),e=i.name,n=i.sizes[i.selectedSizeId].size}if("cart"===this.params.context){const i=this.store.get("cart.items."+this.params.identifier);i.mainImage&&t.push(i.mainImage),e=i.name,n=i.size}const i=document.createElement("div");if(i.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const o=document.createElement("img");o.src=t[0],o.alt=e,o.loading="lazy",o.className="product-image",n.appendChild(o),i.appendChild(n)}const o=document.createElement("div");o.className="product-details-container";const r=document.createElement("div");r.className="product-header";const s=document.createElement("h4");s.className="product-title",s.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),r.appendChild(s),r.appendChild(this.productPriceSpan),o.appendChild(r);const a=document.createElement("p");a.className="product-size-text",a.textContent=n,o.appendChild(a);const c=document.createElement("p");return c.className="engraving-fees-disclaimer",c.textContent="Personalization fees included in total, varies by retailer.",o.appendChild(c),i.appendChild(o),i}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=this.isPresale?e.layout.preSaleButtonText:e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,i,o,r,s;const a=this.store.get("products."+this.params.identifier),c=a.sizes[a.selectedSizeId],p=Object.values(c.shippingFulfillments).filter(t=>t.variant.isEngravable),m=document.createElement("div");m.className="fulfillment-section";const f=document.createElement("p");if(f.className="shipping-from-text",f.innerHTML="Shipping from: <b>"+(null===(t=a.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",m.appendChild(f),1===p.length)return m;const g=document.createElement("div");g.className="fulfillment-options-container",m.appendChild(g);const v=document.createElement("span");v.className="see-more-fulfillments",v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false");const l=()=>{const t=g.classList.contains("expanded");g.classList.toggle("expanded"),t?(v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false")):(v.textContent="See Less Delivery Options",v.setAttribute("aria-label","See Less Delivery Options"),v.setAttribute("aria-expanded","true"))};v.addEventListener("click",l),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l())}),m.appendChild(v);for(const b of p){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",b.id),b.id===(null===(e=a.selectedFulfillment)||void 0===e?void 0:e.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+b.retailerName+", "+formatCentToDollarText(b.variant.price+((null===(i=null===(n=a.sizes[a.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0))+", "+b.engravingExpectation),t.setAttribute("aria-pressed",b.id===(null===(o=a.selectedFulfillment)||void 0===o?void 0:o.id)?"true":"false");const Y=()=>{this.fulfillmentId=b.id,this.partNumber=b.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=g.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+b.retailerName+"</b>"};t.addEventListener("click",Y),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y())});const c=b.variant.price+((null===(s=null===(r=a.sizes[a.selectedSizeId].attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.fee)||0),p=document.createElement("div");p.className="option-row row-1",t.appendChild(p);const m=document.createElement("span");m.className="retailer-name",m.textContent=b.retailerName,p.appendChild(m);const v=document.createElement("span");v.className="fulfillment-price",v.textContent=formatCentToDollarText(c),p.appendChild(v),t.appendChild(p);const x=document.createElement("div");x.className="option-row row-2",t.appendChild(x);const w=document.createElement("span");w.className="estimated-time",w.textContent=b.engravingExpectation,x.appendChild(w),t.appendChild(x),g.appendChild(t)}return m}engravingLinesSection(){var t;const e=this.getConfigs("global"),{lines:n,maxLines:i,location:o,maxCharsPerLine:r}=this.params,s=document.createElement("div");s.className="engraving-section";const a=document.createElement("p");if(a.className="engraving-title",a.textContent=e.layout.personalizationText,s.appendChild(a),o&&(null===(t=null==o?void 0:o.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+o.toLowerCase()+".",s.appendChild(t)}const c=Array.from({length:i},(t,e)=>{const i=e+1,o=document.createElement("div");o.className="engraving-input-wrapper",o.setAttribute("data-line-number",i.toString());const s=document.createElement("input");s.type="text",s.id="engraving-line-"+i,s.dataset.lineNumber=i.toString(),s.maxLength=r,s.value=n[e]||"",s.placeholder=i>1?"Line "+i+" (optional)":"Line "+i,s.className="engraving-input",s.autocomplete="off",s.setAttribute("aria-label",i>1?"Engraving line "+i+", optional, maximum "+r+" characters":"Engraving line "+i+", maximum "+r+" characters");const a=document.createElement("span");return a.className="engraving-char-count",a.textContent=s.value.length+"/"+r,a.setAttribute("aria-live","polite"),a.setAttribute("aria-atomic","true"),s.addEventListener("input",()=>{a.textContent=s.value.length+"/"+r,this.engravingLines[e]=s.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),o.appendChild(s),o.appendChild(a),o}),p=document.createElement("div");return p.className="engraving-inputs-container",p.append(...c),s.appendChild(p),s}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const o=document.createElement("button");o.type="button",o.className="cancel-action-button",o.textContent="Cancel",o.setAttribute("aria-label","Cancel personalization and close");const Q=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(i.CART)};o.addEventListener("click",Q),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Q())}),n.appendChild(o),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const k=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t};this.isPresale?await this.commands.product.addPresaleToCart(t,e):await this.commands.product.addToCart(t,e),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(i.CART))};return this.addToCartButton.addEventListener("click",k),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),k())}),n.appendChild(this.addToCartButton),n}template(){const elements=[],t=this.productInformationSection();if(elements.push(t),"product"===this.params.context){const t=this.retailersSection();elements.push(t)}const e=this.engravingLinesSection();elements.push(e);const n=this.actionButtonsSection();elements.push(n);const i=document.createElement("p");return i.className="engraving-disclaimer",i.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",elements.push(i),elements}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,o,r,s,a,c,p,m,f,g,v,b,x,w,S,E,_,F;const I=this.params.identifier,O={identifier:I,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+I);O.lines=(null===(e=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],O.maxLines=(null===(o=null===(n=null==i?void 0:i.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.maxLines)||1,O.maxCharsPerLine=(null===(s=null===(r=null==i?void 0:i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,O.fee=(null===(c=null===(a=null==i?void 0:i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,O.location=(null===(m=null===(p=null==i?void 0:i.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+I);O.lines=(null===(g=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.lines)||[],O.maxLines=(null===(b=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.maxLines)||1,O.maxCharsPerLine=(null===(w=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.maxCharsPerLine)||16,O.fee=(null===(E=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===E?void 0:E.fee)||0,O.location=(null===(F=null===(_=null==t?void 0:t.attributes)||void 0===_?void 0:_.engraving)||void 0===F?void 0:F.location)||""}this.commands.ui.openDrawer(i.ENGRAVING_FORM,O)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");if(o.className="engraving-fee",1===t.quantity&&(o.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){o.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",o.appendChild(e)}n.appendChild(i),n.appendChild(o);const r=document.createElement("div");r.className="engraving-body";const s=document.createElement("div");s.className="engraving-lines";for(const p of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=p,s.appendChild(t)}const a=document.createElement("div");a.className="engraving-actions";const c=document.createElement("button");c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.setAttribute("aria-label","Remove engraving");const u=async()=>{await this.handleRemove()};if(c.addEventListener("click",u),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await u())}),a.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),a.appendChild(t)}return r.appendChild(s),r.appendChild(a),[n,r]}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,i=e.value;n>0&&/\D/.test(i[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target,n=e.value,i=e.selectionStart||0;let o=0,r;if(i>2&&(o=1),i>5&&(o=2),n.includes("/")){const t=n.split("/");let e=(t[0]||"").replace(/\D/g,"").substring(0,2);const i=(t[1]||"").replace(/\D/g,"");let o=i.substring(0,2);const s=i.substring(2);let a=(t[2]||"").replace(/\D/g,"");if(a=(s+a).substring(0,4),""===e&&3===t.length&&(e="01"),2===e.length){let t=Number.parseInt(e,10);t>12&&(t=12),t<1&&(t=1),e=t.toString().padStart(2,"0")}if(""===o&&3===t.length&&(o="01"),2===o.length){let t=Number.parseInt(o,10);t>31&&(t=31),t<1&&(t=1),o=t.toString().padStart(2,"0")}r=e,(t.length>1||o)&&(r+="/"+o),(a||t.length>2)&&(r+="/"+a)}else{let t=n.replace(/\D/g,"");if(t.length>8&&(t=t.substring(0,8)),t.length>=2){let e=Number.parseInt(t.substring(0,2),10);e>12&&(e=12),t=e.toString().padStart(2,"0")+t.substring(2)}if(t.length>=4){let e=Number.parseInt(t.substring(2,4),10);e>31&&(e=31),t=t.substring(0,2)+e.toString().padStart(2,"0")+t.substring(4)}r=t.length>=5?t.substring(0,2)+"/"+t.substring(2,4)+"/"+t.substring(4):t.length>=3?t.substring(0,2)+"/"+t.substring(2):t}if(e.value=r,n.includes("/")){let t;t=0===o?Math.min(i,2):1===o?Math.min(i,5):r.length,e.setSelectionRange(t,t)}}validateEmail(t){const e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,i,o]=t.split("/").map(Number),r=new Date(o,n-1,i);return r.getFullYear()===o&&r.getMonth()===n-1&&r.getDate()===i}parseDateString(t){if(!this.validateDate(t))return null;const[e,n,i]=t.split("/").map(Number);return new Date(i,e-1,n)}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,n}validateDateConstraints(t){const e=[],n=this.params.validation;if(!n)return e;const i=this.parseDateString(t);if(!i)return e;const o=i.getFullYear();void 0!==n.minYear&&o<n.minYear&&e.push("Year must be "+n.minYear+" or later"),void 0!==n.maxYear&&o>n.maxYear&&e.push("Year must be "+n.maxYear+" or earlier");const r=this.calculateAge(i);return void 0!==n.minAge&&r<n.minAge&&e.push("Must be at least "+n.minAge+" years old"),void 0!==n.maxAge&&r>n.maxAge&&e.push("Must be no more than "+n.maxAge+" years old"),e}isFieldComplete(){var t,e,n;const i=this.inputElement.value.trim();if(!i)return![];switch(this.params.inputType){case"tel":return this.validateTel(i);case"date":case"birthdate":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(e=this.params.validation)||void 0===e?void 0:e.max)&&i.length>=this.params.validation.max||(null===(n=this.params.validation)||void 0===n?void 0:n.min)&&i.length>=this.params.validation.min?!![]:i.length>=3}}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),!n.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"===this.params.inputType||"birthdate"===this.params.inputType)if(this.validateDate(t)){const n=this.validateDateConstraints(t);e.push(...n)}else e.push("Please enter a valid date (MM/DD/YYYY)");if("number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&i<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&i>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const i=new RegExp(n.pattern);i.test(t)||e.push("Invalid format")}if(n.customValidator){const i=n.customValidator(t);i&&e.push(i)}}this.showErrors(e);const i=0===e.length;return this.params.onValidation&&this.params.onValidation(i,e),i}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const elements=[];if(this.params.label){const e=document.createElement("label");e.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(e.textContent+="*"),e.setAttribute("for",this.params.name),elements.push(e)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",elements.push(this.inputElement),elements.push(this.errorContainer),elements}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.U=t=>{e.rerender(t||"LceElementRerender")}),this.V.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),i=n.getStylesheet(t);this.applyThemeStyles(i),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.V.adoptedStyleSheets=[e,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(bt){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.V&&this.V.appendChild(e)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of n){const n=i.trim();if(!n)continue;const o=document.createElement("span");o.classList.add("promo-ticker__text-item"),o.textContent=n,e.appendChild(o);const r=document.createElement("span");r.classList.add("promo-ticker__separator"),r.textContent=t.separator,e.appendChild(r)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let o=0;o<5;o++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",i.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=i,[e,i]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=e[this.params.messageType]||"warning",o=document.createElement("div");return o.className="alert-icon alert-icon-"+this.params.messageType,o.appendChild(htmlStringToElement(n[i]({width:16,height:16,className:"alert-icon-svg"}))),o}template(){var t;const elements=[],e=this.getIconElement();e&&elements.push(e);const n=document.createElement("span");if(n.className="alert-message",n.textContent=this.params.message,elements.push(n),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const e=document.createElement("small");e.className="alert-details-text",e.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(e),elements.push(t)}return elements}}const Lt=LoggerFactory.get("ClientHelpers"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},i=[];for(const o in e){const r=e[o],s=n[o];if(!(o in t)){i.push('Property "'+o+'" does not exist in target schema, skipping merge.');continue}const a=getType(r),c=getType(s);a===c?isObject(r)&&isObject(s)?n[o]=deepMergeConfigs(s,r):n[o]=r:i.push('Type mismatch for key "'+o+'": source is '+a+", target is "+c+". Skipping merge.")}return i.length>0&&Lt.warn("Merging configurations with warnings:",i),n}const Rt=new Map([["global.layout.enablePersonalization",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.PRODUCT_INTERACTIONS,i.CART_ITEM,i.CHECKOUT_ITEM]],["global.layout.personalizationText",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.CART_ITEM]],["global.layout.personalizationCardStyle",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[i.CART,i.CART_PROMO_CODE,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[i.CART,i.CHECKOUT,i.ADDRESS,i.INPUT,i.ADDRESS_INPUT,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_BUYER,i.CHECKOUT_BILLING,i.CHECKOUT_PAYMENT,i.CART_PROMO_CODE]],["global.layout.showPoweredBy",[i.CART,i.CHECKOUT,i.CHECKOUT_COMPLETED,i.POWERED_BY,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[i.POWERED_BY]],["product.layout.showImages",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[i.PRODUCT]],["product.layout.showDescription",[i.PRODUCT,i.PRODUCT_DESCRIPTION,i.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[i.PRODUCT,i.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[i.CART,i.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[i.CART,i.CART_FOOTER]],["checkout.layout.emailOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[i.CHECKOUT,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[i.CHECKOUT,i.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[i.CHECKOUT,i.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[i.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const i of Object.keys(e)){const e=Rt.get(t+"."+i);if(e)for(const t of e)n.add(t)}return Array.from(n)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.modalCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Client preparation failed",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",bt.version);const t=this.clientConfig.isProduction(),e=this.clientConfig.isDebuggingEnabled();!t&&e&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!t&&e&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:n,configs:i}=await this.authClient.authenticateAndGetConfigs();if(!n||!i)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);this.logger.info("✅ Authentication completed and configurations loaded"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let o=i;this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.clientConfig.set("partnerName",o.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(o.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",s);const a=s?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:s,persistedStore:a}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),e=o.global.layout.showPoweredBy;o=deepMergeConfigs(o,t),o.global.layout.showPoweredBy=e}await this.themeProvider.initialize(o),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureModalExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:e,containerId:n,...o}=t;if(!n||"string"!=typeof n)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);if(!e)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const r=n.replace("#",""),s=document.getElementById(r);if(!s)return console.warn("Container with ID '"+r+"' not found"),null;s.innerHTML="";const a={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},c=ComponentFactoryService.createElement(a);return safeReplaceChildren(s,c),t.type===i.CHECKOUT&&(this.store.set("metadata.checkout.injection",{containerId:r,injectedAt:Date.now()}),await this.commands.checkout.loadCheckout({checkoutId:void 0===t.checkoutId?"":t.checkoutId})),this.createInjectedComponentWrapper(r,t.type,c)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const e=t.slice(0,20),n=[],o=[];for(const i of e){if(!i||"object"!=typeof i){this.logger.warn("Invalid product parameter: must be an object");continue}if(!i.containerId||"string"!=typeof i.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+i.identifier+"'");continue}const t=i.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+i.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+i.identifier+"'");continue}const o=n.every(e=>e.containerId!==t);if(!o){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!i.identifier||"string"!=typeof i.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const r=n.every(t=>t.identifier!==i.identifier);r?n.push({containerId:t,identifier:i.identifier}):this.logger.warn("Duplicate product identifier '"+i.identifier+"' found, skipping")}for(const r of n){const t=ComponentFactoryService.createElement({type:i.PRODUCT,useShadowDom:!![],productId:r.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(r.containerId);e?(e.innerHTML="",e.appendChild(t),o.push(this.createInjectedComponentWrapper(r.containerId,i.PRODUCT,t)),await this.commands.product.createProductInstance(r.identifier,!![])):this.logger.warn("Product ("+r.identifier+") container with ID '"+r.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(n.map(t=>t.identifier)),o}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const e=Object.values(m);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const n=ComponentFactoryService.createElement({type:i.PRODUCT_LIST,wrapInLceElement:!![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}async injectProductListSearch(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_SEARCH),void 0;if(!t)throw new SDKError("Product list search requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list search container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list search.',!![]);const n=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_SEARCH,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![]});safeReplaceChildren(e,n)}async injectProductListFilters(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_FILTERS),void 0;if(!t)throw new SDKError("Product list filters requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list filters container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.filters&&t.filters.length>0){const e=Object.values(m);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list filters.',!![]);const n=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_FILTERS,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![],filters:t.filters});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:i.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureModalExists(){if(!this.modalCreated)try{const t=ComponentFactoryService.createElement({type:i.MODAL,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.modalCreated=!![]}catch(t){this.logger.warn("Failed to create modal:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const i={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,i),i}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let i;i=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,i)}registerEssentialComponents(){ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.CART,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent),ComponentFactoryService.registerComponent(i.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(i.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(i.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_RETAILERS,ProductListRetailersComponent),ComponentFactoryService.registerComponent(i.CART,CartComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(i.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(i.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(i.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(i.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(i.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(i.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(i.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const o=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,o)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);e.innerHTML="",e.classList.add("lce-cart-subtotal");const N=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;N(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;N(t)})},cartItemsCount:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let n=!![];e&&"boolean"==typeof e.hideZero&&(n=e.hideZero);const i=document.getElementById(t.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);i.innerHTML="",i.classList.add("lce-cart-items-count");const k=t=>{i.textContent=t.toString(),0===t?(n&&(i.style.visibility="hidden"),i.classList.add("no-items")):(n&&(i.style.visibility="visible"),i.classList.remove("no-items"))},o=this.store.get("cart.itemsQuantity")||0;k(o),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;k(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,i.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,i.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.CART,containerId:t}):(this.injectDisabledElementsError(t,i.CART),null)}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.CHECKOUT,containerId:t,checkoutId:e}):(this.injectDisabledElementsError(t,i.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,n){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:n.proxy,development:n.development,checkout:n.checkout});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),injectProductListFilters:r.injectProductListFilters.bind(r),injectProductListSearch:r.injectProductListSearch.bind(r),ui:r.ui,actions:r.actions,getInjectedComponents:r.getInjectedComponents.bind(r)};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(e.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),null}}const Mt={SCRIPT:{CHECKOUT_PARAM:"data-checkout-param"},ELEMENT:{CHECKOUT:"data-lce-checkout"},JSON_SCRIPT:{DEVELOPMENT:"data-liquid-commerce-elements-development"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function getDevelopmentConfigs(){const t=document.querySelector("script["+Mt.JSON_SCRIPT.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(e){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",e),void 0}}function triggerAutoInit(t,e){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await t()}catch(n){console.error(e+" Failed to initialize:",n)}},50)}):setTimeout(async()=>{try{await t()}catch(n){console.error(e+" Failed to initialize:",n)}},50)}catch(n){console.error(e+" Failed to setup initialization:",n)}}async function setupCheckout(t,e,n){try{const i=document.querySelector("div["+Mt.ELEMENT.CHECKOUT+"]");if(!i)return n.requireCheckoutId||console.warn(n.errorPrefix+" No checkout container found. Add a div with data-lce-checkout attribute."),void 0;const o="lce-checkout-container";let r;i.className="lce-checkout-container",i.id=o;const s=t.getAttribute(Mt.SCRIPT.CHECKOUT_PARAM)||"lce_checkout";if(s&&startsWithLcePrefix(s)){const t=new URLSearchParams(window.location.search);if(r=t.get(s)||void 0,!r&&n.requireCheckoutId)return console.warn(n.errorPrefix+" Checkout ID not found in query parameters."),void 0}else if(console.warn(n.errorPrefix+' Ignoring checkout query parameter "'+s+'" because it does not start with "lce_" prefix.'),n.requireCheckoutId)return;await e(o,r)}catch(i){console.error(n.errorPrefix+" Failed to setup checkout:",i)}}const jt={SCRIPT:{MAIN:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",PRODUCT:"data-product",CONTAINER:"data-container",PRODUCT_PARAM:"data-product-param",PRODUCT_FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",PROMO_CODE_PARAM:"data-promo-code-param",PROMO_CODE:"data-promo-code",PROMO_TEXT:"data-promo-text",PROMO_SEPARATOR:"data-promo-separator",PROMO_ACTIVE_FROM:"data-promo-active-from",PROMO_ACTIVE_UNTIL:"data-promo-active-until",CART_BUTTON:"data-cart-button",CART_BADGE_BUTTON:"data-cart-badge-button",CART_MOBILE_BUTTON:"data-cart-mobile-button",CART_MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",CART_BUTTON_HIDDEN:"data-cart-button-hidden",CHECKOUT_URL:"data-checkout-url"},ELEMENT:{PRODUCT:"data-lce-product",PRODUCTS_LIST:"data-liquid-commerce-elements-products-list",PRODUCTS_LIST_ROWS:"data-rows",PRODUCTS_LIST_COLUMNS:"data-columns",PRODUCTS_LIST_FILTERS:"data-filters",PRODUCTS_LIST_FILTERS_CONTAINER:"data-filters-container",PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER:"data-search-container",PRODUCTS_LIST_PRODUCT_URL:"data-product-url",CART_TOGGLE_BUTTON:"data-lce-cart-toggle-button",CART_ITEMS_COUNT:"data-lce-cart-items-count"},JSON_SCRIPT:{PRODUCTS:"data-liquid-commerce-elements-products"}};function generateElementId({prefix:t,index:e}){const n=Math.random().toString(36).substring(2,7),i=void 0!==t?t:"",o=void 0!==e?e:"",r=i&&o?"-":"";return""+i+r+o+n}function pairsFromMainScript(t){const e=[];try{const i=t.getAttributeNames().filter(t=>t.substring(0,12)===jt.SCRIPT.PRODUCT);for(const o of i)try{const n=o.match(/^data-product(-(.+))?$/),i=(null==n?void 0:n[2])?"-"+n[2]:"",r=""+jt.SCRIPT.CONTAINER+i;if(t.hasAttribute(r)){const n=t.getAttribute(r),i=t.getAttribute(o);n&&i&&e.push({containerId:n,identifier:i})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",i)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+jt.JSON_SCRIPT.PRODUCTS+"]");for(const i of n)try{const e=JSON.parse(i.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div["+jt.ELEMENT.PRODUCT+"]");let i=0;for(const o of n)try{const e=generateElementId({prefix:"lce-p",index:i});o.setAttribute("id",e);const n=o.getAttribute(jt.ELEMENT.PRODUCT);e&&n&&t.push({containerId:e,identifier:n}),i+=1}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}async function addProductToCartViaQueryParam(t,e){try{const i=e.getAttribute(jt.SCRIPT.PRODUCT_PARAM),r=e.getAttribute(jt.SCRIPT.PRODUCT_FULFILLMENT_TYPE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),a=s.get(i);if(!a)return;let c=o.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=s.get(r);t!==o.ON_DEMAND&&t!==o.SHIPPING||(c=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:a,fulfillmentType:c,quantity:1}],!![])}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",i)}}async function addPromoCodeToCartViaQueryParam(t,e){try{const i=e.getAttribute(jt.SCRIPT.PROMO_CODE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),r=o.get(i);if(!r)return;try{await t.actions.cart.applyPromoCode(r)}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",i)}}async function setupCartButtonWithPosition(t,e,n,i){var o,r,s;try{const a=n.includes("mobile"),c=a?"mobile":"desktop",p=!a,m=e.getAttribute(n),f=e.getAttribute(i);if(!e.hasAttribute(n)&&!e.hasAttribute(i))return p&&t.ui.floatingCartButton(![]),void 0;if(p){if(e.hasAttribute(n)&&!m)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(i)&&!f)return t.ui.floatingCartButton(!![]),void 0}const g=m||f,v=!!f;if(!g)return p&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(v)),void 0;const b=["above","below","replace","inside"],x=g.match(/^(\w+):(.+)$/),w=x&&b.includes(x[1])?x[1]:"inside";let S=x?x[2]:g;/^[#.]/.test(S)||/\s/.test(S)||(S="#"+S);const E=document.querySelector(S);if(!E)return p&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+S+'" not found. Using floating button.'),t.ui.floatingCartButton(v)),void 0;const _=document.createElement("div");switch(_.classList.add("lce-cart-"+c+"-button-container"),_.id=generateElementId({prefix:"lce-cart-"+c+"-btn"}),w){case"above":null===(o=E.parentNode)||void 0===o?void 0:o.insertBefore(_,E);break;case"below":null===(r=E.parentNode)||void 0===r?void 0:r.insertBefore(_,E.nextSibling);break;case"replace":null===(s=E.parentNode)||void 0===s?void 0:s.replaceChild(_,E);break;default:E.appendChild(_)}t.ui.cartButton(_.id,v)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",a)}}async function setupCartButtons(t,e){e.hasAttribute(jt.SCRIPT.CART_BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,jt.SCRIPT.CART_BUTTON,jt.SCRIPT.CART_BADGE_BUTTON),await setupCartButtonWithPosition(t,e,jt.SCRIPT.CART_MOBILE_BUTTON,jt.SCRIPT.CART_MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST+"]"),n=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER+"]"),i=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST_FILTERS_CONTAINER+"]");if(!e)return;const o="lce-products-list-container";if(e.className="lce-products-list-container",e.id=o,n){const e="lce-product-list-search-container";n.className="lce-product-list-search-container",n.id=e,t.injectProductListSearch({containerId:e})}if(i){const e="lce-product-list-filters-container";i.className="lce-product-list-filters-container",i.id=e;const n=i.getAttribute(jt.ELEMENT.PRODUCTS_LIST_FILTERS);let o=[];n&&(o=n.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductListFilters({containerId:e,filters:o})}const r=Number.parseInt(e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_ROWS)||"3",10)||3,s=Number.parseInt(e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_COLUMNS)||"4",10)||4,a=e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_FILTERS),c=e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_PRODUCT_URL)||void 0;let p=[];a&&(p=a.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductList({containerId:o,rows:r,columns:s,filters:p,productUrl:c})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",e)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const e=t.detail;if(!e.data.isReady)return;const n=window.elements,i=document.querySelectorAll("["+jt.ELEMENT.CART_TOGGLE_BUTTON+"]");if(i.length>0)for(const r of i)r.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),n.actions.cart.toggleCart()});const o=document.querySelectorAll("["+jt.ELEMENT.CART_ITEMS_COUNT+"]");if(o.length>0){let t=0;for(const e of o){const i=e.getAttribute(jt.ELEMENT.CART_ITEMS_COUNT),o=!(i&&"keep-zero"===i),r=Boolean(null==e?void 0:e.id);let s;r?s=e.id:(s=generateElementId({prefix:"lce-cart-items-count",index:t}),e.id=s),n.ui.cartItemsCount(s,{hideZero:o}),t+=1}}})}catch(bt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",bt)}}async function ElementsAutoInitialize(){var e,n,i,o,s;try{const a=document.querySelector("script["+jt.SCRIPT.MAIN+"]");if(!a)return;const c=a.getAttribute(jt.SCRIPT.TOKEN),p=a.getAttribute(jt.SCRIPT.ENV)||t.PRODUCTION,m=a.getAttribute(jt.SCRIPT.DEBUG_MODE);if(!c)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const f=a.getAttribute(jt.SCRIPT.PROMO_CODE),g=a.getAttribute(jt.SCRIPT.PROMO_TEXT),v=null!==(e=a.getAttribute(jt.SCRIPT.PROMO_SEPARATOR))&&void 0!==e?e:"•",b=null!==(n=a.getAttribute(jt.SCRIPT.PROMO_ACTIVE_FROM))&&void 0!==n?n:void 0,x=null!==(i=a.getAttribute(jt.SCRIPT.PROMO_ACTIVE_UNTIL))&&void 0!==i?i:void 0,w=a.getAttribute(jt.SCRIPT.CHECKOUT_URL)||void 0,S=pairsFromMainScript(a),E=pairsFromProductsScript(),_=pairsFromAttributedElements(),F=[...S,...E,..._],I=f&&g&&b&&x?{promoCode:f,text:g.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:v,activeFrom:null===(o=new Date(b))||void 0===o?void 0:o.toISOString(),activeUntil:null===(s=new Date(x))||void 0===s?void 0:s.toISOString()}:void 0;let O=r.NONE;m&&p!==t.PRODUCTION&&(O=m),setupEventListeners();const R=await Elements(c,{env:p,debugMode:O,promoTicker:I?[I]:void 0,checkout:w?{pageUrl:w}:void 0,development:getDevelopmentConfigs()});if(!R)throw new SDKError("Elements SDK client initialization failed",!![]);setupCartButtons(R,a),0!==F.length&&R.injectProductElement(F).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),await initializeProductsList(R),addProductToCartViaQueryParam(R,a),addPromoCodeToCartViaQueryParam(R,a),setupCheckout(a,R.injectCheckoutElement.bind(R),{requireCheckoutId:!![],errorPrefix:"[LiquidCommerce Elements Auto Initialization]"})}catch(a){console.error("[LiquidCommerce Elements Auto Initialization]",a)}}function triggerElementsAutoInit(){triggerAutoInit(ElementsAutoInitialize,"[LiquidCommerce Elements Auto Initialization]")}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new SDKError("Failed to update global configuration: "+e.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new SDKError("Failed to update product configuration: "+e.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new SDKError("Failed to update cart configuration: "+e.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new SDKError("Failed to update checkout configuration: "+e.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new SDKError("Failed to update address configuration: "+e.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:i.CART,containerId:t})}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=await this.processInjectElement({type:i.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:n.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,n){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:!![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,checkout:n.checkout,proxy:void 0,development:void 0});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={updateComponentGlobalConfigs:r.updateComponentGlobalConfigs.bind(r),updateProductComponent:r.updateProductComponent.bind(r),updateAddressComponent:r.updateAddressComponent.bind(r),updateCartComponent:r.updateCartComponent.bind(r),updateCheckoutComponent:r.updateCheckoutComponent.bind(r),injectElement:r.injectElement.bind(r),injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),actions:r.actions};window.elementsBuilder=s;const a=PubSubService.getInstance();return a.publishAction(e.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,i,o,r)=>isSDKError(r,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:i,colno:o,error:r}),!![]):t?t(e,n,i,o,r):![];const e=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(Nt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Nt)}try{triggerElementsAutoInit()}catch(Bt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Bt)}}catch(qt){console.error("[LiquidCommerce Elements] SDK initialization failed:",qt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const n of t)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const n=document.createDocumentFragment();for(const e of t)"string"==typeof e?n.appendChild(document.createTextNode(e)):n.appendChild(e);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.replaceChild(e,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.insertBefore(e,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.insertBefore(e,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const n={};for(const[e,i]of t)n[e]=i;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(xt){console.warn("DOM polyfills initialization failed:",xt)}}function safeReplaceChildren(t,...n){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...n);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of n)"string"==typeof e?t.appendChild(document.createTextNode(e)):t.appendChild(e)}}catch(e){console.error("replaceChildren operation failed:",e),1===n.length&&"string"==typeof n[0]&&(t.innerHTML=n[0])}}const t={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},e={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",PRODUCT_LIST_ENGRAVING_FORM:"product-list-engraving-form",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={NONE:"none",CONSOLE:"console",PANEL:"panel"},s={PROMO_CODE:"promo-code"},a={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},c={SUCCESS:"success",WARNING:"warning",ERROR:"error"},l={[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},d={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},m={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040,MODAL:2147483640},g=1024;class SDKError extends Error{constructor(t,n=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,n){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return n?isSDKSource(n):![];const e=String((null==t?void 0:t.message)||""),i=/liquidcommerce\s+elements/i.test(e),o=String((null==t?void 0:t.stack)||""),r=(null==t?void 0:t.source)||n||"",s=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],a=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],c=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\/(?:main|checkout)\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],l=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],d=isSDKSource(r),m=s.some(t=>t.test(o)),g=a.some(t=>t.test(o)),v=c.some(t=>t.test(o)),y=l.some(t=>t.test(o));return i||d||m||g||v||y}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(t))}class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,n){const e=SingletonManager.getInstances();e.has(t)||e.set(t,n());const i=e.get(t);if(!i)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const n=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),e="LiquidCommerceElementsClient_"+n,i=SingletonManager.getInstances();if(i.has(e))return i.get(e);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(e,o),o}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const v="lce",y={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},b={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:o.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},k={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},E={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},_={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},F={checkout:{injection:null,returnUrl:null}},D={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},T={products:{},cart:k,address:y,checkout:E,ui:_,metadata:F,productsList:D};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,n={}){this.validateInputs(t,n),this.config=Object.freeze(this.buildConfiguration(t,n))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:n})}isDevelopment(){return this.get("env")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===r.CONSOLE||t===r.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===r.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===r.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}getProxyConfig(){return this.get("proxy")}validateInputs(n,e){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(e.env&&!Object.values(t).includes(e.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+e.env+'". Using default environment.'),e.env=void 0),void 0!==e.isBuilder&&"boolean"!=typeof e.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),e.isBuilder=void 0),void 0===e.debugMode||Object.values(r).includes(e.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+e.debugMode+'". Must be one of: '+Object.values(r).join(", ")+". Using default value."),e.debugMode=void 0),e.promoTicker&&"object"!=typeof e.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),e.promoTicker=void 0),e.checkout&&("object"!=typeof e.checkout?(console.warn("[LiquidCommerce Elements] checkout must be an object. Skipping checkout configuration."),e.checkout=void 0):e.checkout.pageUrl&&"string"==typeof e.checkout.pageUrl?e.checkout.pageUrl.trim()?e.checkout.pageUrl.includes("{id}")||console.warn('[LiquidCommerce Elements] checkout.pageUrl does not include "{id}" placeholder and will not include cart IDs.'):(console.warn("[LiquidCommerce Elements] checkout.pageUrl cannot be empty. Skipping checkout configuration."),e.checkout=void 0):(console.warn("[LiquidCommerce Elements] checkout.pageUrl is required and must be a string. Skipping checkout configuration."),e.checkout=void 0)),e.promoTicker)if(Array.isArray(e.promoTicker)){const t=e.promoTicker.filter((t,n)=>{if(!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const e="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(e instanceof Date)||Number.isNaN(e.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const i="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return i instanceof Date&&!Number.isNaN(i.getTime())?e>=i?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});e.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),e.promoTicker=void 0;e.proxy&&("object"!=typeof e.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),e.proxy=void 0):e.proxy.baseUrl&&"string"==typeof e.proxy.baseUrl?e.proxy.headers&&"object"!=typeof e.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),e.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),e.proxy=void 0))}buildConfiguration(n,e){var i,o,s,a;const c=e.env||t.PRODUCTION;let d=l[c];const m=c===t.PRODUCTION,g=e.isBuilder||![],y=v+(m?"":"_"+c)+(g?"builder":"");return(null===(i=e.development)||void 0===i?void 0:i.customApiUrl)&&(d=e.development.customApiUrl),{apiKey:n.trim(),env:c,isBuilder:g,debugMode:e.debugMode||r.NONE,baseUrl:d,partnerCode:void 0,partnerName:void 0,customTheme:e.customTheme||null,proxy:e.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:y,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:e.promoTicker||null,paymentMethodId:(null===(o=e.development)||void 0===o?void 0:o.paymentMethodId)||void 0,openShadowDom:m?![]:(null===(s=e.development)||void 0===s?void 0:s.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(a=e.development)||void 0===a?void 0:a.customApiUrl),checkout:e.checkout||null}}detectDeviceType(){var t,n;if("undefined"==typeof navigator)return"desktop";const e=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,s=Math.max(o,r),a=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return a.some(t=>t.test(e))?"tablet":c.some(t=>t.test(e))||i&&s<768?"mobile":i&&s>=768&&s<=1200||i&&/macintosh/i.test(e)&&navigator.maxTouchPoints>1||/android/i.test(e)&&i&&s>=768||/windows nt/i.test(e)&&i&&s>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(e),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const n=(new Date).toISOString().slice(11,23);return["%c["+n+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,n){if(this.sendToTelemetry("debug",t,void 0,n),!this.enableLogging)return;const[e,...i]=this.getPrefix("debug");void 0!==n?console.debug(e,...i,t,n):console.debug(e,...i,t)}info(t,n){if(!this.enableLogging)return;const[e,...i]=this.getPrefix("info");void 0!==n?console.info(e,...i,t,n):console.info(e,...i,t)}warn(t,n){if(this.sendToTelemetry("warn",t,void 0,n),!this.enableLogging)return;const[e,...i]=this.getPrefix("warn");void 0!==n?console.warn(e,...i,t,n):console.warn(e,...i,t)}error(t,n){const e=n instanceof Error;let i=e?n:void 0,o=!e&&n?n:void 0;if(o&&o.error instanceof Error){i=o.error;const{error:t,...n}=o;o=Object.keys(n).length>0?n:void 0}if(this.sendToTelemetry("error",t,i,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("error");if(console.group(r+" "+t,...s),i){console.log("Type:",i.name||"Error"),console.log("Message:",i.message),i.stack&&console.log("Stack:",i.stack),i.cause&&console.log("Caused by:",i.cause);const t=Object.keys(i).filter(t=>!["name","message","stack","cause"].includes(t));if(t.length>0){const n={};for(const e of t)n[e]=i[e];console.log("Additional:",n)}}o&&Object.keys(o).length>0&&console.log("Context:",o),console.groupEnd()}sendToTelemetry(t,n,e,i){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,n,{context:this.context,error:e,data:i})}catch(o){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const n=this.getInstances();if(!n.has(t)){const e=LoggerService.getInstance(t);e.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&e.setTelemetryService(this.telemetryService),n.set(t,e)}return n.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const n=this.getInstances();for(const[,e]of n)e.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const n=this.getInstances();for(const[,e]of n)e.setTelemetryService(t)}}function componentError({componentType:t,message:n}){const e=document.createElement("div");e.className=t;const i=e.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent='\n div {\n padding: 10px;\n background-color: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const r=document.createElement("div"),s=document.createElement("h3");s.textContent="Component </"+t+">";const a=document.createElement("p");return a.textContent=n,r.appendChild(o),r.appendChild(s),r.appendChild(a),i.appendChild(r),e}function productionComponentError({title:t,message:n,componentType:e}){const i=document.createElement("div");i.setAttribute("data-component-type",e);const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent="\n div {\n padding: 20px;\n background-color: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const s=document.createElement("div"),a=document.createElement("h2");a.textContent=t;const c=document.createElement("p");return c.textContent=n,s.appendChild(r),s.appendChild(a),s.appendChild(c),o.appendChild(s),i}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,n){ComponentFactoryService.getComponentRegistry().set(t,n)}static createElement(t){try{const n=ComponentFactoryService.getComponentRegistry().get(t.type);if(!n)throw new SDKError("Component type ["+t.type+"] is not registered");const e=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(e)||window.customElements.define(e,n);const o=document.createElement(e);if(o.initialize){const{type:n,useShadowDom:i,wrapInLceElement:r,...s}=t,a={type:n,tagName:e,useShadowDom:i&&r!==!![]};o.initialize({data:s,config:a})}if(t.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),e=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(e)||window.customElements.define(e,n);const r=document.createElement(e);return r.initialize(t.type,o),r}return o}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==n?void 0:n.message)||n})}}static componentError({componentType:t,message:n}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:n})}static getComponentTagName(t){const n={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.MODAL]:"modal-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.PRODUCT_LIST]:"product-list-lc",[i.PRODUCT_LIST_CARD]:"product-list-card-lc",[i.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[i.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[i.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[i.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[i.PRODUCT_LIST_ENGRAVING_FORM]:"product-list-engraving-form-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION]:"checkout-information-lc",[i.CHECKOUT_PAYMENT]:"checkout-payment-lc",[i.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[i.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING]:"checkout-billing-lc",[i.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[i.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[i.CHECKOUT_BUYER]:"checkout-buyer-lc",[i.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[i.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return n[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,n){this.publishSpecific("actions."+t,n)}publishForm(t,n){this.publishSpecific("forms."+t,n)}publishSpecific(t,n){const[e,i]=t.includes(".")?t.split(".",2):["actions",t];let o=i.split("_")[0];["product","cart","address","checkout"].includes(o)||(o="other");const r=Date.now(),s={eventId:"evt_"+r+"_"+Math.random().toString(36).slice(2,9),namespace:e,event:i,originalEvent:t,actionNamespace:"actions"===e?o:void 0,timestamp:r},a={data:n,metadata:s};this.dispatchNativeEvents(t,a)}dispatchNativeEvents(t,n){const[e]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=n);const i=new CustomEvent(this.eventPrefix+":"+t,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const o=new CustomEvent(this.eventPrefix+":"+e,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(o)}catch(i){this.logger.error("Error dispatching native events for "+t,i)}}setupClientReadyBuffering(){try{const t=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(e,i,o)=>{if(e!==n)return t.call(window,e,i,o);if(!this.clientReadyEvent)return t.call(window,e,i,o);try{const t=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof i?i(t):i&&"function"==typeof i.handleEvent&&i.handleEvent(t)}catch(r){this.logger.error("Error replaying CLIENT_READY event",r)}return t.call(window,e,i,o)}}catch(xt){this.logger.error("Error setting up CLIENT_READY buffering",xt)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,n=!![]){const e=Math.floor(t/100),i=t%100;let o="$"+e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||i>0)&&(o+=".",o+=i<10?"0"+i:i.toString()),o}function htmlStringToElement(t){const n=document.createElement("template");return n.innerHTML=t.trim(),n.content.firstElementChild}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const e=(n.getMonth()+1).toString().padStart(2,"0"),i=n.getDate().toString().padStart(2,"0"),o=n.getFullYear().toString();return e+"/"+i+"/"+o}catch(n){return""}}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const n=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async setPersistedStore(t,n){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:n})}catch(e){this.logger.error("Error setting persisted store",e)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+t);return n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(n){this.logger.error("Error deleting persisted store",n)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const n=await this.client.post("/address/autocomplete",{body:{input:t}});return n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const n=await this.client.post("/address/details",{body:{id:t}});return n.data}catch(n){throw this.logger.error("Error fetching address details",n),new SDKError("Failed to fetch address details: "+(null==n?void 0:n.message))}}async getProductsData(t,n){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const e={identifiers:t,location:n},i=await this.client.post("/product/availability",{body:e});return i.data}catch(e){return this.logger.error("Error fetching product data",e),null}}async catalogSearch(t){try{const n=await this.client.post("/product/search",{body:t});return n.data}catch(n){return this.logger.error("Error fetching catalog search data",n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const n=await this.client.post("/cart/get",{body:{id:t||void 0}});return n.data}catch(n){throw this.logger.error("Error fetching cart data",n),new SDKError("Failed to fetch cart data: "+n.message)}}async updateCart(t){try{const n=await this.client.post("/cart/update",{body:t});return n.data}catch(n){throw this.logger.error("Error updating cart",n),new SDKError("Failed to update cart: "+(null==n?void 0:n.message))}}async prepareCheckout(t){try{const n=await this.client.post("/checkout/prepare",{body:t});return n.data}catch(n){throw this.logger.error("Error fetching prepare checkout data",n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async updateCheckoutItems(t){try{const n=await this.client.post("/checkout/items",{body:t});return n.data}catch(n){throw this.logger.error("Error updating checkout items",n),new SDKError("Failed to update checkout items: "+(null==n?void 0:n.message))}}async getPaymentSession(t){try{const n=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return n.data}catch(n){throw this.logger.error("Error fetching payment session",n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t){try{const n=await this.client.post("/checkout/payment/confirm",{body:t});return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),new SDKError("Failed to confirm payment session: "+(null==n?void 0:n.message))}}async checkoutComplete(t){try{const n=await this.client.post("/checkout/complete",{body:{token:t}});return n.data}catch(n){if(this.logger.error("Error completing checkout",n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:n,next:e})=>{const i=performance.now();try{const o=e(),r=performance.now()-i;return this.logger.info("🏪 Store "+t+" ✓ "+r.toFixed(3)+"ms",n),o}catch(o){const e=performance.now()-i;throw this.logger.error("🏪 Store "+t+" ✗ "+e.toFixed(3)+"ms",{payload:n,error:o}),o}},this.performanceMiddleware=({action:t,next:n})=>{const e=performance.now(),i=n(),o=performance.now()-e;return o>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+o.toFixed(2)+"ms"),i},this.state=T,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:n,persistedStore:e}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():e&&await this.loadFromDBPersistence(e),this.state={...this.state,metadata:F},this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:n,hasPersistedState:null!==e,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const n=t.split(".");let e=this.state;for(const i of n){if(null==e)return;e=e[i]}return void 0!==e?Array.isArray(e)?[...e]:"object"==typeof e&&null!==e?{...e}:e:void 0}set(t,n){return this.runWithMiddleware("set",{path:t,value:n},()=>{const e=this.get(t);return this.state=this.immutableSet(this.state,t,n),this.notifyListeners(t,n,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,n){const e=this.get(t),i=n(e);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const n=this.get(t);if(void 0===n)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const e=t.split(".");let i=this.state;const o=e.pop();for(const r of e){if(void 0===i[r])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[r]}if(Array.isArray(i))i=i.filter((t,n)=>n!==Number.parseInt(o,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+o+'" from non-object type at path "'+t+'".'),![];{const{[o]:t,...n}=i;i=n}}return this.state=this.immutableSet(this.state,e.join("."),i),this.notifyListeners(t,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const n=[];if("function"==typeof t){const e=t(this.state);for(const[t,i]of Object.entries(e)){const e=this.get(t);n.push({path:t,oldValue:e,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[e,i]of Object.entries(t)){const t=this.get(e);n.push({path:e,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,i)}for(const{path:t,oldValue:e,newValue:i}of n)this.notifyListeners(t,i,e);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,n){const e=t;return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>{var t;null===(t=this.listeners.get(e))||void 0===t?void 0:t.delete(n)}}watchMany(t,n){const e=[];let i;const o=t.map(t=>this.watch(t,(o,r)=>{e.push({path:t,value:o,oldValue:r}),clearTimeout(i),i=setTimeout(()=>{e.length>0&&(n([...e]),e.length=0)},0)}));return()=>{for(const t of o)t()}}createProductInstance(t){const n="products."+t,e=this.get(n);return e?!![]:this.set(n,b)}removeProductInstance(t){const n=this.get("products"),{[t]:e,...i}=n;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,n,e){let i=0;const V=()=>{if(i>=this.middleware.length)return e();const o=this.middleware[i++];return o({action:t,payload:n,state:this.getState(),next:V})};return V()}immutableSet(t,n,e){const i=n.split(".");if(1===i.length){if(Array.isArray(t)){const n=[...t];return n[i[0]]=e,n}return{...t,[i[0]]:e}}const[o,...r]=i,s=t[o],a=Array.isArray(s)?[]:{};if(Array.isArray(t)){const n=[...t];return n[o]=this.immutableSet(s||a,r.join("."),e),n}return{...t,[o]:this.immutableSet(s||a,r.join("."),e)}}notifyListeners(t,n,e){const i=this.listeners.get(t);if(i)for(const a of i)try{a(n,e)}catch(r){this.logger.error('Error in store listener for path "'+t+'"',r)}const o=t.split(".");for(let a=o.length-1;a>0;a--){const t=o.slice(0,a).join("."),n=this.listeners.get(t);if(n){const i=this.get(t),r=o.slice(a).join("."),c=this.immutableSet(i,r,e);for(const e of n)try{e(i,c)}catch(s){this.logger.error('Error in store listener for parent path "'+t+'"',s)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const n=this.get("address.id")||"",e=this.get("cart.id");if(!n&&!e)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:e}),void 0;try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(i,{p:n,c:e}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:n,cartId:e})}catch(i){this.logger.error("Failed to persist session data to DB",i)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(xt){this.logger.error("Failed to clear localStorage entry",xt)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",e=this.get("cart.id");(n||e)&&(t=n+":"+e)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const t=JSON.parse(n);for(const[n,e]of Object.entries(t))this.set(n,e);return}catch(t){if(n.includes(":")){const[t,e]=n.split(":");if(void 0!==t){const n=await this.getAddressDataFromId(t);this.set("address",n)}return void 0!==e&&this.set("cart.id",e||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const n=await this.getAddressDataFromId(t.p);this.set("address",n)}void 0!==t.c&&this.set("cart.id",t.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(t){if(!t||""===t.trim())return y;try{const n=await this.api.getAddressDetails(t);return n&&0!==Object.keys(n).length?{id:t,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{latitude:n.coordinates.latitude,longitude:n.coordinates.longitude}}:{...y,id:t}}catch(n){return{...y,id:t}}}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),e=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:e,batchSize:n===t.PRODUCTION?5:10,batchInterval:n===t.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,n,e={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const i=Date.now();try{const o={eventId:"event_"+i,timestamp:i,level:t,message:n,context:e.context,error:e.error?this.buildErrorContext(e.error):void 0,component:e.component,data:e.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(o)}catch(o){this.handleInternalError(o)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const e=this.createBatch(n);try{this.sendBatch(e),this.stats.batchesSent++}catch(i){this.stats.failedBatches++,this.handleInternalError(i),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(t)],{type:"text/plain"}),e=navigator.sendBeacon(this.config.endpoint,n);if(e)return}catch(n){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(t)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(n){this.stats.failedBatches++}}}}const A=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],O=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],z=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],L=[i.CHECKOUT,i.CHECKOUT_INFORMATION,i.CHECKOUT_STRIPE_HANDLER,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT,i.CHECKOUT_BILLING,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_DELIVER_TO_SUMMARY,i.CHECKOUT_BUYER,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN,i.CHECKOUT_PRESALE_EXPIRED,i.CHECKOUT_SEND_AS_GIFT],R=[i.PRODUCT_LIST,i.PRODUCT_LIST_CARD,i.PRODUCT_LIST_CARD_LOADING,i.PRODUCT_LIST_FILTERS,i.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,n="swap"){if(!t||0===t.length)return;const e=[...this.defaultFontFamilies,...t],i=e.map(t=>{const n=encodeURIComponent(t.name);return"family="+n+":wght@"+t.weights.join(";")}).join("&"),o="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+o,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,n="swap"){const e=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,n),e&&e.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!n){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const j={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},q={backgroundColor:"--product-background-color"},H={backgroundColor:"--cart-background-color"},Y={backgroundColor:"--address-background-color"},Q={backgroundColor:"--checkout-background-color"},W={backgroundColor:"--product-list-background-color"},Z={global:j,product:q,cart:H,address:Y,checkout:Q,productList:W};function getCSSVariableMapping(t){return Z[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,n){const e={},i=getCSSVariableMapping(n);for(const[o,r]of Object.entries(i)){const n=this.getValueByPath(t,o);void 0!==n&&this.isCSSValue(n)&&(e[r]=n,this.isColorVariable(r,n)&&this.generateOpacityVariants(e,r,n))}return e}extractVariablesFromPartialTheme(t,n){const e={},i=getCSSVariableMapping(n);for(const[o,r]of Object.entries(i))if(this.hasValueAtPath(t,o)){const n=this.getValueByPath(t,o);void 0!==n&&this.isCSSValue(n)&&(e[r]=n,this.isColorVariable(r,n)&&this.generateOpacityVariants(e,r,n))}return e}generateCSSVariablesString(t){return Object.entries(t).map(([t,n])=>" "+t+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(t,n){if(0!==Object.keys(n).length)try{const e=this.findOrCreateRule(t);for(const[t,i]of Object.entries(n))e.style.setProperty(t,String(i))}catch(e){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,n){return n.split(".").reduce((t,n)=>t&&void 0!==t[n]?t[n]:void 0,t)}hasValueAtPath(t,n){const e=n.split(".");let i=t;for(const o of e){if(null==i||!(o in i))return![];i=i[o]}return!![]}findOrCreateRule(t){const n=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===n)return i;const e=t.insertRule(n+" {}");return t.cssRules[e]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,n,e){for(const i of this.opacityLevels){const o=n+"-"+i.suffix,r=this.addOpacityToHexColor(e,i.value);r&&(t[o]=r)}}isColorVariable(t,n){if("string"!=typeof n)return![];const e=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(n);return e&&i}addOpacityToHexColor(t,n){if(!t.startsWith("#"))return null;let e=t.slice(1);if(3===e.length&&(e=e.split("").map(t=>t+t).join("")),6!==e.length)return null;const i=Math.round(255*n),o=i.toString(16).padStart(2,"0");return"#"+e+o}}class StyleRegistryService{constructor(){this.registry=new Map}static getInstance(){return StyleRegistryService.instance||(StyleRegistryService.instance=new StyleRegistryService),StyleRegistryService.instance}register(t,n,e=10){this.registry.has(t)||this.registry.set(t,[]);const i=this.registry.get(t),o=i.some(t=>t.getter===n);o||(i.push({getter:n,priority:e}),i.sort((t,n)=>t.priority-n.priority))}getStyleGetters(t){const n=this.registry.get(t);return n?n.map(t=>t.getter):[]}getStyles(t){const n=this.getStyleGetters(t);return n.map(t=>t())}hasStyles(t){const n=this.registry.get(t);return!!n&&n.length>0}getRegisteredTypes(){return Array.from(this.registry.keys())}clear(){this.registry.clear()}}const X=StyleRegistryService.getInstance();class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,n){const e=this.cssProcessor.extractVariablesFromTheme(n,t),i=this.cssProcessor.generateCSSVariablesString(e),o=X.getStyles(t).join("\n\n"),r=0===i.length?"":":host { "+i+" }",s=("\n "+r+"\n\n "+o+"\n ").trim();this.createStylesheet(t,s)}createStylesheet(t,n){try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(n),this.styleSheets.set(t,e)}else this.styleSheets.set(t,n)}catch(xt){this.styleSheets.set(t,n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,n,e){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(n,e);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(t){var n,e;const i=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=i,((null===(n=t.theme)||void 0===n?void 0:n.headingFont)||(null===(e=t.theme)||void 0===e?void 0:e.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}updateProductListComponent(t){this.data.productList=this.deepMerge(this.getConfigs("productList"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",t.theme,"product-list")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==A.indexOf(t)?this.getConfigs("product"):-1!==O.indexOf(t)?this.getConfigs("address"):-1!==z.indexOf(t)?this.getConfigs("cart"):-1!==L.indexOf(t)?this.getConfigs("checkout"):-1!==R.indexOf(t)?this.getConfigs("productList"):void 0}getStylesheet(t){const n=this.getBaseStylesheets();if(t===i.DRAWER||t===i.MODAL){const t=[...n],e=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address"),s=this.stylesheetGenerator.getStylesheet("product-list");return e&&t.push(e),i&&t.push(i),o&&t.push(o),r&&t.push(r),s&&t.push(s),t}let e;if(O.includes(t)||t===i.ADDRESS)e="address";else if(A.includes(t)||t===i.PRODUCT)e="product";else if(z.includes(t)||t===i.CART)e="cart";else if(L.includes(t)||t===i.CHECKOUT)e="checkout";else{if(!R.includes(t)&&t!==i.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),n;e="product-list"}const o=this.stylesheetGenerator.getStylesheet(e);return o?[...n,o]:n}getBaseStylesheets(){const t=[],n=this.stylesheetGenerator.getStylesheet("global"),e=this.stylesheetGenerator.getStylesheet("ui");return n&&t.push(n),e&&t.push(e),t}deepMerge(t,n){const e={...t};for(const i in n)null!==n[i]&&void 0!==n[i]&&("object"!=typeof n[i]||Array.isArray(n[i])||"object"!=typeof t[i]||Array.isArray(t[i])?e[i]=n[i]:e[i]=this.deepMerge(t[i],n[i]));return e}}const J="@liquidcommerce/elements-sdk",$="LiquidCommerce Elements SDK",tt="UNLICENSED",nt="LiquidCommerce Team",et="2.6.0-beta.34",it="https://docs.liquidcommerce.co/elements-sdk",ot={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},rt={url:"https://github.com/liquidcommerce/elements-sdk/issues"},st="./dist/index.esm.js",at="./umd/elements.js",ct="./dist/types/index.d.ts",lt="pnpm@10.0.0",dt={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./checkout":{types:"./dist/types/index.checkout.d.ts",import:"./dist/index.checkout.esm.js",browser:"./umd/elements-checkout.js",default:"./dist/index.checkout.esm.js"},"./package.json":"./package.json"},ht=["dist","umd","docs","README.md","LICENSE"],ut={access:"public",registry:"https://registry.npmjs.org/"},pt="module",mt=["dist/index.esm.js","dist/index.checkout.esm.js","umd/elements.js","umd/elements-checkout.js","src/index.ts","src/index.umd.ts","src/index.checkout.ts","src/index.checkout.umd.ts"],ft={build:"rollup -c","build:checkout":"rollup -c rollup.config.checkout.mjs","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build && pnpm build:checkout",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build && pnpm build:checkout",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},gt=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],vt={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.10","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.56.0","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},yt={node:">=22"},bt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},xt={name:J,description:$,license:tt,author:nt,version:et,homepage:it,repository:ot,bugs:rt,module:st,browser:at,types:ct,packageManager:lt,exports:dt,files:ht,publishConfig:ut,type:pt,sideEffects:mt,scripts:ft,keywords:gt,devDependencies:vt,engines:yt,pnpm:bt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const e=n.src;return e.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const n=await this.waitForContainerInit(t,1e4);return n?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(n){return this.checkFallbackGTM(t)}}waitForContainerInit(t,n){return new Promise(e=>{let i;const o=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(o),clearTimeout(i),e(!![]))},100);i=setTimeout(()=>{clearInterval(o),e(![])},n)})}injectGTMScript(t){return new Promise((n,e)=>{const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![],i.crossOrigin="anonymous";let o=![];const r=setTimeout(()=>{o||(o=!![],this.isContainerInitialized(t)?n():e(new Error("GTM script timeout")))},15e3);i.onload=()=>{o||setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?n():e(new Error("GTM script loaded but failed to initialize")))},500)},i.onerror=()=>{setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?n():e(new Error("GTM script failed to load")))},100)},document.head.appendChild(i)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),n=this.eventQueue.filter(n=>t-n.timestamp<3e4);for(const i of n)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t)}catch(e){this.logger.error("Error processing queued event "+i.methodName,e)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const n=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!n.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+n.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(n.message),this.processEventQueue()}executeEvent(t,n,e){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),o={...e,...i.length>0&&{send_to:i},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:xt.description+" v"+xt.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:n,eventData:o,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const r={event:n,...o};window.dataLayer.push(r)}catch(i){this.logger.error("GTM "+t+" error",i)}}calculateValue(t){const n=t.reduce((t,n)=>t+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,n,e){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:e,items:t})}selectItem(t,n,e){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:e,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addShippingInfo(t,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addPaymentInfo(t,n,e){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:n,coupon:e,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:n})}promoCodeFailed(t,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:n})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:n})}giftCardFailed(t,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:n})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const r=o.quantity+e;if(r<1)return this.removeItem(t,!![]);const s=this.buildItemUpdate(o,r),a=await this.api.updateCart({id:i,items:[s],location:this.getLocation()});this.syncItemsFromApiResponse(a,[t]),this.updateFulfillment(o.fulfillmentId,a),this.syncRetailersFromApiResponse(a),this.syncCartMetaFromApiResponse(a),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:i,itemId:o.id,quantity:r,previousQuantity:o.quantity});const c=splitCategoryPath(o.catPath),l={item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:Math.abs(e),price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};e<0?this.googleTagManager.removeFromCart(l):e>0&&this.googleTagManager.addToCart(l)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const r=this.buildItemUpdate(o,0),s=await this.api.updateCart({id:i,items:[r],location:this.getLocation()}),a={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId};this.syncItemsFromApiResponse(s,[]),this.cleanupAfterItemRemoval(a,s),this.syncCartMetaFromApiResponse(s),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:i,itemId:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,e){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c=this.getDetails(),l={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:e},d=await this.api.updateCart({id:s.id||"",items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const m=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:m.cartId,itemId:a.id,engravingLines:e,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:c,current:m})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to update item engraving",s),s}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),r=this.getDetails(),s=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],a=s.length>0,c=Object.values(o.items||{}).find(n=>{var e,i,o,r,c;const l=n.fulfillmentId===t.fulfillmentId&&n.partNumber===t.partNumber;if(!l)return![];if(a){const t=(null===(i=null===(e=n.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||[];return s.join(",")===t.join(",")}return!(null===(c=null===(r=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.length)}),l={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:c?t.quantity+c.quantity:t.quantity};a&&(l.engravingLines=s);const d=await this.api.updateCart({id:o.id||"",items:[l],location:this.getLocation()}),m=null===(i=Object.values(d.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===l.fulfillmentId&&t.partNumber===l.partNumber);if(!m)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(d,[]);const g=this.store.get("cart.fulfillments."+t.fulfillmentId);g?this.updateFulfillment(t.fulfillmentId,d):this.addNewFulfillmentAndRetailer(t.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const v=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:v.cartId,itemId:m.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:r,current:v});const y=splitCategoryPath(m.catPath);this.googleTagManager.addToCart({item_id:m.liquidId,item_name:m.name,item_brand:m.brand,item_size:m.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,quantity:m.quantity,price:centToDollar(m.unitPrice||0),item_image:m.mainImage,upc:m.upc,grouping_id:m.salsifyGrouping,product_id:m.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=this.clientConfig.get("checkout");if(e){this.trackBeginCheckout(t);const n=await this.api.prepareCheckout({cartId:t.id||""}),i=this.resolveCheckoutRedirectUrl(e.pageUrl,n.token);return window.location.assign(i),void 0}this.pubSub.publishAction(n.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var n;const e=(null===(n=t.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],e)}resolveCheckoutRedirectUrl(t,n){return t.includes("{id}")?n?t.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}async applyPromoCode(t){var e,i,o,r,s;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const a=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const c=await this.api.updateCart({id:t,items:[],promoCode:a,location:this.getLocation()});this.store.batch({"cart.subtotal":c.subtotal,"cart.itemsQuantity":c.itemsQuantity,"cart.events":c.events});const l=(null===(i=null===(e=c.promoCode)||void 0===e?void 0:e.code)||void 0===i?void 0:i.toLowerCase())===a.toLowerCase();l?(this.store.set("cart.promoCode",{code:a,discount:(null===(o=c.promoCode)||void 0===o?void 0:o.discount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(r=c.promoCode)||void 0===r?void 0:r.discount)||0,newSubtotal:c.subtotal||0}),this.googleTagManager.promoCodeApplied(a,(null===(s=c.promoCode)||void 0===s?void 0:s.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:t}),this.googleTagManager.promoCodeFailed(a,t),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const i=this.store.get("cart.promoCode"),o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:o,error:e}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...k,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartState(e,!![]),e.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(n.CART_RESET,!![])}catch(t){const e=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",e);const i=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_FAILED,{cartId:i,message:e}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}getDetails(){var t;const n=this.store.get("cart"),e=this.store.get("address"),i={};for(const o in n.items||{}){const t=n.items[o];i[o]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:n.id||"",promoCodeDiscount:(null===(t=n.promoCode)||void 0===t?void 0:t.discount)||null,subtotal:n.subtotal,itemCount:n.itemsQuantity,items:i,retailers:n.retailers||{},location:e.id?{placesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}}buildItemUpdate(t,n){var e,i,o;const r={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:n},s=(null===(o=null===(i=null===(e=t.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}syncItemsFromApiResponse(t,n=[]){const e=this.store.get("cart.items")||{},i=new Set(Object.keys(t.items));for(const r of Object.keys(e))i.has(r)||this.store.remove("cart.items."+r);const o={};for(const r of Object.values(t.items))0!==n.length&&!n.includes(r.id)&&e[r.id]||(o["cart.items."+r.id]=r);Object.keys(o).length>0&&this.store.batch(o)}syncCartMetaFromApiResponse(t){var n,e;const i={"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":t.events},o=null===(n=null==t?void 0:t.promoCode)||void 0===n?void 0:n.code;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discount:(null===(e=t.promoCode)||void 0===e?void 0:e.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var n,e;const i=this.store.get("cart.retailers")||{},o=this.store.get("cart.fulfillments")||{},r=new Set(Object.keys(t.retailers)),s=new Set;for(const a of Object.values(t.retailers))if(a.fulfillments)for(const t of Object.keys(a.fulfillments))s.add(t);for(const a of Object.keys(i))r.has(a)||this.store.remove("cart.retailers."+a);for(const a of Object.keys(o))s.has(a)||this.store.remove("cart.fulfillments."+a);if((null===(n=Object.values(t.retailers))||void 0===n?void 0:n.length)>0){const n={};for(const i of Object.values(t.retailers))if(n["cart.retailers."+i.id]=i,(null===(e=Object.values(i.fulfillments))||void 0===e?void 0:e.length)>0)for(const t of Object.values(i.fulfillments))n["cart.fulfillments."+t.id]=t;this.store.batch(n)}}updateFulfillment(t,n){var e;const i=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.find(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t)}),o=null==i?void 0:i.fulfillments[t];o&&i&&this.store.set("cart.fulfillments."+t,o)}addNewFulfillmentAndRetailer(t,n){var e;const i=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.find(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t)}),o=null==i?void 0:i.fulfillments[t];if(o&&i){const n={["cart.fulfillments."+t]:o,["cart.retailers."+i.id]:i};this.store.batch(n)}}cleanupAfterItemRemoval(t,n){var e,i;const o=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.some(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t.fulfillmentId)}),r=null===(i=Object.keys(n.retailers))||void 0===i?void 0:i.some(n=>n===t.retailerId);if(o){this.updateFulfillment(t.fulfillmentId,n);const e=n.retailers[t.retailerId];e&&this.store.set("cart.retailers."+t.retailerId,e)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),r){const e=n.retailers[t.retailerId];e&&this.store.set("cart.retailers."+t.retailerId,e)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,e=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const n of Object.keys(c.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const l={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.items))l["cart.items."+n.id]=n;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.retailers))if(l["cart.retailers."+n.id]=n,(null===(s=Object.values(n.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(n.fulfillments))l["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(l["cart.events"]=t.events),this.store.batch(l),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var n,e;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const n=t.items[r];o[r]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(e=null===(n=t.promoCode)||void 0===n?void 0:n.discount)&&void 0!==e?e:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const o={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===i.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}openModal(t,n){const e={type:t,data:n||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:e})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+n.INTERNAL_CART_TO_CHECKOUT,async()=>{this.store.set("metadata.checkout",F.checkout),await this.loadCheckout({}),this.uiCommands.openDrawer(i.CHECKOUT)}),window.addEventListener("lce:actions."+n.CART_RESET,()=>{this.store.set("checkout",{...E,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const n={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},e=await this.api.updateCart({id:"",items:[n],location:this.getLocation()});await this.loadCheckout({cartId:e.id,isForPresale:!![]})}catch(n){throw this.store.set("checkout.error",n.message),this.logger.error("Failed to add presale item to checkout",n),n}}async loadCheckout(t){try{this.store.set("checkout.loading",!![]);const e=void 0!==t.cartId?t.cartId:this.store.get("cart.id");if(!t.checkoutId&&!e)return this.store.set("checkout.error","Checkout token or Cart ID is required"),void 0;const i=this.themeProvider.getConfigs("checkout"),o=await this.api.prepareCheckout({token:t.checkoutId||void 0,cartId:t.checkoutId?void 0:e,marketingPreferences:{canEmail:i.layout.emailOptIn.checked,canSms:i.layout.smsOptIn.checked}});if(t.isForPresale===!![]&&0===o.itemsQuantity)return this.showPresaleExpired("items_unavailable"),void 0;const r={"checkout.cartId":o.cartId,"checkout.isGift":o.isGift,"checkout.marketingPreferences":o.marketingPreferences,"checkout.customerForm":E.customerForm,"checkout.giftRecipientForm":E.giftRecipientForm,"checkout.paymentForm":E.paymentForm,"checkout.paymentForm.billingSameAsShipping":o.billingSameAsShipping,"checkout.shippingAddress":o.shippingAddress,"checkout.presale":o.presale,"checkout.giftRecipientForm.data":o.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":o.itemsQuantity};this.store.batch(r),this.syncCheckoutState(o),this.pubSub.publishAction(n.CHECKOUT_LOADED,this.getDetails())}catch(e){this.store.set("checkout.error",e.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:e.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),i=null!=t?t:!e,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o});const r=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{cartId:r,isActive:i,previousIsActive:e})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",i);const o=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:o,isActive:i,previousIsActive:e})}async toggleMarketingPreferences(t,e){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=e?e:!i,r=this.store.get("checkout.marketingPreferences"),s=this.dataForCheckoutPrepare({marketingPreferences:{...r,[t]:o}}),a=await this.api.prepareCheckout(s);this.store.set("checkout.marketingPreferences",a.marketingPreferences);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:c,fieldName:t,isActive:o,previousIsActive:i})}async getPaymentSession(){try{const t=this.store.get("cart.id"),n=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":n,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,n){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const e=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:n});return{id:e.id,card:{brand:e.card.brand,last4:e.card.last4,expMonth:e.card.expMonth,expYear:e.card.expYear}}}catch(e){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const e=this.dataForCheckoutPrepare({}),i=await this.api.prepareCheckout({...e,promoCode:t}),o=0!==i.amounts.discounts,r=i.events.some(t=>t.type===a.PROMO_CODE)?i.events[0]:null;if(!o){this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist');const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e,error:(null==r?void 0:r.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==r?void 0:r.message)||"not_applied"),void 0}const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:s,discount:i.amounts.discounts,newTotal:i.amounts.total}),this.googleTagManager.promoCodeApplied(t,i.amounts.discounts),await this.refreshCheckout({response:i})}catch(e){const i=(null==e?void 0:e.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",i);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:i}),this.googleTagManager.promoCodeFailed(t,i),e}}async removePromoCode(){var t,e;try{const i=this.dataForCheckoutPrepare({}),o=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:s,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.refreshCheckout({response:r})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"",o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(xt){const n=xt.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),xt}}async applyGiftCard(t){const e=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(e);const t=this.dataForCheckoutPrepare({}),i=t.giftCards||[],o=await this.api.prepareCheckout({...t,giftCards:[...i,e]}),r=o.events.some(t=>t.type===a.GIFT_CARD&&t.level===c.ERROR)?o.events[0]:null;r&&this.store.set("checkout.giftCardError",r.message);const s=o.giftCards.find(t=>t.code.toLowerCase()===e.toLowerCase());if(!s){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==r?void 0:r.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(e,(null==r?void 0:r.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:l,newTotal:o.amounts.total}),this.googleTagManager.giftCardApplied(e,s.applied),await this.refreshCheckout({response:o})}catch(i){const t=(null==i?void 0:i.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:o,error:t}),this.googleTagManager.giftCardFailed(e,t),i}}async removeGiftCard(t){var e;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],r=await this.api.prepareCheckout({...t,giftCards:o}),s=r.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(s)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:a,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.refreshCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(xt){throw this.store.set("checkout.error",(null==xt?void 0:xt.message)||"Failed to clear gift card error. Please try again."),xt}}showPresaleExpired(t="time_expired"){this.store.set("checkout",{...E,rerender:![]});const n=this.store.get("metadata.checkout.injection");if(null==n?void 0:n.containerId){const e=document.getElementById(n.containerId);if(e){const n=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_EXPIRED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],reason:t});safeReplaceChildren(e,n)}return}this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED,{reason:t})}openCheckout(){const t=this.clientConfig.get("checkout");if(null==t?void 0:t.pageUrl){this.store.set("metadata.checkout.returnUrl",window.location.href);const n=this.store.get("checkout.token")||"",e=this.resolveCheckoutPageUrl(t.pageUrl,n);return window.location.assign(e),void 0}this.uiCommands.openDrawer(i.CHECKOUT)}getReturnUrl(){return this.store.get("metadata.checkout.returnUrl")}resolveCheckoutPageUrl(t,n){return t.includes("{id}")?n?t.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout page URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var i,o,r;try{this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c=a.quantity,l=a.quantity+e;if(l<1)return this.removeItem(t,!![]);const d={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:l},m=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];m.length>0&&(d.engravingLines=m);const g=await this.api.updateCheckoutItems({cartId:s,items:[d],location:this.getLocation()});this.syncFromItemUpdate(g.cart,g.checkout),this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:s,cartItemId:a.cartItemId,quantity:l,previousQuantity:c});const v=splitCategoryPath(a.catPath),y={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,quantity:Math.abs(e),price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};e<0?this.googleTagManager.removeFromCart(y):e>0&&this.googleTagManager.addToCart(y)}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,i,o;try{const r=this.store.get("checkout.items."+t);if(!r)throw new SDKError("Item not found in checkout");if(!(null===(e=r.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const s=(null===(o=null===(i=r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],a={id:r.cartItemId,fulfillmentId:r.fulfillmentId,partNumber:r.partNumber,quantity:r.quantity,engravingLines:[]},c=this.store.get("checkout.cartId"),l=await this.api.updateCheckoutItems({cartId:c,items:[a],location:this.getLocation()});this.syncFromItemUpdate(l.cart,l.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:c,cartItemId:r.cartItemId,engravingLines:[],previousEngravingLines:s})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r}),r}}async removeItem(t,e){var i,o,r;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:0},l=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];l.length>0&&(c.engravingLines=l);const d=await this.api.updateCheckoutItems({cartId:s,items:[c],location:this.getLocation()});this.syncFromItemUpdate(d.cart,d.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:s,cartItemId:a.cartItemId})}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.fulfillments"),i=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:Math.round(n.amounts.subtotal*t/100)})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.fulfillments"),r=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),s=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?e:n.amounts.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(a);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:c,deliveryTips:s,previousDeliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.fulfillments"),i=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?0:n.amounts.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:i}){var o;try{this.store.set("checkout.customerForm.isSaving",!![]);const r=this.store.get("checkout.customerForm.data"),s=this.store.get("checkout.isGift"),a=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...r,...i},isGift:s}),c=await this.api.prepareCheckout(a);this.store.batch({"checkout.customerForm.data":c.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":c.shippingAddress,"checkout.deliveryInstructions":e});const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:l});const d=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(d.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=d.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...i}){var o;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const r=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:i}),s=await this.api.prepareCheckout(r);this.store.batch({"checkout.giftRecipientForm.data":s.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":s.shippingAddress,"checkout.deliveryInstructions":e});const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:a});const c=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(c.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=c.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var i,o,r;try{this.store.set("checkout.paymentForm.isSaving",!![]);const s=this.store.get("checkout"),a={},c=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let l=null,d=null;if(c||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");l=t.card,d=t.id}const m=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:d||void 0}),g=await this.api.prepareCheckout(m);if(g.payment&&l&&(a["checkout.paymentForm.paymentMethod"]={id:g.payment,card:l}),t&&g.billingAddress){a["checkout.paymentForm.data"]={firstName:g.billingAddress.firstName||"",lastName:g.billingAddress.lastName||"",email:g.billingAddress.email||"",phone:g.billingAddress.phone||"",company:g.billingAddress.company||"",addressOne:g.billingAddress.one||"",addressTwo:g.billingAddress.two||"",city:g.billingAddress.city||"",state:g.billingAddress.state||"",zipCode:g.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}a["checkout.paymentForm.isEditing"]=![],a["checkout.paymentForm.isValid"]=!![],this.store.batch(a);const v=a["checkout.paymentForm.paymentMethod"]||(null===(i=s.paymentForm)||void 0===i?void 0:i.paymentMethod),y=(null===(o=null==v?void 0:v.card)||void 0===o?void 0:o.brand)?v.card.brand+" ****"+v.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(s.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),y,(null===(r=s.promoCode)||void 0===r?void 0:r.code)||void 0)}catch(s){throw this.logger.error("Failed to save payment form",s),this.store.set("checkout.error",s.message),s}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,o,r,s,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout"),{orderNumber:l}=await this.api.checkoutComplete(c.token);c.presale||this.store.set("cart.shouldReset",!![]);const d={orderNumber:l,orderTotal:c.amounts.total,cardLast4:(null===(o=null===(e=null===(t=null==c?void 0:c.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===o?void 0:o.last4)||"",customerEmail:c.customerForm.data.email,giftRecipientEmail:(null===(s=null===(r=null==c?void 0:c.giftRecipientForm)||void 0===r?void 0:r.data)||void 0===s?void 0:s.email)||null},m=this.store.get("metadata.checkout.injection");if(null==m?void 0:m.containerId){const t=document.getElementById(m.containerId);if(t){const n=ComponentFactoryService.createElement({type:i.CHECKOUT_COMPLETED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...d});safeReplaceChildren(t,n)}}else this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,d);this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:l,orderTotal:c.amounts.total}),this.googleTagManager.purchase({transaction_id:l,tax:centToDollar(c.amounts.tax+c.amounts.service+c.amounts.platform),shipping:centToDollar(c.amounts.shipping||0),coupon:(null===(a=c.promoCode)||void 0===a?void 0:a.code)||void 0,items:[...Object.values(c.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(c.amounts.total),subtotal:centToDollar(c.amounts.subtotal),total_before_discounts:centToDollar(c.amounts.subtotal+c.amounts.tax+c.amounts.service+c.amounts.platform+c.amounts.shipping+c.amounts.delivery),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)})}catch(c){const t=(null==c?void 0:c.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const n={"checkout.amounts":t.amounts,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const e of Object.values(t.retailers))for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t;this.store.batch(n)}syncFromItemUpdate(t,n){var e,i,o,r,s;try{this.store.set("checkout.updating",!![]);const a=this.store.get("cart");for(const t of Object.keys(a.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(a.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(a.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const c={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(e=t.promoCode)||void 0===e?void 0:e.code)?{...t.promoCode,error:null}:null};if((null===(i=Object.values(t.items))||void 0===i?void 0:i.length)>0)for(const n of Object.values(t.items))c["cart.items."+n.id]=n;if((null===(o=Object.values(t.retailers))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.retailers))if(c["cart.retailers."+n.id]=n,(null===(r=Object.values(n.fulfillments))||void 0===r?void 0:r.length)>0)for(const t of Object.values(n.fulfillments))c["cart.fulfillments."+t.id]=t;this.store.batch(c);const l={"checkout.token":n.token,"checkout.events":n.events,"checkout.amounts":n.amounts,"checkout.shippingAddress":n.shippingAddress,"checkout.itemsQuantity":n.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(s=null==n?void 0:n.promoCode)||void 0===s?void 0:s.code)?null==n?void 0:n.promoCode:null};if(Object.values(n.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(n.items))l["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(n.retailers&&Object.values(n.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(n.retailers)){l["checkout.retailers."+t.id]=t;for(const n of Object.values(t.fulfillments))l["checkout.fulfillments."+n.id]=n}}this.store.batch(l)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var n;const e={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.shippingAddress":t.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(n=null==t?void 0:t.promoCode)||void 0===n?void 0:n.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const n of Object.values(t.items))e["checkout.items."+n.cartItemId]={...n,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const n of Object.values(t.retailers)){e["checkout.retailers."+n.id]=n;for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t}}this.store.batch(e)}async refreshCheckout(t){var e;try{let n;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)n=t.response;else{const i=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...o,cartId:i})}this.syncCheckoutState(n)}catch(i){const t=(null==i?void 0:i.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),i}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:n,billingData:e,marketingPreferences:i,shippingAddressTwo:r,deliveryInstructions:s,deliveryTips:a,paymentMethodId:c,isGift:l}){var d,m,g,v,y,b,k,E,_,F,D,T,A,O,z,L,R,j,q,H,Y,Q,W;const Z=this.store.get("checkout"),X=null!==(m=null===(d=Z.paymentForm)||void 0===d?void 0:d.billingSameAsShipping)&&void 0!==m?m:!![],J=void 0!==l?l:Z.isGift,$=n?!![]:null!==(v=null===(g=Z.giftRecipientForm)||void 0===g?void 0:g.isValid)&&void 0!==v?v:![],tt=J&&$,nt={cartId:Z.cartId,shippingAddressTwo:r,billingSameAsShipping:X,marketingPreferences:i||Z.marketingPreferences,promoCode:(null===(y=Z.promoCode)||void 0===y?void 0:y.code)||void 0,isGift:tt,giftCards:(null===(b=null==Z?void 0:Z.giftCards)||void 0===b?void 0:b.map(t=>t.code))||[],deliveryTips:a||Object.values(Z.fulfillments||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};c?nt.payment=c:(null===(E=null===(k=Z.paymentForm)||void 0===k?void 0:k.paymentMethod)||void 0===E?void 0:E.id)&&(nt.payment=Z.paymentForm.paymentMethod.id);const et=s||Z.deliveryInstructions;if(et&&(nt.deliveryInstructions=Object.values(Z.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:et}))),nt.customer=t||((null===(F=null===(_=null==Z?void 0:Z.customerForm)||void 0===_?void 0:_.data)||void 0===F?void 0:F.email)?{firstName:null===(T=null===(D=Z.customerForm)||void 0===D?void 0:D.data)||void 0===T?void 0:T.firstName,lastName:null===(O=null===(A=Z.customerForm)||void 0===A?void 0:A.data)||void 0===O?void 0:O.lastName,email:null===(L=null===(z=Z.customerForm)||void 0===z?void 0:z.data)||void 0===L?void 0:L.email,phone:null===(j=null===(R=Z.customerForm)||void 0===R?void 0:R.data)||void 0===j?void 0:j.phone,birthDate:null===(H=null===(q=Z.customerForm)||void 0===q?void 0:q.data)||void 0===H?void 0:H.birthDate,company:null===(Q=null===(Y=Z.customerForm)||void 0===Y?void 0:Y.data)||void 0===Q?void 0:Q.company}:void 0),tt){const t=n||(null===(W=Z.giftRecipientForm)||void 0===W?void 0:W.data);t&&(nt.giftOptions=t)}return X||(e?nt.billingAddress={firstName:e.firstName,lastName:e.lastName,email:e.email,phone:e.phone,company:e.company,one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip}:Z.paymentForm.data&&(nt.billingAddress=Z.paymentForm.data)),nt}getDetails(){var t,n,e,i;const o=this.store.get("checkout"),r={};for(const s in o.items||{}){const t=o.items[s];r[s]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:s,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:o.cartId,isGift:o.isGift||![],billingSameAsShipping:(null===(t=o.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(n=o.marketingPreferences)||void 0===n?void 0:n.canEmail)||![],canSms:(null===(e=o.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:Boolean(null===(i=o.promoCode)||void 0===i?void 0:i.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,amounts:o.amounts,itemCount:Object.values(r).reduce((t,n)=>t+(n.quantity||0),0),items:r}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,n=![]){this.store.createProductInstance(t),n&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var n;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=!![],t["products."+n+".error"]=null,t),{}));const e=await this.api.getProductsData(t,this.getLocation());if(!e||!e.products||0===e.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]=!![],t),{})),void 0;const i=[];for(const r of e.products){const o=Object.values(r.sizes).filter(n=>t.some(t=>t===(n.upc||n.id||r.salsifyGrouping))),s=t.find(t=>o.some(n=>t===n.upc||t===n.id)||t===r.salsifyGrouping),a=s||(null===(n=null==o?void 0:o[0])||void 0===n?void 0:n.upc);await this.loadProduct(a,{products:[r],retailers:e.retailers}),i.push(a)}const o=t.filter(t=>-1===i.indexOf(t));this.store.batch(o.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(e&&(s=e),e||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],l=a.sizes[a.selectedSizeId||""],d=Boolean(this.getLocation()),m=a.selectedFulfillment,g=d&&(null==m?void 0:m.variant.price)?m.variant.price:a.noAvailabilityPrice,v=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:c.name,item_brand:c.brand,item_size:null==l?void 0:l.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(g),item_type:c.type,item_subtype:c.subType,item_image:(null==l?void 0:l.image)||(null===(o=c.images)||void 0===o?void 0:o[0]),upc:null==l?void 0:l.upc,grouping_id:c.salsifyGrouping,product_id:null==l?void 0:l.id})}catch(r){this.store.set("products."+t+".error",r.message),this.logger.error("Failed to load product data for ID "+t,r)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var i,r,s;const a=this.store.get("products."+t),c=a.sizes[e],l=Object.values(c.shippingFulfillments),d=Object.values(c.onDemandFulfillments),m=l.length>0,g=d.length>0,v=m||g;let y=a.selectedFulfillmentType,b=null,k=null;const E=y===o.SHIPPING?m:g;!E&&v&&(y=y===o.SHIPPING?o.ON_DEMAND:o.SHIPPING);const _=y===o.SHIPPING?l:d;_.length>0&&(b=_[0],k=b.id);const F=_.length>0,D=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==c?void 0:c.id,item_name:a.name,item_brand:a.brand,item_size:null==c?void 0:c.size,item_category:D.category,item_category2:D.category2,item_category3:D.category3,price:centToDollar((null==b?void 0:b.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==c?void 0:c.image)||(null===(i=a.images)||void 0===i?void 0:i[0]),upc:null==c?void 0:c.upc,grouping_id:a.salsifyGrouping,product_id:null==c?void 0:c.id}),v||this.googleTagManager.productSizeNoAvailability({productId:null==c?void 0:c.id,productName:a.name,productBrand:a.brand,productCategory:D.category,productCategory2:D.category2,productCategory3:D.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:e,sizeName:null==c?void 0:c.size,upc:null==c?void 0:c.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,selectedSize:(null===(r=a.sizes[e])||void 0===r?void 0:r.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(s=a.sizes[a.selectedSizeId])||void 0===s?void 0:s.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:v,["products."+t+".fulfillmentHasAvailability"]:F,["products."+t+".selectedFulfillmentType"]:y,["products."+t+".selectedFulfillment"]:b,["products."+t+".selectedFulfillmentId"]:k})}async selectFulfillment(t,e){var i;const r=this.store.get("products."+t),s=r.sizes[r.selectedSizeId],a=r.selectedFulfillmentType===o.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,c=a[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId||"",previousFulfillmentType:r.selectedFulfillmentType});const l=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:r.name,item_brand:r.brand,item_size:null==s?void 0:s.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:centToDollar((null==c?void 0:c.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,item_image:(null==s?void 0:s.image)||(null===(i=r.images)||void 0===i?void 0:i[0]),upc:null==s?void 0:s.upc,grouping_id:r.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+e,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,l=Math.max(a,Math.min(c,s));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:l,previousQuantity:r}),this.store.set("products."+t+".quantity",l)}async changeFulfillmentType(t,e){var i,r;const s=this.store.get("products."+t),a=s.sizes[s.selectedSizeId],c=e===o.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,l=Object.values(c);if(0===l.length){const t=splitCategoryPath(s.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:s.name,productBrand:s.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:null!==(i=s.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:e,upc:null==a?void 0:a.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const d=l[0]||null,m=(null==d?void 0:d.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:m,previousFulfillmentType:s.selectedFulfillmentType,previousFulfillmentId:s.selectedFulfillmentId,fulfillmentHasAvailability:l.length>0});const g=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:s.name,item_brand:s.brand,item_size:null==a?void 0:a.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==d?void 0:d.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,item_image:(null==a?void 0:a.image)||(null===(r=s.images)||void 0===r?void 0:r[0]),upc:null==a?void 0:a.upc,grouping_id:s.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:m,["products."+t+".fulfillmentHasAvailability"]:l.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,n,e){const i={type:n,data:e||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),n=Object.keys(t);for(const e of n)this.store.set("products."+e+".rerender",!![])}async addToCart(t,n){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const e=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(e.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(e){this.logger.error("Error adding to cart",e),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,n){try{this.store.set("products."+t+".updating",!![]),await this.checkoutCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout(),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(e){this.logger.error("Error adding presale item to checkout",e),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const n=this.store.get("products."+t);if(!n)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[n,e])=>(t[n]={...e},t),{}):{},e=Object.entries(n.sizes||{}).reduce((t,[n,e])=>{const{loading:i,error:o,shippingFulfillments:r,onDemandFulfillments:s,...a}=e;return t[n]={...a,shippingFulfillments:fulfillmentEventData(r),onDemandFulfillments:fulfillmentEventData(s)},t},{});return{identifier:t,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentType:n.selectedFulfillmentType,selectedFulfillmentId:n.selectedFulfillmentId||null,productHasAvailability:Boolean(n.productHasAvailability),fulfillmentHasAvailability:Boolean(n.fulfillmentHasAvailability),id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,subType:n.subType,salsifyGrouping:n.salsifyGrouping,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,noAvailabilityPrice:n.noAvailabilityPrice,sizes:e}}findFirstAvailableSize(t){const n=Object.values(t);for(const e of n){const t=e.shippingFulfillments||{},n=e.onDemandFulfillments||{},i=Object.values(t).length,o=Object.values(n).length;if(i+o>0)return e.id}return null}loadProductStoreUpdate({products:[t,...n],retailers:e}){var i,r,s,a,c;try{const n=this.themeProvider.getConfigs("product"),l={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:n.layout.enableShippingFulfillment?o.SHIPPING:o.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:o,...r}of Object.values(t.sizes)){l.sizes[r.id]={...r,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(i)){const n=e[t.retailerId];(null==n?void 0:n.shippingFulfillment)&&(l.sizes[r.id].shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}for(const t of Object.values(o)){const n=e[t.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(l.sizes[r.id].onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}}const d=Object.values(l.sizes),m=this.findFirstAvailableSize(l.sizes);l.selectedSizeId=m||(null===(i=d[0])||void 0===i?void 0:i.id)||"";const g=(null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},v=(null===(s=l.sizes[l.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments)||{};l.productHasAvailability=Object.values(g).length+Object.values(v).length>0;const y=l.selectedFulfillmentType===o.SHIPPING?Object.values(g):Object.values(v);if(l.fulfillmentHasAvailability=y.length>0,l.selectedFulfillment=y[0]||null,l.selectedFulfillmentId=(null===(a=l.selectedFulfillment)||void 0===a?void 0:a.id)||null,!l.fulfillmentHasAvailability){const t=l.selectedFulfillmentType===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,n=t===o.SHIPPING?Object.values(g):Object.values(v);n.length>0&&(l.selectedFulfillmentType=t,l.selectedFulfillment=n[0],l.selectedFulfillmentId=(null===(c=l.selectedFulfillment)||void 0===c?void 0:c.id)||null,l.fulfillmentHasAvailability=!![])}if(!l.productHasAvailability){const n=splitCategoryPath(t.catPath),e=l.sizes[l.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==e?void 0:e.id,productName:t.name,productBrand:t.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==e?void 0:e.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return l}catch(l){throw this.logger.error("Product data processing error",l),l}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=this.buildFormattedAddressString(t),i={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(i)}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:e,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",y),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var n,e,i,o,r,s;const a=[],c=[];(null===(n=t.one)||void 0===n?void 0:n.trim())&&c.push(t.one.trim()),(null===(e=t.two)||void 0===e?void 0:e.trim())&&c.push(t.two.trim()),c.length>0&&a.push(c.join(" ")),(null===(i=t.city)||void 0===i?void 0:i.trim())&&a.push(t.city.trim());const l=[];return(null===(o=t.state)||void 0===o?void 0:o.trim())&&l.push(t.state.trim()),(null===(r=t.zip)||void 0===r?void 0:r.trim())&&l.push(t.zip.trim()),l.length>0&&a.push(l.join(" ")),(null===(s=t.country)||void 0===s?void 0:s.trim())&&a.push(t.country.trim()),a.join(", ")}}const wt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},kt={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},Ct={MIN:"0",MAX:"1000"},St={YES:"YES",NO:"NO"},Et={IDLE:"idle",LOADING_INITIAL:"loading_initial",LOADING_MORE:"loading_more",ERROR:"error"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[wt.BRANDS]:d.BRANDS,[wt.CATEGORIES]:d.CATEGORIES,[wt.FLAVOR]:d.FLAVOR,[wt.REGION]:d.REGION,[wt.VARIETY]:d.VARIETY,[wt.VINTAGE]:d.VINTAGE,[wt.COUNTRY]:d.COUNTRY,[wt.APPELLATION]:d.APPELLATION,[wt.MATERIALS]:d.MATERIALS,[wt.SIZES]:d.SIZES,[wt.PRESALE]:d.PRESALE,[wt.ENGRAVING]:d.ENGRAVING,[wt.FULFILLMENT]:d.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(t,n)=>{var e;const i=this.getStoreState(),r=i.products.find(n=>(n.salsifyGrouping||n.id)===t),s=i.userProducts[t].selectedSizeId,a=r?Object.values(r.sizes).find(t=>t.id===s):void 0;if(!a)return;const c=n===o.SHIPPING?Object.values(a.shippingFulfillments):Object.values(a.onDemandFulfillments),l=c[0];if(!l)return;const d=l.variant,m=i.retailers,g=m[d.retailerId];if(!g)return;const v=n===o.SHIPPING?g.shippingFulfillment:g.onDemandFulfillment,y={...i.userProducts,[t]:{...i.userProducts[t],selectedFulfillmentType:n,selectedFulfillment:v?{...v,id:null!==(e=v.id)&&void 0!==e?e:"",retailerName:g.name,retailerAddress:g.address,retailerAddressFormatted:g.addressFormatted,variant:d,image:a.image}:null}};this.store.set("productsList.userProducts",y),this.notifyListeners()},this.selectFulfillment=async(t,n)=>{var e,i;const r=this.getStoreState(),s=r.products.find(n=>(n.salsifyGrouping||n.id)===t),a=r.userProducts[t].selectedSizeId,c=s?Object.values(s.sizes).find(t=>t.id===a):void 0;if(!c)return;const l=Object.values(c.shippingFulfillments||{}).find(t=>t.id===n),d=Object.values(c.onDemandFulfillments||{}).find(t=>t.id===n),m=l||d;if(!m)return;const g=l?o.SHIPPING:o.ON_DEMAND,v=null===(e=m.variant)||void 0===e?void 0:e.retailerId,y=v?r.retailers[v]:void 0;if(!y)return;const b=g===o.SHIPPING?y.shippingFulfillment:y.onDemandFulfillment,k={...r.userProducts,[t]:{...r.userProducts[t],selectedFulfillmentType:g,selectedFulfillment:b?{...b,id:null!==(i=b.id)&&void 0!==i?i:"",retailerName:y.name,retailerAddress:y.address,retailerAddressFormatted:y.addressFormatted,variant:m.variant,image:c.image}:null}};this.store.set("productsList.userProducts",k),this.notifyListeners()},this.selectSize=async(t,n)=>{var e;const i=this.getStoreState(),o=i.products.find(n=>(n.salsifyGrouping||n.id)===t);if(!o)return;const r=Object.values(o.sizes).find(t=>t.id===n);if(!r)return;const{fulfillment:s,fulfillmentType:a}=this.getFulfillmentForSize(r,i.userProducts[t].selectedFulfillmentType),c={...i.userProducts,[t]:{...i.userProducts[t],selectedSizeId:n,...a?{selectedFulfillmentType:a}:{},...s?{selectedFulfillment:s?{...s,image:null!==(e=s.image)&&void 0!==e?e:null}:null}:{}}};this.store.set("productsList.userProducts",c),this.notifyListeners()},this.updateQuantity=(t,n)=>{const e=this.getStoreState(),i={...e.userProducts,[t]:{...e.userProducts[t],selectedQuantity:n}};this.store.set("productsList.userProducts",i),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(t){this.listeners.add(t);const n=this.getStoreState();try{t(n)}catch(e){this.logger.error("Error in initial state listener call:",e)}return()=>{this.listeners.delete(t)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(t){this.store.set("productsList.searchTerm",t),this.notifyListeners()}setLoading(t){this.store.set("productsList.loading",t),this.notifyListeners()}notifyListeners(){const t=this.getStoreState();this.listeners.forEach(n=>{try{n(t)}catch(e){this.logger.error("Error in state listener:",e)}})}initializeProductFulfillment(t){const n=Object.values(t.sizes)[0];if(!n)return{sizeId:"",fulfillmentType:null,fulfillment:null};const e=n.id,i=Object.values(n.shippingFulfillments)[0];if(i)return{sizeId:e,fulfillmentType:"shipping",fulfillment:{...i,image:Object.values(t.sizes)[0].image}};const o=Object.values(n.onDemandFulfillments)[0];return o?{sizeId:e,fulfillmentType:"onDemand",fulfillment:{...o,image:t.sizes[0].image}}:{sizeId:e,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(t,n){return t.map(t=>this.transformSingleProduct(t,n))}transformSingleProduct(t,n){const e={...t,sizes:{}};if(!t.sizes||0===Object.values(t.sizes).length)return e;for(const[i,o]of Object.entries(t.sizes))e.sizes[i]=this.transformProductSize(o,n);return e}transformProductSize(t,n){const{shippingVariants:e,onDemandVariants:i,...o}=t,r={...o,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(r,e,n),this.addOnDemandFulfillments(r,i,n),r}addShippingFulfillments(t,n,e){if(n)for(const i of Object.values(n)){const n=e[i.retailerId];(null==n?void 0:n.shippingFulfillment)&&(t.shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:i})}}addOnDemandFulfillments(t,n,e){if(n)for(const i of Object.values(n)){const n=e[i.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(t.onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:i})}}async loadInitialProducts(t,n,e,i,o){try{this.setLoading(!![]);const r=this.buildSearchParams(t,n,e,i,o),s=await this.getProductList(r),a=this.transformProductVariantsToFulfillments(s.products||[],s.retailers||{}),c={};a&&a.length>0&&a.forEach(t=>{var n;const e=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);c[e]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(n=i.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":a,"productsList.retailers":s.retailers,"productsList.filters":s.navigation.filters,"productsList.pagination":this.updatePagination(s.navigation),"productsList.loading":![],"productsList.userProducts":c}),this.notifyListeners()}catch(r){throw this.logger.error("Error loading initial products:",r),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),r}}async loadMoreProducts(t,n,e,i){try{const o=this.getStoreState(),r=o.pagination;if(!r.hasMorePages)return;this.setLoading(!![]);const s=r.currentPage+1,a=this.buildSearchParams(s,t,n,e,i),c=await this.getProductList(a);if(c.products&&c.products.length>0){const t=o.products,n=o.retailers,e=o.userProducts,i=this.mergeRetailers(n,c.retailers||{}),r=this.transformProductVariantsToFulfillments(c.products,c.retailers||{}),s={...e};r.forEach(t=>{var n;const e=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);s[e]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(n=i.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...t,...r],"productsList.retailers":i,"productsList.filters":c.navigation.filters,"productsList.pagination":this.updatePagination(c.navigation),"productsList.loading":![],"productsList.userProducts":s}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...r,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(o){throw this.logger.error("Error loading more products:",o),this.setLoading(![]),o}}async getProductList(t){t.location=this.getLocation();const n=await this.api.catalogSearch(t);return n.products&&n.products.length>0&&this.trackViewItemList(n.products),n}syncFiltersFromComponent(t){const n={};for(const[e,i]of Object.entries(t))null!=i&&(Array.isArray(i)?n[e]=i:n[e]="object"==typeof i?[JSON.stringify(i)]:[String(i)]);this.store.set("productsList.appliedFilters",n),this.notifyListeners()}getSanitizedFilters(t,n){return n&&0!==n.length?t.filter(t=>{const e=this.FILTER_TYPE_MAP[t.type];return e&&n.includes(e)}):[]}buildSearchParams(t,n,e,i,o){const r={page:t,perPage:n,filters:this.buildFilters(i,o)};return e&&e.trim().length>0&&(r.search=e.trim()),r}buildFilters(t,n){const e=[];return this.addToggleFilters(e,t,n),this.addPriceFilter(e,t,n),this.addDynamicFilters(e,t,n),e}addToggleFilters(t,n,e){this.addEngravingFilter(t,n,e),this.addPresaleFilter(t,n,e),this.addFulfillmentFilter(t,n,e)}getBooleanFilterValue(t){return"boolean"==typeof t?t:Array.isArray(t)&&t.length>0?"true"===t[0]:"string"==typeof t?"true"===t:![]}addEngravingFilter(t,n,e){if(e.includes(d.ENGRAVING)){const e=this.getBooleanFilterValue(n[wt.ENGRAVING]);t.push({key:wt.ENGRAVING,values:[e?St.YES:St.NO]})}}addPresaleFilter(t,n,e){if(e.includes(d.PRESALE)){const e=this.getBooleanFilterValue(n[wt.PRESALE]);t.push({key:wt.PRESALE,values:[e?St.YES:St.NO]})}}addFulfillmentFilter(t,n,e){if(e.includes(d.FULFILLMENT)){const e=n[wt.FULFILLMENT],i=Array.isArray(e)?e[0]:e||kt.ALL,o=i===kt.ALL?[kt.ON_DEMAND,kt.SHIPPING]:[i];t.push({key:wt.FULFILLMENT,values:o})}}addPriceFilter(t,n,e){var i,o,r,s;e.includes(d.PRICE)&&t.push({key:wt.PRICE,values:{min:null!==(o=null===(i=n.price)||void 0===i?void 0:i.min)&&void 0!==o?o:Ct.MIN,max:null!==(s=null===(r=n.price)||void 0===r?void 0:r.max)&&void 0!==s?s:Ct.MAX}})}addDynamicFilters(t,n,e){const i=[wt.PRICE,wt.ENGRAVING,wt.PRESALE,wt.FULFILLMENT],o=Object.keys(n).filter(t=>!i.includes(t)),r=new Set;for(const a of o)t.push({key:a,values:n[a]}),r.add(a);const s=this.getFilterKeyToTypeMap();for(const a of e){const n=s[a];!n||r.has(n)||i.includes(n)||t.push({key:n,values:[]})}}setGridConfig(t,n){this.store.set("productsList.gridConfig",{rows:t,columns:n})}getItemsPerPage(){const t=this.getStoreState(),n=t.gridConfig;return n?n.rows*n.columns:16}updatePagination(t){var n,e,i,o,r;return t?{currentPage:null!==(n=t.currentPage)&&void 0!==n?n:0,totalPages:null!==(e=t.totalPages)&&void 0!==e?e:0,totalCount:null!==(i=t.totalCount)&&void 0!==i?i:0,hasMorePages:(null!==(o=t.currentPage)&&void 0!==o?o:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(t,n){const e={...t};for(const[i,o]of Object.entries(n))e[i]||(e[i]=o);return e}extractProductCardData(t,n){const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const i=Object.values(e.shippingFulfillments),o=Object.values(e.onDemandFulfillments),r=i[0],s=o[0],a=(null==r?void 0:r.variant)||(null==s?void 0:s.variant);if(!a)return this.logger.warn("Product "+t.id+" has no variants"),null;const c=n[a.retailerId];return c?{product:t,retailer:c}:(this.logger.warn("Retailer "+a.retailerId+" not found for product "+t.id),null)}getFilterKeyToTypeMap(){const t={};for(const[n,e]of Object.entries(this.FILTER_TYPE_MAP))t[e]=n;return t}async addToCart(t){try{this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(t)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(t){try{await this.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout()}catch(n){throw this.logger.error("Error adding presale product to checkout from product list",n),n}}trackViewItemList(t){if(0!==t.length)try{const n=this.getStoreState(),e=this.transformProductVariantsToFulfillments(t,n.retailers),i=e.map((t,n)=>({...this.convertProductToBaseItem(t),index:n+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(t){try{const n=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(t){var n,e;const i=null===(n=t.sizes)||void 0===n?void 0:n[0],o=null==i?void 0:i.shippingFulfillments[Object.keys(i.shippingFulfillments)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==o?void 0:o.variant.price)?centToDollar(o.variant.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==i?void 0:i.image)||(null===(e=t.images)||void 0===e?void 0:e[0]),upc:null==i?void 0:i.upc,grouping_id:t.salsifyGrouping,product_id:null==i?void 0:i.id,item_list_id:"product_list",item_list_name:"Product List"}}openProductListModal(t,n,e){const i={type:n,data:e};this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:!![],["productsList.userProducts."+t+".modal.contentConfig"]:i}),this.notifyListeners()}closeProductListModal(t){this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:![],["productsList.userProducts."+t+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(t,n){const e=Object.values(t.shippingFulfillments||{}),i=Object.values(t.onDemandFulfillments||{}),r=e[0],s=i[0];return n===o.SHIPPING&&r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:n===o.ON_DEMAND&&s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const n of Object.keys(c.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const l={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.items))l["cart.items."+n.id]=n;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.retailers))if(l["cart.retailers."+n.id]=n,(null===(s=Object.values(n.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(n.fulfillments))l["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(l["cart.events"]=t.events),this.store.batch(l),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var n,e;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const n=t.items[r];o[r]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(e=null===(n=t.promoCode)||void 0===n?void 0:n.discount)&&void 0!==e?e:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartFromResponse(n,!![]),n.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e);const i=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:i,message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:n}){var e;this.o=Object.freeze(t),this.l=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(e=null==n?void 0:n.useShadowDom)&&void 0!==e?e:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const n=/\{([^}]+)}/g;return t.replace(n,(n,e)=>{const i=this.o[e];return null==i?(this.logger.warn('Parameter "'+e+'" not found in component params for path "'+t+'"'),n):String(i)})}connectedCallback(){var t,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.l.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(e){this.logger.error("Component connectedCallback error in "+((null===(n=this.l)||void 0===n?void 0:n.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"connectedCallback")}}disconnectedCallback(){var t,n;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(e){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.l)||void 0===n?void 0:n.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"disconnectedCallback")}}setup(){var t,n,e;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(i){this.logger.error("Component setup error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const n of this.unsubscribers)try{n()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const e=this.interpolatePath(n),i=this.store.watch(e,(t,n)=>{this.isDestroyed||void 0===t&&void 0!==n&&this.handleAutoDestroy(e)});this.unsubscribers.push(i)}handleAutoDestroy(t){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,t);const e=this.reactiveOptions.autoDestroyDelay||0;e>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},e):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.l.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.o)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,e;try{if(this.isDestroyed)return;const e=t.map(t=>t.path).join(", "),i="store:["+e+"]",o=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,t);o!==![]&&this.triggerRender(i)}catch(i){this.logger.error("Store watcher callback error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(t=this.l)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.o)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,e;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,t)}catch(i){this.logger.error("Non-rendering watcher callback error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.l)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,n;if(!this.initialized||this.isDestroyed)return;const e=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const o=performance.now()-e;this.logRenderInfo(o);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(i){this.logger.error("❌ afterRender hook error in "+this.l.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(o){const t=performance.now()-e;this.logger.error("❌ Component render error in "+this.l.tagName,o),this.captureComponentError(o,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.l.type,message:o instanceof Error?o.message:String(o)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,o,"render")}catch(r){this.logger.error("❌ onError hook error in "+this.l.tagName,r)}}}logRenderInfo(t){const n=this.l.type,e=this.l.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+n+" </"+e+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+e+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:n,tagName:e,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+e+":performance",component:{type:n,tagName:e,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.l.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,n,e){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.l.tagName+":"+n,component:{type:this.l.type,tagName:this.l.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.l.useShadowDom}})}catch(i){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const e of n)this.classList.toggle(e)}addHostAttribute(t,n){t&&"string"==typeof t&&n&&"string"==typeof n&&(this.setAttribute(t,String(n)),this.hostAttributes[t]=String(n))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[n,e]of Object.entries(t))n&&"string"==typeof n&&e&&"string"==typeof e&&this.setAttribute(n,String(e))}get params(){return this.o}get config(){return this.themeProvider.getComponentConfig(this.l.type)}get elementConfig(){return this.l}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,n){return this.store.set(t,n)}watchStore(t,n){const e=this.store.watch(t,n);return this.unsubscribers.push(e),e}}const createAddToCartButton=({isPresale:t,hasAvailability:n,state:e,disabled:i=![],borderRadius:o,hasAddress:r,onClick:s})=>{const a=document.createElement("button");return a.type="button",a.className="plc__button "+o,a.disabled=r&&(i||!n),a.textContent=t?"Pre Order":r?n?"Add to Cart":"Not Available In "+e.toUpperCase():"Buy Now",s&&a.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await s(t)}),a},createFulfillmentSection=t=>{const{shippingVariants:n,onDemandVariants:e,enableShippingFulfillment:i,enableOnDemandFulfillment:o,productId:r,onDeliveryOptionsClick:s}=t,a=Object.values(n),c=Object.values(e),l=(i?a.length:0)+(o?c.length:0),d=document.createElement("button");return d.className="plc__fulfillment-delivery",d.textContent="Delivery Options ("+l+")",d.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),0!==l&&await s(r)}),d},createQuantitySelector=({initialQuantity:t,minQuantity:n,maxQuantity:e,cornerRadius:i,cardStyle:o,onChange:r})=>{let s=t;const a=document.createElement("div");a.className="plc__quantity-container";const c=document.createElement("button");c.type="button",c.className="quantity-decrease "+i+" "+o,c.textContent="-",c.setAttribute("aria-label","Decrease quantity");const l=document.createElement("span");l.className="quantity-text "+o,l.textContent=s.toString(),l.setAttribute("aria-live","polite"),l.setAttribute("aria-atomic","true");const d=document.createElement("button");d.type="button",d.className="quantity-increase "+i+" "+o,d.textContent="+",d.setAttribute("aria-label","Increase quantity");const w=t=>{const i=t>n,o=t<e;i?(c.disabled=![],c.classList.remove("disabled")):(c.disabled=!![],c.classList.add("disabled")),o?(d.disabled=![],d.classList.remove("disabled")):(d.disabled=!![],d.classList.add("disabled"))},N=t=>{s=Math.max(n,Math.min(e,t)),l.textContent=s.toString(),w(s),null==r||r(s)},U=t=>{t.preventDefault(),t.stopPropagation(),s>n&&N(s-1)},P=t=>{t.preventDefault(),t.stopPropagation(),s<e&&N(s+1)};return c.addEventListener("click",U),d.addEventListener("click",P),w(s),a.appendChild(c),a.appendChild(l),a.appendChild(d),a},ArrowRightIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:n=24,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 489 489" class="bag-icon '+e+'" style="'+o+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckIcon=({width:t=12,height:n=12,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M11.8047 0.195262C12.0651 0.455612 12.0651 0.877722 11.8047 1.13807L4.4714 8.4714C4.21106 8.73175 3.78894 8.73175 3.5286 8.4714L0.195262 5.13807C-0.0650874 4.87772 -0.0650874 4.45561 0.195262 4.19526C0.455612 3.93491 0.877722 3.93491 1.13807 4.19526L4 7.05719L10.8619 0.195262C11.1223 -0.0650874 11.5444 -0.0650874 11.8047 0.195262Z" fill="#18181B"/>\n </svg>\n '},CheckboxIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+e+'" style="'+o+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+e+'" style="'+o+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="search-icon '+e+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+o+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+e+'" style="'+o+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '},createProductSizesList=({sizes:t,selectedSize:n,cornerRadius:e,onSelect:i})=>{let o=n;const r=document.createElement("div");r.className="plc__dropdown-size-wrapper "+e;const s=document.createElement("button");s.type="button",s.className="plc__dropdown-default-size-wrapper";const a=document.createElement("span");a.className="plc__dropdown-size-text",a.textContent=o.size;const c=document.createElement("span");c.className="plc__dropdown-chevron",c.innerHTML=ChevronDownIcon({className:"chevron-down-icon"}),c.style.display="none";const l=document.createElement("span");l.className="plc__dropdown-check",l.innerHTML=CheckIcon({className:"check-icon"}),s.appendChild(a),s.appendChild(c),s.appendChild(l),r.appendChild(s);const d=Object.values(t);if(d.length<=1)return s.setAttribute("aria-haspopup","false"),s.setAttribute("aria-expanded","false"),s.disabled=!![],c.style.display="none",l.style.display="flex",r;s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-expanded","false");const m=document.createElement("div");m.className="plc__sizes-list "+e,m.setAttribute("role","listbox");const p=()=>{r.classList.remove("expanded"),s.setAttribute("aria-expanded","false"),c.style.display="none",l.style.display="flex"},openDropdown=()=>{r.classList.add("expanded"),s.setAttribute("aria-expanded","true"),c.style.display="flex",l.style.display="none"},w=()=>r.classList.contains("expanded"),N=()=>{m.innerHTML="",d.forEach(t=>{const n=document.createElement("div");n.className="plc__size-option",n.setAttribute("role","option");const e=(null==o?void 0:o.id)===t.id;n.setAttribute("aria-selected",String(e));const r=document.createElement("span");if(r.className="plc__size-option-text",r.textContent=t.size,n.appendChild(r),e){const t=document.createElement("span");t.className="plc__size-option-check",t.innerHTML=CheckIcon({width:16,height:16,className:"check-icon"}),n.appendChild(t)}n.addEventListener("click",n=>{n.stopPropagation(),o=t,a.textContent=t.size,null==i||i(t),N(),p()}),m.appendChild(n)})};N(),r.appendChild(m),s.addEventListener("click",t=>{t.stopPropagation(),w()?p():openDropdown()});const U=t=>{const n=t.target;n&&(r.contains(n)||p())};return document.addEventListener("click",U),r};class ProductListCardComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress","productsList.userProducts"]}),this.selectedSize=null}get hostClasses(){return["product-list-card",this.config.layout.productCard.cornerRadius,""+this.config.layout.productCard.style]}async connected(){const t=this.params.product.salsifyGrouping||this.params.product.id||"";this.unsubscribeFromState=this.commands.productList.subscribe(n=>{var e,i;const o=n.userProducts[t];if(!o)return;const r=o.selectedFulfillment,s=o.selectedFulfillmentType;if(o){const t=Object.values(this.params.product.sizes).find(t=>t.id===o.selectedSizeId);t&&(null===(e=this.selectedSize)||void 0===e?void 0:e.id)!==t.id&&(this.selectedSize=t)}(r||s)&&this.reRender(),(null===(i=o.modal)||void 0===i?void 0:i.isOpen)&&this.reRender()})}disconnected(){this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0)}reRender(){const elements=this.template();this.innerHTML="";const t=document.createDocumentFragment();for(const n of elements)t.appendChild(n);this.appendChild(t)}getAvailabilityData(t){var n;const e=this.params.product,i=this.getStoreValue("address.address"),o={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==i?void 0:i.state)||"",isPresale:![],isPresaleActive:![]},r=t||Object.values(e.sizes)[0];if(!r)return o;const s=Object.values(r.shippingFulfillments||{}),a=s[0],c=null==a?void 0:a.variant;if(!c)return o;o.upc=r.upc;const l=r.attributes||{};return o.isPresale=(null===(n=l.presale)||void 0===n?void 0:n.isActive)===!![],o.isPresaleActive=this.isPresaleActive(l),this.params.shippingFulfillment&&c.shippingFulfillmentId===this.params.shippingFulfillment.id&&c.stock>0?(o.hasAvailability=!![],o.fulfillmentId=this.params.shippingFulfillment.id,o.partNumber=c.partNumber):this.params.onDemandFulfillment&&c.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&c.stock>0&&(o.hasAvailability=!![],o.fulfillmentId=this.params.onDemandFulfillment.id,o.partNumber=c.partNumber),o}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n||!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),e=new Date;if(e.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){var n,e,i;if(!t.hasAvailability)return;const o=this.params.product.salsifyGrouping||this.params.product.id||"",r=this.getStoreValue("productsList"),s=null===(n=r.userProducts[o])||void 0===n?void 0:n.selectedFulfillment,a=(null===(e=r.userProducts[o])||void 0===e?void 0:e.selectedQuantity)||1,c=(null==s?void 0:s.id)||t.fulfillmentId,l=(null===(i=null==s?void 0:s.variant)||void 0===i?void 0:i.partNumber)||t.partNumber;t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:c,partNumber:l,quantity:a,identifier:o}):await this.commands.productList.addToCart({fulfillmentId:c,partNumber:l,quantity:a,identifier:o}),this.commands.productList.updateQuantity(o,1)}template(){var t,n,e,i,o,r,s,a,c;const l=this.params.product,d=this.params.product.salsifyGrouping||this.params.product.id||"",m=this.getStoreValue("productsList"),g=null===(t=m.userProducts[d])||void 0===t?void 0:t.selectedSizeId,v=g?Object.values(l.sizes).find(t=>t.id===g):this.selectedSize||Object.values(l.sizes)[0];this.selectedSize=v||Object.values(l.sizes)[0];const y=null===(n=m.userProducts[d])||void 0===n?void 0:n.selectedFulfillment,b=(null===(e=m.userProducts[d])||void 0===e?void 0:e.selectedQuantity)||1,k=(null==y?void 0:y.image)||(null===(i=this.selectedSize)||void 0===i?void 0:i.image),E=l.name,_=this.selectedSize?this.selectedSize.size:null;let F=l.noAvailabilityPrice;if(null===(o=null==y?void 0:y.variant)||void 0===o?void 0:o.price)F=y.variant.price;else{const t=Object.values((null===(r=this.selectedSize)||void 0===r?void 0:r.shippingFulfillments)||{});F=null!==(a=null===(s=t[0])||void 0===s?void 0:s.variant.price)&&void 0!==a?a:l.noAvailabilityPrice}const D=F*b,T=this.getAvailabilityData(this.selectedSize),A=(null==y?void 0:y.variant.isEngravable)||![],O=l.sizes,z=null===(c=this.selectedSize)||void 0===c?void 0:c.maxQuantityPerOrder,elements=this.createVariantStandard({image:k,name:E,size:_,price:D,availability:T,hasPersonalization:A,sizes:O,maxQuantityPerOrder:z,shippingVariants:{},onDemandVariants:{}});return elements}generateProductUrl(){if(!this.params.productUrl)return null;const t=this.params.product,n=this.selectedSize||Object.values(t.sizes)[0],e=this.params.productUrl;if(e.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?e.replace("{upc}",t):null}if(e.includes("{grouping}")){const n=t.salsifyGrouping||"";return n?e.replace("{grouping}",n):null}return e}createVariantStandard(t){const{image:n,name:e,price:i,availability:o,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a}=t,c=this.params.product.salsifyGrouping||this.params.product.id||"",l=this.generateProductUrl();return[this.createImageSection(n,e,o,l),this.createContentSection({name:e,price:i,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a,availability:o,productId:c,productUrl:l})]}createImageSection(t,n,e,i){const o=document.createElement("div");o.className="plc__image-content";const r=document.createElement("div");r.className="plc__image-wrapper";const s=document.createElement("img");if(s.className="plc__image",s.src=t,s.alt=n,s.loading="lazy",r.appendChild(s),e.isPresale){const t=document.createElement("div");t.className="plc__presale-badge "+this.config.layout.productCard.cornerRadius,t.textContent="Pre-Order",r.appendChild(t)}if(o.appendChild(r),i){const t=document.createElement("a");return t.href=i,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(o),t}return o}createContentSection(t){const n=this.getStoreValue("address.formattedAddress"),e=!!(n&&n.trim().length>0),i=document.createElement("div");i.className="plc__content",this.config.layout.productCard.showCollections&&e&&i.appendChild(this.createBadgesSection()),i.appendChild(this.createTitleSection(t.name,t.productUrl));const o=this.createPricePersonalizationSection(t.price,t.hasPersonalization,e);return o&&i.appendChild(o),this.config.layout.productCard.showSizeSelector&&e&&i.appendChild(this.createSizesSection(t.sizes)),(this.config.layout.productCard.showFulfillment||this.config.layout.productCard.showRetailerName)&&e&&i.appendChild(this.createFulfillmentSectionWrapper(t.productId,e)),i.appendChild(this.createAddToCartSection(t.availability,t.maxQuantityPerOrder,e)),i}createBadgesSection(){const t=document.createElement("div");t.className="plc__badges-wrapper";const n=document.createElement("span");n.className="plc__badge-text",n.textContent="First Bottle Free",t.appendChild(n);const e=document.createElement("span");e.textContent="•",t.appendChild(e);const i=document.createElement("span");return i.className="plc__badge-text",i.textContent="Same-Day Delivery",t.appendChild(i),t}createTitleSection(t,n){const e=document.createElement("h3");if(e.className="plc__title",e.textContent=t,n){const t=document.createElement("a");return t.href=n,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(e),t}return e}createPricePersonalizationSection(t,n,e){const o=this.config.layout.productCard.showPrice,r=this.config.layout.productCard.enablePersonalization&&n;if(!o&&!r)return null;const s=document.createElement("div");if(s.className="plc__price-personalization-wrapper",o){const n=document.createElement("span");n.className="plc__price",n.textContent=formatCentToDollarText(t),s.appendChild(n)}if(r&&e){const t=document.createElement("span");t.className="plc__personalize",t.textContent="Personalize Bottle",s.appendChild(t),t.addEventListener("click",()=>{var t,n,e,o,r,s,a,c,l,d,m,v,y,b,k,E;const _=window.innerWidth;_>=g?this.commands.ui.openModal(i.PRODUCT_LIST_ENGRAVING_FORM,{identifier:this.params.product.salsifyGrouping||this.params.product.id,context:"product-list",lines:[],maxLines:(null===(n=null===(t=this.selectedSize)||void 0===t?void 0:t.attributes.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(o=null===(e=this.selectedSize)||void 0===e?void 0:e.attributes.engraving)||void 0===o?void 0:o.maxCharsPerLine)||16,fee:(null===(s=null===(r=this.selectedSize)||void 0===r?void 0:r.attributes.engraving)||void 0===s?void 0:s.fee)||0,location:null===(c=null===(a=this.selectedSize)||void 0===a?void 0:a.attributes.engraving)||void 0===c?void 0:c.location}):this.commands.ui.openDrawer(i.PRODUCT_LIST_ENGRAVING_FORM,{identifier:this.params.product.salsifyGrouping||this.params.product.id,context:"product-list",lines:[],maxLines:(null===(d=null===(l=this.selectedSize)||void 0===l?void 0:l.attributes.engraving)||void 0===d?void 0:d.maxLines)||1,maxCharsPerLine:(null===(v=null===(m=this.selectedSize)||void 0===m?void 0:m.attributes.engraving)||void 0===v?void 0:v.maxCharsPerLine)||16,fee:(null===(b=null===(y=this.selectedSize)||void 0===y?void 0:y.attributes.engraving)||void 0===b?void 0:b.fee)||0,location:null===(E=null===(k=this.selectedSize)||void 0===k?void 0:k.attributes.engraving)||void 0===E?void 0:E.location})})}return s}createSizesSection(t){return createProductSizesList({sizes:t,selectedSize:this.selectedSize||Object.values(t)[0],cornerRadius:this.config.layout.productCard.cornerRadius,onSelect:t=>{this.selectedSize=t;const n=this.params.product.salsifyGrouping||this.params.product.id||"";this.commands.productList.selectSize(n,t.id),this.reRender()}})}handleDeliveryOptionsClick(t){const n=window.innerWidth;n>=g?this.commands.ui.openModal(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config}):this.commands.ui.openDrawer(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config})}createFulfillmentSectionWrapper(t,n){var e,i;const o=this.getStoreValue("productsList"),r=this.params.product,s=this.selectedSize||Object.values(r.sizes)[0],a=o.userProducts[t].selectedFulfillmentType,c=(null===(i=null===(e=o.userProducts[t])||void 0===e?void 0:e.selectedFulfillment)||void 0===i?void 0:i.retailerName)||"",l=document.createElement("div");if(l.className="plc__fulfillment-wrapper",this.config.layout.productCard.showRetailerName&&n){const t=this.createFulfillmentTextSection(a,c);l.appendChild(t)}if(this.config.layout.productCard.showFulfillment&&n){const n=createFulfillmentSection({shippingVariants:(null==s?void 0:s.shippingFulfillments)||{},onDemandVariants:(null==s?void 0:s.onDemandFulfillments)||{},enableShippingFulfillment:this.config.layout.productCard.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.productCard.enableOnDemandFulfillment,productId:t,onDeliveryOptionsClick:t=>this.handleDeliveryOptionsClick(t)});l.appendChild(n)}return l}createFulfillmentTextSection(t,n){const e=document.createElement("span");return e.className="plc__fulfillment-text",e.textContent=t===o.SHIPPING?"Ships from: "+n:"Delivered from: "+n,e}createAddToCartSection(t,n,e){var o;const r=this.getStoreValue("productsList"),s=document.createElement("div");s.className="plc__add-to-cart-wrapper";const a=this.params.product.salsifyGrouping||this.params.product.id||"",c=(null===(o=r.userProducts[a])||void 0===o?void 0:o.selectedQuantity)||1;this.config.layout.productCard.showQuantityCounter&&e&&s.appendChild(createQuantitySelector({initialQuantity:c,minQuantity:1,maxQuantity:n,cornerRadius:this.config.layout.productCard.cornerRadius,cardStyle:this.config.layout.productCard.style,onChange:t=>this.commands.productList.updateQuantity(a,t)}));const l=createAddToCartButton({isPresale:t.isPresale,hasAvailability:t.hasAvailability,state:t.state,borderRadius:this.config.layout.productCard.cornerRadius,hasAddress:e,onClick:async()=>{e?await this.handleAddToCart(t):this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]})}});return t.hasAvailability||this.addHostClasses("not-available"),s.appendChild(l),s}}class ModalComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.modal"]}),this.isOpen=![],this.wrapperElement=null,this.modalElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var n;const e=t.find(t=>"ui.modal"===t.path),i=null==e?void 0:e.value,o=i.isOpen,r=null===(n=i.contentConfig)||void 0===n?void 0:n.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Modal opening attempted without content configuration"),void 0;const{type:n,data:e}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...e}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateModalContentTypeClass(n),this.open(),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Modal content loading failed",n),this.commands.ui.closeModal()}}open(){this.isOpen=!![],this.updateModalState()}close(){this.isOpen=![],this.updateModalState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(t){t.target===this.backdropElement&&this.commands.ui.closeModal()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeModal()}updateModalContentTypeClass(t){if(!this.modalElement)return;const n=["modal"];this.isOpen&&n.push("open"),n.push(t.toString().toLowerCase()),this.modalElement.className=n.join(" ")}updateModalState(){this.wrapperElement&&this.modalElement&&this.backdropElement&&(this.isOpen?(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),this.modalElement.classList.add("open"),document.body.style.overflow="hidden",this.currentContentType&&this.updateModalContentTypeClass(this.currentContentType)):(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),this.modalElement.classList.remove("open"),document.body.style.overflow="",this.modalElement.className="modal"))}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("modal-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("modal-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.modalElement=document.createElement("div"),this.modalElement.classList.add("modal"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("modal-content"),this.modalElement.appendChild(this.contentContainer),this.wrapperElement.appendChild(this.backdropElement),this.wrapperElement.appendChild(this.modalElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+m.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+m.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+m.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+m.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n min-width: 226px;\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+m.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n\n @media (max-width: 639px) {\n .product-list-card-loading__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .slc__card {\n width: 100%;\n flex: 0 0 100%;\n max-width: 336px;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-card-loading__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .slc__card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-card-loading__container {\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .slc__card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-card-loading__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n";function getModalStyles(){return"\n .modal-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+m.MODAL+";\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n }\n\n .modal-wrapper.open {\n pointer-events: auto;\n }\n\n .modal-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n visibility: hidden;\n transition: opacity 150ms ease-out, visibility 150ms ease-out;\n }\n\n .modal-backdrop.visible {\n opacity: 1;\n visibility: visible;\n }\n\n .modal {\n position: relative;\n max-width: 512px;\n max-height: 576px;\n width: 100%;\n height: 100%;\n background: transparent;\n opacity: 0;\n transform: scale(0.95);\n transition: opacity 150ms ease-out, transform 150ms ease-out;\n z-index: 1; /* Higher than backdrop within the wrapper context */\n }\n\n .modal.open {\n opacity: 1;\n transform: scale(1);\n }\n\n .modal-content {\n position: relative;\n max-width: 512px;\n max-height: 576px;\n width: 100%;\n box-sizing: border-box;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n padding: 16px;\n overflow-y: auto;\n }\n\n @media (max-width: 576px) {\n .modal-wrapper {\n padding: 8px;\n }\n\n .modal {\n max-width: 100%;\n }\n\n .modal-content {\n max-height: calc(100vh - 16px);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .modal,\n .modal-backdrop {\n transition: none;\n }\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+m.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n';X.register("global",getGlobalStyles,0),X.register("ui",getDrawerStyles,1),X.register("ui",getProductLoadingStyles,2),X.register("ui",getProductListCardLoadingStyles,3),X.register("ui",getPromoCodeTickerStyles,4),X.register("ui",getModalStyles,5);const getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+m.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+m.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+m.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n";X.register("address",getAddressStyles,10);const getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+m.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+m.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+m.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+m.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n";X.register("cart",getCartStyles,10);const getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+m.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+m.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+m.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+m.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n /* Hosted checkout header - non-sticky */\n .checkout-header-wrapper.hosted {\n position: relative;\n background-color: transparent;\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Spacer to maintain layout balance when close button is hidden */\n .checkout-header-spacer {\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+m.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ';X.register("checkout",getCheckoutStyles,10);const getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+m.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+m.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+m.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";X.register("product",getProductStyles,10),X.register("product",getImageCarouselStyle,11),X.register("product",getAddressStyles,12),X.register("product",getProductRetailersStyles,13);const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+m.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card {\n width: 100%;\n flex: 0 0 100%;\n max-width: 336px;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getProductListCardStyles=()=>"\n /* Product List Card Styles */\n .product-list-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-height: 400px;\n min-width: 226px;\n height: 100%;\n padding: 8px;\n border: 1px solid var(--accent-color, #E4E4E7);\n background: var(--product-list-background-color, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n cursor: pointer;\n overflow: hidden;\n position: relative;\n }\n\n .product-list-card.rounded {\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-list-card.sharp {\n border-radius: 0px;\n }\n\n .product-list-card.card {\n background: var(--product-list-background-color, #FAFAFA);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .product-list-card.ghost {\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n .product-list-card.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n position: relative;\n }\n\n .product-list-card .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-card .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n /* Pre-Order Badge Styles */\n .plc__presale-badge {\n position: absolute;\n top: 16px;\n left: 16px;\n padding: 4px 12px;\n background-color: #18181B;\n color: #FFFFFF;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n z-index: 10;\n text-transform: capitalize;\n letter-spacing: 0.5px;\n }\n\n .plc__presale-badge.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__presale-badge.sharp {\n border-radius: 0px;\n }\n\n .plc__content {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n padding-top: 16px;\n }\n\n .plc__badges-wrapper {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n gap: 8px;\n line-height: 14px;\n }\n\n .plc__badge-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\n }\n\n .plc__content .plc__title {\n width: 100%;\n font-size: 24px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 70px;\n }\n\n .plc__price-personalization-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: nowrap;\n gap: 8px;\n }\n\n .plc__price {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 24px;\n }\n\n .plc__personalize {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n }\n\n .plc__dropdown-size-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #E4E4E7);\n background: var(--product-list-background-color, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n overflow: visible;\n position: relative;\n }\n\n .plc__dropdown-size-wrapper.rounded {\n border-radius: var(--card-border-radius, 6px);\n }\n\n .plc__dropdown-size-wrapper.sharp {\n border-radius: 0px;\n }\n\n .plc__dropdown-default-size-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n background: none;\n border: none;\n padding: 4px 8px;\n cursor: pointer;\n transition: opacity 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .plc__dropdown-size-wrapper.expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n }\n\n .plc__dropdown-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-chevron svg {\n display: block;\n }\n\n .plc__dropdown-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-check svg {\n display: block;\n }\n\n .plc__sizes-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease;\n background: var(--product-list-background-color, #FFFFFF);\n border: 1px solid var(--accent-color, #E4E4E7);\n border-top: none;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n z-index: 1000;\n }\n\n .plc__sizes-list.rounded {\n border-bottom-left-radius: var(--border-radius-rounded, 6px);\n border-bottom-right-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__sizes-list.sharp {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-wrapper.expanded .plc__sizes-list {\n max-height: 200px;\n opacity: 1;\n overflow-y: auto;\n }\n\n .plc__size-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 8px;\n background: var(--product-list-background-color, #FFFFFF);\n border: none;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .plc__size-option:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .plc__size-option:hover .plc__size-option-text {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option:hover .plc__size-option-check svg {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n transition: color 0.2s ease;\n }\n\n .plc__size-option-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: color 0.2s ease;\n width: 12px;\n }\n\n .plc__size-option-check svg {\n display: block;\n }\n\n .plc__fulfillment-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n align-self: stretch;\n }\n\n .plc__fulfillment-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 48px;\n }\n\n .plc__fulfillment-delivery {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__add-to-cart-wrapper {\n display: flex;\n align-items: center;\n align-content: flex-start;\n gap: 8px;\n align-self: stretch;\n flex-wrap: nowrap;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n display: flex;\n min-width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n user-select: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text.ghost {\n border: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n display: flex;\n width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n background: transparent;\n border: 1px solid var(--accent-color, #E4E4E7);\n transition: background-color 0.15s ease, opacity 0.15s ease;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease {\n border-right: 1px solid var(--accent-color, #E4E4E7); \n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n border-left: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.disabled,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.rounded {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.rounded {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n \n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.ghost,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.ghost {\n border: none;\n }\n\n .product-list-card .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n height: 36px;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n font-family: var(--paragraph-font-family, Poppins);\n padding: 0 0.75rem;\n border: none;\n cursor: pointer;\n transition-property: background-color, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button.rounded {\n border-radius: var(--button-border-radius, 6px);\n }\n\n .plc__button.sharp {\n border-radius: 0px;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .plc__button:active {\n transform: translateY(1px);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Retailers Popup Styles */\n .retailers-popup-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .drawer-wrapper.open .retailers-popup-wrapper{\n padding: 16px;\n }\n\n .retailers-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .retailers-popup-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .retailers-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n .retailers-popup-no-data {\n padding: 24px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .popup-fulfillment-list-container {\n margin-top: 16px;\n max-height: 100% !important;\n }\n\n /* Engraving Options Popup Styles */\n .engraving-popup-wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .drawer-wrapper.open .engraving-popup-wrapper{\n padding: 16px;\n }\n\n .engraving-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .engraving-popup-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .engraving-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n /* Prevent background scroll when dialog is active */\n body:has(dialog[open]) {\n overflow: hidden;\n }\n",getProductListFiltersStyles=()=>"\n /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+m.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n }\n";X.register("product-list",getProductListStyles,10),X.register("product-list",getProductListCardStyles,11),X.register("product-list",getProductListFiltersStyles,12),X.register("product-list",getProductRetailersStyles,13);class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,n)=>t||n&&n.status>=500&&n.status<600?!![]:![],this.xhrFetch=(t,n)=>new Promise((e,i)=>{const o=new XMLHttpRequest;o.open(n.method||"GET",t);for(const[t,r]of Object.entries(n.headers))o.setRequestHeader(t,r);o.onload=()=>{const t={ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,n)=>{const[e,i]=n.split(": ");return e&&i&&(t[e]=i),t},{}),h:o.responseText,json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)};e(t)},o.onerror=()=>{i(new TypeError("Network request failed"))},o.ontimeout=()=>{i(new TypeError("Network request timed out"))},o.timeout=3e4,o.send(n.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var n,e,i;const{url:o,options:r,retryConfig:s}=t,a=null!==(n=null==s?void 0:s.maxRetries)&&void 0!==n?n:3,c=null!==(e=null==s?void 0:s.retryDelay)&&void 0!==e?e:1e3,l=null!==(i=null==s?void 0:s.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let d;const m=Date.now();for(let v=0;v<=a;v++){let t=Date.now();try{t=Date.now();const n=await this.fetchImpl(o,r),e=Date.now()-t;if(n.ok)return n;if(await this.logFailedResponse(o,r,n,e,v,a),v<a&&l(null,n)){await this.delay(c*2**v);continue}return n}catch(g){const n=Date.now()-t;if(d=g,this.logNetworkError(o,r,g,n,v,a),v<a&&l(g,void 0)){await this.delay(c*2**v);continue}throw this.enhanceError(g,o,r,Date.now()-m)}}throw this.enhanceError(d,o,r,Date.now()-m)}async logFailedResponse(t,n,e,i,o,r){const s=o<r;let a,c;try{e.h||(e.h=await e.text());try{a=JSON.parse(e.h)}catch(l){a=e.h}}catch(d){a="[Unable to read response body]"}if(n.body)try{c=JSON.parse(n.body)}catch(m){c=n.body}this.logger.error("HTTP request failed",{method:n.method,url:t,status:e.status,statusText:e.statusText,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:s,requestHeaders:n.headers,requestBody:c,responseHeaders:e.headers,responseBody:a})}logNetworkError(t,n,e,i,o,r){var s;const a=o<r;this.logger.error("Network request failed",{method:n.method,url:t,error:e,errorType:(null===(s=null==e?void 0:e.constructor)||void 0===s?void 0:s.name)||typeof e,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:a,possibleCauses:this.diagnosePossibleCauses(e)})}diagnosePossibleCauses(t){var n,e,i,o,r;const s=[];return((null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timeout"))||(null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timed out")))&&s.push("Request timeout - server took too long to respond"),((null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("Failed to fetch"))||(null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Network request failed")))&&(s.push("Network connectivity issue"),s.push("CORS policy blocking the request"),s.push("Server is not responding"),s.push("Request was blocked by browser or firewall")),(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("aborted"))&&s.push("Request was aborted"),0===s.length&&s.push("Unknown network error"),s}enhanceError(t,n,e,i){const o=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return o.url=n,o.method=e.method,o.totalDuration=i+"ms",o.isNetworkError=!![],o.originalError=t,o.possibleCauses=this.diagnosePossibleCauses(t),o}delay(t){return new Promise(n=>setTimeout(n,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(n,e)=>{var i;const o=await t(n,e);let r;if("function"==typeof(null===(i=o.headers)||void 0===i?void 0:i.entries))r=Object.fromEntries(o.headers.entries());else{r={};for(const[t,n]of o.headers)r[t]=n}const s={ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:async()=>(s.h||(s.h=await o.text()),JSON.parse(s.h)),text:async()=>(s.h||(s.h=await o.text()),s.h)};return s}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(t,n)=>t?!![]:n&&this.isAuthError(n)?![]:n&&n.status>=500&&n.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticateAndGetConfigs(){var t,n,e,i,o,r,s,a,c;try{this.logger.info("Authenticating and fetching configurations in single request");const l=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(n=null===(t=null==l?void 0:l.data)||void 0===t?void 0:t.auth)||void 0===n?void 0:n.accessToken)&&(null===(i=null===(e=null==l?void 0:l.data)||void 0===e?void 0:e.auth)||void 0===i?void 0:i.expiration)?(null===(c=null==l?void 0:l.data)||void 0===c?void 0:c.configs)?(this.accessToken=l.data.auth.accessToken,this.tokenExpiration=l.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:{...l.data.configs,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showRetailerName:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==l?void 0:l.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(r=null===(o=null==l?void 0:l.data)||void 0===o?void 0:o.auth)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(a=null===(s=null==l?void 0:l.data)||void 0===s?void 0:s.auth)||void 0===a?void 0:a.expiration),response:null==l?void 0:l.data}),{success:![]})}catch(l){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:l,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(t,n){return this.request(t,{method:"GET",headers:null==n?void 0:n.headers})}async post(t,n){return this.request(t,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async performAuthentication(){var t,n,e,i;try{const o=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:o,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,n,e,i;try{this.logger.info("Attempting to refresh access token");const o=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:o,status:null==o?void 0:o.status,endpoint:"/auth/refresh"}),![]}}async request(t,n,e=![],i=![]){if(!e&&!i&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const o=this.buildUrl(t),r=this.buildHeaders(n.headers,e),s=await this.httpClient.request({url:o,options:{method:n.method,headers:r,body:n.body?JSON.stringify(n.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return s.ok?this.handleSuccessResponse(s,t,n.method):!this.isAuthError(s)||e||i?this.handleErrorResponse(s):this.handleAuthError(s,t,n)}async handleSuccessResponse(t,n,e){try{return await t.json()}catch(i){const o=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:n,method:e,status:t.status,responsePreview:o.substring(0,1e3),error:i}),{message:o}}}async handleAuthError(t,n,e){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:n,method:e.method});let i=await this.refreshToken();return i||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),i=await this.authenticate()),i?this.request(n,e,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:n,method:e.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let n;try{n=await t.json()}catch(e){const i=await t.text().catch(()=>"HTTP error status: "+t.status);n={message:i||"Unknown error"}}throw{...n,status:t.status,message:(null==n?void 0:n.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(t){const n=this.clientConfig.getProxyConfig();return new URL("api"+t,n?n.baseUrl:this.baseUrl).toString()}buildHeaders(t,n=![]){const e={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return n?e["X-Liquid-Api-Key"]=this.apiKey:e.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(e["X-Liquid-Api-Builder"]="true"),e}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;class BaseActionService{constructor(t){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get(t)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}class ClientAddressActionService extends BaseActionService{constructor(){super("AddressAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientAddressActionService",()=>new ClientAddressActionService)}get actions(){return{setAddressByPlacesId:this.setAddressByPlacesId.bind(this),setAddressManually:this.setAddressManually.bind(this),clear:this.clear.bind(this),getDetails:this.getDetails.bind(this)}}async setAddressByPlacesId(t){try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const n=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:n.address,coordinates:n.coordinates,formattedAddress:n.formattedAddress})}catch(n){throw this.logger.error("Error setting address by placesId:",n),n}}async setAddressManually(t,n){try{if(!t||!n)throw new SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof n.latitude||"number"!=typeof n.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof n.latitude+", long: "+typeof n.longitude,!![]);if(n.latitude<-90||n.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+n.latitude,!![]);if(n.longitude<-180||n.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+n.longitude,!![]);await this.command.address.setAddressManually(t,n)}catch(e){throw this.logger.error("Error setting manual address:",e),e}}async clear(){await this.command.address.clearSelectedAddress()}getDetails(){return this.command.address.getDetails()}}class ClientCartActionService extends BaseActionService{constructor(){super("CartAction"),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.command=CommandService.getInstance(),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientCartActionService",()=>new ClientCartActionService)}get actions(){return{openCart:this.openCart.bind(this),closeCart:this.closeCart.bind(this),toggleCart:this.toggleCart.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),resetCart:this.resetCart.bind(this),getDetails:this.getDetails.bind(this)}}setupAddressUpdateListener(){const x=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,x)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,n=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.addProduct(t,n)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}openCart(){this.command.ui.openDrawer(i.CART)}closeCart(){this.command.ui.closeDrawer()}toggleCart(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CART)}async addProduct(t,e){var r,s;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const n of t){if(!n.identifier||"string"!=typeof n.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(n.fulfillmentType||(n.fulfillmentType=o.SHIPPING),n.quantity&&"number"==typeof n.quantity||(n.quantity=1),n.fulfillmentType!==o.SHIPPING&&n.fulfillmentType!==o.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+n.fulfillmentType+'" for product "'+n.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(n.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+n.identifier+'"',!![])}const a=this.getLocation();if(void 0===a)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(i.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(i.CART);const c=[...new Set(t.map(t=>t.identifier))],l=await this.api.getProductsData(c,a);if(!l||!l.products||0===l.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const n of t){let t=null;for(let o=0;o<l.products.length;o++){const e=l.products[o];let i=![];const r=Object.values(e.sizes);for(let t=0;t<r.length;t++){const o=r[t];if(o.upc===n.identifier||o.id===n.identifier||e.salsifyGrouping===n.identifier){i=!![];break}}if(i){t=e;break}}if(!t){this.logger.warn("No product found for identifier: "+n.identifier);continue}const e=Object.values(t.sizes)[0];if(!e){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(s=null===(r=null==e?void 0:e.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+n.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let i=null;const a=n.fulfillmentType===o.SHIPPING?e.shippingVariants:e.onDemandVariants,c=Object.values(a);for(let n=0;n<c.length;n++)if(c[n]){i=c[n];break}if(!i){this.logger.warn("No supported variant found for product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const d=n.fulfillmentType===o.ON_DEMAND?i.onDemandFulfillmentId:i.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:d,partNumber:i.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation();const d=this.store.get("cart.id");this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{cartId:d,itemsAdded:t.length,identifiers:c}),this.logger.info("Products added to cart successfully:",c)}catch(a){this.logger.error("Error adding products to cart:",a),this.clearPendingCartOperation();const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}}async applyPromoCode(t){try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const r=this.store.get("cart.promoCode");if(r&&r.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const s=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:s.cartId,discount:s.promoCodeDiscount||0,newSubtotal:s.subtotal}),this.logger.info("Promo code applied successfully")}catch(e){this.logger.error("Failed to apply promo code:",e);const t=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),e}}async removePromoCode(){try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:i.cartId,newSubtotal:i.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}}async resetCart(){await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])}getDetails(){return this.command.cart.getDetails()}}const _t="lce-checkout-stripe-slot",Pt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},It={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientCheckoutActionService extends BaseActionService{constructor(){super("CheckoutAction"),this.allowedCustomerFields=new Set(Object.values(Pt)),this.allowedBillingFields=new Set(Object.values(It)),this.allowedGiftFields=new Set(Object.values(Ft)),this.cartActionsAddProduct=null,this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientCheckoutActionService",()=>new ClientCheckoutActionService)}setCartActionsAddProduct(t){this.cartActionsAddProduct=t}get actions(){return{openCheckout:this.openCheckout.bind(this),closeCheckout:this.closeCheckout.bind(this),toggleCheckout:this.toggleCheckout.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),applyGiftCard:this.applyGiftCard.bind(this),removeGiftCard:this.removeGiftCard.bind(this),toggleIsGift:this.toggleIsGift.bind(this),toggleBillingSameAsShipping:this.toggleBillingSameAsShipping.bind(this),toggleMarketingPreferences:this.toggleMarketingPreferences.bind(this),updateCustomerInfo:this.updateCustomerInfo.bind(this),updateBillingInfo:this.updateBillingInfo.bind(this),updateGiftInfo:this.updateGiftInfo.bind(this),getDetails:this.getDetails.bind(this)}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}openCheckout(){this.command.ui.openDrawer(i.CHECKOUT)}closeCheckout(){this.command.ui.closeDrawer()}toggleCheckout(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)}async addProduct(t,e){var r;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const s=t.map(t=>t.identifier);if(this.cartActionsAddProduct)await this.cartActionsAddProduct(t);else for(const n of t){const t=this.getLocation();if(!t)throw new SDKError("Location is required to add products to checkout",!![]);const e=await this.api.getProductsData([n.identifier],t);if(!(null===(r=null==e?void 0:e.products)||void 0===r?void 0:r[0])){this.logger.warn("No product data found for identifier: "+n.identifier);continue}const i=e.products[0],s=Object.values(i.sizes)[0];if(!s)continue;const a=n.fulfillmentType===o.SHIPPING?s.shippingVariants:s.onDemandVariants,c=Object.values(a)[0];if(!c)continue;const l=n.fulfillmentType===o.ON_DEMAND?c.onDemandFulfillmentId:c.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:l,partNumber:c.partNumber,quantity:n.quantity,identifier:n.identifier})}await this.command.checkout.loadCheckout({});const a=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:a,itemsAdded:t.length,identifiers:s}),this.logger.info("Products added to checkout successfully:",s)}catch(s){this.logger.error("Error adding products to checkout:",s);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to checkout"}),s}}async applyPromoCode(t){var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const s=this.store.get("checkout.promoCode");if(s&&s.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const a=this.store.get("checkout"),c=a.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:a.cartId,discount:(null==c?void 0:c.discount)||0,newTotal:(null===(e=null==a?void 0:a.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){this.logger.error("Failed to apply checkout promo code:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),i}}async removePromoCode(){var t;try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:o.cartId,newTotal:(null===(t=null==o?void 0:o.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}}async applyGiftCard(t){var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){this.logger.error("Failed to apply gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),i}}async removeGiftCard(t){var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){this.logger.error("Failed to remove gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),i}}async toggleIsGift(t){await this.command.checkout.toggleIsGift(t)}async toggleBillingSameAsShipping(t){await this.command.checkout.toggleBillingSameAsShipping(t)}async toggleMarketingPreferences(t,n){await this.command.checkout.toggleMarketingPreferences(t,n)}updateCustomerInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t)){if(!this.allowedCustomerFields.has(e))continue;const t=this.normalizeCheckoutFieldValue(i);e===Pt.addressTwo?n["checkout.shippingAddress.address.two"]=t:n["checkout.customerForm.data."+e]=t}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(n)}updateBillingInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t))this.allowedBillingFields.has(e)&&(n["checkout.paymentForm.data."+e]=this.normalizeCheckoutFieldValue(i));if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(n)}updateGiftInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t)){if(!this.allowedGiftFields.has(e))continue;const t=this.normalizeCheckoutFieldValue(i);e===Ft.addressTwo?n["checkout.shippingAddress.address.two"]=t:n["checkout.giftRecipientForm.data."+e]=t}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(n)}getDetails(){return this.command.checkout.getDetails()}}class ClientProductActionService extends BaseActionService{constructor(){super("ProductAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientProductActionService",()=>new ClientProductActionService)}get actions(){return{getDetails:this.getDetails.bind(this)}}getDetails(t){if(!t||""===t.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(t)}catch(n){throw this.logger.error('Unable to retrieve product details for identifier "'+t+'"',n),new SDKError('Product "'+t+'" has not been loaded yet.',!![])}}}class ClientActionService{constructor(){this.productActionService=ClientProductActionService.getInstance(),this.addressActionService=ClientAddressActionService.getInstance(),this.cartActionService=ClientCartActionService.getInstance(),this.checkoutActionService=ClientCheckoutActionService.getInstance(),this.checkoutActionService.setCartActionsAddProduct(this.cartActionService.actions.addProduct)}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}get actions(){return{product:this.productActionService.actions,address:this.addressActionService.actions,cart:this.cartActionService.actions,checkout:this.checkoutActionService.actions}}}const Dt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",Tt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,n=t.instances;if(n)for(const[i,o]of n)this.interceptLoggerInstance(o,i);const e=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const n=e(t);return this.interceptLoggerInstance(n,t),n}}interceptLoggerInstance(t,n){if(t.u)return;const e=t.debug.bind(t),i=t.info.bind(t),o=t.warn.bind(t),r=t.error.bind(t),B=(t,e,i)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:e,data:i,context:n});t.debug=(t,n)=>{e(t,n),this.addLogEntry(B("debug",t,n))},t.info=(t,n)=>{i(t,n),this.addLogEntry(B("info",t,n))},t.warn=(t,n)=>{o(t,n),this.addLogEntry(B("warn",t,n))},t.error=(t,n)=>{r(t,n),this.addLogEntry(B("error",t,n))},t.u=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),n=t.publishAction.bind(t);t.publishAction=(t,e)=>{n(t,e),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:e,context:"PubSub"})};const e=t.publishForm.bind(t);t.publishForm=(t,n)=>{e(t,n),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:n,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),n=t.executeEvent.bind(t);t.executeEvent=(t,e,i)=>{n(t,e,i),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+e,data:i,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const n=this.createLogElement(t);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(Tt);t&&t.remove(),this.panelElement=document.createElement(Tt);const n=window.innerWidth<=768,e=window.innerWidth<=480;e?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=Dt,t.appendChild(n),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const e=this.createHeader();this.panelContainer.appendChild(e);const i=this.createToggles();this.panelContainer.appendChild(i),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const o=this.createResizeHandle();this.panelContainer.appendChild(o),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const e=document.createElement("div");e.className="title-container";const i=document.createElement("div");i.className="title",i.textContent="Elements Debug Console";const o=document.createElement("div");o.className="subtitle",o.textContent="Live SDK logs, events & GTM tracking",e.appendChild(i),e.appendChild(o);const r=document.createElement("button");return r.className="minimize",r.innerHTML="−",r.title="Minimize debug panel",r.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(n),t.appendChild(e),t.appendChild(r),t}createToggles(){const t=document.createElement("div");t.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:e,description:i,color:o})=>{const r=document.createElement("label");r.className="toggle",r.title=i;const s=document.createElement("input");s.type="checkbox",s.checked="showLogs"!==n,s.addEventListener("change",t=>{const e=t.target;"showEvents"===n&&(this.showEvents=e.checked),"showGtmEvents"===n&&(this.showGtmEvents=e.checked),"showLogs"===n&&(this.showLogs=e.checked),this.renderLogs()});const a=document.createElement("span");a.textContent=e,a.style.color=o,r.appendChild(s),r.appendChild(a),t.appendChild(r)});const e=document.createElement("button");return e.className="clear-btn",e.innerHTML="🗑️",e.title="Clear all logs",e.addEventListener("click",()=>this.clearLogs()),t.appendChild(e),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let n=![],e=0,i=0,o=0,r=0;t.addEventListener("mousedown",t=>{n=!![],e=t.clientX,i=t.clientY,o=Number.parseInt(this.panelElement.style.width,10)||500,r=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",S),document.addEventListener("mouseup",u),t.preventDefault()});const S=t=>{if(!n||!this.panelElement)return;const s=t.clientX-e,a=t.clientY-i,c=window.innerWidth<=768,l=window.innerWidth<=480;let d,m,g,v;l?(d=280,m=window.innerWidth-20,g=200,v=.4*window.innerHeight):c?(d=300,m=window.innerWidth-30,g=200,v=.4*window.innerHeight):(d=300,m=800,g=200,v=600);const y=Math.max(d,Math.min(m,o+s)),b=Math.max(g,Math.min(v,r+a));this.panelElement.style.width=y+"px",this.panelElement.style.height=b+"px"},u=()=>{n=![],document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",u)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const n=t.querySelector(".header");if(n){let t=![],e=0,i=0,o=0,r=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;t=!![],e=n.clientX,i=n.clientY;const s=this.panelElement.getBoundingClientRect();o=s.left,r=s.top,document.addEventListener("mousemove",S),document.addEventListener("mouseup",u),n.preventDefault()});const S=n=>{if(!t||!this.panelElement)return;const s=n.clientX-e,a=n.clientY-i;this.panelElement.style.left=o+s+"px",this.panelElement.style.top=r+a+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},u=()=>{t=![],document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",u)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const n=document.createElement("div");n.className="log-entry "+t.type+" "+t.level;const e=new Date(t.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+e+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",n}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(n){return String(t)}}escapeHtml(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.m()){const n=this.v(t);if(n)return this.k(t,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.C()),this.k(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.S(),browser:this._(),timezone:this.P()}}isLocalStorageWebApiAvailable(){return this.m()}k(t,n){return(t+"_"+n).toLowerCase()}m(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,n="__localStorage_test_"+Date.now()+"__",e="test";t.setItem(n,e);const i=t.getItem(n);return i!==e?(this.isLocalStorageAvailable=![],![]):(t.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(t){const e=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(e)try{const t=window.localStorage;return t&&t.length>0?(this.F()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},e=n[t.name]||"Storage error: "+t.name,i=this.F()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+e)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}v(t){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const e=localStorage.key(t);if(null==e?void 0:e.startsWith(n)){const t=e.substring(n.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(n){return null}}C(){const t=this.getFingerprintData(),n=Object.keys(t).sort().map(n=>n+":"+t[n]).join("|");return this.I(n)}S(){try{const t=screen,n=t.colorDepth||24,e=t.pixelDepth||n,i=this.D(),o=Math.round(100*(window.devicePixelRatio||1));return n+"|"+e+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(xt){}return"srgb"}_(){var t;try{const n=navigator,e=[],i=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);e.push(i),e.push(n.hardwareConcurrency||4);const o=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);e.push(o),e.push(n.cookieEnabled?"1":"0"),e.push(n.maxTouchPoints||0),e.push(n.deviceMemory||0),e.push(this.T()),e.push(this.F()?"webview":"browser");const r=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return e.push(r.join("")),e.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}T(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}F(){try{const t=navigator.userAgent.toLowerCase(),n=navigator,e=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return e.some(n=>t.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}P(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}I(t){const n=16777619;let e=2166136261,i=2166136261,o=2166136261,r=2166136261;for(let s=0;s<t.length;s++){const a=t.charCodeAt(s);e^=a,e=Math.imul(e,n),i^=a<<1,i=Math.imul(i,n),o^=a<<2,o=Math.imul(o,n),r^=a<<3,r=Math.imul(r,n)}return e=Math.abs(e),i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),e.toString(16)+i.toString(16)+o.toString(16)+r.toString(16)}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const n=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,n,e,o;const r=this.getStoreValue("address"),s=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],a=null!==(n=this.params.productId)&&void 0!==n?n:"",c=null!==(e=this.params.options)&&void 0!==e?e:{},l=null!==(o=c.showLabel)&&void 0!==o?o:!![],elements=[];if(l){const t=document.createElement("span");t.textContent="Delivers to:",elements.push(t)}const d=document.createElement("button");d.type="button",d.textContent=r.formattedAddress||"Select an address";const m=r.formattedAddress?"Change delivery address, currently set to "+r.formattedAddress:"Select delivery address";return d.setAttribute("aria-label",m),d.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,i.ADDRESS_INPUT,{productId:a}))}),elements.push(d),elements}}class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const n=t.target,e=n.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");n.value=e;const i=e.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(i);if(i.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const t=this.params.productId,n=this.clientConfig.isMobile(),e=this.isIndependentComponent();(n||e)&&this.commands.ui.closeDrawer(),!n&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(xt){this.logger.error("Address edit cancellation failed",xt)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),n=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;n&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const n=t.currentTarget.dataset.suggestionId;if(n)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(n);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:n,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(e){this.logger.error("Address details retrieval failed",e),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const n=await this.commands.address.searchAddresses(t);this.suggestions=n.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(n){this.logger.error("Address search operation failed",n),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const n=this.createElement("li",{className:"suggestion-item"}),e=this.createElement("span",{textContent:t.description});n.appendChild(e),n.setAttribute("data-suggestion-id",t.id),n.setAttribute("role","option"),n.setAttribute("aria-label","Select address: "+t.description),n.setAttribute("tabindex","0"),n.addEventListener("click",this.handleSuggestionClick),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),this.suggestionsContainer.appendChild(n)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,n){const e=document.createElement(t);return n&&Object.assign(e,n),e}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const n=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),e=this.createElement("span",{className:"error-text"});return t.appendChild(n),t.appendChild(e),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,n,e;const i=this.getConfigs("global"),o=null!==(t=this.params.options)&&void 0!==t?t:{},r=null!==(n=o.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),r){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const s=this.createElement("div",{className:"input-wrapper "+i.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(e=this.selectedAddress)||void 0===e?void 0:e.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),s.appendChild(this.inputElement);const a=this.createElement("span");a.className="input-icon",a.innerHTML=SearchIcon({width:16,height:16,className:""}),s.appendChild(a),this.inputContainer.appendChild(s),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const c=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),l=[this.inputContainer,c,this.errorContainer],d=this.createElement("div",{className:"action-buttons"}),m=this.createCancelButton();d.appendChild(m);const g=this.createCheckButton();return d.appendChild(g),l.push(d),document.addEventListener("click",this.handleDocumentClick),l}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const elements=[],t=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!t){const t=ComponentFactoryService.createElement({type:i.CART_HEADER});elements.push(t)}const n=ComponentFactoryService.createElement({type:i.CART_BODY});elements.push(n);const e=ComponentFactoryService.createElement({type:i.CART_FOOTER});return elements.push(e),elements}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=this.config.layout.drawerHeaderText,n=document.createElement("div");n.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your "+t.toLowerCase()+" is empty",n.appendChild(e),n}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:i.CART_RETAILER,retailerId:t.id})}catch(n){return this.logger.error("Cart retailer component creation failed",n),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,n){const e=this.createRetailerElement(n);e.setAttribute("data-retailer-id",t),this.container.appendChild(e)}removeRetailerElement(t){const n=this.getRetailerElementById(t);n&&n.remove()}updateRetailerElement(t,n){const e=this.getRetailerElementById(t);if(e){const i=this.createRetailerElement(n);i.setAttribute("data-retailer-id",t),e.replaceWith(i)}}hasRetailerDataChanged(t,n){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const n={};for(const[e,i]of Object.entries(t))i&&"object"==typeof i&&i.id&&(n[e]=i);return n}getValidRetailerIds(t){const n=this.getValidRetailers(t);return new Set(Object.keys(n))}onStoreChanged(t){const n=t.find(t=>"cart.retailers"===t.path),e=t.find(t=>"cart.loading"===t.path);if(n){const t=this.getValidRetailers(n.oldValue),e=this.getValidRetailers(n.value),i=this.getValidRetailerIds(n.oldValue),o=this.getValidRetailerIds(n.value),r=i.size,s=o.size,a=this.getValidRetailers(this.getStoreValue("cart.retailers")),c=Object.keys(a).length;if(s>0&&0===c)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===r&&s>0){this.container.innerHTML="";for(const[t,n]of Object.entries(e))this.addRetailerElement(t,n)}else if(r>0&&0===s)this.showEmptyCartState();else if(s>0){for(const t of i)o.has(t)||this.removeRetailerElement(t);for(const n of o){const o=e[n],r=t[n];i.has(n)?this.hasRetailerDataChanged(r,o)&&this.updateRetailerElement(n,o):this.addRetailerElement(n,o)}}else 0===r&&0===s&&this.showEmptyCartState()}if(e){const t=e.value,n=e.oldValue;t!==n&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return e||n,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},n=Object.values(t);if(0===n.length)return this.createEmptyCartElement();const e=[];for(const i of n){const t=this.createRetailerElement(i);t.setAttribute("data-retailer-id",i.id),e.push(t)}return e}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const n=t.some(t=>t.path.includes("cart.items")),e=t.some(t=>t.path.includes("cart.subtotal")),i=t.some(t=>t.path.includes("cart.fulfillments")),o=t.some(t=>"cart.loading"===t.path),r=t.some(t=>t.path.includes("cart.retailers"));n&&this.updateSubtotalItemsCount(),e&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(i||e||o||n||r)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const n=this.getStoreValue("cart.items")||{},e=Object.values(n).some(t=>t.updating);if(e)return!![];const i=this.getStoreValue("cart.fulfillments")||{},o=Object.values(i).some(t=>t.updating);if(o)return!![];const r=this.getStoreValue("cart.retailers")||{},s=Object.values(r).some(t=>t.updating);return s?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},n=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),e=this.shouldDisableCheckout(),i=t||e||!n;this.checkoutButton.disabled=i,this.checkoutButton.classList.toggle("checkout-btn-disabled",i),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),n=Object.values(t).reduce((t,n)=>t+n.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+n+" item"+(1!==n?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),n=this.getStoreValue("cart.subtotal"),elements=[],e=document.createElement("div");e.className="cart-footer-header";const o=document.createElement("div");o.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",o.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(n),o.appendChild(this.subtotalPrice);const r=document.createElement("p");if(r.textContent="Taxes & fees will be calculated at checkout",r.className="taxes-fees-info",e.appendChild(o),e.appendChild(r),elements.push(e),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:i.CART_PROMO_CODE});elements.push(t)}const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(elements.push(s),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),elements.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(t,n){const e=new Set(t||[]),o=new Set(n||[]);for(const i of e)if(!o.has(i)){const t=this.container.querySelector('[data-item-id="'+i+'"]');t&&t.remove()}for(const r of o)if(!e.has(r)){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t+".itemIds"),e=this.container.querySelectorAll("[data-item-id]");for(const i of e)i.remove();for(const o of n){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:o});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t),e=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(e&&e.remove(),null==n?void 0:n.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(n.minimumPurchaseAmount-n.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:n.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const e=document.createElement("div");return e.className="cart-loading-spinner",e.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(e),t.appendChild(n),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const n=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+n);return(null===(t=null==e?void 0:e.itemIds)||void 0===t?void 0:t.length)?e.itemIds.some(t=>this.getStoreValue("cart.items."+t+".updating")):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}onStoreChanged(t){const n=this.getFulfillmentId(),e="cart.fulfillments."+n,i=t.find(t=>t.path===e),o=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(o.length>0&&this.checkAndUpdateLoadingState(),i){const t=i.oldValue,n=i.value,e=(null==t?void 0:t.itemIds)||[],o=(null==n?void 0:n.itemIds)||[],r=JSON.stringify(e)!==JSON.stringify(o);r&&(this.handleItemsUpdate(e,o),this.checkAndUpdateLoadingState());const s=(null==t?void 0:t.subtotal)!==(null==n?void 0:n.subtotal),a=this.hasFulfillmentDataChanged(t,n,["itemIds","updating"]);if(s&&!a&&this.setupMinimumPurchaseAlert(),!a)return![]}return![]}hasFulfillmentDataChanged(t,n,e=[]){if(!t)return!![];const i=["type","canEngrave"];for(const o of i)if(!e.includes(o)&&t[o]!==n[o])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const At={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},Ot="America/New_York";function detectUserTimezone(t){try{if(t){const n=t.toUpperCase(),e=At[n];return e||Ot}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return Ot}}function getCurrentTimeInTimezone(t){try{const n=new Date,e=n.getTime(),i=6e4*n.getTimezoneOffset(),o=new Date(e+i),r=new Date(o.toLocaleString("en-US",{timeZone:t})),s=o.getTime()-r.getTime();return new Date(e+s)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(t){const n=detectUserTimezone(t);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(t){const{startDate:n,endDate:e,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),o=!n||t>=new Date(n),r=!e||t<=new Date(e);return o&&r}catch(o){return![]}}function filterActiveItems(t,n){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:n}))}function hasActiveItems(t,n){return filterActiveItems(t,n).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,n,e;const o=this.config.layout.drawerHeaderText,r=this.getConfigs("global"),s=document.createElement("div");s.className="cart-header-content";const a=document.createElement("h2");a.className="cart-title",a.textContent=o,s.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cart-header-close-btn",c.innerHTML=CloseIcon({width:16,height:16}),c.setAttribute("aria-label","Close cart drawer"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s.appendChild(c);const l=this.clientConfig.get("promoTicker"),d=null!==(n=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],m=null!=l?l:d,g=this.store.get("address"),v=hasActiveItems(m,null===(e=null==g?void 0:g.address)||void 0===e?void 0:e.state);if(!m.length||!v)return[s];const y=ComponentFactoryService.createElement({context:"cart",type:i.PROMO_CODE_TICKER,tickers:m});return[s,y]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,n){this.commands.ui.openDrawer(i.ENGRAVING_FORM,{identifier:t,context:"cart",lines:n.attributes.engraving.lines,maxLines:n.attributes.engraving.maxLines,maxCharsPerLine:n.attributes.engraving.maxCharsPerLine,fee:n.attributes.engraving.fee,location:n.attributes.engraving.location})}template(){var t,n;const e=this.params.itemId,o=this.getStoreValue("cart.items."+e),r=this.getConfigs("global"),s=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),a=document.createElement("article");a.className="cart-item";const c=document.createElement("div");c.className="item-image";const l=document.createElement("img");l.src=o.mainImage,l.alt=o.name,c.appendChild(l);const d=document.createElement("div");d.className="item-details";const m=document.createElement("div");m.className="item-header";const g=document.createElement("h3");g.className="item-title",g.textContent=o.name;const v=document.createElement("button");v.className="item-delete",v.innerHTML=TrashIcon({}),v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","Remove "+o.name+" from cart"),v.setAttribute("aria-expanded","true"),v.addEventListener("click",async()=>{await this.commands.cart.removeItem(e)}),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(e))}),m.appendChild(g),m.appendChild(v);const y=document.createElement("div");y.className="item-specs",y.textContent=o.size+", "+o.container;const b=document.createElement("div");b.className="item-shipping-container";const k=document.createElement("div");if(k.className="item-shipping",k.textContent=o.attributes.engraving.hasEngraving?s.engravingExpectation:s.expectation,b.appendChild(k),r.layout.enablePersonalization&&(null==o?void 0:o.attributes.engraving.isEngravable)&&(null==o?void 0:o.attributes.engraving.hasEngraving)===![]&&s.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=r.layout.personalizationText+" +"+formatCentToDollarText(o.attributes.engraving.fee,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+o.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(e,o)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(e,o))}),b.appendChild(t)}d.appendChild(m),d.appendChild(y),d.appendChild(b),a.appendChild(c),a.appendChild(d);const elements=[a],E=ComponentFactoryService.createElement({type:i.CART_ITEM_QUANTITY_PRICE,itemId:e});if((null===(n=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:e,context:"cart"});elements.push(t)}return elements.push(E),elements}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const n=t.find(t=>"cart.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,n=this.getStoreValue("cart.items."+t);return n||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const n=t.quantity,e=this.getAvailableQuantity(),i=e>0;return{currentQuantity:n,availableQuantity:e,canIncrease:i,canDecrease:!![]}}getAvailableQuantity(){var t,n;const e=this.getItemStore();if(!e)return 0;const i=e.partNumber,o=e.fulfillmentId,r=this.getStoreValue("cart.items")||{},s=Object.values(r).filter(t=>t.partNumber===i&&t.fulfillmentId===o),a=s.reduce((t,n)=>t+n.quantity,0),c=this.getStoreValue("products."+e.upc)||this.getStoreValue("products."+e.salsifyGrouping);if(!c)return e.maxQuantity-a;const l=(null===(n=null===(t=null==c?void 0:c.sizes)||void 0===t?void 0:t[e.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder)||0;return!l||l<=0?e.maxQuantity-a:l-a}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const n=this.calculateQuantityLimits();t>0&&!n.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),n=this.getItemStore();if(!n)return document.createElement("div");const e=document.createElement("div");return e.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),e.appendChild(this.qtyDecreaseButton),e.appendChild(this.quantitySpan),e.appendChild(this.qtyIncreaseButton),e}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const n=document.createElement("div");n.className="item-price-container";const e=document.createElement("span");if(e.className="item-price",e.textContent=formatCentToDollarText(t.price),n.appendChild(e),t.quantity>1){const e=document.createElement("span");e.className="item-price-per-unit",e.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",n.appendChild(e)}return n}template(){const elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer();elements.push(t)}const t=this.createPriceContainer();return elements.push(t),elements}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path);if(n){const{value:t,oldValue:e}=n,i=Boolean(null==e?void 0:e.code),o=Boolean(null==t?void 0:t.code);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;if(o&&this.promoCodePill&&t.discount!==(null==e?void 0:e.discount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")",void 0}}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const e=document.createElement("button");e.type="button",e.classList.add("promo-remove-btn"),e.textContent="Remove",e.setAttribute("role","button"),e.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),e.setAttribute("tabindex","0"),e.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(e),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const n=document.createElement("div");n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),t.appendChild(n),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),n=t.length>=3&&t.length<=255,e=this.getStoreValue("cart.loading"),i=this.getStoreValue("cart.promoCode"),o=this.getStoreValue("cart.events"),r=o.some(t=>t.type===s.PROMO_CODE);this.applyButton.disabled=!n||e||Boolean(null==i?void 0:i.discount)||this.isApplying||r}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),e=this.promoInput;e.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const x=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(n){this.logger.error("Cart promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}};return this.applyButton.addEventListener("click",x),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const e=document.createElement("button");return e.type="button",e.classList.add("promo-remove-btn"),e.textContent="Remove",e.setAttribute("role","button"),e.setAttribute("aria-label","Remove promo code "+t.code),e.setAttribute("tabindex","0"),e.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(e),n}const n=document.createElement("div");n.classList.add("promo-code-container");const e=document.createElement("div");return e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),n.appendChild(e),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:i.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const n=this.container.querySelectorAll("[data-fulfillment-id]");if(n.length>0){const t=n[n.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const n=this.getFulfillmentInsertionPoint();if(n){const e=this.createFulfillmentElement(t);e.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),n.nextSibling?n.parent.insertBefore(e,n.nextSibling):n.parent.appendChild(e)}}removeFulfillmentElement(t){const n=this.getFulfillmentElementById(t);if(n){const t=n.parentElement,e=n.nextElementSibling;n.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const n=document.createElement("div");n.id="retailer-fulfillment-container",e?t.insertBefore(n,e):t.appendChild(n)}}}handleFulfillmentsUpdate(t,n){const e=new Set(t||[]),i=new Set(n||[]);for(const o of e)i.has(o)||this.removeFulfillmentElement(o);for(const o of i)e.has(o)||this.addFulfillmentElement(o)}setupFulfillmentElements(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],e=this.container.querySelectorAll("[data-fulfillment-id]");for(const o of e)o.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),n=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&n&&t.insertBefore(i,n)}for(const o of Object.keys(n))this.addFulfillmentElement(o)}setupSubtotalElement(){const t=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const e=ComponentFactoryService.createElement({type:i.CART_RETAILER_SUBTOTAL,retailerId:t});n.replaceWith(e)}}onStoreChanged(t){const n=this.getRetailerId(),e="cart.retailers."+n,i=t.find(t=>t.path===e);if(i){const t=i.oldValue,n=i.value,e=Object.keys((null==t?void 0:t.fulfillments)||{}),o=Object.keys(n.fulfillments||{});JSON.stringify(e)!==JSON.stringify(o)&&this.handleFulfillmentsUpdate(e,o)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),n=this.container.querySelector(".retailer-section"),e=this.container.querySelector(".section-header-label");if(t&&n&&e){const M=()=>{const n=t.checked;e.setAttribute("aria-label",n?"Expand retailer section":"Collapse retailer section"),e.setAttribute("aria-expanded",n?"false":"true")};t.addEventListener("change",()=>{t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),M()}),e.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),M()}}template(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t),e=document.createElement("section");e.className="retailer-section";const i=document.createElement("div");i.className="cart-retailer-header";const o=document.createElement("div");o.className="retailer-info";const r=document.createElement("h2");r.className="section-title",r.textContent=n.name,o.appendChild(r);const s=document.createElement("input");s.type="checkbox",s.id=n.id,s.className="section-toggle",o.appendChild(s);const a=document.createElement("label");a.htmlFor=n.id,a.className="section-header-label",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Collapse retailer section"),a.setAttribute("aria-expanded","true");const c=document.createElement("span");c.className="chevron",c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),a.appendChild(c),o.appendChild(a),i.appendChild(o),e.appendChild(i);const l=document.createElement("div");l.className="retailer-body-container";const d=document.createElement("div");d.id="retailer-fulfillment-container",l.appendChild(d);const m=document.createElement("div");return m.id="retailer-subtotal-container",l.appendChild(m),e.appendChild(l),e}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,n){const e=Object.values(t||{}).filter(t=>t.retailerId===n);let i=0;for(const o of e)i+=o.quantity;return i}template(){const t=this.params.retailerId,n=this.getStoreValue("cart.retailers."+t+".subtotal")||0,e=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,i=this.getStoreValue("cart.items"),o=this.getRetailerItemCount(i,t),r=1===o?"item":"items",s=document.createElement("h3");s.className="retailer-subtotal-header",s.textContent="Subtotal ("+o+" "+r+"):";const a=document.createElement("span");return a.className="retailer-subtotal-amount",a.textContent=formatCentToDollarText(n+e),[s,a]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){const t=this.store.get("checkout.presale"),n=this.getPromoTickerData(),e=this.checkForActiveTickers(n),o=document.createElement("div");o.classList.add("checkout-container"),this.params.isIndependentComponent&&o.classList.add("independent"),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION})),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_ORDER_SUMMARY}));const r=this.createHeaderWrapper(t,n,e);return[r,o]}getPromoTickerData(){var t,n;const e=this.getConfigs("global"),i=this.clientConfig.get("promoTicker"),o=null!==(n=null===(t=null==e?void 0:e.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[];return null!=i?i:o}checkForActiveTickers(t){var n;const e=this.store.get("address");return hasActiveItems(t,null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state)}createHeaderWrapper(t,n,e){const o=this.params.isIndependentComponent,r=document.createElement("div");return r.classList.add("checkout-header-wrapper"),o&&r.classList.add("hosted"),r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER,isHostedCheckout:o})),n.length>0&&e&&!t&&r.appendChild(ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:n})),t&&r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN})),r}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,n,e;const i=this.getStoreValue("checkout"),r=Boolean(i.promoCode),s=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),a=this.getConfigs("global"),c=Object.values(i.fulfillments).some(t=>t.type===o.SHIPPING),l=Object.values(i.fulfillments).some(t=>t.type===o.ON_DEMAND),elements=[],d=document.createElement("div");d.classList.add("checkout-amount-line");const m=document.createElement("span");m.textContent="Subtotal ("+i.itemsQuantity+" item"+(i.itemsQuantity>1?"s":"")+")",d.appendChild(m);const g=document.createElement("span");if(g.textContent=formatCentToDollarText(i.amounts.subtotal),d.appendChild(g),elements.push(d),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Shipping",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.shipping),t.appendChild(e),elements.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Delivery",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.delivery),t.appendChild(e),elements.push(t)}if((null===(n=null==i?void 0:i.amounts)||void 0===n?void 0:n.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(e),elements.push(t)}const v=document.createElement("div");v.classList.add("checkout-amount-line");const y=document.createElement("span");y.textContent="Taxes & Fees",v.appendChild(y);const b=document.createElement("span");if(b.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),v.appendChild(b),elements.push(v),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(e=i.promoCode)||void 0===e?void 0:e.code.toUpperCase())+")",t.appendChild(n);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),elements.push(t)}if(s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",t.appendChild(n);const e=document.createElement("span");e.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(e),elements.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.tip),t.appendChild(e),elements.push(t)}const k=document.createElement("div");k.classList.add("checkout-separator"),elements.push(k);const E=document.createElement("div");E.classList.add("checkout-amount-total");const _=document.createElement("span");_.textContent="Total",E.appendChild(_);const F=document.createElement("span");if(F.textContent=formatCentToDollarText(i.amounts.total),E.appendChild(F),elements.push(E),i.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(0),t.appendChild(e),elements.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:a.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),elements.push(i)}return elements}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const e=document.createElement("div");e.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),i.setAttribute("role","checkbox"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Billing same as shipping checkbox"),i.setAttribute("aria-checked",t?"true":"false"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const o=document.createElement("label");return o.textContent="Billing address same as shipping address",o.setAttribute("for","billingSameAsShipping"),o.classList.add("billing-checkbox-label"),e.appendChild(i),e.appendChild(o),n.appendChild(e),n}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,n)}template(){const t=this.getStoreValue("checkout.paymentForm"),elements=[],n=this.billingSameAsShippingToggle();if(elements.push(n),t.billingSameAsShipping)return elements;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Your billing info",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),o.appendChild(s),elements.push(o);const a=document.createElement("div");a.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});l.setAttribute("aria-label","First name input"),c.appendChild(l);const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});d.setAttribute("aria-label","Last name input"),c.appendChild(d),a.appendChild(c);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:It.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","Email input"),a.appendChild(m);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:It.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Phone input"),g.appendChild(v);const y=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});y.setAttribute("aria-label","Company input"),g.appendChild(y),a.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const k=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});k.setAttribute("aria-label","Street address input"),b.appendChild(k);const E=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","Apt, suite, etc. (optional) input"),b.appendChild(E),a.appendChild(b);const _=document.createElement("div");_.classList.add("checkout-three-col-container");const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});F.setAttribute("aria-label","City input"),_.appendChild(F);const D=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});D.setAttribute("aria-label","State input"),_.appendChild(D);const T=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:It.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:It.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return T.setAttribute("aria-label","Zip Code input"),_.appendChild(T),a.appendChild(_),elements.push(a),elements}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const elements=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),n.appendChild(o);const r=document.createElement("p");r.textContent="Buyer information is used to process your order and for delivery purposes.",r.classList.add("section-subtitle"),n.appendChild(r),elements.push(n);const s=document.createElement("div");s.classList.add("section-form-container");const a=document.createElement("div");a.classList.add("checkout-two-col-container");const c=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Pt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});a.appendChild(c);const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Pt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});a.appendChild(l),s.appendChild(a);const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Pt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});s.appendChild(d);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:Pt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});s.appendChild(m);const g=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:Pt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});s.appendChild(g);const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:Pt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return s.appendChild(v),elements.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const elements=[],t=this.getStoreValue("checkout.customerForm.data"),n=document.createElement("div");n.classList.add("checkout-summary-form-header");const e=document.createElement("h2");e.textContent="Buyer: "+t.firstName+" "+t.lastName,n.appendChild(e);const i=document.createElement("span");if(i.textContent="Edit",i.setAttribute("aria-label","Edit Buyer Information"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),i.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),n.appendChild(i),elements.push(n),t.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=t.company,elements.push(n)}const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=t.email,elements.push(o);const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=t.phone,elements.push(r);const s=document.createElement("p");return s.classList.add("checkout-summary-form-line"),s.textContent=formatISODateToMMDDYYYY(t.birthDate),elements.push(s),elements}}const zt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Lt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,n){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===t?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const n=t.textContent||"",e=n.replace(/<[^>]*>/g,"");if(e.trim()){const t=document.createTextNode(e);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const n=t,e=n.tagName.toLowerCase();if(zt.includes(e)){const t=document.createElement(e),i=Lt[e]||[];for(const e of Array.from(n.attributes)){const n=e.name.toLowerCase();if(i.includes(n)){const i=sanitizeAttributeValue(n,e.value);null!==i&&t.setAttribute(n,i)}}"a"===e&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const e of Array.from(n.childNodes)){const n=cleanNode(e);n&&t.appendChild(n)}return t}const i=document.createDocumentFragment();for(const t of Array.from(n.childNodes)){const n=cleanNode(t);n&&i.appendChild(n)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const n=new DOMParser,e=n.parseFromString(t,"text/html"),i=e.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const o=document.createDocumentFragment();for(const t of Array.from(e.body.childNodes)){const n=cleanNode(t);n&&o.appendChild(n)}const r=document.createElement("div");return r.appendChild(o),r.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,n,e,o,r,s;const elements=[],a=this.getConfigs("configurations"),c=this.getConfigs("global"),l=this.getConfigs("checkout"),d=this.config.layout.continueShoppingUrl||window.location.host,m=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===n?void 0:n.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(o=null===(e=this.config.layout)||void 0===e?void 0:e.checkoutCompleted)||void 0===o?void 0:o.customLogo,n.alt=a.partnerName+" Logo",t.appendChild(n),elements.push(t)}const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-container");const y=document.createElement("div");y.classList.add("checkout-completed-title-section");const b=document.createElement("h3");b.innerHTML=(null===(s=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===s?void 0:s.customText)||"Thank You for Your Order!",y.appendChild(b);const k=document.createElement("p");k.textContent="Your payment has been successfully processed.",y.appendChild(k),v.appendChild(y),g.appendChild(v);const E=document.createElement("div");E.classList.add("checkout-completed-sub-section");const _=document.createElement("div");_.classList.add("checkout-completed-line");const F=document.createElement("h3");F.textContent="Order Number",_.appendChild(F);const D=document.createElement("span");D.textContent=this.params.orderNumber,_.appendChild(D),E.appendChild(_);const T=document.createElement("div");T.classList.add("checkout-completed-line");const A=document.createElement("h3");A.textContent="Order Amount",T.appendChild(A);const O=document.createElement("span");O.textContent=""+formatCentToDollarText(this.params.orderTotal),T.appendChild(O),E.appendChild(T);const z=document.createElement("div");z.classList.add("checkout-completed-line");const L=document.createElement("h3");L.textContent="Payment Method",z.appendChild(L);const R=document.createElement("span");R.textContent="** "+this.params.cardLast4,z.appendChild(R),E.appendChild(z),g.appendChild(E);const j=document.createElement("div");j.classList.add("checkout-completed-sub-section");const q=document.createElement("p");q.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",j.appendChild(q),g.appendChild(j),elements.push(g);const H=document.createElement("div");H.classList.add("checkout-completed-section-container");const Y=document.createElement("button");Y.type="button";const Q=document.createElement("span");Q.textContent=m,Y.setAttribute("tabindex","0"),Y.setAttribute("role","button"),Y.setAttribute("aria-label",m),Y.appendChild(Q);const W=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:c.theme.selectedTextColor}));Y.appendChild(W),Y.addEventListener("click",()=>{window.location.href=d}),Y.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=d)}),H.appendChild(Y),elements.push(H);const Z=document.createElement("div");Z.classList.add("checkout-completed-section-container");const X=document.createElement("div");X.classList.add("checkout-completed-help-section"),Z.appendChild(X);const J=document.createElement("p");J.textContent="Questions about your order? Contact us at ";const $=document.createElement("a");$.href="mailto:"+a.supportEmail,$.textContent=a.supportEmail,J.appendChild($),X.appendChild(J);const tt=document.createElement("p"),nt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(tt.textContent="Order placed on "+nt,X.appendChild(tt),elements.push(Z),l.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(l.layout.legalMessage.text);const e=document.createElement("div");e.classList.add("checkout-separator"),elements.push(t),elements.push(n),elements.push(e)}if(c.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path),e=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==n?void 0:n.value)||(null==e?void 0:e.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let n;n=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=n}template(){const t=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),r=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("checkout.shippingAddress"),c=n?r:s,l=this.store.get("checkout.deliveryInstructions");s.firstName&&(this.customerData.firstName={isValid:!![],value:s.firstName}),s.lastName&&(this.customerData.lastName={isValid:!![],value:s.lastName}),s.email&&(this.customerData.email={isValid:!![],value:s.email}),s.phone&&(this.customerData.phone={isValid:!![],value:s.phone}),s.company&&(this.customerData.company={isValid:!![],value:s.company}),s.birthDate&&(this.customerData.birthDate={isValid:!![],value:s.birthDate}),r.firstName&&(this.giftData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.giftData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.giftData.email={isValid:!![],value:r.email}),r.phone&&(this.giftData.phone={isValid:!![],value:r.phone}),r.message&&(this.giftData.message={isValid:!![],value:r.message}),a.address.two&&(this.customerData.addressTwo={isValid:!![],value:a.address.two},this.giftData.addressTwo={isValid:!![],value:a.address.two}),l&&(this.customerData.deliveryInstructions={isValid:!![],value:l},this.giftData.deliveryInstructions={isValid:!![],value:l});const d=this.store.get("checkout.fulfillments")||{},m=Object.values(d).some(t=>t.type===o.ON_DEMAND),elements=[],g=document.createElement("div");g.classList.add("delivery-header-container");const v=document.createElement("div");v.classList.add("delivery-header-content");const y=document.createElement("div");y.classList.add("delivery-title-container");const b=document.createElement("h3");b.textContent="Deliver to",b.classList.add("delivery-title");const k=document.createElement("p");k.textContent="Package recipient must be 21+",k.classList.add("delivery-subtitle"),y.appendChild(b),y.appendChild(k),g.appendChild(y),elements.push(g);const E=document.createElement("div");E.classList.add("section-form-container");const _=document.createElement("div");_.classList.add("checkout-two-col-container");const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?Ft.firstName:Pt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:t=>{n?(this.giftData.firstName.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.firstName}))},onValidation:t=>{n?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});F.setAttribute("aria-label","First Name Input"),_.appendChild(F);const D=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?Ft.lastName:Pt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:t=>{n?(this.giftData.lastName.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.lastName}))},onValidation:t=>{n?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(D.setAttribute("aria-label","Last Name Input"),_.appendChild(D),E.appendChild(_),!n){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Pt.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),E.appendChild(t)}const T=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:n?Ft.email:Pt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:t=>{n?(this.giftData.email.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.email})):(this.customerData.email.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.email}))},onValidation:t=>{n?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});T.setAttribute("aria-label","Email Input"),E.appendChild(T);const A=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:n?Ft.phone:Pt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:t=>{n?(this.giftData.phone.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.phone}))},onValidation:t=>{n?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(A.setAttribute("aria-label","Phone Input"),E.appendChild(A),!n){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:Pt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),E.appendChild(t)}const O=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a.formattedAddress,disabled:!![],className:"disabled-input"});O.setAttribute("aria-label","Delivery Address Input"),E.appendChild(O);const z=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?Ft.addressTwo:Pt.addressTwo,label:"Apt, suite, etc. (optional)",value:a.address.two,onChange:t=>{n?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:Pt.addressTwo}))},onValidation:t=>{n?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(z.setAttribute("aria-label","Address Line 2 Input"),E.appendChild(z),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",Ft.message);const o=document.createElement("textarea");o.name=Ft.message,o.id=Ft.message,o.rows=4,o.value=r.message||"",o.setAttribute("aria-label","Gift Message Textarea"),o.addEventListener("input",async t=>{const n=t.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(e.GIFT,{fieldName:Ft.message}),this.updateSaveButtonState()});const s=document.createElement("p");s.textContent="Your gift message will be emailed to the recipient along with delivery details.",s.classList.add("textarea-message-disclaimer"),n.appendChild(i),n.appendChild(o),n.appendChild(s),E.appendChild(n)}if(m){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const o=document.createElement("textarea");o.id="delivery_instructions",o.name="delivery_instructions",o.rows=4,o.setAttribute("aria-label","Delivery Instructions Textarea"),o.value=l,o.addEventListener("input",async t=>{const e=t.target.value;n?(this.giftData.deliveryInstructions.value=e,this.giftData.deliveryInstructions.isValid=e.length>0):(this.customerData.deliveryInstructions.value=e,this.customerData.deliveryInstructions.isValid=e.length>0)});const r=document.createElement("p");r.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",r.classList.add("textarea-message-disclaimer"),e.appendChild(i),e.appendChild(o),e.appendChild(r),E.appendChild(e)}elements.push(E),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const C=async()=>{n?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",C),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await C())}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const elements=[],t=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.data"),e=this.getStoreValue("checkout.giftRecipientForm.data"),i=this.getStoreValue("checkout.shippingAddress"),o=this.getStoreValue("checkout.deliveryInstructions"),r=document.createElement("div");r.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent=t?"Delivering to "+e.firstName+" "+e.lastName:"Delivering to "+n.firstName+" "+n.lastName,r.appendChild(s);const a=document.createElement("span");a.textContent="Edit",a.setAttribute("aria-label","Edit Delivery Information"),a.setAttribute("role","button"),a.setAttribute("tabindex","0");const B=async()=>{t?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(a.addEventListener("click",B),a.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await B())}),r.appendChild(a),elements.push(r),!t&&n.company){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=n.company,elements.push(t)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=i.formattedAddress,elements.push(c);const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=t?e.email:n.email,elements.push(l);const d=document.createElement("p");if(d.classList.add("checkout-summary-form-line"),d.textContent=t?e.phone:n.phone,elements.push(d),!t&&n.birthDate){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=formatISODateToMMDDYYYY(n.birthDate),elements.push(t)}if(t){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Gift Message:",t.appendChild(n);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=e.message||"No message provided.",t.appendChild(i),elements.push(t)}if(o){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Delivery Instructions:",t.appendChild(n);const e=document.createElement("span");e.classList.add("checkout-summary-form-line"),e.textContent=o||"No instructions provided.",t.appendChild(e),elements.push(t)}return elements}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var n;const e=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);e&&e.value.length>((null===(n=e.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),n=t.length>=3&&t.length<=255,e=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||e||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),e=this.giftCardInput;e.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const x=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",x),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const elements=[];return elements.push(this.createGiftCardInput()),elements.push(this.createApplyButton()),elements}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){var t,n;const e=this.store.get("checkout.presale"),o=this.getConfigs("checkout"),r=null!==(n=null===(t=this.params)||void 0===t?void 0:t.isHostedCheckout)&&void 0!==n?n:![];let s=null;if(!e){s=document.createElement("button"),s.type="button",s.classList.add("checkout-header-button"),s.setAttribute("aria-label",r?"Back":"Back to Cart"),s.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back Button Is Disabled In Builder Mode"),void 0;if(r){const t=null==o?void 0:o.layout.continueShoppingUrl;t&&(window.location.href=t)}else this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),s.appendChild(t)}const a=document.createElement("h1");if(a.textContent=(null==o?void 0:o.layout.drawerHeaderText)||"Checkout",a.classList.add("checkout-header-title"),a.setAttribute("aria-label","Checkout Page"),r){const t=document.createElement("div");return t.classList.add("checkout-header-spacer"),s?[s,a,t]:[a,t]}const c=document.createElement("button");return c.innerHTML=CloseIcon({width:16,height:16}),c.classList.add("checkout-header-button-close"),c.setAttribute("aria-label","Close Checkout"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s?[s,a,c]:[a,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.isEditing"),e=this.getStoreValue("checkout.giftRecipientForm.isEditing"),i=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=i?"block":"none",this.paymentSummary.style.display=i?"none":"block"}template(){const elements=[],t=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm"),e=this.getStoreValue("checkout.giftRecipientForm"),o=this.getStoreValue("checkout.paymentForm"),r=ComponentFactoryService.createElement({type:i.CHECKOUT_SEND_AS_GIFT});return elements.push(r),this.deliveryToForm=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=t?e.isEditing?"block":"none":n.isEditing?"block":"none",elements.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=t?e.isEditing?"none":"block":n.isEditing?"none":"block",elements.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER}),this.buyerForm.style.display=t&&n.isEditing?"block":"none",elements.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=t&&!n.isEditing?"block":"none",elements.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT}),this.paymentForm.style.display=o.isEditing?"block":"none",elements.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=o.isEditing?"none":"block",elements.push(this.paymentSummary),elements}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var n,e,i,o;const r=t.find(t=>"checkout.items"===t.path);r&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const s=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(s){const t=s.oldValue,r=s.value;if(r.updating)return![];const a=(null==t?void 0:t.quantity)!==(null==r?void 0:r.quantity),c=(null===(e=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.lines)||[],l=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],d=JSON.stringify(c)!==JSON.stringify(l);(a||d)&&this.updateEngravingElement(r)}return![]}updateEngravingElement(t){var n,e;const o=this.getConfigs("global"),r=this.container.querySelector(".engraving-view-container");if(r&&r.remove(),(null===(e=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.hasEngraving)===!![]&&o.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),e=this.container.querySelector(".checkout-item-card-footer");e&&e.before(n)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const n=t.fulfillmentId;if(!n)return;if(!this.container)return;const e=this.container.querySelector(".checkout-item-card-header");if(e){const t=this.getStoreValue("cart.fulfillments."+n),o=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(o&&o.remove(),t.hasUnmetMinimumPurchaseAmount){const n=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","checkout-retailer-alert"),e.before(n)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),n=Object.keys(t.items).length,e=1===n;this.trashButton.disabled=e,e?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const e=document.createElement("div");return e.className="cart-loading-spinner",e.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(e),t.appendChild(n),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,n,e;const o=this.getConfigs("global"),r=this.getStoreValue("checkout.items."+this.params.itemId),s=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.presale,a=(null==s?void 0:s.isActive)&&(null==s?void 0:s.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(s.estimatedShipBy):"";if(!r)return[];const c=this.getStoreValue("checkout.fulfillments."+r.fulfillmentId),l=this.getStoreValue("checkout.retailers."+r.retailerId),d=document.createElement("div");d.classList.add("checkout-item-card-header");const m=document.createElement("div");m.classList.add("checkout-item-image");const g=document.createElement("img");g.src=r.mainImage,g.alt=r.name,g.loading="lazy",m.appendChild(g),d.appendChild(m);const v=document.createElement("div");v.classList.add("checkout-item-details-container");const y=document.createElement("h4");y.classList.add("checkout-item-title"),y.textContent=r.name,v.appendChild(y);const b=document.createElement("div");b.classList.add("checkout-item-subtitle");const k=document.createElement("span");k.textContent=s.isActive?a+",":(r.attributes.engraving.hasEngraving?null==c?void 0:c.engravingExpectation:null==c?void 0:c.expectation)+",",b.appendChild(k);const E=document.createElement("span");E.textContent="From "+((null==l?void 0:l.name)||"Retailer"),b.appendChild(E),v.appendChild(b),d.appendChild(v),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var n;if(t.preventDefault(),t.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(r.cartItemId)}catch(e){this.logger.error("Checkout item removal failed",e)}}),d.appendChild(this.trashButton);const _=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),F=[];if(F.push(d),o.layout.enablePersonalization&&(null===(e=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout"});F.push(t)}return F.push(_),F}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const n=t.find(t=>"checkout.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,n,e;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,s=i.fulfillmentId,a=null===(e=null===(n=null===(t=Object.values(o).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===n?void 0:n[i.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("checkout.items")||{},l=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===s),d=l.reduce((t,n)=>t+n.quantity,0);return a-d}calculateQuantityLimits(){var t;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const e=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(e.items))||void 0===t?void 0:t.length),o=n.quantity,r=this.getAvailableQuantity(),s=r>0,a=!(i&&1===o);return{currentQuantity:o,availableQuantity:r,isTheOnlyItem:i,canIncrease:s,canDecrease:a}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const n=this.calculateQuantityLimits(),e=this.params.itemId;if((!(t<0)||n.canDecrease)&&(!(t>0)||n.canIncrease)){if(!e)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(e,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",i)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),e=document.createElement("div");e.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),e.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),e.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),e.appendChild(this.increaseButton),this.updateButtonStates(n);const i=document.createElement("span");if(i.classList.add("checkout-item-price-text"),i.textContent=formatCentToDollarText(t.price),t.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",i.appendChild(n)}return[e,i]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},n=new Map;for(const e of Object.values(t))e&&e.cartItemId&&n.set(e.cartItemId,e);return n}syncItemsWithStore(){if(!this.itemsList)return;const t=this.getCurrentItemsMap(),n=this.itemsList.querySelectorAll("[data-item-id]"),e=new Set;for(const i of n){const t=i.getAttribute("data-item-id");t&&e.add(t)}for(const i of n){const n=i.getAttribute("data-item-id");n&&!t.has(n)&&i.remove()}for(const[i]of t)if(!e.has(i)){const t=this.createItemElement(i);t.setAttribute("data-item-id",i),this.itemsList.appendChild(t)}if(this.togglerLabel){const t=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=t+" item"+(t>1?"s":"")}}onStoreChanged(t){let n=null;for(let e=0;e<t.length;e++){const i=t[e];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){n=i;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),t?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",t?"true":"false"),this.togglerButton.setAttribute("aria-label",t?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.itemsQuantity"),n=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=t+" item"+(t>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const e of Object.values(n)){const t=this.createItemElement(e.cartItemId);t.setAttribute("data-item-id",e.cartItemId),this.itemsList.appendChild(t)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const n=t.find(t=>"checkout.amounts"===t.path);if(n){const t=this.getStoreValue("checkout"),n=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&n>0)}}updateZeroAmountElement(t){const n=this.container.querySelector(".checkout-zero-amount-container");if(t&&!n){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(t)}else!t&&n&&n.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!t.show&&!n.show)return null;const e=document.createElement("div");if(e.classList.add("checkout-marketing-opt-ins-container"),t.show){const n=document.createElement("div");let i;n.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const o=document.createElement("span");o.id="emailOptIn",o.classList.add("checkout-checkbox-visual"),i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Email opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleEmailToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(o))});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const n=t.target,e="A"===n.tagName||n.closest("a");e||(this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked"))}),n.appendChild(o),n.appendChild(r),e.appendChild(n)}if(n.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const o=document.createElement("span");o.classList.add("checkout-checkbox-visual"),o.id="smsOptIn",i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","SMS opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleSmsToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(o))});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(n.text),r.addEventListener("click",t=>{const n=t.target,e="A"===n.tagName||n.closest("a");e||(this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked"))}),t.appendChild(o),t.appendChild(r),e.appendChild(t)}return e}hasOnDemandOrder(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).some(t=>t.type===o.ON_DEMAND)}template(){var t;const elements=[],n=this.getConfigs("global"),e=this.getConfigs("checkout"),o=this.getConfigs("global"),r=e.layout.allowGiftCards,s=null===(t=null==o?void 0:o.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Order Summary",c.classList.add("section-title"),a.appendChild(c),elements.push(a);const l=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});elements.push(l);const d=document.createElement("div");d.classList.add("checkout-separator");const m=document.createElement("div");if(m.classList.add("checkout-separator"),elements.push(d),r||s){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});elements.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});elements.push(t),elements.push(m)}const g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="100% Secure Payments",v.classList.add("disclaimer-header"),g.appendChild(v);const y=document.createElement("p");y.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",y.classList.add("disclaimer-description"),g.appendChild(y),elements.push(g);const b=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});elements.push(b);const k=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});elements.push(k);const E=this.marketingOptInsContainer();if(E&&elements.push(E),e.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(e.layout.legalMessage.text),elements.push(t),elements.push(n)}const _=document.createElement("div");if(_.classList.add("checkout-separator"),elements.push(_),n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});elements.push(t)}return elements}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const n of t)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",t=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!n}else{const n=this.stripeFormStatus.isFormComplete,e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(n&&e)}this.saveButton.disabled=t,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const elements=[],t=document.createElement("div");t.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),t.appendChild(n);const e=document.createElement("p");if(e.textContent="All transactions are secure and encrypted.",e.classList.add("section-subtitle"),t.appendChild(e),elements.push(t),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const t=document.createElement("p");t.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(t),elements.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,n)=>{const e={paymentSession:{confirmationTokenId:t,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}}}),elements.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),elements.push(this.errorMessageElement);const o=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING,isFormValid:(t,n)=>{this.billingFormData=n,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return elements.push(o),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),elements.push(this.saveButton),elements}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in edit mode",n),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in beta mode",e),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,n,e,i,o,r,s,a,c;const elements=[],l=this.getStoreValue("checkout.paymentForm"),d=document.createElement("div");d.classList.add("checkout-summary-form-header");const m=document.createElement("h2");m.textContent="Paying with "+(null!==(e=null===(n=null===(t=l.paymentMethod)||void 0===t?void 0:t.card)||void 0===n?void 0:n.brand)&&void 0!==e?e:"")+" "+(null===(o=null===(i=l.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),d.appendChild(m);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Payment Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),d.appendChild(g),elements.push(d);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(s=null===(r=l.paymentMethod)||void 0===r?void 0:r.card)||void 0===s?void 0:s.expMonth)+"/"+(null===(c=null===(a=l.paymentMethod)||void 0===a?void 0:a.card)||void 0===c?void 0:c.expYear),elements.push(v),elements}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const n=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const e=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(e.state),this.placeOrderButton.disabled=e.disabled,this.placeOrderButton.textContent=e.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),t?(n.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:n}){const e=this.config.layout.placeOrderButtonText,i=this.store.get("checkout.presale");let o=![];if(!i){const t=this.getStoreValue("cart.fulfillments")||{};o=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const r=this.store.get("checkout.isGift"),s=this.store.get("checkout.customerForm.isValid"),a=this.store.get("checkout.giftRecipientForm.isValid"),c=this.store.get("checkout.paymentForm.isValid");return o||r&&!a||!s||!c?{state:"disabled",text:e,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:e,disabled:!![]}:{state:"ready",text:e,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const e=document.createElement("div");e.classList.add("checkout-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),e.appendChild(o),e.appendChild(r),n.appendChild(e);const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,s,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var n;const e=t.find(t=>"checkout.presale"===t.path);if(null==e?void 0:e.value)return this.updateExpiresAt(e.value.expiresAt),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(n=null==i?void 0:i.value)||void 0===n?void 0:n.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,n=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const e=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&e>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&e<n&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var t,n;const e=[".drawer-content"];for(const o of e){const n=null===(t=this.rootElement)||void 0===t?void 0:t.closest(o);if(n&&this.isScrollable(n))return n}let i=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null}setScrolledState(t){var n,e;this.isCurrentlyScrolled=t,t?(null===(n=this.rootElement)||void 0===n?void 0:n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(e=this.rootElement)||void 0===e?void 0:e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(t){const n=window.getComputedStyle(t),e=n.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===e||"scroll"===e||"overlay"===e)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const n=new Date,e=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);this.initialDurationSeconds=Math.min(e,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,n=Math.max(0,this.expiresAt.getTime()-t.getTime()),e=n/1e3,i=this.initialDurationSeconds-e,o=Math.max(0,Math.min(100,i/this.initialDurationSeconds*100)),r=e<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;r!==this.isUnderOneMinute&&(this.isUnderOneMinute=r,this.updateWarningState()),this.updateTimerDisplay(n),this.updateProgressBar(o),0===n&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-timer]");n&&(n.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-progress-fill]");n&&(n.style.width=t+"%")}formatTime(t){const n=Math.floor(t/1e3),e=Math.floor(n/60),i=n%60,o=Math.floor(t%1e3/10);return e.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.showPresaleExpired())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const n=this.createTextContainer(),e=this.createProgressBar();return t.appendChild(n),t.appendChild(e),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const n=this.createHeader(),e=this.createSubtitle();return t.appendChild(n),t.appendChild(e),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const n=document.createElement("h2");n.textContent="LIMITED PRE-ORDER:";const e=document.createElement("div");return e.classList.add("checkout-presale-timer"),e.setAttribute("data-timer",""),e.textContent="00:00:00",t.appendChild(n),t.appendChild(e),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const n=document.createElement("div");return n.className="checkout-presale-progress-fill",n.setAttribute("data-progress-fill",""),n.style.width="0%",t.appendChild(n),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,n;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(n=this.params)||void 0===n?void 0:n.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown();const t=this.commands.checkout.getReturnUrl();if(t)return window.location.assign(t),void 0;this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const elements=[],t=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const e=document.createElement("div");e.classList.add("checkout-completed-title-section");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("p");r.classList.add("presale-expired-title");const s=document.createElement("p"),a=document.createElement("div");a.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(r.textContent="Items No Longer Available",s.textContent="The presale items you were trying to purchase are no longer available.",a.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(r.textContent="Session Expired",s.textContent="Your reservation time has ended. The item has been released for other customers.",a.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),o.appendChild(r),o.appendChild(s),e.appendChild(o),n.appendChild(e),n.appendChild(a),elements.push(n);const c=document.createElement("div");c.classList.add("checkout-completed-section-container");const l=document.createElement("button");l.setAttribute("aria-label","Continue shopping"),l.type="button";const d=document.createElement("span");d.textContent="Continue Shopping",l.setAttribute("tabindex","0"),l.setAttribute("role","button"),l.setAttribute("aria-label","Continue Shopping"),l.appendChild(d);const m=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:t.theme.selectedTextColor}));if(l.appendChild(m),l.addEventListener("click",()=>this.handleExit()),l.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),c.appendChild(l),elements.push(c),this.isTimeExpired()){const t=document.createElement("div");t.classList.add("checkout-completed-section-container");const n=document.createElement("p");n.classList.add("checkout-completed-auto-close-text"),n.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const e=document.createElement("span");e.classList.add("checkout-completed-auto-close-text"),e.textContent="seconds",t.appendChild(n),t.appendChild(this.autoCloseElement),t.appendChild(e),elements.push(t)}if(t.layout.showPoweredBy){const t=document.createElement("div");t.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});t.appendChild(n),elements.push(t)}return elements}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const n=t.find(t=>"checkout.promoCode"===t.path),e=t.find(t=>"checkout.loading"===t.path);if(n){const{value:t,oldValue:e}=n,i=Boolean(e),o=Boolean(t);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;o&&this.promoCodeText&&t.discount!==(null==e?void 0:e.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}e&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),n=t.length>=3&&t.length<=255,e=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),o=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||e||Boolean(i)||Boolean(o)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),e=this.promoInput;e.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const x=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",x),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),x())}),this.applyButton}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const e=document.createElement("button");e.type="button",e.classList.add("remove-button"),e.textContent="Remove",e.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(e),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const e=document.createElement("button");return e.type="button",e.classList.add("remove-button"),e.textContent="Remove",e.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(e),n}const elements=[];return elements.push(this.createPromoInput()),elements.push(this.createApplyButton()),elements}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const e=document.createElement("span");e.textContent="Send as Gift? (Free)",e.classList.add("gift-toggle-label"),n.appendChild(e);const i=document.createElement("span");i.textContent="With personalized note & gift receipt.",i.classList.add("gift-toggle-description"),n.appendChild(i);const o=document.createElement("div");o.classList.add("toggle-switch"),o.classList.toggle("active",t);const r=document.createElement("div");return r.classList.add("toggle-slider"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Toggle Gift Option"),o.setAttribute("role","switch"),o.setAttribute("aria-checked",t?"true":"false"),o.appendChild(r),o.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,o]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.L=null,this.R=null,this.M=![],this.j=![],this.N=![],this.B=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.L=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.L.create("payment",t.elementOptions),this.R.mount(this),this.R.on("change",async t=>{const n=!!t.error,e=t.complete,i=n?t.error.message:null;this.j=e,this.M||await this.updateStripeFormStatus({isFormComplete:e,isProcessing:![],hasCompletedPayment:![],errorMessage:i,hasError:n})}),this.R.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.N=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:n}=t.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var t,n;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.j)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.N&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),n=this.q.clientSecret,e=n.split("_secret_")[0];this.N=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:e},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(e){console.error("Payment submission error:",e),this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"Payment processing failed. Please try again."}),((null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.includes("expired"))||(null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((t,n)=>{const e=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",h),this.B=null,n(new Error("Session refresh timeout"))},1e4),h=()=>{clearTimeout(e),this.removeEventListener("lce:s:refreshSession",h),this.B=null,t()};this.addEventListener("lce:s:refreshSession",h,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.L&&this.L.update({clientSecret:this.q.clientSecret}),this.N=![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(xt){console.error("Failed to refresh payment session:",xt),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.j=![],this.N=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(xt){console.error("Failed to reset form:",xt)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.L)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.L.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const n={elements:this.L,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:e,confirmationToken:i}=await this.O.createConfirmationToken(n);if(e)throw new SDKError(e.message||"Failed to create confirmation token");if(!i||!i.id)throw new SDKError("Invalid confirmation token received");return i.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,n;try{this.B=null,this.R&&(this.R.unmount(),this.R=null),this.L&&(null===(n=(t=this.L).destroy)||void 0===n?void 0:n.call(t),this.L=null),this.O=null,this.M=![],this.j=![],this.N=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(e){console.warn("Error during Stripe form cleanup:",e)}}loadStripeJS(){return new Promise((t,n)=>{const e=document.querySelector('script[src*="stripe.com"]');if(e)return e.addEventListener("load",()=>t()),e.addEventListener("error",()=>n(new Error("Failed to load Stripe.js"))),void 0;const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.async=!![],i.onload=()=>t(),i.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const n of t)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(t){var n,e,i,o;(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.brand)&&(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(o=(i=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(i,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,n,e,i,o,r;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(i=(e=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(e,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(r=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===r||r.call(o,![]))}async afterRender(){var t,n,e,i;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const o=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==o?void 0:o.card)||void 0===n?void 0:n.brand)&&o.card.last4&&(this.savedCardInfo={brand:o.card.brand,last4:o.card.last4}),null===(i=(e=this.callbacks).onSavedCardInfoChanged)||void 0===i||i.call(e,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var n,e;this.stripeFormStatus=t.detail.status,null===(e=(n=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var n,e,i,o,r;try{const{confirmationTokenId:i,setupIntentId:o}=t.detail;await(null===(e=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===e?void 0:e.call(n,i,o)),this.isChangingPayment=![]}catch(s){this.logger.error("Failed to save payment form",s),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==s?void 0:s.message)||"Failed to save payment information. Please try again."},null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus),null===(r=this.stripeFormElement)||void 0===r||r.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const n=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.setAttribute("aria-label","Change Payment Method"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.addEventListener("click",()=>this.handleChangePayment()),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,n;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(t=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const elements=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",elements.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const t=document.createElement("slot");return t.setAttribute("name",_t),this.stripeFormContainer.appendChild(t),elements.push(this.stripeFormContainer),elements}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,n=null;for(;t&&t!==document.body;){const e=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),a="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(e||o&&r&&s&&a)return this.rootComponent=t,t;n=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),e=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"dark"===e.layout.poweredByMode?"night":"stripe",variables:{fontFamily:e.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:e.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===e.layout.inputFieldStyle?"none":"1px solid "+e.theme.accentColor,backgroundColor:"filled"===e.layout.inputFieldStyle?e.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,n,e;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const r=o.querySelectorAll('[slot="'+_t+'"]');if(r.length>0)for(const i of r)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",_t),o.appendChild(this.stripeFormElement)}catch(s){this.logger.error("Stripe form element creation failed",s),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(e=(n=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===o.ON_DEMAND)}getRetailerNameForFulfillment(t){const n=this.getStoreValue("checkout.items")||{},e=this.getStoreValue("checkout.retailers")||{},i=Object.values(n).find(n=>n.fulfillmentId===t);if(!i)return"Retailer";const o=e[i.retailerId];return(null==o?void 0:o.name)||"Retailer"}async handlePercentageSelect(t){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(t)}catch(e){this.logger.error("Checkout tips update failed",e)}}async handleFulfillmentTipInput(t,n){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const i=this.getOnDemandFulfillments();if(!i.find(n=>n.id===t))return;const o=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(t,o)}catch(r){this.logger.error("Checkout fulfillment tip update failed",r)}}async removeTipFromFulfillment(t){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const e=this.getOnDemandFulfillments();if(e.find(n=>n.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",i)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const n=[10,18,20],e=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const o of n){const n=document.createElement("button");n.type="button",n.textContent=o+"%",n.classList.add("checkout-tip-button"),n.disabled=e,i===o&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(o)),t.appendChild(n)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".retailers-tips-list");t&&n&&e&&t.addEventListener("click",()=>{const t=e.classList.contains("show");e.classList.toggle("show"),t?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const n=this.getOnDemandFulfillments();if(0===n.length)return t;const e=document.createElement("div");e.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),e.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),e.appendChild(o),t.appendChild(e);const r=document.createElement("div");r.classList.add("retailers-tips-list","show");for(const s of n){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=this.getRetailerNameForFulfillment(s.id),n.classList.add("checkout-sub-header"),t.appendChild(n);const e=document.createElement("div");e.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const o=document.createElement("span");o.classList.add("dollar-sign"),o.textContent="$";const a=document.createElement("input");let c;a.type="number",a.id="tip-input-"+s.id,a.name="tip-"+s.id,a.min="0",a.step="0.01",a.placeholder="0.00",a.classList.add("dollar-input"),a.value=s.amounts.tip>0?(s.amounts.tip/100).toFixed(2):"",a.disabled=this.getStoreValue("checkout.updating")||![],a.addEventListener("wheel",t=>{t.preventDefault()}),a.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),a.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),a.addEventListener("paste",t=>{t.preventDefault()}),a.addEventListener("contextmenu",t=>{t.preventDefault()}),a.addEventListener("input",t=>{const n=t.target;let e=n.value;if(Number.parseFloat(e)<0&&(n.value=Math.abs(Number.parseFloat(e)).toString(),e=n.value),e.includes(".")){const t=e.split(".");t.length>1&&t[1].length>2&&(n.value=t[0]+"."+t[1].substring(0,2))}}),a.addEventListener("input",t=>{const n=t.target,e=Number.parseFloat(n.value)||0;c&&clearTimeout(c),c=setTimeout(()=>{this.handleFulfillmentTipInput(s.id,e)},500)}),i.appendChild(o),i.appendChild(a),e.appendChild(i);const l=document.createElement("button");l.type="button",l.textContent="Remove",l.classList.add("checkout-tip-remove-button"),l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("click",()=>this.removeTipFromFulfillment(s.id)),e.appendChild(l),t.appendChild(e),r.appendChild(t)}return t.appendChild(r),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),n=this.getOnDemandFulfillments();if(t&&n.length>0){const i=n.every(t=>t.amounts.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}catch(e){this.logger.error("Default tip initialization failed",e),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",i),this.isInitialized=![]}}template(){const elements=[],t=this.getOnDemandFulfillments();if(0===t.length)return elements;t.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const e=document.createElement("h3");e.classList.add("checkout-sub-header"),e.textContent="Add a tip",n.appendChild(e);const i=document.createElement("div");i.classList.add("checkout-tip-config-container");const o=this.createTipSelectionButtons();i.appendChild(o),n.appendChild(i);const r=document.createElement("p");r.classList.add("checkout-tip-disclaimer"),r.textContent="Tips will be split proportionally between retailers.",n.appendChild(r);const s=this.createTipDistribution();return elements.push(n,s),elements}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var n,e;const i=t.find(t=>"checkout.giftCardError"===t.path),o=t.find(t=>"checkout.promoCodeError"===t.path),r=t.find(t=>"checkout.giftCards"===t.path);if(r&&this.updateAppliedGiftCards(r.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),i.value){const n=this.createErrorElement(i.value);t.after(n)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(i.value))}}if(o){const t=this.container.querySelector(".input-promo-code-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),o.value){const n=this.createErrorElement(o.value);t.after(n)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(o.value))}}}updateAppliedGiftCards(t){const n=t&&t.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",t.code);const e=document.createElement("span");e.textContent=t.code+" (- "+formatCentToDollarText(t.applied)+")",n.appendChild(e);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),n.appendChild(i),n}inputContainer(){var t;const n=this.getConfigs("checkout"),e=this.getConfigs("global"),o=n.layout.allowGiftCards,r=null===(t=null==e?void 0:e.layout)||void 0===t?void 0:t.allowPromoCodes,s=document.createElement("div");s.classList.add("checkout-pc-gc-sub-container");const a=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),c=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});r&&s.appendChild(a);const l=this.getStoreValue("checkout.promoCodeError");if(l){const t=this.createErrorElement(l);t.classList.add("promo-code-error-wrapper"),s.appendChild(t)}o&&s.appendChild(c);const d=this.getStoreValue("checkout.giftCardError");if(d){const t=this.createErrorElement(d);s.appendChild(t)}return s}createErrorElement(t){const n=document.createElement("div");n.classList.add("error-banner-checkout");const e=document.createElement("div");e.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),n.appendChild(e),n.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const elements=[];return elements.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)}),elements.push(this.appliedGiftCardsContainer)),elements}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:e,selectedSizeAttributes:i}){var r,s,a,c,l,d;const m=n===o.ON_DEMAND;let g=null;m&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=m&&t.hourStatus.isClosed?"closed":"",y=document.createElement("div");y.className="popup-retailer-card "+(e?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.id),y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-pressed",e?"true":"false");const b=n===o.SHIPPING?"Shipping":"Same-day delivery";y.setAttribute("aria-label",b+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const k=document.createElement("div");k.className="row";const E=document.createElement("span");E.className="name",E.textContent=t.retailerName,k.appendChild(E);const _=document.createElement("span");_.className="price",_.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0),k.appendChild(_),y.appendChild(k);const F=document.createElement("div");F.className="row";const D=document.createElement("span");D.className="expectation",D.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(l=null==i?void 0:i.presale)||void 0===l?void 0:l.isActive)&&(null===(d=null==i?void 0:i.presale)||void 0===d?void 0:d.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,F.appendChild(D);const T=document.createElement("span");if(T.className="fee",T.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",F.appendChild(T),y.appendChild(F),m){const n=document.createElement("div");n.className="row";const e=document.createElement("span");e.className="address",e.textContent=t.retailerAddressFormatted,n.appendChild(e),y.appendChild(n)}return y}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:n,shippingSelected:e,onDemandSelected:i,onTabClick:r,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=n.length>0,l=document.createElement("div");if(l.className="fulfillment-tabs-container",l.setAttribute("role","tablist"),l.setAttribute("aria-label","Delivery method options"),s){const n=document.createElement("div");n.className="fulfillment-tab "+(e?"selected":""),n.setAttribute("data-fulfillment-type",o.SHIPPING),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",e?"true":"false"),n.setAttribute("aria-label","Shipping, "+t.length+" options"),n.addEventListener("click",r),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())});const i=document.createElement("span");i.className="fulfillment-tab-label "+(e?"selected":""),i.textContent="Shipping ("+t.length+")",n.appendChild(i),l.appendChild(n)}if(a){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(c?"":"disabled"),t.setAttribute("data-fulfillment-type",o.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",i?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+n.length+" options"),c||t.setAttribute("aria-disabled","true"),t.addEventListener("click",r),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())});const e=document.createElement("span");e.className="fulfillment-tab-label "+(i?"selected":""),e.textContent="Same-Day Delivery ("+n.length+")",t.appendChild(e),l.appendChild(t)}return l}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const n=this.getProductId(),e=this.getStoreValue("products."+n);if(!e.selectedFulfillment||!e.selectedSizeId)return 0;const i=e.selectedFulfillment.variant.partNumber,o=e.selectedFulfillment.id,r=null===(t=e.sizes[e.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!r)return 0;const s=this.getStoreValue("cart.items")||{},a=Object.values(s).filter(t=>t.partNumber===i&&t.fulfillmentId===o),c=a.reduce((t,n)=>t+n.quantity,0);return r-c}isFulfillmentClosed(){const t=this.getProductId(),n=this.getStoreValue("products."+t);return n.selectedFulfillment?n.selectedFulfillmentType===o.ON_DEMAND&&n.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),n=this.getAvailableQuantity(),e=t<n;return{currentQuantity:t,availableQuantity:n,canIncrease:e,canDecrease:t>1}}async handleAddToCart(){var t,n,e;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:i,selectedSizeId:o.selectedSizeId}),void 0;const r=this.getSizeAttributes(),s=(null===(t=null==r?void 0:r.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(r);s&&a?await this.commands.product.addPresaleToCart(i,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(n=o.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:o.quantity,identifier:i}):await this.commands.product.addToCart(i,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(e=o.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:o.quantity,identifier:i})}async handleQuantityChange(t){const n=this.getProductId();await this.commands.product.updateQuantity(n,t)}calculateTotalPrice(){const t=this.getProductId(),n=this.getStoreValue("products."+t),e=n.selectedFulfillment,i=e.variant.price*n.quantity;return{quantity:n.quantity,totalPrice:i}}createQuantityContainer(t){const n=this.calculateQuantityLimits(),e=document.createElement("div");return e.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!n.canDecrease).toString()),n.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=n.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+n.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!n.canIncrease).toString()),n.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),e.appendChild(this.qtyDecreaseButton),e.appendChild(this.quantityText),e.appendChild(this.qtyIncreaseButton),e}getSizeAttributes(){const t=this.getProductId(),n=this.getStoreValue("products."+t+".selectedSizeId"),e=this.getStoreValue("products."+t+".sizes."+n);return(null==e?void 0:e.attributes)||{}}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),e=new Date;if(e.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:n}=this.calculateTotalPrice(),e=this.getSizeAttributes(),i=this.calculateQuantityLimits(),o=(null===(t=null==e?void 0:e.presale)||void 0===t?void 0:t.isActive)===!![],r=this.isPresaleActive(e),s=o?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?s+" - "+formatCentToDollarText(n):s;const a=o&&!r||0===i.availableQuantity||this.isFulfillmentClosed(),c=this.isButtonLoading(),l=this.config.layout.addToCartButtonShowTotalPrice?s+" for "+formatCentToDollarText(n):s;return this.addToCartButton.setAttribute("aria-label",l),this.addToCartButton.setAttribute("aria-busy",c.toString()),this.addToCartButton.setAttribute("aria-disabled",a.toString()),a&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),c&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),e=this.getConfigs("configurations");if(!n||!e.isElementsEnabled)return[];const elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);elements.push(t)}const i=this.createAddToCartButton();return elements.push(i),elements}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,n=this.getStoreValue("products."+t+".description"),e=this.getStoreValue("products."+t+".htmlDescription"),i="About this product:",o="See More",r="See Less",s=document.createElement("h3");s.className="title",s.textContent=i;const a=document.createElement("div");a.className="content collapsed",a.innerHTML=""===(null==e?void 0:e.trim())?n:sanitizeHTML(e);const c=document.createElement("span");c.className="collapse-button",c.textContent=o,c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Show more product information"),c.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,a.classList.toggle("collapsed"),c.textContent=this.isCollapsed?o:r,c.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),c.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return c.addEventListener("click",toggleContent),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[s,a,c]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var n;const e=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!e)return![];const i=e.value,o=i.isOpen,r=null===(n=i.contentConfig)||void 0===n?void 0:n.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const n=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:n}),void 0;const{type:e,data:i}=t||{},o=ComponentFactoryService.createElement({type:e,...i});this.contentContainer&&this.contentContainer.appendChild(o),this.open()}catch(e){this.logger.error("Failed to open product drawer",e),this.commands.product.closeProductDrawer(n)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay,n=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",t,n]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var n;const e=this.params.productId,i=t.find(t=>t.path==="products."+e+".selectedSizeId");if(null==i?void 0:i.value){const t=this.getStoreValue("products."+e),o=null===(n=null==t?void 0:t.sizes)||void 0===n?void 0:n[i.value],r=null==o?void 0:o.image;if(r){const t=this.params.images.indexOf(r);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+r+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let n=0;n<this.thumbnails.length;n++){const t=this.thumbnails[n];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(n)})}const t=this.container.querySelectorAll(".carousel-dot");for(let n=0;n<t.length;n++){const e=t[n];e.addEventListener("click",()=>this.selectImage(n))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var n,e;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(n=this.thumbnails[this.currentImageIndex])||void 0===n||n.classList.remove("selected"),null===(e=this.thumbnails[t])||void 0===e||e.classList.add("selected");const i=this.container.querySelectorAll(".carousel-dot");for(let o=0;o<i.length;o++){const n=i[o];n.classList.toggle("active",o===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const n=this.thumbnails[t],e=this.galleryViewport.offsetWidth,i=n.offsetLeft+n.offsetWidth/2,o=e/2,r=o-i,s=0,a=-(this.galleryContainer.scrollWidth-e);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupMainImageSwipe(){var t,n;let e=0,i=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{e=t.touches[0].clientX,i=t.touches[0].clientY},{passive:!![]}),null===(n=this.mainImageElement)||void 0===n||n.addEventListener("touchend",t=>{const n=t.changedTouches[0].clientX-e,o=t.changedTouches[0].clientY-i;Math.abs(n)>Math.abs(o)&&Math.abs(n)>50&&(n>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const n="touches"in t?t.touches[0].clientX:t.clientX,e=n-this.startX;Math.abs(e)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+e,o=0,r=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const elements=[],t=this.params.images.length>1,n=this.config.layout.showOnlyMainImage,e=document.createElement("div");if(e.className="main-image",e.title="Product main image",e.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",t&&!n){const t=document.createElement("div");t.className="carousel-dots";for(let n=0;n<this.params.images.length;n++){const e=document.createElement("button");e.type="button",e.className="carousel-dot "+(0===n?"active":""),e.setAttribute("data-index",n.toString()),t.appendChild(e)}e.appendChild(t)}if(this.mainImageElement=e,elements.push(e),!n){const t=document.createElement("div");t.className="gallery-viewport";const n=document.createElement("div");n.className="gallery-container";for(let e=0;e<this.params.images.length;e++){const t=this.params.images[e],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===e?"selected":"");const o=document.createElement("img");o.src=t,o.className="gallery-image",o.alt="Product thumbnail "+(e+1),o.loading="lazy",i.appendChild(o),n.appendChild(i)}t.appendChild(n),elements.push(t)}return elements}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var n;const e=this.getProductId();if(!t.some(t=>t.path==="products."+e+".selectedFulfillmentType"))return;const i=this.getStoreValue("products."+e),r=this.getConfigs("global");this.addPersonalizationSpan&&(i.selectedFulfillmentType===o.SHIPPING&&r.layout.enablePersonalization&&i.productHasAvailability&&(null===(n=null==i?void 0:i.selectedFulfillment)||void 0===n?void 0:n.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const e of n){const i=e.textContent||"",o=e.classList.contains("selected");e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select "+i),e.setAttribute("aria-pressed",o?"true":"false"),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),e.addEventListener("click",async()=>{var i;const o=e.dataset.sizeId;if(!o)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:e.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,o);for(const t of n)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");e.classList.add("selected"),e.setAttribute("aria-pressed","true");const r=this.getStoreValue("products."+t),s=this.getConfigs("global");this.addPersonalizationSpan&&(s.layout.enablePersonalization&&r.productHasAvailability&&(null===(i=r.selectedFulfillment)||void 0===i?void 0:i.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,n){const e=document.createElement("div");e.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",i.id="size-label",e.appendChild(i);const o=document.createElement("div");o.className="size-buttons-container",o.setAttribute("role","group"),o.setAttribute("aria-labelledby","size-label");for(const r of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",r.id),n.setAttribute("select-size",""),n.className="size-button "+(r.id===t?"selected":"");const e=r.packDesc?" ("+r.packDesc+")":"";n.textContent=""+r.size+e,o.appendChild(n)}return e.appendChild(o),e}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,n;const e=this.getProductId(),o=this.getStoreValue("products."+e),r=o.sizes[o.selectedSizeId],s=this.getConfigs("global"),elements=[],a=document.createElement("div");a.className="price-personalization-container";const c=ComponentFactoryService.createElement({type:i.PRODUCT_PRICE,productId:e});if(a.appendChild(c),s.layout.enablePersonalization&&o.productHasAvailability&&(null===(t=null==o?void 0:o.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=s.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",s.layout.personalizationText);const addPersonalization=async()=>{var t,n,r,s,a,c,l,d;const m=o.sizes[o.selectedSizeId];await this.commands.product.openProductDrawer(e,i.ENGRAVING_FORM,{identifier:e,context:"product",lines:[],maxLines:(null===(n=null===(t=m.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(s=null===(r=m.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(c=null===(a=m.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,location:null===(d=null===(l=m.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),a.appendChild(this.addPersonalizationSpan)}elements.push(a);const l=this.renderProductSizes(o.selectedSizeId,o.sizes);if(elements.push(l),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,productId:e});elements.push(t)}const d=ComponentFactoryService.createElement({type:i.PRODUCT_RETAILERS,productId:e});elements.push(d);const m=ComponentFactoryService.createElement({type:i.PRODUCT_ADD_TO_CART_SECTION,productId:e});elements.push(m);const g=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.presale;if((null==g?void 0:g.isActive)===!![]&&(null==g?void 0:g.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==g?void 0:g.language)||""),elements.push(t)}if(this.config.layout.showDescription&&(o.description.trim().length>0||o.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:i.PRODUCT_DESCRIPTION,productId:e});elements.push(t)}return elements}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:e,showQuantityCounter:i,fulfillmentDisplay:o,showImages:r,showOnlyMainImage:s}=this.config.layout,a=document.createElement("div");a.classList.add("product-content-wrapper");const c=document.createElement("div");if(c.classList.add("skeleton-container"),n){const t=document.createElement("div");t.classList.add("wave","sc-title"),c.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),c.appendChild(t),c}const l=document.createElement("div");l.classList.add("wave","sc-price"),c.appendChild(l);const d=document.createElement("div");d.classList.add("sc-sizes");const m=document.createElement("div");m.classList.add("wave","sc-size-button"),d.appendChild(m);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),d.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),d.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),d.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),d.appendChild(b),c.appendChild(d);const k=document.createElement("div");k.classList.add("sc-row");const E=document.createElement("div");E.classList.add("wave","sc-price"),k.appendChild(E);const _=document.createElement("div");_.classList.add("wave","sc-personalization"),k.appendChild(_),c.appendChild(k);const F=document.createElement("div");F.classList.add("wave","sc-deliver-to"),c.appendChild(F);const D=document.createElement("div");D.classList.add("wave","sc-address"),c.appendChild(D);const T=document.createElement("div");T.classList.add("wave","sc-retailers",o),c.appendChild(T);const A=document.createElement("div");if(A.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),A.appendChild(t)}const O=document.createElement("div");if(O.classList.add("wave","sc-add-to-cart"),A.appendChild(O),c.appendChild(A),e){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),c.appendChild(t);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),c.appendChild(n);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),c.appendChild(e);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),c.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-more"),c.appendChild(o)}const z=document.createElement("div");if(z.classList.add("product-content"),z.appendChild(c),a.appendChild(z),r){a.classList.add("has-images");const t=this.createImageSkeletons(s);a.prepend(t)}return a}createImageSkeletons(t){const n=document.createElement("div");n.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");if(e.classList.add("wave","sc-main-image"),e.title="Product main image loading",!t){const t=document.createElement("div");t.classList.add("carousel-dots");for(let n=0;n<3;n++){const n=document.createElement("div");n.classList.add("wave","sc-carousel-dot"),t.appendChild(n)}e.appendChild(t)}if(n.appendChild(e),!t){const t=document.createElement("div");t.classList.add("gallery-viewport");const e=document.createElement("div");e.classList.add("gallery-container");for(let n=0;n<4;n++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const n=document.createElement("div");n.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(n),e.appendChild(t)}t.appendChild(e),n.appendChild(t)}return n}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const n=this.getProductId(),e=t.find(t=>t.path==="products."+n+".drawer.isOpen");if(e){const t=e.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),n=this.getStoreValue("address.formattedAddress");if(n)return ComponentFactoryService.createElement({type:i.PRODUCT_INTERACTIONS,productId:this.getProductId()});const e=document.createElement("button");return e.type="button",e.className="product-options-open-address-button",e.textContent=this.config.layout.buyNowButtonText,e.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.ADDRESS_INPUT,{productId:t})}),e}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t);let e=n.noAvailabilityPrice;return n.selectedFulfillment&&(e=n.selectedFulfillment.variant.price),formatCentToDollarText(e)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),e=this.getConfigs("product"),elements=[],o=this.getConfigs("configurations");if(!n.productHasAvailability||!o.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),elements.push(t),elements}const r="carousel"===e.layout.fulfillmentDisplay?i.PRODUCT_RETAILERS_CAROUSEL:i.PRODUCT_RETAILERS_POPUP,s=ComponentFactoryService.createElement({type:r,productId:t});return elements.push(s),elements}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const n=this.getProductId(),e=t.find(t=>t.path==="products."+n+".selectedFulfillmentId");(null==e?void 0:e.value)&&this.updateSelectedCard(e.value)}updateSelectedCard(t){for(const e of this.retailerCards)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");const n=this.retailerCards.findIndex(n=>n.dataset.fulfillmentId===t);-1!==n&&(this.retailerCards[n].classList.add("selected"),this.retailerCards[n].setAttribute("aria-pressed","true"),this.scrollToIndex(n))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const n=this.retailerCards[t],e=this.listViewport.offsetWidth,i=n.offsetLeft+n.offsetWidth/2,o=e/2,r=o-i,s=0,a=-(this.listContainer.scrollWidth-e);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const n="touches"in t?t.touches[0].clientX:t.clientX,e=n-this.startX;Math.abs(e)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+e,o=0,r=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const n=this.getProductId(),e=t.currentTarget.dataset.fulfillmentType;if(!e)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,e)}async onRetailerCardClick(t){if(this.hasMoved)return;const n=this.getProductId(),e=t.currentTarget.dataset.fulfillmentId;if(!e)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const i=this.getStoreValue("products."+n+".selectedFulfillment");if(i&&i.id===e)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:n,fulfillmentId:e}),void 0;await this.commands.product.selectFulfillment(n,e)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:e,selectedSizeAttributes:i}){var r,s,a,c,l,d;const m=n===o.ON_DEMAND;let g=null;m&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=m&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",y=document.createElement("div");y.className="carousel-retailer-card "+(e?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.id),y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-pressed",e?"true":"false");const b=n===o.SHIPPING?"Shipping":"Same-day delivery";y.setAttribute("aria-label",b+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const k=document.createElement("div");k.className="retailer-header";const E=document.createElement("h3");if(E.className="name",E.textContent=t.retailerName,k.appendChild(E),m){const n=document.createElement("h3");n.className="address",n.textContent=t.retailerAddressFormatted,k.appendChild(n)}const _=document.createElement("div");_.className="retailer-body";const F=document.createElement("span");F.className="product-price",F.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0);const D=document.createElement("span");D.className="shipping-price",D.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const T=document.createElement("span");return T.className="expectation",T.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(l=null==i?void 0:i.presale)||void 0===l?void 0:l.isActive)&&(null===(d=null==i?void 0:i.presale)||void 0===d?void 0:d.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,_.append(F,D,T),y.append(k,_),y}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),e=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),i=(null==e?void 0:e.attributes)||null,r=[];for(const o in e.shippingFulfillments)Object.prototype.hasOwnProperty.call(e.shippingFulfillments,o)&&r.push(e.shippingFulfillments[o]);const s=[];for(const o in e.onDemandFulfillments)Object.prototype.hasOwnProperty.call(e.onDemandFulfillments,o)&&s.push(e.onDemandFulfillments[o]);const a=n.selectedFulfillmentType===o.SHIPPING,c=n.selectedFulfillmentType===o.ON_DEMAND,l=a?r:s,d=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===l.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[d,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const m of l){const t=this.generateRetailerCard({fulfillment:m,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:m.id===n.selectedFulfillmentId,selectedSizeAttributes:i}),e=n.selectedFulfillmentType===o.ON_DEMAND&&m.hourStatus.isClosed;e?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[d,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),e=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),r=(null==e?void 0:e.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,c=Object.values(e.shippingFulfillments),l=Object.values(e.onDemandFulfillments),d=(s?c.length:0)+(a?l.length:0),m=document.createElement("div");m.className="header";const g=document.createElement("span");g.className="header-label",g.textContent=n.selectedFulfillmentType===o.SHIPPING?"Shipping From:":"Delivering From:";const v=document.createElement("button");if(v.className="delivery-options",v.type="button",v.textContent="See Delivery Options ("+d+")",v.setAttribute("aria-label","View all "+d+" delivery options"),v.addEventListener("click",async()=>{0!==d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),m.appendChild(g),m.appendChild(v),!n.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,t]}const y=document.createElement("div");y.className="popup-fulfillment-list-container";const b=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:r});return y.appendChild(b),[m,y]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const n=this.getProductId(),e=t.currentTarget.dataset.fulfillmentType;if(!e)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,e)}async onRetailerCardClick(t){const n=this.getProductId(),e=t.currentTarget.dataset.fulfillmentId;if(!e)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const M=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(n),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},i=this.getStoreValue("products."+n+".selectedFulfillment");if(i&&i.id===e)return await M(),void 0;await this.commands.product.selectFulfillment(n,e),await M()}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),e=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),i=(null==e?void 0:e.attributes)||null,r=[];for(const o in e.shippingFulfillments)Object.prototype.hasOwnProperty.call(e.shippingFulfillments,o)&&r.push(e.shippingFulfillments[o]);const s=[];for(const o in e.onDemandFulfillments)Object.prototype.hasOwnProperty.call(e.onDemandFulfillments,o)&&s.push(e.onDemandFulfillments[o]);const a=n.selectedFulfillmentType===o.SHIPPING,c=n.selectedFulfillmentType===o.ON_DEMAND,l=a?r:s,d=document.createElement("h5");d.className="popup-retailers-section-title",d.textContent="Delivery Options";const m=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===l.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[d,m,t]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";for(const o of l){const t=renderPopupRetailerCard({fulfillment:o,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:o.id===n.selectedFulfillmentId,selectedSizeAttributes:i});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),g.appendChild(t)}return[d,m,g]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const n=this.getProductId(),e=t.find(t=>t.path==="products."+n+".drawer.isOpen"),i=t.find(t=>t.path==="products."+n+".rerender");e&&this.titleElement&&this.titleElement.classList.toggle("hide",e.value),(null==i?void 0:i.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const n=this.getProductId(),e=this.getStoreValue("products."+n);if(!e)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});if(e.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:i.PRODUCT});if(e.loading)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});const o=e.sizes[e.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper"),r.setAttribute("role","region"),r.setAttribute("aria-label",""+e.name);const s=document.createElement("div");if(s.classList.add("product-content"),s.setAttribute("role","region"),s.setAttribute("aria-label",""+e.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=e.name,this.titleElement=t,s.appendChild(t)}const a=ComponentFactoryService.createElement({type:i.PRODUCT_OPTIONS,productId:n});s.appendChild(a);const c=ComponentFactoryService.createElement({type:i.PRODUCT_DRAWER,productId:n});if(s.appendChild(c),r.appendChild(s),!this.config.layout.showImages||!(null===(t=e.images)||void 0===t?void 0:t.length))return r;r.classList.add("has-images");const l=ComponentFactoryService.createElement({type:i.PRODUCT_IMAGE_CAROUSEL,images:e.images,mainImage:o.image,productId:n});return r.prepend(l),l.setAttribute("aria-label","Product images"),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}function createApplyFiltersButton(t){const n=document.createElement("div");n.className="product-list-filters-apply-container";const e=document.createElement("button");return e.className="product-list-filters-apply-btn",e.textContent="Apply Filters",e.addEventListener("click",()=>t()),n.appendChild(e),n}function createCheckboxItem(t){const{filter:n,state:e,item:i,onChange:o}=t,r=document.createElement("div");r.className="checkbox-filter-item";const s=document.createElement("input");s.type="checkbox",s.id=n.type+"-"+i.value,s.value=i.value.toString(),s.className="checkbox-filter-checkbox",s.checked=e.selectedValues.has(i.value.toString()),s.addEventListener("change",o);const a=document.createElement("label");a.htmlFor=s.id,a.className="checkbox-filter-item-label";const c=i.count||0,l=document.createElement("span");l.className="checkbox-filter-item-text",l.textContent=i.name;const d=document.createElement("span");return d.className="checkbox-filter-item-count",d.textContent="("+c+")",a.appendChild(l),a.appendChild(d),r.appendChild(s),r.appendChild(a),r}function handleCheckboxFilterSearch(t){const{filter:n,state:e,searchTerm:i,renderCheckboxItems:o}=t,r=i.toLowerCase().trim();e.filteredItems=r?n.values.filter(t=>{const n=(t.name||t.value.toString()).toLowerCase();return n.includes(r)}):[...n.values],o()}function createCheckboxFilterHeader(t){const{filter:n,state:e,onToggle:i}=t,o=document.createElement("div");o.className="checkbox-filter-header";const r=document.createElement("button");r.className="checkbox-filter-label",r.type="button";const s=document.createElement("span");s.textContent=formatFilterLabel(n.type);const a=document.createElement("span");return a.className="checkbox-filter-toggle-icon "+(e.isExpanded?"expanded":"collapsed"),a.innerHTML=e.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),e.iconElement=a,r.appendChild(s),r.appendChild(a),r.addEventListener("click",()=>i(n.type)),o.appendChild(r),o}function createCheckboxFilterSearchContainer(t){const{state:n,onSearch:e}=t,i=document.createElement("div");i.className="checkbox-filter-search-wrapper",n.searchInput=document.createElement("input"),n.searchInput.type="text",n.searchInput.className="checkbox-filter-search",n.searchInput.placeholder="Search";const o=document.createElement("span");return o.className="checkbox-filter-search-icon",o.innerHTML=SearchIcon({}),n.searchInput.addEventListener("input",t=>{const n=t.target;e(n.value)}),i.appendChild(n.searchInput),i.appendChild(o),i}function renderCheckboxItems(t){const{filter:n,state:e,onCheckboxChange:i}=t;if(e.checkboxList&&(e.checkboxList.innerHTML="",e.filteredItems.forEach(t=>{const o=createCheckboxItem({filter:n,state:e,item:t,onChange:()=>{const n=o.querySelector("input");i(t.value.toString(),n.checked)}});e.checkboxList.appendChild(o)}),0===e.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",e.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createChip(t){const{text:n,onRemove:e}=t,i=document.createElement("div");i.className="chip";const o=document.createElement("span");o.className="chip-text",o.textContent=n,i.appendChild(o);const r=document.createElement("button");return r.className="chip-close",r.type="button",r.innerHTML=CloseIcon({width:16,height:16}),r.setAttribute("aria-label","Remove"),e&&r.addEventListener("click",t=>{t.stopPropagation(),e()}),i.appendChild(r),i}function createChipsContainer(t){const{currentFilters:n,sanitizedFilters:e,onRemoveFilter:i,onClearAllFilters:o}=t,r=document.createElement("div");r.className="product-list-filters-chips-container";const s=getActiveFilters(n,e);if(0===s.length)return r.style.display="none",r;if(r.style.display="flex",s.forEach(t=>{const n=createChip({text:t.label,onRemove:()=>i(t.key,t.value)});r.appendChild(n)}),s.length>0){const t=createClearAllButton(o);r.appendChild(t)}return r}function getActiveFilters(t,n){const e=[];return addBooleanFilters(e,t),addDeliveryFilter(e,t),addPriceFilter(e,t),addDynamicFilters(e,t,n),e}function addBooleanFilters(t,n){(null==n?void 0:n[wt.ENGRAVING])&&t.push({key:d.ENGRAVING,value:"true",label:"Engravable"}),(null==n?void 0:n[wt.PRESALE])&&t.push({key:d.PRESALE,value:"true",label:"Presale"})}function addDeliveryFilter(t,n){if(!(null==n?void 0:n.fulfillment)||(null==n?void 0:n.fulfillment)===kt.ALL)return;const e=(null==n?void 0:n.fulfillment)===kt.ON_DEMAND?"Same-day Delivery":"Shipping";t.push({key:d.FULFILLMENT,value:null==n?void 0:n.fulfillment.toString(),label:e})}function addPriceFilter(t,n){const e=null==n?void 0:n.price;if(!e)return;const i=e.min&&e.min!==Ct.MIN,o=e.max&&e.max!==Ct.MAX;if(!i&&!o)return;const r=i?"$"+e.min:"$0",s=o?"$"+e.max:"$"+Ct.MAX+"+";t.push({key:d.PRICE,value:"price",label:r+" - "+s})}function addDynamicFilters(t,n,e){if(!n)return;const i=getDynamicFilterKeys(n);for(const o of i)addDynamicFilterChips(o,t,n,e)}function getDynamicFilterKeys(t){const n=[wt.ENGRAVING,wt.PRESALE,wt.FULFILLMENT,wt.PRICE];return Object.keys(t).filter(t=>!n.includes(t))}function addDynamicFilterChips(t,n,e,i){const o=e[t];if(!Array.isArray(o)||0===o.length)return;const r=null==i?void 0:i.find(n=>n.type===t);o.forEach(e=>{const i=null==r?void 0:r.values.find(t=>t.value.toString()===e),o=(null==i?void 0:i.name)||e;n.push({key:t,value:e,label:o})})}function createClearAllButton(t){const n=document.createElement("button");return n.className="product-list-filters-clear-all",n.textContent="CLEAR ALL FILTERS",n.type="button",n.addEventListener("click",()=>{t()}),n}function createFulfillmentFilter(t){const{currentFilters:n,deliveryCollapsed:e,isSameDayDeliveryDisabled:i,onFulfillmentOptionsChange:o,onToggleCollapse:r}=t,elements=[],s=document.createElement("div");s.className="product-list-filters-fulfillment-options";const a=[{value:kt.ALL,label:"All"},{value:kt.SHIPPING,label:"Shipping"},{value:kt.ON_DEMAND,label:"Same-Day Delivery"}],c=document.createElement("div");c.className="product-list-filters-fulfillment-options-header",c.style.cursor="pointer";const l=document.createElement("h3");l.className="product-list-filters-fulfillment-options-label",l.textContent="Fulfillment Options";const d=document.createElement("div");d.className="product-list-filters-chevron",d.innerHTML=e?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),c.appendChild(l),c.appendChild(d),s.appendChild(c);const m=document.createElement("div");m.className="product-list-filters-fulfillment-options-list",e&&m.classList.add("collapsed");for(const g of a){const t=document.createElement("div");t.className="product-list-filters-fulfillment-option";const e=document.createElement("input");e.type="radio",e.id="fulfillment-"+g.value,e.name="fulfillment-options",e.value=g.value,e.className="product-list-filters-fulfillment-radio";const r="onDemand"===g.value&&i;e.disabled=r;const s=(null==n?void 0:n.fulfillment)||kt.ALL;e.checked=g.value===s,e.addEventListener("change",t=>{const n=t.target;null==o?void 0:o(n.value)});const a=document.createElement("label");a.htmlFor="fulfillment-"+g.value,a.className="product-list-filters-fulfillment-radio-label "+(r?"disabled":""),a.textContent=g.label,t.appendChild(e),t.appendChild(a),m.appendChild(t)}return s.appendChild(m),c.addEventListener("click",()=>{r()}),elements.push(s),{elements,chevronContainer:d,fulfillmentList:m}}function createPriceFilter(t){var n,e,i,o,r,s,a,c;const{priceConfig:l,currentFilters:d,priceCollapsed:m,onPriceChange:g,onToggleCollapse:v,DEFAULT_MIN:y,DEFAULT_MAX:b}=t,elements=[],k=document.createElement("div");k.className="product-list-filters-price";const E=Number.parseInt(null!==(n=null==l?void 0:l.min)&&void 0!==n?n:y,10),_=Number.parseInt(null!==(e=null==l?void 0:l.max)&&void 0!==e?e:b,10),F=Number.parseInt(null!==(r=null!==(o=null===(i=null==d?void 0:d.price)||void 0===i?void 0:i.min)&&void 0!==o?o:null==l?void 0:l.min)&&void 0!==r?r:y,10),D=Number.parseInt(null!==(c=null!==(a=null===(s=null==d?void 0:d.price)||void 0===s?void 0:s.max)&&void 0!==a?a:null==l?void 0:l.max)&&void 0!==c?c:b,10),T=document.createElement("div");T.className="product-list-filters-price-header",T.style.cursor="pointer";const A=document.createElement("h3");A.className="product-list-filters-price-title",A.textContent="Price Range",T.appendChild(A);const O=document.createElement("div");O.className="product-list-filters-chevron",O.innerHTML=m?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),T.appendChild(O),k.appendChild(T);const z=document.createElement("div");z.className="product-list-filters-price-slider-container",m&&z.classList.add("collapsed");const L=document.createElement("div");L.className="product-list-filters-price-range-wrapper";const R=document.createElement("div");R.className="product-list-filters-price-track";const j=document.createElement("div");j.className="product-list-filters-price-track-active",R.appendChild(j),L.appendChild(R);const q=document.createElement("input");q.type="range",q.min=E.toString(),q.max=_.toString(),q.value=F.toString(),q.step="1",q.className="product-list-filters-price-range product-list-filters-price-range-min",L.appendChild(q);const H=document.createElement("input");H.type="range",H.min=E.toString(),H.max=_.toString(),H.value=D.toString(),H.step="1",H.className="product-list-filters-price-range product-list-filters-price-range-max",L.appendChild(H),z.appendChild(L);const Y=document.createElement("div");Y.className="product-list-filters-price-inputs-container";const Q=document.createElement("div");Q.className="product-list-filters-price-input-wrapper";const W=document.createElement("span");W.className="product-list-filters-price-input-prefix",W.textContent="$";const Z=document.createElement("input");Z.type="number",Z.min=E.toString(),Z.max=_.toString(),Z.value=F.toString(),Z.className="product-list-filters-price-input",Z.placeholder=E.toString(),Q.appendChild(W),Q.appendChild(Z);const X=document.createElement("span");X.className="product-list-filters-price-separator",X.textContent="to";const J=document.createElement("div");J.className="product-list-filters-price-input-wrapper";const $=document.createElement("span");$.className="product-list-filters-price-input-prefix",$.textContent="$";const tt=document.createElement("input");tt.type="number",tt.min=E.toString(),tt.max=_.toString(),tt.value=D.toString(),tt.className="product-list-filters-price-input",tt.placeholder=_+"+",J.appendChild($),J.appendChild(tt),Y.appendChild(Q),Y.appendChild(X),Y.appendChild(J),z.appendChild(Y),k.appendChild(z);const K=()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(H.value,10),e=_-E,i=(t-E)/e*100,o=(n-E)/e*100;j.style.left=i+"%",j.style.width=o-i+"%"},f=(t,n)=>{q.value=t.toString(),H.value=n.toString(),Z.value=t.toString(),tt.value=n.toString(),K()};return q.addEventListener("input",()=>{let t=Number.parseInt(q.value,10);const n=Number.parseInt(H.value,10);t>n&&(t=n),f(t,n)}),q.addEventListener("change",()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(H.value,10);null==g?void 0:g(t.toString(),n.toString())}),H.addEventListener("input",()=>{const t=Number.parseInt(q.value,10);let n=Number.parseInt(H.value,10);n<t&&(n=t),f(t,n)}),H.addEventListener("change",()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(H.value,10);null==g?void 0:g(t.toString(),n.toString())}),Z.addEventListener("input",()=>{let t=Number.parseInt(Z.value,10)||E;const n=Number.parseInt(tt.value,10)||_;t=Math.max(E,Math.min(t,_)),t>n&&(t=n),f(t,n),null==g||g(t.toString(),n.toString())}),tt.addEventListener("input",()=>{const t=Number.parseInt(Z.value,10)||E;let n=Number.parseInt(tt.value,10)||_;n=Math.max(E,Math.min(n,_)),n<t&&(n=t),f(t,n),null==g||g(t.toString(),n.toString())}),K(),T.addEventListener("click",()=>{v()}),elements.push(k),{elements,chevronContainer:O,sliderContainer:z}}function createEngravingFilter(t){const{currentFilters:n,isPersonalizationDisabled:e,onEngravingChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-engraving";const r=document.createElement("label");r.className="product-list-filters-engraving-label",r.setAttribute("for","engraving-switch"),r.textContent="Engraved Bottles",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==n?void 0:n.engraving);a&&s.classList.add("active");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="engraving-switch",s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Toggle Engraved Bottles"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.appendChild(c);const I=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},p=()=>{const t=s.classList.contains("active"),n=!t;I(n),null==i||i(n)};if(s.addEventListener("click",()=>{e||p()}),s.addEventListener("keydown",t=>{e||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),o.appendChild(s),e){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}function createPresaleFilter(t){const{currentFilters:n,isPresaleDisabled:e,onPresaleChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-presale";const r=document.createElement("label");r.className="product-list-filters-presale-label",r.setAttribute("for","presale-switch"),r.textContent="Presale",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==n?void 0:n.presale);a&&s.classList.add("active"),e&&s.classList.add("disabled");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="presale-switch",s.setAttribute("tabindex",e?"-1":"0"),s.setAttribute("aria-label","Toggle Presale"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.setAttribute("aria-disabled",e?"true":"false"),s.appendChild(c);const I=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},p=()=>{const t=s.classList.contains("active"),n=!t;I(n),null==i||i(n)};if(s.addEventListener("click",()=>{e||p()}),s.addEventListener("keydown",t=>{e||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),o.appendChild(s),e){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const n=document.createElement("div");n.classList.add("slc__card");const e=document.createElement("div");e.className="slc__image-content";const i=document.createElement("div");i.className="slc__image-wrapper";const o=document.createElement("div");o.classList.add("wave","slc__image"),i.appendChild(o),e.appendChild(i);const r=document.createElement("div");r.className="slc__content";const s=document.createElement("div");s.className="slc__title-container";const a=document.createElement("div");a.classList.add("wave","slc__title","slc__title-line-1"),s.appendChild(a);const c=document.createElement("div");c.classList.add("wave","slc__title","slc__title-line-2"),s.appendChild(c),r.appendChild(s);const l=document.createElement("div");l.className="slc__size-price-wrapper";const d=document.createElement("div");d.classList.add("wave","slc__price"),l.appendChild(d);const m=document.createElement("div");m.classList.add("wave","slc__size"),l.appendChild(m),r.appendChild(l);const g=document.createElement("div");return g.classList.add("wave","slc__button"),n.appendChild(e),n.appendChild(r),n.appendChild(g),n}template(){const elements=[],t=100/this.params.columns;this.container.style.setProperty("--card-width",t+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let e=0;e<n;e++){const t=this.createSkeletonCard(e);elements.push(t)}return elements}}class ProductListEngravingComponent extends BaseComponent{template(){const t=document.createElement("div");t.className="engraving-popup-wrapper",t.appendChild(this.createHeader());const n=ComponentFactoryService.createElement({type:i.ENGRAVING_FORM,identifier:this.params.identifier,context:"product-list",lines:[],maxLines:this.params.maxLines,maxCharsPerLine:this.params.maxCharsPerLine,fee:this.params.fee,location:this.params.location});return t.appendChild(n),t}createHeader(){const t=window.innerWidth,n=document.createElement("div");n.className="engraving-popup-header";const e=document.createElement("h5");e.className="engraving-popup-title",e.textContent="Personalize Your Product",n.appendChild(e);const i=document.createElement("button");return i.className="engraving-popup-close",i.innerHTML=CloseIcon({}),i.addEventListener("click",()=>{t>g&&this.commands.ui.closeModal(),this.commands.ui.closeDrawer()}),n.appendChild(i),n}}const FilterIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 24 24" class="filter-icon '+e+'" style="'+o+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};class ProductListFiltersComponent extends BaseComponent{constructor(){super({watchStorePaths:["address","address.formattedAddress","productsList.filters","productsList.appliedFilters"]}),this.DEFAULT_MIN_PRICE=Ct.MIN,this.DEFAULT_MAX_PRICE=Ct.MAX,this.FILTER_DEBOUNCE_DELAY_MS=500,this.isRenderedInDrawerMode=![],this.permanentFilters={price:{min:Ct.MIN,max:Ct.MAX},fulfillment:kt.ALL,presale:![],engraving:![]},this.availableDynamicFilters=[],this.checkboxFilterStateMap=new Map,this.isPriceFilterCollapsed=![],this.isFulfillmentFilterCollapsed=![],this.appliedFiltersChipsContainer=null,this.resizeHandler=null,this.priceFilterDebounceTimer=null}get hostClasses(){const t=["product-list-filters-container"];return this.isRenderedInDrawerMode&&t.push("drawer-mode"),t}async connected(){this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.setupResizeListener(),this.setupDrawerCloseListener(),this.syncFiltersFromStore(),this.onStoreWatch()}setupDrawerCloseListener(){document.addEventListener("drawerClosed",()=>{this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.isRenderedInDrawerMode||(this.syncFiltersFromStore(),this.refreshUIStates())})}setupResizeListener(){this.resizeHandler=()=>{const t=window.innerWidth;t>=g&&(this.commands.ui.closeDrawer(),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.syncFiltersFromStore(),this.refreshUIStates())},window.addEventListener("resize",this.resizeHandler)}detectIfRenderedInDrawer(){var t,n,e;let i=this.parentElement;for(;i;){if((null===(t=i.classList)||void 0===t?void 0:t.contains("drawer"))||(null===(n=i.hasAttribute)||void 0===n?void 0:n.call(i,"data-drawer"))||"drawer-component"===(null===(e=i.tagName)||void 0===e?void 0:e.toLowerCase()))return!![];i=i.parentElement}return![]}onStoreWatch(){const{filters:t}=this.getStoreValue("productsList");t&&Array.isArray(t)&&t.length>0&&(this.availableDynamicFilters=t),this.syncFiltersFromStore(),this.refreshUIStates()}syncFiltersFromStore(){const{appliedFilters:t}=this.getStoreValue("productsList");if(t){const n={};for(const[e,i]of Object.entries(t))n[e]=this.transformFilterValue(e,i);this.permanentFilters={price:{min:Ct.MIN,max:Ct.MAX},fulfillment:kt.ALL,presale:![],engraving:![],...n},this.checkboxFilterStateMap.clear()}}refreshUIStates(){!this.isRenderedInDrawerMode&&this.appliedFiltersChipsContainer&&(this.appliedFiltersChipsContainer.innerHTML="",this.appliedFiltersChipsContainer.appendChild(this.buildAppliedFiltersChipsContainer())),this.engravingFiltersContainer&&(this.engravingFiltersContainer.innerHTML="",this.buildEngravingFilterElements().forEach(t=>{var n;null===(n=this.engravingFiltersContainer)||void 0===n?void 0:n.appendChild(t)})),this.presaleFilterContainer&&(this.presaleFilterContainer.innerHTML="",this.buildPresaleFilterElements().forEach(t=>{var n;null===(n=this.presaleFilterContainer)||void 0===n?void 0:n.appendChild(t)})),this.dynamicFiltersContainer&&(this.dynamicFiltersContainer.innerHTML="",this.buildDynamicFiltersElements().forEach(t=>{var n;null===(n=this.dynamicFiltersContainer)||void 0===n?void 0:n.appendChild(t)}))}transformFilterValue(t,n){if(t===wt.ENGRAVING||t===wt.PRESALE)return Array.isArray(n)?"true"===n[0]:"true"===n;if(t===wt.FULFILLMENT)return Array.isArray(n)?n[0]:n;if(t!==wt.PRICE)return n;if(Array.isArray(n)&&n[0])try{return JSON.parse(n[0])}catch(e){this.logger.error("Error fetching products with updated filters:",e)}}async fetchFilters(){const{searchTerm:t}=this.getStoreValue("productsList");try{this.store.set("productsList.loading",!![]),this.store.batch({"productsList.products":[],"productsList.retailers":{}}),this.commands.productList.syncFiltersFromComponent(this.permanentFilters),await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),t,this.permanentFilters,this.params.filters);const{filters:n}=this.getStoreValue("productsList");this.availableDynamicFilters=n}catch(n){throw this.logger.error("Error fetching products with updated filters:",n),this.store.set("productsList.loading",![]),n}}async applyFiltersAndCloseDrawer(){await this.fetchFilters(),this.syncFiltersFromStore(),this.commands.ui.closeDrawer()}template(){const t=[];if(!this.isRenderedInDrawerMode){this.filterButtonContainer=document.createElement("div"),this.filterButtonContainer.className="product-list-filter-button-host";const n=this.getStoreValue("productsList"),e=null==n?void 0:n.filters;(null==e?void 0:e.length)>0&&this.filterButtonContainer.appendChild(this.buildFilterButton()),t.push(this.filterButtonContainer)}const n=document.createElement("div");n.className=this.isRenderedInDrawerMode?"product-list-filters-content-wrapper drawer-mode":"product-list-filters-content-wrapper";const e=this.buildFilterHeader();n.appendChild(e),this.appliedFiltersChipsContainer=this.buildAppliedFiltersChipsContainer(),n.appendChild(this.appliedFiltersChipsContainer),this.engravingFiltersContainer=document.createElement("div"),this.engravingFiltersContainer.className="product-list-engraving-filters-container";const i=this.buildEngravingFilterElements();for(const c of i)this.engravingFiltersContainer.appendChild(c);n.appendChild(this.engravingFiltersContainer),this.presaleFilterContainer=document.createElement("div"),this.presaleFilterContainer.className="product-list-presale-filters-container";const o=this.buildPresaleFilterElements();for(const c of o)this.presaleFilterContainer.appendChild(c);n.appendChild(this.presaleFilterContainer),this.fulfillmentFilterContainer=document.createElement("div"),this.fulfillmentFilterContainer.className="product-list-fulfillment-filters-container";const r=this.buildFulfillmentFilterElements();for(const c of r)this.fulfillmentFilterContainer.appendChild(c);n.appendChild(this.fulfillmentFilterContainer),this.priceFiltersContainer=document.createElement("div"),this.priceFiltersContainer.className="product-list-price-filters-container";const s=this.buildPriceFilterElements();for(const c of s)this.priceFiltersContainer.appendChild(c);n.appendChild(this.priceFiltersContainer),this.dynamicFiltersContainer=document.createElement("div"),this.dynamicFiltersContainer.className="product-list-dynamic-filters-container";const a=this.buildDynamicFiltersElements();for(const c of a)this.dynamicFiltersContainer.appendChild(c);return n.appendChild(this.dynamicFiltersContainer),this.isRenderedInDrawerMode&&n.appendChild(createApplyFiltersButton(()=>{void this.applyFiltersAndCloseDrawer()})),t.push(n),t}buildFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const n=document.createElement("div");n.className="product-list-filter-icon",n.innerHTML=FilterIcon({}),n.style.cursor="pointer",n.addEventListener("click",()=>{this.openFilterDrawer()});const e=document.createElement("span");return e.className="product-list-filter-text",e.textContent="Filter",e.style.cursor="pointer",e.addEventListener("click",()=>{this.openFilterDrawer()}),t.appendChild(n),t.appendChild(e),t}openFilterDrawer(){this.commands.ui.openDrawer(i.PRODUCT_LIST_FILTERS,{filters:this.params.filters||[]})}buildFilterHeader(){const t=document.createElement("div");t.className="product-list-filters-header",this.isRenderedInDrawerMode&&t.classList.add("drawer-mode");const n=document.createElement("h3");if(n.className="product-list-filters-title",n.textContent="Filters",t.appendChild(n),this.isRenderedInDrawerMode){const n=document.createElement("button");n.className="product-list-filters-close-btn",n.innerHTML=CloseIcon({}),n.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),t.appendChild(n)}return t}async clearAllActiveFilters(){this.permanentFilters={price:{min:Ct.MIN,max:Ct.MAX},fulfillment:kt.ALL,presale:![],engraving:![]},await this.fetchFilters()}async removeSingleFilter(t,n){switch(t){case d.ENGRAVING:this.permanentFilters[wt.ENGRAVING]=![];break;case d.PRESALE:this.permanentFilters[wt.PRESALE]=![];break;case d.FULFILLMENT:this.permanentFilters[wt.FULFILLMENT]=kt.ALL;break;case d.PRICE:delete this.permanentFilters.price;break;default:{const e=this.checkboxFilterStateMap.get(t);if(e){e.selectedValues.delete(n);const i=Array.from(e.selectedValues);i.length>0?this.permanentFilters[t]=i:delete this.permanentFilters[t]}break}}await this.fetchFilters()}getFilteredAndSanitizedFilters(){return this.params.filters&&0!==this.params.filters.length?this.commands.productList.getSanitizedFilters(this.availableDynamicFilters,this.params.filters):[]}buildAppliedFiltersChipsContainer(){return createChipsContainer({currentFilters:this.permanentFilters,sanitizedFilters:this.getFilteredAndSanitizedFilters(),onRemoveFilter:(t,n)=>this.removeSingleFilter(t,n),onClearAllFilters:()=>this.clearAllActiveFilters()})}async handleFilterChange(){this.commands.productList.syncFiltersFromComponent(this.permanentFilters),this.isRenderedInDrawerMode||await this.fetchFilters()}isEngravingCurrentlyDisabled(){return this.permanentFilters[wt.FULFILLMENT]===kt.ON_DEMAND}buildEngravingFilterElements(){return createEngravingFilter({currentFilters:this.permanentFilters,isPersonalizationDisabled:this.isEngravingCurrentlyDisabled(),onEngravingChange:async t=>{this.permanentFilters[wt.ENGRAVING]=t,await this.handleFilterChange()}})}buildPresaleFilterElements(){return createPresaleFilter({currentFilters:this.permanentFilters,isPresaleDisabled:this.permanentFilters[wt.FULFILLMENT]===kt.ON_DEMAND,onPresaleChange:async t=>{this.permanentFilters[wt.PRESALE]=t,await this.handleFilterChange()}})}isSameDayDeliveryCurrentlyDisabled(){return!(!this.permanentFilters[wt.ENGRAVING]&&!this.permanentFilters[wt.PRESALE])}toggleFulfillmentFilterCollapse(){this.isFulfillmentFilterCollapsed=!this.isFulfillmentFilterCollapsed,this.fulfillmentOptionsList&&this.fulfillmentOptionsList.classList.toggle("collapsed"),this.fulfillmentFilterChevronIcon&&(this.fulfillmentFilterChevronIcon.innerHTML=this.isFulfillmentFilterCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}buildFulfillmentFilterElements(){const t=createFulfillmentFilter({currentFilters:this.permanentFilters,deliveryCollapsed:this.isFulfillmentFilterCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryCurrentlyDisabled(),onFulfillmentOptionsChange:async t=>{this.permanentFilters[wt.FULFILLMENT]=t,t===kt.ON_DEMAND&&(this.permanentFilters[wt.ENGRAVING]=![],this.permanentFilters[wt.PRESALE]=![]),await this.handleFilterChange()},onToggleCollapse:()=>this.toggleFulfillmentFilterCollapse()});return this.fulfillmentFilterChevronIcon=t.chevronContainer,this.fulfillmentOptionsList=t.fulfillmentList,t.elements}togglePriceFilterCollapse(){this.isPriceFilterCollapsed=!this.isPriceFilterCollapsed,this.priceSliderWrapper&&this.priceSliderWrapper.classList.toggle("collapsed"),this.priceFilterChevronIcon&&(this.priceFilterChevronIcon.innerHTML=this.isPriceFilterCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}buildPriceFilterElements(){const t=createPriceFilter({priceConfig:{min:Ct.MIN,max:Ct.MAX},currentFilters:this.permanentFilters,priceCollapsed:this.isPriceFilterCollapsed,onPriceChange:async(t,n)=>{this.permanentFilters.price||(this.permanentFilters.price={}),t!==Ct.MIN?this.permanentFilters.price.min=t:delete this.permanentFilters.price.min,n!==Ct.MAX?this.permanentFilters.price.max=n:delete this.permanentFilters.price.max,this.priceFilterDebounceTimer&&clearTimeout(this.priceFilterDebounceTimer),this.isRenderedInDrawerMode||(this.priceFilterDebounceTimer=setTimeout(async()=>{await this.handleFilterChange()},this.FILTER_DEBOUNCE_DELAY_MS))},onToggleCollapse:()=>this.togglePriceFilterCollapse(),DEFAULT_MIN:this.DEFAULT_MIN_PRICE,DEFAULT_MAX:this.DEFAULT_MAX_PRICE});return this.priceFilterChevronIcon=t.chevronContainer,this.priceSliderWrapper=t.sliderContainer,t.elements}buildDynamicFiltersElements(){const elements=[],t=this.getFilteredAndSanitizedFilters(),n=new Set([wt.ENGRAVING,wt.PRESALE,wt.FULFILLMENT]);for(const e of t)if(!n.has(e.type)){const t=this.getFilterElements(e);elements.push(...t)}return elements}getFilterElements(t){return this.buildCheckboxFilterElements(t)}buildCheckboxFilterElements(t){const elements=[];if(!this.checkboxFilterStateMap.has(t.type)){const n=this.permanentFilters[t.type],e=Array.isArray(n)?new Set(n):new Set;this.checkboxFilterStateMap.set(t.type,{isExpanded:e.size>0,selectedValues:e,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:e.size>0})}const n=this.checkboxFilterStateMap.get(t.type);n.filteredItems=[...t.values];const e=document.createElement("div");e.className="product-list-checkbox-filter",e.setAttribute("data-filter-category",t.type);const i=document.createElement("div");i.className="checkbox-filter-container";const o=createCheckboxFilterHeader({filter:t,state:n,onToggle:t=>this.toggleCheckboxFilterExpansion(t)});i.appendChild(o);const r=document.createElement("div");r.className="checkbox-filter-content "+(n.isExpanded?"expanded":"collapsed"),n.contentElement=r;const s=createCheckboxFilterSearchContainer({state:n,onSearch:e=>{handleCheckboxFilterSearch({filter:t,state:n,searchTerm:e,renderCheckboxItems:()=>this.renderCheckboxItemsForFilter(t,n)})}});return r.appendChild(s),n.checkboxList=document.createElement("div"),n.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsForFilter(t,n),r.appendChild(n.checkboxList),i.appendChild(r),e.appendChild(i),elements.push(e),elements}toggleCheckboxFilterExpansion(t){const n=this.checkboxFilterStateMap.get(t);n&&(n.isExpanded=!n.isExpanded,n.hasUserInteraction=!![],updateFilterExpandState(n))}renderCheckboxItemsForFilter(t,n){renderCheckboxItems({filter:t,state:n,onCheckboxChange:(e,i)=>this.handleCheckboxSelectionChange(t.type,n,e,i)})}async handleCheckboxSelectionChange(t,n,e,i){i?n.selectedValues.add(e):n.selectedValues.delete(e),n.hasUserInteraction=!![],n.isExpanded||(n.isExpanded=!![],updateFilterExpandState(n));const o=Array.from(n.selectedValues);o.length>0?this.permanentFilters[t]=o:delete this.permanentFilters[t],await this.handleFilterChange()}}class ProductListRetailersComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["productsList.userProducts"]})}getProductId(){return this.params.productId}template(){var t,n,e,i,r,s,a,c,l,d;const m=this.getProductId(),g=this.params.config||this.config,v=this.getStoreValue("productsList"),y=v.products.find(t=>(t.salsifyGrouping||t.id)===m);if(!y)return[];const b=null===(t=v.userProducts[m])||void 0===t?void 0:t.selectedSizeId,k=Object.values(y.sizes).find(t=>t.id===b);if(!k)return[];const E=document.createElement("div");E.className="retailers-popup-wrapper";const _=k.attributes||null,F=this.extractFulfillments(k.shippingFulfillments),D=this.extractFulfillments(k.onDemandFulfillments),T=null===(n=v.userProducts[m])||void 0===n?void 0:n.selectedFulfillmentType,A=T===o.SHIPPING,O=T===o.ON_DEMAND,z=A?F:D;E.appendChild(this.createHeader());const L=renderFulfillmentTabsContainer({shippingFulfillments:F,onDemandFulfillments:D,shippingSelected:A,onDemandSelected:O,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:null!==(r=null===(i=null===(e=null==g?void 0:g.layout)||void 0===e?void 0:e.productCard)||void 0===i?void 0:i.enableShippingFulfillment)&&void 0!==r?r:!![],enableOnDemandFulfillment:null!==(c=null===(a=null===(s=null==g?void 0:g.layout)||void 0===s?void 0:s.productCard)||void 0===a?void 0:a.enableOnDemandFulfillment)&&void 0!==c?c:!![]});if(E.appendChild(L),0===z.length)E.appendChild(this.createNoAvailabilityMessage());else{const t=null===(d=null===(l=v.userProducts[m])||void 0===l?void 0:l.selectedFulfillment)||void 0===d?void 0:d.id,n=document.createElement("div");n.className="popup-fulfillment-list-container";for(const e of z){const i=renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:T,isSelected:e.id===t,selectedSizeAttributes:_});i.addEventListener("click",async()=>{await this.onRetailerCardClick(e.id)}),n.appendChild(i)}E.appendChild(n)}return[E]}extractFulfillments(t){return t?Object.values(t):[]}onFulfillmentTabClick(t){const n=t.currentTarget,e=n.getAttribute("data-fulfillment-type");e&&this.commands.productList.selectFulfillmentType(this.getProductId(),e)}async onRetailerCardClick(t){const n=this.getProductId();t&&(await this.commands.productList.selectFulfillment(n,t),this.commands.productList.updateQuantity(n,1),this.clientConfig.isMobile()?this.commands.ui.closeDrawer():this.commands.ui.closeModal())}createHeader(){const t=window.innerWidth,n=document.createElement("div");n.className="retailers-popup-header";const e=document.createElement("h5");e.className="retailers-popup-title",e.textContent="Select a Retailer",n.appendChild(e);const i=document.createElement("button");return i.className="retailers-popup-close",i.innerHTML=CloseIcon({}),i.addEventListener("click",()=>{t>g&&this.commands.ui.closeModal(),this.commands.ui.closeDrawer()}),n.appendChild(i),n}createNoAvailabilityMessage(){const t=document.createElement("p");return t.className="retailers-popup-no-data",t.innerHTML=sanitizeHTML("No delivery options available at this time."),t}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.debounceTimer=null,this.currentSearchTerm="",this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100,this.DEFAULT_DEBOUNCE_MS=500}get hostClasses(){return["product-list-search__control-container"]}disconnectedCallback(){super.disconnectedCallback(),this.cleanupDebounceTimer()}getCurrentSearchTerm(){return this.currentSearchTerm}async fetchProducts(){try{this.commands.productList.setLoading(!![]),this.store.batch({"productList.products":[],"productList.retailers":{}});const t=this.getStoreValue("productsList"),n=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),this.currentSearchTerm,n,[])}catch(t){throw this.logger.error("Error fetching products with search term:",t),this.commands.productList.setLoading(![]),t}}buildCurrentFiltersFromState(t){const n={price:{min:Ct.MIN,max:Ct.MAX},fulfillment:kt.ALL};for(const[e,i]of Object.entries(t))e===wt.PRICE?n.price=i:e===wt.FULFILLMENT?n.fulfillment=i:n[e]=i;return n}template(){const elements=[],t=document.createElement("div");t.className="product-list-search-box";const n=document.createElement("span");return n.className="product-list-search-icon",n.innerHTML=SearchIcon({}),n.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.id="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.searchInput.addEventListener("input",t=>{const n=t.target,e=n.value,i=this.cleanInput(e);i!==e&&(n.value=i),this.updateClearButtonVisibility(i);const o=this.normalizeForSearch(i);o!==this.currentSearchTerm&&this.handleDebouncedSearch(o)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display="none",this.clearButton.addEventListener("click",()=>{this.handleClearSearch()}),t.appendChild(n),t.appendChild(this.searchInput),t.appendChild(this.clearButton),elements.push(t),elements}handleDebouncedSearch(t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.currentSearchTerm=t,this.commands.productList.updateSearchTerm(t),this.fetchProducts()},this.DEFAULT_DEBOUNCE_MS)}handleClearSearch(){var t;const n=""!==(null===(t=this.searchInput)||void 0===t?void 0:t.value);this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),n&&(this.currentSearchTerm="",this.commands.productList.updateSearchTerm(""),this.fetchProducts())}cleanInput(t){if(!t)return"";let n=t.replace(this.ALLOWED_CHARACTERS,"");return n.length>this.MAX_LENGTH&&(n=n.substring(0,this.MAX_LENGTH)),n}normalizeForSearch(t){return t?t.trim().replace(/\s+/g," "):""}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}cleanupDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}}class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},this.cardsContainer=null,this.sentinelElement=null,this.loadingState=Et.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise,this.unsubscribeFromState=this.commands.productList.subscribe(t=>{this.handleStateUpdate(t)})}disconnected(){this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(Et.LOADING_INITIAL),this.commands.productList.setGridConfig(this.params.rows,this.params.columns),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Et.IDLE)}catch(xt){this.logger.error("Error initializing product list:",xt),this.setLoadingState(Et.ERROR),this.showErrorState("Failed to load products")}}handleStateUpdate(t){this.updateLoadingState(t.loading);const n=this.hasProductsChanged(t.products);!n&&t.loading||(this.updateProductData(t),this.handleProductRendering(t.products))}updateLoadingState(t){const n=this.loadingState===Et.LOADING_INITIAL||this.loadingState===Et.LOADING_MORE;t&&0===this.products.length?this.setLoadingState(Et.LOADING_INITIAL):t&&this.products.length>0?this.setLoadingState(Et.LOADING_MORE):!t&&n&&this.setLoadingState(Et.IDLE)}hasProductsChanged(t){return t.length!==this.products.length||t.some((t,n)=>{var e;return t.id!==(null===(e=this.products[n])||void 0===e?void 0:e.id)})}updateProductData(t){this.products=t.products,this.retailers=t.retailers,this.pagination=t.pagination}handleProductRendering(t){var n;if(!this.cardsContainer)return;const e=this.getStoreValue("address.formattedAddress");t.length>0&&e?(this.renderProducts(),this.setupInfiniteScroll()):!e&&t.length>0&&(this.renderSimplifiedProducts(t),this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:null===(n=this.getStoreValue("productsList").products[0])||void 0===n?void 0:n.id,isIndependentComponent:!![]}))}renderSimplifiedProducts(t){this.clearCardsContainer();const n=t.map(t=>ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:t,shippingFulfillment:{},onDemandFulfillment:{},productUrl:this.params.productUrl}));n.forEach(t=>{this.cardsContainer.appendChild(t)}),this.setupInfiniteScroll()}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Et.LOADING_INITIAL:this.renderLoadingState();break;case Et.ERROR:break;case Et.IDLE:case Et.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){try{const t=this.getStoreValue("productsList");await this.commands.productList.loadInitialProducts(0,this.params.rows*this.params.columns,t.searchTerm,t.appliedFilters,this.params.filters);const n=this.getStoreValue("productsList");this.products=n.products,this.retailers=n.retailers,this.pagination=n.pagination}catch(t){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],t}}async loadMoreProducts(){if(this.loadingState!==Et.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Et.LOADING_MORE);const t=this.getStoreValue("productsList"),n=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadMoreProducts(this.params.rows*this.params.columns,t.searchTerm,n,this.params.filters);const e=this.getStoreValue("productsList"),i=this.products.length;this.products=e.products,this.retailers=e.retailers,this.pagination=e.pagination;const o=this.products.slice(i);o.length>0&&this.appendNewProducts(o),this.setLoadingState(Et.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(Et.ERROR),this.showSentinelError("Error loading products")}}buildCurrentFiltersFromState(t){const n={price:{min:Ct.MIN,max:Ct.MAX},fulfillment:kt.ALL};for(const[e,i]of Object.entries(t))this.mapStateFilterToComponentFilter(n,e,i);return n}mapStateFilterToComponentFilter(t,n,e){switch(n){case wt.PRICE:"object"!=typeof e||Array.isArray(e)||(t.price=e);break;case wt.FULFILLMENT:"string"==typeof e&&(t.fulfillment=e);break;case wt.ENGRAVING:"boolean"==typeof e&&(t[wt.ENGRAVING]=e);break;case wt.PRESALE:"boolean"==typeof e&&(t[wt.PRESALE]=e);break;default:Array.isArray(e)&&(t[n]=e)}}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const n=100/this.params.columns;return t.style.setProperty("--card-width",n+"%"),t.style.setProperty("--columns",""+this.params.columns),t}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD_LOADING,rows:this.params.rows,columns:this.getResponsiveColumns(),filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const n=this.createProductCard(t);n&&this.cardsContainer.appendChild(n)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const n of t){const t=this.createProductCard(n);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const n=this.commands.productList.extractProductCardData(t,this.retailers);return n?ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:n.product,shippingFulfillment:n.retailer.shippingFulfillment,onDemandFulfillment:n.retailer.onDemandFulfillment,productUrl:this.params.productUrl}):null}catch(n){return this.logger.error("Error creating product card for product "+t.id+":",n),null}}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const n=t[0];n.isIntersecting&&this.loadingState===Et.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let n;t.innerHTML="",n=this.loadingState===Et.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(n)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const n=this.createErrorElement(t);this.sentinelElement.appendChild(n)}createLoadingElement(t){const n=document.createElement("div");n.className="product-list-sentinel-container";const e=document.createElement("div");e.className="product-list-sentinel-spinner";const i=document.createElement("div");return i.className="product-list-sentinel-text",i.textContent=t,n.appendChild(e),n.appendChild(i),n}createErrorElement(t){const n=document.createElement("div");n.className="product-list-sentinel-error-container";const e=document.createElement("div");e.className="product-list-sentinel-error-icon",e.innerHTML="⚠";const i=document.createElement("div");return i.className="product-list-sentinel-error-text",i.textContent=t,n.appendChild(e),n.appendChild(i),n}createInfoElement(t,n=![]){const e=document.createElement("div");if(e.className="product-list-sentinel-info-container",!n&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",e.appendChild(t)}else if(n){const t=document.createElement("div");t.className="product-list-sentinel-divider",e.appendChild(t)}const i=document.createElement("div");return i.className=n?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",i.textContent=t,e.appendChild(i),e}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const n=this.createErrorElement(t);this.cardsContainer.appendChild(n)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.sentinelElement=null,this.initializationPromise=null}async onStoreWatch(t){const n=t.find(t=>"address"===t.path);if(n&&void 0!==n.value&&this.cardsContainer)try{this.pagination=this.commands.productList.createInitialPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(e){this.logger.error("Error refetching products after address change:",e),this.setLoadingState(Et.ERROR),this.cardsContainer&&this.showErrorState("Failed to refetch products")}}template(){const elements=[],t=document.createElement("div");return t.className="product-list-controls",this.cardsContainer=this.createCardsContainer(),t.appendChild(this.cardsContainer),elements.push(t),this.renderCurrentState(),elements}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,n;const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(e){const t=this.store.get(this.params.errorStorePath)||[],n=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?n.slice(0,1):n}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const n=document.createElement("div");n.classList.add("alert-container","alert-"+t.level);const e=document.createElement("span");e.classList.add("alert-icon"),e.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,n.appendChild(e),n.appendChild(i),n}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(i.CART)});const n=document.createElement("span");if(n.className="lce-cart-button-icon",n.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[n,t]}return[n]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const n=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const n=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var n;const e=t.find(t=>"ui.drawer"===t.path);if(!e)return![];const i=e.value,o=i.isOpen,r=null===(n=i.contentConfig)||void 0===n?void 0:n.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:n,data:e}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...e}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(i,n):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateDrawerContentTypeClass(n),this.open()),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Drawer content loading failed",n),this.commands.ui.closeDrawer()}}animateContentSwap(t,n){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const e=this.contentContainer.firstElementChild;e.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{e.classList.add("fading")}),setTimeout(()=>{e.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(n),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const n=["drawer"];this.isOpen&&n.push("open"),n.push(t.toString().toLowerCase()),this.drawerElement.className=n.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var t,n,e,i,o,r,s,a,c;if(this.engravingLines=this.params.lines,"product"===this.params.context){const o=this.store.get("products."+this.params.identifier);this.fulfillmentId=o.selectedFulfillmentId,this.partNumber=(null===(t=o.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null,this.isPresale=(null===(i=null===(e=null===(n=o.sizes[o.selectedSizeId])||void 0===n?void 0:n.attributes)||void 0===e?void 0:e.presale)||void 0===i?void 0:i.isActive)||![]}if("product-list"===this.params.context){const t=this.store.get("productsList"),n=t.userProducts[this.params.identifier],e=t.products.find(t=>t.id===this.params.identifier),i=null==n?void 0:n.selectedSizeId;this.fulfillmentId=(null===(o=null==n?void 0:n.selectedFulfillment)||void 0===o?void 0:o.id)||null,this.partNumber=(null===(r=null==n?void 0:n.selectedFulfillment)||void 0===r?void 0:r.variant.partNumber)||null,this.isPresale=i&&(null===(c=null===(a=null===(s=null==e?void 0:e.sizes[i])||void 0===s?void 0:s.attributes)||void 0===a?void 0:a.presale)||void 0===c?void 0:c.isActive)||![]}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,n,e,i;if("product"===this.params.context){const e=this.store.get("products."+this.params.identifier),i=e.sizes[e.selectedSizeId],o=i.shippingFulfillments[this.fulfillmentId],r=o.variant.price,s=(null===(n=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.fee)||0;return r+s}if("product-list"===this.params.context){const t=this.store.get("productsList"),n=t.products.find(t=>(t.salsifyGrouping||t.id)===this.params.identifier),o=Object.values(n.sizes).find(n=>{var e;return n.id===(null===(e=t.userProducts[this.params.identifier])||void 0===e?void 0:e.selectedSizeId)}),r=o.shippingFulfillments[this.fulfillmentId],s=r.variant.price,a=(null===(i=null===(e=null==o?void 0:o.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.fee)||0;return s+a}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),n=t.unitPrice,e=t.attributes.engraving.fee||0;return n+e}return 0}productInformationSection(){var t;const n=[];let e="",i="";if("product"===this.params.context){const t=this.store.get("products."+this.params.identifier);t.sizes[t.selectedSizeId].image?n.push(t.sizes[t.selectedSizeId].image):n.push(...t.images||[]),e=t.name,i=t.sizes[t.selectedSizeId].size}if("product-list"===this.params.context){const o=this.store.get("productsList"),r=o.products.find(t=>(t.salsifyGrouping||t.id)===this.params.identifier),s=null===(t=o.userProducts[this.params.identifier])||void 0===t?void 0:t.selectedSizeId,a=Object.values(r.sizes).find(t=>t.id===s);(null==a?void 0:a.image)?n.push(a.image):r.images&&r.images.length>0&&n.push(...r.images),e=r.name,i=a.size}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);t.mainImage&&n.push(t.mainImage),e=t.name,i=t.size}const o=document.createElement("div");if(o.className="product-info-section",n.length>0){const t=document.createElement("div");t.className="product-image-container";const i=document.createElement("img");i.src=n[0],i.alt=e,i.loading="lazy",i.className="product-image",t.appendChild(i),o.appendChild(t)}const r=document.createElement("div");r.className="product-details-container";const s=document.createElement("div");s.className="product-header";const a=document.createElement("h4");a.className="product-title",a.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),s.appendChild(a),s.appendChild(this.productPriceSpan),r.appendChild(s);const c=document.createElement("p");c.className="product-size-text",c.textContent=i,r.appendChild(c);const l=document.createElement("p");return l.className="engraving-fees-disclaimer",l.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(l),o.appendChild(r),o}addToCartButtonText(t){if("product"!==this.params.context&&"product-list"!==this.params.context)return"Save";const n=this.getConfigs("product"),e=this.isPresale?n.layout.preSaleButtonText:n.layout.addToCartButtonText;return n.layout.addToCartButtonShowTotalPrice?e+" - "+formatCentToDollarText(t):e}getFulfillmentData(){var t,n,e,i,o,r;if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier),o=i.sizes[i.selectedSizeId];if(!o)return null;const r=Object.values(o.shippingFulfillments).filter(t=>t.variant.isEngravable).map(t=>({id:t.id,retailerName:t.retailerName,variant:{price:t.variant.price,partNumber:t.variant.partNumber},engravingExpectation:t.engravingExpectation}));return{availableFulfillments:r,selectedFulfillmentId:(null===(t=i.selectedFulfillment)||void 0===t?void 0:t.id)||null,selectedSizeId:i.selectedSizeId,engravingFee:(null===(e=null===(n=o.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.fee)||0}}if("product-list"===this.params.context){const t=this.store.get("productsList"),n=t.userProducts[this.params.identifier],e=t.products.find(t=>(t.salsifyGrouping||t.id)===this.params.identifier);if(!e||!(null==n?void 0:n.selectedSizeId))return null;const s=Object.values(e.sizes).find(t=>t.id===n.selectedSizeId);if(!s)return null;const a=Object.values(s.shippingFulfillments).filter(t=>t.variant.isEngravable).map(t=>({id:t.id,retailerName:t.retailerName,variant:{price:t.variant.price,partNumber:t.variant.partNumber},engravingExpectation:t.engravingExpectation}));return{availableFulfillments:a,selectedFulfillmentId:(null===(i=n.selectedFulfillment)||void 0===i?void 0:i.id)||null,selectedSizeId:n.selectedSizeId,engravingFee:(null===(r=null===(o=s.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.fee)||0}}return null}retailersSection(){const t=this.getFulfillmentData();if(!t)return document.createElement("div");const{availableFulfillments:n,selectedFulfillmentId:e,engravingFee:i}=t,o=document.createElement("div");o.className="fulfillment-section";const r=n.find(t=>t.id===e),s=document.createElement("p");if(s.className="shipping-from-text",s.innerHTML=r?"Shipping from: <b>"+r.retailerName+"</b>":"Select a delivery option",o.appendChild(s),1===n.length)return o;const a=document.createElement("div");a.className="fulfillment-options-container",o.appendChild(a);const c=document.createElement("span");c.className="see-more-fulfillments",c.textContent="See More Delivery Options ("+n.length+")",c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","See More Delivery Options ("+n.length+")"),c.setAttribute("aria-expanded","false");const u=()=>{const t=a.classList.contains("expanded");a.classList.toggle("expanded"),t?(c.textContent="See More Delivery Options ("+n.length+")",c.setAttribute("aria-label","See More Delivery Options ("+n.length+")"),c.setAttribute("aria-expanded","false")):(c.textContent="See Less Delivery Options",c.setAttribute("aria-label","See Less Delivery Options"),c.setAttribute("aria-expanded","true"))};c.addEventListener("click",u),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),u())}),o.appendChild(c);for(const l of n){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",l.id),l.id===e&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+l.retailerName+", "+formatCentToDollarText(l.variant.price+i)+", "+l.engravingExpectation),t.setAttribute("aria-pressed",l.id===e?"true":"false");const w=()=>{this.fulfillmentId=l.id,this.partNumber=l.variant.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const e=a.querySelector(".fulfillment-option.selected");e&&(e.classList.remove("selected"),e.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),s.innerHTML="Shipping from: <b>"+l.retailerName+"</b>"};t.addEventListener("click",w),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),w())});const n=l.variant.price+i,o=document.createElement("div");o.className="option-row row-1",t.appendChild(o);const r=document.createElement("span");r.className="retailer-name",r.textContent=l.retailerName,o.appendChild(r);const c=document.createElement("span");c.className="fulfillment-price",c.textContent=formatCentToDollarText(n),o.appendChild(c),t.appendChild(o);const d=document.createElement("div");d.className="option-row row-2",t.appendChild(d);const m=document.createElement("span");m.className="estimated-time",m.textContent=l.engravingExpectation,d.appendChild(m),t.appendChild(d),a.appendChild(t)}return o}engravingLinesSection(){var t;const n=this.getConfigs("global"),{lines:e,maxLines:i,location:o,maxCharsPerLine:r}=this.params,s=document.createElement("div");s.className="engraving-section";const a=document.createElement("p");if(a.className="engraving-title",a.textContent=n.layout.personalizationText,s.appendChild(a),o&&(null===(t=null==o?void 0:o.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+o.toLowerCase()+".",s.appendChild(t)}const c=Array.from({length:i},(t,n)=>{const i=n+1,o=document.createElement("div");o.className="engraving-input-wrapper",o.setAttribute("data-line-number",i.toString());const s=document.createElement("input");s.type="text",s.id="engraving-line-"+i,s.dataset.lineNumber=i.toString(),s.maxLength=r,s.value=e[n]||"",s.placeholder=i>1?"Line "+i+" (optional)":"Line "+i,s.className="engraving-input",s.autocomplete="off",s.setAttribute("aria-label",i>1?"Engraving line "+i+", optional, maximum "+r+" characters":"Engraving line "+i+", maximum "+r+" characters");const a=document.createElement("span");return a.className="engraving-char-count",a.textContent=s.value.length+"/"+r,a.setAttribute("aria-live","polite"),a.setAttribute("aria-atomic","true"),s.addEventListener("input",()=>{a.textContent=s.value.length+"/"+r,this.engravingLines[n]=s.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),o.appendChild(s),o.appendChild(a),o}),l=document.createElement("div");return l.className="engraving-inputs-container",l.append(...c),s.appendChild(l),s}actionButtonsSection(){const{identifier:t,context:n}=this.params,e=window.innerWidth,o=document.createElement("div");o.className="action-buttons-container";const r=document.createElement("button");r.type="button",r.className="cancel-action-button",r.textContent="Cancel",r.setAttribute("aria-label","Cancel personalization and close");const V=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(t),"product-list"===n&&(e>=g&&this.commands.ui.closeModal(),this.commands.ui.closeDrawer()),"cart"===n&&this.commands.ui.openDrawer(i.CART)};r.addEventListener("click",V),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),V())}),o.appendChild(r),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===n?"Add personalized item to cart":"Update personalization and return to cart");const B=async()=>{const o=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===n&&this.fulfillmentId&&this.partNumber){const n={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:t};this.isPresale?await this.commands.product.addPresaleToCart(t,n):await this.commands.product.addToCart(t,n),await this.commands.product.closeProductDrawer(t)}if("product-list"===n&&this.fulfillmentId&&this.partNumber){const n={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:t};this.isPresale?this.commands.productList.addPresaleToCart(n):this.commands.productList.addToCart(n),e>=g&&this.commands.ui.closeDrawer(),this.commands.ui.closeModal()}"cart"===n&&(await this.commands.cart.updateItemEngraving(t,o),this.commands.ui.openDrawer(i.CART))};return this.addToCartButton.addEventListener("click",B),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),B())}),o.appendChild(this.addToCartButton),o}template(){const elements=[],t=this.productInformationSection();if(elements.push(t),"product"===this.params.context||"product-list"===this.params.context){const t=this.retailersSection();elements.push(t)}const n=this.engravingLinesSection();elements.push(n);const e=this.actionButtonsSection();elements.push(e);const i=document.createElement("p");return i.className="engraving-disclaimer",i.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",elements.push(i),elements}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t),e=(null==n?void 0:n.attributes.engraving.fee)||0,i=(null==n?void 0:n.quantity)||1;return{quantity:i,fee:e,total:e*i}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t),e=(null==n?void 0:n.attributes.engraving.fee)||0,i=(null==n?void 0:n.quantity)||1;return{quantity:i,fee:e,total:e*i}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,n,e,o,r,s,a,c,l,d,m,g,v,y,b,k,E,_,F,D;const T=this.params.identifier,A={identifier:T,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+T);A.lines=(null===(n=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.lines)||[],A.maxLines=(null===(o=null===(e=null==i?void 0:i.attributes)||void 0===e?void 0:e.engraving)||void 0===o?void 0:o.maxLines)||1,A.maxCharsPerLine=(null===(s=null===(r=null==i?void 0:i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,A.fee=(null===(c=null===(a=null==i?void 0:i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,A.location=(null===(d=null===(l=null==i?void 0:i.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+T);A.lines=(null===(g=null===(m=null==t?void 0:t.attributes)||void 0===m?void 0:m.engraving)||void 0===g?void 0:g.lines)||[],A.maxLines=(null===(y=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.maxLines)||1,A.maxCharsPerLine=(null===(k=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===k?void 0:k.maxCharsPerLine)||16,A.fee=(null===(_=null===(E=null==t?void 0:t.attributes)||void 0===E?void 0:E.engraving)||void 0===_?void 0:_.fee)||0,A.location=(null===(D=null===(F=null==t?void 0:t.attributes)||void 0===F?void 0:F.engraving)||void 0===D?void 0:D.location)||""}this.commands.ui.openDrawer(i.ENGRAVING_FORM,A)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),n=this.engravingLines();if(0===n.length)return"";const e=document.createElement("div");e.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");if(o.className="engraving-fee",1===t.quantity&&(o.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){o.textContent=formatCentToDollarText(t.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",o.appendChild(n)}e.appendChild(i),e.appendChild(o);const r=document.createElement("div");r.className="engraving-body";const s=document.createElement("div");s.className="engraving-lines";for(const l of n){const t=document.createElement("span");t.className="engraving-line",t.textContent=l,s.appendChild(t)}const a=document.createElement("div");a.className="engraving-actions";const c=document.createElement("button");c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.setAttribute("aria-label","Remove engraving");const I=async()=>{await this.handleRemove()};if(c.addEventListener("click",I),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await I())}),a.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),a.appendChild(t)}return r.appendChild(s),r.appendChild(a),[e,r]}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const n=t.target,e=n.selectionStart||0,i=n.value;e>0&&/\D/.test(i[e-1])&&setTimeout(()=>{const t=Math.max(0,e-2);n.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const n=t.target;let e=n.value.replace(/\D/g,"");e.length>10&&(e=e.substring(0,10)),e.length>=6?e="("+e.substring(0,3)+") "+e.substring(3,6)+"-"+e.substring(6):e.length>=3&&(e="("+e.substring(0,3)+") "+e.substring(3)),n.value=e}formatDate(t){const n=t.target,e=n.value,i=n.selectionStart||0;let o=0,r;if(i>2&&(o=1),i>5&&(o=2),e.includes("/")){const t=e.split("/");let n=(t[0]||"").replace(/\D/g,"").substring(0,2);const i=(t[1]||"").replace(/\D/g,"");let o=i.substring(0,2);const s=i.substring(2);let a=(t[2]||"").replace(/\D/g,"");if(a=(s+a).substring(0,4),""===n&&3===t.length&&(n="01"),2===n.length){let t=Number.parseInt(n,10);t>12&&(t=12),t<1&&(t=1),n=t.toString().padStart(2,"0")}if(""===o&&3===t.length&&(o="01"),2===o.length){let t=Number.parseInt(o,10);t>31&&(t=31),t<1&&(t=1),o=t.toString().padStart(2,"0")}r=n,(t.length>1||o)&&(r+="/"+o),(a||t.length>2)&&(r+="/"+a)}else{let t=e.replace(/\D/g,"");if(t.length>8&&(t=t.substring(0,8)),t.length>=2){let n=Number.parseInt(t.substring(0,2),10);n>12&&(n=12),t=n.toString().padStart(2,"0")+t.substring(2)}if(t.length>=4){let n=Number.parseInt(t.substring(2,4),10);n>31&&(n=31),t=t.substring(0,2)+n.toString().padStart(2,"0")+t.substring(4)}r=t.length>=5?t.substring(0,2)+"/"+t.substring(2,4)+"/"+t.substring(4):t.length>=3?t.substring(0,2)+"/"+t.substring(2):t}if(n.value=r,e.includes("/")){let t;t=0===o?Math.min(i,2):1===o?Math.min(i,5):r.length,n.setSelectionRange(t,t)}}validateEmail(t){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(t)}validateTel(t){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(t)}validateDate(t){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(t))return![];const[e,i,o]=t.split("/").map(Number),r=new Date(o,e-1,i);return r.getFullYear()===o&&r.getMonth()===e-1&&r.getDate()===i}parseDateString(t){if(!this.validateDate(t))return null;const[n,e,i]=t.split("/").map(Number);return new Date(i,n-1,e)}calculateAge(t){const n=new Date;let e=n.getFullYear()-t.getFullYear();const i=n.getMonth()-t.getMonth();return(i<0||0===i&&n.getDate()<t.getDate())&&e--,e}validateDateConstraints(t){const n=[],e=this.params.validation;if(!e)return n;const i=this.parseDateString(t);if(!i)return n;const o=i.getFullYear();void 0!==e.minYear&&o<e.minYear&&n.push("Year must be "+e.minYear+" or later"),void 0!==e.maxYear&&o>e.maxYear&&n.push("Year must be "+e.maxYear+" or earlier");const r=this.calculateAge(i);return void 0!==e.minAge&&r<e.minAge&&n.push("Must be at least "+e.minAge+" years old"),void 0!==e.maxAge&&r>e.maxAge&&n.push("Must be no more than "+e.maxAge+" years old"),n}isFieldComplete(){var t,n,e;const i=this.inputElement.value.trim();if(!i)return![];switch(this.params.inputType){case"tel":return this.validateTel(i);case"date":case"birthdate":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&i.length>=this.params.validation.max||(null===(e=this.params.validation)||void 0===e?void 0:e.min)&&i.length>=this.params.validation.min?!![]:i.length>=3}}validateInput(){const t=this.inputElement.value,n=[],e=this.params.validation;if(!e)return this.showErrors([]),!![];if(e.required&&!t.trim()&&n.push("This field is required"),!e.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"===this.params.inputType||"birthdate"===this.params.inputType)if(this.validateDate(t)){const e=this.validateDateConstraints(t);n.push(...e)}else n.push("Please enter a valid date (MM/DD/YYYY)");if("number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&n.push("Please enter a valid number"):(void 0!==e.min&&i<e.min&&n.push("Value must be at least "+e.min),void 0!==e.max&&i>e.max&&n.push("Value must be no more than "+e.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==e.min&&t.length<e.min&&n.push("Must be at least "+e.min+" characters"),void 0!==e.max&&t.length>e.max&&n.push("Must be no more than "+e.max+" characters")),e.pattern){const i=new RegExp(e.pattern);i.test(t)||n.push("Invalid format")}if(e.customValidator){const i=e.customValidator(t);i&&n.push(i)}}this.showErrors(n);const i=0===n.length;return this.params.onValidation&&this.params.onValidation(i,n),i}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const elements=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),elements.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",elements.push(this.inputElement),elements.push(this.errorContainer),elements}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,n){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.U=t=>{n.rerender(t||"LceElementRerender")}),this.V.appendChild(n),this.applyBasicStyles();const e=ThemeProviderService.getInstance(),i=e.getStylesheet(t);this.applyThemeStyles(i),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([modal]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(t),this.V.adoptedStyleSheets=[n,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(xt){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const n=document.createElement("style");n.textContent=t,this.V&&this.V.appendChild(n)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",t.appendChild(n);const e=document.createElement("span");e.className="pb-lc",e.textContent="LiquidCommerce",t.appendChild(e);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?t.appendChild(document.createTextNode(n.content)):"link"===n.type&&t.appendChild(this.createLink(n.href,n.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,n){const e=document.createElement("a");return e.href=t,e.target="_blank",e.rel="noopener noreferrer",e.className="pb-link",e.textContent=n,e.setAttribute("role","link"),e.setAttribute("aria-label","Read "+n),e}template(){const t=this.createPoweredBySection(),n=this.createDisclaimerSection();return[t,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const e=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);e&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!e&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const n=this.store.get("cart.promoCode"),e=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===t||(null==e?void 0:e.code)===t}getActiveTickers(){var t;const n=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var e;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(e=null==n?void 0:n.address)||void 0===e?void 0:e.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const e=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of e){const e=i.trim();if(!e)continue;const o=document.createElement("span");o.classList.add("promo-ticker__text-item"),o.textContent=e,n.appendChild(o);const r=document.createElement("span");r.classList.add("promo-ticker__separator"),r.textContent=t.separator,n.appendChild(r)}return n}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const n=document.createElement("div");n.classList.add("promo-ticker__content");const e=document.createElement("div");e.classList.add("promo-ticker__track");for(let o=0;o<5;o++)e.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(e);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",i.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=i,[n,i]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},e={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=n[this.params.messageType]||"warning",o=document.createElement("div");return o.className="alert-icon alert-icon-"+this.params.messageType,o.appendChild(htmlStringToElement(e[i]({width:16,height:16,className:"alert-icon-svg"}))),o}template(){var t;const elements=[],n=this.getIconElement();n&&elements.push(n);const e=document.createElement("span");if(e.className="alert-message",e.textContent=this.params.message,elements.push(e),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),elements.push(t)}return elements}}const Rt=LoggerFactory.get("ClientHelpers"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,n){if(!t||!n)return t;const e={...t},i=[];for(const o in n){const r=n[o],s=e[o];if(!(o in t)){i.push('Property "'+o+'" does not exist in target schema, skipping merge.');continue}const a=getType(r),c=getType(s);a===c?isObject(r)&&isObject(s)?e[o]=deepMergeConfigs(s,r):e[o]=r:i.push('Type mismatch for key "'+o+'": source is '+a+", target is "+c+". Skipping merge.")}return i.length>0&&Rt.warn("Merging configurations with warnings:",i),e}const Mt=new Map([["global.layout.enablePersonalization",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.PRODUCT_INTERACTIONS,i.CART_ITEM,i.CHECKOUT_ITEM]],["global.layout.personalizationText",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.CART_ITEM]],["global.layout.personalizationCardStyle",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[i.CART,i.CART_PROMO_CODE,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[i.CART,i.CHECKOUT,i.ADDRESS,i.INPUT,i.ADDRESS_INPUT,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_BUYER,i.CHECKOUT_BILLING,i.CHECKOUT_PAYMENT,i.CART_PROMO_CODE]],["global.layout.showPoweredBy",[i.CART,i.CHECKOUT,i.CHECKOUT_COMPLETED,i.POWERED_BY,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[i.POWERED_BY]],["product.layout.showImages",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[i.PRODUCT]],["product.layout.showDescription",[i.PRODUCT,i.PRODUCT_DESCRIPTION,i.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[i.PRODUCT,i.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[i.CART,i.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[i.CART,i.CART_FOOTER]],["checkout.layout.emailOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[i.CHECKOUT,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[i.CHECKOUT,i.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[i.CHECKOUT,i.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[i.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,n){const e=new Set;for(const i of Object.keys(n)){const n=Mt.get(t+"."+i);if(n)for(const t of n)e.add(t)}return Array.from(e)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.modalCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Client preparation failed",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",xt.version);const t=this.clientConfig.isProduction(),n=this.clientConfig.isDebuggingEnabled();!t&&n&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!t&&n&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:e,configs:i}=await this.authClient.authenticateAndGetConfigs();if(!e||!i)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);this.logger.info("✅ Authentication completed and configurations loaded"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let o=i;this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.clientConfig.set("partnerName",o.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(o.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",s);const a=s?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:s,persistedStore:a}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=o.global.layout.showPoweredBy;o=deepMergeConfigs(o,t),o.global.layout.showPoweredBy=n}await this.themeProvider.initialize(o),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureModalExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:n,containerId:e,...o}=t;if(!e||"string"!=typeof e)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);if(!n)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const r=e.replace("#",""),s=document.getElementById(r);if(!s)return console.warn("Container with ID '"+r+"' not found"),null;s.innerHTML="";const a={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},c=ComponentFactoryService.createElement(a);return safeReplaceChildren(s,c),t.type===i.CHECKOUT&&(this.store.set("metadata.checkout.injection",{containerId:r,injectedAt:Date.now()}),await this.commands.checkout.loadCheckout({checkoutId:void 0===t.checkoutId?"":t.checkoutId})),this.createInjectedComponentWrapper(r,t.type,c)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const n=t.slice(0,20),e=[],o=[];for(const i of n){if(!i||"object"!=typeof i){this.logger.warn("Invalid product parameter: must be an object");continue}if(!i.containerId||"string"!=typeof i.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+i.identifier+"'");continue}const t=i.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+i.identifier+"'");continue}const n=document.getElementById(t);if(!n){this.logger.warn("Container with ID '"+t+"' not found for product '"+i.identifier+"'");continue}const o=e.every(n=>n.containerId!==t);if(!o){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!i.identifier||"string"!=typeof i.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const r=e.every(t=>t.identifier!==i.identifier);r?e.push({containerId:t,identifier:i.identifier}):this.logger.warn("Duplicate product identifier '"+i.identifier+"' found, skipping")}for(const r of e){const t=ComponentFactoryService.createElement({type:i.PRODUCT,useShadowDom:!![],productId:r.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(r.containerId);n?(n.innerHTML="",n.appendChild(t),o.push(this.createInjectedComponentWrapper(r.containerId,i.PRODUCT,t)),await this.commands.product.createProductInstance(r.identifier,!![])):this.logger.warn("Product ("+r.identifier+") container with ID '"+r.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(e.map(t=>t.identifier)),o}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const n=Object.values(d);for(const e of t.filters)if(!n.includes(e))throw new SDKError('Invalid filter "'+e+'". Valid options: '+n.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const n=document.getElementById(t.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const e=ComponentFactoryService.createElement({type:i.PRODUCT_LIST,wrapInLceElement:!![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(n,e)}async injectProductListSearch(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_SEARCH),void 0;if(!t)throw new SDKError("Product list search requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list search container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);const n=document.getElementById(t.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list search.',!![]);const e=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_SEARCH,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![]});safeReplaceChildren(n,e)}async injectProductListFilters(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_FILTERS),void 0;if(!t)throw new SDKError("Product list filters requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list filters container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.filters&&t.filters.length>0){const n=Object.values(d);for(const e of t.filters)if(!n.includes(e))throw new SDKError('Invalid filter "'+e+'". Valid options: '+n.join(", "),!![])}const n=document.getElementById(t.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list filters.',!![]);const e=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_FILTERS,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![],filters:t.filters});safeReplaceChildren(n,e)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:i.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureModalExists(){if(!this.modalCreated)try{const t=ComponentFactoryService.createElement({type:i.MODAL,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.modalCreated=!![]}catch(t){this.logger.warn("Failed to create modal:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,n,e){const i={getType:()=>n,getElement:()=>document.getElementById(t),rerender:()=>{try{e&&"function"==typeof e.rerender?e.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(n){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,i),i}rerenderInjectedComponentsByType(t){for(const[n,e]of this.injectedComponents)e.getType()===t&&e.rerender()}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",n),!![]}}injectDisabledElementsError(t,n){const e=document.getElementById(t.replace("#",""));if(!e)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let i;i=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),e.innerHTML="",safeReplaceChildren(e,i)}registerEssentialComponents(){ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.CART,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent),ComponentFactoryService.registerComponent(i.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(i.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(i.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_RETAILERS,ProductListRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_ENGRAVING_FORM,ProductListEngravingComponent),ComponentFactoryService.registerComponent(i.CART,CartComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(i.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(i.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(i.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(i.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(i.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(i.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(i.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const o=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});e.innerHTML="",safeReplaceChildren(e,o)},floatingCartButton:t=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(n)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);n.innerHTML="",n.classList.add("lce-cart-subtotal");const G=t=>{n.textContent=formatCentToDollarText(t)},e=this.store.get("cart.subtotal")||0;G(e),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;G(t)})},cartItemsCount:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let e=!![];n&&"boolean"==typeof n.hideZero&&(e=n.hideZero);const i=document.getElementById(t.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);i.innerHTML="",i.classList.add("lce-cart-items-count");const V=t=>{i.textContent=t.toString(),0===t?(e&&(i.style.visibility="hidden"),i.classList.add("no-items")):(e&&(i.style.visibility="visible"),i.classList.remove("no-items"))},o=this.store.get("cart.itemsQuantity")||0;V(o),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;V(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const n of t)this.injectDisabledElementsError(n.containerId,i.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.ADDRESS,containerId:t,options:n}):(this.injectDisabledElementsError(t,i.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.CART,containerId:t}):(this.injectDisabledElementsError(t,i.CART),null)}async injectCheckoutElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.CHECKOUT,containerId:t,checkoutId:n}):(this.injectDisabledElementsError(t,i.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,e){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:e.proxy,development:e.development,checkout:e.checkout});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),injectProductListFilters:r.injectProductListFilters.bind(r),injectProductListSearch:r.injectProductListSearch.bind(r),ui:r.ui,actions:r.actions,getInjectedComponents:r.getInjectedComponents.bind(r)};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),null}}const jt={SCRIPT:{CHECKOUT_PARAM:"data-checkout-param"},ELEMENT:{CHECKOUT:"data-lce-checkout"},JSON_SCRIPT:{DEVELOPMENT:"data-liquid-commerce-elements-development"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function getDevelopmentConfigs(){const t=document.querySelector("script["+jt.JSON_SCRIPT.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(n){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",n),void 0}}function triggerAutoInit(t,n){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await t()}catch(e){console.error(n+" Failed to initialize:",e)}},50)}):setTimeout(async()=>{try{await t()}catch(e){console.error(n+" Failed to initialize:",e)}},50)}catch(e){console.error(n+" Failed to setup initialization:",e)}}async function setupCheckout(t,n,e){try{const i=document.querySelector("div["+jt.ELEMENT.CHECKOUT+"]");if(!i)return e.requireCheckoutId||console.warn(e.errorPrefix+" No checkout container found. Add a div with data-lce-checkout attribute."),void 0;const o="lce-checkout-container";let r;i.className="lce-checkout-container",i.id=o;const s=t.getAttribute(jt.SCRIPT.CHECKOUT_PARAM)||"lce_checkout";if(s&&startsWithLcePrefix(s)){const t=new URLSearchParams(window.location.search);if(r=t.get(s)||void 0,!r&&e.requireCheckoutId)return console.warn(e.errorPrefix+" Checkout ID not found in query parameters."),void 0}else if(console.warn(e.errorPrefix+' Ignoring checkout query parameter "'+s+'" because it does not start with "lce_" prefix.'),e.requireCheckoutId)return;await n(o,r)}catch(i){console.error(e.errorPrefix+" Failed to setup checkout:",i)}}const Nt={SCRIPT:{MAIN:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",PRODUCT:"data-product",CONTAINER:"data-container",PRODUCT_PARAM:"data-product-param",PRODUCT_FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",PROMO_CODE_PARAM:"data-promo-code-param",PROMO_CODE:"data-promo-code",PROMO_TEXT:"data-promo-text",PROMO_SEPARATOR:"data-promo-separator",PROMO_ACTIVE_FROM:"data-promo-active-from",PROMO_ACTIVE_UNTIL:"data-promo-active-until",CART_BUTTON:"data-cart-button",CART_BADGE_BUTTON:"data-cart-badge-button",CART_MOBILE_BUTTON:"data-cart-mobile-button",CART_MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",CART_BUTTON_HIDDEN:"data-cart-button-hidden",CHECKOUT_URL:"data-checkout-url"},ELEMENT:{PRODUCT:"data-lce-product",PRODUCTS_LIST:"data-liquid-commerce-elements-products-list",PRODUCTS_LIST_ROWS:"data-rows",PRODUCTS_LIST_COLUMNS:"data-columns",PRODUCTS_LIST_FILTERS:"data-filters",PRODUCTS_LIST_FILTERS_CONTAINER:"data-filters-container",PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER:"data-search-container",PRODUCTS_LIST_PRODUCT_URL:"data-product-url",CART_TOGGLE_BUTTON:"data-lce-cart-toggle-button",CART_ITEMS_COUNT:"data-lce-cart-items-count"},JSON_SCRIPT:{PRODUCTS:"data-liquid-commerce-elements-products"}};function generateElementId({prefix:t,index:n}){const e=Math.random().toString(36).substring(2,7),i=void 0!==t?t:"",o=void 0!==n?n:"",r=i&&o?"-":"";return""+i+r+o+e}function pairsFromMainScript(t){const n=[];try{const i=t.getAttributeNames().filter(t=>t.substring(0,12)===Nt.SCRIPT.PRODUCT);for(const o of i)try{const e=o.match(/^data-product(-(.+))?$/),i=(null==e?void 0:e[2])?"-"+e[2]:"",r=""+Nt.SCRIPT.CONTAINER+i;if(t.hasAttribute(r)){const e=t.getAttribute(r),i=t.getAttribute(o);e&&i&&n.push({containerId:e,identifier:i})}}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",e)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",i)}return n}function pairsFromProductsScript(){const t=[];try{const e=document.querySelectorAll("script["+Nt.JSON_SCRIPT.PRODUCTS+"]");for(const i of e)try{const n=JSON.parse(i.textContent||"[]");if(!Array.isArray(n))continue;for(const e of n)e.containerId&&e.identifier&&t.push({containerId:e.containerId,identifier:e.identifier})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",n)}}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",e)}return t}function pairsFromAttributedElements(){const t=[];try{const e=document.querySelectorAll("div["+Nt.ELEMENT.PRODUCT+"]");let i=0;for(const o of e)try{const n=generateElementId({prefix:"lce-p",index:i});o.setAttribute("id",n);const e=o.getAttribute(Nt.ELEMENT.PRODUCT);n&&e&&t.push({containerId:n,identifier:e}),i+=1}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",n)}}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",e)}return t}async function addProductToCartViaQueryParam(t,n){try{const i=n.getAttribute(Nt.SCRIPT.PRODUCT_PARAM),r=n.getAttribute(Nt.SCRIPT.PRODUCT_FULFILLMENT_TYPE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),a=s.get(i);if(!a)return;let c=o.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=s.get(r);t!==o.ON_DEMAND&&t!==o.SHIPPING||(c=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:a,fulfillmentType:c,quantity:1}],!![])}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",e)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",i)}}async function addPromoCodeToCartViaQueryParam(t,n){try{const i=n.getAttribute(Nt.SCRIPT.PROMO_CODE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),r=o.get(i);if(!r)return;try{await t.actions.cart.applyPromoCode(r)}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",e)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",i)}}async function setupCartButtonWithPosition(t,n,e,i){var o,r,s;try{const a=e.includes("mobile"),c=a?"mobile":"desktop",l=!a,d=n.getAttribute(e),m=n.getAttribute(i);if(!n.hasAttribute(e)&&!n.hasAttribute(i))return l&&t.ui.floatingCartButton(![]),void 0;if(l){if(n.hasAttribute(e)&&!d)return t.ui.floatingCartButton(![]),void 0;if(n.hasAttribute(i)&&!m)return t.ui.floatingCartButton(!![]),void 0}const g=d||m,v=!!m;if(!g)return l&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(v)),void 0;const y=["above","below","replace","inside"],b=g.match(/^(\w+):(.+)$/),k=b&&y.includes(b[1])?b[1]:"inside";let E=b?b[2]:g;/^[#.]/.test(E)||/\s/.test(E)||(E="#"+E);const _=document.querySelector(E);if(!_)return l&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+E+'" not found. Using floating button.'),t.ui.floatingCartButton(v)),void 0;const F=document.createElement("div");switch(F.classList.add("lce-cart-"+c+"-button-container"),F.id=generateElementId({prefix:"lce-cart-"+c+"-btn"}),k){case"above":null===(o=_.parentNode)||void 0===o?void 0:o.insertBefore(F,_);break;case"below":null===(r=_.parentNode)||void 0===r?void 0:r.insertBefore(F,_.nextSibling);break;case"replace":null===(s=_.parentNode)||void 0===s?void 0:s.replaceChild(F,_);break;default:_.appendChild(F)}t.ui.cartButton(F.id,v)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",a)}}async function setupCartButtons(t,n){n.hasAttribute(Nt.SCRIPT.CART_BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,n,Nt.SCRIPT.CART_BUTTON,Nt.SCRIPT.CART_BADGE_BUTTON),await setupCartButtonWithPosition(t,n,Nt.SCRIPT.CART_MOBILE_BUTTON,Nt.SCRIPT.CART_MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const n=document.querySelector("div["+Nt.ELEMENT.PRODUCTS_LIST+"]"),e=document.querySelector("div["+Nt.ELEMENT.PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER+"]"),i=document.querySelector("div["+Nt.ELEMENT.PRODUCTS_LIST_FILTERS_CONTAINER+"]");if(!n)return;const o="lce-products-list-container";if(n.className="lce-products-list-container",n.id=o,e){const n="lce-product-list-search-container";e.className="lce-product-list-search-container",e.id=n,t.injectProductListSearch({containerId:n})}if(i){const n="lce-product-list-filters-container";i.className="lce-product-list-filters-container",i.id=n;const e=i.getAttribute(Nt.ELEMENT.PRODUCTS_LIST_FILTERS);let o=[];e&&(o=e.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductListFilters({containerId:n,filters:o})}const r=Number.parseInt(n.getAttribute(Nt.ELEMENT.PRODUCTS_LIST_ROWS)||"3",10)||3,s=Number.parseInt(n.getAttribute(Nt.ELEMENT.PRODUCTS_LIST_COLUMNS)||"4",10)||4,a=n.getAttribute(Nt.ELEMENT.PRODUCTS_LIST_FILTERS),c=n.getAttribute(Nt.ELEMENT.PRODUCTS_LIST_PRODUCT_URL)||void 0;let l=[];a&&(l=a.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductList({containerId:o,rows:r,columns:s,filters:l,productUrl:c})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",n)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const n=t.detail;if(!n.data.isReady)return;const e=window.elements,i=document.querySelectorAll("["+Nt.ELEMENT.CART_TOGGLE_BUTTON+"]");if(i.length>0)for(const r of i)r.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),e.actions.cart.toggleCart()});const o=document.querySelectorAll("["+Nt.ELEMENT.CART_ITEMS_COUNT+"]");if(o.length>0){let t=0;for(const n of o){const i=n.getAttribute(Nt.ELEMENT.CART_ITEMS_COUNT),o=!(i&&"keep-zero"===i),r=Boolean(null==n?void 0:n.id);let s;r?s=n.id:(s=generateElementId({prefix:"lce-cart-items-count",index:t}),n.id=s),e.ui.cartItemsCount(s,{hideZero:o}),t+=1}}})}catch(xt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",xt)}}async function ElementsAutoInitialize(){var n,e,i,o,s;try{const a=document.querySelector("script["+Nt.SCRIPT.MAIN+"]");if(!a)return;const c=a.getAttribute(Nt.SCRIPT.TOKEN),l=a.getAttribute(Nt.SCRIPT.ENV)||t.PRODUCTION,d=a.getAttribute(Nt.SCRIPT.DEBUG_MODE);if(!c)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const m=a.getAttribute(Nt.SCRIPT.PROMO_CODE),g=a.getAttribute(Nt.SCRIPT.PROMO_TEXT),v=null!==(n=a.getAttribute(Nt.SCRIPT.PROMO_SEPARATOR))&&void 0!==n?n:"•",y=null!==(e=a.getAttribute(Nt.SCRIPT.PROMO_ACTIVE_FROM))&&void 0!==e?e:void 0,b=null!==(i=a.getAttribute(Nt.SCRIPT.PROMO_ACTIVE_UNTIL))&&void 0!==i?i:void 0,k=a.getAttribute(Nt.SCRIPT.CHECKOUT_URL)||void 0,E=pairsFromMainScript(a),_=pairsFromProductsScript(),F=pairsFromAttributedElements(),D=[...E,..._,...F],T=m&&g&&y&&b?{promoCode:m,text:g.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:v,activeFrom:null===(o=new Date(y))||void 0===o?void 0:o.toISOString(),activeUntil:null===(s=new Date(b))||void 0===s?void 0:s.toISOString()}:void 0;let A=r.NONE;d&&l!==t.PRODUCTION&&(A=d),setupEventListeners();const O=await Elements(c,{env:l,debugMode:A,promoTicker:T?[T]:void 0,checkout:k?{pageUrl:k}:void 0,development:getDevelopmentConfigs()});if(!O)throw new SDKError("Elements SDK client initialization failed",!![]);setupCartButtons(O,a),0!==D.length&&O.injectProductElement(D).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),await initializeProductsList(O),addProductToCartViaQueryParam(O,a),addPromoCodeToCartViaQueryParam(O,a),setupCheckout(a,O.injectCheckoutElement.bind(O),{requireCheckoutId:!![],errorPrefix:"[LiquidCommerce Elements Auto Initialization]"})}catch(a){console.error("[LiquidCommerce Elements Auto Initialization]",a)}}function triggerElementsAutoInit(){triggerAutoInit(ElementsAutoInitialize,"[LiquidCommerce Elements Auto Initialization]")}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const n of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(n){throw this.logger.error("❌ Failed to update global theme configuration",n),new SDKError("Failed to update global configuration: "+n.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const n of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(n){throw this.logger.error("❌ Failed to update product component theme",n),new SDKError("Failed to update product configuration: "+n.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const n of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(n){throw this.logger.error("❌ Failed to update cart component theme",n),new SDKError("Failed to update cart configuration: "+n.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const n of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(n){throw this.logger.error("❌ Failed to update checkout component theme",n),new SDKError("Failed to update checkout configuration: "+n.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(n){throw this.logger.error("❌ Failed to update address component theme",n),new SDKError("Failed to update address configuration: "+n.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:i.ADDRESS,containerId:t,options:n})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:i.CART,containerId:t})}async injectCheckoutElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=await this.processInjectElement({type:i.CHECKOUT,containerId:t});if(null==n?void 0:n.simulatePresale){const t=n.presaleExpiresInMinutes||15,e=new Date;e.setMinutes(e.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:e.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return e}}async function ElementsBuilder(t,e){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:!![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,checkout:e.checkout,proxy:void 0,development:void 0});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={updateComponentGlobalConfigs:r.updateComponentGlobalConfigs.bind(r),updateProductComponent:r.updateProductComponent.bind(r),updateAddressComponent:r.updateAddressComponent.bind(r),updateCartComponent:r.updateCartComponent.bind(r),updateCheckoutComponent:r.updateCheckoutComponent.bind(r),injectElement:r.injectElement.bind(r),injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),actions:r.actions};window.elementsBuilder=s;const a=PubSubService.getInstance();return a.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(n,e,i,o,r)=>isSDKError(r,e)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:n,source:e,lineno:i,colno:o,error:r}),!![]):t?t(n,e,i,o,r):![];const n=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;n&&n.call(window,t)};try{initializeDOMPolyfills()}catch(Bt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Bt)}try{triggerElementsAutoInit()}catch(qt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",qt)}}catch(Ut){console.error("[LiquidCommerce Elements] SDK initialization failed:",Ut)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});