@liquidcommerce/elements-sdk 2.5.6-beta.3 → 2.5.6-beta.4

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.
package/umd/elements.js CHANGED
@@ -1 +1 @@
1
- (function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):(e="undefined"!=typeof globalThis?globalThis:e||self,i(e.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...e){for(;this.firstChild;)this.removeChild(this.firstChild);for(const i of e)"string"==typeof i?this.appendChild(document.createTextNode(i)):this.appendChild(i)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const i=document.createDocumentFragment();for(const o of e)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);this.insertBefore(i,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(...e){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const i={};for(const[o,r]of e)i[o]=r;return i})}function safeScrollIntoView(e,i){try{i&&"function"==typeof e.scrollIntoView?e.scrollIntoView(i):e.scrollIntoView()}catch(o){try{e.scrollIntoView()}catch(r){console.warn("scrollIntoView failed:",r)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(G){console.warn("DOM polyfills initialization failed:",G)}}function safeReplaceChildren(e,...i){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...i);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const o of i)"string"==typeof o?e.appendChild(document.createTextNode(o)):e.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===i.length&&"string"==typeof i[0]&&(e.innerHTML=i[0])}}class SDKError extends Error{constructor(e,i=![]){super(e),this.name="SDKError",this.isSdk=!![],this.reThrow=i,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(e,i){if((null==e?void 0:e.isSdk)===!![])return e instanceof SDKError&&e.reThrow?![]:!![];if(!e||"object"!=typeof e)return i?isSDKSource(i):![];const o=String((null==e?void 0:e.message)||""),r=/liquidcommerce\s+elements/i.test(o),c=String((null==e?void 0:e.stack)||""),l=(null==e?void 0:e.source)||i||"",d=[/@[/\\](?: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],u=[/\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/],h=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?: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(l),f=d.some(e=>e.test(c)),v=u.some(e=>e.test(c)),y=h.some(e=>e.test(c)),b=p.some(e=>e.test(c));return r||m||f||v||y||b}function isSDKSource(e){if(!e||"string"!=typeof e)return![];const i=[/\/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 i.some(i=>i.test(e))}const e={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},i={CLIENT_READY:"client_ready",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",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",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_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_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"},o={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},r={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-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",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_CARD_LOADING:"product-list-card-loading",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_SECTION:"checkout-information-section",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT_FORM:"checkout-payment-form",CHECKOUT_BILLING_FORM:"checkout-billing-form",CHECKOUT_SUMMARY_SECTION:"checkout-summary-section",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_DELIVERY_INFORMATION_FORM:"checkout-delivery-information-form",CHECKOUT_BUYER_INFORMATION_FORM:"checkout-buyer-information-form",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"},c={ON_DEMAND:"onDemand",SHIPPING:"shipping"},l={NONE:"none",CONSOLE:"console",PANEL:"panel"},d={[e.LOCAL]:"http://127.0.0.1:8080",[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},u={STANDARD:"standard"},h={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options"},p={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};class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(e){SingletonManager.clientConstructor=e}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(e,i){const o=SingletonManager.getInstances();o.has(e)||o.set(e,i());const r=o.get(e);if(!r)throw new SDKError("ElementsSdk: Instance for class "+e+" could not be created.");return r}static async getClient(e){const i=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),o="LiquidCommerceElementsClient_"+i,r=SingletonManager.getInstances();if(r.has(o))return r.get(o);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const c=new SingletonManager.clientConstructor(e);return await c.prepare(),r.set(o,c),c}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,i={}){this.validateInputs(e,i),this.config=Object.freeze(this.buildConfiguration(e,i))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,i){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[e]:i})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===l.CONSOLE||e===l.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===l.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===l.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(i,o){if(!(null==i?void 0:i.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(o.env&&!Object.values(e).includes(o.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+o.env+'". Using default environment.'),o.env=void 0),void 0!==o.isBuilder&&"boolean"!=typeof o.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),o.isBuilder=void 0),void 0===o.debugMode||Object.values(l).includes(o.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+o.debugMode+'". Must be one of: '+Object.values(l).join(", ")+". Using default value."),o.debugMode=void 0),o.promoTicker&&"object"!=typeof o.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),o.promoTicker=void 0),o.promoTicker)if(Array.isArray(o.promoTicker)){const e=o.promoTicker.filter((e,i)=>{if("string"!=typeof e.promoCode||!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(e.text)||0===e.text.length||!e.text.every(e=>"string"==typeof e&&e.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof e.separator||!e.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil is required. Skipping this promo."),![];const r="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return r instanceof Date&&!Number.isNaN(r.getTime())?o>=r?(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});o.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),o.promoTicker=void 0;o.proxy&&("object"!=typeof o.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),o.proxy=void 0):o.proxy.baseUrl&&"string"==typeof o.proxy.baseUrl?o.proxy.headers&&"object"!=typeof o.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),o.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),o.proxy=void 0))}buildConfiguration(i,o){var r,c;const u=o.env||e.STAGING,h=d[u];return{apiKey:i.trim(),env:u,isBuilder:null!==(r=o.isBuilder)&&void 0!==r?r:![],debugMode:null!==(c=o.debugMode)&&void 0!==c?c:l.NONE,baseUrl:h,partnerCode:void 0,partnerName:void 0,customTheme:o.customTheme||null,proxy:o.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:o.promoTicker||null}}detectDeviceType(){var e,i;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),r="ontouchstart"in window||navigator.maxTouchPoints>0,c=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,l=(null===(i=window.screen)||void 0===i?void 0:i.height)||0,d=Math.max(c,l),u=[/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/],h=[/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 u.some(e=>e.test(o))?"tablet":h.some(e=>e.test(o))||r&&d<768?"mobile":r&&d>=768&&d<=1200||r&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&r&&d>=768||/windows nt/i.test(o)&&r&&d>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}class LoggerService{constructor(e){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=e}static getInstance(e){return SingletonManager.getClassInstance("LoggerService_"+e,()=>new LoggerService(e))}setEnableLogging(e){this.enableLogging=e}setTelemetryService(e){this.telemetryService=e}getPrefix(e){if(!this.enableLogging)return[];const i=(new Date).toISOString().slice(11,23);return["%c["+i+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[e],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[e],"color: "+this.colors[e]]}debug(e,i){if(this.sendToTelemetry("debug",e,void 0,i),!this.enableLogging)return;const[o,...r]=this.getPrefix("debug");void 0!==i?console.debug(o,...r,e,i):console.debug(o,...r,e)}info(e,i){if(!this.enableLogging)return;const[o,...r]=this.getPrefix("info");void 0!==i?console.info(o,...r,e,i):console.info(o,...r,e)}warn(e,i){if(this.sendToTelemetry("warn",e,void 0,i),!this.enableLogging)return;const[o,...r]=this.getPrefix("warn");void 0!==i?console.warn(o,...r,e,i):console.warn(o,...r,e)}error(e,i){const o=i instanceof Error,r=o?i:void 0,c=!o&&i?i:void 0;if(this.sendToTelemetry("error",e,r,c),!this.enableLogging)return;const[l,...d]=this.getPrefix("error");void 0!==i?console.error(l,...d,e,i):console.error(l,...d,e)}group(e,i=![]){if(!this.enableLogging)return;const[o,...r]=this.getPrefix("log");i?console.groupCollapsed(o,...r,e):console.group(o,...r,e)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(e,i,o,r){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,i,{context:this.context,error:o,data:r})}catch(c){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const i=this.getInstances();if(!i.has(e)){const o=LoggerService.getInstance(e);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),i.set(e,o)}return i.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const i=this.getInstances();for(const[,o]of i)o.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const i=this.getInstances();for(const[,o]of i)o.setTelemetryService(e)}}function componentError({componentType:e,message:i}){const o=document.createElement("div");o.className=e;const r=o.attachShadow({mode:"closed"}),c=document.createElement("style");c.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\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 l=document.createElement("div"),d=document.createElement("h3");d.textContent="Component </"+e+">";const u=document.createElement("p");return u.textContent=i,l.appendChild(c),l.appendChild(d),l.appendChild(u),r.appendChild(l),o}function productionComponentError({title:e,message:i,componentType:o}){const r=document.createElement("div");r.setAttribute("data-component-type",o);const c=r.attachShadow({mode:"closed"}),l=document.createElement("style");l.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\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 d=document.createElement("div"),u=document.createElement("h2");u.textContent=e;const h=document.createElement("p");return h.textContent=i,d.appendChild(l),d.appendChild(u),d.appendChild(h),c.appendChild(d),r}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(e,i){ComponentFactoryService.getComponentRegistry().set(e,i)}static createElement(e){try{const i=ComponentFactoryService.getComponentRegistry().get(e.type);if(!i)throw new SDKError("Component type ["+e.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(o)||window.customElements.define(o,i);const c=document.createElement(o);if(c.initialize){const{type:i,useShadowDom:r,wrapInLceElement:l,...d}=e,u={type:i,tagName:o,useShadowDom:r&&l!==!![]};c.initialize({data:d,config:u})}if(e.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,i);const l=document.createElement(o);return l.initialize(e.type,c),l}return c}catch(i){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e.type}):componentError({componentType:e.type,message:(null==i?void 0:i.message)||i})}}static componentError({componentType:e,message:i}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({componentType:e,message:i})}static getComponentTagName(e){const i={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.BIRTHDATE_INPUT]:"birthdate-input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.PRODUCT_LIST]:"product-list-lc",[r.PRODUCT_LIST_CARD]:"product-list-card-lc",[r.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[r.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[r.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[r.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[r.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return i[e]||e.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(e,i){this.publishSpecific("actions."+e,i)}publishForm(e,i){this.publishSpecific("forms."+e,i)}publishSpecific(e,i){const[o,r]=e.includes(".")?e.split(".",2):["actions",e];let c=r.split("_")[0];["product","cart","address","checkout"].includes(c)||(c="other");const l=Date.now(),d={eventId:"evt_"+l+"_"+Math.random().toString(36).slice(2,9),namespace:o,event:r,originalEvent:e,actionNamespace:"actions"===o?c:void 0,timestamp:l},u={data:i,metadata:d};this.dispatchNativeEvents(e,u)}dispatchNativeEvents(e,i){const[o]=e.split(".",2);try{"actions.client_ready"===e&&(this.clientReadyEvent=i);const r=new CustomEvent(this.eventPrefix+":"+e,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(r);const c=new CustomEvent(this.eventPrefix+":"+o,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(c)}catch(r){this.logger.error("Error dispatching native events for "+e,r)}}setupClientReadyBuffering(){const e=window.addEventListener,i=this.eventPrefix+":actions.client_ready";window.addEventListener=(o,r,c)=>{if(o!==i)return e.call(window,o,r,c);if(!this.clientReadyEvent)return e.call(window,o,r,c);try{const e=new CustomEvent(i,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof r?r(e):r&&"function"==typeof r.handleEvent&&r.handleEvent(e)}catch(l){this.logger.error("Error replaying CLIENT_READY event",l)}return e.call(window,o,r,c)}}}function centToDollar(e){return e/100}function formatCentToDollarText(e,i=!![]){const o=Math.floor(e/100),r=e%100;let c="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||r>0)&&(c+=".",c+=r<10?"0"+r:r.toString()),c}function htmlStringToElement(e){const i=document.createElement("template");return i.innerHTML=e.trim(),i.content.firstElementChild}function format24TimeTo12$1(e){const i=e.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new SDKError("Invalid time format: "+e);const o=Number.parseInt(i[1],10),r=Number.parseInt(i[2],10);if(o<0||o>23||r<0||r>59)throw new SDKError("Invalid time values: "+e);const c=o>=12?"PM":"AM",l=o%12||12;return l+":"+r.toString().padStart(2,"0")+" "+c}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const i=new Date(e);if(Number.isNaN(i.getTime()))return"";const o=(i.getMonth()+1).toString().padStart(2,"0"),r=i.getDate().toString().padStart(2,"0"),c=i.getFullYear().toString();return o+"/"+r+"/"+c}catch(i){return""}}function validateMinimumAge(e,i=21,o=1930){if(!e)return{isValid:![],age:null,error:"Birth date is required"};try{const r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const c=new Date;if(r>c)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const l=r.getFullYear();if(l<o)return{isValid:![],age:null,error:"Birth year cannot be before "+o+". Please check your birth date."};const d=calculateAge(r,c);return d<i?{isValid:![],age:d,error:"Must be at least "+i+" years old"}:{isValid:!![],age:d}}catch(r){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(e,i){let o=i.getFullYear()-e.getFullYear();const r=i.getMonth()-e.getMonth();return(r<0||0===r&&i.getDate()<e.getDate())&&o--,Math.max(0,o)}function buildFormattedAddressString(e){const i=[],o=[];e.one&&e.one.trim()&&o.push(e.one.trim()),e.two&&e.two.trim()&&o.push(e.two.trim()),o.length>0&&i.push(o.join(" ")),e.city&&e.city.trim()&&i.push(e.city.trim());const r=[];return e.state&&e.state.trim()&&r.push(e.state.trim()),e.zip&&e.zip.trim()&&r.push(e.zip.trim()),r.length>0&&i.push(r.join(" ")),e.country&&e.country.trim()&&i.push(e.country.trim()),i.join(", ")}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const i=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:i[0]||"",category2:i[1]||"",category3:i[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(e){this.client=e}async getAllConfigs(){try{this.ensureClientInitialized();const e=await this.client.get("/configs");if(!this.validResponseData(e))throw this.logger.error("Invalid response data",e),new SDKError("Failed to fetch all configs: Invalid response data");return e.data}catch(e){throw this.logger.error("Error fetching configs",e),e}}async setPersistedStore(e,i){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!i||0===Object.keys(i).length)return this.logger.error("No data provided to set persisted store"),void 0;const o=await this.client.post("/configs/store/"+e,{body:i});200!==o.statusCode&&this.logger.error("Failed to set persisted store",o)}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(e){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to get persisted store"),null;const i=await this.client.get("/configs/store/"+e);return 200!==i.statusCode?(this.logger.error("Failed to fetch persisted store",i),null):i.data}catch(i){return this.logger.error("Error fetching persisted store",i),null}}async deletePersistedStore(e){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to delete persisted store"),void 0;const i=await this.client.delete("/configs/store/"+e);200!==i.statusCode&&this.logger.error("Failed to delete persisted store",i)}catch(i){this.logger.error("Error deleting persisted store",i)}}async getProductsData(e,i){try{if(this.ensureClientInitialized(),0===e.length)return this.logger.error("No product identifiers provided"),null;const o={upcs:e,ids:e,grouping:e,shouldShowOffHours:!![],isLegacy:!![],loc:i},r=await this.client.post("/cloud/catalog/availability",{body:o});return 200!==r.statusCode?(this.logger.error("Failed to fetch product data",r),null):{products:r.products,retailers:r.retailers}}catch(o){return this.logger.error("Error fetching product data",o),null}}async getCartData(e){try{this.ensureClientInitialized();const i=await this.client.get("/cloud/cart"+(e?"?id="+e:""));if(200!==i.statusCode)throw this.logger.error("Failed to fetch cart data",i),new SDKError("Failed to fetch cart data: "+i.message);return i.cart}catch(i){throw this.logger.error("Error fetching cart data",i),i}}async updateCart(e){try{this.ensureClientInitialized();const i=await this.client.put("/cloud/cart",{body:e});if(200!==i.statusCode)throw this.logger.error("Failed to update cart",i),new SDKError("Failed to update cart: "+i.message);return i.cart}catch(i){throw this.logger.error("Error updating cart",i),i}}async getAddressSuggestions(e){try{if(this.ensureClientInitialized(),!e||0===e.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const i=await this.client.get("/cloud/address/autocomplete?input="+e);return 200!==i.statusCode?(this.logger.error("Failed to fetch address suggestions",i),[]):i.data}catch(i){return this.logger.error("Error fetching address suggestions",i),[]}}async getAddressDetails(e){try{if(this.ensureClientInitialized(),!e||0===e.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 i=await this.client.get("/cloud/address/details/"+e);if(200!==i.statusCode)throw this.logger.error("Failed to fetch address details",i),new SDKError("Failed to fetch address details: "+i.message);return i.data}catch(i){throw this.logger.error("Error fetching address details",i),i}}async prepareCheckout(e){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/prepare",{body:e});if(200!==i.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",i),new SDKError("Failed to fetch prepare checkout data: "+i.message);return i.checkout}catch(o){throw this.logger.error("Error fetching prepare checkout data:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),o}}async getPaymentSession(e){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/payment/session",{body:e});if(201!==i.statusCode)throw this.logger.error("Failed to get payment session",i),new SDKError("Failed to get payment session: "+i.message);return i.data}catch(o){throw this.logger.error("Error fetching payment session:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),o}}async confirmPaymentSession(e,i){try{this.ensureClientInitialized();const o=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:e,setupIntentId:i}});if(200!==o.statusCode)throw this.logger.error("Failed to confirm payment session",o),new SDKError("Failed to confirm payment session: "+o.message);return o.data}catch(o){throw this.logger.error("Error confirming payment session",o),o}}async checkoutComplete(e){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/complete",{body:e});if(200!==i.statusCode)throw this.logger.error("Failed to complete checkout",i),new SDKError("Failed to complete checkout: "+i.message);return i.order}catch(o){if(this.logger.error("Error completing checkout:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),null==o?void 0:o.error)throw new SDKError(o.error);throw o}}async catalogSearch(e){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/catalog/search",{body:e});if(200!==i.statusCode)throw this.logger.error("Failed to fetch catalog search data",i),new SDKError("Failed to fetch catalog search data: "+i.message);return{products:i.products,retailers:i.retailers,navigation:i.navigation}}catch(o){return this.logger.error("Error fetching catalog search data:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),{products:[],retailers:[],navigation:void 0}}}validResponseData(e){return e.data&&"object"==typeof e.data&&Object.keys(e.data).length>0}ensureClientInitialized(){if(!this.client)throw new SDKError("API client is not initialized")}}function fetchAdapter(e){return async(i,o)=>{var r;const c=await e(i,o);let l;if("function"==typeof(null===(r=c.headers)||void 0===r?void 0:r.entries))l=Object.fromEntries(c.headers.entries());else{l={};for(const[e,i]of c.headers)l[e]=i}return{ok:c.ok,status:c.status,statusText:c.statusText,headers:l,json:()=>c.json(),text:()=>c.text()}}}const xhrFetch=(e,i)=>new Promise((o,r)=>{const c=new XMLHttpRequest;c.open(i.method||"GET",e);for(const[e,l]of Object.entries(i.headers))c.setRequestHeader(e,l);c.onload=()=>{o({ok:c.status>=200&&c.status<300,status:c.status,statusText:c.statusText,headers:c.getAllResponseHeaders().split("\r\n").reduce((e,i)=>{const[o,r]=i.split(": ");return o&&r&&(e[o]=r),e},{}),json:()=>Promise.resolve(JSON.parse(c.responseText)),text:()=>Promise.resolve(c.responseText)})},c.onerror=()=>{r(new TypeError("Network request failed"))},c.send(i.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}class AuthService{constructor(e){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=e.apiKey,this.baseUrl=e.baseUrl,this.env=e.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(e))}async authenticate(){var e,i;if(this.isAuthenticating)return await new Promise(e=>{const n=()=>{this.isAuthenticating?setTimeout(n,100):e(void 0)};n()}),!!this.accessToken;this.isAuthenticating=!![];try{const o=await this.request("/auth",{method:"GET"},0,!![]),r=3e5;return this.accessToken=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.token,this.tokenExpiration=(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.exp)-r,!![]}catch(o){return this.logger.error("Authentication failed",o),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(e,i,o=0,r=![]){r||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const c=this.buildUrl(e),l={"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(),...this.getProxyHeaders(),...i.headers};r?l["X-Liquid-Api-Key"]=this.apiKey:l.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(l["X-Liquid-Api-Builder"]=!![]);const d={method:i.method,headers:l,body:i.body?JSON.stringify(i.body):void 0},u=await this.httpClient(c,d);if(u.ok)try{return await u.json()}catch(p){return this.logger.error("Failed to parse successful response data",p),{message:await u.text().catch(()=>"Success")}}let h;try{h=await u.json()}catch(m){const e=await u.text().catch(()=>"HTTP error status: "+u.status);h={message:e||"Unknown error"},this.logger.error("Failed to parse error response data",m)}if(!r){const c=2,l=(null==h?void 0:h.statusCode)>=5e3&&(null==h?void 0:h.statusCode)<=5010;if(l&&o<c)return this.logger.warn("Authorization error detected (status: "+u.status+", code: "+(null==h?void 0:h.statusCode)+"). Retry attempt "+(o+1)+"/"+c+" in 3 seconds..."),this.accessToken=null,this.tokenExpiration=null,await new Promise(e=>setTimeout(e,3e3)),this.request(e,i,o+1,r)}throw{...h,status:u.status,message:(null==h?void 0:h.message)||"Request failed"}}buildUrl(e){const i=this.clientConfig.getProxyConfig();return new URL("api"+e,i?i.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const e=this.clientConfig.getProxyConfig();return e?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...e.headers}:{}}async get(e,i){return this.request(e,{method:"GET",headers:null==i?void 0:i.headers})}async post(e,i){return this.request(e,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}async put(e,i){return this.request(e,{method:"PUT",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}async delete(e,i){return this.request(e,{method:"DELETE",headers:null==i?void 0:i.headers})}}const m="@liquidcommerce/elements-sdk",f="LiquidCommerce Elements SDK",v="UNLICENSED",y="LiquidCommerce Team",b="2.5.6-beta.3",x="https://docs.liquidcommerce.co/elements-sdk",w={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},C={url:"https://github.com/liquidcommerce/elements-sdk/issues"},S="./dist/index.esm.js",E="./umd/elements.js",_="./dist/types/index.d.ts",D="pnpm@10.0.0",I={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},A=["dist","umd","docs","README.md","LICENSE"],z={access:"public",registry:"https://registry.npmjs.org/"},O="module",N=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],M={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","clean:hard":"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"},R=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],B={"@biomejs/biome":"2.3.3","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@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.1","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.1","ts-node":"^10.9.2",typescript:"^5.9.3"},q={node:">=22"},j={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},G={name:m,description:f,license:v,author:y,version:b,homepage:x,repository:w,bugs:C,module:S,browser:E,types:_,packageManager:D,exports:I,files:A,publishConfig:z,type:O,sideEffects:N,scripts:M,keywords:R,devDependencies:B,engines:q,pnpm:j};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],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(e=>{if("loading"!==document.readyState)return e(),void 0;document.addEventListener("DOMContentLoaded",()=>e())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.length>0}isContainerLoaded(e){const i=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return i.some(i=>{const o=i.src;return o.includes("id="+e)})}isContainerInitialized(e){if(!window.dataLayer||!Array.isArray(window.dataLayer))return![];if(!this.isContainerLoaded(e))return![];const i=window.dataLayer.some(e=>e&&"object"==typeof e&&("gtm.start"in e||"gtm.js"===e.event));return i||window.dataLayer.length>0}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...e)=>window.dataLayer.push(e),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(e){return new Promise((i,o)=>{if(this.isContainerInitialized(e))return this.logger.info("GTM container "+e+" already loaded and initialized, skipping script injection"),i(),void 0;if(this.isContainerLoaded(e)){this.logger.info("GTM container "+e+" script present, checking initialization status");const r=setInterval(()=>{this.isContainerInitialized(e)&&(clearInterval(r),clearTimeout(c),this.logger.info("GTM container "+e+" initialized successfully"),i())},100),c=setTimeout(()=>{clearInterval(r),o(new Error("GTM container "+e+" script present but failed to initialize (possible CSP or network issue)"))},1e4);return}this.logger.info("Loading GTM container "+e);const r=document.createElement("script");r.src="https://www.googletagmanager.com/gtm.js?id="+e,r.async=!![],r.crossOrigin="anonymous";const c=setTimeout(()=>{this.isContainerInitialized(e)?(this.logger.info("GTM container "+e+" initialized despite timeout warning"),i()):o(new Error("GTM script timeout: "+e+" (possible network issue or CSP blocking)"))},15e3);let l=![];r.onload=()=>{l||(l=!![],setTimeout(()=>{if(clearTimeout(c),this.isContainerInitialized(e))this.logger.info("GTM container "+e+" loaded and initialized successfully"),i();else{const r="GTM container "+e+" script loaded but failed to initialize. This may indicate a Content Security Policy (CSP) issue or network error.";this.logger.warn(r),window.dataLayer&&Array.isArray(window.dataLayer)?(this.logger.info("dataLayer available, continuing with GTM initialization"),i()):o(new Error(r))}},500))},r.onerror=r=>{l||setTimeout(()=>{if(this.isContainerLoaded(e)&&this.isContainerInitialized(e))return l||(l=!![],clearTimeout(c),this.logger.info("GTM container "+e+" loaded successfully despite error event (Safari quirk)"),i()),void 0;if(!l){l=!![],clearTimeout(c);let i="GTM script failed to load: "+e;"string"==typeof r?i+=". Error: "+r:r instanceof ErrorEvent&&r.message?i+=". Error: "+r.message:r instanceof Event&&(i+=". Event type: "+r.type);const d=i+". Possible causes: Content Security Policy (CSP) blocking, network failure, or invalid container ID.";this.logger.error(d,{event:r}),o(new Error(d))}},100)},r.addEventListener("error",i=>{l||this.logger.error("GTM script error event for "+e,i)}),document.head.appendChild(r)})}processEventQueue(){const e=Date.now(),i=this.eventQueue.filter(i=>e-i.timestamp<3e4);for(const r of i)try{const e={event:r.eventName,...r.eventData};window.dataLayer.push(e),"function"==="object".gtag&&window.gtag("event",r.eventName,r.eventData),this.logger.debug("Processed queued GTM event: "+r.eventName,{data:r.eventData})}catch(o){this.logger.error("Error processing queued event "+r.methodName,o)}this.eventQueue=[],i.length>0&&this.logger.info("Processed "+i.length+" queued GTM events")}getSendToTargets(){const e=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||e.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&e.push(this.partnerGtmId),0===e.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),e}async initialize(e){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(e);try{await this.initializationPromise}catch(i){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",i)}}}async doInitialize(e){if(!(null==e?void 0:e.partnerName)||!(null==e?void 0:e.liquidCommerceGtmId))throw new SDKError("GTM config missing required fields");if(!e.liquidCommerceEnableGaTracking&&!e.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=e.partnerName,this.partnerGtmId=e.partnerGtmId,this.liquidCommerceGtmId=e.liquidCommerceGtmId,this.partnerEnableGaTracking=e.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=e.liquidCommerceEnableGaTracking;const i=this.isGTMAlreadyLoaded();i&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let o=![],r="";if(e.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(e.liquidCommerceGtmId),o=!![],r=i?"GTM integrated with existing setup (Partner GTM detected, LC container: "+e.liquidCommerceGtmId+")":"GTM initialized with container "+e.liquidCommerceGtmId}catch(c){const e=(null==c?void 0:c.message)||String(c);this.logger.error("Failed to load LiquidCommerce GTM container: "+e+". Checking if partner GTM is available.",c),window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.length>0&&this.logger.warn("LiquidCommerce GTM script failed, but dataLayer is available. Attempting to proceed with existing GTM setup.")}if(o||(i&&window.dataLayer&&Array.isArray(window.dataLayer)&&(this.isContainerInitialized(e.partnerGtmId||"")||window.dataLayer.length>0)&&(o=!![],r="GTM integrated with existing partner setup (LiquidCommerce container failed to load)",this.logger.info("Using partner GTM as fallback after LiquidCommerce GTM load failure")),!o&&window.dataLayer&&Array.isArray(window.dataLayer)&&(o=!![],r="GTM initialized with dataLayer (basic functionality available, container script may have failed)",this.logger.warn("LiquidCommerce GTM container failed to load, but using basic dataLayer for event tracking"))),!o)throw this.isInitializing=![],new SDKError("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(r),this.processEventQueue()}executeEvent(e,i,o){try{if(this.clientConfigService.isBuilder())return;const r=this.getSendToTargets(),c={...o,...r.length>0&&{send_to:r},tenant_source:G.description+" v"+G.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:i,eventData:c,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+i+" (initialization pending)",{data:c}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+i+" skipped: dataLayer not available"),void 0;const l={event:i,...c};window.dataLayer.push(l),"function"==="object".gtag&&window.gtag("event",i,c),this.logger.debug("Sent GTM event: "+i,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:r.length>0?r:"no targeting",data:c})}catch(r){this.logger.error("GTM "+e+" error",r)}}calculateValue(e){const i=e.reduce((e,i)=>e+(i.price||0)*(i.quantity||1),0);return Number.parseFloat(i.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,i,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:i,item_list_name:o,items:e})}selectItem(e,i,o){this.executeEvent("selectItem","select_item",{item_list_id:i,item_list_name:o,items:[e]})}addToCart(e){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),quantity:e.quantity||1,items:[e]})}viewCart(e){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(e),items:e})}removeFromCart(e){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}beginCheckout(e,i){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:i,items:e})}addShippingInfo(e,i){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:i,items:e})}addShippingInfoWithCustomerData(e,i,o,r){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:e,coupon:i,phone:null==o?void 0:o.phone,email:null==o?void 0:o.email,birth_date:null==o?void 0:o.birth_date,customer_id:null==o?void 0:o.customer_id,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}addPaymentInfo(e,i,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:i,coupon:o,items:e})}addPaymentInfoWithoutItems(e,i,o,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:e,payment_type:i,coupon:o,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}purchase(e){this.executeEvent("purchase","purchase",{transaction_id:e.transaction_id,value:e.value,currency:this.currency,tax:e.tax,shipping:e.shipping,coupon:e.coupon,items:e.items,subtotal:e.subtotal,total:e.total_before_discounts,discounts:e.discounts,gift_cards:e.gift_cards,net_total:e.net_total})}promoCodeAttempt(e){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:e})}promoCodeApplied(e,i){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:i})}promoCodeFailed(e,i){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:i})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,i){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:i})}giftCardFailed(e,i){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:i})}addressUpdated(e){this.executeEvent("addressUpdated","address_updated",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,coordinates:e.coordinates})}addressFailed(e){this.executeEvent("addressFailed","address_failed",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,address_error_message:e.error})}productNoAvailability(e){this.executeEvent("productNoAvailability","product_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productSizeNoAvailability(e){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productFulfillmentNoAvailability(e){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,fulfillment_type:e.fulfillmentType,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}}const U="liquid_elements",H={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:c.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},V={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},Y={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],isPresaleLocked:![],presaleExpiresAt:null,acceptedAccountCreation:![],deliveryTips:[],hasAgeVerify:![],hasSubstitutionPolicy:![],isGift:![],billingSameAsShipping:!![],marketingPreferences:{canEmail:![],canSms:![]},giftRecipient:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:null,message:null},customer:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:"",company:""},payment:{key:"",secret:"",paymentMethodId:null,sendSubmitSignal:![]},billing:null,promoCode:null,giftCards:[],orderNumber:null,items:{},readyForSubmit:{customer:![],gift:![],billing:![],payment:![],prepared:![]},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],isFormValid:![],invalidFields:[],focusField:null,onDemandFulfillmentTipInfo:{},tipSelection:10,stripeFormStatus:{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},deliveryInstructions:null,card:{brand:null,country:null,expMonth:null,expYear:null,last4:null,funding:null},giftCardError:null,promoCodeError:null,events:[]},W={drawer:{isOpen:![],contentConfig:null}},Q={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},Z={products:{},cart:V,address:Q,checkout:Y,ui:W};class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:e,payload:i,next:o})=>{const r=performance.now();this.logger.group("🏪 Store "+e+" ---------------------------------"),this.logger.debug("Payload:",i);try{const e=o(),i=performance.now()-r;return this.logger.debug("Completed in "+i.toFixed(3)+"ms"),e}catch(c){throw this.logger.error('Error during store action "'+e+'"',c),c}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:e,next:i})=>{const o=performance.now(),r=i(),c=performance.now()-o;return c>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+c.toFixed(2)+"ms"),r},this.state=Z,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:e,isLocalStorageAvailable:i,persistedStore:o}){this.localStorageKey=this.clientConfig.isBuilder()?U+"_builder_"+e:U+"_"+e,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:i,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const i=e.split(".");let o=this.state;for(const r of i){if(null==o)return;o=o[r]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(e,i){return this.runWithMiddleware("set",{path:e,value:i},()=>{const o=this.get(e);return this.state=this.immutableSet(this.state,e,i),this.notifyListeners(e,i,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,i){const o=this.get(e),r=i(o);return this.set(e,r)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const i=this.get(e);if(void 0===i)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const o=e.split(".");let r=this.state;const c=o.pop();for(const l of o){if(void 0===r[l])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];r=r[l]}if(Array.isArray(r))r=r.filter((e,i)=>i!==Number.parseInt(c,10));else{if("object"!=typeof r||null===r)return this.logger.warn('Cannot remove property "'+c+'" from non-object type at path "'+e+'".'),![];{const{[c]:e,...i}=r;r=i}}return this.state=this.immutableSet(this.state,o.join("."),r),this.notifyListeners(e,void 0,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const i=[];if("function"==typeof e){const o=e(this.state);for(const[e,r]of Object.entries(o)){const o=this.get(e);i.push({path:e,oldValue:o,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,r)}}else for(const[o,r]of Object.entries(e)){const e=this.get(o);i.push({path:o,oldValue:e,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,r)}for(const{path:e,oldValue:o,newValue:r}of i)this.notifyListeners(e,r,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,i){const o=e;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(i),()=>{var e;null===(e=this.listeners.get(o))||void 0===e?void 0:e.delete(i)}}watchMany(e,i){const o=[];let r;const c=e.map(e=>this.watch(e,(c,l)=>{o.push({path:e,value:c,oldValue:l}),clearTimeout(r),r=setTimeout(()=>{o.length>0&&(i([...o]),o.length=0)},0)}));return()=>{for(const e of c)e()}}createProductInstance(e){const i="products."+e,o=this.get(i);return o?!![]:this.set(i,H)}removeProductInstance(e){const i=this.get("products"),{[e]:o,...r}=i;return this.set("products",r)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(e,i,o){let r=0;const L=()=>{if(r>=this.middleware.length)return o();const c=this.middleware[r++];return c({action:e,payload:i,state:this.getState(),next:L})};return L()}immutableSet(e,i,o){const r=i.split(".");if(1===r.length){if(Array.isArray(e)){const i=[...e];return i[r[0]]=o,i}return{...e,[r[0]]:o}}const[c,...l]=r,d=e[c],u=Array.isArray(d)?[]:{};if(Array.isArray(e)){const i=[...e];return i[c]=this.immutableSet(d||u,l.join("."),o),i}return{...e,[c]:this.immutableSet(d||u,l.join("."),o)}}notifyListeners(e,i,o){const r=this.listeners.get(e);if(r)for(const u of r)try{u(i,o)}catch(l){this.logger.error('Error in store listener for path "'+e+'"',l)}const c=e.split(".");for(let u=c.length-1;u>0;u--){const e=c.slice(0,u).join("."),i=this.listeners.get(e);if(i){const r=this.get(e),l=c.slice(u).join("."),h=this.immutableSet(r,l,o);for(const o of i)try{o(r,h)}catch(d){this.logger.error('Error in store listener for parent path "'+e+'"',d)}}}}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 e;const i=this.get("address.id")||"",o=this.get("cart.id")||"";if(!i&&!o)return this.logger.debug("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.debug("Session data persisted to localStorage",{addressId:i,cartId:o}),void 0;try{const r=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(r,{p:i,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:r,addressId:i,cartId:o})}catch(r){this.logger.error("Failed to persist session data to DB",r)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.debug("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.debug("localStorage entry completely removed",{key:this.localStorageKey})}catch(G){this.logger.error("Failed to clear localStorage entry",G)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const i=this.get("address.id")||"",o=this.get("cart.id")||"";(i||o)&&(e=i+":"+o)}else e=this.getState();e&&localStorage.setItem(this.localStorageKey,"string"!=typeof e?JSON.stringify(e):e)}catch(e){this.logger.error("Failed to persist store state",e)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const i=localStorage.getItem(this.localStorageKey);if(!i)return;try{const e=JSON.parse(i);for(const[i,o]of Object.entries(e))this.set(i,o);return}catch(e){if(i.includes(":")){const[e,o]=i.split(":");if(void 0!==e){const i=await this.getAddressDataFromId(e);this.set("address",i)}return void 0!==o&&this.set("cart.id",o||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:i})}}catch(i){this.logger.error("Failed to load persisted state",i),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const i=await this.getAddressDataFromId(e.p);this.set("address",i)}void 0!==e.c&&this.set("cart.id",e.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:e.p,cartId:e.c})}catch(i){this.logger.error("Failed to load session data from DB persistence",i)}}async getAddressDataFromId(e){if(!e||""===e.trim())return Q;try{const i=await this.api.getAddressDetails(e);return i&&0!==Object.keys(i).length?{id:e,formattedAddress:i.formattedAddress,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""},coordinates:{lat:i.coords.lat,long:i.coords.long}}:{...Q,id:e}}catch(i){return{...Q,id:e}}}}const X=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_LIST,r.PRODUCT_LIST_CARD,r.PRODUCT_LIST_CARD_LOADING,r.PRODUCT_LIST_FILTERS],$=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],J=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],tt=[r.CHECKOUT,r.CHECKOUT_INFORMATION_SECTION,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT_FORM,r.CHECKOUT_BILLING_FORM,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVERY_INFORMATION_FORM,r.CHECKOUT_BUYER_INFORMATION_FORM,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN,r.CHECKOUT_PRESALE_EXPIRED];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(e,i="swap"){if(!e||0===e.length)return;const o=[...this.defaultFontFamilies,...e],r=o.map(e=>{const i=encodeURIComponent(e.name);return"family="+i+":wght@"+e.weights.join(";")}).join("&"),c="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+r+"&"+c,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,i="swap"){const o=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(e,i),o&&o.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),i=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!e){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.googleapis.com",document.head.appendChild(e)}if(!i){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(e)}}const getProductListStyles=()=>'\n .product-list {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n }\n\n .product-list-filters-container {\n width: 30%;\n height: fit-content;\n position: sticky;\n top: 24px;\n padding: 0;\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 .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n /* Filters Styles */\n .product-list-filters-header,\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 16px 0 12px 0;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-delivery-options {\n border-bottom: none;\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-personalized,\n .product-list-filters-pre-order {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\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-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 15px;\n font-weight: 500;\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-delivery-options-header {\n display: flex;\n align-items: center;\n }\n\n .product-list-filters-delivery-options-label {\n font-size: 18px;\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-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 12px 16px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-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-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 15px;\n font-weight: 500;\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-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch,\n input[type="checkbox"].product-list-filters-pre-order-switch {\n position: relative;\n width: 52px;\n height: 28px;\n appearance: none;\n background: var(--accent-color, #e5e7eb);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n outline: none;\n border: 2px solid transparent;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch:checked,\n input[type="checkbox"].product-list-filters-pre-order-switch:checked {\n background: var(--primary-color, #3b82f6);\n border-color: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n }\n\n .product-list-filters-personalized-switch:disabled,\n .product-list-filters-pre-order-switch:disabled {\n background: var(--accent-color-30, #f3f4f6);\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .product-list-filters-personalized-switch::before,\n .product-list-filters-pre-order-switch::before {\n content: \'\';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: var(--selected-text-color, #ffffff);\n border-radius: 50%;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n .product-list-filters-personalized-switch:checked::before,\n .product-list-filters-pre-order-switch:checked::before {\n transform: translateX(24px);\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .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 border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\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 line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 10px;\n font-weight: 300;\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\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 padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\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 gap: 8px;\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 /* Responsive Styles */\n\n /* Mobile - 1 column (default, up to 639px) */\n @media (max-width: 639px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px and up) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px and up) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n width: 30%;\n order: unset;\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: unset;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n position: sticky;\n top: 24px;\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.standard {\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: "+p.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: "+p.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: "+p.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 }\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(--primary-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: "+p.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(--primary-color, #1E40AF);\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: "+p.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: "+p.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(--primary-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: "+p.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-container.no-header .checkout-information-section,\n .checkout-container.no-header .checkout-summary-section {\n padding: 0;\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 }\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-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 margin-top: 20px;\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-items: center;\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: "+p.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(--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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+p.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: "+p.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 line-height: 100%;\n text-align: center;\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, .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-payment-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-payment-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-payment-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-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-payment-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-payment-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-payment-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(--primary-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: '+p.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\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 .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: "+p.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(--primary-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 ',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 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: 8px;\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 gap: 16px;\n flex-direction: row;\n align-items: center;\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 }\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 }\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 }\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 gap: 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(--primary-color, #1E40AF);\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 gap: 16px;\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 gap: 4px;\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 .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 }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n gap: 16px;\n align-self: stretch;\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 }\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 }\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 }\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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\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: 500;\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: 500;\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: "+p.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(--primary-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: "+p.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 }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\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 {\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(--primary-color, #1E40AF);\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: "+p.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 }\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 }\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(--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 }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+p.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(--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 }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\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";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: "+p.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: "+p.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: "+p.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: "+p.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: "+p.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 gap: 8px;\n margin-bottom: 20px;\n width: 100%;\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 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 et={"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",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},nt={backgroundColor:"--product-background-color"},it={backgroundColor:"--cart-background-color"},ot={backgroundColor:"--address-background-color"},rt={backgroundColor:"--checkout-background-color"},st={global:et,product:nt,cart:it,address:ot,checkout:rt};function getCSSVariableMapping(e){return st[e]||{}}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(e,i){const o={},r=getCSSVariableMapping(i);for(const[c,l]of Object.entries(r)){const i=this.getValueByPath(e,c);void 0!==i&&this.isCSSValue(i)&&(o[l]=i,this.isColorVariable(l,i)&&this.generateOpacityVariants(o,l,i))}return o}extractVariablesFromPartialTheme(e,i){const o={},r=getCSSVariableMapping(i);for(const[c,l]of Object.entries(r))if(this.hasValueAtPath(e,c)){const i=this.getValueByPath(e,c);void 0!==i&&this.isCSSValue(i)&&(o[l]=i,this.isColorVariable(l,i)&&this.generateOpacityVariants(o,l,i))}return o}generateCSSVariablesString(e){return Object.entries(e).map(([e,i])=>" "+e+": "+i+";").join("\n")}updateCSSVariablesInStylesheet(e,i){if(0!==Object.keys(i).length)try{const o=this.findOrCreateRule(e);for(const[e,r]of Object.entries(i))o.style.setProperty(e,String(r))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,i){return i.split(".").reduce((e,i)=>e&&void 0!==e[i]?e[i]:void 0,e)}hasValueAtPath(e,i){const o=i.split(".");let r=e;for(const c of o){if(null==r||!(c in r))return![];r=r[c]}return!![]}findOrCreateRule(e){const i=":host";for(const r of Array.from(e.cssRules))if(r instanceof CSSStyleRule&&r.selectorText===i)return r;const o=e.insertRule(i+" {}");return e.cssRules[o]}isCSSValue(e){if("string"==typeof e){if(""===e.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(e.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(e))return!![];if(/^[a-z-]+$/.test(e))return!![]}return"number"==typeof e}generateOpacityVariants(e,i,o){for(const r of this.opacityLevels){const c=i+"-"+r.suffix,l=this.addOpacityToHexColor(o,r.value);l&&(e[c]=l)}}isColorVariable(e,i){if("string"!=typeof i)return![];const o=e.toLowerCase().includes("color"),r=/^#[0-9a-f]{3,8}$/i.test(i);return o&&r}addOpacityToHexColor(e,i){if(!e.startsWith("#"))return null;let o=e.slice(1);if(3===o.length&&(o=o.split("").map(e=>e+e).join("")),6!==o.length)return null;const r=Math.round(255*i),c=r.toString(16).padStart(2,"0");return"#"+o+c}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,i){const o=this.cssProcessor.extractVariablesFromTheme(i,e),r=this.cssProcessor.generateCSSVariablesString(o),c=this.getStylesheetStyles(e).join("\n\n"),l=0===r.length?"":":host { "+r+" }",d=("\n "+l+"\n\n "+c+"\n ").trim();this.createStylesheet(e,d)}createStylesheet(e,i){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(i),this.styleSheets.set(e,o)}else this.styleSheets.set(e,i)}catch(G){this.styleSheets.set(e,i)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}updateVariablesInStylesheet(e,i,o){const r=this.styleSheets.get(e);if(r&&"string"!=typeof r){const e=this.cssProcessor.extractVariablesFromPartialTheme(i,o);this.cssProcessor.updateCSSVariablesInStylesheet(r,e)}}getStylesheetStyles(e){switch(e){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];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(e){this.data=e,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)}updateComponentGlobalConfigs(e){var i,o;const r=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),e),this.data.global.layout.showPoweredBy=r,((null===(i=e.theme)||void 0===i?void 0:i.headingFont)||(null===(o=e.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",e.theme,"global")}updateProductComponent(e){this.data.product=this.deepMerge(this.getConfigs("product"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",e.theme,"product")}updateAddressComponent(e){this.data.address=this.deepMerge(this.getConfigs("address"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",e.theme,"address")}updateCartComponent(e){this.data.cart=this.deepMerge(this.getConfigs("cart"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",e.theme,"cart")}updateCheckoutComponent(e){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",e.theme,"checkout")}getConfigs(e){return"all"===e?this.data:this.data[e]}getComponentConfig(e){return-1!==X.indexOf(e)?this.getConfigs("product"):-1!==$.indexOf(e)?this.getConfigs("address"):-1!==J.indexOf(e)?this.getConfigs("cart"):-1!==tt.indexOf(e)?this.getConfigs("checkout"):void 0}getStylesheet(e){const i=this.getBaseStylesheets();if(e===r.DRAWER){const e=[...i],o=this.stylesheetGenerator.getStylesheet("product"),r=this.stylesheetGenerator.getStylesheet("cart"),c=this.stylesheetGenerator.getStylesheet("checkout"),l=this.stylesheetGenerator.getStylesheet("address");return o&&e.push(o),r&&e.push(r),c&&e.push(c),l&&e.push(l),e}let o;if($.includes(e)||e===r.ADDRESS)o="address";else if(X.includes(e)||e===r.PRODUCT)o="product";else if(J.includes(e)||e===r.CART)o="cart";else{if(!tt.includes(e)&&e!==r.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),i;o="checkout"}const c=this.stylesheetGenerator.getStylesheet(o);return c?[...i,c]:i}getBaseStylesheets(){const e=[],i=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return i&&e.push(i),o&&e.push(o),e}deepMerge(e,i){const o={...e};for(const r in i)null!==i[r]&&void 0!==i[r]&&("object"!=typeof i[r]||Array.isArray(i[r])||"object"!=typeof e[r]||Array.isArray(e[r])?o[r]=i[r]:o[r]=this.deepMerge(e[r],i[r]));return o}}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 e=this.store.get("address");if(e.address.one&&e.coordinates.long&&e.coordinates.lat)return{coords:e.coordinates,address:e.address}}}const includeCartEvents=(e,i)=>e.filter(e=>i.includes(e.type)),excludeCartEvents=(e,i)=>e.filter(e=>!i.includes(e.type)),eventsForCart=e=>excludeCartEvents(e,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=e=>{const i=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],o=includeCartEvents(e,i);return o.length>0},includeCheckoutEvents=(e,i)=>e.filter(e=>i.includes(e.type)),eventsForCheckout=e=>includeCheckoutEvents(e,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=e=>includeCheckoutEvents(e,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=e=>includeCheckoutEvents(e,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=e=>{const i=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return e.some(e=>i.includes(e.type))},at={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},ct={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:at[e.type]||"error"})),transformCheckoutEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:ct[e.type]||"error"})),transformEventsForCart=e=>{const i=eventsForCart(e);return transformCartEventsRaw(i)},transformEventsForCheckout=e=>{const i=eventsForCheckout(e);return transformCheckoutEventsRaw(i)},transformPromoCodeCheckoutEvents=e=>{const i=promoCodeCheckoutEvents(e);return transformCheckoutEventsRaw(i)},transformGiftCardCheckoutEvents=e=>{const i=giftCardCheckoutEvents(e);return transformCheckoutEventsRaw(i)};function buildCartItemStore(e){return{id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,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,loading:![],updating:![],error:null}}function buildCartTotals(e){return{subtotal:e.subtotal||0,total:e.total||0,shippingFee:e.shippingFee||0,platformFee:e.platformFee||0,giftCardTotal:e.giftCardTotal||0,engravingFee:e.engravingFee||0,deliveryFee:e.deliveryFee||0,discounts:e.discounts||0,quantity:e.quantity||0}}function buildRetailerStore(e){var i;return{id:e.id,name:e.name,platformFee:e.platformFee||0,shippingFee:e.shippingFee||0,subtotal:e.subtotal||0,address:e.address,total:e.total||0,deliveryFee:e.deliveryFee||0,engravingFee:e.engravingFee||0,fulfillments:(null===(i=e.fulfillments)||void 0===i?void 0:i.map(e=>e.id))||[]}}function buildFulfillmentStore(e,i){return{id:e.id,canEngrave:e.canEngrave||![],type:e.type,fees:e.fees,expectation:e.expectation,shippingFee:e.shippingFee||0,subtotal:e.subtotal||0,engravingFee:e.engravingFee||0,deliveryFee:e.deliveryFee||0,items:e.items||[],retailerId:i.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(e,i){var o;const r=i.formattedAddress?i:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in e.items||{}){const i=e.items[l];c[l]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,salsifyGrouping:i.salsifyGrouping,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price||0,quantity:i.quantity||0,maxQuantity:i.maxQuantity||0,unitPrice:i.unitPrice||0,mainImage:i.mainImage||"",attributes:i.attributes||{}}}return{id:e.id,promoCode:(null===(o=e.promoCode)||void 0===o?void 0:o.code)||"",items:c,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:e.totals.deliveryFee,discounts:e.totals.discounts,engravingFee:e.totals.engravingFee,giftCardTotal:0,platformFee:e.totals.platformFee,shippingFee:e.totals.shippingFee,subtotal:e.totals.subtotal,total:e.totals.total},itemCount:Object.values(c||{}).reduce((e,i)=>e+(i.quantity||0),0),updatedAt:e.updatedAt,createdAt:e.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(e,o=![]){var r,c,l,d,u,h;const p=this.store.get("cart");for(const i of Object.keys(p.items||{}))this.store.remove("cart.items."+i);for(const i of Object.keys(p.retailers||{}))this.store.remove("cart.retailers."+i);for(const i of Object.keys(p.fulfillments||{}))this.store.remove("cart.fulfillments."+i);const m={"cart.id":e.id,"cart.error":null,"cart.totals":buildCartTotals(e),"cart.updatedAt":e.updatedAt||(new Date).toISOString(),"cart.createdAt":e.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(c=null===(r=e.attributes)||void 0===r?void 0:r.promoCode)||void 0===c?void 0:c.value)?{code:e.attributes.promoCode.value.toUpperCase(),discountAmount:e.attributes.promoCode.discount||0,error:null}:null};if((null===(l=e.items)||void 0===l?void 0:l.length)>0)for(const i of e.items)m["cart.items."+i.id]=buildCartItemStore(i);if((null===(d=e.retailers)||void 0===d?void 0:d.length)>0)for(const i of e.retailers)if(m["cart.retailers."+i.id]=buildRetailerStore(i),(null===(u=i.fulfillments)||void 0===u?void 0:u.length)>0)for(const e of i.fulfillments)m["cart.fulfillments."+e.id]=buildFulfillmentStore(e,i);if((null===(h=e.events)||void 0===h?void 0:h.length)>0&&(m["cart.events"]=transformEventsForCart(e.events||[])),this.store.batch(m),o){const e=this.store.get("cart"),o=this.store.get("address");this.pubSub.publishAction(i.CART_LOADED,cartDataForEventFromStore(e,o))}}async loadCart(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),i=await this.api.getCartData(e.id);this.syncCartFromResponse(i,!![]),i.id!==e.id&&await this.store.persist()}catch(e){this.store.set("cart.error","Failed to load cart"),this.logger.error("Load cart failed",e)}finally{this.store.set("cart.loading",![])}}}const lt="lce-checkout-stripe-slot",dt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},ut={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},ht={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function validateCustomerInfo(e){const i=[dt.firstName,dt.lastName,dt.email,dt.phone,dt.birthDate];if(!e)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=e[r];if(!i||"string"==typeof i&&""===i.trim())o.push(r);else if("birthDate"===r){const e=validateMinimumAge(i,21,1930);e.isValid||o.push(r)}}return{isValid:0===o.length,invalidFields:o}}function validateGiftRecipientInfo(e){const i=[ut.firstName,ut.lastName,ut.email,ut.phone,ut.message];if(!e)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=e[r];(!i||"string"==typeof i&&""===i.trim())&&o.push(r)}return{isValid:0===o.length,invalidFields:o}}function validateBillingInfo(e){const i=[ht.firstName,ht.lastName,ht.email,ht.phone,ht.addressOne,ht.city,ht.state,ht.zipCode];if(!e)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=e[r];(!i||"string"==typeof i&&""===i.trim())&&o.push(r)}return{isValid:0===o.length,invalidFields:o}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,o){const c={type:e,data:o||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:c}),e===r.CART&&this.pubSub.publishAction(i.CART_OPENED,!![]),e===r.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===r.CART&&this.pubSub.publishAction(i.CART_CLOSED,!![]),(null==e?void 0:e.type)===r.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(e,i,o){return{liquidId:e.liquidId,variantId:e.variantId,cartItemId:e.cartItemId,retailerId:e.retailerId,fulfillmentId:e.fulfillmentId,salsifyGrouping:e.salsifyGrouping,name:e.name,catPath:e.catPath,volume:e.volume,uom:e.uom,proof:e.proof,abv:e.abv,containerType:e.containerType,container:e.container,size:e.size,pack:e.pack,packDesc:e.packDesc,mainImage:e.mainImage,brand:e.brand,partNumber:e.partNumber,upc:e.upc,sku:e.sku,price:e.price,unitPrice:e.unitPrice,quantity:e.quantity,unitTax:e.unitTax,bottleDeposits:e.bottleDeposits,attributes:e.attributes,retailerName:i.name,expectationDetail:o.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(e){var o,r,l;try{this.store.set("checkout.loading",!![]);const d=e||this.store.get("cart.id"),u=this.store.get("cart");if(0===(null===(o=Object.values(u.items))||void 0===o?void 0:o.length)&&!e)return;const h=this.themeProvider.getConfigs("checkout"),p={canEmail:h.layout.emailOptIn.checked,canSms:h.layout.smsOptIn.checked};if(!d)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const m={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.readyForSubmit":null,"checkout.isPresaleLocked":![],"checkout.presaleExpiresAt":null,"checkout.events":[],"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,firstName:"",lastName:"",email:"",phone:"",message:""}},f=await this.api.prepareCheckout({cartId:d,marketingPreferences:p});if((null===(r=f.retailers)||void 0===r?void 0:r.length)>0)for(const e of f.retailers)for(const i of e.fulfillments)i.type===c.ON_DEMAND&&(m["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal});if((null===(l=f.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const e of f.items){const i=f.retailers.find(i=>i.id===e.retailerId),o=i.fulfillments.find(i=>i.id===e.fulfillmentId);m["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,i,o)}}f.isPresaleLocked&&f.presaleExpiresAt&&(m["checkout.isPresaleLocked"]=f.isPresaleLocked,m["checkout.presaleExpiresAt"]=f.presaleExpiresAt),m["checkout.token"]=f.token,m["checkout.cartId"]=f.cartId,m["checkout.customer"]=f.customer,m["checkout.acceptedAccountCreation"]=f.acceptedAccountCreation,m["checkout.billingSameAsShipping"]=f.billingSameAsShipping,m["checkout.hasAgeVerify"]=f.hasAgeVerify,m["checkout.hasSubstitutionPolicy"]=f.hasSubstitutionPolicy,m["checkout.isGift"]=f.isGift,m["checkout.marketingPreferences"]=f.marketingPreferences,m["checkout.giftCards"]=f.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),m["checkout.promoCode"]=f.promoCode.value?{code:f.promoCode.value,discountAmount:f.promoCode.discount}:null,m["checkout.marketingPreferences.canEmail"]=f.marketingPreferences.canEmail,m["checkout.marketingPreferences.canSms"]=f.marketingPreferences.canSms,m["checkout.amounts"]=f.amounts,m["checkout.error"]=null,m["checkout.updating"]=![],m["checkout.events"]=f.events||[],this.store.batch(m),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_LOADED,{cartId:f.cartId})}catch(d){throw this.store.set("checkout.error",d.message),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:d.message}),d}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(e){var o,r,l,d,u;try{let i;if(this.store.set("checkout.updating",!![]),(null==e?void 0:e.cartResponse)?this.commonCommands.syncCartFromResponse(e.cartResponse):await this.commonCommands.loadCart(),null==e?void 0:e.response)i=e.response;else{const r=null!==(o=null==e?void 0:e.cartId)&&void 0!==o?o:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;i=await this.api.prepareCheckout({cartId:r})}const h={"checkout.token":i.token,"checkout.events":transformEventsForCheckout(i.events||[]),"checkout.amounts":i.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":i.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),"checkout.promoCode":(null===(l=null===(r=null==i?void 0:i.promoCode)||void 0===r?void 0:r.value)||void 0===l?void 0:l.trim())?{code:i.promoCode.value,discountAmount:i.promoCode.discount}:null};if((null===(d=i.retailers)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const e of i.retailers)for(const i of e.fulfillments)i.type===c.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal})}if((null===(u=i.items)||void 0===u?void 0:u.length)>0){this.store.remove("checkout.items");for(const e of i.items){const o=i.retailers.find(i=>i.id===e.retailerId),r=o.fulfillments.find(i=>i.id===e.fulfillmentId);h["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,o,r)}}this.store.batch(h),this.validateAndUpdateFormStatus()}catch(h){const e=(null==h?void 0:h.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:e}),h}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(e){const o=this.store.get("checkout.isGift"),r=null!=e?e:!o;this.store.batch({"checkout.isGift":r,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_IS_GIFT_TOGGLED,{isActive:r})}async toggleBillingSameAsShipping(e){const o=this.store.get("checkout.billingSameAsShipping"),r=null!=e?e:!o;this.store.batch({"checkout.billingSameAsShipping":r,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:r})}toggleMarketingPreferences(e,o){const r=this.store.get("checkout.marketingPreferences."+e),c=null!=o?o:!r;this.store.set("checkout.marketingPreferences."+e,c),this.pubSub.publishAction(i.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:e,isActive:c})}async getPaymentSession(){try{const e=this.store.get("cart.id"),i=await this.api.getPaymentSession({cartId:e});this.store.set("checkout.payment",{key:i.key,secret:i.secret,paymentMethodId:null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,i){try{const o=await this.api.confirmPaymentSession(e,i);this.store.batch({"checkout.payment.paymentMethodId":o.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...o.card}})}catch(o){throw new SDKError("Failed to confirm payment session. Please try again.")}}async applyPromoCode(e){var i;try{this.googleTagManager.promoCodeAttempt(e);const o=this.dataForCheckoutPrepare(),r=await this.api.prepareCheckout({...o,promoCode:e}),c=0!==r.amounts.discounts,l=null===(i=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===i?void 0:i[0];if(!c)return this.store.set("checkout.promoCodeError",l?l.message:'Code "'+e+'" does not exist'),this.googleTagManager.promoCodeFailed(e,(null==l?void 0:l.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(e,r.amounts.discounts),await this.partialLoadCheckout({response:r})}catch(o){const i=(null==o?void 0:o.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",i),this.googleTagManager.promoCodeFailed(e,i),o}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(G){const i=G.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),G}}async removePromoCode(){var e,i;try{const o=this.dataForCheckoutPrepare(),r=(null===(i=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===i?void 0:i.code)||"",c=await this.api.prepareCheckout({...o,promoCode:""});if(0!==c.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(r,0),await this.partialLoadCheckout({response:c})}catch(o){const e=(null==o?void 0:o.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const i=this.store.get("checkout.promoCode.code")||"";throw i&&this.googleTagManager.promoCodeFailed(i,e),o}}async applyGiftCard(e){var i;const o=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(o);const e=this.dataForCheckoutPrepare(),r=e.giftCards||[],c=await this.api.prepareCheckout({...e,giftCards:[...r,o]}),l=null===(i=transformGiftCardCheckoutEvents(c.events||[]))||void 0===i?void 0:i[0],d=hasAnyRetailerGiftCardRestriction(c.events||[]);if(l&&(this.store.set("checkout.giftCardError",l.message),!d))return;const u=c.giftCards.find(e=>e.code.toLowerCase()===o.toLowerCase());if(!u)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(o,(null==l?void 0:l.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(o,u.applied),await this.partialLoadCheckout({response:c})}catch(r){const e=(null==r?void 0:r.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(o,e),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(G){throw this.store.set("checkout.error",(null==G?void 0:G.message)||"Failed to clear gift card error. Please try again."),G}}async removeGiftCard(e){var i;const o=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare(),r=(null===(i=e.giftCards)||void 0===i?void 0:i.filter(e=>e.toLowerCase()!==o.toLowerCase()))||[],c=await this.api.prepareCheckout({...e,giftCards:r}),l=c.giftCards.find(e=>e.code.toLowerCase()===o.toLowerCase());if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;this.googleTagManager.giftCardApplied(o,0),await this.partialLoadCheckout({response:c})}catch(r){const e=(null==r?void 0:r.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(o,e),r}}updateCustomerInfo(e,o){try{this.store.set("checkout.customer."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:e})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateBillingInfo(e,o){try{this.store.set("checkout.billing."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:e})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateGiftInfo(e,o){try{this.store.set("checkout.giftRecipient."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:e})}catch(r){throw this.store.set("checkout.error",r.message),r}}triggerAddShippingInfoEvent(){var e,i;const o=this.store.get("checkout");if(o.customer.email||o.customer.phone){const r=(null===(e=null==o?void 0:o.customer)||void 0===e?void 0:e.id)||(null===(i=null==o?void 0:o.customer)||void 0===i?void 0:i.email),c={subtotal:centToDollar(o.amounts.subtotal),total_before_discounts:centToDollar(o.amounts.subtotal+o.amounts.tax+o.amounts.shipping+o.amounts.delivery+o.amounts.platform+o.amounts.service),discounts:centToDollar(o.amounts.discounts),gift_cards:centToDollar(o.amounts.giftCards||0),net_total:centToDollar(o.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(o.amounts.total),void 0,{phone:o.customer.phone,email:o.customer.email,birth_date:o.customer.birthDate,customer_id:r},c)}}validateAndUpdateFormStatus(){const e=this.store.get("checkout"),i=validateCustomerInfo(e.customer),o=e.isGift?validateGiftRecipientInfo(e.giftRecipient):{isValid:!![],invalidFields:[]},r=e.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(e.billing),c=i.isValid&&o.isValid&&r.isValid,l=[...i.invalidFields.map(e=>"customer."+e),...o.invalidFields.map(e=>"giftRecipient."+e),...r.invalidFields.map(e=>"billing."+e)];this.store.batch({"checkout.isFormValid":c,"checkout.invalidFields":l,"checkout.readyForSubmit.customer":i.isValid,"checkout.readyForSubmit.gift":o.isValid,"checkout.readyForSubmit.billing":r.isValid})}async checkoutComplete(){var e;try{const o=this.store.get("checkout"),c=this.store.get("checkout.payment.paymentMethodId");if(!o.token||!c)return;const l=await this.api.checkoutComplete({token:o.token,payment:c}),d=l.legacyOrderNumber||l.referenceId||"N/A";o.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,{orderNumber:d,orderTotal:o.amounts.total,cardLast4:o.card.last4,customerEmail:o.customer.email,giftRecipientEmail:(null===(e=o.giftRecipient)||void 0===e?void 0:e.email)||null}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:d,orderTotal:o.amounts.total}),this.googleTagManager.purchase({transaction_id:d,tax:centToDollar(o.amounts.tax||0),shipping:centToDollar(o.amounts.shipping||0),items:[...Object.values(o.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],value:centToDollar(o.amounts.total),subtotal:centToDollar(o.amounts.subtotal),total_before_discounts:centToDollar(o.amounts.subtotal+o.amounts.tax+o.amounts.shipping+o.amounts.delivery+o.amounts.platform+o.amounts.service),discounts:centToDollar(o.amounts.discounts),gift_cards:centToDollar(o.amounts.giftCards||0),net_total:centToDollar(o.amounts.total)})}catch(o){const e=(null==o?void 0:o.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":e,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_FAILED,{message:e}),o}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var e,o,r,c;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_STARTED,{started:!![]});const l=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const d={cartId:l.cartId,customer:{firstName:l.customer.firstName,lastName:l.customer.lastName,email:l.customer.email,phone:l.customer.phone,birthDate:l.customer.birthDate,company:l.customer.company},...l.isGift&&{giftOptions:{recipient:{email:l.giftRecipient.email,phone:l.giftRecipient.phone,name:l.giftRecipient.firstName+" "+l.giftRecipient.lastName},message:l.giftRecipient.message||""}},...!l.billingSameAsShipping&&(null==l?void 0:l.billing)&&{billingAddress:{firstName:null==l?void 0:l.billing.firstName,lastName:l.billing.lastName,email:l.billing.email,phone:l.billing.phone,company:null!==(e=l.billing.company)&&void 0!==e?e:void 0,city:l.billing.city,state:l.billing.state,zip:l.billing.zipCode,one:l.billing.addressOne,two:l.billing.addressTwo||""}},billingSameAsShipping:l.billingSameAsShipping,acceptedAccountCreation:l.acceptedAccountCreation,hasAgeVerify:l.hasAgeVerify,shippingAddressTwo:null!==(o=l.isGift?l.giftRecipient.addressTwo:l.customer.addressTwo)&&void 0!==o?o:void 0,hasSubstitutionPolicy:l.hasSubstitutionPolicy,isGift:l.isGift,marketingPreferences:l.marketingPreferences,promoCode:(null===(r=l.promoCode)||void 0===r?void 0:r.code)||void 0,giftCards:(null===(c=l.giftCards)||void 0===c?void 0:c.map(e=>e.code))||[],deliveryInstructions:Object.values(l.onDemandFulfillmentTipInfo||{}).map(e=>({fulfillmentId:e.fulfillmentId,instructions:l.deliveryInstructions||""}))},u=await this.api.prepareCheckout(d);this.store.batch({"checkout.customer":u.customer,"checkout.acceptedAccountCreation":u.acceptedAccountCreation,"checkout.billingSameAsShipping":u.billingSameAsShipping,"checkout.hasAgeVerify":u.hasAgeVerify,"checkout.hasSubstitutionPolicy":u.hasSubstitutionPolicy,"checkout.isGift":u.isGift,"checkout.marketingPreferences":u.marketingPreferences,"checkout.events":u.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent();const h={subtotal:centToDollar(l.amounts.subtotal),total_before_discounts:centToDollar(l.amounts.subtotal+l.amounts.tax+l.amounts.shipping+l.amounts.delivery+l.amounts.platform+l.amounts.service),discounts:centToDollar(l.amounts.discounts),gift_cards:centToDollar(l.amounts.giftCards||0),net_total:centToDollar(l.amounts.total)};this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(l.amounts.total),"card",void 0,h)}catch(l){const e=(null==l?void 0:l.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":e,"checkout.loading":![]}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_FAILED,{message:e}),l}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const e=this.store.get("checkout.invalidFields")||[];if(0===e.length)return;const i=e[0];this.store.set("checkout.focusField",i),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(e){this.logger.error("Checkout form validation focus operation failed",{error:e instanceof Error?e.message:String(e)})}}buildItemUpdate(e,i){var o,r,c;const l={id:e.cartItemId,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:i},d=(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.filter(e=>""!==e.trim()))||[];return d.length>0&&(l.engravingLines=d),l}async updateCheckoutItemQuantity(e,o){try{this.store.set("checkout.items."+e+".updating",!![]);const r=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+e);if(!c)throw new SDKError("Item not found");const l=c.quantity,d=c.quantity+o;if(d<1)return this.removeItem(e,!![]);const u=this.buildItemUpdate(c,d),h=await this.api.updateCart({id:r,items:[u],loc:this.getLocation()});this.pubSub.publishAction(o>0?i.CHECKOUT_ITEM_QUANTITY_INCREASE:i.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:c.cartItemId,quantity:d,previousQuantity:l});const p=splitCategoryPath(c.catPath),m={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:Math.abs(o),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};o<0?this.googleTagManager.removeFromCart(m):o>0&&this.googleTagManager.addToCart(m),await this.partialLoadCheckout({cartResponse:h})}catch(r){throw this.store.set("checkout.items."+e+".error",r.message),r}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var o,r,c;try{const l=this.store.get("checkout.items."+e);if(!l)throw new SDKError("Item not found in checkout");if(!(null===(o=l.attributes)||void 0===o?void 0:o.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const d=(null===(c=null===(r=l.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.lines)||[],u={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:[]},h=this.store.get("checkout.cartId"),p=await this.api.updateCart({id:h,items:[u],loc:this.getLocation()});this.pubSub.publishAction(i.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:l.cartItemId,engravingLines:[],previousEngravingLines:d}),await this.partialLoadCheckout({cartResponse:p})}catch(l){throw this.store.set("checkout.items."+e+".error",l.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:l.message}),l}}async removeItem(e,o){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("checkout.items."+e+".updating",!![]);const r=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+e);if(!c)throw new SDKError("Item not found");const l=this.buildItemUpdate(c,0),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.store.remove("checkout.items."+e),this.pubSub.publishAction(i.CHECKOUT_ITEM_REMOVED,{cartItemId:c.cartItemId}),await this.partialLoadCheckout({cartResponse:d})}catch(r){throw this.store.set("checkout.items."+e+".error",r.message),r}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(o).map(i=>{const o=Math.round(i.subtotal*e/100);return{fulfillmentId:i.fulfillmentId,tip:o}}),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update tips. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,o){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},c=Object.values(r).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===e?o:i.tip})),l={...this.dataForCheckoutPrepare(),deliveryTips:c},d=await this.api.prepareCheckout(l);this.updateStoreFromCheckoutResponse(d),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:c})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update fulfillment tip. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(e){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(o).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===e?0:i.tip})),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to remove fulfillment tip. Please try again."),o}finally{this.store.set("checkout.updating",![])}}updateStoreFromCheckoutResponse(e){var i;const o={"checkout.amounts":e.amounts,"checkout.warning":e.warning,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.error":null};if((null===(i=e.retailers)||void 0===i?void 0:i.length)>0)for(const r of e.retailers)for(const e of r.fulfillments)e.type===c.ON_DEMAND&&(o["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:r.id,retailerName:r.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});this.store.batch(o)}async updateStripeFormStatus(e){try{const i=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},o={...i,...e};this.store.set("checkout.stripeFormStatus",o)}catch(i){throw this.logger.error("Error updating Stripe form status",{error:i instanceof Error?i.message:String(i)}),i}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(e){this.store.set("checkout.deliveryInstructions",e)}dataForCheckoutPrepare(){var e,i,o;const r=this.store.get("checkout"),c=(null===(e=null==r?void 0:r.customer)||void 0===e?void 0:e.email)?{firstName:r.customer.firstName,lastName:r.customer.lastName,email:r.customer.email,phone:r.customer.phone,birthDate:r.customer.birthDate,company:r.customer.company}:void 0;return{cartId:r.cartId,customer:c,billingSameAsShipping:r.billingSameAsShipping,acceptedAccountCreation:r.acceptedAccountCreation,hasAgeVerify:r.hasAgeVerify,hasSubstitutionPolicy:r.hasSubstitutionPolicy,marketingPreferences:r.marketingPreferences,promoCode:(null===(i=r.promoCode)||void 0===i?void 0:i.code)||void 0,giftCards:(null===(o=null==r?void 0:r.giftCards)||void 0===o?void 0:o.map(e=>e.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async e=>{e===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(e,o){try{this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),c=this.store.get("cart.items."+e);if(!c)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+o),new SDKError("Item not found");const l=c.quantity+o;if(l<1)return this.removeItem(e,!![]);const d=this.buildItemUpdate(c,l),u=await this.api.updateCart({id:r,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[e]),this.updateFulfillment(c.fulfillmentId,u),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(o<0?i.CART_ITEM_QUANTITY_DECREASE:i.CART_ITEM_QUANTITY_INCREASE,{id:c.id,quantity:l,previousQuantity:c.quantity});const h=splitCategoryPath(c.catPath),p={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(o),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};o<0?this.googleTagManager.removeFromCart(p):o>0&&this.googleTagManager.addToCart(p)}catch(r){throw this.store.set("cart.items."+e+".error",r.message),this.logger.error("Failed to update item quantity",r),r}finally{this.store.set("cart.items."+e+".updating",![])}}async removeItem(e,o){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),c=this.store.get("cart.items."+e);if(!c)throw new SDKError("Item not found");const l={itemId:c.id,fulfillmentId:c.fulfillmentId,retailerId:c.retailerId},d=this.buildItemUpdate(c,0),u=await this.api.updateCart({id:r,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[]),this.cleanupAfterItemRemoval(l,u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(i.CART_ITEM_REMOVED,{id:c.id});const h=splitCategoryPath(c.catPath);this.googleTagManager.removeFromCart({item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:c.quantity,price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId})}catch(r){throw this.store.set("cart.items."+e+".error",r.message),this.logger.error("Failed to remove item",r),r}}async updateItemEngraving(e,o){var r,c,l;try{const d=this.store.get("cart"),u=null===(r=d.items)||void 0===r?void 0:r[e];if(!u)throw new SDKError("Item not found");this.store.set("cart.items."+e+".updating",!![]);const h={id:u.id,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:u.quantity,engravingLines:o},p=await this.api.updateCart({id:d.id||"",items:[h],loc:this.getLocation()});this.syncItemsFromApiResponse(p,[e]),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const m=this.store.get("cart"),f=this.store.get("address");this.pubSub.publishAction(i.CART_UPDATED,{previous:cartDataForEventFromStore(d,f),current:cartDataForEventFromStore(m,f)}),this.pubSub.publishAction(i.CART_ITEM_ENGRAVING_UPDATED,{id:u.id,engravingLines:o,previousEngravingLines:(null===(l=null===(c=u.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||[]})}catch(d){throw this.store.set("cart.items."+e+".error",d.message),this.logger.error("Failed to update item engraving",d),d}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var o,r;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),l={...c},d=(null===(o=e.engravingLines)||void 0===o?void 0:o.filter(e=>""!==e.trim()))||[],u=d.length>0,h=Object.values(c.items||{}).find(i=>{var o,r,c,l,h;const p=i.fulfillmentId===e.fulfillmentId&&i.partNumber===e.partNumber;if(!p)return![];if(u){const e=(null===(r=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[];return d.join(",")===e.join(",")}return!(null===(h=null===(l=null===(c=i.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.length)}),p={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:h?e.quantity+h.quantity:e.quantity};u&&(p.engravingLines=d);const m=await this.api.updateCart({id:c.id||"",items:[p],loc:this.getLocation()}),f=null===(r=m.items)||void 0===r?void 0:r.find(e=>e.fulfillmentId===p.fulfillmentId&&e.partNumber===p.partNumber&&e.upc===p.upc);if(!f)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(m,[]);const v=this.store.get("cart.fulfillments."+e.fulfillmentId);v?this.updateFulfillment(e.fulfillmentId,m):this.addNewFulfillmentAndRetailer(e.fulfillmentId,m),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const y=this.store.get("cart"),b=this.store.get("address");this.pubSub.publishAction(i.PRODUCT_ADD_TO_CART,{...e}),this.pubSub.publishAction(i.CART_ITEM_ADDED,{id:f.id,upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSub.publishAction(i.CART_UPDATED,{previous:cartDataForEventFromStore(l,b),current:cartDataForEventFromStore(y,b)});const x=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,item_type:f.type,item_subtype:f.subType,quantity:f.quantity,price:centToDollar(f.unitPrice||0),upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(c){throw this.store.set("cart.error",c.message),this.logger.error("Failed to add item to cart",c),c}finally{this.store.set("cart.loading",![])}}async addPresaleItem(e){var i;try{const o={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity};(null==e?void 0:e.engravingLines)&&(null===(i=null==e?void 0:e.engravingLines)||void 0===i?void 0:i.length)>0&&(o.engravingLines=e.engravingLines);const r=await this.api.updateCart({id:"",items:[o],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(r.id)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to add presale item to cart",o),o}}async handleGoToCheckout(){var e;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(r.CHECKOUT);const i=this.store.get("cart"),o=(null===(e=i.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(i.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],o)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to proceed to checkout",i),i}finally{this.store.set("cart.loading",![])}}async applyPromoCode(e){var i,o,r;if(!(null==e?void 0:e.trim()))throw new SDKError("Promo code is required");const c=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(c);const l=await this.api.updateCart({id:e,items:[],promoCode:c,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(l)),this.store.set("cart.events",transformEventsForCart(l.events||[]));const d=(null===(r=null===(o=null===(i=l.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===r?void 0:r.toLowerCase())===c.toLowerCase();d?(this.store.set("cart.promoCode",{code:c,discountAmount:l.discounts||0}),this.googleTagManager.promoCodeApplied(c,l.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(c,'Code "'+c+'" does not exist'))}catch(l){const e=(null==l?void 0:l.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",e),this.googleTagManager.promoCodeFailed(c,e),this.logger.error("Failed to apply promo code",l),l}}async removePromoCode(){try{const e=this.store.get("cart.id"),i=await this.api.updateCart({id:e,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(i),"cart.promoCode":null}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const i=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",i);const o=this.store.get("cart.promoCode");throw(null==o?void 0:o.code)&&this.googleTagManager.promoCodeFailed(o.code,i),this.logger.error("Failed to remove promo code",e),e}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...Y,rerender:!![]}),this.store.set("cart",{...V,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(i.CART_RESET,!![])}getDetails(){var e;const i=this.store.get("cart"),o=this.store.get("address"),r=o.id?o:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in i.items||{}){const e=i.items[l];c[l]={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||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:i.id,promoCode:(null===(e=i.promoCode)||void 0===e?void 0:e.code)||"",items:c,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:i.totals.deliveryFee,discounts:i.totals.discounts,engravingFee:i.totals.engravingFee,giftCardTotal:i.totals.giftCardTotal,platformFee:i.totals.platformFee,shippingFee:i.totals.shippingFee,subtotal:i.totals.subtotal,total:i.totals.total},itemCount:Object.values(c||{}).reduce((e,i)=>e+(i.quantity||0),0),updatedAt:i.updatedAt,createdAt:i.createdAt}}buildItemUpdate(e,i){var o,r,c;const l={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:i},d=(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.filter(e=>""!==e.trim()))||[];return d.length>0&&(l.engravingLines=d),l}syncItemsFromApiResponse(e,i=[]){var o;const r=this.store.get("cart.items")||{},c=new Set((null===(o=e.items)||void 0===o?void 0:o.map(e=>e.id))||[]);for(const d of Object.keys(r))c.has(d)||this.store.remove("cart.items."+d);const l={};for(const d of e.items)0!==i.length&&!i.includes(d.id)&&r[d.id]||(l["cart.items."+d.id]=buildCartItemStore(d));Object.keys(l).length>0&&this.store.batch(l)}syncCartMetaFromApiResponse(e){var i,o;const r={"cart.totals":buildCartTotals(e),"cart.error":null,"cart.updatedAt":e.updatedAt||(new Date).toISOString(),"cart.createdAt":e.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(e.events||[])},c=null===(o=null===(i=e.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value;if(c)r["cart.promoCode"]={code:c.toUpperCase(),discountAmount:e.discounts||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(r["cart.promoCode"]=null)}this.store.batch(r)}syncRetailersFromApiResponse(e){var i;if((null===(i=e.retailers)||void 0===i?void 0:i.length)>0){const i={};for(const o of e.retailers)i["cart.retailers."+o.id]=buildRetailerStore(o);this.store.batch(i)}}updateFulfillment(e,i){var o,r;const c=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===e)}),l=null===(r=null==c?void 0:c.fulfillments)||void 0===r?void 0:r.find(i=>i.id===e);l&&c&&this.store.set("cart.fulfillments."+e,buildFulfillmentStore(l,c))}addNewFulfillmentAndRetailer(e,i){var o,r;const c=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===e)}),l=null===(r=null==c?void 0:c.fulfillments)||void 0===r?void 0:r.find(i=>i.id===e);if(l&&c){const i={["cart.fulfillments."+e]:buildFulfillmentStore(l,c),["cart.retailers."+c.id]:buildRetailerStore(c)};this.store.batch(i)}}cleanupAfterItemRemoval(e,i){var o,r,c,l;const d=this.store.get("cart.fulfillments."+e.fulfillmentId),u=this.store.get("cart.retailers."+e.retailerId);if(!d||!u)return;const h=null===(o=i.retailers)||void 0===o?void 0:o.some(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===e.fulfillmentId)}),p=null===(r=i.retailers)||void 0===r?void 0:r.some(i=>i.id===e.retailerId);if(h){this.updateFulfillment(e.fulfillmentId,i);const o=null===(l=i.retailers)||void 0===l?void 0:l.find(i=>i.id===e.retailerId);o&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(o))}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),p){const o=null===(c=i.retailers)||void 0===c?void 0:c.find(i=>i.id===e.retailerId);o&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(o))}else this.store.remove("cart.retailers."+e.retailerId)}}function fulfillmentAddress(e,i){if(!e)return"";if(i===c.SHIPPING){const i=[e.city,e.state].filter(Boolean);return i.join(", ")}const o=[e.one,e.two,e.city,e.state].filter(Boolean);return o.join(", ")}const pt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],mt=1440;function timeToMinutes(e){const i=e.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new SDKError("Invalid time format: "+e);const o=Number.parseInt(i[1],10),r=Number.parseInt(i[2],10);if(o<0||o>47||r<0||r>59)throw new SDKError("Invalid time values: "+e);return 60*o+r}function getCurrentTimeInTimezone$1(e){var i,o,r;const c=new Date,l={timeZone:e,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const e=new Intl.DateTimeFormat("en-US",l),d=e.formatToParts(c),u=(null===(i=d.find(e=>"weekday"===e.type))||void 0===i?void 0:i.value.toLowerCase())||"",h=(null===(o=d.find(e=>"hour"===e.type))||void 0===o?void 0:o.value)||"0",p=(null===(r=d.find(e=>"minute"===e.type))||void 0===r?void 0:r.value)||"0",m=60*Number.parseInt(h,10)+Number.parseInt(p,10);return{weekday:u,timeInMinutes:m}}catch(d){throw new SDKError("Invalid timezone: "+e)}}function format24TimeTo12(e){const i=e.match(/^(\d{1,2}):(\d{2})$/);if(!i||"object"==typeof i)return e;let o=Number.parseInt(i[1],10);const r=i[2];o>=24&&(o-=24);const c=o>=12?"PM":"AM",l=0===o?12:o>12?o-12:o;return l+":"+r+" "+c}function isWithinTimeSlot(e,i){try{const o=timeToMinutes(i.startsAt),r=timeToMinutes(i.endsAt);if(r>mt){if(e>=o||e<r-mt)return"during"}else if(r<o){if(e>=o||e<r)return"during"}else if(e>=o&&e<r)return"during";return e<o?"before":"after"}catch(o){return"after"}}function getNextOpeningTime(e,i,o=7){var r,c;const l=pt.indexOf(i);for(let u=1;u<=o;u++){const i=(l+u)%7,o=pt[i],h=e[o];if((null==h?void 0:h.active)&&h.times&&h.times.length>0)try{const e=1===u?"tomorrow":o;return"Opens "+e+" at "+format24TimeTo12(null!==(c=null===(r=null==h?void 0:h.times[0])||void 0===r?void 0:r.startsAt)&&void 0!==c?c:"")}catch(d){}}return null}function validateFulfillmentData(e){return e&&"object"==typeof e&&e.hours&&e.timezone?"string"!=typeof e.timezone?![]:!![]:![]}function getRetailerOffHours(e){var i;if(!(null==e?void 0:e.type)||(null==e?void 0:e.type)!==c.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(e))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:o,timeInMinutes:r}=getCurrentTimeInTimezone$1(e.timezone),c=e.hours[o];if(!(null==c?void 0:c.active)||!(null===(i=c.times)||void 0===i?void 0:i.length)){const i=getNextOpeningTime(e.hours,o);return{message:i,isOpen:![],isClosed:!![]}}for(const e of c.times){const i=isWithinTimeSlot(r,e);switch(i){case"before":return{message:"Opens at "+format24TimeTo12(e.startsAt),isOpen:![],isClosed:!![],openTime:e.startsAt,closeTime:e.endsAt};case"during":{let i=e.endsAt;const o=timeToMinutes(i);if(o>mt){const e=Math.floor(o/60)-24,r=o%60;i=e.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(i),isOpen:!![],isClosed:![],openTime:e.startsAt,closeTime:e.endsAt}}}}const l=getNextOpeningTime(e.hours,o);return{message:l,isOpen:![],isClosed:!![]}}catch(o){return{message:null,isOpen:![],isClosed:!![]}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(e,i=![]){this.store.createProductInstance(e),i&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var i;if(!Array.isArray(e)||0===e.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(e.reduce((e,i)=>(e["products."+i+".loading"]=!![],e["products."+i+".error"]=null,e),{}));const o=await this.api.getProductsData(e,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,i)=>(e["products."+i+".loading"]=![],e["products."+i+".error"]=!![],e),{})),void 0;const r=[];for(const l of o.products){const c=l.sizes.filter(i=>e.some(e=>e===(i.upc||i.id||l.salsifyGrouping))),d=e.find(e=>c.some(i=>e===i.upc||e===i.id)||e===l.salsifyGrouping),u=d||(null===(i=null==c?void 0:c[0])||void 0===i?void 0:i.upc);await this.loadProduct(u,{products:[l],retailers:o.retailers}),r.push(u)}const c=e.filter(e=>-1===r.indexOf(e));this.store.batch(c.reduce((e,i)=>(e["products."+i+".loading"]=![],e["products."+i+".error"]="Product data not found",e),{}))}async loadProduct(e,o=null){var r,c;try{const l=this.store.get("products."+e);l.loading||this.store.set("products."+e+".loading",!![]);let d=null;if(o&&(d=o),o||(d=await this.api.getProductsData([e],this.getLocation())),!d||!(null===(r=null==d?void 0:d.products)||void 0===r?void 0:r[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const u=this.loadProductStoreUpdate(d);if(!u)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...u,identifier:e}),this.pubSub.publishAction(i.PRODUCT_LOADED,this.productDataForEventFromStore(e));const h=d.products[0],p=u.sizes[u.selectedSizeId||""],m=Boolean(this.getLocation()),f=u.selectedFulfillment,v=m&&(null==f?void 0:f.price)?f.price:(null===(c=u.priceInfo)||void 0===c?void 0:c.avg)||0,y=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:h.name,item_brand:h.brand,item_size:null==p?void 0:p.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(v),item_type:h.type,item_subtype:h.subType,upc:null==p?void 0:p.upc,grouping_id:h.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(l){throw this.store.set("products."+e+".error",l.message),this.logger.error("Failed to load product data for ID "+e,l),l}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,o){var r,l,d,u,h,p,m;const f=this.store.get("products."+e);let v=f.selectedFulfillmentType;const y=null===(r=f.sizes[o])||void 0===r?void 0:r.shippingFulfillments,b=null===(l=f.sizes[o])||void 0===l?void 0:l.onDemandFulfillments;let x=null,w=null;if(v!==c.SHIPPING||Object.values(y).length)if(v!==c.ON_DEMAND||Object.values(b).length){const e=v===c.SHIPPING?y:b,i=Object.values(e);x=i[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=c.SHIPPING;const e=Object.values(y);x=e[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=c.ON_DEMAND;const e=Object.values(b);x=e[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}const C=v===c.SHIPPING?y:b,S=f.sizes[o],E=splitCategoryPath(f.catPath),_=(null==x?void 0:x.price)||(null===(d=f.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==S?void 0:S.id,item_name:f.name,item_brand:f.brand,item_size:null==S?void 0:S.size,item_category:E.category,item_category2:E.category2,item_category3:E.category3,price:centToDollar(_),item_type:f.type,item_subtype:f.subType,upc:null==S?void 0:S.upc,grouping_id:f.salsifyGrouping,product_id:null==S?void 0:S.id});const D=Object.keys(y).length>0,I=Object.keys(b).length>0,A=D||I;if(!A){const e=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==S?void 0:S.id,productName:f.name,productBrand:f.brand,productCategory:E.category,productCategory2:E.category2,productCategory3:E.category3,productType:f.type,productSubtype:f.subType,productPrice:(null===(u=f.priceInfo)||void 0===u?void 0:u.avg)||0,sizeId:o,sizeName:null==S?void 0:S.size,upc:null==S?void 0:S.upc,groupingId:f.salsifyGrouping,address:(null==e?void 0:e.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||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(i.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:o,size:(null===(h=f.sizes[o])||void 0===h?void 0:h.size)||"",previousSizeId:f.selectedSizeId||"",previousSize:(null===(p=f.sizes[f.selectedSizeId])||void 0===p?void 0:p.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:o,["products."+e+".mainImage"]:(null===(m=f.sizes[o])||void 0===m?void 0:m.image)||null,["products."+e+".productHasAvailability"]:Object.keys(y).length+Object.keys(b).length>0,["products."+e+".fulfillmentHasAvailability"]:Boolean(Object.keys(C).length),["products."+e+".selectedFulfillmentType"]:v,["products."+e+".selectedFulfillment"]:x,["products."+e+".selectedFulfillmentId"]:w})}async selectFulfillment(e,o){var r,l,d;const u=this.store.get("products."+e),h=null===(r=u.sizes[u.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments,p=null===(l=u.sizes[u.selectedSizeId])||void 0===l?void 0:l.onDemandFulfillments,m=u.selectedFulfillmentType===c.SHIPPING?h:p,f=m[o];this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:o,selectedFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId||"",previousFulfillmentType:u.selectedFulfillmentType});const v=u.sizes[u.selectedSizeId||""],y=splitCategoryPath(u.catPath),b=(null==f?void 0:f.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:u.name,item_brand:u.brand,item_size:null==v?void 0:v.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(b),item_type:u.type,item_subtype:u.subType,upc:null==v?void 0:v.upc,grouping_id:u.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+e+".selectedFulfillment"]:f,["products."+e+".selectedFulfillmentId"]:o,["products."+e+".quantity"]:1})}async updateQuantity(e,o){var r;const c=this.store.get("products."+e),l=c.quantity,d=l+o,u=1,h=(null===(r=null==c?void 0:c.selectedFulfillment)||void 0===r?void 0:r.stock)||5,p=Math.max(u,Math.min(h,d));this.pubSub.publishAction(o<0?i.PRODUCT_QUANTITY_DECREASE:i.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:p,previousQuantity:l}),this.store.set("products."+e+".quantity",p)}async changeFulfillmentType(e,o){var r,l,d;const u=this.store.get("products."+e),{shippingFulfillments:h,onDemandFulfillments:p}=u.sizes[u.selectedSizeId],m=o===c.SHIPPING?h:p,f=Object.values(m);if(0===f.length){this.logger.warn("No fulfillments available for type "+o+" on product "+e);const i=this.store.get("address"),c=u.sizes[u.selectedSizeId],d=splitCategoryPath(u.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==c?void 0:c.id,productName:u.name,productBrand:u.brand,productCategory:d.category,productCategory2:d.category2,productCategory3:d.category3,productType:u.type,productSubtype:u.subType,productPrice:(null===(r=u.priceInfo)||void 0===r?void 0:r.avg)||0,sizeId:null!==(l=u.selectedSizeId)&&void 0!==l?l:void 0,sizeName:null==c?void 0:c.size,fulfillmentType:o,upc:null==c?void 0:c.upc,groupingId:u.salsifyGrouping,address:(null==i?void 0:i.address)?{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""}:void 0,reason:"No "+o+" fulfillments available for selected size"}),void 0}const v=f[0]||null,y=(null==v?void 0:v.fulfillmentId)||null;this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:o,selectedFulfillmentId:y,previousFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId,fulfillmentHasAvailability:f.length>0});const b=u.sizes[u.selectedSizeId||""],x=splitCategoryPath(u.catPath),w=(null==v?void 0:v.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==b?void 0:b.id,item_name:u.name,item_brand:u.brand,item_size:null==b?void 0:b.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,price:centToDollar(w),item_type:u.type,item_subtype:u.subType,upc:null==b?void 0:b.upc,grouping_id:u.salsifyGrouping,product_id:null==b?void 0:b.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:o,["products."+e+".selectedFulfillment"]:v,["products."+e+".selectedFulfillmentId"]:y,["products."+e+".fulfillmentHasAvailability"]:f.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async openProductDrawer(e,i,o){const r={type:i,data:o||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:r})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),i=Object.keys(e);for(const o of i)this.store.set("products."+o+".rerender",!![])}async addToCart(e,i){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,i){try{this.store.set("products."+e+".updating",!![]),await this.cartCommands.addPresaleItem(i),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const i=this.store.get("products."+e),o={},fulfillmentEventData=e=>{const i={};for(const o in e){const r=e[o];i[o]={retailerId:r.retailerId,retailerName:r.retailerName,retailerAddress:r.retailerAddress,retailerTimezone:r.timezone,price:r.price,partNumber:r.partNumber,stock:r.stock,isEngravable:r.isVariantEngravable,fulfillmentId:r.fulfillmentId,fulfillmentType:r.fulfillmentType,modalities:r.modalities||[]}}return i};for(const r in i.sizes||{}){const e=i.sizes[r];o[r]={id:e.id,upc:e.upc,size:e.size,pack:e.pack,packDesc:e.packDesc||"",container:e.container,containerType:e.containerType,maxQuantityPerOrder:e.attributes.maxQuantityPerOrder||0,image:e.image,uom:e.uom,volume:e.volume,attributes:{engraving:e.attributes.engraving||void 0,presale:e.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(e.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(e.onDemandFulfillments||{})}}return{identifier:e,selectedSizeId:i.selectedSizeId||null,selectedFulfillmentId:i.selectedFulfillmentId||null,selectedFulfillmentType:i.selectedFulfillmentType,id:i.id,name:i.name,brand:i.brand,catPath:i.catPath,category:i.category,classification:i.classification,type:i.type,salsifyGrouping:i.salsifyGrouping,subType:i.subType,mainImage:i.mainImage||null,images:i.images||[],region:i.region,country:i.country,material:i.material,abv:i.abv,proof:i.proof,age:i.age,color:i.color,flavor:i.flavor,variety:i.variety,appellation:i.appellation,vintage:i.vintage,description:i.description,htmlDescription:i.htmlDescription,tastingNotes:i.tastingNotes,priceInfo:i.priceInfo||null,sizes:o}}findFirstAvailableSize(e){const i=Object.values(e);for(const o of i){const e=o.shippingFulfillments||{},i=o.onDemandFulfillments||{},r=Object.values(e).length,c=Object.values(i).length;if(r+c>0)return o.id}return null}loadProductStoreUpdate(e){var i,o,r,l,d,u,h,p,m,f,v;try{const{products:[y,...b],retailers:x}=e,w=this.themeProvider.getConfigs("product"),C={};let S=![],E=![],_="",D=null,I=w.layout.enableShippingFulfillment?c.SHIPPING:c.ON_DEMAND,A=null,z=null;const O={};if(x&&Array.isArray(x)&&x.length>0)for(const e of x)for(const i of e.fulfillments){const o={retailerName:e.name,retailerAddress:e.address||null,type:i.type,timezone:i.timezone||"",canEngrave:i.canEngrave||![],expectation:i.expectation,fees:i.fees,hours:i.hours,retailerId:e.id,fulfillmentId:i.id,fulfillmentType:i.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]},r=getRetailerOffHours(o);r.isClosed&&!w.layout.showOffHours||(O[i.id]=o)}if(y.sizes&&Array.isArray(y.sizes)&&y.sizes.length>0)for(const e of y.sizes){const d={},u={};for(const h of e.variants){if((null===(i=null==h?void 0:h.fulfillmentTypes)||void 0===i?void 0:i.onDemand)&&""!==h.fulfillmentTypes.onDemand){const e=h.fulfillmentTypes.onDemand,i=O[e];i?u[e]={...i,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:e,fulfillmentType:c.ON_DEMAND,modalities:[...i.modalities,...null!==(o=null==h?void 0:h.modalities)&&void 0!==o?o:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+e)}if((null===(r=null==h?void 0:h.fulfillmentTypes)||void 0===r?void 0:r.shipping)&&""!==h.fulfillmentTypes.shipping){const e=h.fulfillmentTypes.shipping,i=O[e];i?d[e]={...i,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:e,fulfillmentType:c.SHIPPING,modalities:[...i.modalities,...null!==(l=null==h?void 0:h.modalities)&&void 0!==l?l:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+e)}}C[e.id]={id:e.id,upc:e.upc,size:e.size,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,maxQuantityPerOrder:e.attributes.maxQuantityPerOrder||0,image:e.image,uom:e.uom,volume:e.volume,attributes:e.attributes,loading:![],error:null,shippingFulfillments:d,onDemandFulfillments:u}}const N=Object.values(C),M=this.findFirstAvailableSize(C);_=M||N[0]&&N[0].id||"",D=(null===(d=C[_])||void 0===d?void 0:d.image)||null;const R=(null===(u=C[_])||void 0===u?void 0:u.shippingFulfillments)||{},B=(null===(h=C[_])||void 0===h?void 0:h.onDemandFulfillments)||{},q=Object.values(R).length,j=Object.values(B).length;S=q+j>0;const G=I===c.SHIPPING?Object.values(R):Object.values(B);if(E=G.length>0,z=G[0]||null,A=(null==z?void 0:z.fulfillmentId)||null,!E){const e=I===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,i=e===c.SHIPPING?Object.values(R):Object.values(B);i.length>0&&(I=e,z=i[0],A=(null==z?void 0:z.fulfillmentId)||null,E=!![])}if(!S){const e=this.store.get("address"),i=splitCategoryPath(y.catPath),o=C[_];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:y.name,productBrand:y.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:y.type,productSubtype:y.subType,productPrice:(null===(p=y.priceInfo)||void 0===p?void 0:p.average)||0,upc:null==o?void 0:o.upc,groupingId:y.salsifyGrouping,address:(null==e?void 0:e.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||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:y.id||"",name:y.name,description:y.description,htmlDescription:y.htmlDescription,images:y.images,priceInfo:{min:(null===(m=y.priceInfo)||void 0===m?void 0:m.minimum)||0,max:(null===(f=y.priceInfo)||void 0===f?void 0:f.maximum)||0,avg:(null===(v=y.priceInfo)||void 0===v?void 0:v.average)||0},brand:y.brand,region:y.region||"",country:y.country||"",material:y.material||"",abv:y.abv||"",proof:y.proof||"",age:y.age||"",color:y.color||"",flavor:y.flavor||"",variety:y.variety||"",appellation:y.appellation||"",vintage:y.vintage||"",tastingNotes:y.tastingNotes||"",catPath:y.catPath,category:y.category,classification:y.classification,type:y.type,subType:y.subType,salsifyGrouping:y.salsifyGrouping,sizes:C,productHasAvailability:S,fulfillmentHasAvailability:E,selectedSizeId:_,mainImage:D,selectedFulfillmentType:I,selectedFulfillmentId:A,selectedFulfillment:z,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(y){throw this.logger.error("Product data processing error",y),y}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(e){return!e||e.length<3?[]:await this.api.getAddressSuggestions(e)}async getAddressDetails(e){return await this.api.getAddressDetails(e)}async setSelectedAddress(e){try{this.store.batch({"address.id":e.id,"address.formattedAddress":e.formattedAddress,"address.address":e.address,"address.coordinates":e.coordinates});const i=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(i)),await this.cartCommands.resetCart(),await this.store.persist()}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:e.id,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||""},error:(null==o?void 0:o.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==o?void 0:o.message)||"Failed to update downstream state after address change"}),o}this.googleTagManager.addressUpdated({googlePlacesId:e.id,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:e.coordinates}),this.pubSub.publishAction(i.ADDRESS_UPDATED,{googlePlacesId:e.id,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:e.coordinates,formattedAddress:e.formattedAddress})}async setAddressManually(e,o){try{const i=buildFormattedAddressString(e),r={id:"",formattedAddress:i,address:e,coordinates:o};await this.setSelectedAddress(r)}catch(r){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:{one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip,country:e.country||""},error:(null==r?void 0:r.message)||"Failed to set manual address"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:e,coordinates:o,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}async clearSelectedAddress(){this.store.set("address",Q),this.pubSub.publishAction(i.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const e=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(e),this.store.clearLocalStorage()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(e){var i,o;const r=e,c=this.clientConfig.getConfigs();r.entity=null!==(o=null!==(i=window.location.hostname)&&void 0!==i?i:c.partnerName)&&void 0!==o?o:void 0,r.visitorId=c.userDeviceId,r.loc=this.getLocation(),r.isLegacy=!![];const l=await this.api.catalogSearch(r);return l.products&&l.products.length>0&&this.trackViewItemList(l.products),l}async addToCart(e){try{this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(e)}catch(i){throw this.logger.error("Error adding product to cart from product list",i),i}}async addPresaleToCart(e){try{await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT)}catch(i){throw this.logger.error("Error adding presale product to cart from product list",i),i}}trackViewItemList(e){if(0!==e.length)try{const i=e.map((e,i)=>({...this.convertProductToBaseItem(e),index:i+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking view_item_list event",i)}}trackSelectItem(e){try{const i=this.convertProductToBaseItem(e);this.googleTagManager.selectItem(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking select_item event",i)}}convertProductToBaseItem(e){var i,o,r;const c=null===(i=e.sizes)||void 0===i?void 0:i[0],l=null===(o=null==c?void 0:c.variants)||void 0===o?void 0:o[0],d=splitCategoryPath(e.catPath);return{item_id:null==c?void 0:c.id,item_name:e.name,item_brand:e.brand,item_size:null==c?void 0:c.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:(null==l?void 0:l.price)?centToDollar(l.price):(null===(r=e.priceInfo)||void 0===r?void 0:r.average)?centToDollar(e.priceInfo.average):void 0,item_type:e.type,item_subtype:e.subType,upc:null==c?void 0:c.upc,grouping_id:e.salsifyGrouping,product_id:null==c?void 0:c.id,item_list_id:"product_list",item_list_name:"Product List"}}}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 ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:e=>this.command.product.productDataForEventFromStore(e)},this.addressActions={setAddressByPlacesId:async e=>{try{if(!e||""===e.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const i=await this.command.address.getAddressDetails(e);await this.command.address.setSelectedAddress({id:e,address:i.address,coordinates:i.coords,formattedAddress:i.formattedAddress})}catch(i){throw this.logger.error("Error setting address by placesId:",i),i}},setAddressManually:async(e,i)=>{try{if(!e||!i)throw new SDKError("Both address and coordinates are required.",!![]);if(!(e.one&&e.city&&e.state&&e.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof i.lat||"number"!=typeof i.long)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof i.lat+", long: "+typeof i.long,!![]);if(i.lat<-90||i.lat>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+i.lat,!![]);if(i.long<-180||i.long>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+i.long,!![]);await this.command.address.setAddressManually(e,i)}catch(o){throw this.logger.error("Error setting manual address:",o),o}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(r.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CART)},addProduct:async(e,o)=>{var l,d;try{if(!e||0===e.length)return this.logger.warn("No products provided to add to cart"),void 0;const u=this.getLocation();if(void 0===u)return this.pendingCartParams=e,this.pendingCartOpenFlag=null!=o?o:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;o===!![]&&this.command.ui.openDrawer(r.CART);const h=[...new Set(e.map(e=>e.identifier))],p=await this.api.getProductsData(h,u);if(!p||!p.products||0===p.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(i.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const i of e){let e=null;for(let c=0;c<p.products.length;c++){const o=p.products[c];let r=![];for(let e=0;e<o.sizes.length;e++){const c=o.sizes[e];if(c.upc===i.identifier||c.id===i.identifier||o.salsifyGrouping===i.identifier){r=!![];break}}if(r){e=o;break}}if(!e){this.logger.warn("No product found for identifier: "+i.identifier);continue}const o=e.sizes[0];if(!o){this.logger.warn("No sizes found for product: "+i.identifier);continue}if((null===(d=null===(l=null==o?void 0:o.attributes)||void 0===l?void 0:l.presale)||void 0===d?void 0:d.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+i.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let r=null;for(let l=0;l<o.variants.length;l++){const e=o.variants[l];let d=![];if(i.fulfillmentType===c.ON_DEMAND&&(d=!(!e.fulfillmentTypes||!e.fulfillmentTypes.onDemand||""===e.fulfillmentTypes.onDemand)),i.fulfillmentType===c.SHIPPING&&(d=!(!e.fulfillmentTypes||!e.fulfillmentTypes.shipping||""===e.fulfillmentTypes.shipping)),d){r=e;break}}if(!r){this.logger.warn("No supported variant found for product: "+i.identifier+" with fulfillment type: "+i.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const u=i.fulfillmentType===c.ON_DEMAND?r.fulfillmentTypes.onDemand:r.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:o.upc,fulfillmentId:u,partNumber:r.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(i.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(u){throw this.logger.error("Error adding products to cart:",u),this.clearPendingCartOperation(),this.pubSub.publishAction(i.CART_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:u.message||"Failed to add products to cart"}),u}},applyPromoCode:async e=>{try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const o=e.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),c=r.layout.allowPromoCodes;if(!c)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const l=this.store.get("cart.promoCode");if(l&&l.code===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(o);const d=this.command.cart.getDetails();this.pubSub.publishAction(i.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:d.amounts.discounts,newTotal:d.amounts.total}),this.logger.info("Promo code applied successfully")}catch(o){throw this.logger.error("Failed to apply promo code:",o),this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),o=e.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;await this.command.cart.removePromoCode(),this.pubSub.publishAction(i.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove promo code:",e),e}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(i.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(r.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)},addProduct:async(e,o)=>{try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;o===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const c=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:c}),this.logger.info("Products added to checkout successfully:",c)}catch(c){throw this.logger.error("Error adding products to checkout:",c),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:c.message||"Failed to add products to checkout"}),c}},addPresaleProduct:async e=>{var o,l;try{if(!e||"object"!=typeof e||!e.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const d=this.getLocation();if(void 0===d)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const u=await this.api.getProductsData([e.identifier],d);if(!u||!u.products||0===u.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[e.identifier],error:"No product found",isPresale:!![]}),void 0;const h=u.products[0],p=h.sizes[0];if(!p)return this.logger.warn("No sizes found for presale product: "+e.identifier),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[e.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(l=null===(o=null==p?void 0:p.attributes)||void 0===o?void 0:o.presale)||void 0===l?void 0:l.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+e.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[e.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let m=null;for(let i=0;i<p.variants.length;i++){const o=p.variants[i];let r=![];if(e.fulfillmentType===c.ON_DEMAND&&(r=!(!o.fulfillmentTypes||!o.fulfillmentTypes.onDemand||""===o.fulfillmentTypes.onDemand)),e.fulfillmentType===c.SHIPPING&&(r=!(!o.fulfillmentTypes||!o.fulfillmentTypes.shipping||""===o.fulfillmentTypes.shipping)),r){m=o;break}}if(!m)return this.logger.warn("No supported variant found for presale product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[e.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=e.fulfillmentType===c.ON_DEMAND?m.fulfillmentTypes.onDemand:m.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:p.upc,fulfillmentId:f,partNumber:m.partNumber,quantity:e.quantity,engravingLines:[],identifier:e.identifier}),this.command.ui.openDrawer(r.CHECKOUT),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[e.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+e.identifier)}catch(d){throw this.logger.error("Error adding presale product to checkout:",d),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[e.identifier],error:d.message||"Failed to add presale product to checkout",isPresale:!![]}),d}},applyPromoCode:async e=>{var o;try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const r=e.trim().toUpperCase(),c=this.themeProvider.getConfigs("global"),l=c.layout.allowPromoCodes;if(!l)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const d=this.store.get("checkout.promoCode");if(d&&d.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(e);const u=this.store.get("checkout"),h=null==u?void 0:u.promoCode;this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==h?void 0:h.discountAmount)||0,newTotal:(null===(o=null==u?void 0:u.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(r){throw this.logger.error("Failed to apply checkout promo code:",r),this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),o=e.layout.allowPromoCodes;if(!o)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(),this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async e=>{var o;try{const r=this.themeProvider.getConfigs("checkout"),c=r.layout.allowGiftCards;if(!c)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(e);const l=this.store.get("checkout");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(o=null==l?void 0:l.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){throw this.logger.error("Failed to apply gift card:",r),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),r}},removeGiftCard:async e=>{try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)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(e),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(o){throw this.logger.error("Failed to remove gift card:",o),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),o}},toggleIsGift:async e=>{await this.command.checkout.toggleIsGift(e)},toggleBillingSameAsShipping:async e=>{await this.command.checkout.toggleBillingSameAsShipping(e)},toggleMarketingPreferences:(e,i)=>{this.command.checkout.toggleMarketingPreferences(e,i)},updateCustomerInfo:e=>{for(const[i,o]of Object.entries(e))this.command.checkout.updateCustomerInfo(i,o)},updateBillingInfo:e=>{for(const[i,o]of Object.entries(e))this.command.checkout.updateBillingInfo(i,o)},updateGiftInfo:e=>{for(const[i,o]of Object.entries(e))this.command.checkout.updateGiftInfo(i,o)},getDetails:()=>{var e,i,o;const r=this.store.get("checkout"),c=r.items||{},l={};for(const[d,u]of Object.entries(c))l[d]={liquidId:u.liquidId,variantId:u.variantId,cartItemId:d,retailerId:u.retailerId,fulfillmentId:u.fulfillmentId,salsifyGrouping:u.salsifyGrouping,name:u.name,catPath:u.catPath,volume:u.volume,uom:u.uom,proof:u.proof,abv:u.abv,containerType:u.containerType,container:u.container,size:u.size,pack:u.pack,packDesc:u.packDesc,mainImage:u.mainImage,brand:u.brand,partNumber:u.partNumber,upc:u.upc,sku:u.sku,price:u.price,unitPrice:u.unitPrice,quantity:u.quantity,unitTax:u.unitTax,bottleDeposits:u.bottleDeposits,attributes:u.attributes,retailerName:u.retailerName,expectationDetail:u.expectationDetail};return{cartId:r.cartId||"",acceptedAccountCreation:r.acceptedAccountCreation,hasAgeVerify:r.hasAgeVerify||![],hasSubstitutionPolicy:r.hasSubstitutionPolicy,isGift:r.isGift||![],billingSameAsShipping:r.billingSameAsShipping,marketingPreferences:{canEmail:(null===(e=r.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(i=r.marketingPreferences)||void 0===i?void 0:i.canSms)||![]},hasPromoCode:!!(null===(o=r.promoCode)||void 0===o?void 0:o.code),hasGiftCards:Array.isArray(r.giftCards)&&r.giftCards.length>0,itemCount:Object.values(l||{}).reduce((e,i)=>e+(i.quantity||0),0),amounts:r.amounts,items:l}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const s=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+i.ADDRESS_UPDATED,s)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const e=this.pendingCartParams,i=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(e,i)}catch(e){this.logger.error("Failed to retry cart operation after address update",e)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.long&&e.coordinates.lat)return{coords:e.coordinates,address:e.address}}}const ft="\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 gap: 2px;\n flex: 1;\n margin: 0 12px;\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 gap: 12px;\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 .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\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 gap: 8px;\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: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 gap: 2px;\n min-width: 50px;\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 gap: 8px;\n flex-wrap: wrap;\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 gap: 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 gap: 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",gt="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 e=LoggerFactory,i=e.instances;if(i)for(const[r,c]of i)this.interceptLoggerInstance(c,r);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const i=o(e);return this.interceptLoggerInstance(i,e),i}}interceptLoggerInstance(e,i){if(e.o)return;const o=e.debug.bind(e),r=e.info.bind(e),c=e.warn.bind(e),l=e.error.bind(e),t=(e,o,r)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:o,data:r,context:i});e.debug=(e,i)=>{o(e,i),this.addLogEntry(t("debug",e,i))},e.info=(e,i)=>{r(e,i),this.addLogEntry(t("info",e,i))},e.warn=(e,i)=>{c(e,i),this.addLogEntry(t("warn",e,i))},e.error=(e,i)=>{l(e,i),this.addLogEntry(t("error",e,i))},e.o=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),i=e.publishAction.bind(e);e.publishAction=(e,o)=>{i(e,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:o,context:"PubSub"})};const o=e.publishForm.bind(e);e.publishForm=(e,i)=>{o(e,i),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+e,data:i,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),i=e.executeEvent.bind(e);e.executeEvent=(e,o,r)=>{i(e,o,r),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:r,context:"GTM."+e})}}addLogEntry(e){this.logs.push(e),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const e=this.logs.filter(e=>{switch(e.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",e.forEach(e=>{const i=this.createLogElement(e);this.logContainer.appendChild(i)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(gt);e&&e.remove(),this.panelElement=document.createElement(gt);const i=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):i?(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 e=this.panelElement.attachShadow({mode:"closed"}),i=document.createElement("style");i.textContent=ft,e.appendChild(i),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);const r=this.createToggles();this.panelContainer.appendChild(r),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const c=this.createResizeHandle();this.panelContainer.appendChild(c),e.appendChild(this.panelContainer),this.setupShadowEventListeners(e)}createHeader(){const e=document.createElement("div");e.className="header",e.title="Drag to move panel";const i=document.createElement("div");i.className="icon",i.innerHTML="🔍",i.title="Elements Debug Console",i.style.cursor="help";const o=document.createElement("div");o.className="title-container";const r=document.createElement("div");r.className="title",r.textContent="Elements Debug Console";const c=document.createElement("div");c.className="subtitle",c.textContent="Live SDK logs, events & GTM tracking",o.appendChild(r),o.appendChild(c);const l=document.createElement("button");return l.className="minimize",l.innerHTML="−",l.title="Minimize debug panel",l.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(i),e.appendChild(o),e.appendChild(l),e}createToggles(){const e=document.createElement("div");e.className="toggles";const i=[{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"}];i.forEach(({key:i,label:o,description:r,color:c})=>{const l=document.createElement("label");l.className="toggle",l.title=r;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==i,d.addEventListener("change",e=>{const o=e.target;"showEvents"===i&&(this.showEvents=o.checked),"showGtmEvents"===i&&(this.showGtmEvents=o.checked),"showLogs"===i&&(this.showLogs=o.checked),this.renderLogs()});const u=document.createElement("span");u.textContent=o,u.style.color=c,l.appendChild(d),l.appendChild(u),e.appendChild(l)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),e.appendChild(o),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let i=![],o=0,r=0,c=0,l=0;e.addEventListener("mousedown",e=>{i=!![],o=e.clientX,r=e.clientY,c=Number.parseInt(this.panelElement.style.width,10)||500,l=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",K),document.addEventListener("mouseup",P),e.preventDefault()});const K=e=>{if(!i||!this.panelElement)return;const d=e.clientX-o,u=e.clientY-r,h=window.innerWidth<=768,p=window.innerWidth<=480;let m,f,v,y;p?(m=280,f=window.innerWidth-20,v=200,y=.4*window.innerHeight):h?(m=300,f=window.innerWidth-30,v=200,y=.4*window.innerHeight):(m=300,f=800,v=200,y=600);const b=Math.max(m,Math.min(f,c+d)),x=Math.max(v,Math.min(y,l+u));this.panelElement.style.width=b+"px",this.panelElement.style.height=x+"px"},P=()=>{i=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",P)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const i=e.querySelector(".header");if(i){let e=![],o=0,r=0,c=0,l=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;e=!![],o=i.clientX,r=i.clientY;const d=this.panelElement.getBoundingClientRect();c=d.left,l=d.top,document.addEventListener("mousemove",K),document.addEventListener("mouseup",P),i.preventDefault()});const K=i=>{if(!e||!this.panelElement)return;const d=i.clientX-o,u=i.clientY-r;this.panelElement.style.left=c+d+"px",this.panelElement.style.top=l+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},P=()=>{e=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",P)}}}createFloatingButton(){const e=document.createElement("div");return e.className="floating-btn",e.innerHTML="⚙️",e.title="Open Elements Debug Console",e.style.display="none",e.addEventListener("click",()=>{this.toggleVisibility()}),e}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(e){const i=document.createElement("div");i.className="log-entry "+e.type+" "+e.level;const o=new Date(e.timestamp).toLocaleTimeString();return i.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(e.message)+"\n "+(e.context?'<div class="log-context">'+this.escapeHtml(e.context)+"</div>":"")+"\n "+(e.data?'<div class="log-data"><pre>'+this.formatJsonData(e.data)+"</pre></div>":"")+"\n </div>\n ",i}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(i){return String(e)}}escapeHtml(e){const i=document.createElement("div");return i.textContent=e,i.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=U,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.l()){const i=this.u(e);if(i)return this.h(e,i)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const i=this.h(e,this.cachedFingerprint);if(this.l())try{const e=this.keyPrefix+"_"+i;localStorage.setItem(e,Date.now().toString())}catch(o){}return i}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(e,i){return(e+"_"+i).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const e=window.localStorage,i="__localStorage_test_"+Date.now()+"__",o="test";e.setItem(i,o);const r=e.getItem(i);return r!==o?(this.isLocalStorageAvailable=![],![]):(e.removeItem(i),this.isLocalStorageAvailable=!![],!![])}catch(e){const o=e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name);if(o)try{const e=window.localStorage;return e&&e.length>0?(this.S()&&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(i){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],e instanceof DOMException){const i={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"},o=i[e.name]||"Storage error: "+e.name,r=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+r+": "+o)}else console.warn("localStorage unavailable:",e.message||"Unknown error");return![]}}u(e){try{const i=this.keyPrefix+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);if(null==o?void 0:o.startsWith(i)){const e=o.substring(i.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(i){return null}}m(){const e=this.getFingerprintData(),i=Object.keys(e).sort().map(i=>i+":"+e[i]).join("|");return this._(i)}v(){try{const e=screen,i=e.colorDepth||24,o=e.pixelDepth||i,r=this.D(),c=Math.round(100*(window.devicePixelRatio||1));return i+"|"+o+"|"+r+"|"+c}catch(e){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(G){}return"srgb"}C(){var e;try{const i=navigator,o=[],r=((null===(e=i.languages)||void 0===e?void 0:e[0])||i.language||"en").substring(0,2);o.push(r),o.push(i.hardwareConcurrency||4);const c=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(c),o.push(i.cookieEnabled?"1":"0"),o.push(i.maxTouchPoints||0),o.push(i.deviceMemory||0),o.push(this.P()),o.push(this.S()?"webview":"browser");const l=["bluetooth"in i?"1":"0","usb"in i?"1":"0","mediaDevices"in i?"1":"0","permissions"in i?"1":"0","credentials"in i?"1":"0","storage"in i?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(l.join("")),o.join("|")}catch(i){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){try{const e=navigator.userAgent.toLowerCase();return e.includes("instagram")?"ig_webview":e.includes("fban")||e.includes("fbav")?"fb_webview":e.includes("tiktok")?"tiktok_webview":e.includes("linkedin")?"linkedin_webview":e.includes("snapchat")?"snapchat_webview":e.includes("twitter")?"twitter_webview":e.includes("line/")?"line_webview":e.includes("micromessenger")?"wechat_webview":e.includes("firefox")?"gecko":e.includes("edg/")?"edge":e.includes("opr/")||e.includes("opera")?"opera":e.includes("chrome")&&!e.includes("edg")?"blink":e.includes("safari")&&!e.includes("chrome")?"webkit":"unknown"}catch(e){return"unknown"}}S(){try{const e=navigator.userAgent.toLowerCase(),i=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(i=>e.includes(i))?!![]:void 0===i.standalone||i.standalone?window.self!==window.top?!![]:![]:!![]}catch(e){return![]}}k(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return e.replace(/\//g,"_").substring(0,30)}catch(e){return"UTC"}}_(e){const i=16777619;let o=2166136261,r=2166136261,c=2166136261,l=2166136261;for(let d=0;d<e.length;d++){const u=e.charCodeAt(d);o^=u,o=Math.imul(o,i),r^=u<<1,r=Math.imul(r,i),c^=u<<2,c=Math.imul(c,i),l^=u<<3,l=Math.imul(l,i)}return o=Math.abs(o),r=Math.abs(r),c=Math.abs(c),l=Math.abs(l),o.toString(16)+r.toString(16)+c.toString(16)+l.toString(16)}}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 i=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:o,batchSize:i===e.PRODUCTION?5:10,batchInterval:i===e.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(e,i,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const r=Date.now();try{const c={eventId:"event_"+r+"}",timestamp:r,level:e,message:i,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(c)}catch(c){this.handleInternalError(c)}}buildErrorContext(e){return{name:e.name,message:e.message,stack:this.truncateStackTrace(e.stack),code:e.code,statusCode:e.status||e.statusCode}}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 e=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:e||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(e){switch(e){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(e){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(e),this.stats.totalEvents++,this.stats.eventsByLevel[e.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 e;if(0===this.eventQueue.length||!(null===(e=this.config)||void 0===e?void 0:e.endpoint))return;const i=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(i);try{this.sendBatch(o),this.stats.batchesSent++}catch(r){this.stats.failedBatches++,this.handleInternalError(r),this.eventQueue.unshift(...i),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const i=Date.now();return{batchId:"batch_"+i,timestamp:i,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const i=new Blob([JSON.stringify(e)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,i);if(o)return}catch(i){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const i=new XMLHttpRequest;if(i.open("POST",this.config.endpoint,![]),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(e)),i.status<200||i.status>=300)throw new SDKError("XHR request failed with status: "+i.status)}catch(i){throw new SDKError("Both sendBeacon and XHR failed: "+i.message)}}truncateStackTrace(e){if(e)return e.split("\n").slice(0,10).join("\n")}handleInternalError(e){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",e)}shutdown(){var e;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(e=this.config)||void 0===e?void 0:e.endpoint))){const e=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(e),this.stats.batchesSent++}catch(i){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(e={}){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,...e}}initialize({data:e,config:i}){var o;this.T=Object.freeze(e),this.I=Object.freeze({type:i.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==i?void 0:i.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(e){return e.map(e=>this.interpolatePath(e))}interpolatePath(e){if("string"!=typeof e)return e;const i=/\{([^}]+)}/g;return e.replace(i,(i,o)=>{const r=this.T[o];return null==r?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+e+'"'),i):String(r)})}connectedCallback(){var e,i;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.I.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(e=this.connected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(i=this.I)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var e,i;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(i=this.I)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var e,i,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(i=this.beforeConnected)||void 0===i||i.call(this)}catch(r){this.logger.error("Component setup error in "+((null===(o=this.I)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const i of this.unsubscribers)try{i()}catch(e){this.logger.error("Cleanup error during component destruction",e),e instanceof Error&&this.captureComponentError(e,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var e;if(!this.reactiveOptions.autoDestroy)return;let i=this.reactiveOptions.autoDestroyPath;if(!i&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(i=this.reactiveOptions.watchStorePaths[0]),!i)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(i),r=this.store.watch(o,(e,i)=>{this.isDestroyed||void 0===e&&void 0!==i&&this.handleAutoDestroy(o)});this.unsubscribers.push(r),this.logger.debug("🔥 AutoDestroy enabled for "+this.I.tagName+" watching path: "+o)}handleAutoDestroy(e){var i;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.I.tagName+' - path "'+e+'" was removed'),null===(i=this.beforeAutoDestroy)||void 0===i||i.call(this,e);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(i){this.logger.error("Error during auto-destroy of "+this.I.tagName,i),i instanceof Error&&this.captureComponentError(i,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.T)return;e=this.interpolateStorePaths(e);const i=this.store.watchMany(e,e=>{var i,o;try{if(this.isDestroyed)return;const o=e.map(e=>e.path).join(", "),r="store:["+o+"]",c=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,e);c!==![]&&this.triggerRender(r)}catch(r){this.logger.error("Store watcher callback error in "+((null===(o=this.I)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"storeWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Store watchers setup error in "+((null===(e=this.I)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.T)return;e=this.interpolateStorePaths(e);const i=this.store.watchMany(e,e=>{var i,o;try{if(this.isDestroyed)return;null===(i=this.onStoreWatch)||void 0===i?void 0:i.call(this,e)}catch(r){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this.I)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"nonRenderingWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.I)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupNonRenderingWatchers")}}triggerRender(e){this.lastRenderTrigger=e,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var e,i;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const i=this.template();"string"==typeof i&&(this.container.innerHTML=i),i instanceof HTMLElement&&safeReplaceChildren(this.container,i),Array.isArray(i)&&safeReplaceChildren(this.container,...i);const c=performance.now()-o;this.logRenderInfo(c);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(r){this.logger.error("❌ afterRender hook error in "+this.I.tagName,r),r instanceof Error&&this.captureComponentError(r,"afterRender")}}catch(c){const e=performance.now()-o;this.logger.error("❌ Component render error in "+this.I.tagName,c),this.captureComponentError(c,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.I.type,message:c instanceof Error?c.message:String(c)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,c,"render")}catch(l){this.logger.error("❌ onError hook error in "+this.I.tagName,l)}}}logRenderInfo(e){const i=this.I.type,o=this.I.tagName,r=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+r+" "+i+" </"+o+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+i+"("+o+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:i,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:i,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.I.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,i,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.I.tagName+":"+i,component:{type:this.I.type,tagName:this.I.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.I.useShadowDom}})}catch(r){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.add(...i)}}addHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.add(...i)}removeHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.remove(...i)}toggleHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const o of i)this.classList.toggle(o)}addHostAttribute(e,i){e&&"string"==typeof e&&i&&"string"==typeof i&&(this.setAttribute(e,String(i)),this.hostAttributes[e]=String(i))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[i,o]of Object.entries(e))i&&"string"==typeof i&&o&&"string"==typeof o&&this.setAttribute(i,String(o))}get params(){return this.T}get config(){return this.themeProvider.getComponentConfig(this.I.type)}get elementConfig(){return this.I}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,i){return this.store.set(e,i)}watchStore(e,i){const o=this.store.watch(e,i);return this.unsubscribers.push(o),o}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var e;const i=null!==(e=this.params.options)&&void 0!==e?e:{};return ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,i,o,c;const l=this.getStoreValue("address"),d=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],u=null!==(i=this.params.productId)&&void 0!==i?i:"",h=null!==(o=this.params.options)&&void 0!==o?o:{},p=null!==(c=h.showLabel)&&void 0!==c?c:!![],m=[];if(p){const e=document.createElement("span");e.textContent="Delivers to:",m.push(e)}const f=document.createElement("button");f.type="button",f.textContent=l.formattedAddress||"Select an address";const v=l.formattedAddress?"Change delivery address, currently set to "+l.formattedAddress:"Select delivery address";return f.setAttribute("aria-label",v),f.addEventListener("click",async()=>{if(d)return this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:u,isIndependentComponent:!![]}),void 0;!d&&u&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:u}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(u,r.ADDRESS_INPUT,{productId:u}))}),m.push(f),m}}const ArrowRightIcon=({width:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+c+'" 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:e=24,height:i=24,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 489 489" class="bag-icon '+o+'" style="'+c+'" 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'},CheckboxIcon=({width:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="'+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+c+'" 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 '},CloseIcon=({width:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="search-icon '+o+'">\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="'+c+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+c+'" 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:e=16,height:i=16,className:o="",color:r=null})=>{const c=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+c+'" 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 '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var e;return null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![]},this.handleInputChange=e=>{const i=e.target,o=i.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const r=/^\d/.test(o);if(o.length<this.minSearchLength||!r)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(o)},300)},this.closeDrawer=async()=>{const e=this.params.productId,i=this.clientConfig.isMobile(),o=this.isIndependentComponent();(i||o)&&this.commands.ui.closeDrawer(),!i&&e&&await this.commands.product.closeProductDrawer(e)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(G){this.logger.error("Address edit cancellation failed",G)}},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 e=this.getStoreValue("address"),i=(null==e?void 0:e.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==e?void 0:e.coordinates.long)!==this.selectedAddress.coordinates.long;i&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(e){this.logger.error("Address selection and availability check failed",e),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async e=>{const i=e.currentTarget.dataset.suggestionId;if(i)try{this.error=null,this.updateErrorDisplay();const e=await this.commands.address.getAddressDetails(i);if(0===Object.keys(e).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:i,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(o){this.logger.error("Address details retrieval failed",o),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=e=>{this.container.contains(e.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const e=this.getStoreValue("address");(null==e?void 0:e.formattedAddress)&&(this.selectedAddress=e)}async searchAddresses(e){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const i=await this.commands.address.searchAddresses(e);this.suggestions=i.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(i){this.logger.error("Address search operation failed",i),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 e=this.errorContainer.querySelector(".error-text");e&&(e.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const e=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(e),void 0}for(const e of this.suggestions){const i=this.createElement("li",{className:"suggestion-item"}),o=this.createElement("span",{textContent:e.description});i.appendChild(o),i.setAttribute("data-suggestion-id",e.id),i.setAttribute("role","option"),i.setAttribute("aria-label","Select address: "+e.description),i.setAttribute("tabindex","0"),i.addEventListener("click",this.handleSuggestionClick),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())}),this.suggestionsContainer.appendChild(i)}}}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(e,i){const o=document.createElement(e);return i&&Object.assign(o,i),o}createErrorContainer(){const e=this.createElement("div",{className:"error-message"});e.style.display="none",e.setAttribute("role","alert"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true");const i=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),o=this.createElement("span",{className:"error-text"});return e.appendChild(i),e.appendChild(o),e}createCheckButton(){const e=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return e.setAttribute("aria-label","Save and check address availability"),e.addEventListener("click",this.handleCheckAvailability),e}createCancelButton(){const e=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return e.setAttribute("aria-label","Cancel address selection"),e.addEventListener("click",this.handleCancel),e}template(){var e,i,o;const r=this.getConfigs("global"),c=null!==(e=this.params.options)&&void 0!==e?e:{},l=null!==(i=c.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),l){const e=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(e)}const d=this.createElement("div",{className:"input-wrapper "+r.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(o=this.selectedAddress)||void 0===o?void 0:o.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),d.appendChild(this.inputElement);const u=this.createElement("span");u.className="input-icon",u.innerHTML=SearchIcon({width:16,height:16,className:""}),d.appendChild(u),this.inputContainer.appendChild(d),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 h=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,h,this.errorContainer],m=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();m.appendChild(f);const v=this.createCheckButton();return m.appendChild(v),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 e=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&e.push("cart-no-header"),this.params.isIndependentComponent&&e.push("independent"),e}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const e=[],i=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!i){const i=ComponentFactoryService.createElement({type:r.CART_HEADER});e.push(i)}const o=ComponentFactoryService.createElement({type:r.CART_BODY});e.push(o);const c=ComponentFactoryService.createElement({type:r.CART_FOOTER});return e.push(c),e}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const e=document.createElement("div");e.className="empty-cart-container";const i=document.createElement("h3");return i.className="empty-cart-content",i.textContent="Your cart is empty",e.appendChild(i),e}createLoadingElement(){const e=document.createElement("div");return e.setAttribute("data-component-type","cart-body-loading"),e.innerHTML=this.loadingTemplate(),e}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(e){try{return ComponentFactoryService.createElement({type:r.CART_RETAILER,retailerId:e.id})}catch(i){return this.logger.error("Cart retailer component creation failed",i),document.createElement("div")}}getRetailerElementById(e){return this.container.querySelector('[data-retailer-id="'+e+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const e=this.createEmptyCartElement();this.container.appendChild(e),this.setupEmptyCartListeners()}addLoadingOverlay(){const e=this.getLoadingElement();if(!e){const e=this.createLoadingElement();this.container.appendChild(e)}}removeLoadingOverlay(){const e=this.getLoadingElement();e&&e.remove()}setupEmptyCartListeners(){const e=this.container.querySelector('[data-action="continue-shopping"]');e&&e.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(e,i){const o=this.createRetailerElement(i);o.setAttribute("data-retailer-id",e),this.container.appendChild(o)}removeRetailerElement(e){const i=this.getRetailerElementById(e);i&&i.remove()}updateRetailerElement(e,i){const o=this.getRetailerElementById(e);if(o){const r=this.createRetailerElement(i);r.setAttribute("data-retailer-id",e),o.replaceWith(r)}}hasRetailerDataChanged(e,i){return e?![]:!![]}getValidRetailers(e){if(!e)return{};const i={};for(const[o,r]of Object.entries(e))r&&"object"==typeof r&&r.id&&(i[o]=r);return i}getValidRetailerIds(e){const i=this.getValidRetailers(e);return new Set(Object.keys(i))}onStoreChanged(e){const i=e.find(e=>"cart.retailers"===e.path),o=e.find(e=>"cart.loading"===e.path);if(i){const e=this.getValidRetailers(i.oldValue),o=this.getValidRetailers(i.value),r=this.getValidRetailerIds(i.oldValue),c=this.getValidRetailerIds(i.value),l=r.size,d=c.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),h=Object.keys(u).length;if(d>0&&0===h)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===l&&d>0){this.container.innerHTML="";for(const[e,i]of Object.entries(o))this.addRetailerElement(e,i)}else if(l>0&&0===d)this.showEmptyCartState();else if(d>0){for(const e of r)c.has(e)||this.removeRetailerElement(e);for(const i of c){const c=o[i],l=e[i];r.has(i)?this.hasRetailerDataChanged(l,c)&&this.updateRetailerElement(i,c):this.addRetailerElement(i,c)}}else 0===l&&0===d&&this.showEmptyCartState()}if(o){const e=o.value,i=o.oldValue;e!==i&&(e?this.addLoadingOverlay():this.removeLoadingOverlay())}return o||i,![]}afterRender(){this.setupEmptyCartListeners();const e=this.getStoreValue("cart.loading");e&&this.addLoadingOverlay()}template(){const e=this.getStoreValue("cart.retailers")||{},i=Object.values(e);if(0===i.length)return this.createEmptyCartElement();const o=[];for(const r of i){const e=this.createRetailerElement(r);e.setAttribute("data-retailer-id",r.id),o.push(e)}return o}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(e){const i=e.some(e=>e.path.includes("cart.items")),o=e.some(e=>e.path.includes("cart.totals")),r=e.some(e=>e.path.includes("cart.fulfillments")),c=e.some(e=>"cart.loading"===e.path),l=e.some(e=>e.path.includes("cart.retailers"));if(i&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice){const e=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(e.subtotal+e.engravingFee-e.discounts)}(r||o||c||i||l)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const e=this.getStoreValue("cart.loading");if(e)return!![];const i=this.getStoreValue("cart.items")||{},o=Object.values(i).some(e=>e.updating);if(o)return!![];const r=this.getStoreValue("cart.fulfillments")||{},c=Object.values(r).some(e=>e.updating);if(c)return!![];const l=this.getStoreValue("cart.retailers")||{},d=Object.values(l).some(e=>e.updating);return d?!![]:![]}hasUnmetMinimum(e){var i;const o=e.subtotal;if(e.type===c.SHIPPING){const r=e.fees;if((null===(i=r.individual)||void 0===i?void 0:i.active)&&r.individual.min>0&&o<r.individual.min)return!![]}if(e.type===c.ON_DEMAND){const i=e.fees;if(i.min>0&&o<i.min)return!![]}return![]}shouldDisableCheckout(){const e=this.getStoreValue("cart.fulfillments")||{};return Object.values(e).some(e=>this.hasUnmetMinimum(e))}updateCheckoutButtonState(){const e=this.getStoreValue("cart.items")||{},i=Object.keys(e).length>0;if(this.checkoutButton){const e=this.isAnythingLoading(),o=this.shouldDisableCheckout(),r=e||o||!i;this.checkoutButton.disabled=r,this.checkoutButton.classList.toggle("checkout-btn-disabled",r),this.checkoutButton.classList.toggle("loading",e)}}updateSubtotalItemsCount(){const e=this.getStoreValue("cart.items"),i=Object.values(e).reduce((e,i)=>e+i.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+i+" item"+(1!==i?"s":"")+"):")}async handleCheckout(e){return this.clientConfig.isBuilder()?(e.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(e.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const e=this.getConfigs("global"),i=this.getStoreValue("cart.totals"),o=[],c=document.createElement("div");c.className="cart-footer-header";const l=document.createElement("div");l.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",l.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(i.subtotal+i.engravingFee-i.discounts),l.appendChild(this.subtotalPrice);const d=document.createElement("p");if(d.textContent="Taxes & fees will be calculated at checkout",d.className="taxes-fees-info",c.appendChild(l),c.appendChild(d),o.push(c),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:r.CART_PROMO_CODE});o.push(e)}const u=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(o.push(u),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 e=>{e.preventDefault(),await this.handleCheckout(e)}),this.checkoutButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handleCheckout(e))}),o.push(this.checkoutButton),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});o.push(e)}return o}}const shouldShowMinimumPurchaseAlert=(e,i=![])=>{var o,r;const l=e.subtotal;if(e.type===c.SHIPPING){const c=e.fees;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&l<c.pack.min)return!![];if(!i&&(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&l<c.individual.min)return!![]}else if(e.type===c.ON_DEMAND){const i=e.fees;if(i.min>0&&l<i.min)return!![]}return![]},getMinimumPurchaseMessage=(e,i=![])=>{var o,r;const l=e.subtotal;if(e.type===c.SHIPPING){const c=e.fees;let d=0;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0?d=c.pack.min:(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&(d=c.individual.min),d>0&&l<d)return{message:"+"+formatCentToDollarText(d-l)+" needed for order minimum",type:"warning"}}if(e.type===c.ON_DEMAND){const i=e.fees,o=i.min>0?i.min:0;if(o>0&&l<o)return{message:"+"+formatCentToDollarText(o-l)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(e,i=![])=>{var o,r;const l=e.subtotal;if(e.type===c.SHIPPING){const c=e.fees;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&l<c.pack.min)return!![];if(!i&&(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&l<c.individual.min)return!![]}if(e.type===c.ON_DEMAND){const i=e.fees;if(i.min>0&&l<i.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const e=this.config||{};if(e.showIcon===![])return null;const i={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},r=i[this.params.messageType]||"warning",c=document.createElement("div");return c.className="alert-icon alert-icon-"+this.params.messageType,c.appendChild(htmlStringToElement(o[r]({width:16,height:16,className:"alert-icon-svg"}))),c}template(){var e;const i=[],o=this.getIconElement();o&&i.push(o);const r=document.createElement("span");if(r.className="alert-message",r.textContent=this.params.message,i.push(r),"detailed"===(null===(e=this.config)||void 0===e?void 0:e.alertType)&&this.params.currentTotal){const e=document.createElement("div");e.className="alert-details";const o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(o),i.push(e)}return i}}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}getProductStore(){const e=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+e+".items")||{};return Object.values(i).find(i=>i.fulfillmentId===e)}handleItemsUpdate(e,i){const o=new Set(e||[]),c=new Set(i||[]);for(const r of o)if(!c.has(r)){const e=this.container.querySelector('[data-item-id="'+r+'"]');e&&e.remove()}for(const l of c)if(!o.has(l)){const e=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:l});e.setAttribute("data-item-id",l),this.container.appendChild(e)}}setupItemElements(){const e=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+e+".items")||[],o=this.container.querySelectorAll("[data-item-id]");for(const r of o)r.remove();for(const c of i){const e=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:c});e.setAttribute("data-item-id",c),this.container.appendChild(e)}}setupMinimumPurchaseAlert(){var e;const i=this.getFulfillmentId(),o=(null===(e=this.getProductStore())||void 0===e?void 0:e.pack)||![],c=this.getStoreValue("cart.fulfillments."+i),l=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(c,o)){const e=getMinimumPurchaseMessage(c,o),i=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:c.subtotal,config:{showIcon:!![],alertType:"minimal"}});i.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(i)}}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","fulfillment-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.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 ',i.appendChild(o),e.appendChild(i),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var e;const i=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+i);return(null===(e=null==o?void 0:o.items)||void 0===e?void 0:e.length)?o.items.some(e=>{const i=this.getStoreValue("cart.items."+e);return(null==i?void 0:i.updating)===!![]}):![]}checkAndUpdateLoadingState(){const e=this.isAnyItemUpdating(),i=this.hasLoadingOverlay();e&&!i?this.showLoadingOverlay():!e&&i&&this.hideLoadingOverlay()}onStoreChanged(e){const i=this.getFulfillmentId(),o="cart.fulfillments."+i,r=e.find(e=>e.path===o),c=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(c.length>0&&this.checkAndUpdateLoadingState(),r){const e=r.oldValue,i=r.value,o=(null==e?void 0:e.items)||[],c=(null==i?void 0:i.items)||[],l=JSON.stringify(o)!==JSON.stringify(c);l&&(this.handleItemsUpdate(o,c),this.checkAndUpdateLoadingState());const d=this.hasFulfillmentFeesChanged(e,i),u=this.hasFulfillmentDataChanged(e,i,["items","updating"]);if(d&&!u&&this.setupMinimumPurchaseAlert(),!u)return![]}return![]}hasFulfillmentFeesChanged(e,i){return e?e.subtotal!==i.subtotal||e.shippingFee!==i.shippingFee||e.deliveryFee!==i.deliveryFee||JSON.stringify(e.fees)!==JSON.stringify(i.fees):!![]}hasFulfillmentDataChanged(e,i,o=[]){if(!e)return!![];const r=["type","canEngrave","retailerId"];for(const c of r)if(!o.includes(c)&&e[c]!==i[c])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const vt={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"},yt="America/New_York";function detectUserTimezone(e){try{if(e){const i=e.toUpperCase(),o=vt[i];return o||yt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return yt}}function getCurrentTimeInTimezone(e){try{const i=new Date,o=i.getTime(),r=6e4*i.getTimezoneOffset(),c=new Date(o+r),l=new Date(c.toLocaleString("en-US",{timeZone:e})),d=c.getTime()-l.getTime();return new Date(o+d)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(e){const i=detectUserTimezone(e);return getCurrentTimeInTimezone(i)}function isDateTimeInRange(e){const{startDate:i,endDate:o,addressState:r}=e;try{const e=getCurrentTimeInUserTimezone(r),c=!i||e>=new Date(i),l=!o||e<=new Date(o);return c&&l}catch(c){return![]}}function filterActiveItems(e,i){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:i}))}function hasActiveItems(e,i){return filterActiveItems(e,i).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var e,i,o;const c=this.config.layout.drawerHeaderText,l=this.getConfigs("global"),d=document.createElement("div");d.className="cart-header-content";const u=document.createElement("h2");u.className="cart-title",u.textContent=c,d.appendChild(u);const h=document.createElement("button");h.type="button",h.className="cart-header-close-btn",h.innerHTML=CloseIcon({width:16,height:16}),h.setAttribute("aria-label","Close cart drawer"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),d.appendChild(h);const p=this.clientConfig.get("promoTicker"),m=null!==(i=null===(e=null==l?void 0:l.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],f=null!=p?p:m,v=this.store.get("address"),y=hasActiveItems(f,null===(o=null==v?void 0:v.address)||void 0===o?void 0:o.state);if(!f.length||!y)return[d];const b=ComponentFactoryService.createElement({context:"cart",type:r.PROMO_CODE_TICKER,tickers:f});return[d,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(e,i){var o,c,l,d,u,h,p,m,f,v;this.commands.ui.openDrawer(r.ENGRAVING_FORM,{identifier:e,context:"cart",lines:(null===(c=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.lines)||[],maxLines:(null===(d=null===(l=i.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxLines)||1,maxCharsPerLine:(null===(h=null===(u=i.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,fee:(null===(m=null===(p=i.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.fee)||0,location:null===(v=null===(f=i.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.location})}template(){var e,i,o,c,l,d,u,h,p;const m=this.params.itemId,f=this.getStoreValue("cart.items."+m),v=this.getConfigs("global"),y=this.getStoreValue("cart.fulfillments."+f.fulfillmentId),b=f.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(e=null==y?void 0:y.expectation)||void 0===e?void 0:e.detail)||"",x=document.createElement("article");x.className="cart-item";const w=document.createElement("div");w.className="item-image";const C=document.createElement("img");C.src=f.mainImage,C.alt=f.name,w.appendChild(C);const S=document.createElement("div");S.className="item-details";const E=document.createElement("div");E.className="item-header";const _=document.createElement("h3");_.className="item-title",_.textContent=f.name;const D=document.createElement("button");D.className="item-delete",D.innerHTML=TrashIcon({}),D.setAttribute("role","button"),D.setAttribute("tabindex","0"),D.setAttribute("aria-label","Remove "+f.name+" from cart"),D.setAttribute("aria-expanded","true"),D.addEventListener("click",async()=>{await this.commands.cart.removeItem(m)}),D.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.commands.cart.removeItem(m))}),E.appendChild(_),E.appendChild(D);const I=document.createElement("div");I.className="item-specs",I.textContent=f.size+", "+f.container;const A=document.createElement("div");A.className="item-shipping-container";const z=document.createElement("div");if(z.className="item-shipping",z.textContent=b,A.appendChild(z),v.layout.enablePersonalization&&(null===(o=null===(i=null==f?void 0:f.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.isEngravable)&&(null===(l=null===(c=null==f?void 0:f.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.hasEngraving)===![]&&y.canEngrave){const e=document.createElement("span");e.className="cart-add-personalization-span",e.textContent=v.layout.personalizationText+" +"+formatCentToDollarText((null===(u=null===(d=f.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,![]),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Add personalization to "+f.name),e.addEventListener("click",()=>this.handleOpenEngravingForm(m,f)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleOpenEngravingForm(m,f))}),A.appendChild(e)}S.appendChild(E),S.appendChild(I),S.appendChild(A),x.appendChild(w),x.appendChild(S);const O=[x],N=ComponentFactoryService.createElement({type:r.CART_ITEM_QUANTITY_PRICE,itemId:m});if((null===(p=null===(h=null==f?void 0:f.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:m,context:"cart"});O.push(e)}return O.push(N),O}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(e){const i=e.find(e=>"cart.items"===e.path);if(i){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getItemStore(){const e=this.params.itemId,i=this.getStoreValue("cart.items."+e);return i||null}calculateQuantityLimits(){const e=this.getItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const i=e.quantity,o=this.getAvailableQuantity(),r=o>0;return{currentQuantity:i,availableQuantity:o,canIncrease:r,canDecrease:!![]}}getAvailableQuantity(){var e,i,o,r;const c=this.getItemStore();if(!c)return 0;const l=c.partNumber,d=c.fulfillmentId,u=this.getStoreValue("cart.items")||{},h=Object.values(u).filter(e=>e.partNumber===l&&e.fulfillmentId===d),p=h.reduce((e,i)=>e+i.quantity,0),m=this.getStoreValue("products."+c.upc)||this.getStoreValue("products."+c.salsifyGrouping);if(!m)return c.maxQuantity-p;const f=null!==(r=null===(o=null===(i=null===(e=null==m?void 0:m.sizes)||void 0===e?void 0:e[c.liquidId])||void 0===i?void 0:i.attributes)||void 0===o?void 0:o.maxQuantityPerOrder)&&void 0!==r?r:0;return!f||f<=0?c.maxQuantity-p:f-p}updateButtonStates(e){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!e.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!e.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const i=this.calculateQuantityLimits();e>0&&!i.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,e)}createQuantityContainer(){const e=this.calculateQuantityLimits(),i=this.getItemStore();if(!i)return document.createElement("div");const o=document.createElement("div");return o.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 e=>{e.preventDefault(),e.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 e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(e),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantitySpan),o.appendChild(this.qtyIncreaseButton),o}createPriceContainer(){const e=this.getItemStore();if(!e)return document.createElement("div");const i=document.createElement("div");i.className="item-price-container";const o=document.createElement("span");if(o.className="item-price",o.textContent=formatCentToDollarText(e.price),i.appendChild(o),e.quantity>1){const o=document.createElement("span");o.className="item-price-per-unit",o.textContent="("+formatCentToDollarText(e.unitPrice)+" ea)",i.appendChild(o)}return i}template(){const e=[];if(this.config.layout.showQuantityCounter){const i=this.createQuantityContainer();e.push(i)}const i=this.createPriceContainer();return e.push(i),e}}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(e){const i=e.find(e=>"cart.promoCode"===e.path);if(i){const{value:e,oldValue:o}=i,r=Boolean(null==o?void 0:o.code),c=Boolean(null==e?void 0:e.code);if(!r&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(r&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;if(c&&this.promoCodePill&&e.discountAmount!==(null==o?void 0:o.discountAmount))return this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",void 0}}createAppliedContainer(e){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+(null==e?void 0:e.code)),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){const e=document.createElement("div");e.classList.add("promo-code-container");const i=document.createElement("div");i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),e.appendChild(i),this.container.appendChild(e),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),i=e.length>=3&&e.length<=255,o=this.getStoreValue("cart.loading"),r=this.getStoreValue("cart.promoCode"),c=this.getStoreValue("cart.events")||[],l=hasCartAnyPromoCodeEvents(c);this.applyButton.disabled=!i||o||Boolean(null==r?void 0:r.discountAmount)||this.isApplying||l}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),o=this.promoInput;o.setValue(i),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 s=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(e),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(i){this.logger.error("Cart promo code application failed",{promoCode:e,error:i instanceof Error?i.message:String(i)})}};return this.applyButton.addEventListener("click",s),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())}),this.applyButton}template(){const e=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==e?void 0:e.code){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+e.code),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),i}const i=document.createElement("div");i.classList.add("promo-code-container");const o=document.createElement("div");return o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),i.appendChild(o),i}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(e){return ComponentFactoryService.createElement({type:r.CART_FULFILLMENT,fulfillmentId:e})}getFulfillmentElementById(e){return this.container.querySelector('[data-fulfillment-id="'+e+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const e=this.getFulfillmentContainer();if(e)return{parent:e.parentElement,nextSibling:e.nextElementSibling};const i=this.container.querySelectorAll("[data-fulfillment-id]");if(i.length>0){const e=i[i.length-1];return{parent:e.parentElement,nextSibling:e.nextElementSibling}}return null}addFulfillmentElement(e){const i=this.getFulfillmentInsertionPoint();if(i){const o=this.createFulfillmentElement(e);o.setAttribute("data-fulfillment-id",e);const r=this.getFulfillmentContainer();r&&r.remove(),i.nextSibling?i.parent.insertBefore(o,i.nextSibling):i.parent.appendChild(o)}}removeFulfillmentElement(e){const i=this.getFulfillmentElementById(e);if(i){const e=i.parentElement,o=i.nextElementSibling;i.remove();const r=this.container.querySelectorAll("[data-fulfillment-id]");if(0===r.length){const i=document.createElement("div");i.id="retailer-fulfillment-container",o?e.insertBefore(i,o):e.appendChild(i)}}}handleFulfillmentsUpdate(e,i){const o=new Set(e||[]),r=new Set(i||[]);for(const c of o)r.has(c)||this.removeFulfillmentElement(c);for(const c of r)o.has(c)||this.addFulfillmentElement(c)}setupFulfillmentElements(){const e=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const c of o)c.remove();let r=this.getFulfillmentContainer();if(!r){const e=this.container.querySelector(".retailer-body-container"),i=this.container.querySelector("#retailer-subtotal-container");r=document.createElement("div"),r.id="retailer-fulfillment-container",e&&i&&e.insertBefore(r,i)}for(const c of i)this.addFulfillmentElement(c)}setupSubtotalElement(){const e=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const o=ComponentFactoryService.createElement({type:r.CART_RETAILER_SUBTOTAL,retailerId:e});i.replaceWith(o)}}onStoreChanged(e){const i=this.getRetailerId(),o="cart.retailers."+i,r=e.find(e=>e.path===o);if(r){const e=r.oldValue,i=r.value,o=(null==e?void 0:e.fulfillments)||[],c=(null==i?void 0:i.fulfillments)||[];JSON.stringify(o)!==JSON.stringify(c)&&this.handleFulfillmentsUpdate(o,c)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section"),o=this.container.querySelector(".section-header-label");if(e&&i&&o){const F=()=>{const i=e.checked;o.setAttribute("aria-label",i?"Expand retailer section":"Collapse retailer section"),o.setAttribute("aria-expanded",i?"false":"true")};e.addEventListener("change",()=>{e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),F()}),o.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())}),e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),F()}}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const e=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+e),o=document.createElement("section");o.className="retailer-section";const r=document.createElement("div");r.className="cart-retailer-header";const c=document.createElement("div");c.className="retailer-info";const l=document.createElement("h2");l.className="section-title",l.textContent=i.name,c.appendChild(l);const d=document.createElement("input");d.type="checkbox",d.id=i.id,d.className="section-toggle",c.appendChild(d);const u=document.createElement("label");u.htmlFor=i.id,u.className="section-header-label",u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Collapse retailer section"),u.setAttribute("aria-expanded","true");const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(h),c.appendChild(u),r.appendChild(c),o.appendChild(r);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),o.appendChild(p),o}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(e,i){const o=Object.values(e||{}).filter(e=>e.retailerId===i);let r=0;for(const c of o)r+=c.quantity;return r}template(){const e=this.params.retailerId,i=this.getStoreValue("cart.retailers."+e+".subtotal")||0,o=this.getStoreValue("cart.retailers."+e+".engravingFee")||0,r=this.getStoreValue("cart.items"),c=this.getRetailerItemCount(r,e),l=1===c?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+c+" "+l+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(i+o),[d,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var e,i,o;const c=this.store.get("checkout.isPresaleLocked"),l=this.store.get("checkout.presaleExpiresAt"),d=this.getConfigs("global"),u=this.clientConfig.get("promoTicker"),h=null!==(i=null===(e=null==d?void 0:d.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],p=null!=u?u:h,m=this.store.get("address"),f=hasActiveItems(p,null===(o=null==m?void 0:m.address)||void 0===o?void 0:o.state),v=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),y=c&&l,b=document.createElement("div");b.classList.add("checkout-container"),v&&b.classList.add("no-header"),this.params.isIndependentComponent&&b.classList.add("independent");const x=ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION_SECTION});b.appendChild(x);const w=ComponentFactoryService.createElement({type:r.CHECKOUT_SUMMARY_SECTION});if(b.appendChild(w),!y&&(!p.length||!f)&&v)return[b];const C=document.createElement("div");if(C.classList.add("checkout-header-wrapper"),!v){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER});C.appendChild(e)}if(p.length&&f&&!y){const e=ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:p});C.appendChild(e)}if(y){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN});C.appendChild(e)}return[C,b]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const e=this.store.get("checkout.isPresaleLocked"),i=this.getConfigs("checkout");let o=null;if(!e){o=document.createElement("button"),o.classList.add("checkout-header-button"),o.setAttribute("aria-label","Back to Cart"),o.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(r.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),o.appendChild(e)}const c=document.createElement("h1");c.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",c.classList.add("checkout-header-title"),c.setAttribute("aria-label","Checkout Page");const l=document.createElement("button");return l.innerHTML=CloseIcon({width:16,height:16}),l.classList.add("checkout-header-button-close"),l.setAttribute("aria-label","Close Checkout"),l.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o?[o,c,l]:[c,l]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(e){const i=e.find(e=>"checkout.isGift"===e.path);i&&this.handleBuyerInformationVisibility(i.value)}handleBuyerInformationVisibility(e){const i=this.container.querySelector("#buyer-information-container");if(e&&!i){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_INFORMATION_FORM});e.id="buyer-information-container";const i=this.container.querySelector(".checkout-delivery-information");i&&i.insertAdjacentElement("afterend",e)}else!e&&i&&setTimeout(()=>{i.remove()},300)}template(){const e=[],i=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVERY_INFORMATION_FORM});e.push(i);const o=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT_FORM});e.push(o);const c=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING_FORM});return e.push(c),e}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(e){var i;const o=e.find(e=>"checkout.presaleExpiresAt"===e.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value),!![];const r=e.find(e=>"ui.drawer"===e.path);return(null===(i=null==r?void 0:r.value)||void 0===i?void 0:i.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const e=this.store.get("checkout.presaleExpiresAt");e&&this.updateExpiresAt(e),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var e,i;const o=[".drawer-content"];for(const c of o){const i=null===(e=this.rootElement)||void 0===e?void 0:e.closest(c);if(i&&this.isScrollable(i))return i}let r=null===(i=this.rootElement)||void 0===i?void 0:i.parentElement;for(;r&&r!==document.body;){if(this.isScrollable(r))return r;r=r.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var e,i;if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop,r=70,c=10;!this.isCurrentlyScrolled&&o>r?(this.isCurrentlyScrolled=!![],null===(e=this.rootElement)||void 0===e||e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&o<c&&(this.isCurrentlyScrolled=![],null===(i=this.rootElement)||void 0===i||i.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(e){const i=window.getComputedStyle(e),o=i.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(e){this.stopCountdown();try{if(this.expiresAt=new Date(e),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:e}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const i=new Date,o=Math.floor((this.expiresAt.getTime()-i.getTime())/1e3);o<this.totalDuration&&(this.totalDuration=Math.max(o,240)),this.startCountdown()}catch(i){this.logger.error("Failed to parse presale expiration date",i),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const e=new Date,i=Math.max(0,this.expiresAt.getTime()-e.getTime()),o=i/1e3,r=this.totalDuration-o,c=Math.max(0,Math.min(100,r/this.totalDuration*100)),l=o<60;if(l!==this.isUnderOneMinute){this.isUnderOneMinute=l;const e=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==e||e.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==e||e.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const d=this.rootElement.querySelector("[data-timer]");d&&(d.textContent=this.formatTime(i));const u=this.rootElement.querySelector("[data-progress-fill]");u&&(u.style.width=c+"%"),0===i&&this.handleExpire()}formatTime(e){const i=Math.floor(e/1e3),o=Math.floor(i/60),r=i%60,c=Math.floor(e%1e3/10);return o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const e=document.createElement("div");e.classList.add("checkout-presale-countdown"),this.rootElement=e;const i=document.createElement("div");i.classList.add("checkout-presale-text-container");const o=document.createElement("div");o.classList.add("checkout-presale-heading");const r=document.createElement("h2");r.textContent="LIMITED PRE-ORDER:";const c=document.createElement("div");c.classList.add("checkout-presale-timer"),c.setAttribute("data-timer",""),c.textContent="00:00:00",o.appendChild(r),o.appendChild(c);const l=document.createElement("p");l.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",l.classList.add("checkout-presale-subtitle"),i.appendChild(o),i.appendChild(l);const d=document.createElement("div");d.className="checkout-presale-progress-bar",d.setAttribute("data-progress","");const u=document.createElement("div");return u.className="checkout-presale-progress-fill",u.setAttribute("data-progress-fill",""),u.style.width="0%",d.appendChild(u),e.appendChild(i),e.appendChild(d),e}}const bt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],xt={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(e,i){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(i)?i:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(i)?i:null:"class"===e?i.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():i.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const i=e.textContent||"",o=i.replace(/<[^>]*>/g,"");if(o.trim()){const e=document.createTextNode(o);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const i=e,o=i.tagName.toLowerCase();if(bt.includes(o)){const e=document.createElement(o),r=xt[o]||[];for(const o of Array.from(i.attributes)){const i=o.name.toLowerCase();if(r.includes(i)){const r=sanitizeAttributeValue(i,o.value);null!==r&&e.setAttribute(i,r)}}"a"===o&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(i.childNodes)){const i=cleanNode(o);i&&e.appendChild(i)}return e}const r=document.createDocumentFragment();for(const e of Array.from(i.childNodes)){const i=cleanNode(e);i&&r.appendChild(i)}return r.childNodes.length>0?r:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const i=new DOMParser,o=i.parseFromString(e,"text/html"),r=o.querySelector("parsererror");if(r)return console.warn("HTML parsing error detected"),"";const c=document.createDocumentFragment();for(const e of Array.from(o.body.childNodes)){const i=cleanNode(e);i&&c.appendChild(i)}const l=document.createElement("div");return l.appendChild(c),l.innerHTML}catch(i){return console.error("HTML sanitization error:",i),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const i=e.find(e=>"checkout.amounts"===e.path);if(i){const e=this.getStoreValue("checkout"),i=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&i>0)}}updateZeroAmountElement(e){const i=this.container.querySelector(".checkout-zero-amount-container");if(e&&!i){const e=document.createElement("div");e.classList.add("checkout-zero-amount-container"),e.textContent="Credit card required to complete order (even when fully covered by gift card)";const i=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");i&&i.after(e)}else!e&&i&&i.remove()}afterRender(){const e=this.getStoreValue("checkout.amounts");e&&this.updateZeroAmountElement(0===e.total)}handleEmailToggle(e){this.commands.checkout.toggleMarketingPreferences("canEmail"),e.classList.toggle("checked");const i=e.classList.contains("checked");e.setAttribute("aria-checked",i?"true":"false")}handleSmsToggle(e){this.commands.checkout.toggleMarketingPreferences("canSms"),e.classList.toggle("checked");const i=e.classList.contains("checked");e.setAttribute("aria-checked",i?"true":"false")}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,i=this.config.layout.smsOptIn;if(!e.show&&!i.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),e.show){const i=document.createElement("div");let r;i.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canEmail");const c=document.createElement("span");c.id="emailOptIn",c.classList.add("checkout-checkbox-visual"),r&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Email opt-in checkbox"),c.setAttribute("aria-checked",r?"true":"false"),c.addEventListener("click",()=>this.handleEmailToggle(c)),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEmailToggle(c))});const l=document.createElement("label");l.setAttribute("for","emailOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(e.text),l.addEventListener("click",e=>{const i=e.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked"))}),i.appendChild(c),i.appendChild(l),o.appendChild(i)}if(i.show){const e=document.createElement("div");let r;e.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?i.checked:this.store.get("checkout.marketingPreferences.canSms");const c=document.createElement("span");c.classList.add("checkout-checkbox-visual"),c.id="smsOptIn",r&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","SMS opt-in checkbox"),c.setAttribute("aria-checked",r?"true":"false"),c.addEventListener("click",()=>this.handleSmsToggle(c)),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleSmsToggle(c))});const l=document.createElement("label");l.setAttribute("for","smsOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(i.text),l.addEventListener("click",e=>{const i=e.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked"))}),e.appendChild(c),e.appendChild(l),o.appendChild(e)}return o}hasOnDemandOrder(){const e=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}template(){var e;const i=[],o=this.getConfigs("global"),c=this.getConfigs("checkout"),l=this.getConfigs("global"),d=c.layout.allowGiftCards,u=null===(e=null==l?void 0:l.layout)||void 0===e?void 0:e.allowPromoCodes,h=document.createElement("div");h.classList.add("section-title-container");const p=document.createElement("h3");p.textContent="Order Summary",p.classList.add("section-title"),h.appendChild(p),i.push(h);const m=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});i.push(m);const f=document.createElement("div");f.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),i.push(f),d||u){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});i.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});i.push(e),i.push(v)}const y=document.createElement("div");y.classList.add("section-title-container");const b=document.createElement("h3");b.textContent="100% Secure Payments",b.classList.add("disclaimer-header"),y.appendChild(b);const x=document.createElement("p");x.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.",x.classList.add("disclaimer-description"),y.appendChild(x),i.push(y);const w=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});i.push(w);const C=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});i.push(C);const S=this.marketingOptInsContainer();if(S&&i.push(S),c.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(c.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),i.push(e),i.push(o),i.push(r)}if(o.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});i.push(e)}return i}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(e){this.commands.checkout.updateBillingInfo(ht.firstName,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.firstName})}async handleLastNameChange(e){this.commands.checkout.updateBillingInfo(ht.lastName,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.lastName})}async handleEmailChange(e){this.commands.checkout.updateBillingInfo(ht.email,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.email})}async handlePhoneChange(e){this.commands.checkout.updateBillingInfo(ht.phone,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.phone})}async handleCompanyChange(e){this.commands.checkout.updateBillingInfo(ht.company,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.company})}async handleAddressOneChange(e){this.commands.checkout.updateBillingInfo(ht.addressOne,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.addressOne})}async handleAddressTwoChange(e){this.commands.checkout.updateBillingInfo(ht.addressTwo,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.addressTwo})}async handleCityChange(e){this.commands.checkout.updateBillingInfo(ht.city,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.city})}async handleStateChange(e){this.commands.checkout.updateBillingInfo(ht.state,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.state})}async handleZipCodeChange(e){this.commands.checkout.updateBillingInfo(ht.zipCode,e),this.pubSub.publishForm(o.BILLING,{fieldName:ht.zipCode})}billingSameAsShippingToggle(){const e=this.getStoreValue("checkout.billingSameAsShipping"),i=document.createElement("div");i.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const r=document.createElement("span");r.id="billingSameAsShipping",r.classList.add("checkout-checkbox-visual"),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Billing same as shipping checkbox"),r.setAttribute("aria-checked",e?"true":"false"),e&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),i.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const c=document.createElement("label");return c.textContent="Billing address same as shipping address",c.setAttribute("for","billingSameAsShipping"),c.classList.add("billing-checkbox-label"),o.appendChild(r),o.appendChild(c),i.appendChild(o),i}template(){const e=this.getStoreValue("checkout.billingSameAsShipping"),i=[],o=this.billingSameAsShippingToggle();if(i.push(o),e)return i;const c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Your billing info",l.classList.add("section-title"),c.appendChild(l);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),c.appendChild(d),i.push(c);const u=document.createElement("div");u.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});p.setAttribute("aria-label","First name input"),h.appendChild(p);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});m.setAttribute("aria-label","Last name input"),h.appendChild(m),u.appendChild(h);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:ht.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});f.setAttribute("aria-label","Email input"),u.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-two-col-container");const y=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:ht.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});y.setAttribute("aria-label","Phone input"),v.appendChild(y);const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});b.setAttribute("aria-label","Company input"),v.appendChild(b),u.appendChild(v);const x=document.createElement("div");x.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});w.setAttribute("aria-label","Street address input"),x.appendChild(w);const C=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});C.setAttribute("aria-label","Apt, suite, etc. (optional) input"),x.appendChild(C),u.appendChild(x);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});E.setAttribute("aria-label","City input"),S.appendChild(E);const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:e=>e&&2===e.length&&/^[A-Z]{2}$/.test(e)?null:"State must be 2 uppercase characters"},onChange:this.handleStateChange.bind(this),storePath:"billing.state"});_.setAttribute("aria-label","State input"),S.appendChild(_);const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return D.setAttribute("aria-label","Zip Code input"),S.appendChild(D),u.appendChild(S),i.push(u),i}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(e){this.commands.checkout.updateCustomerInfo(dt.firstName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.firstName})}async handleLastNameChange(e){this.commands.checkout.updateCustomerInfo(dt.lastName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.lastName})}async handleEmailChange(e){this.commands.checkout.updateCustomerInfo(dt.email,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.email})}async handlePhoneChange(e){this.commands.checkout.updateCustomerInfo(dt.phone,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.phone})}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(dt.company,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.company})}async handleDobChange(e){this.commands.checkout.updateCustomerInfo(dt.birthDate,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.birthDate})}template(){const e=this.store.get("checkout.customer"),i=[],o=document.createElement("div");o.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Buyer Information",c.classList.add("section-title"),o.appendChild(c);const l=document.createElement("p");l.textContent="Buyer information is used to process your order and for delivery purposes.",l.classList.add("section-subtitle"),o.appendChild(l),i.push(o);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});u.appendChild(h);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});u.appendChild(p),d.appendChild(u);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:this.handleCompanyChange.bind(this)});d.appendChild(m);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:dt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});d.appendChild(f);const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:dt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});d.appendChild(v);const y=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:dt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return d.appendChild(y),i.push(d),i}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const e=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}async handleDeliveryInstructionsChange(e){await this.commands.checkout.updateDeliveryInstructions(e)}async handleFirstNameChange(e){const i=this.getStoreValue("checkout.isGift");i?(this.commands.checkout.updateGiftInfo(ut.firstName,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.firstName})):(this.commands.checkout.updateCustomerInfo(dt.firstName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.firstName}))}async handleLastNameChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(ut.lastName,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.lastName})):(this.commands.checkout.updateCustomerInfo(dt.lastName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.lastName}))}async handleEmailChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(ut.email,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.email})):(this.commands.checkout.updateCustomerInfo(dt.email,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.email}))}async handlePhoneChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(ut.phone,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.phone})):(this.commands.checkout.updateCustomerInfo(dt.phone,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.phone}))}async handleAddressTwoChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(ut.addressTwo,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.addressTwo})):(this.commands.checkout.updateCustomerInfo(dt.addressTwo,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.addressTwo}))}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(dt.company,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.company})}async handleBirthdateChange(e){this.commands.checkout.updateCustomerInfo(dt.birthDate,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:dt.birthDate})}async handleGiftMessageChange(e){this.commands.checkout.updateGiftInfo(ut.message,e),this.pubSub.publishForm(o.GIFT,{fieldName:ut.message})}template(){const e=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift")||![],o=this.store.get("checkout.giftRecipient"),c=this.store.get("checkout.customer"),l=this.store.get("address.formattedAddress"),d=i?o:c,u=[],h=document.createElement("div");h.classList.add("delivery-header-container");const p=document.createElement("div");p.classList.add("delivery-header-content");const m=document.createElement("div");m.classList.add("delivery-title-container");const f=document.createElement("h3");f.textContent="Deliver to",f.classList.add("delivery-title");const v=document.createElement("p");v.textContent="Package recipient must be 21+",v.classList.add("delivery-subtitle"),m.appendChild(f),m.appendChild(v);const y=document.createElement("div");y.classList.add("gift-toggle-container");const b=document.createElement("div");b.classList.add("gift-label-wrapper");const x=document.createElement("span");x.textContent="Send as Gift? (Free)",x.classList.add("gift-toggle-label"),b.appendChild(x);const w=document.createElement("span");w.textContent="With personalized note & gift receipt.",w.classList.add("gift-toggle-description"),b.appendChild(w);const C=document.createElement("div");C.classList.add("toggle-switch"),C.classList.toggle("active",i);const S=document.createElement("div");S.classList.add("toggle-slider"),C.setAttribute("tabindex","0"),C.setAttribute("aria-label","Toggle Gift Option"),C.setAttribute("role","switch"),C.setAttribute("aria-checked",i?"true":"false"),C.appendChild(S),y.appendChild(b),y.appendChild(C),C.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),C.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleIsGift())}),h.appendChild(y),h.appendChild(m),u.push(h);const E=document.createElement("div");E.classList.add("section-form-container");const _=document.createElement("div");_.classList.add("checkout-two-col-container");const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:i?ut.firstName:dt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:d.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:i?"giftRecipient.firstName":"customer.firstName"});D.setAttribute("aria-label","First Name Input"),_.appendChild(D);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:i?ut.lastName:dt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:d.lastName,onChange:this.handleLastNameChange.bind(this),storePath:i?"giftRecipient.lastName":"customer.lastName"});if(I.setAttribute("aria-label","Last Name Input"),_.appendChild(I),E.appendChild(_),!i){const e=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.company,label:"Company (optional)",autocomplete:!![],value:d.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});e.setAttribute("aria-label","Company Input"),E.appendChild(e)}const A=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:i?ut.email:dt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:d.email,onChange:this.handleEmailChange.bind(this),storePath:i?"giftRecipient.email":"customer.email"});A.setAttribute("aria-label","Email Input"),E.appendChild(A);const z=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:i?ut.phone:dt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:d.phone,onChange:this.handlePhoneChange.bind(this),storePath:i?"giftRecipient.phone":"customer.phone"});if(z.setAttribute("aria-label","Phone Input"),E.appendChild(z),!i){const e=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:dt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(d.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});e.setAttribute("aria-label","Birthdate Input"),E.appendChild(e)}const O=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:l,disabled:!![],className:"disabled-input",validation:{required:!![]}});O.setAttribute("aria-label","Delivery Address Input"),E.appendChild(O);const N=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:i?ut.addressTwo:dt.addressTwo,label:"Apt, suite, etc. (optional)",value:d.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:i?"giftRecipient.addressTwo":"customer.addressTwo"});if(N.setAttribute("aria-label","Address Line 2 Input"),E.appendChild(N),this.hasOnDemandFulfillments()){const i=document.createElement("div");i.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Delivery Instructions",o.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.setAttribute("aria-label","Delivery Instructions Textarea"),r.value=this.store.get("checkout.deliveryInstructions")||"",r.addEventListener("blur",async e=>{await this.handleDeliveryInstructionsChange(e.target.value)}),r.addEventListener("keydown",async e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),await this.handleDeliveryInstructionsChange(e.target.value))});const c=document.createElement("p");c.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",c.classList.add("textarea-message-disclaimer"),i.appendChild(o),i.appendChild(r),i.appendChild(c),E.appendChild(i)}if(i){const i=document.createElement("div");i.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",ut.message);const c=document.createElement("textarea");c.name=ut.message,c.id=ut.message,c.rows=4,c.value=o.message||"",c.setAttribute("aria-label","Gift Message Textarea"),c.addEventListener("input",async e=>{await this.handleGiftMessageChange(e.target.value)});const l=document.createElement("p");l.textContent="Your gift message will be emailed to the recipient along with delivery details.",l.classList.add("textarea-message-disclaimer"),i.appendChild(r),i.appendChild(c),i.appendChild(l),E.appendChild(i)}return u.push(E),u}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let e=this,i=null;for(;e&&e!==document.body;){const o=e.hasAttribute("checkout"),c=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),l=e.hasAttribute("drawer"),d=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),u="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(o||c&&l&&d&&u)return this.rootComponent=e,e;i=e,e=e.parentElement||e.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.payment"),i=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"stripe",variables:{fontFamily:i.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:i.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===i.layout.inputFieldStyle?"none":"1px solid "+i.theme.accentColor,backgroundColor:"filled"===i.layout.inputFieldStyle?i.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 e;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const i=this.findRootComponent();if(!i)return;if(null===(e=this.stripeFormElement)||void 0===e?void 0:e.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const o=i.querySelectorAll('[slot="'+lt+'"]');if(o.length>0)for(const r of o)r.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.stripeFormElement.setAttribute("slot",lt),i.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(c){this.logger.error("Stripe form element creation failed",c),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),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",async e=>{await this.commands.checkout.updateStripeFormStatus(e.detail.status),e.detail.status.hasError&&this.logger.error("Stripe form status update failed",e.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async e=>{try{const{confirmationTokenId:i,setupIntentId:o}=e.detail;await this.commands.checkout.confirmPaymentSession(i,o)}catch(i){this.logger.error("Failed to confirm payment session",i),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const i=await this.doStripeConfig(),o=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:i}});null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(o)}catch(i){this.logger.error("Failed to refresh payment session",i)}})}onStoreChanged(e){const i=e.some(e=>"checkout.payment.sendSubmitSignal"===e.path&&e.value===!![]);if(i&&this.stripeFormElement){const e=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(e)}return![]}disconnected(){var e;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(e=super.disconnected)||void 0===e||e.call(this)}template(){const e=[],i=document.createElement("div");i.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),i.appendChild(o);const r=document.createElement("p");r.textContent="All transactions are secure and encrypted.",r.classList.add("section-subtitle"),i.appendChild(r),e.push(i);const c=document.createElement("slot");return c.setAttribute("name",lt),e.push(c),e}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.F=![],this.A=null,this.O=null,this.N=null,this.L=![],this.M=![],this.R=![]}async initialize({data:e}){if(this.F)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=e.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.F=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const e=this.B;this.A=window.Stripe(e.publishableKey),this.O=this.A.elements({clientSecret:e.clientSecret,appearance:e.appearance}),this.N=this.O.create("payment",e.elementOptions),this.N.mount(this),this.N.on("change",async e=>{const i=!!e.error,o=e.complete,r=i?e.error.message:null;this.M=o,await this.updateStripeFormStatus({isComplete:o,hasError:i,errorMessage:r,isProcessing:this.L})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.M,hasError:![],errorMessage:null,isProcessing:this.L})}),this.R=![]}catch(e){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),e}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(e){const{stripeConfig:i}=e.detail;i&&(this.B=i,await this.refreshPaymentSession())}async handleSubmit(){if(!this.L){this.L=!![],await this.updateStripeFormStatus({isComplete:this.M,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.M)throw new SDKError("Please complete all required payment fields");this.R&&await this.requestSessionRefresh();const e=await this.createConfirmationTokenId(),i=this.B.clientSecret,o=i.split("_secret_")[0],r=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:e,setupIntentId:o}});this.dispatchEvent(r),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(e){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.M,isProcessing:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"An unexpected error with payment occurred"})}finally{this.L=![]}}}async requestSessionRefresh(){const e=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(e),new Promise((e,i)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",T),i(new Error("Session refresh timeout"))},5e3),T=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",T),e()};this.addEventListener("lce:s:refreshSession",T,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(G){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(e){const i=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e}});this.dispatchEvent(i)}async createConfirmationTokenId(){if(!this.O)throw new SDKError("Elements must be provided");try{const{error:e}=await this.O.submit();if(e)throw new SDKError(e.message);const i={elements:this.O,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:o,confirmationToken:r}=await this.A.createConfirmationToken(i);if(o)throw new SDKError(o.message);if(!r||!r.id)throw new SDKError("Confirmation token not found");return r.id}catch(e){throw new SDKError(e.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(e=>{console.error("Error during Stripe form disconnection cleanup:",e)})}async cleanupForm(){var e,i;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(i=(e=this.O).destroy)||void 0===i?void 0:i.call(e),this.O=null),this.A=null,this.L=![],this.M=![],this.R=![],this.F=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((e,i)=>{const o=document.createElement("script");o.src="https://js.stripe.com/basil/stripe.js",o.onload=()=>e(),o.onerror=()=>i(new Error("Failed to load Stripe.js")),document.head.appendChild(o)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,i,o;const r=this.getStoreValue("checkout"),c=Boolean(r.promoCode),l=Boolean(null===(e=r.giftCards)||void 0===e?void 0:e.length),d=this.getConfigs("global"),u=Object.keys(r.onDemandFulfillmentTipInfo||{}).length>0,h=Object.values(r.items||{}),p=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+h.length+" item"+(h.length>1?"s":"")+")",m.appendChild(f);const v=document.createElement("span");v.textContent=formatCentToDollarText(r.amounts.subtotal),m.appendChild(v),p.push(m);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Shipping",y.appendChild(b);const x=document.createElement("span");x.textContent=formatCentToDollarText(r.amounts.shipping),y.appendChild(x),p.push(y);const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Delivery",w.appendChild(C);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(r.amounts.delivery),w.appendChild(S),p.push(w),(null===(i=null==r?void 0:r.amounts)||void 0===i?void 0:i.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Engraving",e.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.engraving),e.appendChild(o),p.push(e)}const E=document.createElement("div");E.classList.add("checkout-amount-line");const _=document.createElement("span");_.textContent="Taxes & Fees",E.appendChild(_);const D=document.createElement("span");if(D.textContent=formatCentToDollarText(r.amounts.tax+r.amounts.service+r.amounts.platform),E.appendChild(D),p.push(E),c){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Promo Code ("+(null===(o=r.promoCode)||void 0===o?void 0:o.code)+")",e.appendChild(i);const c=document.createElement("span");c.textContent="-"+formatCentToDollarText(r.amounts.discounts),e.appendChild(c),p.push(e)}if(l){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Gift Cards Applied",e.appendChild(i);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(r.amounts.giftCards),e.appendChild(o),p.push(e)}if(u){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Tips",e.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.tip),e.appendChild(o),p.push(e)}const I=document.createElement("div");I.classList.add("checkout-separator"),p.push(I);const A=document.createElement("div");A.classList.add("checkout-amount-total");const z=document.createElement("span");z.textContent="Total",A.appendChild(z);const O=document.createElement("span");O.textContent=formatCentToDollarText(r.amounts.total),A.appendChild(O),p.push(A);const N=this.store.get("checkout.isPresaleLocked");if(N){const e=document.createElement("div");e.classList.add("checkout-amount-due");const i=document.createElement("span");i.textContent="Amount due today",e.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),e.appendChild(o),p.push(e);const r=document.createElement("div");r.classList.add("checkout-presale-locked-message");const c=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));r.appendChild(c);const l=document.createElement("p");l.textContent="Pre-ordered items will be charged when shipped.",r.appendChild(l),p.push(r)}return p}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var e,i,o,c,l,d,u,h,p,m,f,v;const y=[],b=this.getConfigs("configurations"),x=this.getConfigs("global"),w=this.getConfigs("checkout"),C=this.config.layout.exitUrl||window.location.host,S=this.config.layout.thankYouButtonText||"Continue Shopping";if((null===(i=null===(e=this.config.theme)||void 0===e?void 0:e.checkoutCompleted)||void 0===i?void 0:i.customLogo)||(null===(c=null===(o=this.config.layout)||void 0===o?void 0:o.checkoutCompleted)||void 0===c?void 0:c.customLogo)){const e=document.createElement("div");e.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=(null===(d=null===(l=this.config.theme)||void 0===l?void 0:l.checkoutCompleted)||void 0===d?void 0:d.customLogo)||(null===(h=null===(u=this.config.layout)||void 0===u?void 0:u.checkoutCompleted)||void 0===h?void 0:h.customLogo),i.alt=b.partnerName+" Logo",e.appendChild(i),y.push(e)}const E=document.createElement("div");E.classList.add("checkout-completed-section-container");const _=document.createElement("div");_.classList.add("checkout-completed-title-container");const D=document.createElement("div");D.classList.add("checkout-completed-title-section");const I=document.createElement("h3");I.innerHTML=(null===(m=null===(p=this.config.theme)||void 0===p?void 0:p.checkoutCompleted)||void 0===m?void 0:m.customText)||(null===(v=null===(f=this.config.layout)||void 0===f?void 0:f.checkoutCompleted)||void 0===v?void 0:v.customText)||"Thank You for Your Order!",D.appendChild(I);const A=document.createElement("p");A.textContent="Your payment has been successfully processed.",D.appendChild(A),_.appendChild(D),E.appendChild(_);const z=document.createElement("div");z.classList.add("checkout-completed-sub-section");const O=document.createElement("div");O.classList.add("checkout-completed-line");const N=document.createElement("h3");N.textContent="Order Number",O.appendChild(N);const M=document.createElement("span");M.textContent=this.params.orderNumber,O.appendChild(M),z.appendChild(O);const R=document.createElement("div");R.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Order Amount",R.appendChild(B);const q=document.createElement("span");q.textContent=""+formatCentToDollarText(this.params.orderTotal),R.appendChild(q),z.appendChild(R);const j=document.createElement("div");j.classList.add("checkout-completed-line");const G=document.createElement("h3");G.textContent="Payment Method",j.appendChild(G);const U=document.createElement("span");U.textContent="** "+this.params.cardLast4,j.appendChild(U),z.appendChild(j),E.appendChild(z);const H=document.createElement("div");H.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>.",H.appendChild(V),E.appendChild(H),y.push(E);const Y=document.createElement("div");Y.classList.add("checkout-completed-section-container");const W=document.createElement("button");W.type="button";const Q=document.createElement("span");Q.textContent=S,W.setAttribute("tabindex","0"),W.setAttribute("role","button"),W.setAttribute("aria-label",S),W.appendChild(Q);const Z=htmlStringToElement(ArrowRightIcon({width:16,height:16}));W.appendChild(Z),W.addEventListener("click",()=>{window.location.href=C}),W.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),window.location.href=C)}),Y.appendChild(W),y.push(Y);const X=document.createElement("div");X.classList.add("checkout-completed-section-container");const $=document.createElement("div");$.classList.add("checkout-completed-help-section"),X.appendChild($);const J=document.createElement("p");J.textContent="Questions about your order? Contact us at ";const tt=document.createElement("a");tt.href="mailto:"+b.supportEmail,tt.textContent=b.supportEmail,J.appendChild(tt),$.appendChild(J);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,$.appendChild(et),y.push(X),w.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(w.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),y.push(e),y.push(i),y.push(o)}if(x.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});y.push(e)}return y}}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(e){var i;const o=e.find(e=>"checkout.giftCards"===e.path),r=e.find(e=>"checkout.loading"===e.path);o&&o.value.length>((null===(i=o.oldValue)||void 0===i?void 0:i.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),i=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!i||o||Boolean(r)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),o=this.giftCardInput;o.setValue(i),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 s=async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(i){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",s),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const e=[];return e.push(this.createGiftCardInput()),e.push(this.createApplyButton()),e}disconnected(){this.giftCardInput=null,this.applyButton=null}}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(e){var i,o,r,c;const l=e.find(e=>"checkout.items"===e.path);l&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const d=e.find(e=>e.path==="checkout.items."+this.params.itemId);if(d){const e=d.oldValue,l=d.value;if(l.updating)return![];const u=(null==e?void 0:e.quantity)!==(null==l?void 0:l.quantity),h=(null===(o=null===(i=null==e?void 0:e.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],p=(null===(c=null===(r=null==l?void 0:l.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.lines)||[],m=JSON.stringify(h)!==JSON.stringify(p);(u||m)&&this.updateEngravingElement(l)}return![]}updateEngravingElement(e){var i,o;const c=this.getConfigs("global"),l=this.container.querySelector(".engraving-view-container");if(l&&l.remove(),(null===(o=null===(i=null==e?void 0:e.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&c.layout.enablePersonalization){const i=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:e.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(i)}}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const i=e.fulfillmentId;if(!i)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const c=this.getStoreValue("cart.fulfillments."+i),l=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(c,e.pack)){const i=getMinimumPurchaseMessage(c,e.pack),l=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:i.message,messageType:i.type,currentTotal:c.subtotal,config:{showIcon:!![],alertType:"minimal"}});l.setAttribute("data-component-type","checkout-retailer-alert"),o.before(l)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),i=Object.keys(e.items).length,o=1===i;this.trashButton.disabled=o,o?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","item-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.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 ',i.appendChild(o),e.appendChild(i),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="item-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const e=this.getStoreValue("checkout.items."+this.params.itemId);return e?e.updating===!![]:![]}checkAndUpdateLoadingState(){const e=this.isItemUpdating(),i=this.hasLoadingOverlay();e&&!i?this.showLoadingOverlay():!e&&i&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e,i,o;const c=this.getConfigs("global"),l=this.getStoreValue("checkout.items."+this.params.itemId),d=null===(e=null==l?void 0:l.attributes)||void 0===e?void 0:e.presale,u=(null==d?void 0:d.isActive)&&(null==d?void 0:d.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(d.estimatedShipBy):"";if(!l)return[];const h=document.createElement("div");h.classList.add("checkout-item-card-header");const p=document.createElement("div");p.classList.add("checkout-item-image");const m=document.createElement("img");m.src=l.mainImage,m.alt=l.name,m.loading="lazy",p.appendChild(m),h.appendChild(p);const f=document.createElement("div");f.classList.add("checkout-item-details-container");const v=document.createElement("h4");v.classList.add("checkout-item-title"),v.textContent=l.name,f.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=d.isActive?""+u:((null==l?void 0:l.expectationDetail)||"")+",",y.appendChild(b);const x=document.createElement("span");x.textContent="From "+((null==l?void 0:l.retailerName)||""),y.appendChild(x),f.appendChild(y),h.appendChild(f),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var i;if(e.preventDefault(),e.stopPropagation(),!(null===(i=this.trashButton)||void 0===i?void 0:i.disabled))try{await this.commands.checkout.removeItem(l.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),h.appendChild(this.trashButton);const w=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:l.cartItemId}),C=[];if(C.push(h),c.layout.enablePersonalization&&(null===(o=null===(i=null==l?void 0:l.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:l.cartItemId,context:"checkout"});C.push(e)}return C.push(w),C}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(e){const i=e.find(e=>"checkout.items"===e.path);if(i){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getAvailableQuantity(){var e,i,o;const r=this.getStoreValue("checkout.items."+this.params.itemId);if(!r)return 0;const c=this.getStoreValue("products");if(!c)return 0;const l=r.partNumber,d=r.fulfillmentId,u=null===(o=null===(i=null===(e=Object.values(c).find(e=>e.sizes[r.liquidId]))||void 0===e?void 0:e.sizes)||void 0===i?void 0:i[r.liquidId])||void 0===o?void 0:o.attributes.maxQuantityPerOrder;if(!u)return 0;const h=this.getStoreValue("checkout.items")||{},p=Object.values(h).filter(e=>e.partNumber===l&&e.fulfillmentId===d),m=p.reduce((e,i)=>e+i.quantity,0);return u-m}calculateQuantityLimits(){var e;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),r=1===(null===(e=Object.values(o.items))||void 0===e?void 0:e.length),c=i.quantity,l=this.getAvailableQuantity(),d=l>0,u=!(r&&1===c);return{currentQuantity:c,availableQuantity:l,isTheOnlyItem:r,canIncrease:d,canDecrease:u}}updateButtonStates(e){this.decreaseButton&&(this.decreaseButton.disabled=!e.canDecrease,this.decreaseButton.classList.toggle("disabled",!e.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!e.canIncrease,this.increaseButton.classList.toggle("disabled",!e.canIncrease),e.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const i=this.calculateQuantityLimits(),o=this.params.itemId;if((!(e<0)||i.canDecrease)&&(!(e>0)||i.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:e}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,e)}catch(r){this.logger.error("Checkout item quantity change operation failed",r)}}}template(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const i=this.calculateQuantityLimits(),o=document.createElement("div");o.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 e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.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 e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(i);const r=document.createElement("span");if(r.classList.add("checkout-item-price-text"),r.textContent=formatCentToDollarText(e.price),e.quantity>1){const i=document.createElement("span");i.classList.add("checkout-item-price-each-text"),i.textContent=" ("+formatCentToDollarText(e.unitPrice)+" ea)",r.appendChild(i)}return[o,r]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(e){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:e})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const e=this.getStoreValue("checkout.items")||{},i=new Map;for(const o of Object.values(e))o&&o.cartItemId&&i.set(o.cartItemId,o);return i}syncItemsWithStore(){const e=this.getItemsListContainer();if(!e)return;const i=this.getCurrentItemsMap(),o=e.querySelectorAll("[data-item-id]"),r=new Set;for(const c of o){const e=c.getAttribute("data-item-id");e&&r.add(e)}for(const c of o){const e=c.getAttribute("data-item-id");e&&!i.has(e)&&c.remove()}for(const[c]of i)if(!r.has(c)){const i=this.createItemElement(c);i.setAttribute("data-item-id",c),e.appendChild(i)}this.updateItemCount()}updateItemCount(){const e=this.getTogglerLabel();if(!e)return;const i=this.getCurrentItemsMap(),o=i.size;e.textContent=o+" item"+(1!==o?"s":"")}onStoreChanged(e){let i;for(let o=0;o<e.length;o++){const r=e[o];if("checkout"===r.path||"checkout.items"===r.path||"checkout.items."===r.path.substring(0,15)){i=r;break}}return i?(this.syncItemsWithStore(),![]):![]}handleToggle(){const e=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".checkout-items-list");if(e&&i){const o=i.classList.contains("show");i.classList.toggle("show"),e.classList.toggle("expanded"),o?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand checkout items")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const e=this.container.querySelector(".checkout-items-toggler"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");if(e&&i&&o){const r=o.classList.contains("show");i.setAttribute("tabindex","0"),i.setAttribute("aria-expanded",r?"true":"false"),i.setAttribute("aria-label",r?"Collapse checkout items":"Expand checkout items"),e.addEventListener("click",()=>this.handleToggle()),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.items"),i=Object.values(e||{}),o=document.createElement("div");o.classList.add("checkout-items-toggler");const r=document.createElement("span");r.classList.add("checkout-items-toggler-label"),r.textContent=i.length+" item"+(1!==i.length?"s":""),o.appendChild(r);const c=document.createElement("button");c.type="button",c.classList.add("checkout-items-toggler-button"),c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(c);const l=document.createElement("div");l.classList.add("checkout-items-list","show");for(const d of i){const e=this.createItemElement(d.cartItemId);e.setAttribute("data-item-id",d.cartItemId),l.appendChild(e)}return[o,l]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(e){const i=e.some(e=>"checkout.isFormValid"===e.path||"checkout.invalidFields"===e.path||"checkout.stripeFormStatus"===e.path||"checkout.stripeFormStatus."===e.path.substring(0,26)||"checkout.readyForSubmit"===e.path||"checkout.readyForSubmit."===e.path.substring(0,23)||"checkout.loading"===e.path||"checkout.error"===e.path);i&&this.updateButtonState();const o=e.find(e=>"checkout.readyForSubmit"===e.path);return o&&this.handleCheckoutReadyForSubmit(o.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.isFormValid")||![],i=this.store.get("checkout.invalidFields")||[],o=this.store.get("checkout.stripeFormStatus")||{},r=this.store.get("checkout.loading")||![],c=this.store.get("checkout.error")||null,l=o.isComplete||![],d=o.hasError||![],u=o.isProcessing||![],h=o.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(c,h));const p=this.determineButtonState({isFormValid:e,invalidFieldsCount:i.length,isPaymentComplete:l,hasPaymentError:d,isStripeProcessing:u,isCheckoutLoading:r,hasCheckoutError:!!c});this.applyButtonState(p)}determineErrorMessage(e,i){return e&&i?i:i||e}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const i=this.errorContainer.querySelector(".error-text");i&&(this.clearErrorTimeout(),e?(i.textContent=e,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const e=this.store.get("checkout.stripeFormStatus");(null==e?void 0:e.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(i.textContent="",this.errorContainer.style.display="none"))}determineButtonState(e){const{isFormValid:i,invalidFieldsCount:o,isPaymentComplete:r,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:d,hasCheckoutError:u}=e,h=this.config.layout.placeOrderButtonText,p=this.config.layout.placeOrderButtonShowRequiredFields,m=i&&r&&!c&&!l&&!u,f=this.store.get("checkout.readyForSubmit.payment")||![],v=this.store.get("checkout.readyForSubmit.prepared")||![],y=this.store.get("checkout.payment.sendSubmitSignal")||![],b=this.store.get("checkout.isPresaleLocked")||![];let x=![];if(!b){const e=this.getStoreValue("cart.fulfillments")||{};x=Object.values(e).some(e=>hasUnmetMinimum(e))}const w=l||d||y;if(d&&!l&&!y)return{state:"processing",text:h,disabled:!![]};if(x)return{state:"disabled",text:h,disabled:!![]};if(w)return f&&v?{state:"processing",text:"Placing Order...",disabled:!![]}:f&&!v?{state:"processing",text:"Preparing Order...",disabled:!![]}:v&&!f&&(l||y)||y||l?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!i){const e=o>0?" ("+o+")":"";return{state:"form-invalid",text:p?"Complete Required Fields"+e:h,disabled:![]}}return r?c?{state:"payment-error",text:h,disabled:![]}:m?{state:"ready",text:h,disabled:![]}:{state:"disabled",text:h,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(e){if(!this.placeOrderButton)return;const i=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...i),this.placeOrderButton.classList.add(e.state),this.placeOrderButton.disabled=e.disabled,this.placeOrderButton.textContent=e.text}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const e=this.store.get("checkout.isFormValid")||![],i=this.store.get("checkout.stripeFormStatus")||{},o=this.store.get("checkout.loading")||![],r=i.isComplete||![],c=i.hasError||![],l=i.isProcessing||![];if(l||o)return;if(!e)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!r||c)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(e){this.logger.error("Error handling place order click",e)}}showPaymentError(){const e=document.querySelector(".checkout-stripe-form");e&&safeScrollIntoView(e,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(e){if(!e)return;const{payment:i,prepared:o,customer:r,gift:c,billing:l}=e,d=i&&o&&r&&l&&c;d&&await this.commands.checkout.checkoutComplete()}template(){const e=document.createElement("button");e.type="button",e.textContent=this.config.layout.placeOrderButtonText,e.classList.add("checkout-place-order-button"),e.disabled=!![],e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label","Place Order"),e.addEventListener("click",this.handlePlaceOrderClick.bind(this)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePlaceOrderClick())});const i=document.createElement("div");i.classList.add("checkout-payment-error-wrapper"),i.setAttribute("role","alert"),i.style.display="none";const o=document.createElement("div");o.classList.add("checkout-payment-error");const c=document.createElement("span");c.classList.add("icon-error"),c.innerHTML=ErrorInfoIcon({});const l=document.createElement("span");l.classList.add("error-text"),o.appendChild(c),o.appendChild(l),i.appendChild(o);const d=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,d,e]}}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"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),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 e=[],i=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const l=document.createElement("div");l.classList.add("checkout-completed-title-section");const d=document.createElement("p");d.classList.add("presale-expired-title"),d.textContent="Session Expired",l.appendChild(d);const u=document.createElement("p");u.textContent="Your reservation time has ended. The item has been released for other customers.",l.appendChild(u),c.appendChild(l),o.appendChild(c);const h=document.createElement("div");h.classList.add("checkout-completed-help-section"),h.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(h),e.push(o);const p=document.createElement("div");p.classList.add("checkout-completed-section-container");const m=document.createElement("button");m.setAttribute("aria-label","Continue shopping"),m.type="button";const f=document.createElement("span");f.textContent="Continue Shopping",m.setAttribute("tabindex","0"),m.setAttribute("role","button"),m.setAttribute("aria-label","Continue Shopping"),m.appendChild(f);const v=htmlStringToElement(ArrowRightIcon({width:16,height:16}));m.appendChild(v),m.addEventListener("click",()=>this.handleExit()),m.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleExit())}),p.appendChild(m),e.push(p);const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("p");b.classList.add("checkout-completed-auto-close-text"),b.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 x=document.createElement("span");if(x.classList.add("checkout-completed-auto-close-text"),x.textContent="seconds",y.appendChild(b),y.appendChild(this.autoCloseElement),y.appendChild(x),e.push(y),i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});i.appendChild(o),e.push(i)}return e}}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(e){const i=e.find(e=>"checkout.promoCode"===e.path),o=e.find(e=>"checkout.loading"===e.path);if(i){const{value:e,oldValue:o}=i,r=Boolean(o),c=Boolean(e);if(!r&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(r&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;c&&this.promoCodeText&&e.discountAmount!==(null==o?void 0:o.discountAmount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),i=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.promoCode"),c=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||o||Boolean(r)||Boolean(c)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),o=this.promoInput;o.setValue(i),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 s=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(i){this.logger.error("Checkout promo code application failed",{promoCode:e,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",s),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())}),this.applyButton}createAppliedContainer(e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const e=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),i}const i=[];return i.push(this.createPromoInput()),i.push(this.createApplyButton()),i}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const e=this.getStoreValue("checkout.tipSelection");return null!=e?e:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(e){const i=this.getStoreValue("checkout.updating")||![];if(!i)try{await this.commands.checkout.updateTips(e)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(e,i){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const r=this.getOnDemandFulfillmentTipInfo();if(!r[e])return;const c=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(e,c)}catch(l){this.logger.error("Checkout fulfillment tip update failed",l)}}async removeTipFromFulfillment(e){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const o=this.getOnDemandFulfillmentTipInfo();if(o[e])try{await this.commands.checkout.removeFulfillmentTip(e)}catch(r){this.logger.error("Checkout fulfillment tip removal failed",r)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const i=[10,18,20],o=this.getStoreValue("checkout.updating")||![],r=this.getTipSelection();for(const c of i){const i=document.createElement("button");i.type="button",i.textContent=c+"%",i.classList.add("checkout-tip-button"),i.disabled=o,r===c&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(c)),e.appendChild(i)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");e&&i&&o&&e.addEventListener("click",()=>{const e=o.classList.contains("show");o.classList.toggle("show"),e?(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand tips section")):(i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse tips section")),i.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const i=this.getFulfillmentTipInfoArray();if(0===i.length)return e;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const r=document.createElement("h3");r.textContent="View Tip Distribution",r.classList.add("checkout-sub-header"),o.appendChild(r);const c=document.createElement("button");c.type="button",c.classList.add("checkout-items-toggler-button"),c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(c),e.appendChild(o);const l=document.createElement("div");l.classList.add("retailers-tips-list","show");for(const d of i){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=d.retailerName,i.classList.add("checkout-sub-header"),e.appendChild(i);const o=document.createElement("div");o.classList.add("checkout-tip-fulfillment-input-wrapper");const r=document.createElement("div");r.classList.add("dollar-input-container");const c=document.createElement("span");c.classList.add("dollar-sign"),c.textContent="$";const u=document.createElement("input");let h;u.type="number",u.id="tip-input-"+d.fulfillmentId,u.name="tip-"+d.fulfillmentId,u.min="0",u.step="0.01",u.placeholder="0.00",u.classList.add("dollar-input"),u.value=d.tip>0?(d.tip/100).toFixed(2):"",u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("wheel",e=>{e.preventDefault()}),u.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),u.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),u.addEventListener("paste",e=>{e.preventDefault()}),u.addEventListener("contextmenu",e=>{e.preventDefault()}),u.addEventListener("input",e=>{const i=e.target;let o=i.value;if(Number.parseFloat(o)<0&&(i.value=Math.abs(Number.parseFloat(o)).toString(),o=i.value),o.includes(".")){const e=o.split(".");e.length>1&&e[1].length>2&&(i.value=e[0]+"."+e[1].substring(0,2))}}),u.addEventListener("input",e=>{const i=e.target,o=Number.parseFloat(i.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,o)},500)}),r.appendChild(c),r.appendChild(u),o.appendChild(r);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(d.fulfillmentId)),o.appendChild(p),e.appendChild(o),l.appendChild(e)}return e.appendChild(l),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),i=this.getFulfillmentTipInfoArray();if(e&&i.length>0){const e=i.some(e=>e.tip>0);if(e)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==e)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(r){this.logger.error("Default tip initialization failed during fallback",r),this.isInitialized=![]}}template(){const e=[],i=this.getFulfillmentTipInfoArray();if(0===i.length)return e;i.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const r=document.createElement("h3");r.classList.add("checkout-sub-header"),r.textContent="Add a tip",o.appendChild(r);const c=document.createElement("div");c.classList.add("checkout-tip-config-container");const l=this.createTipSelectionButtons();c.appendChild(l),o.appendChild(c);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",o.appendChild(d);const u=this.createTipDistribution();return e.push(o,u),e}}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(e){var i,o;const r=e.find(e=>"checkout.giftCardError"===e.path),c=e.find(e=>"checkout.promoCodeError"===e.path),l=e.find(e=>"checkout.giftCards"===e.path);if(l&&this.updateAppliedGiftCards(l.value),r){const e=this.container.querySelector(".input-gift-card-container");if(e){const o=e.nextElementSibling;if((null===(i=null==o?void 0:o.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),r.value){const i=this.createErrorElement(r.value);e.after(i)}const c=e.querySelector(".apply-button");c&&(c.disabled=Boolean(r.value))}}if(c){const e=this.container.querySelector(".input-promo-code-container");if(e){const i=e.nextElementSibling;if((null===(o=null==i?void 0:i.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),c.value){const i=this.createErrorElement(c.value);e.after(i)}const r=e.querySelector(".apply-button");r&&(r.disabled=Boolean(c.value))}}}updateAppliedGiftCards(e){const i=e&&e.length>0;if(!i)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="",e.forEach(e=>{const i=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(i)})}createAppliedGiftCardElement(e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),i.setAttribute("data-gift-card-code",e.code);const o=document.createElement("span");o.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",i.appendChild(o);const r=document.createElement("button");return r.type="button",r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),i.appendChild(r),i}pcInputContainer(){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return e}gcInputContainer(){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});return e}inputContainer(){var e;const i=this.getConfigs("checkout"),o=this.getConfigs("global"),r=i.layout.allowGiftCards,c=null===(e=null==o?void 0:o.layout)||void 0===e?void 0:e.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),u=this.gcInputContainer();c&&l.appendChild(d);const h=this.getStoreValue("checkout.promoCodeError");if(h){const e=this.createErrorElement(h);e.classList.add("promo-code-error-wrapper"),l.appendChild(e)}r&&l.appendChild(u);const p=this.getStoreValue("checkout.giftCardError");if(p){const e=this.createErrorElement(p);l.appendChild(e)}return l}createErrorElement(e){const i=document.createElement("div");i.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const r=document.createElement("p");return r.textContent=e.toString(),i.appendChild(o),i.appendChild(r),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),i.remove()},3e3),i}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const i=[];return i.push(this.inputContainer()),e&&e.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),e.forEach(e=>{const i=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(i)}),i.push(this.appliedGiftCardsContainer)),i}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:i,isSelected:o,fulfillmentStatus:r,selectedSizeAttributes:l}){var d,u,h,p,m;let f=0;const v=null==l?void 0:l.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=i===c.SHIPPING,x=i===c.ON_DEMAND;b&&(f=(null===(u=null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),x&&(f=(null===(h=null==e?void 0:e.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(e.retailerAddress,i);let C=null;i===c.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(C=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const S=i===c.ON_DEMAND&&r&&r.isClosed?"closed":"",E=document.createElement("div");E.className="popup-retailer-card "+(o?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",e.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",o?"true":"false");const _=i===c.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",_+" from "+e.retailerName+", "+formatCentToDollarText(null!==(p=e.price)&&void 0!==p?p:0));const D=document.createElement("div");D.className="row";const I=document.createElement("span");I.className="name",I.textContent=e.retailerName,D.appendChild(I);const A=document.createElement("span");A.className="price",A.textContent=formatCentToDollarText(null!==(m=e.price)&&void 0!==m?m:0),D.appendChild(A),E.appendChild(D);const z=document.createElement("div");z.className="row";const O=document.createElement("span");O.className="expectation",O.textContent=r.isClosed?C:(null==v?void 0:v.isActive)?y:(null==e?void 0:e.expectation.detail)||"No expectation available",z.appendChild(O);const N=document.createElement("span");if(N.className="fee",N.textContent=f>0?formatCentToDollarText(f):"Free Delivery",z.appendChild(N),E.appendChild(z),x){const e=document.createElement("div");e.className="row";const i=document.createElement("span");i.className="address",i.textContent=w,e.appendChild(i),E.appendChild(e)}return E}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:i,shippingSelected:o,onDemandSelected:r,onTabClick:l,enableShippingFulfillment:d,enableOnDemandFulfillment:u}){const h=i.length>0,p=document.createElement("div");if(p.className="fulfillment-tabs-container",p.setAttribute("role","tablist"),p.setAttribute("aria-label","Delivery method options"),d){const i=document.createElement("div");i.className="fulfillment-tab "+(o?"selected":""),i.setAttribute("data-fulfillment-type",c.SHIPPING),i.setAttribute("role","tab"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected",o?"true":"false"),i.setAttribute("aria-label","Shipping, "+e.length+" options"),i.addEventListener("click",l),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(o?"selected":""),r.textContent="Shipping ("+e.length+")",i.appendChild(r),p.appendChild(i)}if(u){const e=document.createElement("div");e.className="fulfillment-tab "+(r?"selected":"")+" "+(h?"":"disabled"),e.setAttribute("data-fulfillment-type",c.ON_DEMAND),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",r?"true":"false"),e.setAttribute("aria-label","Same-day delivery, "+i.length+" options"),h||e.setAttribute("aria-disabled","true"),e.addEventListener("click",l),e.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(r?"selected":""),o.textContent="Same-Day Delivery ("+i.length+")",e.appendChild(o),p.appendChild(e)}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 e;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment||!o.selectedSizeId)return 0;const r=o.selectedFulfillment.partNumber,c=o.selectedFulfillment.fulfillmentId,l=null===(e=o.sizes[o.selectedSizeId].attributes)||void 0===e?void 0:e.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(e=>e.partNumber===r&&e.fulfillmentId===c),h=u.reduce((e,i)=>e+i.quantity,0);return l-h}isFulfillmentClosed(){const e=this.getProductId(),i=this.getStoreValue("products."+e);if(!i.selectedFulfillment)return![];const o=getRetailerOffHours(i.selectedFulfillment);return i.selectedFulfillmentType===c.ON_DEMAND&&o&&o.isClosed}isButtonLoading(){const e=this.getProductId();return this.getStoreValue("products."+e+".updating")}calculateQuantityLimits(){const{quantity:e}=this.calculateTotalPrice(),i=this.getAvailableQuantity(),o=e<i;return{currentQuantity:e,availableQuantity:i,canIncrease:o,canDecrease:e>1}}async handleAddToCart(){var e,i,o;const r=this.getProductId(),c=this.getStoreValue("products."+r);if(!c.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:r,selectedSizeId:c.selectedSizeId}),void 0;const l=this.getSizeAttributes(),d=(null===(e=null==l?void 0:l.presale)||void 0===e?void 0:e.isActive)===!![],u=this.isPresaleActive(l);d&&u?await this.commands.product.addPresaleToCart(r,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(i=c.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:c.quantity,identifier:r}):await this.commands.product.addToCart(r,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(o=c.selectedFulfillment)||void 0===o?void 0:o.partNumber,quantity:c.quantity,identifier:r})}async handleQuantityChange(e){const i=this.getProductId();await this.commands.product.updateQuantity(i,e)}calculateTotalPrice(){const e=this.getProductId(),i=this.getStoreValue("products."+e),o=i.selectedFulfillment,r=o.price*i.quantity;return{quantity:i.quantity,totalPrice:r}}createQuantityContainer(e){const i=this.calculateQuantityLimits(),o=document.createElement("div");return o.className="quantity-container "+e,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!i.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!i.canDecrease).toString()),i.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=i.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+i.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!i.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!i.canIncrease).toString()),i.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(1)}),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantityText),o.appendChild(this.qtyIncreaseButton),o}getSizeAttributes(){const e=this.getProductId(),i=this.getStoreValue("products."+e+".selectedSizeId"),o=this.getStoreValue("products."+e+".sizes."+i);return(null==o?void 0:o.attributes)||{}}isPresaleActive(e){const i=null==e?void 0:e.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const e=new Date(i.canPurchaseOn),o=new Date;if(o.getTime()<e.getTime())return![]}return!![]}createAddToCartButton(){var e;const{totalPrice:i}=this.calculateTotalPrice(),o=this.getSizeAttributes(),r=this.calculateQuantityLimits(),c=(null===(e=null==o?void 0:o.presale)||void 0===e?void 0:e.isActive)===!![],l=this.isPresaleActive(o),d=c?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?d+" - "+formatCentToDollarText(i):d;const u=c&&!l||0===r.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),p=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(i):d;return this.addToCartButton.setAttribute("aria-label",p),this.addToCartButton.setAttribute("aria-busy",h.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),h&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async e=>{if(e.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 e=this.getProductId(),i=this.getStoreValue("products."+e+".fulfillmentHasAvailability"),o=this.getConfigs("configurations");if(!i||!o.isElementsEnabled)return[];const r=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer(this.config.layout.quantityCounterStyle);r.push(e)}const c=this.createAddToCartButton();return r.push(c),r}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const e=this.params.productId,i=this.getStoreValue("products."+e+".description"),o=this.getStoreValue("products."+e+".htmlDescription"),r="About this product:",c="See More",l="See Less",d=document.createElement("h3");d.className="title",d.textContent=r;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==o?void 0:o.trim())?i:sanitizeHTML(o);const h=document.createElement("span");h.className="collapse-button",h.textContent=c,h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label","Show more product information"),h.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),h.textContent=this.isCollapsed?c:l,h.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),h.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return h.addEventListener("click",toggleContent),h.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),toggleContent())}),[d,u,h]}}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(e){var i;const o=e.find(e=>e.path==="products."+this.getProductId()+".drawer");if(!o)return![];const r=o.value,c=r.isOpen,l=null===(i=r.contentConfig)||void 0===i?void 0:i.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(r),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(r),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){const i=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!e)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:i}),void 0;const{type:o,data:r}=e||{},c=ComponentFactoryService.createElement({type:o,...r});this.contentContainer&&this.contentContainer.appendChild(c),this.open()}catch(o){this.logger.error("Failed to open product drawer",o),this.commands.product.closeProductDrawer(i)}}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 e=document.createElement("div");return e.classList.add("product-drawer-content"),this.contentContainer=e,e}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const e=this.config.layout.fulfillmentDisplay;return["product-image-carousel",e]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),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(e){const i=this.params.productId,o=e.find(e=>e.path==="products."+i+".mainImage");if(null==o?void 0:o.value){const e=this.params.images.indexOf(null==o?void 0:o.value);-1!==e?this.selectImage(e):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+o.value+"')")}}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 i=0;i<this.thumbnails.length;i++){const e=this.thumbnails[i];e.addEventListener("click",()=>{this.hasMoved||this.selectImage(i)})}const e=this.container.querySelectorAll(".carousel-dot");for(let i=0;i<e.length;i++){const o=e[i];o.addEventListener("click",()=>this.selectImage(i))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(e){var i,o;if(e<0||e>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[e]+"')",this.mainImageElement.title="Product image "+(e+1)),null===(i=this.thumbnails[this.currentImageIndex])||void 0===i||i.classList.remove("selected"),null===(o=this.thumbnails[e])||void 0===o||o.classList.add("selected");const r=this.container.querySelectorAll(".carousel-dot");for(let c=0;c<r.length;c++){const i=r[c];i.classList.toggle("active",c===e)}this.currentImageIndex=e,this.galleryViewport&&this.scrollToIndex(e)}scrollToIndex(e){if(!this.galleryViewport||!this.thumbnails[e])return;const i=this.thumbnails[e],o=this.galleryViewport.offsetWidth,r=i.offsetLeft+i.offsetWidth/2,c=o/2,l=c-r,d=0,u=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupMainImageSwipe(){var e,i;let o=0,r=0;null===(e=this.mainImageElement)||void 0===e?void 0:e.addEventListener("touchstart",e=>{o=e.touches[0].clientX,r=e.touches[0].clientY},{passive:!![]}),null===(i=this.mainImageElement)||void 0===i||i.addEventListener("touchend",e=>{const i=e.changedTouches[0].clientX-o,c=e.changedTouches[0].clientY-r;Math.abs(i)>Math.abs(c)&&Math.abs(i)>50&&(i>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 e of this.galleryContainer.querySelectorAll("img"))e.addEventListener("dragstart",e=>e.preventDefault())}}handleDragStart(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===e.type&&e.preventDefault();const i="touches"in e?e.touches[0].clientX:e.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const r=this.currentTranslateX+o,c=0,l=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,r)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.galleryContainer&&(this.galleryContainer.style.transition=e?"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 e=[],i=this.params.images.length>1,o=document.createElement("div");if(o.className="main-image",o.title="Product main image",o.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",i){const e=document.createElement("div");e.className="carousel-dots";for(let i=0;i<this.params.images.length;i++){const o=document.createElement("button");o.type="button",o.className="carousel-dot "+(0===i?"active":""),o.setAttribute("data-index",i.toString()),e.appendChild(o)}o.appendChild(e)}this.mainImageElement=o,e.push(o);const r=document.createElement("div");r.className="gallery-viewport";const c=document.createElement("div");c.className="gallery-container";for(let l=0;l<this.params.images.length;l++){const e=this.params.images[l],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===l?"selected":"");const o=document.createElement("img");o.src=e,o.className="gallery-image",o.alt="Product thumbnail "+(l+1),o.loading="lazy",i.appendChild(o),c.appendChild(i)}return r.appendChild(c),e.push(r),e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(e){var i,o,r,l;const d=this.getProductId();if(!e.some(e=>e.path==="products."+d+".selectedFulfillmentType"))return;const u=this.getStoreValue("products."+d),h=u.sizes[u.selectedSizeId],p=this.getConfigs("global");this.addPersonalizationSpan&&(u.selectedFulfillmentType===c.SHIPPING&&p.layout.enablePersonalization&&u.productHasAvailability&&(null===(o=null===(i=null==h?void 0:h.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.status)===!![]&&(null===(r=null==u?void 0:u.selectedFulfillment)||void 0===r?void 0:r.isVariantEngravable)===!![]&&(null===(l=null==u?void 0:u.selectedFulfillment)||void 0===l?void 0:l.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const e=this.getProductId(),i=this.container.querySelectorAll("[select-size]");for(const o of i){const r=o.textContent||"",c=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+r),o.setAttribute("aria-pressed",c?"true":"false"),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var r,c,l,d;const u=o.dataset.sizeId;if(!u)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:e,buttonElement:o.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(e,u);for(const e of i)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const h=this.getStoreValue("products."+e),p=h.sizes[u],m=this.getConfigs("global");this.addPersonalizationSpan&&(m.layout.enablePersonalization&&(null===(c=null===(r=null==p?void 0:p.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.status)===!![]&&h.productHasAvailability&&(null===(l=h.selectedFulfillment)||void 0===l?void 0:l.isVariantEngravable)===!![]&&(null===(d=h.selectedFulfillment)||void 0===d?void 0:d.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(e,i){const o=document.createElement("div");o.className="size-container";const r=document.createElement("h3");r.className="size-label",r.textContent="Size",r.id="size-label",o.appendChild(r);const c=document.createElement("div");c.className="size-buttons-container",c.setAttribute("role","group"),c.setAttribute("aria-labelledby","size-label");for(const l of Object.values(i)){const i=document.createElement("span");i.setAttribute("data-size-id",l.id),i.setAttribute("select-size",""),i.className="size-button "+(l.id===e?"selected":"");const o=l.packDesc?" ("+l.packDesc+")":"";i.textContent=""+l.size+o,c.appendChild(i)}return o.appendChild(c),o}hasIndependentAddressComponent(){var e;return(null===(e=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===e?void 0:e.length)>0}template(){var e,i,o,c,l;const d=this.getProductId(),u=this.getStoreValue("products."+d),h=u.sizes[u.selectedSizeId],p=this.getConfigs("global"),m=[],f=document.createElement("div");f.className="price-personalization-container";const v=ComponentFactoryService.createElement({type:r.PRODUCT_PRICE,productId:d});if(f.appendChild(v),p.layout.enablePersonalization&&u.productHasAvailability&&(null===(i=null===(e=null==h?void 0:h.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.status)===!![]&&(null===(o=null==u?void 0:u.selectedFulfillment)||void 0===o?void 0:o.canEngrave)===!![]&&(null===(c=null==u?void 0:u.selectedFulfillment)||void 0===c?void 0:c.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var e,i,o,c,l,h,p,m;const f=u.sizes[u.selectedSizeId];await this.commands.product.openProductDrawer(d,r.ENGRAVING_FORM,{identifier:d,context:"product",lines:[],maxLines:(null===(i=null===(e=f.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.maxLines)||1,maxCharsPerLine:(null===(c=null===(o=f.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,fee:(null===(h=null===(l=f.attributes)||void 0===l?void 0:l.engraving)||void 0===h?void 0:h.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 e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await addPersonalization())}),f.appendChild(this.addPersonalizationSpan)}m.push(f);const y=this.renderProductSizes(u.selectedSizeId,u.sizes);if(m.push(y),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,productId:d});m.push(e)}const b=ComponentFactoryService.createElement({type:r.PRODUCT_RETAILERS,productId:d});m.push(b);const x=ComponentFactoryService.createElement({type:r.PRODUCT_ADD_TO_CART_SECTION,productId:d});m.push(x);const w=null===(l=null==h?void 0:h.attributes)||void 0===l?void 0:l.presale;if((null==w?void 0:w.isActive)===!![]&&(null==w?void 0:w.language)){const e=document.createElement("div");e.className="product-presale-notice",e.innerHTML=sanitizeHTML((null==w?void 0:w.language)||""),m.push(e)}if(this.config.layout.showDescription){const e=ComponentFactoryService.createElement({type:r.PRODUCT_DESCRIPTION,productId:d});m.push(e)}return m}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:o,showQuantityCounter:r,fulfillmentDisplay:c,showImages:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const u=document.createElement("div");if(u.classList.add("skeleton-container"),i){const e=document.createElement("div");e.classList.add("wave","sc-title"),u.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),u.appendChild(e),u}const h=document.createElement("div");h.classList.add("wave","sc-price"),u.appendChild(h);const p=document.createElement("div");p.classList.add("sc-sizes");const m=document.createElement("div");m.classList.add("wave","sc-size-button"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),p.appendChild(f);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),p.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),p.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),p.appendChild(b),u.appendChild(p);const x=document.createElement("div");x.classList.add("sc-row");const w=document.createElement("div");w.classList.add("wave","sc-price"),x.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-personalization"),x.appendChild(C),u.appendChild(x);const S=document.createElement("div");S.classList.add("wave","sc-deliver-to"),u.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-address"),u.appendChild(E);const _=document.createElement("div");_.classList.add("wave","sc-retailers",c),u.appendChild(_);const D=document.createElement("div");if(D.classList.add("sc-row"),r){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),D.appendChild(e)}const I=document.createElement("div");if(I.classList.add("wave","sc-add-to-cart"),D.appendChild(I),u.appendChild(D),o){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),u.appendChild(e);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),u.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),u.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),u.appendChild(r);const c=document.createElement("div");c.classList.add("wave","sc-description-more"),u.appendChild(c)}const A=document.createElement("div");if(A.classList.add("product-content"),A.appendChild(u),d.appendChild(A),l){d.classList.add("has-images");const e=this.createImageSkeletons();d.prepend(e)}return d}createImageSkeletons(){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const i=document.createElement("div");i.classList.add("wave","sc-main-image"),i.title="Product main image loading";const o=document.createElement("div");o.classList.add("carousel-dots");for(let l=0;l<3;l++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),o.appendChild(e)}i.appendChild(o),e.appendChild(i);const r=document.createElement("div");r.classList.add("gallery-viewport");const c=document.createElement("div");c.classList.add("gallery-container");for(let l=0;l<4;l++){const e=document.createElement("div");e.classList.add("gallery-image-wrapper");const i=document.createElement("div");i.classList.add("wave","sc-gallery-thumbnail"),e.appendChild(i),c.appendChild(e)}return r.appendChild(c),e.appendChild(r),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(e){const i=this.getProductId(),o=e.find(e=>e.path==="products."+i+".drawer.isOpen");if(o){const e=o.value===!![];e&&this.addHostClasses("hide-content"),e||this.removeHostClasses("hide-content")}}template(){const e=this.getProductId(),i=this.getStoreValue("address.formattedAddress");if(i)return ComponentFactoryService.createElement({type:r.PRODUCT_INTERACTIONS,productId:this.getProductId()});const o=document.createElement("button");return o.type="button",o.className="product-options-open-address-button",o.textContent=this.config.layout.buyNowButtonText,o.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,r.ADDRESS_INPUT,{productId:e})}),o}}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(){var e;const i=this.getProductId(),o=this.getStoreValue("products."+i);let r=(null===(e=o.priceInfo)||void 0===e?void 0:e.avg)||0;return o.selectedFulfillment&&(r=o.selectedFulfillment.price),formatCentToDollarText(r)}}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 e=this.getProductId(),i=this.getStoreValue("products."+e),o=this.getConfigs("product"),c=[],l=this.getConfigs("configurations");if(!i.productHasAvailability||!l.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),c.push(e),c}const d="carousel"===o.layout.fulfillmentDisplay?r.PRODUCT_RETAILERS_CAROUSEL:r.PRODUCT_RETAILERS_POPUP,u=ComponentFactoryService.createElement({type:d,productId:e});return c.push(u),c}}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 e=this.retailerCards.findIndex(e=>e.classList.contains("selected"));-1!==e&&this.scrollToIndex(e)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(e){const i=this.getProductId(),o=e.find(e=>e.path==="products."+i+".selectedFulfillmentId");(null==o?void 0:o.value)&&this.updateSelectedCard(o.value)}updateSelectedCard(e){for(const o of this.retailerCards)o.classList.remove("selected"),o.setAttribute("aria-pressed","false");const i=this.retailerCards.findIndex(i=>i.dataset.fulfillmentId===e);-1!==i&&(this.retailerCards[i].classList.add("selected"),this.retailerCards[i].setAttribute("aria-pressed","true"),this.scrollToIndex(i))}scrollToIndex(e){if(!this.listViewport||!this.retailerCards[e])return;const i=this.retailerCards[e],o=this.listViewport.offsetWidth,r=i.offsetLeft+i.offsetWidth/2,c=o/2,l=c-r,d=0,u=-(this.listContainer.scrollWidth-o);this.translateX=Math.max(u,Math.min(d,l)),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(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.listViewport)return;"touchmove"===e.type&&e.preventDefault();const i="touches"in e?e.touches[0].clientX:e.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const r=this.currentTranslateX+o,c=0,l=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,r)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.listContainer&&(this.listContainer.style.transition=e?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(e){const i=this.getProductId(),o=e.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(e){if(this.hasMoved)return;const i=this.getProductId(),o=e.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const r=this.getStoreValue("products."+i+".selectedFulfillment");if(r&&r.fulfillmentId===o)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:i,fulfillmentId:o}),void 0;await this.commands.product.selectFulfillment(i,o)}generateRetailerCard({fulfillment:e,selectedFulfillmentType:i,isSelected:o,fulfillmentStatus:r,selectedSizeAttributes:l}){var d,u,h,p,m;let f=0;const v=null==l?void 0:l.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=i===c.SHIPPING,x=i===c.ON_DEMAND;b&&(f=(null===(u=null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),x&&(f=(null===(h=null==e?void 0:e.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(e.retailerAddress,i);let C=null;i===c.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(C=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const S=i===c.ON_DEMAND&&r&&r.isClosed?"closed":"",E=document.createElement("div");E.className="carousel-retailer-card "+(o?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",e.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",o?"true":"false");const _=i===c.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",_+" from "+e.retailerName+", "+formatCentToDollarText(null!==(p=e.price)&&void 0!==p?p:0));const D=document.createElement("div");D.className="retailer-header";const I=document.createElement("h3");if(I.className="name",I.textContent=e.retailerName,D.appendChild(I),x){const e=document.createElement("h3");e.className="address",e.textContent=w,D.appendChild(e)}const A=document.createElement("div");A.className="retailer-body";const z=document.createElement("span");z.className="product-price",z.textContent=formatCentToDollarText(null!==(m=e.price)&&void 0!==m?m:0);const O=document.createElement("span");O.className="shipping-price",O.textContent=f>0?"+ "+formatCentToDollarText(f):"FREE Delivery";const N=document.createElement("span");return N.className="expectation",N.textContent=r.isClosed?C:(null==v?void 0:v.isActive)?y:(null==e?void 0:e.expectation.detail)||"No expectation available",A.append(z,O,N),E.append(D,A),E}template(){const e=this.getProductId(),i=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),r=(null==o?void 0:o.attributes)||null,l=[];for(const c in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)&&l.push(o.shippingFulfillments[c]);const d=[];for(const c in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)&&d.push(o.onDemandFulfillments[c]);const u=i.selectedFulfillmentType===c.SHIPPING,h=i.selectedFulfillmentType===c.ON_DEMAND,p=u?l:d,m=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===p.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,e]}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 e=getRetailerOffHours(f),o=this.generateRetailerCard({fulfillment:f,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:f.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:r}),l=i.selectedFulfillmentType===c.ON_DEMAND&&e&&e.isClosed;l?o.setAttribute("aria-disabled","true"):(o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())})),this.listContainer.appendChild(o)}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 e=this.getProductId(),i=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),l=(null==o?void 0:o.attributes)||null,d=this.config.layout.enableShippingFulfillment,u=this.config.layout.enableOnDemandFulfillment,h=Object.values(o.shippingFulfillments),p=Object.values(o.onDemandFulfillments),m=(d?h.length:0)+(u?p.length:0),f=document.createElement("div");f.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=i.selectedFulfillmentType===c.SHIPPING?"Shipping From:":"Delivering From:";const y=document.createElement("button");if(y.className="delivery-options",y.type="button",y.textContent="See Delivery Options ("+m+")",y.setAttribute("aria-label","View all "+m+" delivery options"),y.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,r.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),f.appendChild(v),f.appendChild(y),!i.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,e]}const b=document.createElement("div");b.className="popup-fulfillment-list-container";const x=getRetailerOffHours(i.selectedFulfillment),w=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],fulfillmentStatus:x,selectedSizeAttributes:l});return b.appendChild(w),[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(e){const i=this.getProductId(),o=e.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(e){const i=this.getProductId(),o=e.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const F=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(i),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},r=this.getStoreValue("products."+i+".selectedFulfillment");if(r&&r.fulfillmentId===o)return await F(),void 0;await this.commands.product.selectFulfillment(i,o),await F()}template(){const e=this.getProductId(),i=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),r=(null==o?void 0:o.attributes)||null,l=[];for(const c in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)&&l.push(o.shippingFulfillments[c]);const d=[];for(const c in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)&&d.push(o.onDemandFulfillments[c]);const u=i.selectedFulfillmentType===c.SHIPPING,h=i.selectedFulfillmentType===c.ON_DEMAND,p=u?l:d,m=document.createElement("h5");m.className="popup-retailers-section-title",m.textContent="Delivery Options";const f=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===p.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,f,e]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const c of p){const e=getRetailerOffHours(c),o=renderPopupRetailerCard({fulfillment:c,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:c.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:r});o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())}),v.appendChild(o)}return[m,f,v]}}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(e){const i=this.getProductId(),o=e.find(e=>e.path==="products."+i+".drawer.isOpen"),r=e.find(e=>e.path==="products."+i+".rerender");o&&this.titleElement&&this.titleElement.classList.toggle("hide",o.value),(null==r?void 0:r.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var e;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(o.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:r.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});const c=o.sizes[o.selectedSizeId],l=document.createElement("div");l.classList.add("product-content-wrapper"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+o.name);const d=document.createElement("div");if(d.classList.add("product-content"),d.setAttribute("role","region"),d.setAttribute("aria-label",""+o.name),this.config.layout.showTitle){const e=document.createElement("h1");e.classList.add("product-title"),e.textContent=o.name,this.titleElement=e,d.appendChild(e)}const u=ComponentFactoryService.createElement({type:r.PRODUCT_OPTIONS,productId:i});d.appendChild(u);const h=ComponentFactoryService.createElement({type:r.PRODUCT_DRAWER,productId:i});if(d.appendChild(h),l.appendChild(d),!this.config.layout.showImages||!(null===(e=o.images)||void 0===e?void 0:e.length))return l;l.classList.add("has-images");const p=ComponentFactoryService.createElement({type:r.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:c.image,productId:i});return l.prepend(p),p.setAttribute("aria-label","Product images"),l}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var e,i,o;const r=this.params.product,c=this.getStoreValue("address.address"),l={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==c?void 0:c.state)||"",isPresale:![],isPresaleActive:![]},d=r.sizes[0];if(!d)return l;const u=d.variants[0];if(!u)return l;l.upc=d.upc;const h=d.attributes||{};l.isPresale=(null===(e=h.presale)||void 0===e?void 0:e.isActive)===!![],l.isPresaleActive=this.isPresaleActive(h);for(const p of this.params.fulfillments){const e=u.fulfillments.some(e=>e===p.id);if(e){const e="shipping"===p.type&&(null===(i=u.fulfillmentTypes)||void 0===i?void 0:i.shipping)||"onDemand"===p.type&&(null===(o=u.fulfillmentTypes)||void 0===o?void 0:o.onDemand);if(e&&u.stock>0){l.hasAvailability=!![],l.fulfillmentId=p.id,l.partNumber=u.partNumber;break}}}return l}isPresaleActive(e){const i=null==e?void 0:e.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const e=new Date(i.canPurchaseOn),o=new Date;if(o.getTime()<e.getTime())return![]}return!![]}async handleAddToCart(e){if(!e.hasAvailability)return;const i=this.params.product.salsifyGrouping||this.params.product.id||"";e.isPresale&&e.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,identifier:i}):await this.commands.productList.addToCart({upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,identifier:i})}template(){var e,i,o,r;const c=this.params.product,l=c.sizes[0],d=l?l.image:c.images[0],u=c.name,h=l?l.size:null,p=null!==(o=null===(i=null===(e=null==l?void 0:l.variants)||void 0===e?void 0:e[0])||void 0===i?void 0:i.price)&&void 0!==o?o:(null===(r=c.priceInfo)||void 0===r?void 0:r.average)||0,m=this.getAvailabilityData();return this.createVariantStandard({image:d,name:u,size:h,price:p,availability:m})}generateProductUrl(){var e;if(!this.params.productUrl)return null;const i=this.params.product,o=null===(e=i.sizes)||void 0===e?void 0:e[0],r=this.params.productUrl;if(r.includes("{upc}")){const e=(null==o?void 0:o.upc)||"";return e?r.replace("{upc}",e):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(r.includes("{grouping}")){const e=i.salsifyGrouping||"";return e?r.replace("{grouping}",e):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(e){const{image:i,name:o,size:r,price:c,availability:l}=e,d=[],u=this.generateProductUrl(),h=document.createElement("div");h.className="plc__image-content";const p=document.createElement("div");p.className="plc__image-wrapper";const m=document.createElement("img");if(m.className="plc__image",m.src=i,m.alt=o,m.loading="lazy",p.appendChild(m),h.appendChild(p),u){const e=document.createElement("a");e.href=u,e.className="plc__image-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),e.appendChild(h),d.push(e)}else d.push(h);const f=document.createElement("div");f.className="plc__content";const v=document.createElement("h3");if(v.className="plc__title",v.textContent=o,u){const e=document.createElement("a");e.href=u,e.className="plc__title-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),e.appendChild(v),f.appendChild(e)}else f.appendChild(v);const y=document.createElement("div");y.className="plc__size-price-wrapper";const b=document.createElement("div");b.className="plc__price",b.textContent=formatCentToDollarText(c),y.appendChild(b);const x=document.createElement("div");x.className="plc__size",x.textContent=r||"",y.appendChild(x),f.appendChild(y),d.push(f);const w=document.createElement("button");return w.type="button",w.className="plc__button",w.disabled=!l.hasAvailability,l.hasAvailability?w.textContent="Add to Cart":(w.textContent="Not Available In "+l.state.toUpperCase(),this.addHostClasses("not-available")),w.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleAddToCart(l)}),d.push(w),d}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(e){const i=document.createElement("div");i.classList.add("slc__card");const o=document.createElement("div");o.className="slc__image-content";const r=document.createElement("div");r.className="slc__image-wrapper";const c=document.createElement("div");c.classList.add("wave","slc__image"),r.appendChild(c),o.appendChild(r);const l=document.createElement("div");l.className="slc__content";const d=document.createElement("div");d.className="slc__title-container";const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-1"),d.appendChild(u);const h=document.createElement("div");h.classList.add("wave","slc__title","slc__title-line-2"),d.appendChild(h),l.appendChild(d);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),l.appendChild(p);const v=document.createElement("div");return v.classList.add("wave","slc__button"),i.appendChild(o),i.appendChild(l),i.appendChild(v),i}template(){const e=[],i=100/this.params.columns;this.container.style.setProperty("--card-width",i+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const o=this.params.rows*this.params.columns;for(let r=0;r<o;r++){const i=this.createSkeletonCard(r);e.push(i)}return e}}class ProductListFiltersComponent extends BaseComponent{get hostClasses(){return["product-list-filters-container"]}isSameDayDeliveryDisabled(){var e,i;return!(!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.personalized)&&!(null===(i=this.params.currentFilters)||void 0===i?void 0:i.preOrder))}isPersonalizationDisabled(){var e;return"onDemand"===(null===(e=this.params.currentFilters)||void 0===e?void 0:e.deliveryOptions)}isPreOrderDisabled(){var e;return"onDemand"===(null===(e=this.params.currentFilters)||void 0===e?void 0:e.deliveryOptions)}template(){var e,i,o;const r=[],c=document.createElement("div");c.className="product-list-filters-header";const l=document.createElement("h3");if(l.className="product-list-filters-title",l.textContent="Filters",c.appendChild(l),r.push(c),this.params.enablePersonalized){const i=document.createElement("div");i.className="product-list-filters-personalized";const o=document.createElement("label");o.className="product-list-filters-personalized-label",o.setAttribute("for","personalized-switch"),o.textContent="Personalized Bottles",i.appendChild(o);const c=document.createElement("input");if(c.type="checkbox",c.id="personalized-switch",c.className="product-list-filters-personalized-switch",c.disabled=this.isPersonalizationDisabled(),c.checked=(null===(e=this.params.currentFilters)||void 0===e?void 0:e.personalized)||![],c.addEventListener("change",e=>{var i,o;const r=e.target;null===(o=(i=this.params).onPersonalizedChange)||void 0===o?void 0:o.call(i,r.checked)}),i.appendChild(c),this.isPersonalizationDisabled()){const e=document.createElement("div");e.className="product-list-filters-warning",e.textContent="(Not Available With Same-Day Delivery)",i.appendChild(e)}r.push(i)}if(this.params.enablePreOrder){const e=document.createElement("div");e.className="product-list-filters-pre-order";const o=document.createElement("label");o.className="product-list-filters-pre-order-label",o.setAttribute("for","pre-order-switch"),o.textContent="Pre-Order",e.appendChild(o);const c=document.createElement("input");if(c.type="checkbox",c.id="pre-order-switch",c.className="product-list-filters-pre-order-switch",c.disabled=this.isPreOrderDisabled(),c.checked=(null===(i=this.params.currentFilters)||void 0===i?void 0:i.preOrder)||![],c.addEventListener("change",e=>{var i,o;const r=e.target;null===(o=(i=this.params).onPreOrderChange)||void 0===o?void 0:o.call(i,r.checked)}),e.appendChild(c),this.isPreOrderDisabled()){const i=document.createElement("div");i.className="product-list-filters-warning",i.textContent="(Not Available With Same-Day Delivery)",e.appendChild(i)}r.push(e)}if(this.params.enableDeliveryOptions){const e=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],i=document.createElement("div");i.className="product-list-filters-delivery-options";const c=document.createElement("div");c.className="product-list-filters-delivery-options-header";const l=document.createElement("h3");l.className="product-list-filters-delivery-options-label",l.textContent="Delivery Options",c.appendChild(l),i.appendChild(c);const d=document.createElement("div");d.className="product-list-filters-delivery-options-list";for(const r of e){const e=document.createElement("div");e.className="product-list-filters-delivery-option";const i=document.createElement("input");i.type="radio",i.id="delivery-"+r.value,i.name="delivery-options",i.value=r.value,i.className="product-list-filters-delivery-radio";const c="onDemand"===r.value&&this.isSameDayDeliveryDisabled();i.disabled=c,i.checked=r.value===((null===(o=this.params.currentFilters)||void 0===o?void 0:o.deliveryOptions)||"all"),i.addEventListener("change",e=>{var i,o;const r=e.target;null===(o=(i=this.params).onDeliveryOptionsChange)||void 0===o?void 0:o.call(i,r.value)});const l=document.createElement("label");l.htmlFor="delivery-"+r.value,l.className="product-list-filters-delivery-radio-label "+(c?"disabled":""),l.textContent=r.label,e.appendChild(i),e.appendChild(l),d.appendChild(e)}i.appendChild(d),r.push(i)}return r}}var wt;(function(e){e.IDLE="idle",e.LOADING_INITIAL="loading_initial",e.LOADING_MORE="loading_more",e.ERROR="error"})(wt||(wt={}));class ProductListComponent extends BaseComponent{get hostClasses(){const e=["product-list"];return this.params.filters.length>0&&e.push("has-filters"),e}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all"},this.cardsContainer=null,this.filtersContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=wt.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(wt.IDLE)}catch(G){this.logger.error("Error initializing product list:",G),this.setLoadingState(wt.ERROR),this.showErrorState("Failed to load products")}}template(){const e=[];return this.params.filters.length>0&&e.push(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),e.push(this.cardsContainer),this.renderCurrentState(),e}setLoadingState(e){const i=this.loadingState;this.loadingState=e,this.logger.debug("Loading state changed: "+i+" → "+e),this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case wt.LOADING_INITIAL:this.renderLoadingState();break;case wt.ERROR:break;case wt.IDLE:case wt.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var e;try{const i=this.buildApiParams(0),o=await this.commands.productList.getProductList(i);this.products=o.products||[],this.retailers=o.retailers||[],this.updatePagination(o.navigation),this.syncFiltersFromResponse((null===(e=o.navigation)||void 0===e?void 0:e.filters)||[])}catch(i){throw this.logger.error("Error loading initial products:",i),this.products=[],this.retailers=[],this.pagination.hasMorePages=![],i}}async loadMoreProducts(){if(this.loadingState!==wt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(wt.LOADING_MORE);const e=this.pagination.currentPage+1,i=this.buildApiParams(e),o=await this.commands.productList.getProductList(i);o.products&&o.products.length>0?(this.products.push(...o.products),this.mergeRetailers(o.retailers||[]),this.updatePagination(o.navigation),this.appendNewProducts(o.products)):(this.pagination.hasMorePages=![],this.updatePagination(o.navigation)),this.setLoadingState(wt.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(wt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(e){const i=new Map(this.retailers.map(e=>[e.id,e]));for(const o of e)i.has(o.id)||(this.retailers.push(o),i.set(o.id,o))}updatePagination(e){var i,o,r,c;e&&(this.pagination={currentPage:null!==(i=e.currentPage)&&void 0!==i?i:0,totalPages:null!==(o=e.totalPages)&&void 0!==o?o:0,hasMorePages:(null!==(r=e.currentPage)&&void 0!==r?r:0)<(null!==(c=e.totalPages)&&void 0!==c?c:1)-1})}buildApiParams(e){return{page:e,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()}}buildFiltersFromState(){const e=[{key:"availability",values:"IN_STOCK"}];return this.currentFilters.personalized&&e.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&e.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&e.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),e}syncFiltersFromResponse(e){if(e)for(const i of e)switch(i.key){case"engraving":this.currentFilters.personalized="YES"===i.values;break;case"presale":this.currentFilters.preOrder="YES"===i.values;break;case"fulfillment":Array.isArray(i.values)&&(i.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":i.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(wt.IDLE)}catch(G){this.logger.error("Error handling filter change:",G),this.setLoadingState(wt.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(e=>{const i="onDemand"===e.value&&this.isSameDayDeliveryDisabled();e.disabled=i,i&&"onDemand"===e.value||(e.checked=e.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(e,i)})}updateRadioLabel(e,i){const o=this.deliveryRadioLabels.get(e.id);o&&(o.className="product-list-filters-delivery-radio-label "+(i?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const e=document.createElement("div");e.className="product-list-cards__container";const i=100/this.params.columns;return e.style.setProperty("--card-width",i+"%"),e.style.setProperty("--columns",""+this.params.columns),e}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const e=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(e)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const e=this.createInfoElement("No products found");return this.cardsContainer.appendChild(e),void 0}for(const e of this.products){const i=this.createProductCard(e);i&&this.cardsContainer.appendChild(i)}}}appendNewProducts(e){if(this.cardsContainer&&0!==e.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const i of e){const e=this.createProductCard(i);e&&this.cardsContainer.appendChild(e)}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(e){var i;try{const o=null===(i=e.sizes)||void 0===i?void 0:i[0];if(!o)return this.logger.warn("Product "+e.id+" has no sizes"),null;const c=new Map(this.retailers.flatMap(e=>e.fulfillments.map(e=>[e.id,e]))),l=new Set(o.variants.flatMap(e=>e.fulfillments)),d=Array.from(l).map(e=>c.get(e)).filter(e=>Boolean(e));return ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:e,fulfillments:d,productUrl:this.params.productUrl})}catch(o){return this.logger.error("Error creating product card for product "+e.id+":",o),null}}createFiltersContainer(){return this.filtersContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_FILTERS,enablePersonalized:this.params.filters.includes(h.PERSONALIZATION),enablePreOrder:this.params.filters.includes(h.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(h.DELIVERY_OPTIONS),currentFilters:this.currentFilters,onPersonalizedChange:async e=>{this.currentFilters.personalized=e,await this.onFilterChange()},onPreOrderChange:async e=>{this.currentFilters.preOrder=e,await this.onFilterChange()},onDeliveryOptionsChange:async e=>{this.currentFilters.deliveryOptions=e,"onDemand"===e&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),await this.onFilterChange()}}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const e=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(e),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(e=>{var i;const o=null===(i=this.filtersContainer)||void 0===i?void 0:i.querySelector('label[for="'+e.id+'"]');o&&this.deliveryRadioLabels.set(e.id,o)})}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(e=>{const i=e[0];i.isIntersecting&&this.loadingState===wt.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const e=document.createElement("div");return e.className="product-list-scroll-sentinel",this.updateSentinelContent(e),e}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(e){let i;e.innerHTML="",i=this.loadingState===wt.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),e.appendChild(i)}showSentinelError(e){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const i=this.createErrorElement(e);this.sentinelElement.appendChild(i)}createLoadingElement(e){const i=document.createElement("div");i.className="product-list-sentinel-container";const o=document.createElement("div");o.className="product-list-sentinel-spinner";const r=document.createElement("div");return r.className="product-list-sentinel-text",r.textContent=e,i.appendChild(o),i.appendChild(r),i}createErrorElement(e){const i=document.createElement("div");i.className="product-list-sentinel-error-container";const o=document.createElement("div");o.className="product-list-sentinel-error-icon",o.innerHTML="⚠";const r=document.createElement("div");return r.className="product-list-sentinel-error-text",r.textContent=e,i.appendChild(o),i.appendChild(r),i}createInfoElement(e,i=![]){const o=document.createElement("div");if(o.className="product-list-sentinel-info-container",!i&&e.includes("Scroll")){const e=document.createElement("div");e.className="product-list-sentinel-icon",e.innerHTML="↓",o.appendChild(e)}else if(i){const e=document.createElement("div");e.className="product-list-sentinel-divider",o.appendChild(e)}const r=document.createElement("div");return r.className=i?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",r.textContent=e,o.appendChild(r),o}showErrorState(e){if(!this.cardsContainer)return;this.clearCardsContainer();const i=this.createErrorElement(e);this.cardsContainer.appendChild(i)}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)}async onStoreWatch(e){const i=e.find(e=>"address"===e.path);if(i&&void 0!==i.value&&this.cardsContainer){this.logger.debug("Address changed in store, reloading products to get updated availability");try{this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(o){this.logger.error("Error reloading products after address change:",o),this.setLoadingState(wt.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers=[],this.cardsContainer=null,this.filtersContainer=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}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(e){e.length>0&&this.updateAlert()}getErrorMessages(){var e,i;const o=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],r=null!==(i=this.params.showFirstEvent)&&void 0!==i?i:!![];if(o){const e=this.store.get(this.params.errorStorePath)||[],i=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return r?i.slice(0,1):i}const c=this.store.get(this.params.errorStorePath);return c?[{message:c,level:"error"}]:[]}createErrorElement(e){const i=document.createElement("div");i.classList.add("alert-container","alert-"+e.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const r=document.createElement("span");return r.classList.add("alert-text"),r.textContent=e.message,i.appendChild(o),i.appendChild(r),i}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},i)}hideAllErrors(){var e;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[];const i=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];i?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const e=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[],0===e.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=e.map(e=>this.createErrorElement(e)),this.elements.forEach(e=>{this.container.appendChild(e)}),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 e=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(r.CART)});const i=document.createElement("span");if(i.className="lce-cart-button-icon",i.innerHTML=BagIcon({color:e.theme.primaryColor}),this.params.showItemsCount){const e=document.createElement("span");return e.className="lce-cart-button-badge",e.style.visibility="hidden",[i,e]}return[i]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const e=this.container.querySelector(".lce-cart-button-badge");if(!e)return;const i=this.getStoreValue("cart.totals.quantity")||0;e.textContent=i.toString(),e.style.visibility=i>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const i=this.getStoreValue("cart.totals.quantity")||0;e.textContent=i.toString(),e.style.visibility=i>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(e){var i;const o=e.find(e=>"ui.drawer"===e.path);if(!o)return![];const r=o.value,c=r.isOpen,l=null===(i=r.contentConfig)||void 0===i?void 0:i.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(r),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(r),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){try{if(!e)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:i,data:o}=e||{};let r;r=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...o}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(r,i):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(r),this.updateDrawerContentTypeClass(i),this.open()),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Drawer content loading failed",i),this.commands.ui.closeDrawer()}}animateContentSwap(e,i){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const o=this.contentContainer.firstElementChild;o.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{o.classList.add("fading")}),setTimeout(()=>{o.remove(),e.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(e),this.updateDrawerContentTypeClass(i),requestAnimationFrame(()=>{e.classList.add("visible"),setTimeout(()=>{e.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(e){this.isOpen&&"Escape"===e.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(e){if(!this.drawerElement)return;const i=["drawer"];this.isOpen&&i.push("open"),i.push(e.toString().toLowerCase()),this.drawerElement.className=i.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 e;try{const i=this.themeProvider.getConfigs("configurations");return null!==(e=null==i?void 0:i.isElementsEnabled)&&void 0!==e?e:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}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}get hostClasses(){return["engraving-form"]}beforeConnected(){var e;if(this.engravingLines=this.params.lines,"product"===this.params.context){const i=this.store.get("products."+this.params.identifier);this.fulfillmentId=i.selectedFulfillmentId,this.partNumber=(null===(e=i.selectedFulfillment)||void 0===e?void 0:e.partNumber)||null}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=e.fulfillmentId,this.partNumber=e.partNumber}}calculateTotalPrice(){var e,i;if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier),r=o.sizes[o.selectedSizeId],c=r.shippingFulfillments[this.fulfillmentId],l=c.price,d=(null===(i=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.fee)||0;return l+d}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier),i=e.unitPrice,o=e.attributes.engraving.fee||0;return i+o}return 0}productInformationSection(){const e=[];let i="",o="";if("product"===this.params.context){const r=this.store.get("products."+this.params.identifier);r.mainImage?e.push(r.mainImage):e.push(...r.images||[]),i=r.name,o=r.sizes[r.selectedSizeId].size}if("cart"===this.params.context){const r=this.store.get("cart.items."+this.params.identifier);r.mainImage&&e.push(r.mainImage),i=r.name,o=r.size}const r=document.createElement("div");if(r.className="product-info-section",e.length>0){const o=document.createElement("div");o.className="product-image-container";const c=document.createElement("img");c.src=e[0],c.alt=i,c.loading="lazy",c.className="product-image",o.appendChild(c),r.appendChild(o)}const c=document.createElement("div");c.className="product-details-container";const l=document.createElement("div");l.className="product-header";const d=document.createElement("h4");d.className="product-title",d.textContent=i,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),l.appendChild(d),l.appendChild(this.productPriceSpan),c.appendChild(l);const u=document.createElement("p");u.className="product-size-text",u.textContent=o,c.appendChild(u);const h=document.createElement("p");return h.className="engraving-fees-disclaimer",h.textContent="Personalization fees included in total, varies by retailer.",c.appendChild(h),r.appendChild(c),r}addToCartButtonText(e){if("product"!==this.params.context)return"Save";const i=this.getConfigs("product"),o=i.layout.addToCartButtonText;return i.layout.addToCartButtonShowTotalPrice?o+" - "+formatCentToDollarText(e):o}retailersSection(){var e,i,o,r,c,l,d;const u=this.store.get("products."+this.params.identifier),h=u.sizes[u.selectedSizeId],p=Object.values(h.shippingFulfillments).filter(e=>e.isVariantEngravable&&e.canEngrave),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===(e=u.selectedFulfillment)||void 0===e?void 0:e.retailerName)+"</b>",m.appendChild(f),1===p.length)return m;const v=document.createElement("div");v.className="fulfillment-options-container",m.appendChild(v);const y=document.createElement("span");y.className="see-more-fulfillments",y.textContent="See More Delivery Options ("+p.length+")",y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),y.setAttribute("aria-expanded","false");const a=()=>{const e=v.classList.contains("expanded");v.classList.toggle("expanded"),e?(y.textContent="See More Delivery Options ("+p.length+")",y.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),y.setAttribute("aria-expanded","false")):(y.textContent="See Less Delivery Options",y.setAttribute("aria-label","See Less Delivery Options"),y.setAttribute("aria-expanded","true"))};y.addEventListener("click",a),y.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())}),m.appendChild(y);for(const b of p){const e=document.createElement("div");e.className="fulfillment-option",e.setAttribute("data-fulfillment-id",b.fulfillmentId),b.fulfillmentId===(null===(i=u.selectedFulfillment)||void 0===i?void 0:i.fulfillmentId)&&e.classList.add("selected"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select delivery from "+b.retailerName+", "+formatCentToDollarText(b.price+((null===(r=null===(o=u.sizes[u.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.fee)||0))+", "+b.expectation.engraving),e.setAttribute("aria-pressed",b.fulfillmentId===(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.fulfillmentId)?"true":"false");const k=()=>{this.fulfillmentId=b.fulfillmentId,this.partNumber=b.partNumber;const i=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const o=v.querySelector(".fulfillment-option.selected");o&&(o.classList.remove("selected"),o.setAttribute("aria-pressed","false")),e.classList.add("selected"),e.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+b.retailerName+"</b>"};e.addEventListener("click",k),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k())});const h=b.price+((null===(d=null===(l=u.sizes[u.selectedSizeId].attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0),p=document.createElement("div");p.className="option-row row-1",e.appendChild(p);const m=document.createElement("span");m.className="retailer-name",m.textContent=b.retailerName,p.appendChild(m);const y=document.createElement("span");y.className="fulfillment-price",y.textContent=formatCentToDollarText(h),p.appendChild(y),e.appendChild(p);const x=document.createElement("div");x.className="option-row row-2",e.appendChild(x);const w=document.createElement("span");w.className="estimated-time",w.textContent=""+b.expectation.engraving,x.appendChild(w),e.appendChild(x),v.appendChild(e)}return m}engravingLinesSection(){var e;const{lines:i,maxLines:o,location:r,maxCharsPerLine:c}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent="Personalize Your Bottle",l.appendChild(d),r&&(null===(e=null==r?void 0:r.trim())||void 0===e?void 0:e.length)>0){const e=document.createElement("p");e.className="engraving-location-text",e.textContent="Your message will appear "+r.toLowerCase()+".",l.appendChild(e)}const u=Array.from({length:o},(e,o)=>{const r=o+1,l=document.createElement("div");l.className="engraving-input-wrapper",l.setAttribute("data-line-number",r.toString());const d=document.createElement("input");d.type="text",d.id="engraving-line-"+r,d.dataset.lineNumber=r.toString(),d.maxLength=c,d.value=i[o]||"",d.placeholder=r>1?"Line "+r+" (optional)":"Line "+r,d.className="engraving-input",d.autocomplete="off",d.setAttribute("aria-label",r>1?"Engraving line "+r+", optional, maximum "+c+" characters":"Engraving line "+r+", maximum "+c+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=d.value.length+"/"+c,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),d.addEventListener("input",()=>{u.textContent=d.value.length+"/"+c,this.engravingLines[o]=d.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),l.appendChild(d),l.appendChild(u),l}),h=document.createElement("div");return h.className="engraving-inputs-container",h.append(...u),l.appendChild(h),l}actionButtonsSection(){const{identifier:e,context:i}=this.params,o=document.createElement("div");o.className="action-buttons-container";const c=document.createElement("button");c.type="button",c.className="cancel-action-button",c.textContent="Cancel",c.setAttribute("aria-label","Cancel personalization and close");const L=async()=>{"product"===i&&await this.commands.product.closeProductDrawer(e),"cart"===i&&this.commands.ui.openDrawer(r.CART)};c.addEventListener("click",L),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),L())}),o.appendChild(c),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"===i?"Add personalized item to cart":"Update personalization and return to cart");const t=async()=>{const o=this.engravingLines.map(e=>e.trim().toUpperCase()).filter(e=>e&&e.length>0);if("product"===i&&this.fulfillmentId&&this.partNumber){const i=this.store.get("products."+e);await this.commands.product.addToCart(e,{upc:i.sizes[i.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:e}),await this.commands.product.closeProductDrawer(e)}"cart"===i&&(await this.commands.cart.updateItemEngraving(e,o),this.commands.ui.openDrawer(r.CART))};return this.addToCartButton.addEventListener("click",t),this.addToCartButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t())}),o.appendChild(this.addToCartButton),o}template(){const e=[],i=this.productInformationSection();if(e.push(i),"product"===this.params.context){const i=this.retailersSection();e.push(i)}const o=this.engravingLinesSection();e.push(o);const r=this.actionButtonsSection();e.push(r);const c=document.createElement("p");return c.className="engraving-disclaimer",c.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>",e.push(c),e}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const e=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+e),o=(null==i?void 0:i.attributes.engraving.fee)||0,r=(null==i?void 0:i.quantity)||1;return{quantity:r,fee:o,total:o*r}}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+e),o=(null==i?void 0:i.attributes.engraving.fee)||0,r=(null==i?void 0:i.quantity)||1;return{quantity:r,fee:o,total:o*r}}return{quantity:0,fee:0,total:0}}engravingLines(){const e=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+e);return(null==i?void 0:i.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+e);return(null==i?void 0:i.attributes.engraving.lines)||[]}return[]}handleEdit(){var e,i,o,c,l,d,u,h,p,m,f,v,y,b,x,w,C,S,E,_;const D=this.params.identifier,I={identifier:D,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+D);I.lines=(null===(i=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||[],I.maxLines=(null===(c=null===(o=null==r?void 0:r.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.maxLines)||1,I.maxCharsPerLine=(null===(d=null===(l=null==r?void 0:r.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxCharsPerLine)||16,I.fee=(null===(h=null===(u=null==r?void 0:r.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.fee)||0,I.location=(null===(m=null===(p=null==r?void 0:r.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+D);I.lines=(null===(v=null===(f=null==e?void 0:e.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.lines)||[],I.maxLines=(null===(b=null===(y=null==e?void 0:e.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxLines)||1,I.maxCharsPerLine=(null===(w=null===(x=null==e?void 0:e.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.maxCharsPerLine)||16,I.fee=(null===(S=null===(C=null==e?void 0:e.attributes)||void 0===C?void 0:C.engraving)||void 0===S?void 0:S.fee)||0,I.location=(null===(_=null===(E=null==e?void 0:e.attributes)||void 0===E?void 0:E.engraving)||void 0===_?void 0:_.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,I)}async handleRemove(){const e=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}template(){const e=this.engravingQuantityFee(),i=this.engravingLines();if(0===i.length)return"";const o=document.createElement("div");o.className="engraving-header";const r=document.createElement("h3");r.textContent="Personalization";const c=document.createElement("span");if(c.className="engraving-fee",1===e.quantity&&(c.textContent=formatCentToDollarText(e.total,![])),e.quantity>1){c.textContent=formatCentToDollarText(e.total,![]);const i=document.createElement("span");i.className="engraving-fee-each",i.textContent=" ("+formatCentToDollarText(e.fee,![])+" ea)",c.appendChild(i)}o.appendChild(r),o.appendChild(c);const l=document.createElement("div");l.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const p of i){const e=document.createElement("span");e.className="engraving-line",e.textContent=p,d.appendChild(e)}const u=document.createElement("div");u.className="engraving-actions";const h=document.createElement("button");h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.setAttribute("aria-label","Remove engraving");const g=async()=>{await this.handleRemove()};if(h.addEventListener("click",g),h.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await g())}),u.appendChild(h),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.setAttribute("aria-label","Edit engraving"),e.addEventListener("click",this.handleEdit.bind(this)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEdit())}),u.appendChild(e)}return l.appendChild(d),l.appendChild(u),[o,l]}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["custom-input","birthdate",e.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(e){const i=e.find(e=>"checkout.focusField"===e.path);i&&i.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const e=this.params.value.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}}setupEventListeners(){this.monthInput.addEventListener("input",e=>{this.formatMonth(e),this.handleNavigation(e,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",e=>{this.formatDay(e),this.handleNavigation(e,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",e=>{this.formatYear(e),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const e of[this.monthInput,this.dayInput,this.yearInput])e.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",e=>{"Backspace"===e.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",e=>{"Backspace"===e.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(e){const i=e.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length&&Number.parseInt(o,10)>1)o="0"+o;else if(2===o.length){const e=Number.parseInt(o,10);e>12?o="12":e<1&&(o="01")}i.value=o}formatDay(e){const i=e.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length&&Number.parseInt(o,10)>3)o="0"+o;else if(2===o.length){const e=Number.parseInt(o,10);e>31?o="31":e<1&&(o="01")}i.value=o}formatYear(e){const i=e.target;let o=i.value.replace(/\D/g,"");o.length>4&&(o=o.substring(0,4)),i.value=o}handleNavigation(e,i){const o=e.target,r=o===this.yearInput?4:2;o.value.length===r&&i&&i.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const e=this.getFormattedValue();this.params.onChange(e)}}getFormattedValue(){const e=this.monthInput.value.padStart(2,"0"),i=this.dayInput.value.padStart(2,"0"),o=this.yearInput.value;return e&&i&&o&&4===o.length?o+"-"+e+"-"+i:""}validateDate(e,i,o){if(!e||!i||!o||4!==o.length)return![];const r=Number.parseInt(e,10),c=Number.parseInt(i,10),l=Number.parseInt(o,10);if(r<1||r>12||c<1||c>31||l<1e3)return![];const d=new Date(l,r-1,c);return d.getFullYear()===l&&d.getMonth()===r-1&&d.getDate()===c}calculateAge(e){const i=new Date;let o=i.getFullYear()-e.getFullYear();const r=i.getMonth()-e.getMonth();return(r<0||0===r&&i.getDate()<e.getDate())&&o--,o}validateInput(){const e=this.monthInput.value,i=this.dayInput.value,o=this.yearInput.value,r=[],c=this.params.validation;if(!c)return this.showErrors([]),!![];const l=e&&i&&o&&4===o.length,d=e||i||o;if(c.required&&!d||d&&!l)r.push("Please enter a complete date (MM/DD/YYYY)");else if(l)if(this.validateDate(e,i,o)){const l=Number.parseInt(e,10),d=Number.parseInt(i,10),u=Number.parseInt(o,10),h=new Date(u,l-1,d);if(void 0!==c.minYear&&u<c.minYear&&r.push("Year must be "+c.minYear+" or later"),void 0!==c.maxYear&&u>c.maxYear&&r.push("Year must be "+c.maxYear+" or earlier"),void 0!==c.minAge||void 0!==c.maxAge){const e=this.calculateAge(h);void 0!==c.minAge&&e<c.minAge&&r.push("Must be at least "+c.minAge+" years old"),void 0!==c.maxAge&&e>c.maxAge&&r.push("Must be no more than "+c.maxAge+" years old")}if(c.customValidator){const e=c.customValidator(this.getFormattedValue());e&&r.push(e)}}else r.push("Please enter a valid date");this.showErrors(r);const u=0===r.length;return this.params.onValidation&&this.params.onValidation(u,r),u}showErrors(e){this.errorContainer.innerHTML="";const i=[this.monthInput,this.dayInput,this.yearInput];if(e.length>0){this.errorContainer.classList.add("show");for(const e of i)e.classList.add("input-error");for(const i of e){const e=document.createElement("div");e.className="error-message",e.textContent=i,this.errorContainer.appendChild(e)}}else for(const o of i)o.classList.remove("input-error")}clearErrors(){const e=[this.monthInput,this.dayInput,this.yearInput],i=e.some(e=>e.classList.contains("input-error"));if(i){for(const i of e)i.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(e){if(e){const i=e.split("/");3===i.length&&(this.monthInput.value=i[0],this.dayInput.value=i[1],this.yearInput.value=i[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var e;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name+"-month"),i.push(o)}const o=document.createElement("div");o.className="date-input-container";const r=document.createElement("input");r.type="text",r.placeholder="MM",r.name=this.params.name+"-month",r.id=this.params.name+"-month",r.maxLength=2,r.className="date-field month-field",r.setAttribute("data-field","month"),r.inputMode="numeric";const c=document.createElement("span");c.className="date-separator",c.textContent="/";const l=document.createElement("input");l.type="text",l.placeholder="DD",l.name=this.params.name+"-day",l.id=this.params.name+"-day",l.maxLength=2,l.className="date-field day-field",l.setAttribute("data-field","day"),l.inputMode="numeric";const d=document.createElement("span");d.className="date-separator",d.textContent="/";const u=document.createElement("input");u.type="text",u.placeholder="YYYY",u.name=this.params.name+"-year",u.id=this.params.name+"-year",u.maxLength=4,u.className="date-field year-field",u.setAttribute("data-field","year"),u.inputMode="numeric",this.params.disabled&&(r.disabled=!![],l.disabled=!![],u.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(r),o.appendChild(c),o.appendChild(l),o.appendChild(d),o.appendChild(u);const h=document.createElement("div");return h.className="error-container",i.push(o),i.push(h),i}}class InputComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["custom-input",e.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(e){const i=e.find(e=>"checkout.focusField"===e.path);return i&&i.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(e){if("Backspace"===e.key){const i=e.target,o=i.selectionStart||0,r=i.value;o>0&&/\D/.test(r[o-1])&&setTimeout(()=>{const e=Math.max(0,o-2);i.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const i=e.target;let o=i.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),i.value=o}formatDate(e){const i=e.target;let o=i.value.replace(/\D/g,"");o.length>8&&(o=o.substring(0,8)),o.length>=5?o=o.substring(0,2)+"/"+o.substring(2,4)+"/"+o.substring(4):o.length>=3&&(o=o.substring(0,2)+"/"+o.substring(2)),i.value=o}validateEmail(e){const i=/^[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 i.test(e)}validateTel(e){const i=/^\(\d{3}\) \d{3}-\d{4}$/;return i.test(e)}validateDate(e){const i=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!i.test(e))return![];const[o,r,c]=e.split("/").map(Number),l=new Date(c,o-1,r);return l.getFullYear()===c&&l.getMonth()===o-1&&l.getDate()===r}validateInput(){const e=this.inputElement.value,i=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!e.trim()&&i.push("This field is required"),e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||i.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||i.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(e)||i.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const r=Number.parseFloat(e);Number.isNaN(r)?e.trim()&&i.push("Please enter a valid number"):(void 0!==o.min&&r<o.min&&i.push("Value must be at least "+o.min),void 0!==o.max&&r>o.max&&i.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&e.length<o.min&&i.push("Must be at least "+o.min+" characters"),void 0!==o.max&&e.length>o.max&&i.push("Must be no more than "+o.max+" characters")),o.pattern){const r=new RegExp(o.pattern);r.test(e)||i.push("Invalid format")}if(o.customValidator){const r=o.customValidator(e);r&&i.push(r)}}this.showErrors(i);const r=0===i.length;return this.params.onValidation&&this.params.onValidation(r,i),r}showErrors(e){if(this.errorContainer.innerHTML="",e.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const i of e){const e=document.createElement("div");e.className="error-message",e.textContent=i,this.errorContainer.appendChild(e)}}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(e){this.inputElement.value=e,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===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 e;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),i.push(o)}return this.inputElement=document.createElement("input"),this.inputElement.type=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&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",e=>{this.clearErrors(),this.params.onChange&&this.params.onChange(e.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",i.push(this.inputElement),i.push(this.errorContainer),i}}class LceElementComponent extends HTMLElement{constructor(){super(),this.F=![],this.q=null,this.j=this.attachShadow({mode:"closed"})}initialize(e,i){if(this.F)return;if(!e||"string"!=typeof e)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(i&&i instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.j)throw new SDKError("LceElementComponent: Shadow DOM container is not available");i&&"function"==typeof i.rerender&&(this.q=e=>{i.rerender(e||"LceElementRerender")}),this.j.appendChild(i),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),r=o.getStylesheet(e);this.applyThemeStyles(r),this.F=!![],this.j=null}rerender(e){this.q&&this.q(e)}applyBasicStyles(){const e="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\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 i=new CSSStyleSheet;i.replaceSync(e),this.j.adoptedStyleSheets=[i,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(G){this.createFallbackStylesheet(e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}applyThemeStyles(e){e.forEach(e=>{"string"==typeof e?this.createFallbackStylesheet(e):this.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const i=document.createElement("style");i.textContent=e,this.j&&this.j.appendChild(i)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const e=document.createElement("div");e.className="pb-title-container";const i=document.createElement("span");i.className="pb-text",i.textContent="Powered by",e.appendChild(i);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",e.appendChild(o);const r=document.createElement("span");return r.className="pb-dot",r.textContent=".",e.appendChild(r),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const i=this.getDisclaimerConfig();return i.parts.forEach(i=>{"text"===i.type?e.appendChild(document.createTextNode(i.content)):"link"===i.type&&e.appendChild(this.createLink(i.href,i.text))}),e}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(e,i){const o=document.createElement("a");return o.href=e,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=i,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+i),o}template(){const e=this.createPoweredBySection(),i=this.createDisclaimerSection();return[e,i]}}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(e){const i=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!i||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const i=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==i?void 0:i.code)===e||(null==o?void 0:o.code)===e}getActiveTickers(){var e;const i=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var o;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(o=null==i?void 0:i.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const i=document.createElement("div");i.classList.add("promo-ticker__text-group");const o=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const r of o){const o=r.trim();if(!o)continue;const c=document.createElement("span");c.classList.add("promo-ticker__text-item"),c.textContent=o,i.appendChild(c);const l=document.createElement("span");l.classList.add("promo-ticker__separator"),l.textContent=e.separator,i.appendChild(l)}return i}async handlePromoClick(){var e;(null===(e=this.currentActiveTicker)||void 0===e?void 0:e.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 e=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(e),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const i=document.createElement("div");i.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let c=0;c<5;c++)o.appendChild(this.generateTextContent(this.currentActiveTicker));i.appendChild(o);const r=document.createElement("button");return r.type="button",r.classList.add("promo-ticker__cta"),r.textContent="APPLY",r.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(r.disabled=!![],r.textContent="APPLIED"),r.addEventListener("click",()=>this.handlePromoClick()),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePromoClick())}),this.applyButton=r,[i,r]}}const Ct=LoggerFactory.get("ElementsClientHelper"),isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),getType=e=>null===e?"null":Array.isArray(e)?"array":typeof e;function deepMergeConfigs(e,i){if(!e||!i)return e;const o={...e},r=[];for(const c in i){const l=i[c],d=o[c];if(!(c in e)){r.push('Property "'+c+'" does not exist in target schema, skipping merge.');continue}const u=getType(l),h=getType(d);u===h?isObject(l)&&isObject(d)?o[c]=deepMergeConfigs(d,l):o[c]=l:r.push('Type mismatch for key "'+c+'": source is '+u+", target is "+h+". Skipping merge.")}return r.length>0&&Ct.warn("Merging configurations with warnings:",r),o}const kt=new Map([["global.layout.enablePersonalization",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_INTERACTIONS,r.CART_ITEM,r.CHECKOUT_ITEM]],["global.layout.personalizationText",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.CART_ITEM]],["global.layout.personalizationCardStyle",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[r.CART,r.CART_PROMO_CODE,r.CART_FOOTER,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[r.CART,r.CHECKOUT,r.ADDRESS,r.INPUT,r.BIRTHDATE_INPUT,r.ADDRESS_INPUT,r.CHECKOUT_DELIVERY_INFORMATION_FORM,r.CHECKOUT_BUYER_INFORMATION_FORM,r.CHECKOUT_BILLING_FORM,r.CHECKOUT_PAYMENT_FORM,r.CART_PROMO_CODE]],["global.layout.showPoweredBy",[r.CART,r.CHECKOUT,r.CHECKOUT_COMPLETED,r.POWERED_BY,r.CART_FOOTER,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[r.POWERED_BY]],["product.layout.showImages",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[r.PRODUCT]],["product.layout.showDescription",[r.PRODUCT,r.PRODUCT_DESCRIPTION,r.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[r.PRODUCT,r.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[r.CART,r.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[r.CART,r.CART_FOOTER]],["checkout.layout.emailOptIn",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.smsOptIn",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.allowGiftCards",[r.CHECKOUT,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[r.CHECKOUT,r.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.placeOrderButtonShowRequiredFields",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[r.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(e,i){const o=new Set;for(const r of Object.keys(i)){const i=kt.get(e+"."+r);if(i)for(const e of i)o.add(e)}return Array.from(o)}class ElementsBaseClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],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.authService=AuthService.getInstance({apiKey:e.apiKey,env:e.env,baseUrl:e.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(e){throw this.logger.error("Failed to prepare client",e),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),e}}async prepareEssentialServices(){this.clientConfig.set("version",G.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.debug("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.debug("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.debug("📊 Telemetry initialized")),this.logger.debug("🔐 Starting authentication...");const e=await this.authService.authenticate();if(!e)throw this.clientPrepared=![],new SDKError("Unable to authenticate with the provided API key.",!![]);this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let i=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",i.configurations.partnerCode),this.clientConfig.set("partnerName",i.configurations.partnerName),this.logger.debug("🔍 Setting up fingerprinting and store...");const o=await this.fingerPrintService.getId(i.configurations.partnerCode),r=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",o),this.clientConfig.set("isLocalStorageAvailable",r);const c=r?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:r,persistedStore:c}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme"),o=i.global.layout.showPoweredBy;i=deepMergeConfigs(i,e),i.global.layout.showPoweredBy=o}await this.themeProvider.initialize(i),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(e){this.logger.error("Heavy initialization failed",e)}},0)}async initializeHeavyServices(){const e=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:e.partnerName,partnerGtmId:e.googleTagManagerId,partnerEnableGaTracking:e.enablePartnerGaTracking,liquidCommerceEnableGaTracking:e.enableLiquidCommerceGaTracking,liquidCommerceGtmId:e.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(i){this.logger.error("GTM initialization failed",i)}this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(e){if(this.ensureAllComponentsRegistered(),!e||"object"!=typeof e)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof e,!![]);const{type:i,containerId:o,...c}=e;if(!o||"string"!=typeof o)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof o?'"'+o+'"':o),!![]);if(!i)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const l=o.replace("#",""),d=document.getElementById(l);if(!d)return console.warn("Container with ID '"+l+"' not found"),null;d.innerHTML="";const u={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...c},h=ComponentFactoryService.createElement(u);return safeReplaceChildren(d,h),e.type===r.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(l,e.type,h)}async processInjectProduct(e){if(this.ensureAllComponentsRegistered(),0===e.length)throw new SDKError("At least one product is required. Received empty array.",!![]);e.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const i=e.slice(0,20),o=[],c=[];for(const r of i){if(!r||"object"!=typeof r){this.logger.warn("Invalid product parameter: must be an object");continue}if(!r.containerId||"string"!=typeof r.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+r.identifier+"'");continue}const e=r.containerId.replace("#","").trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+r.identifier+"'");continue}const i=document.getElementById(e);if(!i){this.logger.warn("Container with ID '"+e+"' not found for product '"+r.identifier+"'");continue}const c=o.every(i=>i.containerId!==e);if(!c){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!r.identifier||"string"!=typeof r.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+e+"'");continue}const l=o.every(e=>e.identifier!==r.identifier);l?o.push({containerId:e,identifier:r.identifier}):this.logger.warn("Duplicate product identifier '"+r.identifier+"' found, skipping")}for(const l of o){const e=ComponentFactoryService.createElement({type:r.PRODUCT,useShadowDom:!![],productId:l.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(l.containerId);i?(i.innerHTML="",i.appendChild(e),c.push(this.createInjectedComponentWrapper(l.containerId,r.PRODUCT,e)),await this.commands.product.createProductInstance(l.identifier,!![])):this.logger.warn("Product ("+l.identifier+") container with ID '"+l.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(o.map(e=>e.identifier)),c}async injectProductList(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e.containerId,r.CHECKOUT),void 0;if(!e)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);if(e.rows&&("number"!=typeof e.rows||e.rows<1||e.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+e.rows,!![]);if(e.columns&&("number"!=typeof e.columns||e.columns<1||e.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+e.columns,!![]);if(e.cardVariant&&!Object.values(u).includes(e.cardVariant))throw new SDKError('Invalid card variant "'+e.cardVariant+'". Valid options: '+Object.values(u).join(", "),!![]);if(e.filters&&!Array.isArray(e.filters))throw new SDKError("Filters must be an array. Received: "+typeof e.filters,!![]);if(e.filters&&e.filters.length>0){const i=Object.values(h);for(const o of e.filters)if(!i.includes(o))throw new SDKError('Invalid filter "'+o+'". Valid options: '+i.join(", "),!![])}if(e.productUrl&&"string"==typeof e.productUrl&&!e.productUrl.includes("{upc}")&&!e.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+e.productUrl+'"',!![]);const i=document.getElementById(e.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e.containerId+'". Make sure the element exists before adding the product list.',!![]);const o=ComponentFactoryService.createElement({type:r.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:e.cardVariant||u.STANDARD,fillCard:e.fillCard||![],rows:e.rows||4,columns:e.columns||4,filters:e.filters||[],productUrl:e.productUrl});safeReplaceChildren(i,o)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:r.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(e),this.cartDrawerCreated=!![]}catch(e){this.logger.warn("Failed to create cart drawer:",e)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(e,i,o){const r={getType:()=>i,getElement:()=>document.getElementById(e),rerender:()=>{try{o&&"function"==typeof o.rerender?o.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+e+"' does not support rerender")}catch(i){this.logger.warn("Failed to rerender component in container '"+e+"'")}}};return this.injectedComponents.set(e,r),r}rerenderInjectedComponentsByType(e){for(const[i,o]of this.injectedComponents)o.getType()===e&&o.rerender()}isElementsEnabled(){var e;try{const i=this.themeProvider.getConfigs("configurations");return null!==(e=null==i?void 0:i.isElementsEnabled)&&void 0!==e?e:![]}catch(i){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",i),!![]}}injectDisabledElementsError(e,i){const o=document.getElementById(e.replace("#",""));if(!o)return this.logger.warn("Container with ID '"+e+"' not found for disabled elements error"),void 0;let r;r=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),o.innerHTML="",safeReplaceChildren(o,r)}registerEssentialComponents(){ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(r.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(r.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,CartComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(r.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(r.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(r.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(r.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(r.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(r.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(r.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(e,i)=>{if(!e||"string"!=typeof e)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);this.ensureCartDrawerExists();const o=document.getElementById(e.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before adding the cart button.',!![]);const c=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});o.innerHTML="",safeReplaceChildren(o,c)},floatingCartButton:e=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(i)},cartSubtotal:e=>{if(!e||"string"!=typeof e)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const i=document.getElementById(e.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart subtotal.',!![]);i.innerHTML="",i.classList.add("lce-cart-subtotal");const n=e=>{i.textContent=formatCentToDollarText(e)},o=this.store.get("cart.totals.subtotal")||0;n(o),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.subtotal")||0;n(e)})},cartItemsCount:e=>{if(!e||"string"!=typeof e)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const i=document.getElementById(e.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart items count.',!![]);i.innerHTML="",i.classList.add("lce-cart-items-count");const n=e=>{i.textContent=e.toString(),0===e?(i.style.visibility="hidden",i.classList.add("no-items")):(i.style.visibility="visible",i.classList.remove("no-items"))},o=this.store.get("cart.totals.quantity")||0;n(o),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.quantity")||0;n(e)})}}}async injectProductElement(e){if(!Array.isArray(e))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof e,!![]);if(!this.isElementsEnabled()){for(const i of e)this.injectDisabledElementsError(i.containerId,r.PRODUCT);return[]}return await this.processInjectProduct(e)}async injectAddressElement(e,i){if(!e||"string"!=typeof e)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.ADDRESS,containerId:e,options:i}):(this.injectDisabledElementsError(e,r.ADDRESS),null)}async injectCartElement(e){if(!e||"string"!=typeof e)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.CART,containerId:e}):(this.injectDisabledElementsError(e,r.CART),null)}async injectCheckoutElement(e){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.CHECKOUT,containerId:e}):(this.injectDisabledElementsError(e,r.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(e,o){try{const r=ClientConfigService.getInstance();r.initialize(e,{env:o.env,isBuilder:![],debugMode:o.debugMode,customTheme:o.customTheme,proxy:o.proxy,promoTicker:o.promoTicker});const c=r.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const d={injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),injectProductList:l.injectProductList.bind(l),ui:l.ui,actions:l.actions,getInjectedComponents:l.getInjectedComponents.bind(l)};window.elements=d;const u=PubSubService.getInstance();return u.publishAction(i.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:r.get("version")}),d}catch(r){try{const e=LoggerFactory.get("ElementsClientInit");e.error("Elements Client Initialization failed",r)}catch(c){console.error("[LiquidCommerce Elements] Client initialization failed:",null==r?void 0:r.message)}try{const e=ClientConfigService.getInstance(),o=PubSubService.getInstance();o.publishAction(i.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(l){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(e){const i=[];try{const r=e.getAttributeNames().filter(e=>"data-product"===e.substring(0,12));for(const c of r)try{const o=c.match(/^data-product(-(.+))?$/),r=(null==o?void 0:o[2])?"-"+o[2]:"",l="data-container"+r;if(e.hasAttribute(l)){const o=e.getAttribute(l),r=e.getAttribute(c);o&&r&&i.push({containerId:o,identifier:r})}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",o)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",r)}return i}function pairsFromProductsScript(){const e=[];try{const o=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const r of o)try{const i=JSON.parse(r.textContent||"[]");if(!Array.isArray(i))continue;for(const o of i)o.containerId&&o.identifier&&e.push({containerId:o.containerId,identifier:o.identifier})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",o)}return e}function pairsFromAttributedElements(){const e=[];try{const o=document.querySelectorAll("div[data-lce-product]");for(const r of o)try{const i="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));r.setAttribute("id",i);const o=r.getAttribute("data-lce-product");i&&o&&e.push({containerId:i,identifier:o})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",o)}return e}function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}async function addProductToCartViaQueryParam(e,i){const o=i.getAttribute("data-product-param"),r=i.getAttribute("data-product-fulfillment-type-param");if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const l=new URLSearchParams(window.location.search),d=l.get(o);if(!d)return;let u=c.SHIPPING;if(r)if(startsWithLcePrefix(r)){const e=l.get(r);e!==c.ON_DEMAND&&e!==c.SHIPPING||(u=e)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await e.actions.cart.addProduct([{identifier:d,fulfillmentType:u,quantity:1}],!![])}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",h)}}async function addPromoCodeToCartViaQueryParam(e,i){const o=i.getAttribute("data-promo-code-param");if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),c=r.get(o);if(c)try{await e.actions.cart.applyPromoCode(c)}catch(l){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",l)}}async function setupCartButton(e,i){var o,r,c;const l=i.hasAttribute("data-cart-button-hidden");if(l)return;const d=i.getAttribute("data-cart-button"),u=i.getAttribute("data-cart-badge-button"),h=d||u,p=!!u;if(!h)return console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),e.ui.floatingCartButton(p),void 0;const m=h.match(/^(above|below|replace|inside):(.+)$/),f=m?m[1]:"inside";let v=m?m[2]:h;"#"!==v.substring(0,1)&&"."!==v.substring(0,1)&&-1===v.indexOf(" ")&&(v="#"+v);const y=document.querySelector(v);if(!y)return console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+v+'" not found. Using floating button.'),e.ui.floatingCartButton(p),void 0;const b=document.createElement("div");switch(b.classList.add("lce-cart-button-container"),b.id="lce-cart-button-"+Date.now(),f){case"above":null===(o=y.parentNode)||void 0===o?void 0:o.insertBefore(b,y);break;case"below":null===(r=y.parentNode)||void 0===r?void 0:r.insertBefore(b,y.nextSibling);break;case"replace":null===(c=y.parentNode)||void 0===c?void 0:c.replaceChild(b,y);break;default:y.appendChild(b)}e.ui.cartButton(b.id,p)}async function initializeProductsList(e){const i=document.querySelector("div[data-liquid-commerce-elements-products-list]");if(!i)return;const o="lce-products-list-container";i.className="lce-products-list-container",i.id=o;const r=i.getAttribute("data-card")||"standard",c=i.hasAttribute("data-card-fill"),l=Number.parseInt(i.getAttribute("data-rows")||"3",10)||3,d=Number.parseInt(i.getAttribute("data-columns")||"4",10)||4,u=i.getAttribute("data-filters"),h=i.getAttribute("data-product-url")||void 0;let p=[];u&&(p=u.split(",").map(e=>e.trim()).filter(e=>e.length>0)),await e.injectProductList({containerId:o,rows:l,columns:d,cardVariant:r,fillCard:c,filters:p,productUrl:h})}async function ElementsAutoInitialize(){var i,o,r,c,d,u;try{const u=document.querySelector("script[data-liquid-commerce-elements]");if(!u)return;const y=u.getAttribute("data-token"),b=u.getAttribute("data-env")||e.PRODUCTION,x=u.getAttribute("data-debug-mode");if(!y)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const w=u.getAttribute("data-promo-code"),C=u.getAttribute("data-promo-text"),S=null!==(i=u.getAttribute("data-promo-separator"))&&void 0!==i?i:"•",E=null!==(o=u.getAttribute("data-promo-active-from"))&&void 0!==o?o:void 0,_=null!==(r=u.getAttribute("data-promo-active-until"))&&void 0!==r?r:void 0,D=pairsFromMainScript(u),I=pairsFromProductsScript(),A=pairsFromAttributedElements(),z=[...D,...I,...A],O=w&&C&&E&&_?{promoCode:w,text:C.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:S,activeFrom:null===(c=new Date(E))||void 0===c?void 0:c.toISOString(),activeUntil:null===(d=new Date(_))||void 0===d?void 0:d.toISOString()}:void 0;let N=l.NONE;x&&b!==e.PRODUCTION&&(N=x);const M=await Elements(y,{env:b,debugMode:N,promoTicker:O?[O]:void 0});if(!M)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);if(0!==z.length)try{await M.injectProductElement(z)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",h)}try{await setupCartButton(M,u)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",p)}try{await initializeProductsList(M)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",m)}try{await addProductToCartViaQueryParam(M,u)}catch(f){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",f)}try{await addPromoCodeToCartViaQueryParam(M,u)}catch(v){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",v)}}catch(y){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(u=null==y?void 0:y.message)&&void 0!==u?u:String(y))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(G){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",G)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(G){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",G)}},50)}catch(G){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",G)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(e){try{if(!e)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(e),e.layout&&Object.keys(e.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("global.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(i){throw this.logger.error("❌ Failed to update global theme configuration",i),new SDKError("Failed to update global configuration: "+i.message,!![])}}async updateProductComponent(e){try{if(!e)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(e),e.layout&&Object.keys(e.layout).length>0){await this.commands.product.rerenderAllProducts();for(const i of getComponentTypesForLayoutFields("product.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(i){throw this.logger.error("❌ Failed to update product component theme",i),new SDKError("Failed to update product configuration: "+i.message,!![])}}updateCartComponent(e){try{if(!e)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(e),e.layout&&Object.keys(e.layout).length>0){this.commands.cart.rerenderCart();for(const i of getComponentTypesForLayoutFields("cart.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(i){throw this.logger.error("❌ Failed to update cart component theme",i),new SDKError("Failed to update cart configuration: "+i.message,!![])}}updateCheckoutComponent(e){try{if(!e)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(e),e.layout&&Object.keys(e.layout).length>0){this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("checkout.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(i){throw this.logger.error("❌ Failed to update checkout component theme",i),new SDKError("Failed to update checkout configuration: "+i.message,!![])}}updateAddressComponent(e){try{if(!e)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(e),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(i){throw this.logger.error("❌ Failed to update address component theme",i),new SDKError("Failed to update address configuration: "+i.message,!![])}}async injectElement(e){if(!e)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);if(!e.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(e)}async injectProductElement(e){if(!Array.isArray(e))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof e,!![]);return await this.processInjectProduct(e)}async injectAddressElement(e,i){if(!e||"string"!=typeof e)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return await this.processInjectElement({type:r.ADDRESS,containerId:e,options:i})}async injectCartElement(e){if(!e||"string"!=typeof e)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return await this.processInjectElement({type:r.CART,containerId:e})}async injectCheckoutElement(e,i){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const o=await this.processInjectElement({type:r.CHECKOUT,containerId:e});if(null==i?void 0:i.simulatePresale){const e=i.presaleExpiresInMinutes||15,o=new Date;o.setMinutes(o.getMinutes()+e),this.store.set("checkout.isPresaleLocked",!![]),this.store.set("checkout.presaleExpiresAt",o.toISOString()),this.logger.info("✅ Builder presale simulation activated - expires in "+e+" minutes")}return o}}async function ElementsBuilder(e,o){try{const r=ClientConfigService.getInstance();r.initialize(e,{env:o.env,isBuilder:!![],debugMode:o.debugMode,customTheme:o.customTheme,proxy:void 0,promoTicker:o.promoTicker});const c=r.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const d={updateComponentGlobalConfigs:l.updateComponentGlobalConfigs.bind(l),updateProductComponent:l.updateProductComponent.bind(l),updateAddressComponent:l.updateAddressComponent.bind(l),updateCartComponent:l.updateCartComponent.bind(l),updateCheckoutComponent:l.updateCheckoutComponent.bind(l),injectElement:l.injectElement.bind(l),injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),injectProductList:l.injectProductList.bind(l),actions:l.actions};window.elementsBuilder=d;const u=PubSubService.getInstance();return u.publishAction(i.CLIENT_READY,{isReady:!![],message:"Builder Client Is Ready",timestamp:Date.now(),version:r.get("version")}),d}catch(r){try{const e=LoggerFactory.get("ElementsBuilderClientInit");e.error("Elements Builder Client Initialization failed",r)}catch(c){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==r?void 0:r.message)}try{const e=ClientConfigService.getInstance(),o=PubSubService.getInstance();o.publishAction(i.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(l){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return 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 e=window.onerror;window.onerror=(i,o,r,c,l)=>isSDKError(l,o)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:i,source:o,lineno:r,colno:c,error:l}),!![]):e?e(i,o,r,c,l):![];const i=window.onunhandledrejection;window.onunhandledrejection=e=>{if(e.reason&&isSDKError(e.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",e.reason),e.preventDefault(),void 0;i&&i.call(window,e)};try{initializeDOMPolyfills()}catch(St){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",St)}try{triggerElementsAutoInit()}catch(Et){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Et)}}catch(_t){console.error("[LiquidCommerce Elements] SDK initialization failed:",_t)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
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 r of t)"string"==typeof r?n.appendChild(document.createTextNode(r)):n.appendChild(r);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 r of t)"string"==typeof r?n.appendChild(document.createTextNode(r)):n.appendChild(r);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 r of t)"string"==typeof r?n.appendChild(document.createTextNode(r)):n.appendChild(r);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,r]of t)e[n]=r;return e})}function safeScrollIntoView(t,e){try{e&&"function"==typeof t.scrollIntoView?t.scrollIntoView(e):t.scrollIntoView()}catch(n){try{t.scrollIntoView()}catch(r){console.warn("scrollIntoView failed:",r)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(M){console.warn("DOM polyfills initialization failed:",M)}}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])}}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)||""),r=/liquidcommerce\s+elements/i.test(n),s=String((null==t?void 0:t.stack)||""),a=(null==t?void 0:t.source)||e||"",l=[/@[/\\](?: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],d=[/\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/],u=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],h=[/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],p=isSDKSource(a),m=l.some(t=>t.test(s)),f=d.some(t=>t.test(s)),g=u.some(t=>t.test(s)),v=h.some(t=>t.test(s));return r||p||m||f||g||v}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))}const t={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},e={CLIENT_READY:"client_ready",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",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",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_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_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"},r={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-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",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_CARD_LOADING:"product-list-card-loading",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_SECTION:"checkout-information-section",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT_FORM:"checkout-payment-form",CHECKOUT_BILLING_FORM:"checkout-billing-form",CHECKOUT_SUMMARY_SECTION:"checkout-summary-section",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_DELIVERY_INFORMATION_FORM:"checkout-delivery-information-form",CHECKOUT_BUYER_INFORMATION_FORM:"checkout-buyer-information-form",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"},s={ON_DEMAND:"onDemand",SHIPPING:"shipping"},a={NONE:"none",CONSOLE:"console",PANEL:"panel"},l={[t.LOCAL]:"http://127.0.0.1:8080",[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},d={STANDARD:"standard"},u={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options"},h={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};class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}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 r=n.get(t);if(!r)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return r}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,r=SingletonManager.getInstances();if(r.has(n))return r.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const s=new SingletonManager.clientConstructor(t);return await s.prepare(),r.set(n,s),s}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;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===a.CONSOLE||t===a.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===a.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===a.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}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(a).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(a).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.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!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 r="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return r instanceof Date&&!Number.isNaN(r.getTime())?n>=r?(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 r,s;const d=n.env||t.STAGING,u=l[d];return{apiKey:e.trim(),env:d,isBuilder:null!==(r=n.isBuilder)&&void 0!==r?r:![],debugMode:null!==(s=n.debugMode)&&void 0!==s?s:a.NONE,baseUrl:u,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),r="ontouchstart"in window||navigator.maxTouchPoints>0,s=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,a=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,l=Math.max(s,a),d=[/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/],u=[/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 d.some(t=>t.test(n))?"tablet":u.some(t=>t.test(n))||r&&l<768?"mobile":r&&l>=768&&l<=1200||r&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&r&&l>=768||/windows nt/i.test(n)&&r&&l>=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,...r]=this.getPrefix("debug");void 0!==e?console.debug(n,...r,t,e):console.debug(n,...r,t)}info(t,e){if(!this.enableLogging)return;const[n,...r]=this.getPrefix("info");void 0!==e?console.info(n,...r,t,e):console.info(n,...r,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...r]=this.getPrefix("warn");void 0!==e?console.warn(n,...r,t,e):console.warn(n,...r,t)}error(t,e){const n=e instanceof Error,r=n?e:void 0,s=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,r,s),!this.enableLogging)return;const[a,...l]=this.getPrefix("error");void 0!==e?console.error(a,...l,t,e):console.error(a,...l,t)}group(t,e=![]){if(!this.enableLogging)return;const[n,...r]=this.getPrefix("log");e?console.groupCollapsed(n,...r,t):console.group(n,...r,t)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(t,e,n,r){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:r})}catch(s){}}}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 r=n.attachShadow({mode:"closed"}),s=document.createElement("style");s.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\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 a=document.createElement("div"),l=document.createElement("h3");l.textContent="Component </"+t+">";const d=document.createElement("p");return d.textContent=e,a.appendChild(s),a.appendChild(l),a.appendChild(d),r.appendChild(a),n}function productionComponentError({title:t,message:e,componentType:n}){const r=document.createElement("div");r.setAttribute("data-component-type",n);const s=r.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\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 l=document.createElement("div"),d=document.createElement("h2");d.textContent=t;const u=document.createElement("p");return u.textContent=e,l.appendChild(a),l.appendChild(d),l.appendChild(u),s.appendChild(l),r}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 s=document.createElement(n);if(s.initialize){const{type:e,useShadowDom:r,wrapInLceElement:a,...l}=t,d={type:e,tagName:n,useShadowDom:r&&a!==!![]};s.initialize({data:l,config:d})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const a=document.createElement(n);return a.initialize(t.type,s),a}return s}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={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.BIRTHDATE_INPUT]:"birthdate-input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.PRODUCT_LIST]:"product-list-lc",[r.PRODUCT_LIST_CARD]:"product-list-card-lc",[r.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[r.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[r.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[r.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[r.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-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,r]=t.includes(".")?t.split(".",2):["actions",t];let s=r.split("_")[0];["product","cart","address","checkout"].includes(s)||(s="other");const a=Date.now(),l={eventId:"evt_"+a+"_"+Math.random().toString(36).slice(2,9),namespace:n,event:r,originalEvent:t,actionNamespace:"actions"===n?s:void 0,timestamp:a},d={data:e,metadata:l};this.dispatchNativeEvents(t,d)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=e);const r=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(r);const s=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(s)}catch(r){this.logger.error("Error dispatching native events for "+t,r)}}setupClientReadyBuffering(){const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,r,s)=>{if(n!==e)return t.call(window,n,r,s);if(!this.clientReadyEvent)return t.call(window,n,r,s);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof r?r(t):r&&"function"==typeof r.handleEvent&&r.handleEvent(t)}catch(a){this.logger.error("Error replaying CLIENT_READY event",a)}return t.call(window,n,r,s)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),r=t%100;let s="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||r>0)&&(s+=".",s+=r<10?"0"+r:r.toString()),s}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12$1(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("Invalid time format: "+t);const n=Number.parseInt(e[1],10),r=Number.parseInt(e[2],10);if(n<0||n>23||r<0||r>59)throw new SDKError("Invalid time values: "+t);const s=n>=12?"PM":"AM",a=n%12||12;return a+":"+r.toString().padStart(2,"0")+" "+s}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"),r=e.getDate().toString().padStart(2,"0"),s=e.getFullYear().toString();return n+"/"+r+"/"+s}catch(e){return""}}function validateMinimumAge(t,e=21,n=1930){if(!t)return{isValid:![],age:null,error:"Birth date is required"};try{const r=t instanceof Date?t:new Date(t);if(Number.isNaN(r.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const s=new Date;if(r>s)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const a=r.getFullYear();if(a<n)return{isValid:![],age:null,error:"Birth year cannot be before "+n+". Please check your birth date."};const l=calculateAge(r,s);return l<e?{isValid:![],age:l,error:"Must be at least "+e+" years old"}:{isValid:!![],age:l}}catch(r){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(t,e){let n=e.getFullYear()-t.getFullYear();const r=e.getMonth()-t.getMonth();return(r<0||0===r&&e.getDate()<t.getDate())&&n--,Math.max(0,n)}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const r=[];return t.state&&t.state.trim()&&r.push(t.state.trim()),t.zip&&t.zip.trim()&&r.push(t.zip.trim()),r.length>0&&e.push(r.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}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 getAllConfigs(){try{this.ensureClientInitialized();const t=await this.client.get("/configs");if(!this.validResponseData(t))throw this.logger.error("Invalid response data",t),new SDKError("Failed to fetch all configs: Invalid response data");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),t}}async setPersistedStore(t,e){try{if(this.ensureClientInitialized(),!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;const n=await this.client.post("/configs/store/"+t,{body:e});200!==n.statusCode&&this.logger.error("Failed to set persisted store",n)}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(this.ensureClientInitialized(),!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 200!==e.statusCode?(this.logger.error("Failed to fetch persisted store",e),null):e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;const e=await this.client.delete("/configs/store/"+t);200!==e.statusCode&&this.logger.error("Failed to delete persisted store",e)}catch(e){this.logger.error("Error deleting persisted store",e)}}async getProductsData(t,e){try{if(this.ensureClientInitialized(),0===t.length)return this.logger.error("No product identifiers provided"),null;const n={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:e},r=await this.client.post("/cloud/catalog/availability",{body:n});return 200!==r.statusCode?(this.logger.error("Failed to fetch product data",r),null):{products:r.products,retailers:r.retailers}}catch(n){return this.logger.error("Error fetching product data",n),null}}async getCartData(t){try{this.ensureClientInitialized();const e=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==e.statusCode)throw this.logger.error("Failed to fetch cart data",e),new SDKError("Failed to fetch cart data: "+e.message);return e.cart}catch(e){throw this.logger.error("Error fetching cart data",e),e}}async updateCart(t){try{this.ensureClientInitialized();const e=await this.client.put("/cloud/cart",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to update cart",e),new SDKError("Failed to update cart: "+e.message);return e.cart}catch(e){throw this.logger.error("Error updating cart",e),e}}async getAddressSuggestions(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const e=await this.client.get("/cloud/address/autocomplete?input="+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch address suggestions",e),[]):e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(this.ensureClientInitialized(),!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.get("/cloud/address/details/"+t);if(200!==e.statusCode)throw this.logger.error("Failed to fetch address details",e),new SDKError("Failed to fetch address details: "+e.message);return e.data}catch(e){throw this.logger.error("Error fetching address details",e),e}}async prepareCheckout(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/prepare",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",e),new SDKError("Failed to fetch prepare checkout data: "+e.message);return e.checkout}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getPaymentSession(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/payment/session",{body:t});if(201!==e.statusCode)throw this.logger.error("Failed to get payment session",e),new SDKError("Failed to get payment session: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async confirmPaymentSession(t,e){try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:e}});if(200!==n.statusCode)throw this.logger.error("Failed to confirm payment session",n),new SDKError("Failed to confirm payment session: "+n.message);return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),n}}async checkoutComplete(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/complete",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to complete checkout",e),new SDKError("Failed to complete checkout: "+e.message);return e.order}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new SDKError(n.error);throw n}}async catalogSearch(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/catalog/search",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to fetch catalog search data",e),new SDKError("Failed to fetch catalog search data: "+e.message);return{products:e.products,retailers:e.retailers,navigation:e.navigation}}catch(n){return this.logger.error("Error fetching catalog search data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),{products:[],retailers:[],navigation:void 0}}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new SDKError("API client is not initialized")}}function fetchAdapter(t){return async(e,n)=>{var r;const s=await t(e,n);let a;if("function"==typeof(null===(r=s.headers)||void 0===r?void 0:r.entries))a=Object.fromEntries(s.headers.entries());else{a={};for(const[t,e]of s.headers)a[t]=e}return{ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:()=>s.json(),text:()=>s.text()}}}const xhrFetch=(t,e)=>new Promise((n,r)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t);for(const[t,a]of Object.entries(e.headers))s.setRequestHeader(t,a);s.onload=()=>{n({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,r]=e.split(": ");return n&&r&&(t[n]=r),t},{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{r(new TypeError("Network request failed"))},s.send(e.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const Y=()=>{this.isAuthenticating?setTimeout(Y,100):t(void 0)};Y()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.request("/auth",{method:"GET"},0,!![]),r=3e5;return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp)-r,!![]}catch(n){return this.logger.error("Authentication failed",n),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e,n=0,r=![]){r||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const s=this.buildUrl(t),a={"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(),...this.getProxyHeaders(),...e.headers};r?a["X-Liquid-Api-Key"]=this.apiKey:a.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(a["X-Liquid-Api-Builder"]=!![]);const l={method:e.method,headers:a,body:e.body?JSON.stringify(e.body):void 0},d=await this.httpClient(s,l);if(d.ok)try{return await d.json()}catch(h){return this.logger.error("Failed to parse successful response data",h),{message:await d.text().catch(()=>"Success")}}let u;try{u=await d.json()}catch(p){const t=await d.text().catch(()=>"HTTP error status: "+d.status);u={message:t||"Unknown error"},this.logger.error("Failed to parse error response data",p)}if(!r){const s=2,a=(null==u?void 0:u.statusCode)>=5e3&&(null==u?void 0:u.statusCode)<=5010;if(a&&n<s)return this.logger.warn("Authorization error detected (status: "+d.status+", code: "+(null==u?void 0:u.statusCode)+"). Retry attempt "+(n+1)+"/"+s+" in 3 seconds..."),this.accessToken=null,this.tokenExpiration=null,await new Promise(t=>setTimeout(t,3e3)),this.request(t,e,n+1,r)}throw{...u,status:d.status,message:(null==u?void 0:u.message)||"Request failed"}}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}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 put(t,e){return this.request(t,{method:"PUT",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}async delete(t,e){return this.request(t,{method:"DELETE",headers:null==e?void 0:e.headers})}}const p="@liquidcommerce/elements-sdk",m="LiquidCommerce Elements SDK",f="UNLICENSED",g="LiquidCommerce Team",v="2.5.6-beta.4",y="https://docs.liquidcommerce.co/elements-sdk",b={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},x={url:"https://github.com/liquidcommerce/elements-sdk/issues"},w="./dist/index.esm.js",C="./umd/elements.js",k="./dist/types/index.d.ts",S="pnpm@10.0.0",E={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},_=["dist","umd","docs","README.md","LICENSE"],D={access:"public",registry:"https://registry.npmjs.org/"},T="module",I=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],F={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","clean:hard":"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"},A=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],O={"@biomejs/biome":"2.3.3","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@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.1","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.1","ts-node":"^10.9.2",typescript:"^5.9.3"},N={node:">=22"},L={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},M={name:p,description:m,license:f,author:g,version:v,homepage:y,repository:b,bugs:x,module:w,browser:C,types:k,packageManager:S,exports:E,files:_,publishConfig:D,type:T,sideEffects:I,scripts:F,keywords:A,devDependencies:O,engines:N,pnpm:L};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],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(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.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){if(!window.dataLayer||!Array.isArray(window.dataLayer))return![];if(!this.isContainerLoaded(t))return![];const e=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));return e||window.dataLayer.length>0}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((e,n)=>{if(this.isContainerInitialized(t))return this.logger.info("GTM container "+t+" already loaded and initialized, skipping script injection"),e(),void 0;if(this.isContainerLoaded(t)){this.logger.info("GTM container "+t+" script present, checking initialization status");const r=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(r),clearTimeout(s),this.logger.info("GTM container "+t+" initialized successfully"),e())},100),s=setTimeout(()=>{clearInterval(r),n(new Error("GTM container "+t+" script present but failed to initialize (possible CSP or network issue)"))},1e4);return}this.logger.info("Loading GTM container "+t);const r=document.createElement("script");r.src="https://www.googletagmanager.com/gtm.js?id="+t,r.async=!![],r.crossOrigin="anonymous";const s=setTimeout(()=>{this.isContainerInitialized(t)?(this.logger.info("GTM container "+t+" initialized despite timeout warning"),e()):n(new Error("GTM script timeout: "+t+" (possible network issue or CSP blocking)"))},15e3);let a=![];r.onload=()=>{a||(a=!![],setTimeout(()=>{if(clearTimeout(s),this.isContainerInitialized(t))this.logger.info("GTM container "+t+" loaded and initialized successfully"),e();else{const r="GTM container "+t+" script loaded but failed to initialize. This may indicate a Content Security Policy (CSP) issue or network error.";this.logger.warn(r),window.dataLayer&&Array.isArray(window.dataLayer)?(this.logger.info("dataLayer available, continuing with GTM initialization"),e()):n(new Error(r))}},500))},r.onerror=r=>{a||setTimeout(()=>{if(this.isContainerLoaded(t)&&this.isContainerInitialized(t))return a||(a=!![],clearTimeout(s),this.logger.info("GTM container "+t+" loaded successfully despite error event (Safari quirk)"),e()),void 0;if(!a){a=!![],clearTimeout(s);let e="GTM script failed to load: "+t;"string"==typeof r?e+=". Error: "+r:r instanceof ErrorEvent&&r.message?e+=". Error: "+r.message:r instanceof Event&&(e+=". Event type: "+r.type);const l=e+". Possible causes: Content Security Policy (CSP) blocking, network failure, or invalid container ID.";this.logger.error(l,{event:r}),n(new Error(l))}},100)},r.addEventListener("error",e=>{a||this.logger.error("GTM script error event for "+t,e)}),document.head.appendChild(r)})}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const r of e)try{const t={event:r.eventName,...r.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",r.eventName,r.eventData),this.logger.debug("Processed queued GTM event: "+r.eventName,{data:r.eventData})}catch(n){this.logger.error("Error processing queued event "+r.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{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))throw new SDKError("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const e=this.isGTMAlreadyLoaded();e&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let n=![],r="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),n=!![],r=e?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(s){const t=(null==s?void 0:s.message)||String(s);this.logger.error("Failed to load LiquidCommerce GTM container: "+t+". Checking if partner GTM is available.",s),window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.length>0&&this.logger.warn("LiquidCommerce GTM script failed, but dataLayer is available. Attempting to proceed with existing GTM setup.")}if(n||(e&&window.dataLayer&&Array.isArray(window.dataLayer)&&(this.isContainerInitialized(t.partnerGtmId||"")||window.dataLayer.length>0)&&(n=!![],r="GTM integrated with existing partner setup (LiquidCommerce container failed to load)",this.logger.info("Using partner GTM as fallback after LiquidCommerce GTM load failure")),!n&&window.dataLayer&&Array.isArray(window.dataLayer)&&(n=!![],r="GTM initialized with dataLayer (basic functionality available, container script may have failed)",this.logger.warn("LiquidCommerce GTM container failed to load, but using basic dataLayer for event tracking"))),!n)throw this.isInitializing=![],new SDKError("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(r),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const r=this.getSendToTargets(),s={...n,...r.length>0&&{send_to:r},tenant_source:M.description+" v"+M.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:s,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+e+" (initialization pending)",{data:s}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+e+" skipped: dataLayer not available"),void 0;const a={event:e,...s};window.dataLayer.push(a),"function"==="object".gtag&&window.gtag("event",e,s),this.logger.debug("Sent GTM event: "+e,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:r.length>0?r:"no targeting",data:s})}catch(r){this.logger.error("GTM "+t+" error",r)}}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})}addShippingInfoWithCustomerData(t,e,n,r){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:t,coupon:e,phone:null==n?void 0:n.phone,email:null==n?void 0:n.email,birth_date:null==n?void 0:n.birth_date,customer_id:null==n?void 0:n.customer_id,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}addPaymentInfoWithoutItems(t,e,n,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:t,payment_type:e,coupon:n,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}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})}}const R="liquid_elements",B={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:s.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},j={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},G={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],isPresaleLocked:![],presaleExpiresAt:null,acceptedAccountCreation:![],deliveryTips:[],hasAgeVerify:![],hasSubstitutionPolicy:![],isGift:![],billingSameAsShipping:!![],marketingPreferences:{canEmail:![],canSms:![]},giftRecipient:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:null,message:null},customer:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:"",company:""},payment:{key:"",secret:"",paymentMethodId:null,sendSubmitSignal:![]},billing:null,promoCode:null,giftCards:[],orderNumber:null,items:{},readyForSubmit:{customer:![],gift:![],billing:![],payment:![],prepared:![]},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],isFormValid:![],invalidFields:[],focusField:null,onDemandFulfillmentTipInfo:{},tipSelection:10,stripeFormStatus:{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},deliveryInstructions:null,card:{brand:null,country:null,expMonth:null,expYear:null,last4:null,funding:null},giftCardError:null,promoCodeError:null,events:[]},K={drawer:{isOpen:![],contentConfig:null}},V={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},W={products:{},cart:j,address:V,checkout:G,ui:K};class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const r=performance.now();this.logger.group("🏪 Store "+t+" ---------------------------------"),this.logger.debug("Payload:",e);try{const t=n(),e=performance.now()-r;return this.logger.debug("Completed in "+e.toFixed(3)+"ms"),t}catch(s){throw this.logger.error('Error during store action "'+t+'"',s),s}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),r=e(),s=performance.now()-n;return s>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+s.toFixed(2)+"ms"),r},this.state=W,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.isBuilder()?R+"_builder_"+t:R+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),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 r of e){if(null==n)return;n=n[r]}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),r=e(n);return this.set(t,r)}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 r=this.state;const s=n.pop();for(const a of n){if(void 0===r[a])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];r=r[a]}if(Array.isArray(r))r=r.filter((t,e)=>e!==Number.parseInt(s,10));else{if("object"!=typeof r||null===r)return this.logger.warn('Cannot remove property "'+s+'" from non-object type at path "'+t+'".'),![];{const{[s]:t,...e}=r;r=e}}return this.state=this.immutableSet(this.state,n.join("."),r),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,r]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,r)}}else for(const[n,r]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,r)}for(const{path:t,oldValue:n,newValue:r}of e)this.notifyListeners(t,r,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 r;const s=t.map(t=>this.watch(t,(s,a)=>{n.push({path:t,value:s,oldValue:a}),clearTimeout(r),r=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of s)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,...r}=e;return this.set("products",r)}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 r=0;const P=()=>{if(r>=this.middleware.length)return n();const s=this.middleware[r++];return s({action:t,payload:e,state:this.getState(),next:P})};return P()}immutableSet(t,e,n){const r=e.split(".");if(1===r.length){if(Array.isArray(t)){const e=[...t];return e[r[0]]=n,e}return{...t,[r[0]]:n}}const[s,...a]=r,l=t[s],d=Array.isArray(l)?[]:{};if(Array.isArray(t)){const e=[...t];return e[s]=this.immutableSet(l||d,a.join("."),n),e}return{...t,[s]:this.immutableSet(l||d,a.join("."),n)}}notifyListeners(t,e,n){const r=this.listeners.get(t);if(r)for(const d of r)try{d(e,n)}catch(a){this.logger.error('Error in store listener for path "'+t+'"',a)}const s=t.split(".");for(let d=s.length-1;d>0;d--){const t=s.slice(0,d).join("."),e=this.listeners.get(t);if(e){const r=this.get(t),a=s.slice(d).join("."),u=this.immutableSet(r,a,n);for(const n of e)try{n(r,u)}catch(l){this.logger.error('Error in store listener for parent path "'+t+'"',l)}}}}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.debug("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.debug("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const r=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(r,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:r,addressId:e,cartId:n})}catch(r){this.logger.error("Failed to persist session data to DB",r)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.debug("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.debug("localStorage entry completely removed",{key:this.localStorageKey})}catch(M){this.logger.error("Failed to clear localStorage entry",M)}}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||null),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||null),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:{lat:e.coords.lat,long:e.coords.long}}:{...V,id:t}}catch(e){return{...V,id:t}}}}const X=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_LIST,r.PRODUCT_LIST_CARD,r.PRODUCT_LIST_CARD_LOADING,r.PRODUCT_LIST_FILTERS],$=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],J=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],tt=[r.CHECKOUT,r.CHECKOUT_INFORMATION_SECTION,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT_FORM,r.CHECKOUT_BILLING_FORM,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVERY_INFORMATION_FORM,r.CHECKOUT_BUYER_INFORMATION_FORM,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN,r.CHECKOUT_PRESALE_EXPIRED];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],r=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),s="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+r+"&"+s,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 flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n }\n\n .product-list-filters-container {\n width: 30%;\n height: fit-content;\n position: sticky;\n top: 24px;\n padding: 0;\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 .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n /* Filters Styles */\n .product-list-filters-header,\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 16px 0 12px 0;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-delivery-options {\n border-bottom: none;\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-personalized,\n .product-list-filters-pre-order {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\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-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 15px;\n font-weight: 500;\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-delivery-options-header {\n display: flex;\n align-items: center;\n }\n\n .product-list-filters-delivery-options-label {\n font-size: 18px;\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-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 12px 16px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-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-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 15px;\n font-weight: 500;\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-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch,\n input[type="checkbox"].product-list-filters-pre-order-switch {\n position: relative;\n width: 52px;\n height: 28px;\n appearance: none;\n background: var(--accent-color, #e5e7eb);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n outline: none;\n border: 2px solid transparent;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch:checked,\n input[type="checkbox"].product-list-filters-pre-order-switch:checked {\n background: var(--primary-color, #3b82f6);\n border-color: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n }\n\n .product-list-filters-personalized-switch:disabled,\n .product-list-filters-pre-order-switch:disabled {\n background: var(--accent-color-30, #f3f4f6);\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .product-list-filters-personalized-switch::before,\n .product-list-filters-pre-order-switch::before {\n content: \'\';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: var(--selected-text-color, #ffffff);\n border-radius: 50%;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n .product-list-filters-personalized-switch:checked::before,\n .product-list-filters-pre-order-switch:checked::before {\n transform: translateX(24px);\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .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 border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\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 line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 10px;\n font-weight: 300;\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\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 padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\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 gap: 8px;\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 /* Responsive Styles */\n\n /* Mobile - 1 column (default, up to 639px) */\n @media (max-width: 639px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px and up) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px and up) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n width: 30%;\n order: unset;\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: unset;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n position: sticky;\n top: 24px;\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.standard {\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: "+h.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: "+h.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: "+h.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 }\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(--primary-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: "+h.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(--primary-color, #1E40AF);\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: "+h.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: "+h.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(--primary-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: "+h.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-container.no-header .checkout-information-section,\n .checkout-container.no-header .checkout-summary-section {\n padding: 0;\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 }\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-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 margin-top: 20px;\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-items: center;\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: "+h.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(--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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+h.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: "+h.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 line-height: 100%;\n text-align: center;\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, .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-payment-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-payment-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-payment-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-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-payment-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-payment-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-payment-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(--primary-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: '+h.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\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 .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: "+h.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(--primary-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 ',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 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: 8px;\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 gap: 16px;\n flex-direction: row;\n align-items: center;\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 }\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 }\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 }\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 gap: 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(--primary-color, #1E40AF);\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 gap: 16px;\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 gap: 4px;\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 .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 }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n gap: 16px;\n align-self: stretch;\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 }\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 }\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 }\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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\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: 500;\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: 500;\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: "+h.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(--primary-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: "+h.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 }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\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 {\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(--primary-color, #1E40AF);\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: "+h.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 }\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 }\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(--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 }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+h.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(--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 }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\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";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: "+h.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: "+h.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: "+h.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: "+h.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: "+h.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 gap: 8px;\n margin-bottom: 20px;\n width: 100%;\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 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 et={"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",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},nt={backgroundColor:"--product-background-color"},it={backgroundColor:"--cart-background-color"},ot={backgroundColor:"--address-background-color"},rt={backgroundColor:"--checkout-background-color"},st={global:et,product:nt,cart:it,address:ot,checkout:rt};function getCSSVariableMapping(t){return st[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={},r=getCSSVariableMapping(e);for(const[s,a]of Object.entries(r)){const e=this.getValueByPath(t,s);void 0!==e&&this.isCSSValue(e)&&(n[a]=e,this.isColorVariable(a,e)&&this.generateOpacityVariants(n,a,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},r=getCSSVariableMapping(e);for(const[s,a]of Object.entries(r))if(this.hasValueAtPath(t,s)){const e=this.getValueByPath(t,s);void 0!==e&&this.isCSSValue(e)&&(n[a]=e,this.isColorVariable(a,e)&&this.generateOpacityVariants(n,a,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,r]of Object.entries(e))n.style.setProperty(t,String(r))}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 r=t;for(const s of n){if(null==r||!(s in r))return![];r=r[s]}return!![]}findOrCreateRule(t){const e=":host";for(const r of Array.from(t.cssRules))if(r instanceof CSSStyleRule&&r.selectorText===e)return r;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 r of this.opacityLevels){const s=e+"-"+r.suffix,a=this.addOpacityToHexColor(n,r.value);a&&(t[s]=a)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),r=/^#[0-9a-f]{3,8}$/i.test(e);return n&&r}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 r=Math.round(255*e),s=r.toString(16).padStart(2,"0");return"#"+n+s}}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),r=this.cssProcessor.generateCSSVariablesString(n),s=this.getStylesheetStyles(t).join("\n\n"),a=0===r.length?"":":host { "+r+" }",l=("\n "+a+"\n\n "+s+"\n ").trim();this.createStylesheet(t,l)}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(M){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 r=this.styleSheets.get(t);if(r&&"string"!=typeof r){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(r,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];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)}updateComponentGlobalConfigs(t){var e,n;const r=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=r,((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")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==X.indexOf(t)?this.getConfigs("product"):-1!==$.indexOf(t)?this.getConfigs("address"):-1!==J.indexOf(t)?this.getConfigs("cart"):-1!==tt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===r.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),r=this.stylesheetGenerator.getStylesheet("cart"),s=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),r&&t.push(r),s&&t.push(s),a&&t.push(a),t}let n;if($.includes(t)||t===r.ADDRESS)n="address";else if(X.includes(t)||t===r.PRODUCT)n="product";else if(J.includes(t)||t===r.CART)n="cart";else{if(!tt.includes(t)&&t!==r.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const s=this.stylesheetGenerator.getStylesheet(n);return s?[...e,s]: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 r in e)null!==e[r]&&void 0!==e[r]&&("object"!=typeof e[r]||Array.isArray(e[r])||"object"!=typeof t[r]||Array.isArray(t[r])?n[r]=e[r]:n[r]=this.deepMerge(t[r],e[r]));return n}}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.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},at={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},ct={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:at[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:ct[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,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,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,giftCardTotal:t.giftCardTotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var e;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(e=t.fulfillments)||void 0===e?void 0:e.map(t=>t.id))||[]}}function buildFulfillmentStore(t,e){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:e.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,e){var n;const r=e.formattedAddress?e:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in t.items||{}){const e=t.items[a];s[a]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,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||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:s,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},itemCount:Object.values(s||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,n=![]){var r,s,a,l,d,u;const h=this.store.get("cart");for(const e of Object.keys(h.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(h.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(h.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const p={"cart.id":t.id,"cart.error":null,"cart.totals":buildCartTotals(t),"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(s=null===(r=t.attributes)||void 0===r?void 0:r.promoCode)||void 0===s?void 0:s.value)?{code:t.attributes.promoCode.value.toUpperCase(),discountAmount:t.attributes.promoCode.discount||0,error:null}:null};if((null===(a=t.items)||void 0===a?void 0:a.length)>0)for(const e of t.items)p["cart.items."+e.id]=buildCartItemStore(e);if((null===(l=t.retailers)||void 0===l?void 0:l.length)>0)for(const e of t.retailers)if(p["cart.retailers."+e.id]=buildRetailerStore(e),(null===(d=e.fulfillments)||void 0===d?void 0:d.length)>0)for(const t of e.fulfillments)p["cart.fulfillments."+t.id]=buildFulfillmentStore(t,e);if((null===(u=t.events)||void 0===u?void 0:u.length)>0&&(p["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(p),n){const t=this.store.get("cart"),n=this.store.get("address");this.pubSub.publishAction(e.CART_LOADED,cartDataForEventFromStore(t,n))}}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){this.store.set("cart.error","Failed to load cart"),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}const lt="lce-checkout-stripe-slot",dt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},ut={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},ht={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function validateCustomerInfo(t){const e=[dt.firstName,dt.lastName,dt.email,dt.phone,dt.birthDate];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const r of e){const e=t[r];if(!e||"string"==typeof e&&""===e.trim())n.push(r);else if("birthDate"===r){const t=validateMinimumAge(e,21,1930);t.isValid||n.push(r)}}return{isValid:0===n.length,invalidFields:n}}function validateGiftRecipientInfo(t){const e=[ut.firstName,ut.lastName,ut.email,ut.phone,ut.message];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const r of e){const e=t[r];(!e||"string"==typeof e&&""===e.trim())&&n.push(r)}return{isValid:0===n.length,invalidFields:n}}function validateBillingInfo(t){const e=[ht.firstName,ht.lastName,ht.email,ht.phone,ht.addressOne,ht.city,ht.state,ht.zipCode];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const r of e){const e=t[r];(!e||"string"==typeof e&&""===e.trim())&&n.push(r)}return{isValid:0===n.length,invalidFields:n}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,n){const s={type:t,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:s}),t===r.CART&&this.pubSub.publishAction(e.CART_OPENED,!![]),t===r.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)===r.CART&&this.pubSub.publishAction(e.CART_CLOSED,!![]),(null==t?void 0:t.type)===r.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,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,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var n,r,a;try{this.store.set("checkout.loading",!![]);const l=t||this.store.get("cart.id"),d=this.store.get("cart");if(0===(null===(n=Object.values(d.items))||void 0===n?void 0:n.length)&&!t)return;const u=this.themeProvider.getConfigs("checkout"),h={canEmail:u.layout.emailOptIn.checked,canSms:u.layout.smsOptIn.checked};if(!l)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const p={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.readyForSubmit":null,"checkout.isPresaleLocked":![],"checkout.presaleExpiresAt":null,"checkout.events":[],"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,firstName:"",lastName:"",email:"",phone:"",message:""}},m=await this.api.prepareCheckout({cartId:l,marketingPreferences:h});if((null===(r=m.retailers)||void 0===r?void 0:r.length)>0)for(const t of m.retailers)for(const e of t.fulfillments)e.type===s.ON_DEMAND&&(p["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(a=m.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const t of m.items){const e=m.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);p["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,n)}}m.isPresaleLocked&&m.presaleExpiresAt&&(p["checkout.isPresaleLocked"]=m.isPresaleLocked,p["checkout.presaleExpiresAt"]=m.presaleExpiresAt),p["checkout.token"]=m.token,p["checkout.cartId"]=m.cartId,p["checkout.customer"]=m.customer,p["checkout.acceptedAccountCreation"]=m.acceptedAccountCreation,p["checkout.billingSameAsShipping"]=m.billingSameAsShipping,p["checkout.hasAgeVerify"]=m.hasAgeVerify,p["checkout.hasSubstitutionPolicy"]=m.hasSubstitutionPolicy,p["checkout.isGift"]=m.isGift,p["checkout.marketingPreferences"]=m.marketingPreferences,p["checkout.giftCards"]=m.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),p["checkout.promoCode"]=m.promoCode.value?{code:m.promoCode.value,discountAmount:m.promoCode.discount}:null,p["checkout.marketingPreferences.canEmail"]=m.marketingPreferences.canEmail,p["checkout.marketingPreferences.canSms"]=m.marketingPreferences.canSms,p["checkout.amounts"]=m.amounts,p["checkout.error"]=null,p["checkout.updating"]=![],p["checkout.events"]=m.events||[],this.store.batch(p),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_LOADED,{cartId:m.cartId})}catch(l){throw this.store.set("checkout.error",l.message),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:l.message}),l}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(t){var n,r,a,l,d;try{let e;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)e=t.response;else{const r=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;e=await this.api.prepareCheckout({cartId:r})}const u={"checkout.token":e.token,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.amounts":e.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(a=null===(r=null==e?void 0:e.promoCode)||void 0===r?void 0:r.value)||void 0===a?void 0:a.trim())?{code:e.promoCode.value,discountAmount:e.promoCode.discount}:null};if((null===(l=e.retailers)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of e.retailers)for(const e of t.fulfillments)e.type===s.ON_DEMAND&&(u["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(d=e.items)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.items");for(const t of e.items){const n=e.retailers.find(e=>e.id===t.retailerId),r=n.fulfillments.find(e=>e.id===t.fulfillmentId);u["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,n,r)}}this.store.batch(u),this.validateAndUpdateFormStatus()}catch(u){const t=(null==u?void 0:u.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:t}),u}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),r=null!=t?t:!n;this.store.batch({"checkout.isGift":r,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_IS_GIFT_TOGGLED,{isActive:r})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.billingSameAsShipping"),r=null!=t?t:!n;this.store.batch({"checkout.billingSameAsShipping":r,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:r})}toggleMarketingPreferences(t,n){const r=this.store.get("checkout.marketingPreferences."+t),s=null!=n?n:!r;this.store.set("checkout.marketingPreferences."+t,s),this.pubSub.publishAction(e.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:s})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.set("checkout.payment",{key:e.key,secret:e.secret,paymentMethodId:null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{const n=await this.api.confirmPaymentSession(t,e);this.store.batch({"checkout.payment.paymentMethodId":n.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...n.card}})}catch(n){throw new SDKError("Failed to confirm payment session. Please try again.")}}async applyPromoCode(t){var e;try{this.googleTagManager.promoCodeAttempt(t);const n=this.dataForCheckoutPrepare(),r=await this.api.prepareCheckout({...n,promoCode:t}),s=0!==r.amounts.discounts,a=null===(e=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===e?void 0:e[0];if(!s)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+t+'" does not exist'),this.googleTagManager.promoCodeFailed(t,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(t,r.amounts.discounts),await this.partialLoadCheckout({response:r})}catch(n){const e=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.promoCodeFailed(t,e),n}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(M){const e=M.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),M}}async removePromoCode(){var t,e;try{const n=this.dataForCheckoutPrepare(),r=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",s=await this.api.prepareCheckout({...n,promoCode:""});if(0!==s.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(r,0),await this.partialLoadCheckout({response:s})}catch(n){const t=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"";throw e&&this.googleTagManager.promoCodeFailed(e,t),n}}async applyGiftCard(t){var e;const n=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(n);const t=this.dataForCheckoutPrepare(),r=t.giftCards||[],s=await this.api.prepareCheckout({...t,giftCards:[...r,n]}),a=null===(e=transformGiftCardCheckoutEvents(s.events||[]))||void 0===e?void 0:e[0],l=hasAnyRetailerGiftCardRestriction(s.events||[]);if(a&&(this.store.set("checkout.giftCardError",a.message),!l))return;const d=s.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(!d)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(n,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(n,d.applied),await this.partialLoadCheckout({response:s})}catch(r){const t=(null==r?void 0:r.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(M){throw this.store.set("checkout.error",(null==M?void 0:M.message)||"Failed to clear gift card error. Please try again."),M}}async removeGiftCard(t){var e;const n=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare(),r=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==n.toLowerCase()))||[],s=await this.api.prepareCheckout({...t,giftCards:r}),a=s.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+n),void 0;this.googleTagManager.giftCardApplied(n,0),await this.partialLoadCheckout({response:s})}catch(r){const t=(null==r?void 0:r.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),r}}updateCustomerInfo(t,n){try{this.store.set("checkout.customer."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:t})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateBillingInfo(t,n){try{this.store.set("checkout.billing."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:t})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateGiftInfo(t,n){try{this.store.set("checkout.giftRecipient."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:t})}catch(r){throw this.store.set("checkout.error",r.message),r}}triggerAddShippingInfoEvent(){var t,e;const n=this.store.get("checkout");if(n.customer.email||n.customer.phone){const r=(null===(t=null==n?void 0:n.customer)||void 0===t?void 0:t.id)||(null===(e=null==n?void 0:n.customer)||void 0===e?void 0:e.email),s={subtotal:centToDollar(n.amounts.subtotal),total_before_discounts:centToDollar(n.amounts.subtotal+n.amounts.tax+n.amounts.shipping+n.amounts.delivery+n.amounts.platform+n.amounts.service),discounts:centToDollar(n.amounts.discounts),gift_cards:centToDollar(n.amounts.giftCards||0),net_total:centToDollar(n.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(n.amounts.total),void 0,{phone:n.customer.phone,email:n.customer.email,birth_date:n.customer.birthDate,customer_id:r},s)}}validateAndUpdateFormStatus(){const t=this.store.get("checkout"),e=validateCustomerInfo(t.customer),n=t.isGift?validateGiftRecipientInfo(t.giftRecipient):{isValid:!![],invalidFields:[]},r=t.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(t.billing),s=e.isValid&&n.isValid&&r.isValid,a=[...e.invalidFields.map(t=>"customer."+t),...n.invalidFields.map(t=>"giftRecipient."+t),...r.invalidFields.map(t=>"billing."+t)];this.store.batch({"checkout.isFormValid":s,"checkout.invalidFields":a,"checkout.readyForSubmit.customer":e.isValid,"checkout.readyForSubmit.gift":n.isValid,"checkout.readyForSubmit.billing":r.isValid})}async checkoutComplete(){var t;try{const n=this.store.get("checkout"),s=this.store.get("checkout.payment.paymentMethodId");if(!n.token||!s)return;const a=await this.api.checkoutComplete({token:n.token,payment:s}),l=a.legacyOrderNumber||a.referenceId||"N/A";n.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,{orderNumber:l,orderTotal:n.amounts.total,cardLast4:n.card.last4,customerEmail:n.customer.email,giftRecipientEmail:(null===(t=n.giftRecipient)||void 0===t?void 0:t.email)||null}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:l,orderTotal:n.amounts.total}),this.googleTagManager.purchase({transaction_id:l,tax:centToDollar(n.amounts.tax||0),shipping:centToDollar(n.amounts.shipping||0),items:[...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),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(n.amounts.total),subtotal:centToDollar(n.amounts.subtotal),total_before_discounts:centToDollar(n.amounts.subtotal+n.amounts.tax+n.amounts.shipping+n.amounts.delivery+n.amounts.platform+n.amounts.service),discounts:centToDollar(n.amounts.discounts),gift_cards:centToDollar(n.amounts.giftCards||0),net_total:centToDollar(n.amounts.total)})}catch(n){const t=(null==n?void 0:n.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":t,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),n}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var t,n,r,s;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_STARTED,{started:!![]});const a=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const l={cartId:a.cartId,customer:{firstName:a.customer.firstName,lastName:a.customer.lastName,email:a.customer.email,phone:a.customer.phone,birthDate:a.customer.birthDate,company:a.customer.company},...a.isGift&&{giftOptions:{recipient:{email:a.giftRecipient.email,phone:a.giftRecipient.phone,name:a.giftRecipient.firstName+" "+a.giftRecipient.lastName},message:a.giftRecipient.message||""}},...!a.billingSameAsShipping&&(null==a?void 0:a.billing)&&{billingAddress:{firstName:null==a?void 0:a.billing.firstName,lastName:a.billing.lastName,email:a.billing.email,phone:a.billing.phone,company:null!==(t=a.billing.company)&&void 0!==t?t:void 0,city:a.billing.city,state:a.billing.state,zip:a.billing.zipCode,one:a.billing.addressOne,two:a.billing.addressTwo||""}},billingSameAsShipping:a.billingSameAsShipping,acceptedAccountCreation:a.acceptedAccountCreation,hasAgeVerify:a.hasAgeVerify,shippingAddressTwo:null!==(n=a.isGift?a.giftRecipient.addressTwo:a.customer.addressTwo)&&void 0!==n?n:void 0,hasSubstitutionPolicy:a.hasSubstitutionPolicy,isGift:a.isGift,marketingPreferences:a.marketingPreferences,promoCode:(null===(r=a.promoCode)||void 0===r?void 0:r.code)||void 0,giftCards:(null===(s=a.giftCards)||void 0===s?void 0:s.map(t=>t.code))||[],deliveryInstructions:Object.values(a.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:a.deliveryInstructions||""}))},d=await this.api.prepareCheckout(l);this.store.batch({"checkout.customer":d.customer,"checkout.acceptedAccountCreation":d.acceptedAccountCreation,"checkout.billingSameAsShipping":d.billingSameAsShipping,"checkout.hasAgeVerify":d.hasAgeVerify,"checkout.hasSubstitutionPolicy":d.hasSubstitutionPolicy,"checkout.isGift":d.isGift,"checkout.marketingPreferences":d.marketingPreferences,"checkout.events":d.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent();const u={subtotal:centToDollar(a.amounts.subtotal),total_before_discounts:centToDollar(a.amounts.subtotal+a.amounts.tax+a.amounts.shipping+a.amounts.delivery+a.amounts.platform+a.amounts.service),discounts:centToDollar(a.amounts.discounts),gift_cards:centToDollar(a.amounts.giftCards||0),net_total:centToDollar(a.amounts.total)};this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(a.amounts.total),"card",void 0,u)}catch(a){const t=(null==a?void 0:a.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":t,"checkout.loading":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),a}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const t=this.store.get("checkout.invalidFields")||[];if(0===t.length)return;const e=t[0];this.store.set("checkout.focusField",e),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(t){this.logger.error("Checkout form validation focus operation failed",{error:t instanceof Error?t.message:String(t)})}}buildItemUpdate(t,e){var n,r,s;const a={id:t.cartItemId,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},l=(null===(s=null===(r=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];return l.length>0&&(a.engravingLines=l),a}async updateCheckoutItemQuantity(t,n){try{this.store.set("checkout.items."+t+".updating",!![]);const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found");const a=s.quantity,l=s.quantity+n;if(l<1)return this.removeItem(t,!![]);const d=this.buildItemUpdate(s,l),u=await this.api.updateCart({id:r,items:[d],loc:this.getLocation()});this.pubSub.publishAction(n>0?e.CHECKOUT_ITEM_QUANTITY_INCREASE:e.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:s.cartItemId,quantity:l,previousQuantity:a});const h=splitCategoryPath(s.catPath),p={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(n),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};n<0?this.googleTagManager.removeFromCart(p):n>0&&this.googleTagManager.addToCart(p),await this.partialLoadCheckout({cartResponse:u})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),r}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var n,r,s;try{const a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found in checkout");if(!(null===(n=a.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const l=(null===(s=null===(r=a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],d={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},u=this.store.get("checkout.cartId"),h=await this.api.updateCart({id:u,items:[d],loc:this.getLocation()});this.pubSub.publishAction(e.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:l}),await this.partialLoadCheckout({cartResponse:h})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:a.message}),a}}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("checkout.items."+t+".updating",!![]);const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found");const a=this.buildItemUpdate(s,0),l=await this.api.updateCart({id:r,items:[a],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(e.CHECKOUT_ITEM_REMOVED,{cartItemId:s.cartItemId}),await this.partialLoadCheckout({cartResponse:l})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),r}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(n).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}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 r=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(r).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?n:e.tip})),a={...this.dataForCheckoutPrepare(),deliveryTips:s},l=await this.api.prepareCheckout(a);this.updateStoreFromCheckoutResponse(l),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update fulfillment tip. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(n).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}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",![])}}updateStoreFromCheckoutResponse(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const r of t.retailers)for(const t of r.fulfillments)t.type===s.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:r.id,retailerName:r.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async updateStripeFormStatus(t){try{const e=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},n={...e,...t};this.store.set("checkout.stripeFormStatus",n)}catch(e){throw this.logger.error("Error updating Stripe form status",{error:e instanceof Error?e.message:String(e)}),e}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(t){this.store.set("checkout.deliveryInstructions",t)}dataForCheckoutPrepare(){var t,e,n;const r=this.store.get("checkout"),s=(null===(t=null==r?void 0:r.customer)||void 0===t?void 0:t.email)?{firstName:r.customer.firstName,lastName:r.customer.lastName,email:r.customer.email,phone:r.customer.phone,birthDate:r.customer.birthDate,company:r.customer.company}:void 0;return{cartId:r.cartId,customer:s,billingSameAsShipping:r.billingSameAsShipping,acceptedAccountCreation:r.acceptedAccountCreation,hasAgeVerify:r.hasAgeVerify,hasSubstitutionPolicy:r.hasSubstitutionPolicy,marketingPreferences:r.marketingPreferences,promoCode:(null===(e=r.promoCode)||void 0===e?void 0:e.code)||void 0,giftCards:(null===(n=null==r?void 0:r.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),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 r=this.store.get("cart.id"),s=this.store.get("cart.items."+t);if(!s)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+n),new SDKError("Item not found");const a=s.quantity+n;if(a<1)return this.removeItem(t,!![]);const l=this.buildItemUpdate(s,a),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.updateFulfillment(s.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(n<0?e.CART_ITEM_QUANTITY_DECREASE:e.CART_ITEM_QUANTITY_INCREASE,{id:s.id,quantity:a,previousQuantity:s.quantity});const u=splitCategoryPath(s.catPath),h={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(n),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};n<0?this.googleTagManager.removeFromCart(h):n>0&&this.googleTagManager.addToCart(h)}catch(r){throw this.store.set("cart.items."+t+".error",r.message),this.logger.error("Failed to update item quantity",r),r}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 r=this.store.get("cart.id"),s=this.store.get("cart.items."+t);if(!s)throw new SDKError("Item not found");const a={itemId:s.id,fulfillmentId:s.fulfillmentId,retailerId:s.retailerId},l=this.buildItemUpdate(s,0),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[]),this.cleanupAfterItemRemoval(a,d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(e.CART_ITEM_REMOVED,{id:s.id});const u=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(r){throw this.store.set("cart.items."+t+".error",r.message),this.logger.error("Failed to remove item",r),r}}async updateItemEngraving(t,n){var r,s,a;try{const l=this.store.get("cart"),d=null===(r=l.items)||void 0===r?void 0:r[t];if(!d)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const u={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:n},h=await this.api.updateCart({id:l.id||"",items:[u],loc:this.getLocation()});this.syncItemsFromApiResponse(h,[t]),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h);const p=this.store.get("cart"),m=this.store.get("address");this.pubSub.publishAction(e.CART_UPDATED,{previous:cartDataForEventFromStore(l,m),current:cartDataForEventFromStore(p,m)}),this.pubSub.publishAction(e.CART_ITEM_ENGRAVING_UPDATED,{id:d.id,engravingLines:n,previousEngravingLines:(null===(a=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[]})}catch(l){throw this.store.set("cart.items."+t+".error",l.message),this.logger.error("Failed to update item engraving",l),l}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var n,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},l=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],d=l.length>0,u=Object.values(s.items||{}).find(e=>{var n,r,s,a,u;const h=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!h)return![];if(d){const t=(null===(r=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===r?void 0:r.lines)||[];return l.join(",")===t.join(",")}return!(null===(u=null===(a=null===(s=e.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===u?void 0:u.length)}),h={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:u?t.quantity+u.quantity:t.quantity};d&&(h.engravingLines=l);const p=await this.api.updateCart({id:s.id||"",items:[h],loc:this.getLocation()}),m=null===(r=p.items)||void 0===r?void 0:r.find(t=>t.fulfillmentId===h.fulfillmentId&&t.partNumber===h.partNumber&&t.upc===h.upc);if(!m)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const f=this.store.get("cart.fulfillments."+t.fulfillmentId);f?this.updateFulfillment(t.fulfillmentId,p):this.addNewFulfillmentAndRetailer(t.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const g=this.store.get("cart"),v=this.store.get("address");this.pubSub.publishAction(e.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(e.CART_ITEM_ADDED,{id:m.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(e.CART_UPDATED,{previous:cartDataForEventFromStore(a,v),current:cartDataForEventFromStore(g,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,item_type:m.type,item_subtype:m.subType,quantity:m.quantity,price:centToDollar(m.unitPrice||0),upc:m.upc,grouping_id:m.salsifyGrouping,product_id:m.liquidId})}catch(s){throw this.store.set("cart.error",s.message),this.logger.error("Failed to add item to cart",s),s}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const r=await this.api.updateCart({id:"",items:[n],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(r.id)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to add presale item to cart",n),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(r.CHECKOUT);const e=this.store.get("cart"),n=(null===(t=e.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.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),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}catch(e){throw this.store.set("cart.error",e.message),this.logger.error("Failed to proceed to checkout",e),e}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var e,n,r;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const s=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(s);const a=await this.api.updateCart({id:t,items:[],promoCode:s,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(a)),this.store.set("cart.events",transformEventsForCart(a.events||[]));const l=(null===(r=null===(n=null===(e=a.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value)||void 0===r?void 0:r.toLowerCase())===s.toLowerCase();l?(this.store.set("cart.promoCode",{code:s,discountAmount:a.discounts||0}),this.googleTagManager.promoCodeApplied(s,a.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(s,'Code "'+s+'" does not exist'))}catch(a){const t=(null==a?void 0:a.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.googleTagManager.promoCodeFailed(s,t),this.logger.error("Failed to apply promo code",a),a}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(e),"cart.promoCode":null}),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 n=this.store.get("cart.promoCode");throw(null==n?void 0:n.code)&&this.googleTagManager.promoCodeFailed(n.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...G,rerender:!![]}),this.store.set("cart",{...j,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(e.CART_RESET,!![])}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),r=n.id?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in e.items||{}){const t=e.items[a];s[a]={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||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:s,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:e.totals.deliveryFee,discounts:e.totals.discounts,engravingFee:e.totals.engravingFee,giftCardTotal:e.totals.giftCardTotal,platformFee:e.totals.platformFee,shippingFee:e.totals.shippingFee,subtotal:e.totals.subtotal,total:e.totals.total},itemCount:Object.values(s||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:e.updatedAt,createdAt:e.createdAt}}buildItemUpdate(t,e){var n,r,s;const a={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},l=(null===(s=null===(r=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];return l.length>0&&(a.engravingLines=l),a}syncItemsFromApiResponse(t,e=[]){var n;const r=this.store.get("cart.items")||{},s=new Set((null===(n=t.items)||void 0===n?void 0:n.map(t=>t.id))||[]);for(const l of Object.keys(r))s.has(l)||this.store.remove("cart.items."+l);const a={};for(const l of t.items)0!==e.length&&!e.includes(l.id)&&r[l.id]||(a["cart.items."+l.id]=buildCartItemStore(l));Object.keys(a).length>0&&this.store.batch(a)}syncCartMetaFromApiResponse(t){var e,n;const r={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},s=null===(n=null===(e=t.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value;if(s)r["cart.promoCode"]={code:s.toUpperCase(),discountAmount:t.discounts||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(r["cart.promoCode"]=null)}this.store.batch(r)}syncRetailersFromApiResponse(t){var e;if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0){const e={};for(const n of t.retailers)e["cart.retailers."+n.id]=buildRetailerStore(n);this.store.batch(e)}}updateFulfillment(t,e){var n,r;const s=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),a=null===(r=null==s?void 0:s.fulfillments)||void 0===r?void 0:r.find(e=>e.id===t);a&&s&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(a,s))}addNewFulfillmentAndRetailer(t,e){var n,r;const s=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),a=null===(r=null==s?void 0:s.fulfillments)||void 0===r?void 0:r.find(e=>e.id===t);if(a&&s){const e={["cart.fulfillments."+t]:buildFulfillmentStore(a,s),["cart.retailers."+s.id]:buildRetailerStore(s)};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,r,s,a;const l=this.store.get("cart.fulfillments."+t.fulfillmentId),d=this.store.get("cart.retailers."+t.retailerId);if(!l||!d)return;const u=null===(n=e.retailers)||void 0===n?void 0:n.some(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)}),h=null===(r=e.retailers)||void 0===r?void 0:r.some(e=>e.id===t.retailerId);if(u){this.updateFulfillment(t.fulfillmentId,e);const n=null===(a=e.retailers)||void 0===a?void 0:a.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),h){const n=null===(s=e.retailers)||void 0===s?void 0:s.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else this.store.remove("cart.retailers."+t.retailerId)}}function fulfillmentAddress(t,e){if(!t)return"";if(e===s.SHIPPING){const e=[t.city,t.state].filter(Boolean);return e.join(", ")}const n=[t.one,t.two,t.city,t.state].filter(Boolean);return n.join(", ")}const pt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],mt=1440;function timeToMinutes(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("Invalid time format: "+t);const n=Number.parseInt(e[1],10),r=Number.parseInt(e[2],10);if(n<0||n>47||r<0||r>59)throw new SDKError("Invalid time values: "+t);return 60*n+r}function getCurrentTimeInTimezone$1(t){var e,n,r;const s=new Date,a={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",a),l=t.formatToParts(s),d=(null===(e=l.find(t=>"weekday"===t.type))||void 0===e?void 0:e.value.toLowerCase())||"",u=(null===(n=l.find(t=>"hour"===t.type))||void 0===n?void 0:n.value)||"0",h=(null===(r=l.find(t=>"minute"===t.type))||void 0===r?void 0:r.value)||"0",p=60*Number.parseInt(u,10)+Number.parseInt(h,10);return{weekday:d,timeInMinutes:p}}catch(l){throw new SDKError("Invalid timezone: "+t)}}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e||"object"==typeof e)return t;let n=Number.parseInt(e[1],10);const r=e[2];n>=24&&(n-=24);const s=n>=12?"PM":"AM",a=0===n?12:n>12?n-12:n;return a+":"+r+" "+s}function isWithinTimeSlot(t,e){try{const n=timeToMinutes(e.startsAt),r=timeToMinutes(e.endsAt);if(r>mt){if(t>=n||t<r-mt)return"during"}else if(r<n){if(t>=n||t<r)return"during"}else if(t>=n&&t<r)return"during";return t<n?"before":"after"}catch(n){return"after"}}function getNextOpeningTime(t,e,n=7){var r,s;const a=pt.indexOf(e);for(let d=1;d<=n;d++){const e=(a+d)%7,n=pt[e],u=t[n];if((null==u?void 0:u.active)&&u.times&&u.times.length>0)try{const t=1===d?"tomorrow":n;return"Opens "+t+" at "+format24TimeTo12(null!==(s=null===(r=null==u?void 0:u.times[0])||void 0===r?void 0:r.startsAt)&&void 0!==s?s:"")}catch(l){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var e;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==s.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:n,timeInMinutes:r}=getCurrentTimeInTimezone$1(t.timezone),s=t.hours[n];if(!(null==s?void 0:s.active)||!(null===(e=s.times)||void 0===e?void 0:e.length)){const e=getNextOpeningTime(t.hours,n);return{message:e,isOpen:![],isClosed:!![]}}for(const t of s.times){const e=isWithinTimeSlot(r,t);switch(e){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let e=t.endsAt;const n=timeToMinutes(e);if(n>mt){const t=Math.floor(n/60)-24,r=n%60;e=t.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(e),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const a=getNextOpeningTime(t.hours,n);return{message:a,isOpen:![],isClosed:!![]}}catch(n){return{message:null,isOpen:![],isClosed:!![]}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.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 r=[];for(const a of n.products){const s=a.sizes.filter(e=>t.some(t=>t===(e.upc||e.id||a.salsifyGrouping))),l=t.find(t=>s.some(e=>t===e.upc||t===e.id)||t===a.salsifyGrouping),d=l||(null===(e=null==s?void 0:s[0])||void 0===e?void 0:e.upc);await this.loadProduct(d,{products:[a],retailers:n.retailers}),r.push(d)}const s=t.filter(t=>-1===r.indexOf(t));this.store.batch(s.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,n=null){var r,s;try{const a=this.store.get("products."+t);a.loading||this.store.set("products."+t+".loading",!![]);let l=null;if(n&&(l=n),n||(l=await this.api.getProductsData([t],this.getLocation())),!l||!(null===(r=null==l?void 0:l.products)||void 0===r?void 0:r[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(l);if(!d)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...d,identifier:t}),this.pubSub.publishAction(e.PRODUCT_LOADED,this.productDataForEventFromStore(t));const u=l.products[0],h=d.sizes[d.selectedSizeId||""],p=Boolean(this.getLocation()),m=d.selectedFulfillment,f=p&&(null==m?void 0:m.price)?m.price:(null===(s=d.priceInfo)||void 0===s?void 0:s.avg)||0,g=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==h?void 0:h.id,item_name:u.name,item_brand:u.brand,item_size:null==h?void 0:h.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(f),item_type:u.type,item_subtype:u.subType,upc:null==h?void 0:h.upc,grouping_id:u.salsifyGrouping,product_id:null==h?void 0:h.id})}catch(a){throw this.store.set("products."+t+".error",a.message),this.logger.error("Failed to load product data for ID "+t,a),a}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,n){var r,a,l,d,u,h,p;const m=this.store.get("products."+t);let f=m.selectedFulfillmentType;const g=null===(r=m.sizes[n])||void 0===r?void 0:r.shippingFulfillments,v=null===(a=m.sizes[n])||void 0===a?void 0:a.onDemandFulfillments;let y=null,b=null;if(f!==s.SHIPPING||Object.values(g).length)if(f!==s.ON_DEMAND||Object.values(v).length){const t=f===s.SHIPPING?g:v,e=Object.values(t);y=e[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=s.SHIPPING;const t=Object.values(g);y=t[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=s.ON_DEMAND;const t=Object.values(v);y=t[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}const x=f===s.SHIPPING?g:v,w=m.sizes[n],C=splitCategoryPath(m.catPath),k=(null==y?void 0:y.price)||(null===(l=m.priceInfo)||void 0===l?void 0:l.avg)||0;this.googleTagManager.viewItem({item_id:null==w?void 0:w.id,item_name:m.name,item_brand:m.brand,item_size:null==w?void 0:w.size,item_category:C.category,item_category2:C.category2,item_category3:C.category3,price:centToDollar(k),item_type:m.type,item_subtype:m.subType,upc:null==w?void 0:w.upc,grouping_id:m.salsifyGrouping,product_id:null==w?void 0:w.id});const S=Object.keys(g).length>0,E=Object.keys(v).length>0,_=S||E;if(!_){const t=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==w?void 0:w.id,productName:m.name,productBrand:m.brand,productCategory:C.category,productCategory2:C.category2,productCategory3:C.category3,productType:m.type,productSubtype:m.subType,productPrice:(null===(d=m.priceInfo)||void 0===d?void 0:d.avg)||0,sizeId:n,sizeName:null==w?void 0:w.size,upc:null==w?void 0:w.upc,groupingId:m.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(e.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,size:(null===(u=m.sizes[n])||void 0===u?void 0:u.size)||"",previousSizeId:m.selectedSizeId||"",previousSize:(null===(h=m.sizes[m.selectedSizeId])||void 0===h?void 0:h.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".mainImage"]:(null===(p=m.sizes[n])||void 0===p?void 0:p.image)||null,["products."+t+".productHasAvailability"]:Object.keys(g).length+Object.keys(v).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(x).length),["products."+t+".selectedFulfillmentType"]:f,["products."+t+".selectedFulfillment"]:y,["products."+t+".selectedFulfillmentId"]:b})}async selectFulfillment(t,n){var r,a,l;const d=this.store.get("products."+t),u=null===(r=d.sizes[d.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments,h=null===(a=d.sizes[d.selectedSizeId])||void 0===a?void 0:a.onDemandFulfillments,p=d.selectedFulfillmentType===s.SHIPPING?u:h,m=p[n];this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId||"",previousFulfillmentType:d.selectedFulfillmentType});const f=d.sizes[d.selectedSizeId||""],g=splitCategoryPath(d.catPath),v=(null==m?void 0:m.price)||(null===(l=d.priceInfo)||void 0===l?void 0:l.avg)||0;this.googleTagManager.viewItem({item_id:null==f?void 0:f.id,item_name:d.name,item_brand:d.brand,item_size:null==f?void 0:f.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(v),item_type:d.type,item_subtype:d.subType,upc:null==f?void 0:f.upc,grouping_id:d.salsifyGrouping,product_id:null==f?void 0:f.id}),this.store.batch({["products."+t+".selectedFulfillment"]:m,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".quantity"]:1})}async updateQuantity(t,n){var r;const s=this.store.get("products."+t),a=s.quantity,l=a+n,d=1,u=(null===(r=null==s?void 0:s.selectedFulfillment)||void 0===r?void 0:r.stock)||5,h=Math.max(d,Math.min(u,l));this.pubSub.publishAction(n<0?e.PRODUCT_QUANTITY_DECREASE:e.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:h,previousQuantity:a}),this.store.set("products."+t+".quantity",h)}async changeFulfillmentType(t,n){var r,a,l;const d=this.store.get("products."+t),{shippingFulfillments:u,onDemandFulfillments:h}=d.sizes[d.selectedSizeId],p=n===s.SHIPPING?u:h,m=Object.values(p);if(0===m.length){this.logger.warn("No fulfillments available for type "+n+" on product "+t);const e=this.store.get("address"),s=d.sizes[d.selectedSizeId],l=splitCategoryPath(d.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==s?void 0:s.id,productName:d.name,productBrand:d.brand,productCategory:l.category,productCategory2:l.category2,productCategory3:l.category3,productType:d.type,productSubtype:d.subType,productPrice:(null===(r=d.priceInfo)||void 0===r?void 0:r.avg)||0,sizeId:null!==(a=d.selectedSizeId)&&void 0!==a?a:void 0,sizeName:null==s?void 0:s.size,fulfillmentType:n,upc:null==s?void 0:s.upc,groupingId:d.salsifyGrouping,address:(null==e?void 0:e.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||""}:void 0,reason:"No "+n+" fulfillments available for selected size"}),void 0}const f=m[0]||null,g=(null==f?void 0:f.fulfillmentId)||null;this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:g,previousFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId,fulfillmentHasAvailability:m.length>0});const v=d.sizes[d.selectedSizeId||""],y=splitCategoryPath(d.catPath),b=(null==f?void 0:f.price)||(null===(l=d.priceInfo)||void 0===l?void 0:l.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:d.name,item_brand:d.brand,item_size:null==v?void 0:v.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(b),item_type:d.type,item_subtype:d.subType,upc:null==v?void 0:v.upc,grouping_id:d.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:n,["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:g,["products."+t+".fulfillmentHasAvailability"]:m.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const r={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:r})}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(r.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),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.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const r=t[n];e[n]={retailerId:r.retailerId,retailerName:r.retailerName,retailerAddress:r.retailerAddress,retailerTimezone:r.timezone,price:r.price,partNumber:r.partNumber,stock:r.stock,isEngravable:r.isVariantEngravable,fulfillmentId:r.fulfillmentId,fulfillmentType:r.fulfillmentType,modalities:r.modalities||[]}}return e};for(const r in e.sizes||{}){const t=e.sizes[r];n[r]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:{engraving:t.attributes.engraving||void 0,presale:t.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentId:e.selectedFulfillmentId||null,selectedFulfillmentType:e.selectedFulfillmentType,id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,salsifyGrouping:e.salsifyGrouping,subType:e.subType,mainImage:e.mainImage||null,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,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,priceInfo:e.priceInfo||null,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},r=Object.values(t).length,s=Object.values(e).length;if(r+s>0)return n.id}return null}loadProductStoreUpdate(t){var e,n,r,a,l,d,u,h,p,m,f;try{const{products:[g,...v],retailers:y}=t,b=this.themeProvider.getConfigs("product"),x={};let w=![],C=![],k="",S=null,E=b.layout.enableShippingFulfillment?s.SHIPPING:s.ON_DEMAND,_=null,D=null;const T={};if(y&&Array.isArray(y)&&y.length>0)for(const t of y)for(const e of t.fulfillments){const n={retailerName:t.name,retailerAddress:t.address||null,type:e.type,timezone:e.timezone||"",canEngrave:e.canEngrave||![],expectation:e.expectation,fees:e.fees,hours:e.hours,retailerId:t.id,fulfillmentId:e.id,fulfillmentType:e.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]},r=getRetailerOffHours(n);r.isClosed&&!b.layout.showOffHours||(T[e.id]=n)}if(g.sizes&&Array.isArray(g.sizes)&&g.sizes.length>0)for(const t of g.sizes){const l={},d={};for(const u of t.variants){if((null===(e=null==u?void 0:u.fulfillmentTypes)||void 0===e?void 0:e.onDemand)&&""!==u.fulfillmentTypes.onDemand){const t=u.fulfillmentTypes.onDemand,e=T[t];e?d[t]={...e,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:t,fulfillmentType:s.ON_DEMAND,modalities:[...e.modalities,...null!==(n=null==u?void 0:u.modalities)&&void 0!==n?n:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+t)}if((null===(r=null==u?void 0:u.fulfillmentTypes)||void 0===r?void 0:r.shipping)&&""!==u.fulfillmentTypes.shipping){const t=u.fulfillmentTypes.shipping,e=T[t];e?l[t]={...e,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:t,fulfillmentType:s.SHIPPING,modalities:[...e.modalities,...null!==(a=null==u?void 0:u.modalities)&&void 0!==a?a:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+t)}}x[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:l,onDemandFulfillments:d}}const I=Object.values(x),F=this.findFirstAvailableSize(x);k=F||I[0]&&I[0].id||"",S=(null===(l=x[k])||void 0===l?void 0:l.image)||null;const A=(null===(d=x[k])||void 0===d?void 0:d.shippingFulfillments)||{},O=(null===(u=x[k])||void 0===u?void 0:u.onDemandFulfillments)||{},N=Object.values(A).length,L=Object.values(O).length;w=N+L>0;const M=E===s.SHIPPING?Object.values(A):Object.values(O);if(C=M.length>0,D=M[0]||null,_=(null==D?void 0:D.fulfillmentId)||null,!C){const t=E===s.SHIPPING?s.ON_DEMAND:s.SHIPPING,e=t===s.SHIPPING?Object.values(A):Object.values(O);e.length>0&&(E=t,D=e[0],_=(null==D?void 0:D.fulfillmentId)||null,C=!![])}if(!w){const t=this.store.get("address"),e=splitCategoryPath(g.catPath),n=x[k];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:g.name,productBrand:g.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:g.type,productSubtype:g.subType,productPrice:(null===(h=g.priceInfo)||void 0===h?void 0:h.average)||0,upc:null==n?void 0:n.upc,groupingId:g.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:g.id||"",name:g.name,description:g.description,htmlDescription:g.htmlDescription,images:g.images,priceInfo:{min:(null===(p=g.priceInfo)||void 0===p?void 0:p.minimum)||0,max:(null===(m=g.priceInfo)||void 0===m?void 0:m.maximum)||0,avg:(null===(f=g.priceInfo)||void 0===f?void 0:f.average)||0},brand:g.brand,region:g.region||"",country:g.country||"",material:g.material||"",abv:g.abv||"",proof:g.proof||"",age:g.age||"",color:g.color||"",flavor:g.flavor||"",variety:g.variety||"",appellation:g.appellation||"",vintage:g.vintage||"",tastingNotes:g.tastingNotes||"",catPath:g.catPath,category:g.category,classification:g.classification,type:g.type,subType:g.subType,salsifyGrouping:g.salsifyGrouping,sizes:x,productHasAvailability:w,fulfillmentHasAvailability:C,selectedSizeId:k,mainImage:S,selectedFulfillmentType:E,selectedFulfillmentId:_,selectedFulfillment:D,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(g){throw this.logger.error("Product data processing error",g),g}}}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=buildFormattedAddressString(t),r={id:"",formattedAddress:e,address:t,coordinates:n};await this.setSelectedAddress(r)}catch(r){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country||""},error:(null==r?void 0:r.message)||"Failed to set manual address"}),this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:n,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}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}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){var e,n;const r=t,s=this.clientConfig.getConfigs();r.entity=null!==(n=null!==(e=window.location.hostname)&&void 0!==e?e:s.partnerName)&&void 0!==n?n:void 0,r.visitorId=s.userDeviceId,r.loc=this.getLocation(),r.isLegacy=!![];const a=await this.api.catalogSearch(r);return a.products&&a.products.length>0&&this.trackViewItemList(a.products),a}async addToCart(t){try{this.uiCommands.openDrawer(r.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.cartCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT)}catch(e){throw this.logger.error("Error adding presale product to cart from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=t.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(e,"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,r;const s=null===(e=t.sizes)||void 0===e?void 0:e[0],a=null===(n=null==s?void 0:s.variants)||void 0===n?void 0:n[0],l=splitCategoryPath(t.catPath);return{item_id:null==s?void 0:s.id,item_name:t.name,item_brand:t.brand,item_size:null==s?void 0:s.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:(null==a?void 0:a.price)?centToDollar(a.price):(null===(r=t.priceInfo)||void 0===r?void 0:r.average)?centToDollar(t.priceInfo.average):void 0,item_type:t.type,item_subtype:t.subType,upc:null==s?void 0:s.upc,grouping_id:t.salsifyGrouping,product_id:null==s?void 0:s.id,item_list_id:"product_list",item_list_name:"Product List"}}}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 ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async 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.coords,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(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.lat||"number"!=typeof e.long)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.lat+", long: "+typeof e.long,!![]);if(e.lat<-90||e.lat>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.lat,!![]);if(e.long<-180||e.long>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.long,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(r.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CART)},addProduct:async(t,n)=>{var a,l;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const d=this.getLocation();if(void 0===d)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(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(r.CART);const u=[...new Set(t.map(t=>t.identifier))],h=await this.api.getProductsData(u,d);if(!h||!h.products||0===h.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const e of t){let t=null;for(let s=0;s<h.products.length;s++){const n=h.products[s];let r=![];for(let t=0;t<n.sizes.length;t++){const s=n.sizes[t];if(s.upc===e.identifier||s.id===e.identifier||n.salsifyGrouping===e.identifier){r=!![];break}}if(r){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(l=null===(a=null==n?void 0:n.attributes)||void 0===a?void 0:a.presale)||void 0===l?void 0:l.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 r=null;for(let a=0;a<n.variants.length;a++){const t=n.variants[a];let l=![];if(e.fulfillmentType===s.ON_DEMAND&&(l=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),e.fulfillmentType===s.SHIPPING&&(l=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),l){r=t;break}}if(!r){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 d=e.fulfillmentType===s.ON_DEMAND?r.fulfillmentTypes.onDemand:r.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:n.upc,fulfillmentId:d,partNumber:r.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(e.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:u}),this.logger.info("Products added to cart successfully:",u)}catch(d){throw this.logger.error("Error adding products to cart:",d),this.clearPendingCartOperation(),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:d.message||"Failed to add products to cart"}),d}},applyPromoCode:async 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(),r=this.themeProvider.getConfigs("global"),s=r.layout.allowPromoCodes;if(!s)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const a=this.store.get("cart.promoCode");if(a&&a.code===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const l=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:l.amounts.discounts,newTotal:l.amounts.total}),this.logger.info("Promo code applied successfully")}catch(n){throw this.logger.error("Failed to apply promo code:",n),this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{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(),this.pubSub.publishAction(e.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(e.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(r.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)},addProduct:async(t,n)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const s=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:s}),this.logger.info("Products added to checkout successfully:",s)}catch(s){throw this.logger.error("Error adding products to checkout:",s),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to checkout"}),s}},addPresaleProduct:async t=>{var n,a;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const l=this.getLocation();if(void 0===l)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const d=await this.api.getProductsData([t.identifier],l);if(!d||!d.products||0===d.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const u=d.products[0],h=u.sizes[0];if(!h)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(a=null===(n=null==h?void 0:h.attributes)||void 0===n?void 0:n.presale)||void 0===a?void 0:a.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let p=null;for(let e=0;e<h.variants.length;e++){const n=h.variants[e];let r=![];if(t.fulfillmentType===s.ON_DEMAND&&(r=!(!n.fulfillmentTypes||!n.fulfillmentTypes.onDemand||""===n.fulfillmentTypes.onDemand)),t.fulfillmentType===s.SHIPPING&&(r=!(!n.fulfillmentTypes||!n.fulfillmentTypes.shipping||""===n.fulfillmentTypes.shipping)),r){p=n;break}}if(!p)return this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const m=t.fulfillmentType===s.ON_DEMAND?p.fulfillmentTypes.onDemand:p.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:h.upc,fulfillmentId:m,partNumber:p.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(r.CHECKOUT),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(l){throw this.logger.error("Error adding presale product to checkout:",l),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:l.message||"Failed to add presale product to checkout",isPresale:!![]}),l}},applyPromoCode:async 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 r=t.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const l=this.store.get("checkout.promoCode");if(l&&l.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const d=this.store.get("checkout"),u=null==d?void 0:d.promoCode;this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==u?void 0:u.discountAmount)||0,newTotal:(null===(n=null==d?void 0:d.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(r){throw this.logger.error("Failed to apply checkout promo code:",r),this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{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("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode(),this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove checkout promo code:",t),t}},applyGiftCard:async t=>{var n;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)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 a=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(n=null==a?void 0:a.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){throw this.logger.error("Failed to apply gift card:",r),this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),r}},removeGiftCard:async t=>{try{const n=this.themeProvider.getConfigs("checkout"),r=n.layout.allowGiftCards;if(!r)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),this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(n){throw this.logger.error("Failed to remove gift card:",n),this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),n}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,e)=>{this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of Object.entries(t))this.command.checkout.updateCustomerInfo(e,n)},updateBillingInfo:t=>{for(const[e,n]of Object.entries(t))this.command.checkout.updateBillingInfo(e,n)},updateGiftInfo:t=>{for(const[e,n]of Object.entries(t))this.command.checkout.updateGiftInfo(e,n)},getDetails:()=>{var t,e,n;const r=this.store.get("checkout"),s=r.items||{},a={};for(const[l,d]of Object.entries(s))a[l]={liquidId:d.liquidId,variantId:d.variantId,cartItemId:l,retailerId:d.retailerId,fulfillmentId:d.fulfillmentId,salsifyGrouping:d.salsifyGrouping,name:d.name,catPath:d.catPath,volume:d.volume,uom:d.uom,proof:d.proof,abv:d.abv,containerType:d.containerType,container:d.container,size:d.size,pack:d.pack,packDesc:d.packDesc,mainImage:d.mainImage,brand:d.brand,partNumber:d.partNumber,upc:d.upc,sku:d.sku,price:d.price,unitPrice:d.unitPrice,quantity:d.quantity,unitTax:d.unitTax,bottleDeposits:d.bottleDeposits,attributes:d.attributes,retailerName:d.retailerName,expectationDetail:d.expectationDetail};return{cartId:r.cartId||"",acceptedAccountCreation:r.acceptedAccountCreation,hasAgeVerify:r.hasAgeVerify||![],hasSubstitutionPolicy:r.hasSubstitutionPolicy,isGift:r.isGift||![],billingSameAsShipping:r.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=r.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(e=r.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:!!(null===(n=r.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(r.giftCards)&&r.giftCards.length>0,itemCount:Object.values(a||{}).reduce((t,e)=>t+(e.quantity||0),0),amounts:r.amounts,items:a}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const c=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+e.ADDRESS_UPDATED,c)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const ft="\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 gap: 2px;\n flex: 1;\n margin: 0 12px;\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 gap: 12px;\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 .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\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 gap: 8px;\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: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 gap: 2px;\n min-width: 50px;\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 gap: 8px;\n flex-wrap: wrap;\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 gap: 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 gap: 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",gt="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[r,s]of e)this.interceptLoggerInstance(s,r);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.o)return;const n=t.debug.bind(t),r=t.info.bind(t),s=t.warn.bind(t),a=t.error.bind(t),H=(t,n,r)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:r,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(H("debug",t,e))},t.info=(t,e)=>{r(t,e),this.addLogEntry(H("info",t,e))},t.warn=(t,e)=>{s(t,e),this.addLogEntry(H("warn",t,e))},t.error=(t,e)=>{a(t,e),this.addLogEntry(H("error",t,e))},t.o=!![]}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,r)=>{e(t,n,r),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:r,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(gt);t&&t.remove(),this.panelElement=document.createElement(gt);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=ft,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 r=this.createToggles();this.panelContainer.appendChild(r),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const s=this.createResizeHandle();this.panelContainer.appendChild(s),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 r=document.createElement("div");r.className="title",r.textContent="Elements Debug Console";const s=document.createElement("div");s.className="subtitle",s.textContent="Live SDK logs, events & GTM tracking",n.appendChild(r),n.appendChild(s);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(a),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:r,color:s})=>{const a=document.createElement("label");a.className="toggle",a.title=r;const l=document.createElement("input");l.type="checkbox",l.checked="showLogs"!==e,l.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 d=document.createElement("span");d.textContent=n,d.style.color=s,a.appendChild(l),a.appendChild(d),t.appendChild(a)});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,r=0,s=0,a=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,r=t.clientY,s=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",z),document.addEventListener("mouseup",q),t.preventDefault()});const z=t=>{if(!e||!this.panelElement)return;const l=t.clientX-n,d=t.clientY-r,u=window.innerWidth<=768,h=window.innerWidth<=480;let p,m,f,g;h?(p=280,m=window.innerWidth-20,f=200,g=.4*window.innerHeight):u?(p=300,m=window.innerWidth-30,f=200,g=.4*window.innerHeight):(p=300,m=800,f=200,g=600);const v=Math.max(p,Math.min(m,s+l)),y=Math.max(f,Math.min(g,a+d));this.panelElement.style.width=v+"px",this.panelElement.style.height=y+"px"},q=()=>{e=![],document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",q)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,r=0,s=0,a=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,r=e.clientY;const l=this.panelElement.getBoundingClientRect();s=l.left,a=l.top,document.addEventListener("mousemove",z),document.addEventListener("mouseup",q),e.preventDefault()});const z=e=>{if(!t||!this.panelElement)return;const l=e.clientX-n,d=e.clientY-r;this.panelElement.style.left=s+l+"px",this.panelElement.style.top=a+d+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},q=()=>{t=![],document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",q)}}}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.keyPrefix=R,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.l()){const e=this.u(t);if(e)return this.h(t,e)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const e=this.h(t,this.cachedFingerprint);if(this.l())try{const t=this.keyPrefix+"_"+e;localStorage.setItem(t,Date.now().toString())}catch(n){}return e}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(t,e){return(t+"_"+e).toLowerCase()}l(){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 r=t.getItem(e);return r!==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.S()&&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,r=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+r+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const e=this.keyPrefix+"_"+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}}m(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this._(e)}v(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,r=this.D(),s=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+r+"|"+s}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(M){}return"srgb"}C(){var t;try{const e=navigator,n=[],r=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(r),n.push(e.hardwareConcurrency||4);const s=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(s),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.P()),n.push(this.S()?"webview":"browser");const a=["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(a.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){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"}}S(){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![]}}k(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}_(t){const e=16777619;let n=2166136261,r=2166136261,s=2166136261,a=2166136261;for(let l=0;l<t.length;l++){const d=t.charCodeAt(l);n^=d,n=Math.imul(n,e),r^=d<<1,r=Math.imul(r,e),s^=d<<2,s=Math.imul(s,e),a^=d<<3,a=Math.imul(a,e)}return n=Math.abs(n),r=Math.abs(r),s=Math.abs(s),a=Math.abs(a),n.toString(16)+r.toString(16)+s.toString(16)+a.toString(16)}}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:!![],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 r=Date.now();try{const s={eventId:"event_"+r+"}",timestamp:r,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(s)}catch(s){this.handleInternalError(s)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code,statusCode:t.status||t.statusCode}}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(r){this.stats.failedBatches++,this.handleInternalError(r),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++}}}}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.T=Object.freeze(t),this.I=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 r=this.T[n];return null==r?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(r)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.I.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"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.I)||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.I)||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(r){this.logger.error("Component setup error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"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),r=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(r),this.logger.debug("🔥 AutoDestroy enabled for "+this.I.tagName+" watching path: "+n)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.I.tagName+' - path "'+t+'" was removed'),null===(e=this.beforeAutoDestroy)||void 0===e||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.I.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.T)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(", "),r="store:["+n+"]",s=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);s!==![]&&this.triggerRender(r)}catch(r){this.logger.error("Store watcher callback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.I)||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.T)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(r){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.I)||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 s=performance.now()-n;this.logRenderInfo(s);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(r){this.logger.error("❌ afterRender hook error in "+this.I.tagName,r),r instanceof Error&&this.captureComponentError(r,"afterRender")}}catch(s){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.I.tagName,s),this.captureComponentError(s,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.I.type,message:s instanceof Error?s.message:String(s)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,s,"render")}catch(a){this.logger.error("❌ onError hook error in "+this.I.tagName,a)}}}logRenderInfo(t){const e=this.I.type,n=this.I.tagName,r=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+r+" "+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.I.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.I.tagName+":"+e,component:{type:this.I.type,tagName:this.I.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.I.useShadowDom}})}catch(r){}}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.T}get config(){return this.themeProvider.getComponentConfig(this.I.type)}get elementConfig(){return this.I}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}}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:r.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,s;const a=this.getStoreValue("address"),l=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],d=null!==(e=this.params.productId)&&void 0!==e?e:"",u=null!==(n=this.params.options)&&void 0!==n?n:{},h=null!==(s=u.showLabel)&&void 0!==s?s:!![],p=[];if(h){const t=document.createElement("span");t.textContent="Delivers to:",p.push(t)}const m=document.createElement("button");m.type="button",m.textContent=a.formattedAddress||"Select an address";const f=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return m.setAttribute("aria-label",f),m.addEventListener("click",async()=>{if(l)return this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!l&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,r.ADDRESS_INPUT,{productId:d}))}),p.push(m),p}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:r=null})=>{const s=r?"--icon-color: "+r:"";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="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+s+'" 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'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";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="'+s+'" 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 '},CloseIcon=({width:t=16,height:e=16,className:n="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r||"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="'+s+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+s+'" 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:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+s+'" 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 '};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.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const r=/^\d/.test(n);if(n.length<this.minSearchLength||!r)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(n)},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(M){this.logger.error("Address edit cancellation failed",M)}},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.lat)!==this.selectedAddress.coordinates.lat||(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;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.coords,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 r=this.getConfigs("global"),s=null!==(t=this.params.options)&&void 0!==t?t:{},a=null!==(e=s.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),a){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const l=this.createElement("div",{className:"input-wrapper "+r.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),l.appendChild(this.inputElement);const d=this.createElement("span");d.className="input-icon",d.innerHTML=SearchIcon({width:16,height:16,className:""}),l.appendChild(d),this.inputContainer.appendChild(l),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 u=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),h=[this.inputContainer,u,this.errorContainer],p=this.createElement("div",{className:"action-buttons"}),m=this.createCancelButton();p.appendChild(m);const f=this.createCheckButton();return p.appendChild(f),h.push(p),document.addEventListener("click",this.handleDocumentClick),h}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 t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:r.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:r.CART_BODY});t.push(n);const s=ComponentFactoryService.createElement({type:r.CART_FOOTER});return t.push(s),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}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:r.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 r=this.createRetailerElement(e);r.setAttribute("data-retailer-id",t),n.replaceWith(r)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,r]of Object.entries(t))r&&"object"==typeof r&&r.id&&(e[n]=r);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),r=this.getValidRetailerIds(e.oldValue),s=this.getValidRetailerIds(e.value),a=r.size,l=s.size,d=this.getValidRetailers(this.getStoreValue("cart.retailers")),u=Object.keys(d).length;if(l>0&&0===u)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===a&&l>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(a>0&&0===l)this.showEmptyCartState();else if(l>0){for(const t of r)s.has(t)||this.removeRetailerElement(t);for(const e of s){const s=n[e],a=t[e];r.has(e)?this.hasRetailerDataChanged(a,s)&&this.updateRetailerElement(e,s):this.addRetailerElement(e,s)}}else 0===a&&0===l&&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 r of e){const t=this.createRetailerElement(r);t.setAttribute("data-retailer-id",r.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","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.totals")),r=t.some(t=>t.path.includes("cart.fulfillments")),s=t.some(t=>"cart.loading"===t.path),a=t.some(t=>t.path.includes("cart.retailers"));if(e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice){const t=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(t.subtotal+t.engravingFee-t.discounts)}(r||n||s||e||a)&&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 r=this.getStoreValue("cart.fulfillments")||{},s=Object.values(r).some(t=>t.updating);if(s)return!![];const a=this.getStoreValue("cart.retailers")||{},l=Object.values(a).some(t=>t.updating);return l?!![]:![]}hasUnmetMinimum(t){var e;const n=t.subtotal;if(t.type===s.SHIPPING){const r=t.fees;if((null===(e=r.individual)||void 0===e?void 0:e.active)&&r.individual.min>0&&n<r.individual.min)return!![]}if(t.type===s.ON_DEMAND){const e=t.fees;if(e.min>0&&n<e.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),r=t||n||!e;this.checkoutButton.disabled=r,this.checkoutButton.classList.toggle("checkout-btn-disabled",r),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.totals"),n=[],s=document.createElement("div");s.className="cart-footer-header";const a=document.createElement("div");a.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",a.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e.subtotal+e.engravingFee-e.discounts),a.appendChild(this.subtotalPrice);const l=document.createElement("p");if(l.textContent="Taxes & fees will be calculated at checkout",l.className="taxes-fees-info",s.appendChild(a),s.appendChild(l),n.push(s),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:r.CART_PROMO_CODE});n.push(t)}const d=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(d),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))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});n.push(t)}return n}}const shouldShowMinimumPurchaseAlert=(t,e=![])=>{var n,r;const a=t.subtotal;if(t.type===s.SHIPPING){const s=t.fees;if(e&&(null===(n=s.pack)||void 0===n?void 0:n.active)&&s.pack.min>0&&a<s.pack.min)return!![];if(!e&&(null===(r=s.individual)||void 0===r?void 0:r.active)&&s.individual.min>0&&a<s.individual.min)return!![]}else if(t.type===s.ON_DEMAND){const e=t.fees;if(e.min>0&&a<e.min)return!![]}return![]},getMinimumPurchaseMessage=(t,e=![])=>{var n,r;const a=t.subtotal;if(t.type===s.SHIPPING){const s=t.fees;let l=0;if(e&&(null===(n=s.pack)||void 0===n?void 0:n.active)&&s.pack.min>0?l=s.pack.min:(null===(r=s.individual)||void 0===r?void 0:r.active)&&s.individual.min>0&&(l=s.individual.min),l>0&&a<l)return{message:"+"+formatCentToDollarText(l-a)+" needed for order minimum",type:"warning"}}if(t.type===s.ON_DEMAND){const e=t.fees,n=e.min>0?e.min:0;if(n>0&&a<n)return{message:"+"+formatCentToDollarText(n-a)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,e=![])=>{var n,r;const a=t.subtotal;if(t.type===s.SHIPPING){const s=t.fees;if(e&&(null===(n=s.pack)||void 0===n?void 0:n.active)&&s.pack.min>0&&a<s.pack.min)return!![];if(!e&&(null===(r=s.individual)||void 0===r?void 0:r.active)&&s.individual.min>0&&a<s.individual.min)return!![]}if(t.type===s.ON_DEMAND){const e=t.fees;if(e.min>0&&a<e.min)return!![]}return![]};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},r=e[this.params.messageType]||"warning",s=document.createElement("div");return s.className="alert-icon alert-icon-"+this.params.messageType,s.appendChild(htmlStringToElement(n[r]({width:16,height:16,className:"alert-icon-svg"}))),s}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const r=document.createElement("span");if(r.className="alert-message",r.textContent=this.params.message,e.push(r),"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),e.push(t)}return e}}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}getProductStore(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(e).find(e=>e.fulfillmentId===t)}handleItemsUpdate(t,e){const n=new Set(t||[]),s=new Set(e||[]);for(const r of n)if(!s.has(r)){const t=this.container.querySelector('[data-item-id="'+r+'"]');t&&t.remove()}for(const a of s)if(!n.has(a)){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:a});t.setAttribute("data-item-id",a),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||[],n=this.container.querySelectorAll("[data-item-id]");for(const r of n)r.remove();for(const s of e){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:s});t.setAttribute("data-item-id",s),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const e=this.getFulfillmentId(),n=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],s=this.getStoreValue("cart.fulfillments."+e),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(s,n)){const t=getMinimumPurchaseMessage(s,n),e=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}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.items)||void 0===t?void 0:t.length)?n.items.some(t=>{const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.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,r=t.find(t=>t.path===n),s=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(s.length>0&&this.checkAndUpdateLoadingState(),r){const t=r.oldValue,e=r.value,n=(null==t?void 0:t.items)||[],s=(null==e?void 0:e.items)||[],a=JSON.stringify(n)!==JSON.stringify(s);a&&(this.handleItemsUpdate(n,s),this.checkAndUpdateLoadingState());const l=this.hasFulfillmentFeesChanged(t,e),d=this.hasFulfillmentDataChanged(t,e,["items","updating"]);if(l&&!d&&this.setupMinimumPurchaseAlert(),!d)return![]}return![]}hasFulfillmentFeesChanged(t,e){return t?t.subtotal!==e.subtotal||t.shippingFee!==e.shippingFee||t.deliveryFee!==e.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(e.fees):!![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const r=["type","canEngrave","retailerId"];for(const s of r)if(!n.includes(s)&&t[s]!==e[s])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const vt={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"},yt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=vt[e];return n||yt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return yt}}function getCurrentTimeInTimezone(t){try{const e=new Date,n=e.getTime(),r=6e4*e.getTimezoneOffset(),s=new Date(n+r),a=new Date(s.toLocaleString("en-US",{timeZone:t})),l=s.getTime()-a.getTime();return new Date(n+l)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:r}=t;try{const t=getCurrentTimeInUserTimezone(r),s=!e||t>=new Date(e),a=!n||t<=new Date(n);return s&&a}catch(s){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 s=this.config.layout.drawerHeaderText,a=this.getConfigs("global"),l=document.createElement("div");l.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=s,l.appendChild(d);const u=document.createElement("button");u.type="button",u.className="cart-header-close-btn",u.innerHTML=CloseIcon({width:16,height:16}),u.setAttribute("aria-label","Close cart drawer"),u.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),l.appendChild(u);const h=this.clientConfig.get("promoTicker"),p=null!==(e=null===(t=null==a?void 0:a.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],m=null!=h?h:p,f=this.store.get("address"),g=hasActiveItems(m,null===(n=null==f?void 0:f.address)||void 0===n?void 0:n.state);if(!m.length||!g)return[l];const v=ComponentFactoryService.createElement({context:"cart",type:r.PROMO_CODE_TICKER,tickers:m});return[l,v]}}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){var n,s,a,l,d,u,h,p,m,f;this.commands.ui.openDrawer(r.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(s=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.lines)||[],maxLines:(null===(l=null===(a=e.attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.maxLines)||1,maxCharsPerLine:(null===(u=null===(d=e.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,fee:(null===(p=null===(h=e.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.fee)||0,location:null===(f=null===(m=e.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location})}template(){var t,e,n,s,a,l,d,u,h;const p=this.params.itemId,m=this.getStoreValue("cart.items."+p),f=this.getConfigs("global"),g=this.getStoreValue("cart.fulfillments."+m.fulfillmentId),v=m.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==g?void 0:g.expectation)||void 0===t?void 0:t.detail)||"",y=document.createElement("article");y.className="cart-item";const b=document.createElement("div");b.className="item-image";const x=document.createElement("img");x.src=m.mainImage,x.alt=m.name,b.appendChild(x);const w=document.createElement("div");w.className="item-details";const C=document.createElement("div");C.className="item-header";const k=document.createElement("h3");k.className="item-title",k.textContent=m.name;const S=document.createElement("button");S.className="item-delete",S.innerHTML=TrashIcon({}),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-label","Remove "+m.name+" from cart"),S.setAttribute("aria-expanded","true"),S.addEventListener("click",async()=>{await this.commands.cart.removeItem(p)}),S.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(p))}),C.appendChild(k),C.appendChild(S);const E=document.createElement("div");E.className="item-specs",E.textContent=m.size+", "+m.container;const _=document.createElement("div");_.className="item-shipping-container";const D=document.createElement("div");if(D.className="item-shipping",D.textContent=v,_.appendChild(D),f.layout.enablePersonalization&&(null===(n=null===(e=null==m?void 0:m.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.isEngravable)&&(null===(a=null===(s=null==m?void 0:m.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&g.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=f.layout.personalizationText+" +"+formatCentToDollarText((null===(d=null===(l=m.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+m.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(p,m)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(p,m))}),_.appendChild(t)}w.appendChild(C),w.appendChild(E),w.appendChild(_),y.appendChild(b),y.appendChild(w);const T=[y],I=ComponentFactoryService.createElement({type:r.CART_ITEM_QUANTITY_PRICE,itemId:p});if((null===(h=null===(u=null==m?void 0:m.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:p,context:"cart"});T.push(t)}return T.push(I),T}}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(),r=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:r,canDecrease:!![]}}getAvailableQuantity(){var t,e,n,r;const s=this.getItemStore();if(!s)return 0;const a=s.partNumber,l=s.fulfillmentId,d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(t=>t.partNumber===a&&t.fulfillmentId===l),h=u.reduce((t,e)=>t+e.quantity,0),p=this.getStoreValue("products."+s.upc)||this.getStoreValue("products."+s.salsifyGrouping);if(!p)return s.maxQuantity-h;const m=null!==(r=null===(n=null===(e=null===(t=null==p?void 0:p.sizes)||void 0===t?void 0:t[s.liquidId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.maxQuantityPerOrder)&&void 0!==r?r:0;return!m||m<=0?s.maxQuantity-h:m-h}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 t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}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,r=Boolean(null==n?void 0:n.code),s=Boolean(null==t?void 0:t.code);if(!r&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(r&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;if(s&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",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.discountAmount)||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"),r=this.getStoreValue("cart.promoCode"),s=this.getStoreValue("cart.events")||[],a=hasCartAnyPromoCodeEvents(s);this.applyButton.disabled=!e||n||Boolean(null==r?void 0:r.discountAmount)||this.isApplying||a}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:r.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 c=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",c),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),c())}),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.discountAmount)+")";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:r.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 r=this.getFulfillmentContainer();r&&r.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 r=this.container.querySelectorAll("[data-fulfillment-id]");if(0===r.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||[]),r=new Set(e||[]);for(const s of n)r.has(s)||this.removeFulfillmentElement(s);for(const s of r)n.has(s)||this.addFulfillmentElement(s)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const s of n)s.remove();let r=this.getFulfillmentContainer();if(!r){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");r=document.createElement("div"),r.id="retailer-fulfillment-container",t&&e&&t.insertBefore(r,e)}for(const s of e)this.addFulfillmentElement(s)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:r.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,r=t.find(t=>t.path===n);if(r){const t=r.oldValue,e=r.value,n=(null==t?void 0:t.fulfillments)||[],s=(null==e?void 0:e.fulfillments)||[];JSON.stringify(n)!==JSON.stringify(s)&&this.handleFulfillmentsUpdate(n,s)}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 U=()=>{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"),U()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),U()}}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const r=document.createElement("div");r.className="cart-retailer-header";const s=document.createElement("div");s.className="retailer-info";const a=document.createElement("h2");a.className="section-title",a.textContent=e.name,s.appendChild(a);const l=document.createElement("input");l.type="checkbox",l.id=e.id,l.className="section-toggle",s.appendChild(l);const d=document.createElement("label");d.htmlFor=e.id,d.className="section-header-label",d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Collapse retailer section"),d.setAttribute("aria-expanded","true");const u=document.createElement("span");u.className="chevron",u.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),d.appendChild(u),s.appendChild(d),r.appendChild(s),n.appendChild(r);const h=document.createElement("div");h.className="retailer-body-container";const p=document.createElement("div");p.id="retailer-fulfillment-container",h.appendChild(p);const m=document.createElement("div");return m.id="retailer-subtotal-container",h.appendChild(m),n.appendChild(h),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 r=0;for(const s of n)r+=s.quantity;return r}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,r=this.getStoreValue("cart.items"),s=this.getRetailerItemCount(r,t),a=1===s?"item":"items",l=document.createElement("h3");l.className="retailer-subtotal-header",l.textContent="Subtotal ("+s+" "+a+"):";const d=document.createElement("span");return d.className="retailer-subtotal-amount",d.textContent=formatCentToDollarText(e+n),[l,d]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var t,e,n;const s=this.store.get("checkout.isPresaleLocked"),a=this.store.get("checkout.presaleExpiresAt"),l=this.getConfigs("global"),d=this.clientConfig.get("promoTicker"),u=null!==(e=null===(t=null==l?void 0:l.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],h=null!=d?d:u,p=this.store.get("address"),m=hasActiveItems(h,null===(n=null==p?void 0:p.address)||void 0===n?void 0:n.state),f=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),g=s&&a,v=document.createElement("div");v.classList.add("checkout-container"),f&&v.classList.add("no-header"),this.params.isIndependentComponent&&v.classList.add("independent");const y=ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION_SECTION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_SUMMARY_SECTION});if(v.appendChild(b),!g&&(!h.length||!m)&&f)return[v];const x=document.createElement("div");if(x.classList.add("checkout-header-wrapper"),!f){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER});x.appendChild(t)}if(h.length&&m&&!g){const t=ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:h});x.appendChild(t)}if(g){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN});x.appendChild(t)}return[x,v]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.isPresaleLocked"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(r.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const s=document.createElement("h1");s.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.setAttribute("aria-label","Checkout Page");const a=document.createElement("button");return a.innerHTML=CloseIcon({width:16,height:16}),a.classList.add("checkout-header-button-close"),a.setAttribute("aria-label","Close Checkout"),a.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n?[n,s,a]:[s,a]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(t){const e=t.find(t=>"checkout.isGift"===t.path);e&&this.handleBuyerInformationVisibility(e.value)}handleBuyerInformationVisibility(t){const e=this.container.querySelector("#buyer-information-container");if(t&&!e){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_INFORMATION_FORM});t.id="buyer-information-container";const e=this.container.querySelector(".checkout-delivery-information");e&&e.insertAdjacentElement("afterend",t)}else!t&&e&&setTimeout(()=>{e.remove()},300)}template(){const t=[],e=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVERY_INFORMATION_FORM});t.push(e);const n=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT_FORM});t.push(n);const s=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING_FORM});return t.push(s),t}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presaleExpiresAt"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value),!![];const r=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presaleExpiresAt");t&&this.updateExpiresAt(t),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const s of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(s);if(e&&this.isScrollable(e))return e}let r=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;r&&r!==document.body;){if(this.isScrollable(r))return r;r=r.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,r=70,s=10;!this.isCurrentlyScrolled&&n>r?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<s&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}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);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),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()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,r=this.totalDuration-n,s=Math.max(0,Math.min(100,r/this.totalDuration*100)),a=n<60;if(a!==this.isUnderOneMinute){this.isUnderOneMinute=a;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"))}const l=this.rootElement.querySelector("[data-timer]");l&&(l.textContent=this.formatTime(e));const d=this.rootElement.querySelector("[data-progress-fill]");d&&(d.style.width=s+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),r=e%60,s=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const r=document.createElement("h2");r.textContent="LIMITED PRE-ORDER:";const s=document.createElement("div");s.classList.add("checkout-presale-timer"),s.setAttribute("data-timer",""),s.textContent="00:00:00",n.appendChild(r),n.appendChild(s);const a=document.createElement("p");a.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",a.classList.add("checkout-presale-subtitle"),e.appendChild(n),e.appendChild(a);const l=document.createElement("div");l.className="checkout-presale-progress-bar",l.setAttribute("data-progress","");const d=document.createElement("div");return d.className="checkout-presale-progress-fill",d.setAttribute("data-progress-fill",""),d.style.width="0%",l.appendChild(d),t.appendChild(e),t.appendChild(l),t}}const bt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],xt={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(bt.includes(n)){const t=document.createElement(n),r=xt[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(r.includes(e)){const r=sanitizeAttributeValue(e,n.value);null!==r&&t.setAttribute(e,r)}}"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 r=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&r.appendChild(e)}return r.childNodes.length>0?r:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),r=n.querySelector("parsererror");if(r)return console.warn("HTML parsing error detected"),"";const s=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&s.appendChild(e)}const a=document.createElement("div");return a.appendChild(s),a.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutSummarySectionComponent 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 r;e.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const s=document.createElement("span");s.id="emailOptIn",s.classList.add("checkout-checkbox-visual"),r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Email opt-in checkbox"),s.setAttribute("aria-checked",r?"true":"false"),s.addEventListener("click",()=>this.handleEmailToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(s))});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(t.text),a.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked"))}),e.appendChild(s),e.appendChild(a),n.appendChild(e)}if(e.show){const t=document.createElement("div");let r;t.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const s=document.createElement("span");s.classList.add("checkout-checkbox-visual"),s.id="smsOptIn",r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","SMS opt-in checkbox"),s.setAttribute("aria-checked",r?"true":"false"),s.addEventListener("click",()=>this.handleSmsToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(s))});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(e.text),a.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked"))}),t.appendChild(s),t.appendChild(a),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),s=this.getConfigs("checkout"),a=this.getConfigs("global"),l=s.layout.allowGiftCards,d=null===(t=null==a?void 0:a.layout)||void 0===t?void 0:t.allowPromoCodes,u=document.createElement("div");u.classList.add("section-title-container");const h=document.createElement("h3");h.textContent="Order Summary",h.classList.add("section-title"),u.appendChild(h),e.push(u);const p=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});e.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),e.push(m),l||d){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});e.push(t),e.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 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),e.push(g);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});e.push(b);const x=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});e.push(x);const w=this.marketingOptInsContainer();if(w&&e.push(w),s.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(s.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),e.push(t),e.push(n),e.push(r)}if(n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(t){this.commands.checkout.updateBillingInfo(ht.firstName,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.firstName})}async handleLastNameChange(t){this.commands.checkout.updateBillingInfo(ht.lastName,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.lastName})}async handleEmailChange(t){this.commands.checkout.updateBillingInfo(ht.email,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.email})}async handlePhoneChange(t){this.commands.checkout.updateBillingInfo(ht.phone,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.phone})}async handleCompanyChange(t){this.commands.checkout.updateBillingInfo(ht.company,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.company})}async handleAddressOneChange(t){this.commands.checkout.updateBillingInfo(ht.addressOne,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.addressOne})}async handleAddressTwoChange(t){this.commands.checkout.updateBillingInfo(ht.addressTwo,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.addressTwo})}async handleCityChange(t){this.commands.checkout.updateBillingInfo(ht.city,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.city})}async handleStateChange(t){this.commands.checkout.updateBillingInfo(ht.state,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.state})}async handleZipCodeChange(t){this.commands.checkout.updateBillingInfo(ht.zipCode,t),this.pubSub.publishForm(n.BILLING,{fieldName:ht.zipCode})}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.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 r=document.createElement("span");r.id="billingSameAsShipping",r.classList.add("checkout-checkbox-visual"),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Billing same as shipping checkbox"),r.setAttribute("aria-checked",t?"true":"false"),t&&r.classList.add("checked"),r.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 s=document.createElement("label");return s.textContent="Billing address same as shipping address",s.setAttribute("for","billingSameAsShipping"),s.classList.add("billing-checkbox-label"),n.appendChild(r),n.appendChild(s),e.appendChild(n),e}template(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t)return e;const s=document.createElement("div");s.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),s.appendChild(a);const l=document.createElement("p");l.textContent="Provide the info relevant to your payment method",l.classList.add("section-subtitle"),s.appendChild(l),e.push(s);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});h.setAttribute("aria-label","First name input"),u.appendChild(h);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});p.setAttribute("aria-label","Last name input"),u.appendChild(p),d.appendChild(u);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:ht.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});m.setAttribute("aria-label","Email input"),d.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:ht.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});g.setAttribute("aria-label","Phone input"),f.appendChild(g);const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});v.setAttribute("aria-label","Company input"),f.appendChild(v),d.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});b.setAttribute("aria-label","Street address input"),y.appendChild(b);const x=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});x.setAttribute("aria-label","Apt, suite, etc. (optional) input"),y.appendChild(x),d.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-three-col-container");const C=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});C.setAttribute("aria-label","City input"),w.appendChild(C);const k=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.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:this.handleStateChange.bind(this),storePath:"billing.state"});k.setAttribute("aria-label","State input"),w.appendChild(k);const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ht.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return S.setAttribute("aria-label","Zip Code input"),w.appendChild(S),d.appendChild(w),e.push(d),e}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(t){this.commands.checkout.updateCustomerInfo(dt.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.firstName})}async handleLastNameChange(t){this.commands.checkout.updateCustomerInfo(dt.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.lastName})}async handleEmailChange(t){this.commands.checkout.updateCustomerInfo(dt.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.email})}async handlePhoneChange(t){this.commands.checkout.updateCustomerInfo(dt.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.phone})}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(dt.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.company})}async handleDobChange(t){this.commands.checkout.updateCustomerInfo(dt.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.birthDate})}template(){const t=this.store.get("checkout.customer"),e=[],n=document.createElement("div");n.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),n.appendChild(s);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),n.appendChild(a),e.push(n);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});d.appendChild(u);const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});d.appendChild(h),l.appendChild(d);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:this.handleCompanyChange.bind(this)});l.appendChild(p);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:dt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});l.appendChild(m);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:dt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});l.appendChild(f);const g=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:dt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return l.appendChild(g),e.push(l),e}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const t=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}async handleDeliveryInstructionsChange(t){await this.commands.checkout.updateDeliveryInstructions(t)}async handleFirstNameChange(t){const e=this.getStoreValue("checkout.isGift");e?(this.commands.checkout.updateGiftInfo(ut.firstName,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.firstName})):(this.commands.checkout.updateCustomerInfo(dt.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.firstName}))}async handleLastNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(ut.lastName,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.lastName})):(this.commands.checkout.updateCustomerInfo(dt.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.lastName}))}async handleEmailChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(ut.email,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.email})):(this.commands.checkout.updateCustomerInfo(dt.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.email}))}async handlePhoneChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(ut.phone,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.phone})):(this.commands.checkout.updateCustomerInfo(dt.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.phone}))}async handleAddressTwoChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(ut.addressTwo,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.addressTwo})):(this.commands.checkout.updateCustomerInfo(dt.addressTwo,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.addressTwo}))}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(dt.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.company})}async handleBirthdateChange(t){this.commands.checkout.updateCustomerInfo(dt.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:dt.birthDate})}async handleGiftMessageChange(t){this.commands.checkout.updateGiftInfo(ut.message,t),this.pubSub.publishForm(n.GIFT,{fieldName:ut.message})}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift")||![],n=this.store.get("checkout.giftRecipient"),s=this.store.get("checkout.customer"),a=this.store.get("address.formattedAddress"),l=e?n:s,d=[],u=document.createElement("div");u.classList.add("delivery-header-container");const h=document.createElement("div");h.classList.add("delivery-header-content");const p=document.createElement("div");p.classList.add("delivery-title-container");const m=document.createElement("h3");m.textContent="Deliver to",m.classList.add("delivery-title");const f=document.createElement("p");f.textContent="Package recipient must be 21+",f.classList.add("delivery-subtitle"),p.appendChild(m),p.appendChild(f);const g=document.createElement("div");g.classList.add("gift-toggle-container");const v=document.createElement("div");v.classList.add("gift-label-wrapper");const y=document.createElement("span");y.textContent="Send as Gift? (Free)",y.classList.add("gift-toggle-label"),v.appendChild(y);const b=document.createElement("span");b.textContent="With personalized note & gift receipt.",b.classList.add("gift-toggle-description"),v.appendChild(b);const x=document.createElement("div");x.classList.add("toggle-switch"),x.classList.toggle("active",e);const w=document.createElement("div");w.classList.add("toggle-slider"),x.setAttribute("tabindex","0"),x.setAttribute("aria-label","Toggle Gift Option"),x.setAttribute("role","switch"),x.setAttribute("aria-checked",e?"true":"false"),x.appendChild(w),g.appendChild(v),g.appendChild(x),x.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),x.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),u.appendChild(g),u.appendChild(p),d.push(u);const C=document.createElement("div");C.classList.add("section-form-container");const k=document.createElement("div");k.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?ut.firstName:dt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:l.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:e?"giftRecipient.firstName":"customer.firstName"});S.setAttribute("aria-label","First Name Input"),k.appendChild(S);const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?ut.lastName:dt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:l.lastName,onChange:this.handleLastNameChange.bind(this),storePath:e?"giftRecipient.lastName":"customer.lastName"});if(E.setAttribute("aria-label","Last Name Input"),k.appendChild(E),C.appendChild(k),!e){const t=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:dt.company,label:"Company (optional)",autocomplete:!![],value:l.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});t.setAttribute("aria-label","Company Input"),C.appendChild(t)}const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:e?ut.email:dt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:l.email,onChange:this.handleEmailChange.bind(this),storePath:e?"giftRecipient.email":"customer.email"});_.setAttribute("aria-label","Email Input"),C.appendChild(_);const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:e?ut.phone:dt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:l.phone,onChange:this.handlePhoneChange.bind(this),storePath:e?"giftRecipient.phone":"customer.phone"});if(D.setAttribute("aria-label","Phone Input"),C.appendChild(D),!e){const t=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:dt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(l.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});t.setAttribute("aria-label","Birthdate Input"),C.appendChild(t)}const T=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input",validation:{required:!![]}});T.setAttribute("aria-label","Delivery Address Input"),C.appendChild(T);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?ut.addressTwo:dt.addressTwo,label:"Apt, suite, etc. (optional)",value:l.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:e?"giftRecipient.addressTwo":"customer.addressTwo"});if(I.setAttribute("aria-label","Address Line 2 Input"),C.appendChild(I),this.hasOnDemandFulfillments()){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const n=document.createElement("label");n.textContent="Delivery Instructions",n.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.setAttribute("aria-label","Delivery Instructions Textarea"),r.value=this.store.get("checkout.deliveryInstructions")||"",r.addEventListener("blur",async t=>{await this.handleDeliveryInstructionsChange(t.target.value)}),r.addEventListener("keydown",async t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),await this.handleDeliveryInstructionsChange(t.target.value))});const s=document.createElement("p");s.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",s.classList.add("textarea-message-disclaimer"),e.appendChild(n),e.appendChild(r),e.appendChild(s),C.appendChild(e)}if(e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",ut.message);const s=document.createElement("textarea");s.name=ut.message,s.id=ut.message,s.rows=4,s.value=n.message||"",s.setAttribute("aria-label","Gift Message Textarea"),s.addEventListener("input",async t=>{await this.handleGiftMessageChange(t.target.value)});const a=document.createElement("p");a.textContent="Your gift message will be emailed to the recipient along with delivery details.",a.classList.add("textarea-message-disclaimer"),e.appendChild(r),e.appendChild(s),e.appendChild(a),C.appendChild(e)}return d.push(C),d}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),s=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),a=t.hasAttribute("drawer"),l=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),d="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||s&&a&&l&&d)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(){await this.commands.checkout.getPaymentSession();const t=this.store.get("checkout.payment"),e=this.getConfigs("global");return{publishableKey:t.key,clientSecret:t.secret,appearance:{theme:"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;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const e=this.findRootComponent();if(!e)return;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const n=e.querySelectorAll('[slot="'+lt+'"]');if(n.length>0)for(const r of n)r.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.stripeFormElement.setAttribute("slot",lt),e.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(s){this.logger.error("Stripe form element creation failed",s),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),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",async t=>{await this.commands.checkout.updateStripeFormStatus(t.detail.status),t.detail.status.hasError&&this.logger.error("Stripe form status update failed",t.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async t=>{try{const{confirmationTokenId:e,setupIntentId:n}=t.detail;await this.commands.checkout.confirmPaymentSession(e,n)}catch(e){this.logger.error("Failed to confirm payment session",e),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig(),n=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}});null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(n)}catch(e){this.logger.error("Failed to refresh payment session",e)}})}onStoreChanged(t){const e=t.some(t=>"checkout.payment.sendSubmitSignal"===t.path&&t.value===!![]);if(e&&this.stripeFormElement){const t=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(t)}return![]}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(t=super.disconnected)||void 0===t||t.call(this)}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const r=document.createElement("p");r.textContent="All transactions are secure and encrypted.",r.classList.add("section-subtitle"),e.appendChild(r),t.push(e);const s=document.createElement("slot");return s.setAttribute("name",lt),t.push(s),t}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.F=![],this.A=null,this.O=null,this.N=null,this.L=![],this.M=![],this.R=![]}async initialize({data:t}){if(this.F)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.F=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.B;this.A=window.Stripe(t.publishableKey),this.O=this.A.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.N=this.O.create("payment",t.elementOptions),this.N.mount(this),this.N.on("change",async t=>{const e=!!t.error,n=t.complete,r=e?t.error.message:null;this.M=n,await this.updateStripeFormStatus({isComplete:n,hasError:e,errorMessage:r,isProcessing:this.L})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.M,hasError:![],errorMessage:null,isProcessing:this.L})}),this.R=![]}catch(t){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.B=e,await this.refreshPaymentSession())}async handleSubmit(){if(!this.L){this.L=!![],await this.updateStripeFormStatus({isComplete:this.M,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.M)throw new SDKError("Please complete all required payment fields");this.R&&await this.requestSessionRefresh();const t=await this.createConfirmationTokenId(),e=this.B.clientSecret,n=e.split("_secret_")[0],r=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:t,setupIntentId:n}});this.dispatchEvent(r),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(t){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.M,isProcessing:![],hasError:!![],errorMessage:(null==t?void 0:t.message)||"An unexpected error with payment occurred"})}finally{this.L=![]}}}async requestSessionRefresh(){const t=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(t),new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",o),e(new Error("Session refresh timeout"))},5e3),o=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",o),t()};this.addEventListener("lce:s:refreshSession",o,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(M){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(t){const e=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t}});this.dispatchEvent(e)}async createConfirmationTokenId(){if(!this.O)throw new SDKError("Elements must be provided");try{const{error:t}=await this.O.submit();if(t)throw new SDKError(t.message);const e={elements:this.O,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:r}=await this.A.createConfirmationToken(e);if(n)throw new SDKError(n.message);if(!r||!r.id)throw new SDKError("Confirmation token not found");return r.id}catch(t){throw new SDKError(t.message)}}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.N&&(this.N.unmount(),this.N=null),this.O&&(null===(e=(t=this.O).destroy)||void 0===e?void 0:e.call(t),this.O=null),this.A=null,this.L=![],this.M=![],this.R=![],this.F=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.createElement("script");n.src="https://js.stripe.com/basil/stripe.js",n.onload=()=>t(),n.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(n)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const r=this.getStoreValue("checkout"),s=Boolean(r.promoCode),a=Boolean(null===(t=r.giftCards)||void 0===t?void 0:t.length),l=this.getConfigs("global"),d=Object.keys(r.onDemandFulfillmentTipInfo||{}).length>0,u=Object.values(r.items||{}),h=[],p=document.createElement("div");p.classList.add("checkout-amount-line");const m=document.createElement("span");m.textContent="Subtotal ("+u.length+" item"+(u.length>1?"s":"")+")",p.appendChild(m);const f=document.createElement("span");f.textContent=formatCentToDollarText(r.amounts.subtotal),p.appendChild(f),h.push(p);const g=document.createElement("div");g.classList.add("checkout-amount-line");const v=document.createElement("span");v.textContent="Shipping",g.appendChild(v);const y=document.createElement("span");y.textContent=formatCentToDollarText(r.amounts.shipping),g.appendChild(y),h.push(g);const b=document.createElement("div");b.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Delivery",b.appendChild(x);const w=document.createElement("span");if(w.textContent=formatCentToDollarText(r.amounts.delivery),b.appendChild(w),h.push(b),(null===(e=null==r?void 0:r.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(r.amounts.engraving),t.appendChild(n),h.push(t)}const C=document.createElement("div");C.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Taxes & Fees",C.appendChild(k);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(r.amounts.tax+r.amounts.service+r.amounts.platform),C.appendChild(S),h.push(C),s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=r.promoCode)||void 0===n?void 0:n.code)+")",t.appendChild(e);const s=document.createElement("span");s.textContent="-"+formatCentToDollarText(r.amounts.discounts),t.appendChild(s),h.push(t)}if(a){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(r.amounts.giftCards),t.appendChild(n),h.push(t)}if(d){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(r.amounts.tip),t.appendChild(n),h.push(t)}const E=document.createElement("div");E.classList.add("checkout-separator"),h.push(E);const _=document.createElement("div");_.classList.add("checkout-amount-total");const D=document.createElement("span");D.textContent="Total",_.appendChild(D);const T=document.createElement("span");T.textContent=formatCentToDollarText(r.amounts.total),_.appendChild(T),h.push(_);const I=this.store.get("checkout.isPresaleLocked");if(I){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),h.push(t);const r=document.createElement("div");r.classList.add("checkout-presale-locked-message");const s=htmlStringToElement(InfoIcon({color:l.theme.defaultTextColor}));r.appendChild(s);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",r.appendChild(a),h.push(r)}return h}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,s,a,l,d,u,h,p,m,f;const g=[],v=this.getConfigs("configurations"),y=this.getConfigs("global"),b=this.getConfigs("checkout"),x=this.config.layout.exitUrl||window.location.host,w=this.config.layout.thankYouButtonText||"Continue Shopping";if((null===(e=null===(t=this.config.theme)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo)||(null===(s=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===s?void 0:s.customLogo)){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=(null===(l=null===(a=this.config.theme)||void 0===a?void 0:a.checkoutCompleted)||void 0===l?void 0:l.customLogo)||(null===(u=null===(d=this.config.layout)||void 0===d?void 0:d.checkoutCompleted)||void 0===u?void 0:u.customLogo),e.alt=v.partnerName+" Logo",t.appendChild(e),g.push(t)}const C=document.createElement("div");C.classList.add("checkout-completed-section-container");const k=document.createElement("div");k.classList.add("checkout-completed-title-container");const S=document.createElement("div");S.classList.add("checkout-completed-title-section");const E=document.createElement("h3");E.innerHTML=(null===(p=null===(h=this.config.theme)||void 0===h?void 0:h.checkoutCompleted)||void 0===p?void 0:p.customText)||(null===(f=null===(m=this.config.layout)||void 0===m?void 0:m.checkoutCompleted)||void 0===f?void 0:f.customText)||"Thank You for Your Order!",S.appendChild(E);const _=document.createElement("p");_.textContent="Your payment has been successfully processed.",S.appendChild(_),k.appendChild(S),C.appendChild(k);const D=document.createElement("div");D.classList.add("checkout-completed-sub-section");const T=document.createElement("div");T.classList.add("checkout-completed-line");const I=document.createElement("h3");I.textContent="Order Number",T.appendChild(I);const F=document.createElement("span");F.textContent=this.params.orderNumber,T.appendChild(F),D.appendChild(T);const A=document.createElement("div");A.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Order Amount",A.appendChild(O);const N=document.createElement("span");N.textContent=""+formatCentToDollarText(this.params.orderTotal),A.appendChild(N),D.appendChild(A);const L=document.createElement("div");L.classList.add("checkout-completed-line");const M=document.createElement("h3");M.textContent="Payment Method",L.appendChild(M);const R=document.createElement("span");R.textContent="** "+this.params.cardLast4,L.appendChild(R),D.appendChild(L),C.appendChild(D);const B=document.createElement("div");B.classList.add("checkout-completed-sub-section");const j=document.createElement("p");j.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>.",B.appendChild(j),C.appendChild(B),g.push(C);const G=document.createElement("div");G.classList.add("checkout-completed-section-container");const K=document.createElement("button");K.type="button";const V=document.createElement("span");V.textContent=w,K.setAttribute("tabindex","0"),K.setAttribute("role","button"),K.setAttribute("aria-label",w),K.appendChild(V);const W=htmlStringToElement(ArrowRightIcon({width:16,height:16}));K.appendChild(W),K.addEventListener("click",()=>{window.location.href=x}),K.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=x)}),G.appendChild(K),g.push(G);const X=document.createElement("div");X.classList.add("checkout-completed-section-container");const $=document.createElement("div");$.classList.add("checkout-completed-help-section"),X.appendChild($);const J=document.createElement("p");J.textContent="Questions about your order? Contact us at ";const tt=document.createElement("a");tt.href="mailto:"+v.supportEmail,tt.textContent=v.supportEmail,J.appendChild(tt),$.appendChild(J);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,$.appendChild(et),g.push(X),b.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(b.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),g.push(t),g.push(e),g.push(n)}if(y.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});g.push(t)}return g}}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),r=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(""),r&&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"),r=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(r)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.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 c=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",c),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),c())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}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,r,s;const a=t.find(t=>"checkout.items"===t.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const l=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(l){const t=l.oldValue,a=l.value;if(a.updating)return![];const d=(null==t?void 0:t.quantity)!==(null==a?void 0:a.quantity),u=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],h=(null===(s=null===(r=null==a?void 0:a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],p=JSON.stringify(u)!==JSON.stringify(h);(d||p)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(t){var e,n;const s=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.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)===!![]&&s.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:r.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 s=this.getStoreValue("cart.fulfillments."+e),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(s,t.pack)){const e=getMinimumPurchaseMessage(s,t.pack),a=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),n.before(a)}}}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 s=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),l=null===(t=null==a?void 0:a.attributes)||void 0===t?void 0:t.presale,d=(null==l?void 0:l.isActive)&&(null==l?void 0:l.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(l.estimatedShipBy):"";if(!a)return[];const u=document.createElement("div");u.classList.add("checkout-item-card-header");const h=document.createElement("div");h.classList.add("checkout-item-image");const p=document.createElement("img");p.src=a.mainImage,p.alt=a.name,p.loading="lazy",h.appendChild(p),u.appendChild(h);const m=document.createElement("div");m.classList.add("checkout-item-details-container");const f=document.createElement("h4");f.classList.add("checkout-item-title"),f.textContent=a.name,m.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-item-subtitle");const v=document.createElement("span");v.textContent=l.isActive?""+d:((null==a?void 0:a.expectationDetail)||"")+",",g.appendChild(v);const y=document.createElement("span");y.textContent="From "+((null==a?void 0:a.retailerName)||""),g.appendChild(y),m.appendChild(g),u.appendChild(m),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(a.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),u.appendChild(this.trashButton);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),x=[];if(x.push(u),s.layout.enablePersonalization&&(null===(n=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});x.push(t)}return x.push(b),x}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 r=this.getStoreValue("checkout.items."+this.params.itemId);if(!r)return 0;const s=this.getStoreValue("products");if(!s)return 0;const a=r.partNumber,l=r.fulfillmentId,d=null===(n=null===(e=null===(t=Object.values(s).find(t=>t.sizes[r.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[r.liquidId])||void 0===n?void 0:n.attributes.maxQuantityPerOrder;if(!d)return 0;const u=this.getStoreValue("checkout.items")||{},h=Object.values(u).filter(t=>t.partNumber===a&&t.fulfillmentId===l),p=h.reduce((t,e)=>t+e.quantity,0);return d-p}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"),r=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),s=e.quantity,a=this.getAvailableQuantity(),l=a>0,d=!(r&&1===s);return{currentQuantity:s,availableQuantity:a,isTheOnlyItem:r,canIncrease:l,canDecrease:d}}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(r){this.logger.error("Checkout item quantity change operation failed",r)}}}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 r=document.createElement("span");if(r.classList.add("checkout-item-price-text"),r.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)",r.appendChild(e)}return[n,r]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}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(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),r=new Set;for(const s of n){const t=s.getAttribute("data-item-id");t&&r.add(t)}for(const s of n){const t=s.getAttribute("data-item-id");t&&!e.has(t)&&s.remove()}for(const[s]of e)if(!r.has(s)){const e=this.createItemElement(s);e.setAttribute("data-item-id",s),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const r=t[n];if("checkout"===r.path||"checkout.items"===r.path||"checkout.items."===r.path.substring(0,15)){e=r;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const r=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",r?"true":"false"),e.setAttribute("aria-label",r?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=Object.values(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const r=document.createElement("span");r.classList.add("checkout-items-toggler-label"),r.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(r);const s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-items-list","show");for(const l of e){const t=this.createItemElement(l.cartItemId);t.setAttribute("data-item-id",l.cartItemId),a.appendChild(t)}return[n,a]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(t){const e=t.some(t=>"checkout.isFormValid"===t.path||"checkout.invalidFields"===t.path||"checkout.stripeFormStatus"===t.path||"checkout.stripeFormStatus."===t.path.substring(0,26)||"checkout.readyForSubmit"===t.path||"checkout.readyForSubmit."===t.path.substring(0,23)||"checkout.loading"===t.path||"checkout.error"===t.path);e&&this.updateButtonState();const n=t.find(t=>"checkout.readyForSubmit"===t.path);return n&&this.handleCheckoutReadyForSubmit(n.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.invalidFields")||[],n=this.store.get("checkout.stripeFormStatus")||{},r=this.store.get("checkout.loading")||![],s=this.store.get("checkout.error")||null,a=n.isComplete||![],l=n.hasError||![],d=n.isProcessing||![],u=n.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(s,u));const h=this.determineButtonState({isFormValid:t,invalidFieldsCount:e.length,isPaymentComplete:a,hasPaymentError:l,isStripeProcessing:d,isCheckoutLoading:r,hasCheckoutError:!!s});this.applyButtonState(h)}determineErrorMessage(t,e){return t&&e?e:e||t}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(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const t=this.store.get("checkout.stripeFormStatus");(null==t?void 0:t.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState(t){const{isFormValid:e,invalidFieldsCount:n,isPaymentComplete:r,hasPaymentError:s,isStripeProcessing:a,isCheckoutLoading:l,hasCheckoutError:d}=t,u=this.config.layout.placeOrderButtonText,h=this.config.layout.placeOrderButtonShowRequiredFields,p=e&&r&&!s&&!a&&!d,m=this.store.get("checkout.readyForSubmit.payment")||![],f=this.store.get("checkout.readyForSubmit.prepared")||![],g=this.store.get("checkout.payment.sendSubmitSignal")||![],v=this.store.get("checkout.isPresaleLocked")||![];let y=![];if(!v){const t=this.getStoreValue("cart.fulfillments")||{};y=Object.values(t).some(t=>hasUnmetMinimum(t))}const b=a||l||g;if(l&&!a&&!g)return{state:"processing",text:u,disabled:!![]};if(y)return{state:"disabled",text:u,disabled:!![]};if(b)return m&&f?{state:"processing",text:"Placing Order...",disabled:!![]}:m&&!f?{state:"processing",text:"Preparing Order...",disabled:!![]}:f&&!m&&(a||g)||g||a?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!e){const t=n>0?" ("+n+")":"";return{state:"form-invalid",text:h?"Complete Required Fields"+t:u,disabled:![]}}return r?s?{state:"payment-error",text:u,disabled:![]}:p?{state:"ready",text:u,disabled:![]}:{state:"disabled",text:u,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(t){if(!this.placeOrderButton)return;const e=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...e),this.placeOrderButton.classList.add(t.state),this.placeOrderButton.disabled=t.disabled,this.placeOrderButton.textContent=t.text}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.isFormValid")||![],e=this.store.get("checkout.stripeFormStatus")||{},n=this.store.get("checkout.loading")||![],r=e.isComplete||![],s=e.hasError||![],a=e.isProcessing||![];if(a||n)return;if(!t)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!r||s)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(t){this.logger.error("Error handling place order click",t)}}showPaymentError(){const t=document.querySelector(".checkout-stripe-form");t&&safeScrollIntoView(t,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(t){if(!t)return;const{payment:e,prepared:n,customer:r,gift:s,billing:a}=t,l=e&&n&&r&&a&&s;l&&await this.commands.checkout.checkoutComplete()}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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-payment-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-payment-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),n.appendChild(s),n.appendChild(a),e.appendChild(n);const l=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,l,t]}}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"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),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 t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const l=document.createElement("p");l.classList.add("presale-expired-title"),l.textContent="Session Expired",a.appendChild(l);const d=document.createElement("p");d.textContent="Your reservation time has ended. The item has been released for other customers.",a.appendChild(d),s.appendChild(a),n.appendChild(s);const u=document.createElement("div");u.classList.add("checkout-completed-help-section"),u.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.",n.appendChild(u),t.push(n);const h=document.createElement("div");h.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}));p.appendChild(f),p.addEventListener("click",()=>this.handleExit()),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),h.appendChild(p),t.push(h);const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("p");v.classList.add("checkout-completed-auto-close-text"),v.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 y=document.createElement("span");if(y.classList.add("checkout-completed-auto-close-text"),y.textContent="seconds",g.appendChild(v),g.appendChild(this.autoCloseElement),g.appendChild(y),t.push(g),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}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,r=Boolean(n),s=Boolean(t);if(!r&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(r&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;s&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}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"),r=this.getStoreValue("checkout.promoCode"),s=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(r)||Boolean(s)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.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 c=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",c),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),c())}),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.discountAmount)||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.discountAmount)+")";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 e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}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 r=this.getOnDemandFulfillmentTipInfo();if(!r[t])return;const s=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,s)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(r){this.logger.error("Checkout fulfillment tip removal failed",r)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],r=this.getTipSelection();for(const s of e){const e=document.createElement("button");e.type="button",e.textContent=s+"%",e.classList.add("checkout-tip-button"),e.disabled=n,r===s&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(s)),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.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const r=document.createElement("h3");r.textContent="View Tip Distribution",r.classList.add("checkout-sub-header"),n.appendChild(r);const s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(s),t.appendChild(n);const a=document.createElement("div");a.classList.add("retailers-tips-list","show");for(const l of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=l.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const r=document.createElement("div");r.classList.add("dollar-input-container");const s=document.createElement("span");s.classList.add("dollar-sign"),s.textContent="$";const d=document.createElement("input");let u;d.type="number",d.id="tip-input-"+l.fulfillmentId,d.name="tip-"+l.fulfillmentId,d.min="0",d.step="0.01",d.placeholder="0.00",d.classList.add("dollar-input"),d.value=l.tip>0?(l.tip/100).toFixed(2):"",d.disabled=this.getStoreValue("checkout.updating")||![],d.addEventListener("wheel",t=>{t.preventDefault()}),d.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),d.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),d.addEventListener("paste",t=>{t.preventDefault()}),d.addEventListener("contextmenu",t=>{t.preventDefault()}),d.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))}}),d.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;u&&clearTimeout(u),u=setTimeout(()=>{this.handleFulfillmentTipInput(l.fulfillmentId,n)},500)}),r.appendChild(s),r.appendChild(d),n.appendChild(r);const h=document.createElement("button");h.type="button",h.textContent="Remove",h.classList.add("checkout-tip-remove-button"),h.disabled=this.getStoreValue("checkout.updating")||![],h.addEventListener("click",()=>this.removeTipFromFulfillment(l.fulfillmentId)),n.appendChild(h),t.appendChild(n),a.appendChild(t)}return t.appendChild(a),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const t=e.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}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(r){this.logger.error("Default tip initialization failed during fallback",r),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const r=document.createElement("h3");r.classList.add("checkout-sub-header"),r.textContent="Add a tip",n.appendChild(r);const s=document.createElement("div");s.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();s.appendChild(a),n.appendChild(s);const l=document.createElement("p");l.classList.add("checkout-tip-disclaimer"),l.textContent="Tips will be split proportionally between retailers.",n.appendChild(l);const d=this.createTipDistribution();return t.push(n,d),t}}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 r=t.find(t=>"checkout.giftCardError"===t.path),s=t.find(t=>"checkout.promoCodeError"===t.path),a=t.find(t=>"checkout.giftCards"===t.path);if(a&&this.updateAppliedGiftCards(a.value),r){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()),r.value){const e=this.createErrorElement(r.value);t.after(e)}const s=t.querySelector(".apply-button");s&&(s.disabled=Boolean(r.value))}}if(s){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()),s.value){const e=this.createErrorElement(s.value);t.after(e)}const r=t.querySelector(".apply-button");r&&(r.disabled=Boolean(s.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.discountAmount)+")",e.appendChild(n);const r=document.createElement("button");return r.type="button",r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(r),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),r=e.layout.allowGiftCards,s=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("checkout-pc-gc-sub-container");const l=this.pcInputContainer(),d=this.gcInputContainer();s&&a.appendChild(l);const u=this.getStoreValue("checkout.promoCodeError");if(u){const t=this.createErrorElement(u);t.classList.add("promo-code-error-wrapper"),a.appendChild(t)}r&&a.appendChild(d);const h=this.getStoreValue("checkout.giftCardError");if(h){const t=this.createErrorElement(h);a.appendChild(t)}return a}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const r=document.createElement("p");return r.textContent=t.toString(),e.appendChild(n),e.appendChild(r),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 e=[];return e.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)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:r,selectedSizeAttributes:a}){var l,d,u,h,p;let m=0;const f=null==a?void 0:a.presale,g=(null==f?void 0:f.isActive)&&(null==f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(f.estimatedShipBy):"",v=e===s.SHIPPING,y=e===s.ON_DEMAND;v&&(m=(null===(d=null===(l=null==t?void 0:t.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),y&&(m=(null===(u=null==t?void 0:t.fees)||void 0===u?void 0:u.fee)||0);const b=fulfillmentAddress(t.retailerAddress,e);let x=null;e===s.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(x=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const w=e===s.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="popup-retailer-card "+(n?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",t.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",n?"true":"false");const k=e===s.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.price)&&void 0!==h?h:0));const S=document.createElement("div");S.className="row";const E=document.createElement("span");E.className="name",E.textContent=t.retailerName,S.appendChild(E);const _=document.createElement("span");_.className="price",_.textContent=formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0),S.appendChild(_),C.appendChild(S);const D=document.createElement("div");D.className="row";const T=document.createElement("span");T.className="expectation",T.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==t?void 0:t.expectation.detail)||"No expectation available",D.appendChild(T);const I=document.createElement("span");if(I.className="fee",I.textContent=m>0?formatCentToDollarText(m):"Free Delivery",D.appendChild(I),C.appendChild(D),y){const t=document.createElement("div");t.className="row";const e=document.createElement("span");e.className="address",e.textContent=b,t.appendChild(e),C.appendChild(t)}return C}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:r,onTabClick:a,enableShippingFulfillment:l,enableOnDemandFulfillment:d}){const u=e.length>0,h=document.createElement("div");if(h.className="fulfillment-tabs-container",h.setAttribute("role","tablist"),h.setAttribute("aria-label","Delivery method options"),l){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",s.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",a),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(n?"selected":""),r.textContent="Shipping ("+t.length+")",e.appendChild(r),h.appendChild(e)}if(d){const t=document.createElement("div");t.className="fulfillment-tab "+(r?"selected":"")+" "+(u?"":"disabled"),t.setAttribute("data-fulfillment-type",s.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",r?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),u||t.setAttribute("aria-disabled","true"),t.addEventListener("click",a),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(r?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),h.appendChild(t)}return h}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 r=n.selectedFulfillment.partNumber,s=n.selectedFulfillment.fulfillmentId,a=null===(t=n.sizes[n.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!a)return 0;const l=this.getStoreValue("cart.items")||{},d=Object.values(l).filter(t=>t.partNumber===r&&t.fulfillmentId===s),u=d.reduce((t,e)=>t+e.quantity,0);return a-u}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);if(!e.selectedFulfillment)return![];const n=getRetailerOffHours(e.selectedFulfillment);return e.selectedFulfillmentType===s.ON_DEMAND&&n&&n.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 r=this.getProductId(),s=this.getStoreValue("products."+r);if(!s.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:r,selectedSizeId:s.selectedSizeId}),void 0;const a=this.getSizeAttributes(),l=(null===(t=null==a?void 0:a.presale)||void 0===t?void 0:t.isActive)===!![],d=this.isPresaleActive(a);l&&d?await this.commands.product.addPresaleToCart(r,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(e=s.selectedFulfillment)||void 0===e?void 0:e.partNumber,quantity:s.quantity,identifier:r}):await this.commands.product.addToCart(r,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(n=s.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:s.quantity,identifier:r})}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,r=n.price*e.quantity;return{quantity:e.quantity,totalPrice:r}}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(),r=this.calculateQuantityLimits(),s=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(n),l=s?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?l+" - "+formatCentToDollarText(e):l;const d=s&&!a||0===r.availableQuantity||this.isFulfillmentClosed(),u=this.isButtonLoading(),h=this.config.layout.addToCartButtonShowTotalPrice?l+" for "+formatCentToDollarText(e):l;return this.addToCartButton.setAttribute("aria-label",h),this.addToCartButton.setAttribute("aria-busy",u.toString()),this.addToCartButton.setAttribute("aria-disabled",d.toString()),d&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),u&&(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 r=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);r.push(t)}const s=this.createAddToCartButton();return r.push(s),r}}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"),r="About this product:",s="See More",a="See Less",l=document.createElement("h3");l.className="title",l.textContent=r;const d=document.createElement("div");d.className="content collapsed",d.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const u=document.createElement("span");u.className="collapse-button",u.textContent=s,u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Show more product information"),u.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,d.classList.toggle("collapsed"),u.textContent=this.isCollapsed?s:a,u.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),u.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return u.addEventListener("click",toggleContent),u.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[l,d,u]}}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 r=n.value,s=r.isOpen,a=null===(e=r.contentConfig)||void 0===e?void 0:e.type,l=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(r),![]):s&&this.isOpen&&!l?![]:s&&this.isOpen&&l?(this.currentContentType=a,this.openWithContent(r),![]):!s&&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:r}=t||{},s=ComponentFactoryService.createElement({type:n,...r});this.contentContainer&&this.contentContainer.appendChild(s),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;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),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){const e=this.params.productId,n=t.find(t=>t.path==="products."+e+".mainImage");if(null==n?void 0:n.value){const t=this.params.images.indexOf(null==n?void 0:n.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+n.value+"')")}}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 r=this.container.querySelectorAll(".carousel-dot");for(let s=0;s<r.length;s++){const e=r[s];e.classList.toggle("active",s===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,r=e.offsetLeft+e.offsetWidth/2,s=n/2,a=s-r,l=0,d=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(d,Math.min(l,a)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,r=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,r=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,s=t.changedTouches[0].clientY-r;Math.abs(e)>Math.abs(s)&&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 r=this.currentTranslateX+n,s=0,a=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,r)),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 t=[],e=this.params.images.length>1,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])+"')",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)}this.mainImageElement=n,t.push(n);const r=document.createElement("div");r.className="gallery-viewport";const s=document.createElement("div");s.className="gallery-container";for(let a=0;a<this.params.images.length;a++){const t=this.params.images[a],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===a?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(a+1),n.loading="lazy",e.appendChild(n),s.appendChild(e)}return r.appendChild(s),t.push(r),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e,n,r,a;const l=this.getProductId();if(!t.some(t=>t.path==="products."+l+".selectedFulfillmentType"))return;const d=this.getStoreValue("products."+l),u=d.sizes[d.selectedSizeId],h=this.getConfigs("global");this.addPersonalizationSpan&&(d.selectedFulfillmentType===s.SHIPPING&&h.layout.enablePersonalization&&d.productHasAvailability&&(null===(n=null===(e=null==u?void 0:u.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(r=null==d?void 0:d.selectedFulfillment)||void 0===r?void 0:r.isVariantEngravable)===!![]&&(null===(a=null==d?void 0:d.selectedFulfillment)||void 0===a?void 0:a.canEngrave)===!![]?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 r=n.textContent||"",s=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+r),n.setAttribute("aria-pressed",s?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var r,s,a,l;const d=n.dataset.sizeId;if(!d)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,d);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const u=this.getStoreValue("products."+t),h=u.sizes[d],p=this.getConfigs("global");this.addPersonalizationSpan&&(p.layout.enablePersonalization&&(null===(s=null===(r=null==h?void 0:h.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.status)===!![]&&u.productHasAvailability&&(null===(a=u.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]&&(null===(l=u.selectedFulfillment)||void 0===l?void 0:l.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const r=document.createElement("h3");r.className="size-label",r.textContent="Size",r.id="size-label",n.appendChild(r);const s=document.createElement("div");s.className="size-buttons-container",s.setAttribute("role","group"),s.setAttribute("aria-labelledby","size-label");for(const a of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",a.id),e.setAttribute("select-size",""),e.className="size-button "+(a.id===t?"selected":"");const n=a.packDesc?" ("+a.packDesc+")":"";e.textContent=""+a.size+n,s.appendChild(e)}return n.appendChild(s),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,n,s,a;const l=this.getProductId(),d=this.getStoreValue("products."+l),u=d.sizes[d.selectedSizeId],h=this.getConfigs("global"),p=[],m=document.createElement("div");m.className="price-personalization-container";const f=ComponentFactoryService.createElement({type:r.PRODUCT_PRICE,productId:l});if(m.appendChild(f),h.layout.enablePersonalization&&d.productHasAvailability&&(null===(e=null===(t=null==u?void 0:u.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.status)===!![]&&(null===(n=null==d?void 0:d.selectedFulfillment)||void 0===n?void 0:n.canEngrave)===!![]&&(null===(s=null==d?void 0:d.selectedFulfillment)||void 0===s?void 0:s.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,e,n,s,a,u,h,p;const m=d.sizes[d.selectedSizeId];await this.commands.product.openProductDrawer(l,r.ENGRAVING_FORM,{identifier:l,context:"product",lines:[],maxLines:(null===(e=null===(t=m.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(s=null===(n=m.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(u=null===(a=m.attributes)||void 0===a?void 0:a.engraving)||void 0===u?void 0:u.fee)||0,location:null===(p=null===(h=m.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),m.appendChild(this.addPersonalizationSpan)}p.push(m);const g=this.renderProductSizes(d.selectedSizeId,d.sizes);if(p.push(g),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,productId:l});p.push(t)}const v=ComponentFactoryService.createElement({type:r.PRODUCT_RETAILERS,productId:l});p.push(v);const y=ComponentFactoryService.createElement({type:r.PRODUCT_ADD_TO_CART_SECTION,productId:l});p.push(y);const b=null===(a=null==u?void 0:u.attributes)||void 0===a?void 0:a.presale;if((null==b?void 0:b.isActive)===!![]&&(null==b?void 0:b.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==b?void 0:b.language)||""),p.push(t)}if(this.config.layout.showDescription){const t=ComponentFactoryService.createElement({type:r.PRODUCT_DESCRIPTION,productId:l});p.push(t)}return p}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:r,fulfillmentDisplay:s,showImages:a}=this.config.layout,l=document.createElement("div");l.classList.add("product-content-wrapper");const d=document.createElement("div");if(d.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),d.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),d.appendChild(t),d}const u=document.createElement("div");u.classList.add("wave","sc-price"),d.appendChild(u);const h=document.createElement("div");h.classList.add("sc-sizes");const p=document.createElement("div");p.classList.add("wave","sc-size-button"),h.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),h.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),h.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),h.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),h.appendChild(v),d.appendChild(h);const y=document.createElement("div");y.classList.add("sc-row");const b=document.createElement("div");b.classList.add("wave","sc-price"),y.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-personalization"),y.appendChild(x),d.appendChild(y);const w=document.createElement("div");w.classList.add("wave","sc-deliver-to"),d.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-address"),d.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-retailers",s),d.appendChild(k);const S=document.createElement("div");if(S.classList.add("sc-row"),r){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),S.appendChild(t)}const E=document.createElement("div");if(E.classList.add("wave","sc-add-to-cart"),S.appendChild(E),d.appendChild(S),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),d.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),d.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),d.appendChild(n);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),d.appendChild(r);const s=document.createElement("div");s.classList.add("wave","sc-description-more"),d.appendChild(s)}const _=document.createElement("div");if(_.classList.add("product-content"),_.appendChild(d),l.appendChild(_),a){l.classList.add("has-images");const t=this.createImageSkeletons();l.prepend(t)}return l}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let a=0;a<3;a++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const r=document.createElement("div");r.classList.add("gallery-viewport");const s=document.createElement("div");s.classList.add("gallery-container");for(let a=0;a<4;a++){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),s.appendChild(t)}return r.appendChild(s),t.appendChild(r),t}}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:r.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(r.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.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(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);let r=(null===(t=n.priceInfo)||void 0===t?void 0:t.avg)||0;return n.selectedFulfillment&&(r=n.selectedFulfillment.price),formatCentToDollarText(r)}}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"),s=[],a=this.getConfigs("configurations");if(!e.productHasAvailability||!a.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),s.push(t),s}const l="carousel"===n.layout.fulfillmentDisplay?r.PRODUCT_RETAILERS_CAROUSEL:r.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:l,productId:t});return s.push(d),s}}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,r=e.offsetLeft+e.offsetWidth/2,s=n/2,a=s-r,l=0,d=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(d,Math.min(l,a)),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 r=this.currentTranslateX+n,s=0,a=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,r)),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 r=this.getStoreValue("products."+e+".selectedFulfillment");if(r&&r.fulfillmentId===n)return this.logger.debug("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,fulfillmentStatus:r,selectedSizeAttributes:a}){var l,d,u,h,p;let m=0;const f=null==a?void 0:a.presale,g=(null==f?void 0:f.isActive)&&(null==f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(f.estimatedShipBy):"",v=e===s.SHIPPING,y=e===s.ON_DEMAND;v&&(m=(null===(d=null===(l=null==t?void 0:t.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),y&&(m=(null===(u=null==t?void 0:t.fees)||void 0===u?void 0:u.fee)||0);const b=fulfillmentAddress(t.retailerAddress,e);let x=null;e===s.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(x=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const w=e===s.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="carousel-retailer-card "+(n?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",t.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",n?"true":"false");const k=e===s.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.price)&&void 0!==h?h:0));const S=document.createElement("div");S.className="retailer-header";const E=document.createElement("h3");if(E.className="name",E.textContent=t.retailerName,S.appendChild(E),y){const t=document.createElement("h3");t.className="address",t.textContent=b,S.appendChild(t)}const _=document.createElement("div");_.className="retailer-body";const D=document.createElement("span");D.className="product-price",D.textContent=formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0);const T=document.createElement("span");T.className="shipping-price",T.textContent=m>0?"+ "+formatCentToDollarText(m):"FREE Delivery";const I=document.createElement("span");return I.className="expectation",I.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==t?void 0:t.expectation.detail)||"No expectation available",_.append(D,T,I),C.append(S,_),C}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,a=[];for(const s in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,s)&&a.push(n.shippingFulfillments[s]);const l=[];for(const s in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,s)&&l.push(n.onDemandFulfillments[s]);const d=e.selectedFulfillmentType===s.SHIPPING,u=e.selectedFulfillmentType===s.ON_DEMAND,h=d?a:l,p=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,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 h){const t=getRetailerOffHours(m),n=this.generateRetailerCard({fulfillment:m,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:m.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:r}),a=e.selectedFulfillmentType===s.ON_DEMAND&&t&&t.isClosed;a?n.setAttribute("aria-disabled","true"):(n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())})),this.listContainer.appendChild(n)}return this.listViewport.appendChild(this.listContainer),[p,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),a=(null==n?void 0:n.attributes)||null,l=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,u=Object.values(n.shippingFulfillments),h=Object.values(n.onDemandFulfillments),p=(l?u.length:0)+(d?h.length:0),m=document.createElement("div");m.className="header";const f=document.createElement("span");f.className="header-label",f.textContent=e.selectedFulfillmentType===s.SHIPPING?"Shipping From:":"Delivering From:";const g=document.createElement("button");if(g.className="delivery-options",g.type="button",g.textContent="See Delivery Options ("+p+")",g.setAttribute("aria-label","View all "+p+" delivery options"),g.addEventListener("click",async()=>{0!==p&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),m.appendChild(f),m.appendChild(g),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,t]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";const y=getRetailerOffHours(e.selectedFulfillment),b=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],fulfillmentStatus:y,selectedSizeAttributes:a});return v.appendChild(b),[m,v]}}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 U=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},r=this.getStoreValue("products."+e+".selectedFulfillment");if(r&&r.fulfillmentId===n)return await U(),void 0;await this.commands.product.selectFulfillment(e,n),await U()}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,a=[];for(const s in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,s)&&a.push(n.shippingFulfillments[s]);const l=[];for(const s in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,s)&&l.push(n.onDemandFulfillments[s]);const d=e.selectedFulfillmentType===s.SHIPPING,u=e.selectedFulfillmentType===s.ON_DEMAND,h=d?a:l,p=document.createElement("h5");p.className="popup-retailers-section-title",p.textContent="Delivery Options";const m=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,m,t]}const f=document.createElement("div");f.className="popup-fulfillment-list-container";for(const s of h){const t=getRetailerOffHours(s),n=renderPopupRetailerCard({fulfillment:s,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:s.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:r});n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),f.appendChild(n)}return[p,m,f]}}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"),r=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==r?void 0:r.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:r.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});const s=n.sizes[n.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+n.name);const l=document.createElement("div");if(l.classList.add("product-content"),l.setAttribute("role","region"),l.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,l.appendChild(t)}const d=ComponentFactoryService.createElement({type:r.PRODUCT_OPTIONS,productId:e});l.appendChild(d);const u=ComponentFactoryService.createElement({type:r.PRODUCT_DRAWER,productId:e});if(l.appendChild(u),a.appendChild(l),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return a;a.classList.add("has-images");const h=ComponentFactoryService.createElement({type:r.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:s.image,productId:e});return a.prepend(h),h.setAttribute("aria-label","Product images"),a}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t,e,n;const r=this.params.product,s=this.getStoreValue("address.address"),a={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==s?void 0:s.state)||"",isPresale:![],isPresaleActive:![]},l=r.sizes[0];if(!l)return a;const d=l.variants[0];if(!d)return a;a.upc=l.upc;const u=l.attributes||{};a.isPresale=(null===(t=u.presale)||void 0===t?void 0:t.isActive)===!![],a.isPresaleActive=this.isPresaleActive(u);for(const h of this.params.fulfillments){const t=d.fulfillments.some(t=>t===h.id);if(t){const t="shipping"===h.type&&(null===(e=d.fulfillmentTypes)||void 0===e?void 0:e.shipping)||"onDemand"===h.type&&(null===(n=d.fulfillmentTypes)||void 0===n?void 0:n.onDemand);if(t&&d.stock>0){a.hasAvailability=!![],a.fulfillmentId=h.id,a.partNumber=d.partNumber;break}}}return a}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!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const e=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e}):await this.commands.productList.addToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e})}template(){var t,e,n,r;const s=this.params.product,a=s.sizes[0],l=a?a.image:s.images[0],d=s.name,u=a?a.size:null,h=null!==(n=null===(e=null===(t=null==a?void 0:a.variants)||void 0===t?void 0:t[0])||void 0===e?void 0:e.price)&&void 0!==n?n:(null===(r=s.priceInfo)||void 0===r?void 0:r.average)||0,p=this.getAvailabilityData();return this.createVariantStandard({image:l,name:d,size:u,price:h,availability:p})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const e=this.params.product,n=null===(t=e.sizes)||void 0===t?void 0:t[0],r=this.params.productUrl;if(r.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?r.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(r.includes("{grouping}")){const t=e.salsifyGrouping||"";return t?r.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:e,name:n,size:r,price:s,availability:a}=t,l=[],d=this.generateProductUrl(),u=document.createElement("div");u.className="plc__image-content";const h=document.createElement("div");h.className="plc__image-wrapper";const p=document.createElement("img");if(p.className="plc__image",p.src=e,p.alt=n,p.loading="lazy",h.appendChild(p),u.appendChild(h),d){const t=document.createElement("a");t.href=d,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(u),l.push(t)}else l.push(u);const m=document.createElement("div");m.className="plc__content";const f=document.createElement("h3");if(f.className="plc__title",f.textContent=n,d){const t=document.createElement("a");t.href=d,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(f),m.appendChild(t)}else m.appendChild(f);const g=document.createElement("div");g.className="plc__size-price-wrapper";const v=document.createElement("div");v.className="plc__price",v.textContent=formatCentToDollarText(s),g.appendChild(v);const y=document.createElement("div");y.className="plc__size",y.textContent=r||"",g.appendChild(y),m.appendChild(g),l.push(m);const b=document.createElement("button");return b.type="button",b.className="plc__button",b.disabled=!a.hasAvailability,a.hasAvailability?b.textContent="Add to Cart":(b.textContent="Not Available In "+a.state.toUpperCase(),this.addHostClasses("not-available")),b.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(a)}),l.push(b),l}}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 r=document.createElement("div");r.className="slc__image-wrapper";const s=document.createElement("div");s.classList.add("wave","slc__image"),r.appendChild(s),n.appendChild(r);const a=document.createElement("div");a.className="slc__content";const l=document.createElement("div");l.className="slc__title-container";const d=document.createElement("div");d.classList.add("wave","slc__title","slc__title-line-1"),l.appendChild(d);const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-2"),l.appendChild(u),a.appendChild(l);const h=document.createElement("div");h.className="slc__size-price-wrapper";const p=document.createElement("div");p.classList.add("wave","slc__price"),h.appendChild(p);const m=document.createElement("div");m.classList.add("wave","slc__size"),h.appendChild(m),a.appendChild(h);const f=document.createElement("div");return f.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(a),e.appendChild(f),e}template(){const t=[],e=100/this.params.columns;this.container.style.setProperty("--card-width",e+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let r=0;r<n;r++){const e=this.createSkeletonCard(r);t.push(e)}return t}}class ProductListFiltersComponent extends BaseComponent{get hostClasses(){return["product-list-filters-container"]}isSameDayDeliveryDisabled(){var t,e;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}template(){var t,e,n;const r=[],s=document.createElement("div");s.className="product-list-filters-header";const a=document.createElement("h3");if(a.className="product-list-filters-title",a.textContent="Filters",s.appendChild(a),r.push(s),this.params.enablePersonalized){const e=document.createElement("div");e.className="product-list-filters-personalized";const n=document.createElement("label");n.className="product-list-filters-personalized-label",n.setAttribute("for","personalized-switch"),n.textContent="Personalized Bottles",e.appendChild(n);const s=document.createElement("input");if(s.type="checkbox",s.id="personalized-switch",s.className="product-list-filters-personalized-switch",s.disabled=this.isPersonalizationDisabled(),s.checked=(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)||![],s.addEventListener("change",t=>{var e,n;const r=t.target;null===(n=(e=this.params).onPersonalizedChange)||void 0===n?void 0:n.call(e,r.checked)}),e.appendChild(s),this.isPersonalizationDisabled()){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",e.appendChild(t)}r.push(e)}if(this.params.enablePreOrder){const t=document.createElement("div");t.className="product-list-filters-pre-order";const n=document.createElement("label");n.className="product-list-filters-pre-order-label",n.setAttribute("for","pre-order-switch"),n.textContent="Pre-Order",t.appendChild(n);const s=document.createElement("input");if(s.type="checkbox",s.id="pre-order-switch",s.className="product-list-filters-pre-order-switch",s.disabled=this.isPreOrderDisabled(),s.checked=(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder)||![],s.addEventListener("change",t=>{var e,n;const r=t.target;null===(n=(e=this.params).onPreOrderChange)||void 0===n?void 0:n.call(e,r.checked)}),t.appendChild(s),this.isPreOrderDisabled()){const e=document.createElement("div");e.className="product-list-filters-warning",e.textContent="(Not Available With Same-Day Delivery)",t.appendChild(e)}r.push(t)}if(this.params.enableDeliveryOptions){const t=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],e=document.createElement("div");e.className="product-list-filters-delivery-options";const s=document.createElement("div");s.className="product-list-filters-delivery-options-header";const a=document.createElement("h3");a.className="product-list-filters-delivery-options-label",a.textContent="Delivery Options",s.appendChild(a),e.appendChild(s);const l=document.createElement("div");l.className="product-list-filters-delivery-options-list";for(const r of t){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const e=document.createElement("input");e.type="radio",e.id="delivery-"+r.value,e.name="delivery-options",e.value=r.value,e.className="product-list-filters-delivery-radio";const s="onDemand"===r.value&&this.isSameDayDeliveryDisabled();e.disabled=s,e.checked=r.value===((null===(n=this.params.currentFilters)||void 0===n?void 0:n.deliveryOptions)||"all"),e.addEventListener("change",t=>{var e,n;const r=t.target;null===(n=(e=this.params).onDeliveryOptionsChange)||void 0===n?void 0:n.call(e,r.value)});const a=document.createElement("label");a.htmlFor="delivery-"+r.value,a.className="product-list-filters-delivery-radio-label "+(s?"disabled":""),a.textContent=r.label,t.appendChild(e),t.appendChild(a),l.appendChild(t)}e.appendChild(l),r.push(e)}return r}}var wt;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(wt||(wt={}));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"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all"},this.cardsContainer=null,this.filtersContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=wt.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(wt.IDLE)}catch(M){this.logger.error("Error initializing product list:",M),this.setLoadingState(wt.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[];return this.params.filters.length>0&&t.push(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),t.push(this.cardsContainer),this.renderCurrentState(),t}setLoadingState(t){const e=this.loadingState;this.loadingState=t,this.logger.debug("Loading state changed: "+e+" → "+t),this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case wt.LOADING_INITIAL:this.renderLoadingState();break;case wt.ERROR:break;case wt.IDLE:case wt.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t;try{const e=this.buildApiParams(0),n=await this.commands.productList.getProductList(e);this.products=n.products||[],this.retailers=n.retailers||[],this.updatePagination(n.navigation),this.syncFiltersFromResponse((null===(t=n.navigation)||void 0===t?void 0:t.filters)||[])}catch(e){throw this.logger.error("Error loading initial products:",e),this.products=[],this.retailers=[],this.pagination.hasMorePages=![],e}}async loadMoreProducts(){if(this.loadingState!==wt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(wt.LOADING_MORE);const t=this.pagination.currentPage+1,e=this.buildApiParams(t),n=await this.commands.productList.getProductList(e);n.products&&n.products.length>0?(this.products.push(...n.products),this.mergeRetailers(n.retailers||[]),this.updatePagination(n.navigation),this.appendNewProducts(n.products)):(this.pagination.hasMorePages=![],this.updatePagination(n.navigation)),this.setLoadingState(wt.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(wt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){const e=new Map(this.retailers.map(t=>[t.id,t]));for(const n of t)e.has(n.id)||(this.retailers.push(n),e.set(n.id,n))}updatePagination(t){var e,n,r,s;t&&(this.pagination={currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,hasMorePages:(null!==(r=t.currentPage)&&void 0!==r?r:0)<(null!==(s=t.totalPages)&&void 0!==s?s:1)-1})}buildApiParams(t){return{page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()}}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];return this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&t.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),t}syncFiltersFromResponse(t){if(t)for(const e of t)switch(e.key){case"engraving":this.currentFilters.personalized="YES"===e.values;break;case"presale":this.currentFilters.preOrder="YES"===e.values;break;case"fulfillment":Array.isArray(e.values)&&(e.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":e.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(wt.IDLE)}catch(M){this.logger.error("Error handling filter change:",M),this.setLoadingState(wt.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const e="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=e,e&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,e)})}updateRadioLabel(t,e){const n=this.deliveryRadioLabels.get(t.id);n&&(n.className="product-list-filters-delivery-radio-label "+(e?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}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:r.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,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){var e;try{const n=null===(e=t.sizes)||void 0===e?void 0:e[0];if(!n)return this.logger.warn("Product "+t.id+" has no sizes"),null;const s=new Map(this.retailers.flatMap(t=>t.fulfillments.map(t=>[t.id,t]))),a=new Set(n.variants.flatMap(t=>t.fulfillments)),l=Array.from(a).map(t=>s.get(t)).filter(t=>Boolean(t));return ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,fulfillments:l,productUrl:this.params.productUrl})}catch(n){return this.logger.error("Error creating product card for product "+t.id+":",n),null}}createFiltersContainer(){return this.filtersContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_FILTERS,enablePersonalized:this.params.filters.includes(u.PERSONALIZATION),enablePreOrder:this.params.filters.includes(u.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(u.DELIVERY_OPTIONS),currentFilters:this.currentFilters,onPersonalizedChange:async t=>{this.currentFilters.personalized=t,await this.onFilterChange()},onPreOrderChange:async t=>{this.currentFilters.preOrder=t,await this.onFilterChange()},onDeliveryOptionsChange:async t=>{this.currentFilters.deliveryOptions=t,"onDemand"===t&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),await this.onFilterChange()}}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var e;const n=null===(e=this.filtersContainer)||void 0===e?void 0:e.querySelector('label[for="'+t.id+'"]');n&&this.deliveryRadioLabels.set(t.id,n)})}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===wt.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===wt.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 r=document.createElement("div");return r.className="product-list-sentinel-text",r.textContent=t,e.appendChild(n),e.appendChild(r),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 r=document.createElement("div");return r.className="product-list-sentinel-error-text",r.textContent=t,e.appendChild(n),e.appendChild(r),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 r=document.createElement("div");return r.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",r.textContent=t,n.appendChild(r),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)}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer){this.logger.debug("Address changed in store, reloading products to get updated availability");try{this.resetPagination(),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 reloading products after address change:",n),this.setLoadingState(wt.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers=[],this.cardsContainer=null,this.filtersContainer=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}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:![],r=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 r?e.slice(0,1):e}const s=this.store.get(this.params.errorStorePath);return s?[{message:s,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 r=document.createElement("span");return r.classList.add("alert-text"),r.textContent=t.message,e.appendChild(n),e.appendChild(r),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(r.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.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const e=this.getStoreValue("cart.totals.quantity")||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 r=n.value,s=r.isOpen,a=null===(e=r.contentConfig)||void 0===e?void 0:e.type,l=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(r),![]):s&&this.isOpen&&!l?![]:s&&this.isOpen&&l?(this.currentContentType=a,this.openWithContent(r),![]):!s&&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 r;r=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(r,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(r),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}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const e=this.store.get("products."+this.params.identifier);this.fulfillmentId=e.selectedFulfillmentId,this.partNumber=(null===(t=e.selectedFulfillment)||void 0===t?void 0:t.partNumber)||null}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),r=n.sizes[n.selectedSizeId],s=r.shippingFulfillments[this.fulfillmentId],a=s.price,l=(null===(e=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return a+l}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 r=this.store.get("products."+this.params.identifier);r.mainImage?t.push(r.mainImage):t.push(...r.images||[]),e=r.name,n=r.sizes[r.selectedSizeId].size}if("cart"===this.params.context){const r=this.store.get("cart.items."+this.params.identifier);r.mainImage&&t.push(r.mainImage),e=r.name,n=r.size}const r=document.createElement("div");if(r.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const s=document.createElement("img");s.src=t[0],s.alt=e,s.loading="lazy",s.className="product-image",n.appendChild(s),r.appendChild(n)}const s=document.createElement("div");s.className="product-details-container";const a=document.createElement("div");a.className="product-header";const l=document.createElement("h4");l.className="product-title",l.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),a.appendChild(l),a.appendChild(this.productPriceSpan),s.appendChild(a);const d=document.createElement("p");d.className="product-size-text",d.textContent=n,s.appendChild(d);const u=document.createElement("p");return u.className="engraving-fees-disclaimer",u.textContent="Personalization fees included in total, varies by retailer.",s.appendChild(u),r.appendChild(s),r}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,r,s,a,l;const d=this.store.get("products."+this.params.identifier),u=d.sizes[d.selectedSizeId],h=Object.values(u.shippingFulfillments).filter(t=>t.isVariantEngravable&&t.canEngrave),p=document.createElement("div");p.className="fulfillment-section";const m=document.createElement("p");if(m.className="shipping-from-text",m.innerHTML="Shipping from: <b>"+(null===(t=d.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",p.appendChild(m),1===h.length)return p;const f=document.createElement("div");f.className="fulfillment-options-container",p.appendChild(f);const g=document.createElement("span");g.className="see-more-fulfillments",g.textContent="See More Delivery Options ("+h.length+")",g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.setAttribute("aria-label","See More Delivery Options ("+h.length+")"),g.setAttribute("aria-expanded","false");const i=()=>{const t=f.classList.contains("expanded");f.classList.toggle("expanded"),t?(g.textContent="See More Delivery Options ("+h.length+")",g.setAttribute("aria-label","See More Delivery Options ("+h.length+")"),g.setAttribute("aria-expanded","false")):(g.textContent="See Less Delivery Options",g.setAttribute("aria-label","See Less Delivery Options"),g.setAttribute("aria-expanded","true"))};g.addEventListener("click",i),g.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())}),p.appendChild(g);for(const v of h){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",v.fulfillmentId),v.fulfillmentId===(null===(e=d.selectedFulfillment)||void 0===e?void 0:e.fulfillmentId)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+v.retailerName+", "+formatCentToDollarText(v.price+((null===(r=null===(n=d.sizes[d.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===r?void 0:r.fee)||0))+", "+v.expectation.engraving),t.setAttribute("aria-pressed",v.fulfillmentId===(null===(s=d.selectedFulfillment)||void 0===s?void 0:s.fulfillmentId)?"true":"false");const Z=()=>{this.fulfillmentId=v.fulfillmentId,this.partNumber=v.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=f.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),m.innerHTML="Shipping from: <b>"+v.retailerName+"</b>"};t.addEventListener("click",Z),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Z())});const u=v.price+((null===(l=null===(a=d.sizes[d.selectedSizeId].attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.fee)||0),h=document.createElement("div");h.className="option-row row-1",t.appendChild(h);const p=document.createElement("span");p.className="retailer-name",p.textContent=v.retailerName,h.appendChild(p);const g=document.createElement("span");g.className="fulfillment-price",g.textContent=formatCentToDollarText(u),h.appendChild(g),t.appendChild(h);const y=document.createElement("div");y.className="option-row row-2",t.appendChild(y);const b=document.createElement("span");b.className="estimated-time",b.textContent=""+v.expectation.engraving,y.appendChild(b),t.appendChild(y),f.appendChild(t)}return p}engravingLinesSection(){var t;const{lines:e,maxLines:n,location:r,maxCharsPerLine:s}=this.params,a=document.createElement("div");a.className="engraving-section";const l=document.createElement("p");if(l.className="engraving-title",l.textContent="Personalize Your Bottle",a.appendChild(l),r&&(null===(t=null==r?void 0:r.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 "+r.toLowerCase()+".",a.appendChild(t)}const d=Array.from({length:n},(t,n)=>{const r=n+1,a=document.createElement("div");a.className="engraving-input-wrapper",a.setAttribute("data-line-number",r.toString());const l=document.createElement("input");l.type="text",l.id="engraving-line-"+r,l.dataset.lineNumber=r.toString(),l.maxLength=s,l.value=e[n]||"",l.placeholder=r>1?"Line "+r+" (optional)":"Line "+r,l.className="engraving-input",l.autocomplete="off",l.setAttribute("aria-label",r>1?"Engraving line "+r+", optional, maximum "+s+" characters":"Engraving line "+r+", maximum "+s+" characters");const d=document.createElement("span");return d.className="engraving-char-count",d.textContent=l.value.length+"/"+s,d.setAttribute("aria-live","polite"),d.setAttribute("aria-atomic","true"),l.addEventListener("input",()=>{d.textContent=l.value.length+"/"+s,this.engravingLines[n]=l.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(l),a.appendChild(d),a}),u=document.createElement("div");return u.className="engraving-inputs-container",u.append(...d),a.appendChild(u),a}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const s=document.createElement("button");s.type="button",s.className="cancel-action-button",s.textContent="Cancel",s.setAttribute("aria-label","Cancel personalization and close");const P=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(r.CART)};s.addEventListener("click",P),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),P())}),n.appendChild(s),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 H=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=this.store.get("products."+t);await this.commands.product.addToCart(t,{upc:e.sizes[e.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t}),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(r.CART))};return this.addToCartButton.addEventListener("click",H),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),H())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const r=this.actionButtonsSection();t.push(r);const s=document.createElement("p");return s.className="engraving-disclaimer",s.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>",t.push(s),t}}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,r=(null==e?void 0:e.quantity)||1;return{quantity:r,fee:n,total:n*r}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,r=(null==e?void 0:e.quantity)||1;return{quantity:r,fee:n,total:n*r}}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,s,a,l,d,u,h,p,m,f,g,v,y,b,x,w,C,k;const S=this.params.identifier,E={identifier:S,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+S);E.lines=(null===(e=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],E.maxLines=(null===(s=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.maxLines)||1,E.maxCharsPerLine=(null===(l=null===(a=null==r?void 0:r.attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,E.fee=(null===(u=null===(d=null==r?void 0:r.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,E.location=(null===(p=null===(h=null==r?void 0:r.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+S);E.lines=(null===(f=null===(m=null==t?void 0:t.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.lines)||[],E.maxLines=(null===(v=null===(g=null==t?void 0:t.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.maxLines)||1,E.maxCharsPerLine=(null===(b=null===(y=null==t?void 0:t.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxCharsPerLine)||16,E.fee=(null===(w=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.fee)||0,E.location=(null===(k=null===(C=null==t?void 0:t.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,E)}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 r=document.createElement("h3");r.textContent="Personalization";const s=document.createElement("span");if(s.className="engraving-fee",1===t.quantity&&(s.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){s.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",s.appendChild(e)}n.appendChild(r),n.appendChild(s);const a=document.createElement("div");a.className="engraving-body";const l=document.createElement("div");l.className="engraving-lines";for(const h of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=h,l.appendChild(t)}const d=document.createElement("div");d.className="engraving-actions";const u=document.createElement("button");u.type="button",u.classList.add("remove-button"),u.textContent="Remove",u.setAttribute("aria-label","Remove engraving");const Q=async()=>{await this.handleRemove()};if(u.addEventListener("click",Q),u.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await Q())}),d.appendChild(u),"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())}),d.appendChild(t)}return a.appendChild(l),a.appendChild(d),[n,a]}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(t){const e=t.find(t=>"checkout.focusField"===t.path);e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("/");3===t.length&&(this.monthInput.value=t[0],this.dayInput.value=t[1],this.yearInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const t of[this.monthInput,this.dayInput,this.yearInput])t.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>1)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>3)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}handleNavigation(t,e){const n=t.target,r=n===this.yearInput?4:2;n.value.length===r&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const r=Number.parseInt(t,10),s=Number.parseInt(e,10),a=Number.parseInt(n,10);if(r<1||r>12||s<1||s>31||a<1e3)return![];const l=new Date(a,r-1,s);return l.getFullYear()===a&&l.getMonth()===r-1&&l.getDate()===s}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const r=e.getMonth()-t.getMonth();return(r<0||0===r&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,r=[],s=this.params.validation;if(!s)return this.showErrors([]),!![];const a=t&&e&&n&&4===n.length,l=t||e||n;if(s.required&&!l||l&&!a)r.push("Please enter a complete date (MM/DD/YYYY)");else if(a)if(this.validateDate(t,e,n)){const a=Number.parseInt(t,10),l=Number.parseInt(e,10),d=Number.parseInt(n,10),u=new Date(d,a-1,l);if(void 0!==s.minYear&&d<s.minYear&&r.push("Year must be "+s.minYear+" or later"),void 0!==s.maxYear&&d>s.maxYear&&r.push("Year must be "+s.maxYear+" or earlier"),void 0!==s.minAge||void 0!==s.maxAge){const t=this.calculateAge(u);void 0!==s.minAge&&t<s.minAge&&r.push("Must be at least "+s.minAge+" years old"),void 0!==s.maxAge&&t>s.maxAge&&r.push("Must be no more than "+s.maxAge+" years old")}if(s.customValidator){const t=s.customValidator(this.getFormattedValue());t&&r.push(t)}}else r.push("Please enter a valid date");this.showErrors(r);const d=0===r.length;return this.params.onValidation&&this.params.onValidation(d,r),d}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.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 for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];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+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const r=document.createElement("input");r.type="text",r.placeholder="MM",r.name=this.params.name+"-month",r.id=this.params.name+"-month",r.maxLength=2,r.className="date-field month-field",r.setAttribute("data-field","month"),r.inputMode="numeric";const s=document.createElement("span");s.className="date-separator",s.textContent="/";const a=document.createElement("input");a.type="text",a.placeholder="DD",a.name=this.params.name+"-day",a.id=this.params.name+"-day",a.maxLength=2,a.className="date-field day-field",a.setAttribute("data-field","day"),a.inputMode="numeric";const l=document.createElement("span");l.className="date-separator",l.textContent="/";const d=document.createElement("input");d.type="text",d.placeholder="YYYY",d.name=this.params.name+"-year",d.id=this.params.name+"-year",d.maxLength=4,d.className="date-field year-field",d.setAttribute("data-field","year"),d.inputMode="numeric",this.params.disabled&&(r.disabled=!![],a.disabled=!![],d.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(r),n.appendChild(s),n.appendChild(a),n.appendChild(l),n.appendChild(d);const u=document.createElement("div");return u.className="error-container",e.push(n),e.push(u),e}}class InputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(t){const e=t.find(t=>"checkout.focusField"===t.path);return e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,r=e.value;n>0&&/\D/.test(r[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;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}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,r,s]=t.split("/").map(Number),a=new Date(s,n-1,r);return a.getFullYear()===s&&a.getMonth()===n-1&&a.getDate()===r}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"),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||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const r=Number.parseFloat(t);Number.isNaN(r)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&r<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&r>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 r=new RegExp(n.pattern);r.test(t)||e.push("Invalid format")}if(n.customValidator){const r=n.customValidator(t);r&&e.push(r)}}this.showErrors(e);const r=0===e.length;return this.params.onValidation&&this.params.onValidation(r,e),r}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&&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 e=[];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),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=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&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.F=![],this.q=null,this.j=this.attachShadow({mode:"closed"})}initialize(t,e){if(this.F)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.j)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.q=t=>{e.rerender(t||"LceElementRerender")}),this.j.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),r=n.getStylesheet(t);this.applyThemeStyles(r),this.F=!![],this.j=null}rerender(t){this.q&&this.q(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\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.j.adoptedStyleSheets=[e,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(M){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.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.j&&this.j.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 r=document.createElement("span");return r.className="pb-dot",r.textContent=".",t.appendChild(r),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 r of n){const n=r.trim();if(!n)continue;const s=document.createElement("span");s.classList.add("promo-ticker__text-item"),s.textContent=n,e.appendChild(s);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=t.separator,e.appendChild(a)}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 s=0;s<5;s++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const r=document.createElement("button");return r.type="button",r.classList.add("promo-ticker__cta"),r.textContent="APPLY",r.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(r.disabled=!![],r.textContent="APPLIED"),r.addEventListener("click",()=>this.handlePromoClick()),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=r,[e,r]}}const Ct=LoggerFactory.get("ElementsClientHelper"),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},r=[];for(const s in e){const a=e[s],l=n[s];if(!(s in t)){r.push('Property "'+s+'" does not exist in target schema, skipping merge.');continue}const d=getType(a),u=getType(l);d===u?isObject(a)&&isObject(l)?n[s]=deepMergeConfigs(l,a):n[s]=a:r.push('Type mismatch for key "'+s+'": source is '+d+", target is "+u+". Skipping merge.")}return r.length>0&&Ct.warn("Merging configurations with warnings:",r),n}const kt=new Map([["global.layout.enablePersonalization",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_INTERACTIONS,r.CART_ITEM,r.CHECKOUT_ITEM]],["global.layout.personalizationText",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.CART_ITEM]],["global.layout.personalizationCardStyle",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[r.CART,r.CART_PROMO_CODE,r.CART_FOOTER,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[r.CART,r.CHECKOUT,r.ADDRESS,r.INPUT,r.BIRTHDATE_INPUT,r.ADDRESS_INPUT,r.CHECKOUT_DELIVERY_INFORMATION_FORM,r.CHECKOUT_BUYER_INFORMATION_FORM,r.CHECKOUT_BILLING_FORM,r.CHECKOUT_PAYMENT_FORM,r.CART_PROMO_CODE]],["global.layout.showPoweredBy",[r.CART,r.CHECKOUT,r.CHECKOUT_COMPLETED,r.POWERED_BY,r.CART_FOOTER,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[r.POWERED_BY]],["product.layout.showImages",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[r.PRODUCT]],["product.layout.showDescription",[r.PRODUCT,r.PRODUCT_DESCRIPTION,r.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[r.PRODUCT,r.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[r.CART,r.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[r.CART,r.CART_FOOTER]],["checkout.layout.emailOptIn",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.smsOptIn",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.allowGiftCards",[r.CHECKOUT,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[r.CHECKOUT,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[r.CHECKOUT,r.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.placeOrderButtonShowRequiredFields",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[r.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const r of Object.keys(e)){const e=kt.get(t+"."+r);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.gtmInitialized=![],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.authService=AuthService.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("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",M.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.debug("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.debug("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.debug("📊 Telemetry initialized")),this.logger.debug("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Unable to authenticate with the provided API key.",!![]);this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",e.configurations.partnerCode),this.clientConfig.set("partnerName",e.configurations.partnerName),this.logger.debug("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),r=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",r);const s=r?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:r,persistedStore:s}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=e.global.layout.showPoweredBy;e=deepMergeConfigs(e,t),e.global.layout.showPoweredBy=n}await this.themeProvider.initialize(e),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 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");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(e){this.logger.error("GTM initialization failed",e)}this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),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,...s}=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 a=n.replace("#",""),l=document.getElementById(a);if(!l)return console.warn("Container with ID '"+a+"' not found"),null;l.innerHTML="";const d={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...s},u=ComponentFactoryService.createElement(d);return safeReplaceChildren(l,u),t.type===r.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(a,t.type,u)}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=[],s=[];for(const r of e){if(!r||"object"!=typeof r){this.logger.warn("Invalid product parameter: must be an object");continue}if(!r.containerId||"string"!=typeof r.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+r.identifier+"'");continue}const t=r.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+r.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+r.identifier+"'");continue}const s=n.every(e=>e.containerId!==t);if(!s){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!r.identifier||"string"!=typeof r.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const a=n.every(t=>t.identifier!==r.identifier);a?n.push({containerId:t,identifier:r.identifier}):this.logger.warn("Duplicate product identifier '"+r.identifier+"' found, skipping")}for(const a of n){const t=ComponentFactoryService.createElement({type:r.PRODUCT,useShadowDom:!![],productId:a.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(a.containerId);e?(e.innerHTML="",e.appendChild(t),s.push(this.createInjectedComponentWrapper(a.containerId,r.PRODUCT,t)),await this.commands.product.createProductInstance(a.identifier,!![])):this.logger.warn("Product ("+a.identifier+") container with ID '"+a.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(n.map(t=>t.identifier)),s}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,r.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.cardVariant&&!Object.values(d).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(d).join(", "),!![]);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(u);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:r.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||d.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:r.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const r={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,r),r}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 r;r=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,r)}registerEssentialComponents(){ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(r.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(r.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,CartComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(r.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(r.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(r.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(r.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(r.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(r.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(r.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent)}}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 s=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,s)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:r.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 Y=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.totals.subtotal")||0;Y(n),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;Y(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 r=document.getElementById(t.replace("#",""));if(!r)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);r.innerHTML="",r.classList.add("lce-cart-items-count");const P=t=>{r.textContent=t.toString(),0===t?(n&&(r.style.visibility="hidden"),r.classList.add("no-items")):(n&&(r.style.visibility="visible"),r.classList.remove("no-items"))},s=this.store.get("cart.totals.quantity")||0;P(s),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;P(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,r.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:r.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,r.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:r.CART,containerId:t}):(this.injectDisabledElementsError(t,r.CART),null)}async injectCheckoutElement(t){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:r.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,r.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,n){try{const r=ClientConfigService.getInstance();r.initialize(t,{env:n.env,isBuilder:![],debugMode:n.debugMode,customTheme:n.customTheme,proxy:n.proxy,promoTicker:n.promoTicker});const s=r.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),ui:a.ui,actions:a.actions,getInjectedComponents:a.getInjectedComponents.bind(a)};window.elements=l;const d=PubSubService.getInstance();return d.publishAction(e.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:r.get("version")}),l}catch(r){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",r)}catch(s){console.error("[LiquidCommerce Elements] Client initialization failed:",null==r?void 0:r.message)}try{const t=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(e.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const St={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden"}};function pairsFromMainScript(t){const e=[];try{const r=t.getAttributeNames().filter(t=>t.substring(0,12)===St.PRODUCT.PRODUCT);for(const s of r)try{const n=s.match(/^data-product(-(.+))?$/),r=(null==n?void 0:n[2])?"-"+n[2]:"",a=""+St.PRODUCT.CONTAINER+r;if(t.hasAttribute(a)){const n=t.getAttribute(a),r=t.getAttribute(s);n&&r&&e.push({containerId:n,identifier:r})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",r)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+St.PRODUCT_LIST.SCRIPT+"]");for(const r of n)try{const e=JSON.parse(r.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["+St.PRODUCT.LCE_PRODUCT+"]");for(const r of n)try{const e="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));r.setAttribute("id",e);const n=r.getAttribute(St.PRODUCT.LCE_PRODUCT);e&&n&&t.push({containerId:e,identifier:n})}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}function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}async function addProductToCartViaQueryParam(t,e){const n=e.getAttribute(St.PRODUCT.PARAM),r=e.getAttribute(St.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const a=new URLSearchParams(window.location.search),l=a.get(n);if(!l)return;let d=s.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=a.get(r);t!==s.ON_DEMAND&&t!==s.SHIPPING||(d=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:l,fulfillmentType:d,quantity:1}],!![])}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",u)}}async function addPromoCodeToCartViaQueryParam(t,e){const n=e.getAttribute(St.PROMO_TICKER.CODE_PARAM);if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),s=r.get(n);if(s)try{await t.actions.cart.applyPromoCode(s)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",a)}}async function setupCartButton(t,e){var n,r,s;if(e.hasAttribute(St.CART.BUTTON_HIDDEN))return;const a=e.getAttribute(St.CART.BUTTON),l=e.getAttribute(St.CART.BADGE_BUTTON);if(e.hasAttribute(St.CART.BUTTON)&&!a)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(St.CART.BADGE_BUTTON)&&!l)return t.ui.floatingCartButton(!![]),void 0;const d=a||l,u=!!l;if(!d)return console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(!![]),void 0;const h=d.match(/^(above|below|replace|inside):(.+)$/),p=h?h[1]:"inside";let m=h?h[2]:d;/^[#.]/.test(m)||/\s/.test(m)||(m="#"+m);const f=document.querySelector(m);if(!f)return console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+m+'" not found. Using floating button.'),t.ui.floatingCartButton(u),void 0;const g=document.createElement("div");switch(g.classList.add("lce-cart-button-container"),g.id="lce-cart-button-"+Date.now(),p){case"above":null===(n=f.parentNode)||void 0===n?void 0:n.insertBefore(g,f);break;case"below":null===(r=f.parentNode)||void 0===r?void 0:r.insertBefore(g,f.nextSibling);break;case"replace":null===(s=f.parentNode)||void 0===s?void 0:s.replaceChild(g,f);break;default:f.appendChild(g)}t.ui.cartButton(g.id,u)}async function initializeProductsList(t){const e=document.querySelector("div["+St.PRODUCT_LIST.LIST+"]");if(!e)return;const n="lce-products-list-container";e.className="lce-products-list-container",e.id=n;const r=e.getAttribute(St.PRODUCT_LIST.CARD)||"standard",s=e.hasAttribute(St.PRODUCT_LIST.CARD_FILL),a=Number.parseInt(e.getAttribute(St.PRODUCT_LIST.ROWS)||"3",10)||3,l=Number.parseInt(e.getAttribute(St.PRODUCT_LIST.COLUMNS)||"4",10)||4,d=e.getAttribute(St.PRODUCT_LIST.FILTERS),u=e.getAttribute(St.PRODUCT_LIST.PRODUCT_URL)||void 0;let h=[];d&&(h=d.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:n,rows:a,columns:l,cardVariant:r,fillCard:s,filters:h,productUrl:u})}async function ElementsAutoInitialize(){var e,n,r,s,l,d;try{const d=document.querySelector("script["+St.CORE.MAIN_SCRIPT+"]");if(!d)return;const g=d.getAttribute(St.CORE.TOKEN),v=d.getAttribute(St.CORE.ENV)||t.PRODUCTION,y=d.getAttribute(St.CORE.DEBUG_MODE);if(!g)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const b=d.getAttribute(St.PROMO_TICKER.CODE),x=d.getAttribute(St.PROMO_TICKER.TEXT),w=null!==(e=d.getAttribute(St.PROMO_TICKER.SEPARATOR))&&void 0!==e?e:"•",C=null!==(n=d.getAttribute(St.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,k=null!==(r=d.getAttribute(St.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==r?r:void 0,S=pairsFromMainScript(d),E=pairsFromProductsScript(),_=pairsFromAttributedElements(),D=[...S,...E,..._],T=b&&x&&C&&k?{promoCode:b,text:x.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:w,activeFrom:null===(s=new Date(C))||void 0===s?void 0:s.toISOString(),activeUntil:null===(l=new Date(k))||void 0===l?void 0:l.toISOString()}:void 0;let I=a.NONE;y&&v!==t.PRODUCTION&&(I=y);const F=await Elements(g,{env:v,debugMode:I,promoTicker:T?[T]:void 0});if(!F)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);if(0!==D.length)try{await F.injectProductElement(D)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",u)}try{await setupCartButton(F,d)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",h)}try{await initializeProductsList(F)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",p)}try{await addProductToCartViaQueryParam(F,d)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",m)}try{await addPromoCodeToCartViaQueryParam(F,d)}catch(f){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",f)}}catch(g){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(d=null==g?void 0:g.message)&&void 0!==d?d:String(g))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(M){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",M)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(M){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",M)}},50)}catch(M){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",M)}}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:r.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:r.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:r.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.isPresaleLocked",!![]),this.store.set("checkout.presaleExpiresAt",n.toISOString()),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,n){try{const r=ClientConfigService.getInstance();r.initialize(t,{env:n.env,isBuilder:!![],debugMode:n.debugMode,customTheme:n.customTheme,proxy:void 0,promoTicker:n.promoTicker});const s=r.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={updateComponentGlobalConfigs:a.updateComponentGlobalConfigs.bind(a),updateProductComponent:a.updateProductComponent.bind(a),updateAddressComponent:a.updateAddressComponent.bind(a),updateCartComponent:a.updateCartComponent.bind(a),updateCheckoutComponent:a.updateCheckoutComponent.bind(a),injectElement:a.injectElement.bind(a),injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),actions:a.actions};window.elementsBuilder=l;const d=PubSubService.getInstance();return d.publishAction(e.CLIENT_READY,{isReady:!![],message:"Builder Client Is Ready",timestamp:Date.now(),version:r.get("version")}),l}catch(r){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",r)}catch(s){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==r?void 0:r.message)}try{const t=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(e.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return 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,r,s,a)=>isSDKError(a,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:r,colno:s,error:a}),!![]):t?t(e,n,r,s,a):![];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(Et){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Et)}try{triggerElementsAutoInit()}catch(_t){console.error("[LiquidCommerce Elements] Auto-initialization failed:",_t)}}catch(Dt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Dt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});