@liquidcommerce/elements-sdk 2.2.0-beta.21 → 2.2.0-beta.22
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/README.md +1551 -557
- package/dist/index.esm.js +8243 -7986
- package/dist/types/enums/core.enum.d.ts +1 -0
- package/dist/types/modules/product/components/index.d.ts +1 -0
- package/dist/types/modules/product/components/product-engraving.component.d.ts +19 -0
- package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +0 -1
- package/package.json +8 -8
- package/umd/elements.js +1 -1
package/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):(e="undefined"!=typeof globalThis?globalThis:e||self,o(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 o of e)"string"==typeof o?this.appendChild(document.createTextNode(o)):this.appendChild(o)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);this.insertBefore(o,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 o=this.parentNode;if(!o)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);o.replaceChild(r,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const o=this.parentNode;if(!o)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);o.insertBefore(r,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const o=this.parentNode;if(!o)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);o.insertBefore(r,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const o={};for(const[r,s]of e)o[r]=s;return o})}function safeScrollIntoView(e,o){try{o&&"function"==typeof e.scrollIntoView?e.scrollIntoView(o):e.scrollIntoView()}catch(r){try{e.scrollIntoView()}catch(s){console.warn("scrollIntoView failed:",s)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(L){console.warn("DOM polyfills initialization failed:",L)}}function safeReplaceChildren(e,...o){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...o);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const r of o)"string"==typeof r?e.appendChild(document.createTextNode(r)):e.appendChild(r)}}catch(r){console.error("replaceChildren operation failed:",r),1===o.length&&"string"==typeof o[0]&&(e.innerHTML=o[0])}}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,o){const r=SingletonManager.getInstances();r.has(e)||r.set(e,o());const s=r.get(e);if(!s)throw new Error("ElementsSdk: Instance for class "+e+" could not be created.");return s}static async getClient(e){const o=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),r="LiquidCommerceElementsClient_"+o,s=SingletonManager.getInstances();if(s.has(r))return s.get(r);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const c=new SingletonManager.clientConstructor(e);return await c.prepare(),s.set(r,c),c}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;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 o=(new Date).toISOString().slice(11,23);return["%c["+o+"%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,o){if(this.sendToTelemetry("debug",e,void 0,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("debug");void 0!==o?console.debug(r,...s,e,o):console.debug(r,...s,e)}info(e,o){if(!this.enableLogging)return;const[r,...s]=this.getPrefix("info");void 0!==o?console.info(r,...s,e,o):console.info(r,...s,e)}warn(e,o){if(this.sendToTelemetry("warn",e,void 0,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("warn");void 0!==o?console.warn(r,...s,e,o):console.warn(r,...s,e)}error(e,o){const r=o instanceof Error,s=r?o:void 0,c=!r&&o?o:void 0;if(this.sendToTelemetry("error",e,s,c),!this.enableLogging)return;const[l,...d]=this.getPrefix("error");void 0!==o?console.error(l,...d,e,o):console.error(l,...d,e)}group(e,o=![]){if(!this.enableLogging)return;const[r,...s]=this.getPrefix("log");o?console.groupCollapsed(r,...s,e):console.group(r,...s,e)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(e,o,r,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,o,{context:this.context,error:r,data:s})}catch(c){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const o=this.getInstances();if(!o.has(e)){const r=LoggerService.getInstance(e);r.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&r.setTelemetryService(this.telemetryService),o.set(e,r)}return o.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const o=this.getInstances();for(const[,r]of o)r.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const o=this.getInstances();for(const[,r]of o)r.setTelemetryService(e)}}var e;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(e){e.CLOSED="CLOSED",e.OPEN="OPEN",e.HALF_OPEN="HALF_OPEN"}(e||(e={}));class CircuitBreakerService{constructor(o){this.state=e.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.config={failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:1e4,countClientErrorsAsFailures:![],...o},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(e){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(e))}async execute(o,r,s){switch(this.totalCalls++,this.state===e.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(r),this.state){case e.OPEN:if(null==s?void 0:s.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:r,failures:this.failures}),this.executeWithTimeout(o,s.critical);if(null==s?void 0:s.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:r}),this.rejectedCalls++,s.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:r,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(r||"unknown")+")");case e.HALF_OPEN:if(this.halfOpenCallsInProgress>=this.config.halfOpenMaxCalls){if(null==s?void 0:s.fallback)return this.logger.info("Circuit breaker HALF_OPEN limit reached - using fallback",{context:r}),this.rejectedCalls++,s.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:r,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(r||"unknown")+")")}this.halfOpenCallsInProgress++}try{const e=await this.executeWithTimeout(o,null==s?void 0:s.critical);return this.onSuccess(r),e}catch(c){throw this.onFailure(c,r),c}}async executeWithFallback(e,o,r,s){return this.execute(e,r,{fallback:o,critical:s})}getStats(){return{state:this.state,failures:this.failures,successes:this.successes,totalCalls:this.totalCalls,rejectedCalls:this.rejectedCalls,lastFailureTime:this.lastFailureTime,lastSuccessTime:this.lastSuccessTime,isHealthy:this.state===e.CLOSED&&0===this.failures}}reset(){this.state=e.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker reset to initial state")}forceOpen(e){this.openCircuit(e)}forceClose(o){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:o})}async executeWithTimeout(e,o){const r=o?2*this.config.timeout:this.config.timeout;return new Promise((o,s)=>{const c=setTimeout(()=>{s(new Error("Request timeout after "+r+"ms"))},r);e().then(e=>{clearTimeout(c),o(e)}).catch(e=>{clearTimeout(c),s(e)})})}onSuccess(o){this.lastSuccessTime=Date.now(),this.state===e.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(o)):this.state===e.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:o,state:this.state,successes:this.successes,failures:this.failures})}onFailure(o,r){const s=(null==o?void 0:o.status)&&o.status>=400&&o.status<500;if(s&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:r,status:o.status,message:o.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===e.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(r)),this.state===e.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(r),this.logger.warn("Circuit breaker failure",{context:r,state:this.state,failures:this.failures,error:(null==o?void 0:o.message)||o,status:null==o?void 0:o.status,threshold:this.config.failureThreshold,isClientError:s})}openCircuit(o){this.state=e.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:o,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(o){this.state=e.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:o,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(o){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:o,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const o={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},r={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",PRODUCT_ENGRAVING_UPDATED:"product_engraving_updated",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"},s={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},c={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",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"},l={ON_DEMAND:"onDemand",SHIPPING:"shipping"},d={NONE:"none",CONSOLE:"console",PANEL:"panel"},h={[o.LOCAL]:"http://127.0.0.1:8080",[o.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[o.STAGING]:"https://staging-elements.liquidcommerce.us",[o.PRODUCTION]:"https://elements.liquidcommerce.us"},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 ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,o={}){this.validateInputs(e,o),this.config=Object.freeze(this.buildConfiguration(e,o))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,o){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[e]:o})}isDevelopment(){return this.get("env")===o.DEVELOPMENT}isStaging(){return this.get("env")===o.STAGING}isProduction(){return this.get("env")===o.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===d.CONSOLE||e===d.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===d.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===d.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,r){if(!(null==e?void 0:e.trim()))throw new Error("API key is required");if(r.env&&!Object.values(o).includes(r.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+r.env+'". Using default environment.'),r.env=void 0),void 0!==r.isBuilder&&"boolean"!=typeof r.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),r.isBuilder=void 0),void 0===r.debugMode||Object.values(d).includes(r.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+r.debugMode+'". Must be one of: '+Object.values(d).join(", ")+". Using default value."),r.debugMode=void 0),r.promoTicker&&"object"!=typeof r.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),r.promoTicker=void 0),r.promoTicker)if(Array.isArray(r.promoTicker)){const e=r.promoTicker.filter((e,o)=>{if("string"!=typeof e.promoCode||!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+o+"].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["+o+"].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["+o+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+o+"].activeFrom is required. Skipping this promo."),![];const r="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(r instanceof Date)||Number.isNaN(r.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+o+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+o+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?r>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+o+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+o+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});r.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),r.promoTicker=void 0;r.proxy&&("object"!=typeof r.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),r.proxy=void 0):r.proxy.baseUrl&&"string"==typeof r.proxy.baseUrl?r.proxy.headers&&"object"!=typeof r.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),r.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),r.proxy=void 0))}buildConfiguration(e,r){var s,c;const l=r.env||o.STAGING,p=h[l];return{apiKey:e.trim(),env:l,isBuilder:null!==(s=r.isBuilder)&&void 0!==s?s:![],debugMode:null!==(c=r.debugMode)&&void 0!==c?c:d.NONE,baseUrl:p,partnerCode:void 0,customTheme:r.customTheme||null,proxy:r.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:r.promoTicker||null}}detectDeviceType(){var e,o;if("undefined"==typeof navigator)return"desktop";const r=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,c=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,l=(null===(o=window.screen)||void 0===o?void 0:o.height)||0,d=Math.max(c,l),h=[/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/],p=[/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 h.some(e=>e.test(r))?"tablet":p.some(e=>e.test(r))||s&&d<768?"mobile":s&&d>=768&&d<=1200||s&&/macintosh/i.test(r)&&navigator.maxTouchPoints>1||/android/i.test(r)&&s&&d>=768||/windows nt/i.test(r)&&s&&d>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(r),"desktop")}}function fetchAdapter(e){return async(o,r)=>{var s;const c=await e(o,r);let l;if("function"==typeof(null===(s=c.headers)||void 0===s?void 0:s.entries))l=Object.fromEntries(c.headers.entries());else{l={};for(const[e,o]of c.headers)l[e]=o}return{ok:c.ok,status:c.status,statusText:c.statusText,headers:l,json:()=>c.json(),text:()=>c.text()}}}const xhrFetch=(e,o)=>new Promise((r,s)=>{const c=new XMLHttpRequest;c.open(o.method||"GET",e);for(const[e,l]of objectEntries(o.headers))c.setRequestHeader(e,l);c.onload=()=>{r({ok:c.status>=200&&c.status<300,status:c.status,statusText:c.statusText,headers:c.getAllResponseHeaders().split("\r\n").reduce((e,o)=>{const[r,s]=o.split(": ");return r&&s&&(e[r]=s),e},{}),json:()=>Promise.resolve(JSON.parse(c.responseText)),text:()=>Promise.resolve(c.responseText)})},c.onerror=()=>{s(new TypeError("Network request failed"))},c.send(o.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}function objectValues(e){const o=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.push(e[r]);return o}function objectEntries(e){const o=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.push([r,e[r]]);return o}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(),this.circuitBreaker=CircuitBreakerService.getInstance({failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:15e3,countClientErrorsAsFailures:![]})}static getInstance(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(e))}async authenticate(){var e,o;if(this.isAuthenticating)return await new Promise(e=>{const a=()=>{this.isAuthenticating?setTimeout(a,100):e(void 0)};a()}),!!this.accessToken;this.isAuthenticating=!![];try{const r=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.token,this.tokenExpiration=Date.now()+1e3*(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.exp),!![]}catch(r){return this.logger.error("Authentication failed",r),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(e,o,r=![]){return this.circuitBreaker.execute(async()=>{const r=this.buildUrl(e),s={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"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(),...o.headers};this.clientConfig.isBuilder()&&(s["X-Liquid-Api-Builder"]=!![]);const c={method:o.method,headers:s,body:o.body?JSON.stringify(o.body):void 0},l=await this.httpClient(r,c);if(!l.ok)throw{message:"HTTP error status: "+l.status,status:l.status};return l.json()},o.method+" "+e+" (no-auth)",{critical:r})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(e,o,r=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=this.buildUrl(e),s={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"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(),...o.headers};this.clientConfig.isBuilder()&&(s["X-Liquid-Api-Builder"]=!![]);const c={method:o.method,headers:s,body:o.body?JSON.stringify(o.body):void 0},l=await this.httpClient(r,c);let d;try{d=await l.json()}catch(h){const e=await l.text().catch(()=>"HTTP error status: "+l.status);d={message:e||h},this.logger.error("Failed to parse response data",h)}if(!l.ok)throw{...d,status:l.status,message:(null==d?void 0:d.message)||"HTTP error status: "+l.status};return d},o.method+" "+e,{critical:r})}buildUrl(e){const o=this.clientConfig.getProxyConfig();return new URL("api"+e,o?o.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,o){return this.request(e,{method:"GET",headers:null==o?void 0:o.headers},null==o?void 0:o.critical)}async post(e,o){return this.request(e,{method:"POST",body:null==o?void 0:o.body,headers:null==o?void 0:o.headers},null==o?void 0:o.critical)}async put(e,o){return this.request(e,{method:"PUT",body:null==o?void 0:o.body,headers:null==o?void 0:o.headers},null==o?void 0:o.critical)}async delete(e,o){return this.request(e,{method:"DELETE",headers:null==o?void 0:o.headers},null==o?void 0:o.critical)}}const m="@liquidcommerce/elements-sdk",g="LiquidCommerce Elements SDK",v="UNLICENSED",y="LiquidCommerce Team",b="2.2.0-beta.21",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"},k="./dist/index.esm.js",S="./umd/elements.js",E="./dist/types/index.d.ts",T="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"},P=["dist","umd","README.md"],F={access:"public",registry:"https://registry.npmjs.org/"},D="module",A=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],_={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"'},O=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],z={"@biomejs/biome":"2.2.2","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.6","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.3.1","@rollup/plugin-replace":"^6.0.2","@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":"^11.0.6","@semantic-release/npm":"^12.0.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.6.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.3","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.3"},N={node:">=20"},M={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},L={name:m,description:g,license:v,author:y,version:b,homepage:x,repository:w,bugs:C,module:k,browser:S,types:E,packageManager:T,exports:I,files:P,publishConfig:F,type:D,sideEffects:A,scripts:_,keywords:O,devDependencies:z,engines:N,pnpm:M};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 o=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return o.some(o=>{const r=o.src;return r.includes("id="+e)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...e)=>window.dataLayer.push(e),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(e){return new Promise((o,r)=>{if(this.isContainerLoaded(e))return this.logger.info("GTM container "+e+" already loaded, skipping script injection"),o(),void 0;this.logger.info("Loading GTM container "+e);const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+e,s.async=!![];const c=setTimeout(()=>r(new Error("GTM script timeout: "+e)),5e3);s.onload=()=>{clearTimeout(c),this.logger.info("GTM container "+e+" loaded successfully"),o()},s.onerror=()=>{clearTimeout(c),r(new Error("GTM script failed: "+e))},document.head.appendChild(s)})}processEventQueue(){const e=Date.now(),o=this.eventQueue.filter(o=>e-o.timestamp<3e4);for(const s of o)try{const e={event:s.eventName,...s.eventData};window.dataLayer.push(e),"function"==="object".gtag&&window.gtag("event",s.eventName,s.eventData),this.logger.debug("Processed queued GTM event: "+s.eventName,{data:s.eventData})}catch(r){this.logger.error("Error processing queued event "+s.methodName,r)}this.eventQueue=[],o.length>0&&this.logger.info("Processed "+o.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(o){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",o)}}}async doInitialize(e){if(!(null==e?void 0:e.partnerName)||!(null==e?void 0:e.liquidCommerceGtmId))throw new Error("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 o=this.isGTMAlreadyLoaded();o&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let r=![],s="";if(e.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(e.liquidCommerceGtmId),r=!![],s=o?"GTM integrated with existing setup (Partner GTM detected, LC container: "+e.liquidCommerceGtmId+")":"GTM initialized with container "+e.liquidCommerceGtmId}catch(c){this.logger.error("Failed to load LiquidCommerce GTM container: "+c+". Checking if partner GTM is available.",c)}if(r||(o&&window.dataLayer?(r=!![],s="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(r=!![],s="GTM initialized with dataLayer (basic functionality available)")),!r)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(s),this.processEventQueue()}executeEvent(e,o,r){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),c={...r,...s.length>0&&{send_to:s},tenant_source:L.description+" v"+L.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:o,eventData:c,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+o+" (initialization pending)",{data:c}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+o+" skipped: dataLayer not available"),void 0;const l={event:o,...c};window.dataLayer.push(l),"function"==="object".gtag&&window.gtag("event",o,c),this.logger.debug("Sent GTM event: "+o,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:s.length>0?s:"no targeting",data:c})}catch(s){this.logger.error("GTM "+e+" error",s)}}calculateValue(e){const o=e.reduce((e,o)=>e+(o.price||0)*(o.quantity||1),0);return Number.parseFloat(o.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,o,r){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:o,item_list_name:r,items:e})}selectItem(e,o,r){this.executeEvent("selectItem","select_item",{item_list_id:o,item_list_name:r,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,o){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:o,items:e})}addShippingInfo(e,o){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:o,items:e})}addShippingInfoWithCustomerData(e,o,r,s){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:e,coupon:o,phone:null==r?void 0:r.phone,email:null==r?void 0:r.email,birth_date:null==r?void 0:r.birth_date,customer_id:null==r?void 0:r.customer_id,subtotal:null==s?void 0:s.subtotal,total:null==s?void 0:s.total_before_discounts,discounts:null==s?void 0:s.discounts,gift_cards:null==s?void 0:s.gift_cards,net_total:null==s?void 0:s.net_total})}addPaymentInfo(e,o,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:o,coupon:r,items:e})}addPaymentInfoWithoutItems(e,o,r,s){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:e,payment_type:o,coupon:r,subtotal:null==s?void 0:s.subtotal,total:null==s?void 0:s.total_before_discounts,discounts:null==s?void 0:s.discounts,gift_cards:null==s?void 0:s.gift_cards,net_total:null==s?void 0:s.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,o){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:o})}promoCodeFailed(e,o){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:o})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,o){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:o})}giftCardFailed(e,o){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:o})}increaseQuantity(e){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}decreaseQuantity(e){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}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})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(e,o){this.publishSpecific("actions."+e,o)}publishForm(e,o){this.publishSpecific("forms."+e,o)}publishSpecific(e,o){const[r,s]=e.includes(".")?e.split(".",2):["actions",e];let c=s.split("_")[0];["product","cart","address","checkout"].includes(c)||(c="other");const l=Date.now(),d={eventId:this.generateEventId(l),namespace:r,event:s,originalEvent:e,actionNamespace:"actions"===r?c:void 0,timestamp:l},h={data:o,metadata:d};this.dispatchNativeEvents(e,h)}dispatchNativeEvents(e,o){const[r]=e.split(".",2);try{const s=new CustomEvent(this.eventPrefix+":"+e,{detail:o,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const c=new CustomEvent(this.eventPrefix+":"+r,{detail:o,bubbles:!![],cancelable:!![]});window.dispatchEvent(c)}catch(s){this.logger.error("Error dispatching native events for "+e,s)}}generateEventId(e){return"evt_"+e+"_"+Math.random().toString(36).slice(2,9)}}const B="liquid_elements",q={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:l.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,engravingLines:[],drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},j={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee: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:[]},U={drawer:{isOpen:![],contentConfig:null}},V={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},H={products:{},cart:j,address:V,checkout:G,ui:U};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",{critical:!![]});if(!this.validResponseData(e))throw this.logger.error("Invalid response data",e),new Error("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,o){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!o||0===Object.keys(o).length)return this.logger.error("No data provided to set persisted store"),void 0;const r=await this.client.post("/configs/store/"+e,{body:o});200!==r.statusCode&&this.logger.error("Failed to set persisted store",r)}catch(r){this.logger.error("Error setting persisted store",r)}}async getPersistedStore(e){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to get persisted store"),null;const o=await this.client.get("/configs/store/"+e);return 200!==o.statusCode?(this.logger.error("Failed to fetch persisted store",o),null):o.data}catch(o){return this.logger.error("Error fetching persisted store",o),null}}async getProductsData(e,o){try{if(this.ensureClientInitialized(),0===e.length)return this.logger.error("No product identifiers provided"),null;const r={upcs:e,ids:e,grouping:e,shouldShowOffHours:!![],isLegacy:!![],loc:o},s=await this.client.post("/cloud/catalog/availability",{body:r});return 200===s.statusCode&&s.products&&0!==s.products.length?{products:s.products,retailers:s.retailers}:(this.logger.error("Failed to fetch product data",s),null)}catch(r){return this.logger.error("Error fetching product data",r),null}}async getCartData(e){try{this.ensureClientInitialized();const o=await this.client.get("/cloud/cart"+(e?"?id="+e:""));if(200!==o.statusCode)throw this.logger.error("Failed to fetch cart data",o),new Error("Failed to fetch cart data: "+o.message);return o.cart}catch(o){throw this.logger.error("Error fetching cart data",o),o}}async updateCart(e){try{this.ensureClientInitialized();const o=await this.client.put("/cloud/cart",{body:e});if(200!==o.statusCode)throw this.logger.error("Failed to update cart",o),new Error("Failed to update cart: "+o.message);return o.cart}catch(o){throw this.logger.error("Error updating cart",o),o}}async getAddressSuggestions(e){try{if(this.ensureClientInitialized(),!e||0===e.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const o=await this.client.get("/cloud/address/autocomplete?input="+e);return 200!==o.statusCode?(this.logger.error("Failed to fetch address suggestions",o),[]):o.data}catch(o){return this.logger.error("Error fetching address suggestions",o),[]}}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 Error("Address ID is required to fetch address details");const o=await this.client.get("/cloud/address/details/"+e);if(200!==o.statusCode)throw this.logger.error("Failed to fetch address details",o),new Error("Failed to fetch address details: "+o.message);return o.data}catch(o){throw this.logger.error("Error fetching address details",o),o}}async prepareCheckout(e){var o;try{this.ensureClientInitialized();const o=await this.client.post("/cloud/checkout/prepare",{body:e,critical:!![]});if(200!==o.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",o),new Error("Failed to fetch prepare checkout data: "+o.message);return o.checkout}catch(r){throw this.logger.error("Error fetching prepare checkout data:",null!==(o=null==r?void 0:r.message)&&void 0!==o?o:r),r}}async getPaymentSession(e){var o;try{this.ensureClientInitialized();const o=await this.client.post("/cloud/payment/session",{body:e,critical:!![]});if(201!==o.statusCode)throw this.logger.error("Failed to get payment session",o),new Error("Failed to get payment session: "+o.message);return o.data}catch(r){throw this.logger.error("Error fetching payment session:",null!==(o=null==r?void 0:r.message)&&void 0!==o?o:r),r}}async confirmPaymentSession(e,o){try{this.ensureClientInitialized();const r=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:e,setupIntentId:o},critical:!![]});if(200!==r.statusCode)throw this.logger.error("Failed to confirm payment session",r),new Error("Failed to confirm payment session: "+r.message);return r.data}catch(r){throw this.logger.error("Error confirming payment session",r),r}}async checkoutComplete(e){var o;try{this.ensureClientInitialized();const o=await this.client.post("/cloud/checkout/complete",{body:e,critical:!![]});if(200!==o.statusCode)throw this.logger.error("Failed to complete checkout",o),new Error("Failed to complete checkout: "+o.message);return o.order}catch(r){if(this.logger.error("Error completing checkout:",null!==(o=null==r?void 0:r.message)&&void 0!==o?o:r),null==r?void 0:r.error)throw new Error(r.error);throw r}}validResponseData(e){return e.data&&"object"==typeof e.data&&Object.keys(e.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:e,payload:o,next:r})=>{const s=performance.now();this.logger.group("🏪 Store "+e+" ---------------------------------"),this.logger.debug("Payload:",o);try{const e=r(),o=performance.now()-s;return this.logger.debug("Completed in "+o.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:o})=>{const r=performance.now(),s=o(),c=performance.now()-r;return c>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+c.toFixed(2)+"ms"),s},this.state=H,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:o,persistedStore:r}){this.localStorageKey=B+"_"+e,this.isLocalStorageAvailable=o,o?await this.loadPersistedState():r&&await this.loadFromDBPersistence(r),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:o,hasPersistedState:null!==r,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const o=e.split(".");let r=this.state;for(const s of o){if(null==r)return;r=r[s]}return void 0!==r?Array.isArray(r)?[...r]:"object"==typeof r&&null!==r?{...r}:r:void 0}set(e,o){return this.runWithMiddleware("set",{path:e,value:o},()=>{const r=this.get(e);return this.state=this.immutableSet(this.state,e,o),this.notifyListeners(e,o,r),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,o){const r=this.get(e),s=o(r);return this.set(e,s)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const o=this.get(e);if(void 0===o)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const r=e.split(".");let s=this.state;const c=r.pop();for(const l of r){if(void 0===s[l])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];s=s[l]}if(Array.isArray(s))s=s.filter((e,o)=>o!==Number.parseInt(c,10));else{if("object"!=typeof s||null===s)return this.logger.warn('Cannot remove property "'+c+'" from non-object type at path "'+e+'".'),![];{const{[c]:e,...o}=s;s=o}}return this.state=this.immutableSet(this.state,r.join("."),s),this.notifyListeners(e,void 0,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const o=[];if("function"==typeof e){const r=e(this.state);for(const[e,s]of Object.entries(r)){const r=this.get(e);o.push({path:e,oldValue:r,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,s)}}else for(const[r,s]of Object.entries(e)){const e=this.get(r);o.push({path:r,oldValue:e,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,r,s)}for(const{path:e,oldValue:r,newValue:s}of o)this.notifyListeners(e,s,r);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,o){const r=e;return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(o),()=>{var e;null===(e=this.listeners.get(r))||void 0===e?void 0:e.delete(o)}}watchMany(e,o){const r=[];let s;const c=e.map(e=>this.watch(e,(c,l)=>{r.push({path:e,value:c,oldValue:l}),clearTimeout(s),s=setTimeout(()=>{r.length>0&&(o([...r]),r.length=0)},0)}));return()=>{for(const e of c)e()}}createProductInstance(e){const o="products."+e,r=this.get(o);return r?!![]:this.set(o,q)}removeProductInstance(e){const o=this.get("products"),{[e]:r,...s}=o;return this.set("products",s)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(e,o,r){let s=0;const f=()=>{if(s>=this.middleware.length)return r();const c=this.middleware[s++];return c({action:e,payload:o,state:this.getState(),next:f})};return f()}immutableSet(e,o,r){const s=o.split(".");if(1===s.length){if(Array.isArray(e)){const o=[...e];return o[s[0]]=r,o}return{...e,[s[0]]:r}}const[c,...l]=s,d=e[c],h=Array.isArray(d)?[]:{};if(Array.isArray(e)){const o=[...e];return o[c]=this.immutableSet(d||h,l.join("."),r),o}return{...e,[c]:this.immutableSet(d||h,l.join("."),r)}}notifyListeners(e,o,r){const s=this.listeners.get(e);if(s)for(const h of s)try{h(o,r)}catch(l){this.logger.error('Error in store listener for path "'+e+'"',l)}const c=e.split(".");for(let h=c.length-1;h>0;h--){const e=c.slice(0,h).join("."),o=this.listeners.get(e);if(o){const s=this.get(e),l=c.slice(h).join("."),p=this.immutableSet(s,l,r);for(const r of o)try{r(s,p)}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 o=this.get("address.id")||"",r=this.get("cart.id")||"";if(!o&&!r)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:o,cartId:r}),void 0;try{const s=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(s,{p:o,c:r}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:o,cartId:r})}catch(s){this.logger.error("Failed to persist session data to DB",s)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const o=this.get("address.id")||"",r=this.get("cart.id")||"";(o||r)&&(e=o+"_"+r)}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 o=localStorage.getItem(this.localStorageKey);if(!o)return;try{const e=JSON.parse(o);for(const[o,r]of Object.entries(e))this.set(o,r);return}catch(e){if(o.includes("_")){const[e,r]=o.split("_");if(void 0!==e){const o=await this.getAddressDataFromId(e);this.set("address",o)}return void 0!==r&&this.set("cart.id",r||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:o})}}catch(o){this.logger.error("Failed to load persisted state",o),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const o=await this.getAddressDataFromId(e.p);this.set("address",o)}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(o){this.logger.error("Failed to load session data from DB persistence",o)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(e){if(!e||""===e.trim())return V;try{const o=await this.api.getAddressDetails(e);return o&&0!==Object.keys(o).length?{id:e,formattedAddress:o.formattedAddress,address:{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country||""},coordinates:{lat:o.coords.lat,long:o.coords.long}}:{...V,id:e}}catch(o){return{...V,id:e}}}}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()}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,o)=>e.filter(e=>o.includes(e.type)),excludeCartEvents=(e,o)=>e.filter(e=>!o.includes(e.type)),eventsForCart=e=>excludeCartEvents(e,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=e=>{const o=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],r=includeCartEvents(e,o);return r.length>0},includeCheckoutEvents=(e,o)=>e.filter(e=>o.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 o=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return e.some(e=>o.includes(e.type))},Y={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"},W={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:Y[e.type]||"error"})),transformCheckoutEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:W[e.type]||"error"})),transformEventsForCart=e=>{const o=eventsForCart(e);return transformCartEventsRaw(o)},transformEventsForCheckout=e=>{const o=eventsForCheckout(e);return transformCheckoutEventsRaw(o)},transformPromoCodeCheckoutEvents=e=>{const o=promoCodeCheckoutEvents(e);return transformCheckoutEventsRaw(o)},transformGiftCardCheckoutEvents=e=>{const o=giftCardCheckoutEvents(e);return transformCheckoutEventsRaw(o)};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,engravingFee:e.engravingFee||0,deliveryFee:e.deliveryFee||0,discounts:e.discounts||0,quantity:e.quantity||0}}function buildRetailerStore(e){var o;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===(o=e.fulfillments)||void 0===o?void 0:o.map(e=>e.id))||[]}}function buildFulfillmentStore(e,o){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:o.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(e,o){var r;const s=o.formattedAddress?o:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in e.items||{}){const o=e.items[l];c[l]={id:o.id,variantId:o.variantId,liquidId:o.liquidId,retailerId:o.retailerId,partNumber:o.partNumber,fulfillmentId:o.fulfillmentId,upc:o.upc,sku:o.sku,salsifyGrouping:o.salsifyGrouping,catPath:o.catPath,volume:o.volume,uom:o.uom,pack:o.pack,packDesc:o.packDesc,container:o.container,containerType:o.containerType,name:o.name,brand:o.brand,size:o.size,price:o.price||0,quantity:o.quantity||0,maxQuantity:o.maxQuantity||0,unitPrice:o.unitPrice||0,mainImage:o.mainImage||"",attributes:o.attributes||{}}}return{id:e.id,promoCode:(null===(r=e.promoCode)||void 0===r?void 0:r.code)||"",items:c,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.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},updatedAt:e.updatedAt,createdAt:e.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}async loadCart(){var e,o,s,c,l,d;try{this.store.set("cart.loading",!![]);const h=this.store.get("cart"),p=await this.api.getCartData(h.id);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 m={"cart.id":p.id,"cart.error":null,"cart.totals":buildCartTotals(p),"cart.updatedAt":p.updatedAt||(new Date).toISOString(),"cart.createdAt":p.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(o=null===(e=p.attributes)||void 0===e?void 0:e.promoCode)||void 0===o?void 0:o.value)?{code:p.attributes.promoCode.value.toUpperCase(),discountAmount:p.attributes.promoCode.discount||0,error:null}:null};if((null===(s=p.items)||void 0===s?void 0:s.length)>0)for(const e of p.items)m["cart.items."+e.id]=buildCartItemStore(e);if((null===(c=p.retailers)||void 0===c?void 0:c.length)>0)for(const e of p.retailers)if(m["cart.retailers."+e.id]=buildRetailerStore(e),(null===(l=e.fulfillments)||void 0===l?void 0:l.length)>0)for(const o of e.fulfillments)m["cart.fulfillments."+o.id]=buildFulfillmentStore(o,e);(null===(d=p.events)||void 0===d?void 0:d.length)>0&&(m["cart.events"]=transformEventsForCart(p.events||[])),this.store.batch(m),p.id!==h.id&&await this.store.persist();const g=this.store.get("cart"),v=this.store.get("address");this.pubSub.publishAction(r.CART_LOADED,cartDataForEventFromStore(g,v))}catch(h){throw this.store.set("cart.error",(null==h?void 0:h.message)||"Failed to load cart"),this.logger.error("Load cart failed",h),h}finally{this.store.set("cart.loading",![])}}}const Q="lce-checkout-stripe-slot",X={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Z={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},$={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(e){return e/100}function formatCentToDollarText(e,o=!![]){const r=Math.floor(e/100),s=e%100;let c="$"+r.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(o||s>0)&&(c+=".",c+=s<10?"0"+s:s.toString()),c}function htmlStringToElement(e){const o=document.createElement("template");return o.innerHTML=e.trim(),o.content.firstElementChild}function format24TimeTo12$1(e){const o=e.match(/^(\d{1,2}):(\d{2})$/);if(!o)throw new Error("Invalid time format: "+e);const r=Number.parseInt(o[1],10),s=Number.parseInt(o[2],10);if(r<0||r>23||s<0||s>59)throw new Error("Invalid time values: "+e);const c=r>=12?"PM":"AM",l=r%12||12;return l+":"+s.toString().padStart(2,"0")+" "+c}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const o=new Date(e);if(Number.isNaN(o.getTime()))return"";const r=(o.getMonth()+1).toString().padStart(2,"0"),s=o.getDate().toString().padStart(2,"0"),c=o.getFullYear().toString();return r+"/"+s+"/"+c}catch(o){return""}}function validateMinimumAge(e,o=21,r=1930){if(!e)return{isValid:![],age:null,error:"Birth date is required"};try{const s=e instanceof Date?e:new Date(e);if(Number.isNaN(s.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const c=new Date;if(s>c)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const l=s.getFullYear();if(l<r)return{isValid:![],age:null,error:"Birth year cannot be before "+r+". Please check your birth date."};const d=calculateAge(s,c);return d<o?{isValid:![],age:d,error:"Must be at least "+o+" years old"}:{isValid:!![],age:d}}catch(s){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(e,o){let r=o.getFullYear()-e.getFullYear();const s=o.getMonth()-e.getMonth();return(s<0||0===s&&o.getDate()<e.getDate())&&r--,Math.max(0,r)}function buildFormattedAddressString(e){const o=[],r=[];e.one&&e.one.trim()&&r.push(e.one.trim()),e.two&&e.two.trim()&&r.push(e.two.trim()),r.length>0&&o.push(r.join(" ")),e.city&&e.city.trim()&&o.push(e.city.trim());const s=[];return e.state&&e.state.trim()&&s.push(e.state.trim()),e.zip&&e.zip.trim()&&s.push(e.zip.trim()),s.length>0&&o.push(s.join(" ")),e.country&&e.country.trim()&&o.push(e.country.trim()),o.join(", ")}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const o=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:o[0]||"",category2:o[1]||"",category3:o[2]||""}}function validateCustomerInfo(e){const o=[X.firstName,X.lastName,X.email,X.phone,X.birthDate];if(!e)return{isValid:![],invalidFields:o};const r=[];for(const s of o){const o=e[s];if(!o||"string"==typeof o&&""===o.trim())r.push(s);else if("birthDate"===s){const e=validateMinimumAge(o,21,1930);e.isValid||r.push(s)}}return{isValid:0===r.length,invalidFields:r}}function validateGiftRecipientInfo(e){const o=[Z.firstName,Z.lastName,Z.email,Z.phone,Z.message];if(!e)return{isValid:![],invalidFields:o};const r=[];for(const s of o){const o=e[s];(!o||"string"==typeof o&&""===o.trim())&&r.push(s)}return{isValid:0===r.length,invalidFields:r}}function validateBillingInfo(e){const o=[$.firstName,$.lastName,$.email,$.phone,$.addressOne,$.city,$.state,$.zipCode];if(!e)return{isValid:![],invalidFields:o};const r=[];for(const s of o){const o=e[s];(!o||"string"==typeof o&&""===o.trim())&&r.push(s)}return{isValid:0===r.length,invalidFields:r}}const J=[c.PRODUCT,c.PRODUCT_IMAGE_CAROUSEL,c.PRODUCT_OPTIONS,c.PRODUCT_INTERACTIONS,c.PRODUCT_DESCRIPTION,c.PRODUCT_RETAILERS,c.PRODUCT_RETAILERS_CAROUSEL,c.PRODUCT_RETAILERS_POPUP,c.PRODUCT_RETAILERS_POPUP_LIST,c.PRODUCT_PRICE,c.PRODUCT_ADD_TO_CART_SECTION,c.PRODUCT_DRAWER,c.PRODUCT_LOADING,c.ENGRAVING_FORM,c.ENGRAVING_VIEW],tt=[c.ADDRESS_INPUT,c.ADDRESS_DISPLAY],et=[c.CART,c.CART_RETAILER,c.CART_ITEM,c.CART_FOOTER,c.CART_ITEM_QUANTITY_PRICE,c.CART_RETAILER_SUBTOTAL,c.CART_PROMO_CODE,c.CART_HEADER,c.CART_BODY,c.CART_FULFILLMENT,c.BUTTONS_CART_OPEN],nt=[c.CHECKOUT,c.CHECKOUT_INFORMATION_SECTION,c.CHECKOUT_STRIPE_FORM,c.CHECKOUT_PAYMENT_FORM,c.CHECKOUT_BILLING_FORM,c.CHECKOUT_SUMMARY_SECTION,c.CHECKOUT_PROMO_CODE,c.CHECKOUT_GIFT_CARDS,c.CHECKOUT_AMOUNTS,c.CHECKOUT_ITEMS,c.CHECKOUT_COMPLETED,c.CHECKOUT_DELIVERY_INFORMATION_FORM,c.CHECKOUT_BUYER_INFORMATION_FORM,c.CHECKOUT_TIPS,c.CHECKOUT_PC_GC,c.CHECKOUT_ITEM,c.CHECKOUT_ITEM_QUANTITY,c.CHECKOUT_PLACE_ORDER_BUTTON,c.CHECKOUT_HEADER,c.CHECKOUT_PRESALE_COUNTDOWN];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}loadGoogleFonts(e,o="swap"){if(!e||0===e.length)return;const r=[...this.defaultFontFamilies,...e],s=r.map(e=>{const o=encodeURIComponent(e.name);return"family="+o+":wght@"+e.weights.join(";")}).join("&"),c="display="+o;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+c,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,o="swap"){const r=document.querySelector("link[data-liquid-fonts]");this.loadGoogleFonts(e,o),r&&r.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),o=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",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}if(!o){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute("data-liquid-fonts",""),document.head.appendChild(e)}}const getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n padding-bottom: 8px;\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 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(--heading-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 }\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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\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 .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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 flex-direction: column;\n align-items: flex-start;\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: 400;\n line-height: 20px;\n }\n\n .item-shipping-container {\n display: flex;\n flex-wrap: wrap;\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: 400;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 500;\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: 400;\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: 500;\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\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\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 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 }\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: 400;\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(--heading-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: 400;\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(--heading-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: 400;\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: 400;\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: 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 .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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-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(--heading-font-family, Poppins);\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 width: 64px;\n height: 64px;\n border-radius: var(--card-border-radius, 6px);\n object-fit: cover;\n flex-shrink: 0;}\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n word-break: break-word;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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 h3 {\n overflow: hidden;\n color: var(--base-foreground, #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 }\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: 400;\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: 400;\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 > *: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(--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 p:last-child, .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: 400;\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: 400;\n line-height: 20px;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #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 .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: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: 500;\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(--heading-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(--heading-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: 400;\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 display: flex;\n flex-direction: column;\n align-items: flex-start;\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-weight: 400;\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: 400;\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: 400;\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: 400;\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 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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\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(--heading-font-family, Poppins);\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: 400;\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-container {\n display: flex;\n width: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n .engraving-form-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: 500;\n line-height: 24px;\n margin-bottom: 8px;\n }\n\n .engraving-form-location {\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: 24px;\n }\n\n .engraving-form-header > :not(.engraving-form-location) {\n margin-bottom: 0;\n }\n\n .engraving-form-lines {\n display: flex;\n width: 100%;\n height: auto;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-lines .engraving-form-input-container:not(:last-child) {\n margin-bottom: 16px;\n }\n\n .engraving-form-input-container {\n display: flex;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--border-radius-md, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .engraving-form-input-container .engraving-form-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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-form-input-container .engraving-form-input-char-count {\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: 400;\n line-height: 20px;\n margin-left: 4px;\n }\n\n .engraving-form-actions {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-form-actions > button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: none;\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 cursor: pointer;\n }\n\n .engraving-form-actions > button:first-child {\n margin-right: 8px;\n }\n\n .engraving-form-actions .engraving-form-button-cancel {\n color: var(--primary-color, #1D4ED8);\n }\n\n .engraving-form-actions .engraving-form-button-save {\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 flex: 1 0 0;\n }\n\n .engraving-form-actions .engraving-form-button-save.disabled {\n opacity: 0.5;\n }\n\n .engraving-form-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n }\n\n .engraving-form-disclaimer > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\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: 400;\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.has-header {\n width: 100%;\n padding: 16px;\n }\n\n .price-personalization-container > .main-product-price + .engraving-view-container.has-header {\n margin-top: 24px;\n }\n\n .engraving-view-container.outlined.has-header {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled.has-header {\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.has-header .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: 500;\n line-height: 100%;\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: 400;\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: 400;\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 .engraving-view-container.product .add-engraving-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n height: 36px;\n cursor: pointer;\n\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n background: transparent;\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n\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 .engraving-view-container:not(.product) .add-engraving-button {\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: 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 }\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(--heading-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: 400;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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 /** 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: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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\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-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--heading-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: 225px;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 500;\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 cursor: not-allowed;\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; /* 2 lines * 1.4 line-height */\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-weight:700;\n font-style: normal;\n line-height: 20px;\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; /* 2 lines * 1.4 line-height */\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(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\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: 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: 500;\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 cursor: not-allowed;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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 .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 500;\n }\n\n .fulfillments-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";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 /* Image skeleton styles */\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 queries for responsive skeleton images */\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";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(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\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: 400;\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 it={"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"},ot={backgroundColor:"--product-background-color"},rt={backgroundColor:"--cart-background-color"},st={backgroundColor:"--address-background-color"},at={backgroundColor:"--checkout-background-color"},ct={global:it,product:ot,cart:rt,address:st,checkout:at};function getCSSVariableMapping(e){return ct[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,o){const r={},s=getCSSVariableMapping(o);for(const[c,l]of Object.entries(s)){const o=this.getValueByPath(e,c);void 0!==o&&this.isCSSValue(o)&&(r[l]=o,this.isColorVariable(l,o)&&this.generateOpacityVariants(r,l,o))}return r}extractVariablesFromPartialTheme(e,o){const r={},s=getCSSVariableMapping(o);for(const[c,l]of Object.entries(s))if(this.hasValueAtPath(e,c)){const o=this.getValueByPath(e,c);void 0!==o&&this.isCSSValue(o)&&(r[l]=o,this.isColorVariable(l,o)&&this.generateOpacityVariants(r,l,o))}return r}generateCSSVariablesString(e){return Object.entries(e).map(([e,o])=>" "+e+": "+o+";").join("\n")}updateCSSVariablesInStylesheet(e,o){if(0!==Object.keys(o).length)try{const r=this.findOrCreateRule(e);for(const[e,s]of Object.entries(o))r.style.setProperty(e,String(s))}catch(r){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,o){return o.split(".").reduce((e,o)=>e&&void 0!==e[o]?e[o]:void 0,e)}hasValueAtPath(e,o){const r=o.split(".");let s=e;for(const c of r){if(null==s||!(c in s))return![];s=s[c]}return!![]}findOrCreateRule(e){const o=":host";for(const s of Array.from(e.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===o)return s;const r=e.insertRule(o+" {}");return e.cssRules[r]}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,o,r){for(const s of this.opacityLevels){const c=o+"-"+s.suffix,l=this.addOpacityToHexColor(r,s.value);l&&(e[c]=l)}}isColorVariable(e,o){if("string"!=typeof o)return![];const r=e.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(o);return r&&s}addOpacityToHexColor(e,o){if(!e.startsWith("#"))return null;let r=e.slice(1);if(3===r.length&&(r=r.split("").map(e=>e+e).join("")),6!==r.length)return null;const s=Math.round(255*o),c=s.toString(16).padStart(2,"0");return"#"+r+c}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,o){const r=this.cssProcessor.extractVariablesFromTheme(o,e),s=this.cssProcessor.generateCSSVariablesString(r),c=this.getStylesheetStyles(e).join("\n\n"),l=0===s.length?"":":host { "+s+" }",d=("\n "+l+"\n\n "+c+"\n ").trim();this.createStylesheet(e,d)}createStylesheet(e,o){try{if(this.isCSSStyleSheetSupported()){const r=new CSSStyleSheet;r.replaceSync(o),this.styleSheets.set(e,r)}else this.styleSheets.set(e,o)}catch(L){this.styleSheets.set(e,o)}}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,o,r){const s=this.styleSheets.get(e);if(s&&"string"!=typeof s){const e=this.cssProcessor.extractVariablesFromPartialTheme(o,r);this.cssProcessor.updateCSSVariablesInStylesheet(s,e)}}getStylesheetStyles(e){switch(e){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];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 o,r;this.data.global=this.deepMerge(this.getConfigs("global"),e),((null===(o=e.theme)||void 0===o?void 0:o.headingFont)||(null===(r=e.theme)||void 0===r?void 0:r.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!==J.indexOf(e)?this.getConfigs("product"):-1!==tt.indexOf(e)?this.getConfigs("address"):-1!==et.indexOf(e)?this.getConfigs("cart"):-1!==nt.indexOf(e)?this.getConfigs("checkout"):void 0}getStylesheet(e){const o=this.getBaseStylesheets();if(e===c.DRAWER){const e=[...o],r=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),c=this.stylesheetGenerator.getStylesheet("checkout"),l=this.stylesheetGenerator.getStylesheet("address");return r&&e.push(r),s&&e.push(s),c&&e.push(c),l&&e.push(l),e}let r;if(tt.includes(e)||e===c.ADDRESS)r="address";else if(J.includes(e)||e===c.PRODUCT)r="product";else if(et.includes(e)||e===c.CART)r="cart";else{if(!nt.includes(e)&&e!==c.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),o;r="checkout"}const s=this.stylesheetGenerator.getStylesheet(r);return s?[...o,s]:o}getBaseStylesheets(){const e=[],o=this.stylesheetGenerator.getStylesheet("global"),r=this.stylesheetGenerator.getStylesheet("ui");return o&&e.push(o),r&&e.push(r),e}deepMerge(e,o){const r={...e};for(const s in o)null!==o[s]&&void 0!==o[s]&&("object"!=typeof o[s]||Array.isArray(o[s])||"object"!=typeof e[s]||Array.isArray(e[s])?r[s]=o[s]:r[s]=this.deepMerge(e[s],o[s]));return r}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,o){const s={type:e,data:o||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:s}),e===c.CART&&this.pubSub.publishAction(r.CART_OPENED,!![]),e===c.CHECKOUT&&this.pubSub.publishAction(r.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===c.CART&&this.pubSub.publishAction(r.CART_CLOSED,!![]),(null==e?void 0:e.type)===c.CHECKOUT&&this.pubSub.publishAction(r.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(e,o,r){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:o.name,expectationDetail:r.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(e){var o,s,c;try{this.store.set("checkout.loading",!![]);const d=e||this.store.get("cart.id"),h=this.store.get("cart");if(0===(null===(o=Object.values(h.items))||void 0===o?void 0:o.length)&&!e)return;const p=this.themeProvider.getConfigs("checkout"),m={canEmail:p.layout.emailOptIn.checked,canSms:p.layout.smsOptIn.checked};if(!d)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const g={"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:""}},v=await this.api.prepareCheckout({cartId:d,marketingPreferences:m});if((null===(s=v.retailers)||void 0===s?void 0:s.length)>0)for(const e of v.retailers)for(const o of e.fulfillments)o.type===l.ON_DEMAND&&(g["checkout.onDemandFulfillmentTipInfo."+o.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:o.id,tip:o.tip,subtotal:o.subtotal});if((null===(c=v.items)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.items");for(const e of v.items){const o=v.retailers.find(o=>o.id===e.retailerId),r=o.fulfillments.find(o=>o.id===e.fulfillmentId);g["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,o,r)}}v.isPresaleLocked&&v.presaleExpiresAt&&(g["checkout.isPresaleLocked"]=v.isPresaleLocked,g["checkout.presaleExpiresAt"]=v.presaleExpiresAt),g["checkout.token"]=v.token,g["checkout.cartId"]=v.cartId,g["checkout.customer"]=v.customer,g["checkout.acceptedAccountCreation"]=v.acceptedAccountCreation,g["checkout.billingSameAsShipping"]=v.billingSameAsShipping,g["checkout.hasAgeVerify"]=v.hasAgeVerify,g["checkout.hasSubstitutionPolicy"]=v.hasSubstitutionPolicy,g["checkout.isGift"]=v.isGift,g["checkout.marketingPreferences"]=v.marketingPreferences,g["checkout.giftCards"]=v.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),g["checkout.promoCode"]=v.promoCode.value?{code:v.promoCode.value,discountAmount:v.promoCode.discount}:null,g["checkout.marketingPreferences.canEmail"]=v.marketingPreferences.canEmail,g["checkout.marketingPreferences.canSms"]=v.marketingPreferences.canSms,g["checkout.amounts"]=v.amounts,g["checkout.error"]=null,g["checkout.updating"]=![],g["checkout.events"]=v.events||[],this.store.batch(g),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_LOADED,{cartId:v.cartId})}catch(d){throw this.store.set("checkout.error",d.message),this.pubSub.publishAction(r.CHECKOUT_FAILED,{message:d.message}),d}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(e){var o,s,c,d,h;try{let r;if(this.store.set("checkout.updating",!![]),await this.commonCommands.loadCart(),null==e?void 0:e.response)r=e.response;else{const s=null!==(o=null==e?void 0:e.cartId)&&void 0!==o?o:this.store.get("checkout.cartId");if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;r=await this.api.prepareCheckout({cartId:s})}const p={"checkout.token":r.token,"checkout.events":transformEventsForCheckout(r.events||[]),"checkout.amounts":r.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":r.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),"checkout.promoCode":(null===(c=null===(s=null==r?void 0:r.promoCode)||void 0===s?void 0:s.value)||void 0===c?void 0:c.trim())?{code:r.promoCode.value,discountAmount:r.promoCode.discount}:null};if((null===(d=r.retailers)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const e of r.retailers)for(const o of e.fulfillments)o.type===l.ON_DEMAND&&(p["checkout.onDemandFulfillmentTipInfo."+o.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:o.id,tip:o.tip,subtotal:o.subtotal})}if((null===(h=r.items)||void 0===h?void 0:h.length)>0){this.store.remove("checkout.items");for(const e of r.items){const o=r.retailers.find(o=>o.id===e.retailerId),s=o.fulfillments.find(o=>o.id===e.fulfillmentId);p["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,o,s)}}this.store.batch(p),this.validateAndUpdateFormStatus()}catch(p){const e=(null==p?void 0:p.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(r.CHECKOUT_FAILED,{message:e}),p}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(e){const o=this.store.get("checkout.isGift"),s=null!=e?e:!o;this.store.batch({"checkout.isGift":s,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_IS_GIFT_TOGGLED,{isActive:s})}async toggleBillingSameAsShipping(e){const o=this.store.get("checkout.billingSameAsShipping"),s=null!=e?e:!o;this.store.batch({"checkout.billingSameAsShipping":s,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:s})}toggleMarketingPreferences(e,o){const s=this.store.get("checkout.marketingPreferences."+e),c=null!=o?o:!s;this.store.set("checkout.marketingPreferences."+e,c),this.pubSub.publishAction(r.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:e,isActive:c})}async getPaymentSession(){try{const e=this.store.get("cart.id"),o=await this.api.getPaymentSession({cartId:e});this.store.set("checkout.payment",{key:o.key,secret:o.secret,paymentMethodId:null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,o){try{const r=await this.api.confirmPaymentSession(e,o);this.store.batch({"checkout.payment.paymentMethodId":r.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...r.card}})}catch(r){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(e){var o;try{this.googleTagManager.promoCodeAttempt(e);const r=this.dataForCheckoutPrepare(),s=await this.api.prepareCheckout({...r,promoCode:e}),c=0!==s.amounts.discounts,l=null===(o=transformPromoCodeCheckoutEvents(s.events||[]))||void 0===o?void 0:o[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,s.amounts.discounts),await this.partialLoadCheckout({response:s})}catch(r){const o=(null==r?void 0:r.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",o),this.googleTagManager.promoCodeFailed(e,o),r}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(L){const o=L.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",o),L}}async removePromoCode(){var e,o;try{const r=this.dataForCheckoutPrepare(),s=(null===(o=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===o?void 0:o.code)||"",c=await this.api.prepareCheckout({...r,promoCode:""});if(0!==c.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(s,0),await this.partialLoadCheckout({response:c})}catch(r){const e=(null==r?void 0:r.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const o=this.store.get("checkout.promoCode.code")||"";throw o&&this.googleTagManager.promoCodeFailed(o,e),r}}async applyGiftCard(e){var o;const r=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(r);const e=this.dataForCheckoutPrepare(),s=e.giftCards||[],c=await this.api.prepareCheckout({...e,giftCards:[...s,r]}),l=null===(o=transformGiftCardCheckoutEvents(c.events||[]))||void 0===o?void 0:o[0],d=hasAnyRetailerGiftCardRestriction(c.events||[]);if(l){if(!d)return this.store.set("checkout.giftCardError",l.message),void 0;this.store.set("checkout.giftCardError",l.message)}const h=c.giftCards.find(e=>e.code===r);if(!h)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(r,(null==l?void 0:l.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(r,h.applied),await this.partialLoadCheckout({response:c})}catch(s){const e=(null==s?void 0:s.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(r,e),s}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(L){throw this.store.set("checkout.error",(null==L?void 0:L.message)||"Failed to clear gift card error. Please try again."),L}}async removeGiftCard(e){var o;const r=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare(),s=(null===(o=e.giftCards)||void 0===o?void 0:o.filter(e=>e!==r))||[],c=await this.api.prepareCheckout({...e,giftCards:s}),l=c.giftCards.find(e=>e.code===r);if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+r),void 0;this.googleTagManager.giftCardApplied(r,0),await this.partialLoadCheckout({response:c})}catch(s){const e=(null==s?void 0:s.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(r,e),s}}updateCustomerInfo(e,o){try{this.store.set("checkout.customer."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:e})}catch(s){throw this.store.set("checkout.error",s.message),s}}updateBillingInfo(e,o){try{this.store.set("checkout.billing."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:e})}catch(s){throw this.store.set("checkout.error",s.message),s}}updateGiftInfo(e,o){try{this.store.set("checkout.giftRecipient."+e,o),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(r.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:e})}catch(s){throw this.store.set("checkout.error",s.message),s}}triggerAddShippingInfoEvent(){var e,o;const r=this.store.get("checkout");if(r.customer.email||r.customer.phone){const s=(null===(e=null==r?void 0:r.customer)||void 0===e?void 0:e.id)||(null===(o=null==r?void 0:r.customer)||void 0===o?void 0:o.email),c={subtotal:centToDollar(r.amounts.subtotal),total_before_discounts:centToDollar(r.amounts.subtotal+r.amounts.tax+r.amounts.shipping+r.amounts.delivery+r.amounts.platform+r.amounts.service),discounts:centToDollar(r.amounts.discounts),gift_cards:centToDollar(r.amounts.giftCards||0),net_total:centToDollar(r.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(r.amounts.total),void 0,{phone:r.customer.phone,email:r.customer.email,birth_date:r.customer.birthDate,customer_id:s},c)}}validateAndUpdateFormStatus(){const e=this.store.get("checkout"),o=validateCustomerInfo(e.customer),r=e.isGift?validateGiftRecipientInfo(e.giftRecipient):{isValid:!![],invalidFields:[]},s=e.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(e.billing),c=o.isValid&&r.isValid&&s.isValid,l=[...o.invalidFields.map(e=>"customer."+e),...r.invalidFields.map(e=>"giftRecipient."+e),...s.invalidFields.map(e=>"billing."+e)];this.store.batch({"checkout.isFormValid":c,"checkout.invalidFields":l,"checkout.readyForSubmit.customer":o.isValid,"checkout.readyForSubmit.gift":r.isValid,"checkout.readyForSubmit.billing":s.isValid})}async checkoutComplete(){var e;try{const o=this.store.get("checkout"),s=this.store.get("checkout.payment.paymentMethodId");if(!o.token||!s)return;const l=await this.api.checkoutComplete({token:o.token,payment:s}),d=l.legacyOrderNumber||l.referenceId||"N/A";o.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(c.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(r.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 o=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:o.category,item_category2:o.category2,item_category3:o.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(r.CHECKOUT_SUBMIT_FAILED,{message:e}),o}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var e,o,s,c;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(r.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===(s=l.promoCode)||void 0===s?void 0:s.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||""}))},h=await this.api.prepareCheckout(d);this.store.batch({"checkout.customer":h.customer,"checkout.acceptedAccountCreation":h.acceptedAccountCreation,"checkout.billingSameAsShipping":h.billingSameAsShipping,"checkout.hasAgeVerify":h.hasAgeVerify,"checkout.hasSubstitutionPolicy":h.hasSubstitutionPolicy,"checkout.isGift":h.isGift,"checkout.marketingPreferences":h.marketingPreferences,"checkout.events":h.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent();const p={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,p)}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(r.CHECKOUT_SUBMIT_FAILED,{message:e}),l}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(c.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 o=e[0];this.store.set("checkout.focusField",o),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,o){var r,s,c;const l={id:e.cartItemId,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:o},d=(null===(c=null===(s=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.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 s=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+e);if(!c)throw new Error("Item not found");const l=c.quantity,d=c.quantity+o;if(d<1)return this.removeItem(e,!![]);const h=this.buildItemUpdate(c,d);await this.api.updateCart({id:s,items:[h],loc:this.getLocation()}),this.pubSub.publishAction(o>0?r.CHECKOUT_ITEM_QUANTITY_INCREASE:r.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_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()}catch(s){throw this.store.set("checkout.items."+e+".error",s.message),s}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var o,s,c;try{const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+e);if(!d)throw new Error("Item not found in checkout");if(!(null===(o=d.attributes)||void 0===o?void 0:o.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const h=(null===(c=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||[],p={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:[]};await this.api.updateCart({id:l,items:[p],loc:this.getLocation()}),this.pubSub.publishAction(r.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:d.cartItemId,engravingLines:[],previousEngravingLines:h}),await this.partialLoadCheckout()}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 s=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+e);if(!c)throw new Error("Item not found");const l=this.buildItemUpdate(c,0);await this.api.updateCart({id:s,items:[l],loc:this.getLocation()}),this.store.remove("checkout.items."+e),this.pubSub.publishAction(r.CHECKOUT_ITEM_REMOVED,{cartItemId:c.cartItemId}),await this.partialLoadCheckout()}catch(s){throw this.store.set("checkout.items."+e+".error",s.message),s}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(o).map(o=>{const r=Math.round(o.subtotal*e/100);return{fulfillmentId:o.fulfillmentId,tip:r}}),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:s});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(r.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}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 s=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},c=Object.values(s).map(r=>({fulfillmentId:r.fulfillmentId,tip:r.fulfillmentId===e?o:r.tip})),l={...this.dataForCheckoutPrepare(),deliveryTips:c},d=await this.api.prepareCheckout(l);this.updateStoreFromCheckoutResponse(d),this.pubSub.publishAction(r.CHECKOUT_TIP_UPDATED,{deliveryTips:c})}catch(s){throw this.store.set("checkout.error",(null==s?void 0:s.message)||"Failed to update fulfillment tip. Please try again."),s}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(e){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(o).map(o=>({fulfillmentId:o.fulfillmentId,tip:o.fulfillmentId===e?0:o.tip})),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:s});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(r.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}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 o;const r={"checkout.amounts":e.amounts,"checkout.warning":e.warning,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.error":null};if((null===(o=e.retailers)||void 0===o?void 0:o.length)>0)for(const s of e.retailers)for(const e of s.fulfillments)e.type===l.ON_DEMAND&&(r["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:s.id,retailerName:s.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});this.store.batch(r)}async updateStripeFormStatus(e){try{const o=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},r={...o,...e};this.store.set("checkout.stripeFormStatus",r)}catch(o){throw this.logger.error("Error updating Stripe form status",{error:o instanceof Error?o.message:String(o)}),o}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(e){this.store.set("checkout.deliveryInstructions",e)}dataForCheckoutPrepare(){var e,o,r;const s=this.store.get("checkout"),c=(null===(e=null==s?void 0:s.customer)||void 0===e?void 0:e.email)?{firstName:s.customer.firstName,lastName:s.customer.lastName,email:s.customer.email,phone:s.customer.phone,birthDate:s.customer.birthDate,company:s.customer.company}:void 0;return{cartId:s.cartId,customer:c,billingSameAsShipping:s.billingSameAsShipping,acceptedAccountCreation:s.acceptedAccountCreation,hasAgeVerify:s.hasAgeVerify,hasSubstitutionPolicy:s.hasSubstitutionPolicy,marketingPreferences:s.marketingPreferences,promoCode:(null===(o=s.promoCode)||void 0===o?void 0:o.code)||void 0,giftCards:(null===(r=null==s?void 0:s.giftCards)||void 0===r?void 0:r.map(e=>e.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.pubSubService=PubSubService.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 s=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 Error("Item not found");const l=c.quantity+o;if(l<1)return this.removeItem(e,!![]);const d=this.buildItemUpdate(c,l),h=await this.api.updateCart({id:s,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(h,[e]),this.updateFulfillment(c.fulfillmentId,h),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h),this.pubSubService.publishAction(o<0?r.CART_ITEM_QUANTITY_DECREASE:r.CART_ITEM_QUANTITY_INCREASE,{id:c.id,quantity:l,previousQuantity:c.quantity});const p=splitCategoryPath(c.catPath),m={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,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)}catch(s){throw this.store.set("cart.items."+e+".error",s.message),this.logger.error("Failed to update item quantity",s),s}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 s=this.store.get("cart.id"),c=this.store.get("cart.items."+e);if(!c)throw new Error("Item not found");const l={itemId:c.id,fulfillmentId:c.fulfillmentId,retailerId:c.retailerId},d=this.buildItemUpdate(c,0),h=await this.api.updateCart({id:s,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(h,[]),this.cleanupAfterItemRemoval(l,h),this.syncCartMetaFromApiResponse(h),this.pubSubService.publishAction(r.CART_ITEM_REMOVED,{id:c.id});const p=splitCategoryPath(c.catPath);this.googleTagManager.removeFromCart({item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:c.quantity,price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId})}catch(s){throw this.store.set("cart.items."+e+".error",s.message),this.logger.error("Failed to remove item",s),s}}async updateItemEngraving(e,o){var s,c,l;try{const d=this.store.get("cart"),h=null===(s=d.items)||void 0===s?void 0:s[e];if(!h)throw new Error("Item not found");this.store.set("cart.items."+e+".updating",!![]);const p={id:h.id,fulfillmentId:h.fulfillmentId,partNumber:h.partNumber,quantity:h.quantity,engravingLines:o},m=await this.api.updateCart({id:d.id||"",items:[p],loc:this.getLocation()});this.syncItemsFromApiResponse(m,[e]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const g=this.store.get("cart"),v=this.store.get("address");this.pubSubService.publishAction(r.CART_UPDATED,{previous:cartDataForEventFromStore(d,v),current:cartDataForEventFromStore(g,v)}),this.pubSubService.publishAction(r.CART_ITEM_ENGRAVING_UPDATED,{id:h.id,engravingLines:o,previousEngravingLines:(null===(l=null===(c=h.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,s;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()))||[],h=d.length>0,p=Object.values(c.items||{}).find(o=>{var r,s,c,l,p;const m=o.fulfillmentId===e.fulfillmentId&&o.partNumber===e.partNumber;if(!m)return![];if(h){const e=(null===(s=null===(r=o.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[];return d.join(",")===e.join(",")}return!(null===(p=null===(l=null===(c=o.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.length)}),m={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:p?e.quantity+p.quantity:e.quantity};h&&(m.engravingLines=d);const g=await this.api.updateCart({id:c.id||"",items:[m],loc:this.getLocation()}),v=null===(s=g.items)||void 0===s?void 0:s.find(e=>e.fulfillmentId===m.fulfillmentId&&e.partNumber===m.partNumber&&e.upc===m.upc);if(!v)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(g,[]);const y=this.store.get("cart.fulfillments."+e.fulfillmentId);y?this.updateFulfillment(e.fulfillmentId,g):this.addNewFulfillmentAndRetailer(e.fulfillmentId,g),this.syncRetailersFromApiResponse(g),this.syncCartMetaFromApiResponse(g);const b=this.store.get("cart"),x=this.store.get("address");this.pubSubService.publishAction(r.PRODUCT_ADD_TO_CART,{...e}),this.pubSubService.publishAction(r.CART_ITEM_ADDED,{id:v.id,upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSubService.publishAction(r.CART_UPDATED,{previous:cartDataForEventFromStore(l,x),current:cartDataForEventFromStore(b,x)});const w=splitCategoryPath(v.catPath);this.googleTagManager.addToCart({item_id:v.liquidId,item_name:v.name,item_brand:v.brand,item_category:w.category,item_category2:w.category2,item_category3:w.category3,item_type:v.type,item_subtype:v.subType,quantity:v.quantity,price:centToDollar(v.unitPrice||0),upc:v.upc,grouping_id:v.salsifyGrouping,product_id:v.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 o;try{const r={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity};(null==e?void 0:e.engravingLines)&&(null===(o=null==e?void 0:e.engravingLines)||void 0===o?void 0:o.length)>0&&(r.engravingLines=e.engravingLines);const s=await this.api.updateCart({id:"",items:[r],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(s.id)}catch(r){throw this.store.set("cart.error",r.message),this.logger.error("Failed to add presale item to cart",r),r}}async handleGoToCheckout(){var e;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(c.CHECKOUT);const o=this.store.get("cart"),r=(null===(e=o.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(o.items||{}).map(e=>{const o=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:o.category,item_category2:o.category2,item_category3:o.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],r)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to proceed to checkout",o),o}finally{this.store.set("cart.loading",![])}}async applyPromoCode(e){var o,r,s;if(!(null==e?void 0:e.trim()))throw new Error("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===(s=null===(r=null===(o=l.attributes)||void 0===o?void 0:o.promoCode)||void 0===r?void 0:r.value)||void 0===s?void 0:s.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"),o=await this.api.updateCart({id:e,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(o),"cart.promoCode":null}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const o=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",o);const r=this.store.get("cart.promoCode");throw(null==r?void 0:r.code)&&this.googleTagManager.promoCodeFailed(r.code,o),this.logger.error("Failed to remove promo code",e),e}}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.pubSubService.publishAction(r.CART_RESET,!![])}getDetails(){var e;const o=this.store.get("cart"),r=this.store.get("address"),s=r.id?r:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in o.items||{}){const e=o.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:o.id,promoCode:(null===(e=o.promoCode)||void 0===e?void 0:e.code)||"",items:c,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.coordinates.long}},amounts:{deliveryFee:o.totals.deliveryFee,discounts:o.totals.discounts,engravingFee:o.totals.engravingFee,giftCardTotal:0,platformFee:o.totals.platformFee,shippingFee:o.totals.shippingFee,subtotal:o.totals.subtotal,total:o.totals.total},updatedAt:o.updatedAt,createdAt:o.createdAt}}buildItemUpdate(e,o){var r,s,c;const l={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:o},d=(null===(c=null===(s=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===c?void 0:c.filter(e=>""!==e.trim()))||[];return d.length>0&&(l.engravingLines=d),l}syncItemsFromApiResponse(e,o=[]){var r;const s=this.store.get("cart.items")||{},c=new Set((null===(r=e.items)||void 0===r?void 0:r.map(e=>e.id))||[]);for(const d of Object.keys(s))c.has(d)||this.store.remove("cart.items."+d);const l={};for(const d of e.items)0!==o.length&&!o.includes(d.id)&&s[d.id]||(l["cart.items."+d.id]=buildCartItemStore(d));Object.keys(l).length>0&&this.store.batch(l)}syncCartMetaFromApiResponse(e){var o,r;const s={"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===(r=null===(o=e.attributes)||void 0===o?void 0:o.promoCode)||void 0===r?void 0:r.value;if(c)s["cart.promoCode"]={code:c.toUpperCase(),discountAmount:e.discounts||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(e){var o;if((null===(o=e.retailers)||void 0===o?void 0:o.length)>0){const o={};for(const r of e.retailers)o["cart.retailers."+r.id]=buildRetailerStore(r);this.store.batch(o)}}updateFulfillment(e,o){var r,s;const c=null===(r=o.retailers)||void 0===r?void 0:r.find(o=>{var r;return null===(r=o.fulfillments)||void 0===r?void 0:r.some(o=>o.id===e)}),l=null===(s=null==c?void 0:c.fulfillments)||void 0===s?void 0:s.find(o=>o.id===e);l&&c&&this.store.set("cart.fulfillments."+e,buildFulfillmentStore(l,c))}addNewFulfillmentAndRetailer(e,o){var r,s;const c=null===(r=o.retailers)||void 0===r?void 0:r.find(o=>{var r;return null===(r=o.fulfillments)||void 0===r?void 0:r.some(o=>o.id===e)}),l=null===(s=null==c?void 0:c.fulfillments)||void 0===s?void 0:s.find(o=>o.id===e);if(l&&c){const o={["cart.fulfillments."+e]:buildFulfillmentStore(l,c),["cart.retailers."+c.id]:buildRetailerStore(c)};this.store.batch(o)}}cleanupAfterItemRemoval(e,o){var r,s,c,l;const d=this.store.get("cart.fulfillments."+e.fulfillmentId),h=this.store.get("cart.retailers."+e.retailerId);if(!d||!h)return;const p=null===(r=o.retailers)||void 0===r?void 0:r.some(o=>{var r;return null===(r=o.fulfillments)||void 0===r?void 0:r.some(o=>o.id===e.fulfillmentId)}),m=null===(s=o.retailers)||void 0===s?void 0:s.some(o=>o.id===e.retailerId);if(p){this.updateFulfillment(e.fulfillmentId,o);const r=null===(l=o.retailers)||void 0===l?void 0:l.find(o=>o.id===e.retailerId);r&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(r))}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),m){const r=null===(c=o.retailers)||void 0===c?void 0:c.find(o=>o.id===e.retailerId);r&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(r))}else this.store.remove("cart.retailers."+e.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(e,o=![]){this.store.createProductInstance(e),o&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var o;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,o)=>(e["products."+o+".loading"]=!![],e["products."+o+".error"]=null,e),{}));const r=await this.api.getProductsData(e,this.getLocation());if(!r||!r.products||0===r.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,o)=>(e["products."+o+".loading"]=![],e["products."+o+".error"]=!![],e),{})),void 0;const s=[];for(const l of r.products){const c=l.sizes.filter(o=>e.some(e=>e===(o.upc||o.id||l.salsifyGrouping))),d=e.find(e=>c.some(o=>e===o.upc||e===o.id)||e===l.salsifyGrouping),h=d||(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.upc);await this.loadProduct(h,{products:[l],retailers:r.retailers}),s.push(h)}const c=e.filter(e=>-1===s.indexOf(e));this.store.batch(c.reduce((e,o)=>(e["products."+o+".loading"]=![],e["products."+o+".error"]="Product data not found",e),{}))}async loadProduct(e,o=null){var s,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===(s=null==d?void 0:d.products)||void 0===s?void 0:s[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const h=this.loadProductStoreUpdate(d);if(!h)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...h,identifier:e}),this.pubSub.publishAction(r.PRODUCT_LOADED,this.productDataForEventFromStore(e));const p=d.products[0],m=h.sizes[h.selectedSizeId||""],g=Boolean(this.getLocation()),v=h.selectedFulfillment,y=g&&(null==v?void 0:v.price)?v.price:(null===(c=h.priceInfo)||void 0===c?void 0:c.avg)||0,b=splitCategoryPath(p.catPath);this.googleTagManager.viewItem({item_id:null==m?void 0:m.id,item_name:p.name,item_brand:p.brand,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(y),item_type:p.type,item_subtype:p.subType,upc:null==m?void 0:m.upc,grouping_id:p.salsifyGrouping,product_id:null==m?void 0:m.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 s,c,d,h,p,m,g;const v=this.store.get("products."+e);let y=v.selectedFulfillmentType;const b=null===(s=v.sizes[o])||void 0===s?void 0:s.shippingFulfillments,x=null===(c=v.sizes[o])||void 0===c?void 0:c.onDemandFulfillments;let w=null,C=null;if(y!==l.SHIPPING||objectValues(b).length)if(y!==l.ON_DEMAND||objectValues(x).length){const e=y===l.SHIPPING?b:x,o=objectValues(e);w=o[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}else{y=l.SHIPPING;const e=objectValues(b);w=e[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}else{y=l.ON_DEMAND;const e=objectValues(x);w=e[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}const k=y===l.SHIPPING?b:x,S=v.sizes[o],E=splitCategoryPath(v.catPath),T=(null==w?void 0:w.price)||(null===(d=v.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==S?void 0:S.id,item_name:v.name,item_brand:v.brand,item_category:E.category,item_category2:E.category2,item_category3:E.category3,price:centToDollar(T),item_type:v.type,item_subtype:v.subType,upc:null==S?void 0:S.upc,grouping_id:v.salsifyGrouping,product_id:null==S?void 0:S.id});const I=Object.keys(b).length>0,P=Object.keys(x).length>0,F=I||P;if(!F){const e=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==S?void 0:S.id,productName:v.name,productBrand:v.brand,productCategory:E.category,productCategory2:E.category2,productCategory3:E.category3,productType:v.type,productSubtype:v.subType,productPrice:(null===(h=v.priceInfo)||void 0===h?void 0:h.avg)||0,sizeId:o,sizeName:null==S?void 0:S.size,upc:null==S?void 0:S.upc,groupingId:v.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(r.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:o,size:(null===(p=v.sizes[o])||void 0===p?void 0:p.size)||"",previousSizeId:v.selectedSizeId||"",previousSize:(null===(m=v.sizes[v.selectedSizeId])||void 0===m?void 0:m.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:o,["products."+e+".mainImage"]:(null===(g=v.sizes[o])||void 0===g?void 0:g.image)||null,["products."+e+".productHasAvailability"]:Object.keys(b).length+Object.keys(x).length>0,["products."+e+".fulfillmentHasAvailability"]:Boolean(Object.keys(k).length),["products."+e+".selectedFulfillmentType"]:y,["products."+e+".selectedFulfillment"]:w,["products."+e+".selectedFulfillmentId"]:C,["products."+e+".engravingLines"]:[]})}async selectFulfillment(e,o){var s,c,d;const h=this.store.get("products."+e),p=null===(s=h.sizes[h.selectedSizeId])||void 0===s?void 0:s.shippingFulfillments,m=null===(c=h.sizes[h.selectedSizeId])||void 0===c?void 0:c.onDemandFulfillments,g=h.selectedFulfillmentType===l.SHIPPING?p:m,v=g[o];this.pubSub.publishAction(r.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:o,selectedFulfillmentType:h.selectedFulfillmentType,previousFulfillmentId:h.selectedFulfillmentId||"",previousFulfillmentType:h.selectedFulfillmentType});const y=h.sizes[h.selectedSizeId||""],b=splitCategoryPath(h.catPath),x=(null==v?void 0:v.price)||(null===(d=h.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==y?void 0:y.id,item_name:h.name,item_brand:h.brand,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(x),item_type:h.type,item_subtype:h.subType,upc:null==y?void 0:y.upc,grouping_id:h.salsifyGrouping,product_id:null==y?void 0:y.id}),this.store.batch({["products."+e+".selectedFulfillment"]:v,["products."+e+".selectedFulfillmentId"]:o,["products."+e+".engravingLines"]:[],["products."+e+".quantity"]:1})}async updateQuantity(e,o){var s;const c=this.store.get("products."+e),l=c.quantity,d=l+o,h=1,p=(null===(s=null==c?void 0:c.selectedFulfillment)||void 0===s?void 0:s.stock)||5,m=Math.max(h,Math.min(p,d));this.pubSub.publishAction(o<0?r.PRODUCT_QUANTITY_DECREASE:r.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:m,previousQuantity:l}),this.store.set("products."+e+".quantity",m)}async changeFulfillmentType(e,o){var s,c,d;const h=this.store.get("products."+e),{shippingFulfillments:p,onDemandFulfillments:m}=h.sizes[h.selectedSizeId],g=o===l.SHIPPING?p:m,v=objectValues(g);if(0===v.length){this.logger.warn("No fulfillments available for type "+o+" on product "+e);const r=this.store.get("address"),l=h.sizes[h.selectedSizeId],d=splitCategoryPath(h.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==l?void 0:l.id,productName:h.name,productBrand:h.brand,productCategory:d.category,productCategory2:d.category2,productCategory3:d.category3,productType:h.type,productSubtype:h.subType,productPrice:(null===(s=h.priceInfo)||void 0===s?void 0:s.avg)||0,sizeId:null!==(c=h.selectedSizeId)&&void 0!==c?c:void 0,sizeName:null==l?void 0:l.size,fulfillmentType:o,upc:null==l?void 0:l.upc,groupingId:h.salsifyGrouping,address:(null==r?void 0:r.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||""}:void 0,reason:"No "+o+" fulfillments available for selected size"}),void 0}const y=v[0]||null,b=(null==y?void 0:y.fulfillmentId)||null;this.pubSub.publishAction(r.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:o,selectedFulfillmentId:b,previousFulfillmentType:h.selectedFulfillmentType,previousFulfillmentId:h.selectedFulfillmentId,fulfillmentHasAvailability:v.length>0});const x=h.sizes[h.selectedSizeId||""],w=splitCategoryPath(h.catPath),C=(null==y?void 0:y.price)||(null===(d=h.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==x?void 0:x.id,item_name:h.name,item_brand:h.brand,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar(C),item_type:h.type,item_subtype:h.subType,upc:null==x?void 0:x.upc,grouping_id:h.salsifyGrouping,product_id:null==x?void 0:x.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:o,["products."+e+".selectedFulfillment"]:y,["products."+e+".selectedFulfillmentId"]:b,["products."+e+".fulfillmentHasAvailability"]:v.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async updateEngravingLines(e,o){const s=this.store.get("products."+e);if(!s)return this.logger.warn("Product store for ID "+e+" does not exist."),void 0;this.store.set("products."+e+".engravingLines",o),this.pubSub.publishAction(r.PRODUCT_ENGRAVING_UPDATED,{identifier:e,engravingLines:o,previousEngravingLines:s.engravingLines||[]})}async openProductDrawer(e,o,r){const s={type:o,data:r||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:s})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),o=Object.keys(e);for(const r of o)this.store.set("products."+r+".rerender",!![])}async addToCart(e,o){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(c.CART),await this.cartCommands.addItem(o),this.store.batch({["products."+e+".engravingLines"]:[],["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const r=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(r.items||{}).map(e=>{const o=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:o.category,item_category2:o.category2,item_category3:o.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})])}catch(r){this.logger.error("Error adding to cart",r),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,o){try{this.store.set("products."+e+".updating",!![]),await this.cartCommands.addPresaleItem(o),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(c.CHECKOUT),this.store.batch({["products."+e+".engravingLines"]:[],["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(r){this.logger.error("Error adding to cart",r),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const o=this.store.get("products."+e),r={},fulfillmentEventData=e=>{const o={};for(const r in e){const s=e[r];o[r]={retailerId:s.retailerId,retailerName:s.retailerName,retailerAddress:s.retailerAddress,retailerTimezone:s.timezone,price:s.price,partNumber:s.partNumber,fulfillmentId:s.fulfillmentId,fulfillmentType:s.fulfillmentType,modalities:s.modalities||[]}}return o};for(const s in o.sizes||{}){const e=o.sizes[s];r[s]={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,shippingFulfillments:fulfillmentEventData(e.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(e.onDemandFulfillments||{})}}return{identifier:e,id:o.id,name:o.name,brand:o.brand,category:o.category,catPath:o.catPath,classification:o.classification,priceInfo:o.priceInfo||null,sizes:r}}findFirstAvailableSize(e){const o=objectValues(e);for(const r of o){const e=r.shippingFulfillments||{},o=r.onDemandFulfillments||{},s=objectValues(e).length,c=objectValues(o).length;if(s+c>0)return r.id}return null}loadProductStoreUpdate(e){var o,r,s,c,d,h,p,m,g,v,y;try{const{products:[b,...x],retailers:w}=e,C=this.themeProvider.getConfigs("product"),k={};let S=![],E=![],T="",I=null,P=C.layout.enableShippingFulfillment?l.SHIPPING:l.ON_DEMAND,F=null,D=null;const A={};if(w&&Array.isArray(w)&&w.length>0)for(const e of w)for(const o of e.fulfillments)A[o.id]={retailerName:e.name,retailerAddress:e.address||null,type:o.type,timezone:o.timezone||"",canEngrave:o.canEngrave||![],expectation:o.expectation,fees:o.fees,hours:o.hours,retailerId:e.id,fulfillmentId:o.id,fulfillmentType:o.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(b.sizes&&Array.isArray(b.sizes)&&b.sizes.length>0)for(const e of b.sizes){const d={},h={};for(const p of e.variants){if((null===(o=null==p?void 0:p.fulfillmentTypes)||void 0===o?void 0:o.onDemand)&&""!==p.fulfillmentTypes.onDemand){const e=p.fulfillmentTypes.onDemand,o=A[e];o?h[e]={...o,isVariantEngravable:p.isEngravable,stock:p.stock,price:p.price,retailerId:p.retailerId,fulfillmentId:e,fulfillmentType:l.ON_DEMAND,modalities:[...o.modalities,...null!==(r=null==p?void 0:p.modalities)&&void 0!==r?r:[]],partNumber:p.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+e)}if((null===(s=null==p?void 0:p.fulfillmentTypes)||void 0===s?void 0:s.shipping)&&""!==p.fulfillmentTypes.shipping){const e=p.fulfillmentTypes.shipping,o=A[e];o?d[e]={...o,isVariantEngravable:p.isEngravable,stock:p.stock,price:p.price,retailerId:p.retailerId,fulfillmentId:e,fulfillmentType:l.SHIPPING,modalities:[...o.modalities,...null!==(c=null==p?void 0:p.modalities)&&void 0!==c?c:[]],partNumber:p.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+e)}}k[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:h}}const _=objectValues(k),O=this.findFirstAvailableSize(k);T=O||_[0]&&_[0].id||"",I=(null===(d=k[T])||void 0===d?void 0:d.image)||null;const z=(null===(h=k[T])||void 0===h?void 0:h.shippingFulfillments)||{},N=(null===(p=k[T])||void 0===p?void 0:p.onDemandFulfillments)||{},M=objectValues(z).length,L=objectValues(N).length;S=M+L>0;const B=P===l.SHIPPING?objectValues(z):objectValues(N);if(E=B.length>0,D=B[0]||null,F=(null==D?void 0:D.fulfillmentId)||null,!E){const e=P===l.SHIPPING?l.ON_DEMAND:l.SHIPPING,o=e===l.SHIPPING?objectValues(z):objectValues(N);o.length>0&&(P=e,D=o[0],F=(null==D?void 0:D.fulfillmentId)||null,E=!![])}if(!S){const e=this.store.get("address"),o=splitCategoryPath(b.catPath),r=k[T];this.googleTagManager.productNoAvailability({productId:null==r?void 0:r.id,productName:b.name,productBrand:b.brand,productCategory:o.category,productCategory2:o.category2,productCategory3:o.category3,productType:b.type,productSubtype:b.subType,productPrice:(null===(m=b.priceInfo)||void 0===m?void 0:m.average)||0,upc:null==r?void 0:r.upc,groupingId:b.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:b.id||"",name:b.name,description:b.description,htmlDescription:b.htmlDescription,images:b.images,priceInfo:{min:(null===(g=b.priceInfo)||void 0===g?void 0:g.minimum)||0,max:(null===(v=b.priceInfo)||void 0===v?void 0:v.maximum)||0,avg:(null===(y=b.priceInfo)||void 0===y?void 0:y.average)||0},brand:b.brand,catPath:b.catPath,category:b.category,classification:b.classification,type:b.type,subType:b.subType,salsifyGrouping:b.salsifyGrouping,sizes:k,productHasAvailability:S,fulfillmentHasAvailability:E,selectedSizeId:T,mainImage:I,selectedFulfillmentType:P,selectedFulfillmentId:F,selectedFulfillment:D,drawer:{isOpen:![],contentConfig:null},engravingLines:[],error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(b){throw this.logger.error("Product data processing error",b),b}}}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 o=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(o)),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(r.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(r.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 r=buildFormattedAddressString(e),s={id:"",formattedAddress:r,address:e,coordinates:o};await this.setSelectedAddress(s)}catch(s){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==s?void 0:s.message)||"Failed to set manual address"}),this.pubSub.publishAction(r.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:e,coordinates:o,error:(null==s?void 0:s.message)||"Failed to set manual address"}),s}}async clearSelectedAddress(){this.store.set("address",V),this.pubSub.publishAction(r.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.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 Error("Invalid placesId provided");const o=await this.command.address.getAddressDetails(e);await this.command.address.setSelectedAddress({id:e,address:o.address,coordinates:o.coords,formattedAddress:o.formattedAddress})}catch(o){throw this.logger.error("Error setting address by placesId:",o),o}},setAddressManually:async(e,o)=>{try{if(!e||!o)throw new Error("Invalid address or coordinates provided");if(!(e.one&&e.city&&e.state&&e.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof o.lat||"number"!=typeof o.long)throw new Error("Coordinates must be valid numbers");if(o.lat<-90||o.lat>90)throw new Error("Latitude must be between -90 and 90");if(o.long<-180||o.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(e,o)}catch(r){throw this.logger.error("Error setting manual address:",r),r}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(c.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(c.CART)},addProduct:async(e,o)=>{var s,d;try{if(!e||0===e.length)return this.logger.warn("No products provided to add to cart"),void 0;const h=this.getLocation();if(void 0===h)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(c.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;o===!![]&&this.command.ui.openDrawer(c.CART);const p=[...new Set(e.map(e=>e.identifier))],m=await this.api.getProductsData(p,h);if(!m||!m.products||0===m.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(r.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const o of e){let e=null;for(let s=0;s<m.products.length;s++){const r=m.products[s];let c=![];for(let e=0;e<r.sizes.length;e++){const s=r.sizes[e];if(s.upc===o.identifier||s.id===o.identifier||r.salsifyGrouping===o.identifier){c=!![];break}}if(c){e=r;break}}if(!e){this.logger.warn("No product found for identifier: "+o.identifier);continue}const r=e.sizes[0];if(!r){this.logger.warn("No sizes found for product: "+o.identifier);continue}if((null===(d=null===(s=null==r?void 0:r.attributes)||void 0===s?void 0:s.presale)||void 0===d?void 0:d.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+o.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let c=null;for(let s=0;s<r.variants.length;s++){const e=r.variants[s];let d=![];if(o.fulfillmentType===l.ON_DEMAND&&(d=!(!e.fulfillmentTypes||!e.fulfillmentTypes.onDemand||""===e.fulfillmentTypes.onDemand)),o.fulfillmentType===l.SHIPPING&&(d=!(!e.fulfillmentTypes||!e.fulfillmentTypes.shipping||""===e.fulfillmentTypes.shipping)),d){c=e;break}}if(!c){this.logger.warn("No supported variant found for product: "+o.identifier+" with fulfillment type: "+o.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const h=o.fulfillmentType===l.ON_DEMAND?c.fulfillmentTypes.onDemand:c.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:r.upc,fulfillmentId:h,partNumber:c.partNumber,quantity:o.quantity,identifier:o.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(r.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:p}),this.logger.info("Products added to cart successfully:",p)}catch(h){throw this.logger.error("Error adding products to cart:",h),this.clearPendingCartOperation(),this.pubSub.publishAction(r.CART_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:h.message||"Failed to add products to cart"}),h}},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(),s=this.themeProvider.getConfigs("global"),c=s.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(r.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(r.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(r.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(r.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(c.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(c.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(c.CHECKOUT);const s=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(r.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:e.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(r.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:s.message||"Failed to add products to checkout"}),s}},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 s=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===s)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(e);const h=this.store.get("checkout"),p=null==h?void 0:h.promoCode;this.pubSub.publishAction(r.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==p?void 0:p.discountAmount)||0,newTotal:(null===(o=null==h?void 0:h.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(s){throw this.logger.error("Failed to apply checkout promo code:",s),this.pubSub.publishAction(r.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),s}},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(r.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 s=this.themeProvider.getConfigs("checkout"),c=s.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(r.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(s){throw this.logger.error("Failed to apply gift card:",s),this.pubSub.publishAction(r.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),s}},removeGiftCard:async e=>{try{const o=this.themeProvider.getConfigs("checkout"),s=o.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.removeGiftCard(e),this.pubSub.publishAction(r.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(r.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,o)=>{this.command.checkout.toggleMarketingPreferences(e,o)},updateCustomerInfo:e=>{for(const[o,r]of objectEntries(e))this.command.checkout.updateCustomerInfo(o,r)},updateBillingInfo:e=>{for(const[o,r]of objectEntries(e))this.command.checkout.updateBillingInfo(o,r)},updateGiftInfo:e=>{for(const[o,r]of objectEntries(e))this.command.checkout.updateGiftInfo(o,r)},getDetails:()=>{var e;const o=this.store.get("checkout"),r=o.items||{},s={};for(const[c,l]of Object.entries(r)){const e=l,{attributes:o,...r}=e;s[c]=r}return{cartId:o.cartId||"",amounts:o.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}}},items:s,isGift:o.isGift||![],hasAgeVerify:o.hasAgeVerify||![],hasPromoCode:!!(null===(e=o.promoCode)||void 0===e?void 0:e.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,itemCount:Object.keys(r).length}}},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 R=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+r.ADDRESS_UPDATED,R)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const e=this.pendingCartParams,o=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(e,o)}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}}}function componentError({componentType:e,message:o}){const r=document.createElement("div");r.className=e;const s=r.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 h=document.createElement("p");return h.textContent=o,l.appendChild(c),l.appendChild(d),l.appendChild(h),s.appendChild(l),r}function productionComponentError({title:e,message:o,componentType:r}){const s=document.createElement("div");s.setAttribute("data-component-type",r);const c=s.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"),h=document.createElement("h2");h.textContent=e;const p=document.createElement("p");return p.textContent=o,d.appendChild(l),d.appendChild(h),d.appendChild(p),c.appendChild(d),s}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,o){ComponentFactoryService.getComponentRegistry().set(e,o)}static createElement(e){try{const o=ComponentFactoryService.getComponentRegistry().get(e.type);if(!o)throw new Error("Component type ["+e.type+"] is not registered");const r=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(r)||window.customElements.define(r,o);const s=document.createElement(r);if(s.initialize){const{type:o,useShadowDom:c,wrapInLceElement:l,...d}=e,h={type:o,tagName:r,useShadowDom:c&&l!==!![]};s.initialize({data:d,config:h})}if(e.wrapInLceElement){const o=ComponentFactoryService.getComponentRegistry().get(c.LCE_ELEMENT),r=ComponentFactoryService.getComponentTagName(c.LCE_ELEMENT);window.customElements.get(r)||window.customElements.define(r,o);const l=document.createElement(r);return l.initialize(e.type,s),l}return s}catch(o){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",o),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==o?void 0:o.message)||o})}}static componentError({componentType:e,message:o}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+o),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:o})}static getComponentTagName(e){const o={[c.DRAWER]:"drawer-lc",[c.INPUT]:"input-lc",[c.BIRTHDATE_INPUT]:"birthdate-input-lc",[c.ENGRAVING_FORM]:"engraving-form-lc",[c.ENGRAVING_VIEW]:"engraving-view-lc",[c.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[c.POWERED_BY]:"powered-by-lc",[c.LCE_ELEMENT]:"lce-element",[c.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[c.ALERT]:"alert-lc",[c.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[c.ADDRESS]:"address-lc",[c.ADDRESS_INPUT]:"address-input-lc",[c.ADDRESS_DISPLAY]:"address-display-lc",[c.PRODUCT]:"product-lc",[c.PRODUCT_OPTIONS]:"product-options-lc",[c.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[c.PRODUCT_INTERACTIONS]:"product-interactions-lc",[c.PRODUCT_DESCRIPTION]:"product-description-lc",[c.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[c.PRODUCT_RETAILERS]:"product-retailers-lc",[c.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[c.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[c.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[c.PRODUCT_PRICE]:"product-price-lc",[c.PRODUCT_DRAWER]:"product-drawer-lc",[c.PRODUCT_LOADING]:"product-loading-lc",[c.CART]:"cart-lc",[c.CART_RETAILER]:"cart-retailer-lc",[c.CART_ITEM]:"cart-item-lc",[c.CART_FOOTER]:"cart-footer-lc",[c.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[c.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[c.CART_PROMO_CODE]:"cart-promo-code-lc",[c.CART_HEADER]:"cart-header-lc",[c.CART_BODY]:"cart-body-lc",[c.CART_FULFILLMENT]:"cart-fulfillment-lc",[c.CHECKOUT]:"checkout-lc",[c.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[c.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[c.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[c.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[c.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[c.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[c.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[c.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[c.CHECKOUT_ITEMS]:"checkout-items-lc",[c.CHECKOUT_COMPLETED]:"checkout-completed-lc",[c.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[c.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[c.CHECKOUT_TIPS]:"checkout-tips-lc",[c.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[c.CHECKOUT_ITEM]:"checkout-item-lc",[c.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[c.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[c.CHECKOUT_HEADER]:"checkout-header-lc",[c.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[c.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return o[e]||e.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const lt="\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",dt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const e=LoggerFactory,o=e.instances;if(o)for(const[s,c]of o)this.interceptLoggerInstance(c,s);const r=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const o=r(e);return this.interceptLoggerInstance(o,e),o}}interceptLoggerInstance(e,o){if(e.o)return;const r=e.debug.bind(e),s=e.info.bind(e),c=e.warn.bind(e),l=e.error.bind(e),u=(e,r,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:r,data:s,context:o});e.debug=(e,o)=>{r(e,o),this.addLogEntry(u("debug",e,o))},e.info=(e,o)=>{s(e,o),this.addLogEntry(u("info",e,o))},e.warn=(e,o)=>{c(e,o),this.addLogEntry(u("warn",e,o))},e.error=(e,o)=>{l(e,o),this.addLogEntry(u("error",e,o))},e.o=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),o=e.publishAction.bind(e);e.publishAction=(e,r)=>{o(e,r),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:r,context:"PubSub"})};const r=e.publishForm.bind(e);e.publishForm=(e,o)=>{r(e,o),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:o,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),o=e.executeEvent.bind(e);e.executeEvent=(e,r,s)=>{o(e,r,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+r,data:s,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 o=this.createLogElement(e);this.logContainer.appendChild(o)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(dt);e&&e.remove(),this.panelElement=document.createElement(dt);const o=window.innerWidth<=768,r=window.innerWidth<=480;r?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):o?(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"}),o=document.createElement("style");o.textContent=lt,e.appendChild(o),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const r=this.createHeader();this.panelContainer.appendChild(r);const s=this.createToggles();this.panelContainer.appendChild(s),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 o=document.createElement("div");o.className="icon",o.innerHTML="🔍",o.title="Elements Debug Console",o.style.cursor="help";const r=document.createElement("div");r.className="title-container";const s=document.createElement("div");s.className="title",s.textContent="Elements Debug Console";const c=document.createElement("div");c.className="subtitle",c.textContent="Live SDK logs, events & GTM tracking",r.appendChild(s),r.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(o),e.appendChild(r),e.appendChild(l),e}createToggles(){const e=document.createElement("div");e.className="toggles";const o=[{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"}];o.forEach(({key:o,label:r,description:s,color:c})=>{const l=document.createElement("label");l.className="toggle",l.title=s;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==o,d.addEventListener("change",e=>{const r=e.target;"showEvents"===o&&(this.showEvents=r.checked),"showGtmEvents"===o&&(this.showGtmEvents=r.checked),"showLogs"===o&&(this.showLogs=r.checked),this.renderLogs()});const h=document.createElement("span");h.textContent=r,h.style.color=c,l.appendChild(d),l.appendChild(h),e.appendChild(l)});const r=document.createElement("button");return r.className="clear-btn",r.innerHTML="🗑️",r.title="Clear all logs",r.addEventListener("click",()=>this.clearLogs()),e.appendChild(r),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let o=![],r=0,s=0,c=0,l=0;e.addEventListener("mousedown",e=>{o=!![],r=e.clientX,s=e.clientY,c=Number.parseInt(this.panelElement.style.width,10)||500,l=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",i),document.addEventListener("mouseup",n),e.preventDefault()});const i=e=>{if(!o||!this.panelElement)return;const d=e.clientX-r,h=e.clientY-s,p=window.innerWidth<=768,m=window.innerWidth<=480;let g,v,y,b;m?(g=280,v=window.innerWidth-20,y=200,b=.4*window.innerHeight):p?(g=300,v=window.innerWidth-30,y=200,b=.4*window.innerHeight):(g=300,v=800,y=200,b=600);const x=Math.max(g,Math.min(v,c+d)),w=Math.max(y,Math.min(b,l+h));this.panelElement.style.width=x+"px",this.panelElement.style.height=w+"px"},n=()=>{o=![],document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const o=e.querySelector(".header");if(o){let e=![],r=0,s=0,c=0,l=0;o.addEventListener("mousedown",o=>{if(o.target.classList.contains("minimize"))return;e=!![],r=o.clientX,s=o.clientY;const d=this.panelElement.getBoundingClientRect();c=d.left,l=d.top,document.addEventListener("mousemove",i),document.addEventListener("mouseup",n),o.preventDefault()});const i=o=>{if(!e||!this.panelElement)return;const d=o.clientX-r,h=o.clientY-s;this.panelElement.style.left=c+d+"px",this.panelElement.style.top=l+h+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},n=()=>{e=![],document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n)}}}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 o=document.createElement("div");o.className="log-entry "+e.type+" "+e.level;const r=new Date(e.timestamp).toLocaleTimeString();return o.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+r+'</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 ",o}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(o){return String(e)}}escapeHtml(e){const o=document.createElement("div");return o.textContent=e,o.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=B,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.l()){const o=this.h(e);if(o)return this.u(e,o)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const o=this.u(e,this.cachedFingerprint);if(this.l())try{const e=this.keyPrefix+"_"+o;localStorage.setItem(e,Date.now().toString())}catch(r){}return o}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}u(e,o){return(e+"_"+o).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{if(0,!("localStorage"in window))return this.isLocalStorageAvailable=![],![];if(void 0===window.localStorage||null===window.localStorage)return this.isLocalStorageAvailable=![],![];if("object"!=="object".localStorage)return this.isLocalStorageAvailable=![],![];const o=["setItem","getItem","removeItem","clear"];for(const e of o)if("function"!=="object".localStorage[e])return this.isLocalStorageAvailable=![],![];const r="__localStorage_test_"+Date.now()+"__",s="test";window.localStorage.setItem(r,s);const c=window.localStorage.getItem(r);if(c!==s)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(r);try{const e="__quota_test__",o="x".repeat(100);window.localStorage.setItem(e,o),window.localStorage.removeItem(e)}catch(e){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(o){if(this.isLocalStorageAvailable=![],o instanceof DOMException){const e={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},r=e[o.name]||"Storage error: "+o.name,s=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+r)}return![]}}h(e){try{const o=this.keyPrefix+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const r=localStorage.key(e);if(null==r?void 0:r.startsWith(o)){const e=r.substring(o.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(o){return null}}m(){const e=this.getFingerprintData(),o=Object.keys(e).sort().map(o=>o+":"+e[o]).join("|");return this.T(o)}v(){try{const e=screen,o=e.colorDepth||24,r=e.pixelDepth||o,s=this.I(),c=Math.round(100*(window.devicePixelRatio||1));return o+"|"+r+"|"+s+"|"+c}catch(e){return"24|24|srgb|100"}}I(){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(L){}return"srgb"}C(){var e;try{const o=navigator,r=[],s=((null===(e=o.languages)||void 0===e?void 0:e[0])||o.language||"en").substring(0,2);r.push(s),r.push(o.hardwareConcurrency||4);const c=(o.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);r.push(c),r.push(o.cookieEnabled?"1":"0"),r.push(o.maxTouchPoints||0),r.push(o.deviceMemory||0),r.push(this.P()),r.push(this.S()?"webview":"browser");const l=["bluetooth"in o?"1":"0","usb"in o?"1":"0","mediaDevices"in o?"1":"0","permissions"in o?"1":"0","credentials"in o?"1":"0","storage"in o?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return r.push(l.join("")),r.join("|")}catch(o){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(),o=navigator,r=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return r.some(o=>e.includes(o))?!![]:void 0===o.standalone||o.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"}}T(e){const o=16777619;let r=2166136261,s=2166136261,c=2166136261,l=2166136261;for(let d=0;d<e.length;d++){const h=e.charCodeAt(d);r^=h,r=Math.imul(r,o),s^=h<<1,s=Math.imul(s,o),c^=h<<2,c=Math.imul(c,o),l^=h<<3,l=Math.imul(l,o)}return r=Math.abs(r),s=Math.abs(s),c=Math.abs(c),l=Math.abs(l),r.toString(16)+s.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();const e=this.clientConfig.get("env"),r=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:r,batchSize:e===o.PRODUCTION?5:10,batchInterval:e===o.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,o,r={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const s=Date.now(),c="event_"+s+"_"+Math.random().toString(36).slice(2,11);try{const l={eventId:c,timestamp:s,level:e,message:o,context:r.context,error:r.error?this.buildErrorContext(r.error):void 0,component:r.component,data:r.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(l)}catch(l){this.handleInternalError(l)}}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(){return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![]}}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 o=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const r=this.createBatch(o);try{this.sendBatch(r),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...o),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const o=Date.now(),r="batch_"+o+"_"+Math.random().toString(36).slice(2,9);return{batchId:r,timestamp:o,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const o=new Blob([JSON.stringify(e)],{type:"text/plain"}),r=navigator.sendBeacon(this.config.endpoint,o);if(r)return}catch(o){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const o=new XMLHttpRequest;if(o.open("POST",this.config.endpoint,![]),o.setRequestHeader("Content-Type","text/plain"),o.send(JSON.stringify(e)),o.status<200||o.status>=300)throw new Error("XHR request failed with status: "+o.status)}catch(o){throw new Error("Both sendBeacon and XHR failed: "+o.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(o){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:o}){var r;this.F=Object.freeze(e),this.D=Object.freeze({type:o.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(r=null==o?void 0:o.useShadowDom)&&void 0!==r?r:![]}),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 o=/\{([^}]+)}/g;return e.replace(o,(o,r)=>{const s=this.F[r];return null==s?(this.logger.warn('Parameter "'+r+'" not found in component params for path "'+e+'"'),o):String(s)})}connectedCallback(){var e,o;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.D.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(r){this.logger.error("Component connectedCallback error in "+((null===(o=this.D)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"connectedCallback")}}disconnectedCallback(){var e,o;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(r){this.logger.error("Component disconnectedCallback error in "+((null===(o=this.D)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"disconnectedCallback")}}setup(){var e,o,r;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(o=this.beforeConnected)||void 0===o||o.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(r=this.D)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const o of this.unsubscribers)try{o()}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 o=this.reactiveOptions.autoDestroyPath;if(!o&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(o=this.reactiveOptions.watchStorePaths[0]),!o)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const r=this.interpolatePath(o),s=this.store.watch(r,(e,o)=>{this.isDestroyed||void 0===e&&void 0!==o&&this.handleAutoDestroy(r)});this.unsubscribers.push(s),this.logger.debug("🔥 AutoDestroy enabled for "+this.D.tagName+" watching path: "+r)}handleAutoDestroy(e){var o;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.D.tagName+' - path "'+e+'" was removed'),null===(o=this.beforeAutoDestroy)||void 0===o||o.call(this,e);const r=this.reactiveOptions.autoDestroyDelay||0;r>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},r):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(o){this.logger.error("Error during auto-destroy of "+this.D.tagName,o),o instanceof Error&&this.captureComponentError(o,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.F)return;e=this.interpolateStorePaths(e);const o=this.store.watchMany(e,e=>{var o,r;try{if(this.isDestroyed)return;const r=e.map(e=>e.path).join(", "),s="store:["+r+"]",c=null===(o=this.onStoreChanged)||void 0===o?void 0:o.call(this,e);c!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(r=this.D)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(o)}catch(o){this.logger.error("Store watchers setup error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.F)return;e=this.interpolateStorePaths(e);const o=this.store.watchMany(e,e=>{var o,r;try{if(this.isDestroyed)return;null===(o=this.onStoreWatch)||void 0===o?void 0:o.call(this,e)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(r=this.D)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(o)}catch(o){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"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,o;if(!this.initialized||this.isDestroyed)return;const r=performance.now();this.renderCount++;try{const o=this.template();"string"==typeof o&&(this.container.innerHTML=o),o instanceof HTMLElement&&safeReplaceChildren(this.container,o),Array.isArray(o)&&safeReplaceChildren(this.container,...o);const c=performance.now()-r;this.logRenderInfo(c);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this.D.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(c){const e=performance.now()-r;this.logger.error("❌ Component render error in "+this.D.tagName,c),this.captureComponentError(c,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.D.type,message:c instanceof Error?c.message:String(c)}));try{null===(o=this.onError)||void 0===o?void 0:o.call(this,c,"render")}catch(l){this.logger.error("❌ onError hook error in "+this.D.tagName,l)}}}logRenderInfo(e){const o=this.D.type,r=this.D.tagName,s=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+o+" </"+r+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+o+"("+r+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:o,tagName:r,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+r+":performance",component:{type:o,tagName:r,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.D.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,o,r){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.D.tagName+":"+o,component:{type:this.D.type,tagName:this.D.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:r,useShadowDom:this.D.useShadowDom}})}catch(s){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const o=e.filter(e=>e&&"string"==typeof e&&e.trim());o.length>0&&this.classList.add(...o)}}addHostClasses(...e){const o=e.filter(e=>e&&"string"==typeof e&&e.trim());o.length>0&&this.classList.add(...o)}removeHostClasses(...e){const o=e.filter(e=>e&&"string"==typeof e&&e.trim());o.length>0&&this.classList.remove(...o)}toggleHostClasses(...e){const o=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const r of o)this.classList.toggle(r)}addHostAttribute(e,o){e&&"string"==typeof e&&o&&"string"==typeof o&&(this.setAttribute(e,String(o)),this.hostAttributes[e]=String(o))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[o,r]of Object.entries(e))o&&"string"==typeof o&&r&&"string"==typeof r&&this.setAttribute(o,String(r))}get params(){return this.F}get config(){return this.themeProvider.getComponentConfig(this.D.type)}get elementConfig(){return this.D}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,o){return this.store.set(e,o)}watchStore(e,o){const r=this.store.watch(e,o);return this.unsubscribers.push(r),r}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var e;const o=null!==(e=this.params.options)&&void 0!==e?e:{};return ComponentFactoryService.createElement({type:c.ADDRESS_DISPLAY,isIndependentComponent:!![],options:o})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,o,r,s;const l=this.getStoreValue("address"),d=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],h=null!==(o=this.params.productId)&&void 0!==o?o:"",p=null!==(r=this.params.options)&&void 0!==r?r:{},m=null!==(s=p.showLabel)&&void 0!==s?s:!![],g=[];if(m){const e=document.createElement("span");e.textContent="Delivers to:",g.push(e)}const v=document.createElement("button");v.type="button",v.textContent=l.formattedAddress||"Select an address";const y=l.formattedAddress?"Change delivery address, currently set to "+l.formattedAddress:"Select delivery address";return v.setAttribute("aria-label",y),v.addEventListener("click",async()=>{if(d)return this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:h,isIndependentComponent:!![]}),void 0;!d&&h&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:h}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(h,c.ADDRESS_INPUT,{productId:h}))}),g.push(v),g}}const ArrowRightIcon=({width:e=16,height:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="arrow-right-icon '+r+'" 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:o=24,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 489 489" class="bag-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="checkbox-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="'+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="chevron-left-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="close-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="error-info-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="info-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="search-icon '+r+'">\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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="success-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="trash-icon '+r+'" 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:o=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+o+'" viewBox="0 0 16 16" class="warning-icon '+r+'" 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 o=e.target,r=o.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const s=/^\d/.test(r);if(r.length<this.minSearchLength||!s)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(r)},300)},this.closeDrawer=async()=>{const e=this.params.productId,o=this.clientConfig.isMobile(),r=this.isIndependentComponent();(o||r)&&this.commands.ui.closeDrawer(),!o&&e&&await this.commands.product.closeProductDrawer(e)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(L){this.logger.error("Address edit cancellation failed",L)}},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"),o=(null==e?void 0:e.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==e?void 0:e.coordinates.long)!==this.selectedAddress.coordinates.long;o&&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 o=e.currentTarget.dataset.suggestionId;if(o)try{this.error=null,this.updateErrorDisplay();const e=await this.commands.address.getAddressDetails(o);if(0===Object.keys(e).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:o,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(r){this.logger.error("Address details retrieval failed",r),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 o=await this.commands.address.searchAddresses(e);this.suggestions=o.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(o){this.logger.error("Address search operation failed",o),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 o=this.createElement("li",{className:"suggestion-item"}),r=this.createElement("span",{textContent:e.description});o.appendChild(r),o.setAttribute("data-suggestion-id",e.id),o.setAttribute("role","option"),o.setAttribute("aria-label","Select address: "+e.description),o.setAttribute("tabindex","0"),o.addEventListener("click",this.handleSuggestionClick),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())}),this.suggestionsContainer.appendChild(o)}}}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,o){const r=document.createElement(e);return o&&Object.assign(r,o),r}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 o=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),r=this.createElement("span",{className:"error-text"});return e.appendChild(o),e.appendChild(r),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,o,r;const s=this.getConfigs("global"),c=null!==(e=this.params.options)&&void 0!==e?e:{},l=null!==(o=c.showLabel)&&void 0!==o?o:!![];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 "+s.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(r=this.selectedAddress)||void 0===r?void 0:r.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 h=this.createElement("span");h.className="input-icon",h.innerHTML=SearchIcon({width:16,height:16,className:""}),d.appendChild(h),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 p=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),m=[this.inputContainer,p,this.errorContainer],g=this.createElement("div",{className:"action-buttons"}),v=this.createCancelButton();g.appendChild(v);const y=this.createCheckButton();return g.appendChild(y),m.push(g),document.addEventListener("click",this.handleDocumentClick),m}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=[],o=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!o){const o=ComponentFactoryService.createElement({type:c.CART_HEADER});e.push(o)}const r=ComponentFactoryService.createElement({type:c.CART_BODY});e.push(r);const s=ComponentFactoryService.createElement({type:c.CART_FOOTER});return e.push(s),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 o=document.createElement("h3");return o.className="empty-cart-content",o.textContent="Your cart is empty",e.appendChild(o),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:c.CART_RETAILER,retailerId:e.id})}catch(o){return this.logger.error("Cart retailer component creation failed",o),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,o){const r=this.createRetailerElement(o);r.setAttribute("data-retailer-id",e),this.container.appendChild(r)}removeRetailerElement(e){const o=this.getRetailerElementById(e);o&&o.remove()}updateRetailerElement(e,o){const r=this.getRetailerElementById(e);if(r){const s=this.createRetailerElement(o);s.setAttribute("data-retailer-id",e),r.replaceWith(s)}}hasRetailerDataChanged(e,o){return e?![]:!![]}getValidRetailers(e){if(!e)return{};const o={};for(const[r,s]of Object.entries(e))s&&"object"==typeof s&&s.id&&(o[r]=s);return o}getValidRetailerIds(e){const o=this.getValidRetailers(e);return new Set(Object.keys(o))}onStoreChanged(e){const o=e.find(e=>"cart.retailers"===e.path),r=e.find(e=>"cart.loading"===e.path);if(o){const e=this.getValidRetailers(o.oldValue),r=this.getValidRetailers(o.value),s=this.getValidRetailerIds(o.oldValue),c=this.getValidRetailerIds(o.value),l=s.size,d=c.size,h=this.getValidRetailers(this.getStoreValue("cart.retailers")),p=Object.keys(h).length;if(d>0&&0===p)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===l&&d>0){this.container.innerHTML="";for(const[e,o]of Object.entries(r))this.addRetailerElement(e,o)}else if(l>0&&0===d)this.showEmptyCartState();else if(d>0){for(const e of s)c.has(e)||this.removeRetailerElement(e);for(const o of c){const c=r[o],l=e[o];s.has(o)?this.hasRetailerDataChanged(l,c)&&this.updateRetailerElement(o,c):this.addRetailerElement(o,c)}}else 0===l&&0===d&&this.showEmptyCartState()}if(r){const e=r.value,o=r.oldValue;e!==o&&(e?this.addLoadingOverlay():this.removeLoadingOverlay())}return r||o,![]}afterRender(){this.setupEmptyCartListeners();const e=this.getStoreValue("cart.loading");e&&this.addLoadingOverlay()}template(){const e=this.getStoreValue("cart.retailers")||{},o=Object.values(e);if(0===o.length)return this.createEmptyCartElement();const r=[];for(const s of o){const e=this.createRetailerElement(s);e.setAttribute("data-retailer-id",s.id),r.push(e)}return r}}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 o=e.some(e=>e.path.includes("cart.items")),r=e.some(e=>e.path.includes("cart.totals")),s=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(o&&this.updateSubtotalItemsCount(),r&&this.subtotalPrice){const e=this.getStoreValue("cart.totals.subtotal")||0,o=this.getStoreValue("cart.totals.engravingFee")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(e+o)}(s||r||c||o||l)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const e=this.getStoreValue("cart.loading");if(e)return!![];const o=this.getStoreValue("cart.items")||{},r=Object.values(o).some(e=>e.updating);if(r)return!![];const s=this.getStoreValue("cart.fulfillments")||{},c=Object.values(s).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 o;const r=e.subtotal;if(e.type===l.SHIPPING){const s=e.fees;if((null===(o=s.individual)||void 0===o?void 0:o.active)&&s.individual.min>0&&r<s.individual.min)return!![]}if(e.type===l.ON_DEMAND){const o=e.fees;if(o.min>0&&r<o.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")||{},o=Object.keys(e).length>0;if(this.checkoutButton){const e=this.isAnythingLoading(),r=this.shouldDisableCheckout(),s=e||r||!o;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",e)}}updateSubtotalItemsCount(){const e=this.getStoreValue("cart.items"),o=Object.values(e).reduce((e,o)=>e+o.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+o+" item"+(1!==o?"s":"")+"):")}template(){const e=this.getConfigs("global"),o=this.getStoreValue("cart.totals.subtotal")||0,r=this.getStoreValue("cart.totals.engravingFee")||0,s=[],l=document.createElement("div");l.className="cart-footer-header";const d=document.createElement("div");d.className="cart-footer-items-price";const h=document.createElement("span");h.className="subtotal-text",h.textContent="Subtotal (0 items):",this.subtotalText=h,d.appendChild(h);const p=document.createElement("span");p.className="subtotal-price",p.textContent=formatCentToDollarText(o+r),this.subtotalPrice=p,d.appendChild(p);const m=document.createElement("p");if(m.textContent="Taxes & fees will be calculated at checkout",m.className="taxes-fees-info",l.appendChild(d),l.appendChild(m),s.push(l),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:c.CART_PROMO_CODE});s.push(e)}const g=ComponentFactoryService.createElement({type:c.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});s.push(g);const v=document.createElement("button");if(v.type="button",v.className="checkout-button",v.addEventListener("click",async e=>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)),v.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=v,s.push(v),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"general"});s.push(e)}return s}}const ht={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"},ut="America/New_York";function detectUserTimezone(e){try{if(e){const o=e.toUpperCase(),r=ht[o];return r||ut}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(o){return ut}}function getCurrentTimeInTimezone$1(e){try{const o=new Date,r=o.getTime(),s=6e4*o.getTimezoneOffset(),c=new Date(r+s),l=new Date(c.toLocaleString("en-US",{timeZone:e})),d=c.getTime()-l.getTime();return new Date(r+d)}catch(o){return new Date}}function getCurrentTimeInUserTimezone(e){const o=detectUserTimezone(e);return getCurrentTimeInTimezone$1(o)}function isDateTimeInRange(e){const{startDate:o,endDate:r,addressState:s}=e;try{const e=getCurrentTimeInUserTimezone(s),c=!o||e>=new Date(o),l=!r||e<=new Date(r);return c&&l}catch(c){return![]}}function filterActiveItems(e,o){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:o}))}function hasActiveItems(e,o){return filterActiveItems(e,o).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var e,o,r;const s=this.config.layout.drawerHeaderText,l=this.getConfigs("global"),d=document.createElement("div");d.className="cart-header-content";const h=document.createElement("h2");h.className="cart-title",h.textContent=s,d.appendChild(h);const p=document.createElement("button");p.type="button",p.className="cart-header-close-btn",p.innerHTML=CloseIcon({width:16,height:16}),p.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),d.appendChild(p);const m=this.clientConfig.get("promoTicker"),g=null!==(o=null===(e=null==l?void 0:l.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==o?o:[],v=null!=m?m:g,y=this.store.get("address"),b=hasActiveItems(v,null===(r=null==y?void 0:y.address)||void 0===r?void 0:r.state);if(!v.length||!b)return[d];const x=ComponentFactoryService.createElement({context:"cart",type:c.PROMO_CODE_TICKER,tickers:v});return[d,x]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.getItemId()}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}getItemId(){return this.params.itemId}onStoreChanged(e){const o=this.getItemId(),r=e.find(e=>e.path==="cart.items."+o);if(null==r?void 0:r.oldValue){const e=r.oldValue,o=r.value,s=e.attributes.engraving.lines&&e.attributes.engraving.lines.length>0,c=o.attributes.engraving.lines&&o.attributes.engraving.lines.length>0;s!==c&&(this.handleEngravingElement(),this.updateShippingTime())}return![]}handleEngravingElement(){const e=this.getConfigs("global");if(!e.layout.enablePersonalization)return;const o=this.getItemId(),r=this.getStoreValue("cart.items."+o),s=r.attributes.engraving.lines&&r.attributes.engraving.lines.length>0,l=this.container.querySelector(".engraving-view-container");l&&l.remove();const d=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:o,context:"cart",watchStorePaths:["cart.items.{identifier}"]}),h=this.container.querySelector(".item-shipping-container"),p=this.container.querySelector(".cart-item");s?p&&p.insertAdjacentElement("afterend",d):h&&h.appendChild(d)}updateShippingTime(){var e;const o=this.getItemId(),r=this.getStoreValue("cart.items."+o),s=this.getStoreValue("cart.fulfillments."+r.fulfillmentId),c=r.attributes.engraving.lines&&r.attributes.engraving.lines.length>0,l=c?"10 days":(null===(e=null==s?void 0:s.expectation)||void 0===e?void 0:e.short)||"2-3 days",d=this.container.querySelector(".item-shipping span");d&&(d.textContent="Ships in "+l)}template(){var e;const o=this.getItemId(),r=this.getStoreValue("cart.items."+o),s=this.getStoreValue("cart.fulfillments."+r.fulfillmentId),l=r.attributes.engraving.lines&&r.attributes.engraving.lines.length>0,d=l?"Ships in 10 days":(null===(e=null==s?void 0:s.expectation)||void 0===e?void 0:e.detail)||"",h=document.createElement("article");h.className="cart-item";const p=document.createElement("div");p.className="item-image";const m=document.createElement("img");m.src=r.mainImage,m.alt=r.name,p.appendChild(m);const g=document.createElement("div");g.className="item-details";const v=document.createElement("div");v.className="item-header";const y=document.createElement("h3");y.className="item-title",y.textContent=r.name;const b=document.createElement("button");b.className="item-delete",b.innerHTML=TrashIcon({}),b.addEventListener("click",async()=>{await this.commands.cart.removeItem(o)}),v.appendChild(y),v.appendChild(b);const x=document.createElement("div");x.className="item-specs",x.textContent=r.size+", "+r.container;const w=document.createElement("div");w.className="item-shipping-container";const C=document.createElement("div");C.className="item-shipping";const k=document.createElement("span");k.textContent=""+d,C.appendChild(k),w.appendChild(C),g.appendChild(v),g.appendChild(x),g.appendChild(w),h.appendChild(p),h.appendChild(g);const S=[h],E=ComponentFactoryService.createElement({type:c.CART_ITEM_QUANTITY_PRICE,itemId:o});return S.push(E),S}afterRender(){this.handleEngravingElement()}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(e){const o=e.find(e=>"cart.items"===e.path);if(o){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getItemStore(){const e=this.params.itemId,o=this.getStoreValue("cart.items."+e);return o||null}calculateQuantityLimits(){const e=this.getItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const o=e.quantity,r=this.getAvailableQuantity(),s=r>0;return{currentQuantity:o,availableQuantity:r,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var e,o,r,s;const c=this.getItemStore();if(!c)return 0;const l=c.partNumber,d=c.fulfillmentId,h=this.getStoreValue("cart.items")||{},p=Object.values(h).filter(e=>e.partNumber===l&&e.fulfillmentId===d),m=p.reduce((e,o)=>e+o.quantity,0),g=this.getStoreValue("products."+c.upc)||this.getStoreValue("products."+c.salsifyGrouping);if(!g)return c.maxQuantity-m;const v=null!==(s=null===(r=null===(o=null===(e=null==g?void 0:g.sizes)||void 0===e?void 0:e[c.liquidId])||void 0===o?void 0:o.attributes)||void 0===r?void 0:r.maxQuantityPerOrder)&&void 0!==s?s:0;return!v||v<=0?c.maxQuantity-m:v-m}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 o=this.calculateQuantityLimits();e>0&&!o.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,e)}createQuantityContainer(){const e=this.calculateQuantityLimits(),o=this.getItemStore();if(!o)return document.createElement("div");const r=document.createElement("div");return r.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),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantitySpan),r.appendChild(this.qtyIncreaseButton),r}createPriceContainer(){const e=this.getItemStore();if(!e)return document.createElement("div");const o=document.createElement("div");o.className="item-price-container";const r=document.createElement("span");if(r.className="item-price",r.textContent=formatCentToDollarText(e.price),o.appendChild(r),e.quantity>1){const r=document.createElement("span");r.className="item-price-per-unit",r.textContent="("+formatCentToDollarText(e.unitPrice)+" ea)",o.appendChild(r)}return o}template(){const e=[];if(this.config.layout.showQuantityCounter){const o=this.createQuantityContainer();e.push(o)}const o=this.createPriceContainer();return e.push(o),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 o=e.find(e=>"cart.promoCode"===e.path);if(o){const{value:e,oldValue:r}=o,s=Boolean(null==r?void 0:r.code),c=Boolean(null==e?void 0:e.code);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;if(c&&this.promoCodePill&&e.discountAmount!==(null==r?void 0:r.discountAmount))return this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",void 0}}createAppliedContainer(e){const o=document.createElement("div");o.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 r=document.createElement("button");r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.appendChild(this.promoCodePill),o.appendChild(r),this.container.appendChild(o),this.promoInput=null,this.applyButton=null}createInputContainer(){const e=document.createElement("div");e.classList.add("promo-code-container");const o=document.createElement("div");o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),e.appendChild(o),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(),o=e.length>=3,r=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),c=this.getStoreValue("cart.events")||[],l=hasCartAnyPromoCodeEvents(c);this.applyButton.disabled=!o||r||Boolean(null==s?void 0:s.discountAmount)||this.isApplying||l}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:20},onChange:e=>{const o=e.toUpperCase(),r=this.promoInput;r.setValue(o),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.applyButton.disabled=!![],await this.commands.cart.applyPromoCode(e)}catch(o){this.logger.error("Cart promo code application failed",{promoCode:e,error:o instanceof Error?o.message:String(o)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),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 o=document.createElement("div");o.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 r=document.createElement("button");return r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.appendChild(this.promoCodePill),o.appendChild(r),o}const o=document.createElement("div");o.classList.add("promo-code-container");const r=document.createElement("div");return r.classList.add("promo-container"),r.appendChild(this.createPromoInput()),r.appendChild(this.createApplyButton()),o.appendChild(r),o}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:c.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 o=this.container.querySelectorAll("[data-fulfillment-id]");if(o.length>0){const e=o[o.length-1];return{parent:e.parentElement,nextSibling:e.nextElementSibling}}return null}addFulfillmentElement(e){const o=this.getFulfillmentInsertionPoint();if(o){const r=this.createFulfillmentElement(e);r.setAttribute("data-fulfillment-id",e);const s=this.getFulfillmentContainer();s&&s.remove(),o.nextSibling?o.parent.insertBefore(r,o.nextSibling):o.parent.appendChild(r)}}removeFulfillmentElement(e){const o=this.getFulfillmentElementById(e);if(o){const e=o.parentElement,r=o.nextElementSibling;o.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const o=document.createElement("div");o.id="retailer-fulfillment-container",r?e.insertBefore(o,r):e.appendChild(o)}}}handleFulfillmentsUpdate(e,o){const r=new Set(e||[]),s=new Set(o||[]);for(const c of r)s.has(c)||this.removeFulfillmentElement(c);for(const c of s)r.has(c)||this.addFulfillmentElement(c)}setupFulfillmentElements(){const e=this.getRetailerId(),o=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],r=this.container.querySelectorAll("[data-fulfillment-id]");for(const c of r)c.remove();let s=this.getFulfillmentContainer();if(!s){const e=this.container.querySelector(".retailer-body-container"),o=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",e&&o&&e.insertBefore(s,o)}for(const c of o)this.addFulfillmentElement(c)}setupSubtotalElement(){const e=this.getRetailerId(),o=this.container.querySelector("#retailer-subtotal-container");if(o){const r=ComponentFactoryService.createElement({type:c.CART_RETAILER_SUBTOTAL,retailerId:e});o.replaceWith(r)}}onStoreChanged(e){const o=this.getRetailerId(),r="cart.retailers."+o,s=e.find(e=>e.path===r);if(s){const e=s.oldValue,o=s.value,r=(null==e?void 0:e.fulfillments)||[],c=(null==o?void 0:o.fulfillments)||[];JSON.stringify(r)!==JSON.stringify(c)&&this.handleFulfillmentsUpdate(r,c)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),o=this.container.querySelector(".retailer-section");e&&o&&(e.addEventListener("change",()=>{e.checked?o.classList.add("collapsed"):o.classList.remove("collapsed")}),e.checked?o.classList.add("collapsed"):o.classList.remove("collapsed"))}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(),o=this.getStoreValue("cart.retailers."+e),r=document.createElement("section");r.className="retailer-section";const s=document.createElement("div");s.className="cart-retailer-header";const c=document.createElement("div");c.className="retailer-info";const l=document.createElement("h2");l.className="section-title",l.textContent=o.name,c.appendChild(l);const d=document.createElement("input");d.type="checkbox",d.id=o.id,d.className="section-toggle",c.appendChild(d);const h=document.createElement("label");h.htmlFor=o.id,h.className="section-header-label";const p=document.createElement("span");p.className="chevron",p.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),h.appendChild(p),c.appendChild(h),s.appendChild(c),r.appendChild(s);const m=document.createElement("div");m.className="retailer-body-container";const g=document.createElement("div");g.id="retailer-fulfillment-container",m.appendChild(g);const v=document.createElement("div");return v.id="retailer-subtotal-container",m.appendChild(v),r.appendChild(m),r}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(e,o){const r=Object.values(e||{}).filter(e=>e.retailerId===o);let s=0;for(const c of r)s+=c.quantity;return s}template(){const e=this.params.retailerId,o=this.getStoreValue("cart.retailers."+e+".subtotal")||0,r=this.getStoreValue("cart.retailers."+e+".engravingFee")||0,s=this.getStoreValue("cart.items"),c=this.getRetailerItemCount(s,e),l=1===c?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+c+" "+l+"):";const h=document.createElement("span");return h.className="retailer-subtotal-amount",h.textContent=formatCentToDollarText(o+r),[d,h]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var e,o,r;const s=this.store.get("checkout.isPresaleLocked"),l=this.store.get("checkout.presaleExpiresAt"),d=this.getConfigs("global"),h=this.clientConfig.get("promoTicker"),p=null!==(o=null===(e=null==d?void 0:d.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==o?o:[],m=null!=h?h:p,g=this.store.get("address"),v=hasActiveItems(m,null===(r=null==g?void 0:g.address)||void 0===r?void 0:r.state),y=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),b=s&&l,x=document.createElement("div");x.classList.add("checkout-container"),y&&x.classList.add("no-header"),this.params.isIndependentComponent&&x.classList.add("independent");const w=ComponentFactoryService.createElement({type:c.CHECKOUT_INFORMATION_SECTION});x.appendChild(w);const C=ComponentFactoryService.createElement({type:c.CHECKOUT_SUMMARY_SECTION});if(x.appendChild(C),!b&&(!m.length||!v)&&y)return[x];const k=document.createElement("div");if(k.classList.add("checkout-header-wrapper"),!y){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_HEADER});k.appendChild(e)}if(m.length&&v&&!b){const e=ComponentFactoryService.createElement({context:"checkout",type:c.PROMO_CODE_TICKER,tickers:m});k.appendChild(e)}if(b){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_PRESALE_COUNTDOWN});k.appendChild(e)}return[k,x]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const e=this.store.get("checkout.isPresaleLocked"),o=this.getConfigs("checkout");let r=null;if(!e){r=document.createElement("button"),r.classList.add("checkout-header-button"),r.setAttribute("aria-label","Back to Cart"),r.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(c.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),r.appendChild(e)}const s=document.createElement("h1");s.textContent=(null==o?void 0:o.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.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()}),r?[r,s,l]:[s,l]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(e){const o=e.find(e=>"checkout.isGift"===e.path);o&&this.handleBuyerInformationVisibility(o.value)}handleBuyerInformationVisibility(e){const o=this.container.querySelector("#buyer-information-container");if(e&&!o){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_BUYER_INFORMATION_FORM});e.id="buyer-information-container";const o=this.container.querySelector(".checkout-delivery-information");o&&o.insertAdjacentElement("afterend",e)}else!e&&o&&setTimeout(()=>{o.remove()},300)}template(){const e=[],o=ComponentFactoryService.createElement({type:c.CHECKOUT_DELIVERY_INFORMATION_FORM});e.push(o);const r=ComponentFactoryService.createElement({type:c.CHECKOUT_PAYMENT_FORM});e.push(r);const s=ComponentFactoryService.createElement({type:c.CHECKOUT_BILLING_FORM});return e.push(s),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 o;const r=e.find(e=>"checkout.presaleExpiresAt"===e.path);if(null==r?void 0:r.value)return this.updateExpiresAt(r.value),!![];const s=e.find(e=>"ui.drawer"===e.path);return(null===(o=null==s?void 0:s.value)||void 0===o?void 0:o.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,o;const r=[".drawer-content"];for(const c of r){const o=null===(e=this.rootElement)||void 0===e?void 0:e.closest(c);if(o&&this.isScrollable(o))return o}let s=null===(o=this.rootElement)||void 0===o?void 0:o.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.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,o;if(!this.scrollContainer)return;const r=this.scrollContainer.scrollTop,s=70,c=10;!this.isCurrentlyScrolled&&r>s?(this.isCurrentlyScrolled=!![],null===(e=this.rootElement)||void 0===e||e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&r<c&&(this.isCurrentlyScrolled=![],null===(o=this.rootElement)||void 0===o||o.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(e){const o=window.getComputedStyle(e),r=o.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===r||"scroll"===r||"overlay"===r)}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 o=new Date,r=Math.floor((this.expiresAt.getTime()-o.getTime())/1e3);r<this.totalDuration&&(this.totalDuration=Math.max(r,240)),this.startCountdown()}catch(o){this.logger.error("Failed to parse presale expiration date",o),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,o=Math.max(0,this.expiresAt.getTime()-e.getTime()),r=o/1e3,s=this.totalDuration-r,c=Math.max(0,Math.min(100,s/this.totalDuration*100)),l=r<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(o));const h=this.rootElement.querySelector("[data-progress-fill]");h&&(h.style.width=c+"%"),0===o&&this.handleExpire()}formatTime(e){const o=Math.floor(e/1e3),r=Math.floor(o/60),s=o%60,c=Math.floor(e%1e3/10);return r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const e=document.createElement("div");e.classList.add("checkout-presale-countdown"),this.rootElement=e;const o=document.createElement("div");o.classList.add("checkout-presale-text-container");const r=document.createElement("div");r.classList.add("checkout-presale-heading");const s=document.createElement("h2");s.textContent="LIMITED PRE-ORDER:";const c=document.createElement("div");c.classList.add("checkout-presale-timer"),c.setAttribute("data-timer",""),c.textContent="00:00:00",r.appendChild(s),r.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"),o.appendChild(r),o.appendChild(l);const d=document.createElement("div");d.className="checkout-presale-progress-bar",d.setAttribute("data-progress","");const h=document.createElement("div");return h.className="checkout-presale-progress-fill",h.setAttribute("data-progress-fill",""),h.style.width="0%",d.appendChild(h),e.appendChild(o),e.appendChild(d),e}}const pt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],mt={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,o){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(o)?o:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(o)?o:null:"class"===e?o.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():o.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const o=e.textContent||"",r=o.replace(/<[^>]*>/g,"");if(r.trim()){const e=document.createTextNode(r);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const o=e,r=o.tagName.toLowerCase();if(pt.includes(r)){const e=document.createElement(r),s=mt[r]||[];for(const r of Array.from(o.attributes)){const o=r.name.toLowerCase();if(s.includes(o)){const s=sanitizeAttributeValue(o,r.value);null!==s&&e.setAttribute(o,s)}}"a"===r&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const r of Array.from(o.childNodes)){const o=cleanNode(r);o&&e.appendChild(o)}return e}const s=document.createDocumentFragment();for(const e of Array.from(o.childNodes)){const o=cleanNode(e);o&&s.appendChild(o)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const o=new DOMParser,r=o.parseFromString(e,"text/html"),s=r.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const c=document.createDocumentFragment();for(const e of Array.from(r.body.childNodes)){const o=cleanNode(e);o&&c.appendChild(o)}const l=document.createElement("div");return l.appendChild(c),l.innerHTML}catch(o){return console.error("HTML sanitization error:",o),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const o=e.find(e=>"checkout.amounts"===e.path);if(o){const e=this.getStoreValue("checkout"),o=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&o>0)}}updateZeroAmountElement(e){const o=this.container.querySelector(".checkout-zero-amount-container");if(e&&!o){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 o=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");o&&o.after(e)}else!e&&o&&o.remove()}afterRender(){const e=this.getStoreValue("checkout.amounts");e&&this.updateZeroAmountElement(0===e.total)}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,o=this.config.layout.smsOptIn;if(!e.show&&!o.show)return null;const r=document.createElement("div");if(r.classList.add("checkout-marketing-opt-ins-container"),e.show){const o=document.createElement("div");let s;o.classList.add("checkout-checkbox-container"),s=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"),s&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked")});const l=document.createElement("label");l.setAttribute("for","emailOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(e.text),l.addEventListener("click",e=>{const o=e.target,r="A"===o.tagName||o.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked"))}),o.appendChild(c),o.appendChild(l),r.appendChild(o)}if(o.show){const e=document.createElement("div");let s;e.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?o.checked:this.store.get("checkout.marketingPreferences.canSms");const c=document.createElement("span");c.classList.add("checkout-checkbox-visual"),c.id="smsOptIn",s&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked")});const l=document.createElement("label");l.setAttribute("for","smsOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(o.text),l.addEventListener("click",e=>{const o=e.target,r="A"===o.tagName||o.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked"))}),e.appendChild(c),e.appendChild(l),r.appendChild(e)}return r}hasOnDemandOrder(){const e=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}template(){var e;const o=[],r=this.getConfigs("global"),s=this.getConfigs("checkout"),l=this.getConfigs("global"),d=s.layout.allowGiftCards,h=null===(e=null==l?void 0:l.layout)||void 0===e?void 0:e.allowPromoCodes,p=document.createElement("div");p.classList.add("section-title-container");const m=document.createElement("h3");m.textContent="Order Summary",m.classList.add("section-title"),p.appendChild(m),o.push(p);const g=ComponentFactoryService.createElement({type:c.CHECKOUT_ITEMS});o.push(g);const v=document.createElement("div");v.classList.add("checkout-separator");const y=document.createElement("div");if(y.classList.add("checkout-separator"),o.push(v),d||h){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_PC_GC});o.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_TIPS});o.push(e),o.push(y)}const b=document.createElement("div");b.classList.add("section-title-container");const x=document.createElement("h3");x.textContent="100% Secure Payments",x.classList.add("disclaimer-header"),b.appendChild(x);const w=document.createElement("p");w.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.",w.classList.add("disclaimer-description"),b.appendChild(w),o.push(b);const C=ComponentFactoryService.createElement({type:c.CHECKOUT_AMOUNTS});o.push(C);const k=ComponentFactoryService.createElement({type:c.CHECKOUT_PLACE_ORDER_BUTTON});o.push(k);const S=this.marketingOptInsContainer();if(S&&o.push(S),s.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const r=document.createElement("div");r.classList.add("checkout-legal-message"),r.innerHTML=sanitizeHTML(s.layout.legalMessage.text);const c=document.createElement("div");c.classList.add("checkout-separator"),o.push(e),o.push(r),o.push(c)}if(r.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"checkout"});o.push(e)}return o}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(e){this.commands.checkout.updateBillingInfo($.firstName,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.firstName,fieldValue:e})}async handleLastNameChange(e){this.commands.checkout.updateBillingInfo($.lastName,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.lastName,fieldValue:e})}async handleEmailChange(e){this.commands.checkout.updateBillingInfo($.email,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.email,fieldValue:e})}async handlePhoneChange(e){this.commands.checkout.updateBillingInfo($.phone,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.phone,fieldValue:e})}async handleCompanyChange(e){this.commands.checkout.updateBillingInfo($.company,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.company,fieldValue:e})}async handleAddressOneChange(e){this.commands.checkout.updateBillingInfo($.addressOne,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.addressOne,fieldValue:e})}async handleAddressTwoChange(e){this.commands.checkout.updateBillingInfo($.addressTwo,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.addressTwo,fieldValue:e})}async handleCityChange(e){this.commands.checkout.updateBillingInfo($.city,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.city,fieldValue:e})}async handleStateChange(e){this.commands.checkout.updateBillingInfo($.state,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.state,fieldValue:e})}async handleZipCodeChange(e){this.commands.checkout.updateBillingInfo($.zipCode,e),this.pubSub.publishForm(s.BILLING,{fieldName:$.zipCode,fieldValue:e})}billingSameAsShippingToggle(){const e=this.getStoreValue("checkout.billingSameAsShipping"),o=document.createElement("div");o.classList.add("checkout-billing-same-as-shipping-toggle-container");const r=document.createElement("div");r.classList.add("checkout-checkbox-container");const s=document.createElement("span");s.id="billingSameAsShipping",s.classList.add("checkout-checkbox-visual"),e&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),o.addEventListener("click",async()=>{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"),r.appendChild(s),r.appendChild(c),o.appendChild(r),o}template(){const e=this.getStoreValue("checkout.billingSameAsShipping"),o=[],r=this.billingSameAsShippingToggle();if(o.push(r),e)return o;const s=document.createElement("div");s.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Your billing info",l.classList.add("section-title"),s.appendChild(l);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),s.appendChild(d),o.push(s);const h=document.createElement("div");h.classList.add("section-form-container");const p=document.createElement("div");p.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});p.appendChild(m);const g=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});p.appendChild(g),h.appendChild(p);const v=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:$.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});h.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:$.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});y.appendChild(b);const x=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});y.appendChild(x),h.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});w.appendChild(C);const k=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});w.appendChild(k),h.appendChild(w);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const E=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});S.appendChild(E);const T=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.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"});S.appendChild(T);const I=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:$.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return S.appendChild(I),h.appendChild(S),o.push(h),o}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(e){this.commands.checkout.updateCustomerInfo(X.firstName,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.firstName,fieldValue:e})}async handleLastNameChange(e){this.commands.checkout.updateCustomerInfo(X.lastName,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.lastName,fieldValue:e})}async handleEmailChange(e){this.commands.checkout.updateCustomerInfo(X.email,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.email,fieldValue:e})}async handlePhoneChange(e){this.commands.checkout.updateCustomerInfo(X.phone,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.phone,fieldValue:e})}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(X.company,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.company,fieldValue:e})}async handleDobChange(e){this.commands.checkout.updateCustomerInfo(X.birthDate,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.birthDate,fieldValue:e})}template(){const e=this.store.get("checkout.customer"),o=[],r=document.createElement("div");r.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),r.appendChild(s);const l=document.createElement("p");l.textContent="Buyer information is used to process your order and for delivery purposes.",l.classList.add("section-subtitle"),r.appendChild(l),o.push(r);const d=document.createElement("div");d.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:X.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});h.appendChild(p);const m=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:X.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});h.appendChild(m),d.appendChild(h);const g=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:X.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:this.handleCompanyChange.bind(this)});d.appendChild(g);const v=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:X.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});d.appendChild(v);const y=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:X.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});d.appendChild(y);const b=ComponentFactoryService.createElement({type:c.BIRTHDATE_INPUT,inputType:"date",name:X.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return d.appendChild(b),o.push(d),o}}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 o=this.getStoreValue("checkout.isGift");o?(this.commands.checkout.updateGiftInfo(Z.firstName,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.firstName,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(X.firstName,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.firstName,fieldValue:e}))}async handleLastNameChange(e){const o=this.getStoreValue("checkout.isGift")||![];o?(this.commands.checkout.updateGiftInfo(Z.lastName,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.lastName,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(X.lastName,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.lastName,fieldValue:e}))}async handleEmailChange(e){const o=this.getStoreValue("checkout.isGift")||![];o?(this.commands.checkout.updateGiftInfo(Z.email,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.email,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(X.email,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.email,fieldValue:e}))}async handlePhoneChange(e){const o=this.getStoreValue("checkout.isGift")||![];o?(this.commands.checkout.updateGiftInfo(Z.phone,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.phone,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(X.phone,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.phone,fieldValue:e}))}async handleAddressTwoChange(e){const o=this.getStoreValue("checkout.isGift")||![];o?(this.commands.checkout.updateGiftInfo(Z.addressTwo,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.addressTwo,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(X.addressTwo,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.addressTwo,fieldValue:e}))}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(X.company,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.company,fieldValue:e})}async handleBirthdateChange(e){this.commands.checkout.updateCustomerInfo(X.birthDate,e),this.pubSub.publishForm(s.CUSTOMER,{fieldName:X.birthDate,fieldValue:e})}async handleGiftMessageChange(e){this.commands.checkout.updateGiftInfo(Z.message,e),this.pubSub.publishForm(s.GIFT,{fieldName:Z.message,fieldValue:e})}template(){const e=this.getConfigs("global"),o=this.getStoreValue("checkout.isGift")||![],r=this.store.get("checkout.giftRecipient"),s=this.store.get("checkout.customer"),l=this.store.get("address.formattedAddress"),d=o?r:s,h=[],p=document.createElement("div");p.classList.add("delivery-header-container");const m=document.createElement("div");m.classList.add("delivery-header-content");const g=document.createElement("div");g.classList.add("delivery-title-container");const v=document.createElement("h3");v.textContent="Deliver to",v.classList.add("delivery-title");const y=document.createElement("p");y.textContent="Package recipient must be 21+",y.classList.add("delivery-subtitle"),g.appendChild(v),g.appendChild(y);const b=document.createElement("div");b.classList.add("gift-toggle-container");const x=document.createElement("div");x.classList.add("gift-label-wrapper");const w=document.createElement("span");w.textContent="Send as Gift? (Free)",w.classList.add("gift-toggle-label"),x.appendChild(w);const C=document.createElement("span");C.textContent="With personalized note & gift receipt.",C.classList.add("gift-toggle-description"),x.appendChild(C);const k=document.createElement("div");k.classList.add("toggle-switch"),k.classList.toggle("active",o);const S=document.createElement("div");S.classList.add("toggle-slider"),k.appendChild(S),b.appendChild(x),b.appendChild(k),k.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),p.appendChild(b),p.appendChild(g),h.push(p);const E=document.createElement("div");E.classList.add("section-form-container");const T=document.createElement("div");T.classList.add("checkout-two-col-container");const I=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:o?Z.firstName:X.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:d.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:o?"giftRecipient.firstName":"customer.firstName"});T.appendChild(I);const P=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:o?Z.lastName:X.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:d.lastName,onChange:this.handleLastNameChange.bind(this),storePath:o?"giftRecipient.lastName":"customer.lastName"});if(T.appendChild(P),E.appendChild(T),!o){const e=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:X.company,label:"Company (optional)",autocomplete:!![],value:d.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});E.appendChild(e)}const F=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:o?Z.email:X.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:d.email,onChange:this.handleEmailChange.bind(this),storePath:o?"giftRecipient.email":"customer.email"});E.appendChild(F);const D=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:o?Z.phone:X.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:d.phone,onChange:this.handlePhoneChange.bind(this),storePath:o?"giftRecipient.phone":"customer.phone"});if(E.appendChild(D),!o){const e=ComponentFactoryService.createElement({type:c.BIRTHDATE_INPUT,inputType:"date",name:X.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(d.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});E.appendChild(e)}const A=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:l,disabled:!![],className:"disabled-input",validation:{required:!![]}});E.appendChild(A);const _=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:o?Z.addressTwo:X.addressTwo,label:"Apt, suite, etc. (optional)",value:d.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:o?"giftRecipient.addressTwo":"customer.addressTwo"});if(E.appendChild(_),this.hasOnDemandFulfillments()){const o=document.createElement("div");o.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Delivery Instructions",r.setAttribute("for","delivery_instructions");const s=document.createElement("textarea");s.id="delivery_instructions",s.name="delivery_instructions",s.rows=4,s.value=this.store.get("checkout.deliveryInstructions")||"",s.addEventListener("blur",async e=>{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"),o.appendChild(r),o.appendChild(s),o.appendChild(c),E.appendChild(o)}if(o){const o=document.createElement("div");o.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Gift Message*",s.setAttribute("for",Z.message);const c=document.createElement("textarea");c.name=Z.message,c.id=Z.message,c.rows=4,c.value=r.message||"",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"),o.appendChild(s),o.appendChild(c),o.appendChild(l),E.appendChild(o)}return h.push(E),h}}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,o=null;for(;e&&e!==document.body;){const r=e.hasAttribute("checkout"),s=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(c.LCE_ELEMENT),l=e.hasAttribute("drawer"),d=(null==o?void 0:o.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(c.DRAWER),h="checkout"===(null==o?void 0:o.getAttribute("data-target"));if(r||s&&l&&d&&h)return this.rootComponent=e,e;o=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"),o=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"stripe",variables:{fontFamily:o.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:o.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===o.layout.inputFieldStyle?"none":"1px solid "+o.theme.accentColor,backgroundColor:"filled"===o.layout.inputFieldStyle?o.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 o=this.findRootComponent();if(!o)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 r=o.querySelectorAll('[slot="'+Q+'"]');if(r.length>0)for(const c of r)c.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:c.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.stripeFormElement.setAttribute("slot",Q),o.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 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:o,setupIntentId:r}=e.detail;await this.commands.checkout.confirmPaymentSession(o,r)}catch(o){this.logger.error("Failed to confirm payment session",o),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const o=await this.doStripeConfig(),r=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:o}});null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(r)}catch(o){this.logger.error("Failed to refresh payment session",o)}})}onStoreChanged(e){const o=e.some(e=>"checkout.payment.sendSubmitSignal"===e.path&&e.value===!![]);if(o&&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=[],o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Payment",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="All transactions are secure and encrypted.",s.classList.add("section-subtitle"),o.appendChild(s),e.push(o);const c=document.createElement("slot");return c.setAttribute("name",Q),e.push(c),e}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this._=null,this.O=null,this.N=null,this.M=![],this.L=![],this.R=![]}async initialize({data:e}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=e.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const e=this.B;this._=window.Stripe(e.publishableKey),this.O=this._.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 o=!!e.error,r=e.complete,s=o?e.error.message:null;this.L=r,await this.updateStripeFormStatus({isComplete:r,hasError:o,errorMessage:s,isProcessing:this.M})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.M})}),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:o}=e.detail;o&&(this.B=o,await this.refreshPaymentSession())}async handleSubmit(){if(!this.M){this.M=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("Please complete all required payment fields");this.R&&await this.requestSessionRefresh();const e=await this.createConfirmationTokenId(),o=this.B.clientSecret,r=o.split("_secret_")[0],s=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:e,setupIntentId:r}});this.dispatchEvent(s),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(e){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}async requestSessionRefresh(){const e=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(e),new Promise((e,o)=>{const r=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",t),o(new Error("Session refresh timeout"))},5e3),t=()=>{clearTimeout(r),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(L){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(e){const o=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e}});this.dispatchEvent(o)}async createConfirmationTokenId(){if(!this.O)throw new Error("Elements must be provided");try{const{error:e}=await this.O.submit();if(e)throw new Error(e.message);const o={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:r,confirmationToken:s}=await this._.createConfirmationToken(o);if(r)throw new Error(r.message);if(!s||!s.id)throw new Error("Confirmation token not found");return s.id}catch(e){throw new Error(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,o;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(o=(e=this.O).destroy)||void 0===o?void 0:o.call(e),this.O=null),this._=null,this.M=![],this.L=![],this.R=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(r){console.warn("Error during Stripe form cleanup:",r)}}loadStripeJS(){return new Promise((e,o)=>{const r=document.createElement("script");r.src="https://js.stripe.com/basil/stripe.js",r.onload=()=>e(),r.onerror=()=>o(new Error("Failed to load Stripe.js")),document.head.appendChild(r)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,o,r;const s=this.getStoreValue("checkout"),c=Boolean(s.promoCode),l=Boolean(null===(e=s.giftCards)||void 0===e?void 0:e.length),d=this.getConfigs("global"),h=Object.values(s.items||{}),p=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Subtotal ("+h.length+" item"+(h.length>1?"s":"")+")",m.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(s.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(s.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 k=document.createElement("span");if(k.textContent=formatCentToDollarText(s.amounts.delivery),w.appendChild(k),p.push(w),(null===(o=null==s?void 0:s.amounts)||void 0===o?void 0:o.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const o=document.createElement("span");o.textContent="Engraving",e.appendChild(o);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.engraving),e.appendChild(r),p.push(e)}const S=document.createElement("div");S.classList.add("checkout-amount-line");const E=document.createElement("span");E.textContent="Taxes & Fees",S.appendChild(E);const T=document.createElement("span");if(T.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),S.appendChild(T),p.push(S),c){const e=document.createElement("div");e.classList.add("checkout-amount-line");const o=document.createElement("span");o.textContent="Promo Code ("+(null===(r=s.promoCode)||void 0===r?void 0:r.code)+")",e.appendChild(o);const c=document.createElement("span");c.textContent="-"+formatCentToDollarText(s.amounts.discounts),e.appendChild(c),p.push(e)}if(l){const e=document.createElement("div");e.classList.add("checkout-amount-line");const o=document.createElement("span");o.textContent="Gift Cards Applied",e.appendChild(o);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(s.amounts.giftCards),e.appendChild(r),p.push(e)}const I=document.createElement("div");I.classList.add("checkout-amount-line");const P=document.createElement("span");P.textContent="Tips",I.appendChild(P);const F=document.createElement("span");F.textContent=formatCentToDollarText(s.amounts.tip),I.appendChild(F),p.push(I);const D=document.createElement("div");D.classList.add("checkout-separator"),I.appendChild(D),p.push(D);const A=document.createElement("div");A.classList.add("checkout-amount-total");const _=document.createElement("span");_.textContent="Total",A.appendChild(_);const O=document.createElement("span");O.textContent=formatCentToDollarText(s.amounts.total),A.appendChild(O),p.push(A);const z=this.store.get("checkout.isPresaleLocked");if(z){const e=document.createElement("div");e.classList.add("checkout-amount-due");const o=document.createElement("span");o.textContent="Amount due today",e.appendChild(o);const r=document.createElement("span");r.textContent=formatCentToDollarText(0),e.appendChild(r),p.push(e);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const c=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));s.appendChild(c);const l=document.createElement("p");l.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(l),p.push(s)}return p}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const e=[],o=this.getConfigs("configurations"),r=this.getConfigs("global"),s=this.getConfigs("checkout"),l=this.config.layout.exitUrl||window.location.host,d=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const r=document.createElement("div");r.classList.add("checkout-completed-header-container");const s=document.createElement("img");s.src=this.config.theme.checkoutCompleted.customLogo,s.alt=o.partnerName+" Logo",r.appendChild(s),e.push(r)}const h=document.createElement("div");h.classList.add("checkout-completed-section-container");const p=document.createElement("div");p.classList.add("checkout-completed-title-container");const m=document.createElement("div");m.classList.add("checkout-completed-title-section");const g=document.createElement("h3");g.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",m.appendChild(g);const v=document.createElement("p");v.textContent="Your payment has been successfully processed.",m.appendChild(v),p.appendChild(m),h.appendChild(p);const y=document.createElement("div");y.classList.add("checkout-completed-sub-section");const b=document.createElement("div");b.classList.add("checkout-completed-line");const x=document.createElement("h3");x.textContent="Order Number",b.appendChild(x);const w=document.createElement("span");w.textContent=this.params.orderNumber,b.appendChild(w),y.appendChild(b);const C=document.createElement("div");C.classList.add("checkout-completed-line");const k=document.createElement("h3");k.textContent="Order Amount",C.appendChild(k);const S=document.createElement("span");S.textContent=""+formatCentToDollarText(this.params.orderTotal),C.appendChild(S),y.appendChild(C);const E=document.createElement("div");E.classList.add("checkout-completed-line");const T=document.createElement("h3");T.textContent="Payment Method",E.appendChild(T);const I=document.createElement("span");I.textContent="** "+this.params.cardLast4,E.appendChild(I),y.appendChild(E),h.appendChild(y);const P=document.createElement("div");P.classList.add("checkout-completed-sub-section");const F=document.createElement("h3");F.textContent="Confirmation email sent",P.appendChild(F);const D=document.createElement("p");D.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>.",P.appendChild(D),h.appendChild(P),e.push(h);const A=document.createElement("div");A.classList.add("checkout-completed-section-container");const _=document.createElement("button");_.type="button";const O=document.createElement("span");O.textContent=d,_.appendChild(O);const z=htmlStringToElement(ArrowRightIcon({width:16,height:16}));_.appendChild(z),_.addEventListener("click",()=>{window.location.href=l}),A.appendChild(_),e.push(A);const N=document.createElement("div");N.classList.add("checkout-completed-section-container");const M=document.createElement("div");M.classList.add("checkout-completed-help-section"),N.appendChild(M);const L=document.createElement("p");L.textContent="Questions about your order? Contact us at "+o.supportEmail,M.appendChild(L);const B=document.createElement("p"),q=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(B.textContent="Order placed on "+q,M.appendChild(B),e.push(N),s.layout.legalMessage.show){const o=document.createElement("div");o.classList.add("checkout-separator");const r=document.createElement("div");r.classList.add("checkout-legal-message"),r.innerHTML=sanitizeHTML(s.layout.legalMessage.text);const c=document.createElement("div");c.classList.add("checkout-separator"),e.push(o),e.push(r),e.push(c)}if(r.layout.showPoweredBy){const o=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"general"});e.push(o)}return e}}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 o;const r=e.find(e=>"checkout.giftCards"===e.path),s=e.find(e=>"checkout.loading"===e.path);r&&r.value.length>((null===(o=r.oldValue)||void 0===o?void 0:o.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),o=e.length>=3&&e.length<=20,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!o||r||Boolean(s)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:20},onChange:e=>{const o=e.toUpperCase(),r=this.giftCardInput;r.setValue(o),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(o){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:o instanceof Error?o.message:String(o)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),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}}const shouldShowMinimumPurchaseAlert=(e,o=![])=>{var r,s;const c=e.subtotal;if(e.type===l.SHIPPING){const l=e.fees;if(o&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0&&c<l.pack.min)return!![];if(!o&&(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&c<l.individual.min)return!![]}else if(e.type===l.ON_DEMAND){const o=e.fees;if(o.min>0&&c<o.min)return!![]}return![]},getMinimumPurchaseMessage=(e,o=![])=>{var r,s,c,d;const h=e.subtotal;if(e.type===l.SHIPPING){const l=e.fees;let d=0;if(o&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0?d=l.pack.min:(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&(d=l.individual.min),d>0&&h<d)return{message:formatCentToDollarText(d-h)+" more needed - "+(null===(c=null==e?void 0:e.expectation)||void 0===c?void 0:c.detail),type:"warning"}}if(e.type===l.ON_DEMAND){const o=e.fees,r=o.min>0?o.min:0;if(r>0&&h<r)return{message:formatCentToDollarText(r-h)+" more needed - "+(null===(d=null==e?void 0:e.expectation)||void 0===d?void 0:d.detail),type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(e,o=![])=>{var r,s;const c=e.subtotal;if(e.type===l.SHIPPING){const l=e.fees;if(o&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0&&c<l.pack.min)return!![];if(!o&&(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&c<l.individual.min)return!![]}if(e.type===l.ON_DEMAND){const o=e.fees;if(o.min>0&&c<o.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 o={warning:"warning",success:"success",info:"info"},r={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=o[this.params.messageType]||"warning",c=document.createElement("div");return c.className="alert-icon alert-icon-"+this.params.messageType,c.appendChild(htmlStringToElement(r[s]({width:16,height:16,className:"alert-icon-svg"}))),c}template(){var e;const o=[],r=this.getIconElement();r&&o.push(r);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,o.push(s),"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 r=document.createElement("small");r.className="alert-details-text",r.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(r),o.push(e)}return o}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchOnlyStorePaths:["checkout.items"]}),this.trashButton=null}onStoreWatch(e){const o=e.find(e=>"checkout.items"===e.path);o&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState())}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const o=e.fulfillmentId;if(!o)return;if(!this.container)return;const r=this.container.querySelector(".checkout-item-card-header");if(r){const s=this.getStoreValue("cart.fulfillments."+o),l=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(s,e.pack)){const o=getMinimumPurchaseMessage(s,e.pack),l=ComponentFactoryService.createElement({type:c.PURCHASE_MIN_ALERT,message:o.message,messageType:o.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});l.setAttribute("data-component-type","checkout-retailer-alert"),r.before(l)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),o=Object.keys(e.items).length,r=1===o;this.trashButton.disabled=r,r?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 o=document.createElement("div");o.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.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 ',o.appendChild(r),e.appendChild(o),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(),o=this.hasLoadingOverlay();e&&!o?this.showLoadingOverlay():!e&&o&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e;const o=this.getConfigs("global"),r=this.getStoreValue("checkout.items."+this.params.itemId),s=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.presale,l=(null==s?void 0:s.isActive)&&(null==s?void 0:s.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(s.estimatedShipBy):"";if(!r)return[];const d=document.createElement("div");d.classList.add("checkout-item-card-header");const h=document.createElement("img");h.classList.add("checkout-item-image"),h.src=r.mainImage,h.alt=r.name,h.loading="lazy",d.appendChild(h);const p=document.createElement("div");p.classList.add("checkout-item-details-container");const m=document.createElement("h4");m.classList.add("checkout-item-title"),m.textContent=r.name,p.appendChild(m);const g=document.createElement("div");g.classList.add("checkout-item-subtitle");const v=document.createElement("span");v.textContent=s.isActive?""+l:((null==r?void 0:r.expectationDetail)||"")+",",g.appendChild(v);const y=document.createElement("span");y.textContent="From "+((null==r?void 0:r.retailerName)||""),g.appendChild(y),p.appendChild(g),d.appendChild(p),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var o;if(e.preventDefault(),e.stopPropagation(),!(null===(o=this.trashButton)||void 0===o?void 0:o.disabled))try{await this.commands.checkout.removeItem(r.cartItemId)}catch(s){this.logger.error("Checkout item removal failed",s)}}),d.appendChild(this.trashButton);const b=ComponentFactoryService.createElement({type:c.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),x=[];if(x.push(d),o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout",watchStorePaths:["checkout.items.{identifier}"]});x.push(e)}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(e){const o=e.find(e=>"checkout.items"===e.path);if(o){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getCheckoutItemStore(){const e=this.params.itemId,o=this.getStoreValue("checkout.items."+e);return o||null}getAvailableQuantity(){var e,o,r;const s=this.getCheckoutItemStore();if(!s)return 0;const c=this.getStoreValue("products");if(!c)return 0;const l=s.partNumber,d=s.fulfillmentId,h=null===(r=null===(o=null===(e=Object.values(c).find(e=>e.sizes[s.liquidId]))||void 0===e?void 0:e.sizes)||void 0===o?void 0:o[s.liquidId])||void 0===r?void 0:r.attributes.maxQuantityPerOrder;if(!h)return 0;const p=this.getStoreValue("checkout.items")||{},m=Object.values(p).filter(e=>e.partNumber===l&&e.fulfillmentId===d),g=m.reduce((e,o)=>e+o.quantity,0);return h-g}calculateQuantityLimits(){var e;const o=this.getCheckoutItemStore();if(!o)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const r=this.getStoreValue("checkout"),s=1===(null===(e=Object.values(r.items))||void 0===e?void 0:e.length),c=o.quantity,l=this.getAvailableQuantity(),d=l>0,h=!(s&&1===c);return{currentQuantity:c,availableQuantity:l,isTheOnlyItem:s,canIncrease:d,canDecrease:h}}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 o=this.calculateQuantityLimits(),r=this.params.itemId;if((!(e<0)||o.canDecrease)&&(!(e>0)||o.canIncrease)){if(!r)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(r,e)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}createQuantityContainer(){const e=this.calculateQuantityLimits(),o=document.createElement("div");return 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(e),o}template(){const e=this.getCheckoutItemStore();if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const o=this.createQuantityContainer(),r=document.createElement("span");return r.classList.add("checkout-item-price-text"),r.textContent=formatCentToDollarText(e.price),[o,r]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(e){return ComponentFactoryService.createElement({type:c.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")||{},o=new Map;for(const r of objectValues(e))r&&r.cartItemId&&o.set(r.cartItemId,r);return o}syncItemsWithStore(){const e=this.getItemsListContainer();if(!e)return;const o=this.getCurrentItemsMap(),r=e.querySelectorAll("[data-item-id]"),s=new Set;for(const c of r){const e=c.getAttribute("data-item-id");e&&s.add(e)}for(const c of r){const e=c.getAttribute("data-item-id");e&&!o.has(e)&&c.remove()}for(const[c]of o)if(!s.has(c)){const o=this.createItemElement(c);o.setAttribute("data-item-id",c),e.appendChild(o)}this.updateItemCount()}updateItemCount(){const e=this.getTogglerLabel();if(!e)return;const o=this.getCurrentItemsMap(),r=o.size;e.textContent=r+" item"+(1!==r?"s":"")}onStoreChanged(e){let o;for(let r=0;r<e.length;r++){const s=e[r];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){o=s;break}}return o?(this.syncItemsWithStore(),![]):![]}setupToggler(){const e=this.container.querySelector(".checkout-items-toggler"),o=this.container.querySelector(".checkout-items-toggler-button"),r=this.container.querySelector(".checkout-items-list");e&&o&&r&&e.addEventListener("click",()=>{const e=r.classList.contains("show");r.classList.toggle("show"),e?(o.classList.toggle("expanded"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label","Expand checkout items")):(o.classList.toggle("expanded"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.items"),o=objectValues(e||{}),r=document.createElement("div");r.classList.add("checkout-items-toggler");const s=document.createElement("span");s.classList.add("checkout-items-toggler-label"),s.textContent=o.length+" item"+(1!==o.length?"s":""),r.appendChild(s);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"}),r.appendChild(c);const l=document.createElement("div");l.classList.add("checkout-items-list","show");for(const d of o){const e=this.createItemElement(d.cartItemId);e.setAttribute("data-item-id",d.cartItemId),l.appendChild(e)}return[r,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 o=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);o&&this.updateButtonState();const r=e.find(e=>"checkout.readyForSubmit"===e.path);return r&&this.handleCheckoutReadyForSubmit(r.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.isFormValid")||![],o=this.store.get("checkout.invalidFields")||[],r=this.store.get("checkout.stripeFormStatus")||{},s=this.store.get("checkout.loading")||![],c=this.store.get("checkout.error")||null,l=r.isComplete||![],d=r.hasError||![],h=r.isProcessing||![],p=r.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(c,p));const m=this.determineButtonState({isFormValid:e,invalidFieldsCount:o.length,isPaymentComplete:l,hasPaymentError:d,isStripeProcessing:h,isCheckoutLoading:s,hasCheckoutError:!!c});this.applyButtonState(m)}determineErrorMessage(e,o){return e&&o?o:o||e}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const o=this.errorContainer.querySelector(".error-text");o&&(this.clearErrorTimeout(),e?(o.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)):(o.textContent="",this.errorContainer.style.display="none"))}determineButtonState(e){const{isFormValid:o,invalidFieldsCount:r,isPaymentComplete:s,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:d,hasCheckoutError:h}=e,p=this.config.layout.placeOrderButtonText,m=this.config.layout.placeOrderButtonShowRequiredFields,g=o&&s&&!c&&!l&&!h,v=this.store.get("checkout.readyForSubmit.payment")||![],y=this.store.get("checkout.readyForSubmit.prepared")||![],b=this.store.get("checkout.payment.sendSubmitSignal")||![],x=this.store.get("checkout.isPresaleLocked")||![];let w=![];if(!x){const e=this.getStoreValue("cart.fulfillments")||{};w=Object.values(e).some(e=>hasUnmetMinimum(e))}const C=l||d||b;if(d&&!l&&!b)return{state:"processing",text:p,disabled:!![]};if(w)return{state:"disabled",text:p,disabled:!![]};if(C)return v&&y?{state:"processing",text:"Placing Order...",disabled:!![]}:v&&!y?{state:"processing",text:"Preparing Order...",disabled:!![]}:y&&!v&&(l||b)||b||l?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!o){const e=r>0?" ("+r+")":"";return{state:"form-invalid",text:m?"Complete Required Fields"+e:p,disabled:![]}}return s?c?{state:"payment-error",text:p,disabled:![]}:g?{state:"ready",text:p,disabled:![]}:{state:"disabled",text:p,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(e){if(!this.placeOrderButton)return;const o=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...o),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")||![],o=this.store.get("checkout.stripeFormStatus")||{},r=this.store.get("checkout.loading")||![],s=o.isComplete||![],c=o.hasError||![],l=o.isProcessing||![];if(l||r)return;if(!e)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!s||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:o,prepared:r,customer:s,gift:c,billing:l}=e,d=o&&r&&s&&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.addEventListener("click",this.handlePlaceOrderClick.bind(this));const o=document.createElement("div");o.classList.add("checkout-payment-error-wrapper"),o.setAttribute("role","alert"),o.style.display="none";const r=document.createElement("div");r.classList.add("checkout-payment-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const l=document.createElement("span");l.classList.add("error-text"),r.appendChild(s),r.appendChild(l),o.appendChild(r);const d=ComponentFactoryService.createElement({type:c.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[o,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=[],o=this.getConfigs("global"),r=document.createElement("div");r.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const l=document.createElement("div");l.classList.add("checkout-completed-title-section");const d=document.createElement("p");d.textContent="Session Expired",l.appendChild(d);const h=document.createElement("p");h.textContent="Your reservation time has ended. The item has been released for other customers.",l.appendChild(h),s.appendChild(l),r.appendChild(s);const p=document.createElement("div");p.classList.add("checkout-completed-help-section");const m=document.createElement("p");m.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.",p.appendChild(m),r.appendChild(p),e.push(r);const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("button");v.setAttribute("aria-label","Continue shopping"),v.type="button";const y=document.createElement("span");y.textContent="Continue Shopping",v.appendChild(y);const b=htmlStringToElement(ArrowRightIcon({width:16,height:16}));v.appendChild(b),v.addEventListener("click",()=>this.handleExit()),g.appendChild(v),e.push(g);const x=document.createElement("div");x.classList.add("checkout-completed-section-container");const w=document.createElement("p");w.classList.add("checkout-completed-auto-close-text"),w.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 C=document.createElement("span");if(C.classList.add("checkout-completed-auto-close-text"),C.textContent="seconds",x.appendChild(w),x.appendChild(this.autoCloseElement),x.appendChild(C),e.push(x),o.layout.showPoweredBy){const o=document.createElement("div");o.classList.add("checkout-completed-powered-by-container");const r=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"checkout"});o.appendChild(r),e.push(o)}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 o=e.find(e=>"checkout.promoCode"===e.path),r=e.find(e=>"checkout.loading"===e.path);if(o){const{value:e,oldValue:r}=o,s=Boolean(r),c=Boolean(e);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;c&&this.promoCodeText&&e.discountAmount!==(null==r?void 0:r.discountAmount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")")}r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),o=e.length>=3&&e.length<=20,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),c=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!o||r||Boolean(s)||Boolean(c)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:20},onChange:e=>{const o=e.toUpperCase(),r=this.promoInput;r.setValue(o),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(o){this.logger.error("Checkout promo code application failed",{promoCode:e,error:o instanceof Error?o.message:String(o)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}createAppliedContainer(e){const o=document.createElement("div");o.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 r=document.createElement("button");r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),o.appendChild(this.promoCodeText),o.appendChild(r),this.container.appendChild(o),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 o=document.createElement("div");o.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const r=document.createElement("button");return r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),o.appendChild(this.promoCodeText),o.appendChild(r),o}const o=[];return o.push(this.createPromoInput()),o.push(this.createApplyButton()),o}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 o=this.getStoreValue("checkout.updating")||![];if(!o)try{await this.commands.checkout.updateTips(e)}catch(r){this.logger.error("Checkout tips update failed",r)}}async handleFulfillmentTipInput(e,o){const r=this.getStoreValue("checkout.updating")||![];if(r)return;const s=this.getOnDemandFulfillmentTipInfo();if(!s[e])return;const c=Math.round(100*o);try{await this.commands.checkout.updateFulfillmentTip(e,c)}catch(l){this.logger.error("Checkout fulfillment tip update failed",l)}}async removeTipFromFulfillment(e){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const r=this.getOnDemandFulfillmentTipInfo();if(r[e])try{await this.commands.checkout.removeFulfillmentTip(e)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const o=[10,18,20],r=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const c of o){const o=document.createElement("button");o.type="button",o.textContent=c+"%",o.classList.add("checkout-tip-button"),o.disabled=r,s===c&&o.classList.add("selected"),o.addEventListener("click",()=>this.handlePercentageSelect(c)),e.appendChild(o)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),o=this.container.querySelector(".checkout-items-toggler-button"),r=this.container.querySelector(".retailers-tips-list");e&&o&&r&&e.addEventListener("click",()=>{const e=r.classList.contains("show");r.classList.toggle("show"),e?(o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label","Expand tips section")):(o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label","Collapse tips section")),o.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const o=this.getFulfillmentTipInfoArray();if(0===o.length)return e;const r=document.createElement("div");r.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),r.appendChild(s);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"}),r.appendChild(c),e.appendChild(r);const l=document.createElement("div");l.classList.add("retailers-tips-list","show");for(const d of o){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const o=document.createElement("h4");o.textContent=d.retailerName,o.classList.add("checkout-sub-header"),e.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-tip-fulfillment-input-wrapper");const s=document.createElement("div");s.classList.add("dollar-input-container");const c=document.createElement("span");c.classList.add("dollar-sign"),c.textContent="$";const h=document.createElement("input");let p;h.type="number",h.id="tip-input-"+d.fulfillmentId,h.name="tip-"+d.fulfillmentId,h.min="0",h.step="0.01",h.placeholder="0.00",h.classList.add("dollar-input"),h.value=d.tip>0?(d.tip/100).toFixed(2):"",h.disabled=this.getStoreValue("checkout.updating")||![],h.addEventListener("wheel",e=>{e.preventDefault()}),h.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),h.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),h.addEventListener("paste",e=>{e.preventDefault()}),h.addEventListener("contextmenu",e=>{e.preventDefault()}),h.addEventListener("input",e=>{const o=e.target;let r=o.value;if(Number.parseFloat(r)<0&&(o.value=Math.abs(Number.parseFloat(r)).toString(),r=o.value),r.includes(".")){const e=r.split(".");e.length>1&&e[1].length>2&&(o.value=e[0]+"."+e[1].substring(0,2))}}),h.addEventListener("input",e=>{const o=e.target,r=Number.parseFloat(o.value)||0;p&&clearTimeout(p),p=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,r)},500)}),s.appendChild(c),s.appendChild(h),r.appendChild(s);const m=document.createElement("button");m.type="button",m.textContent="Remove",m.classList.add("checkout-tip-remove-button"),m.disabled=this.getStoreValue("checkout.updating")||![],m.addEventListener("click",()=>this.removeTipFromFulfillment(d.fulfillmentId)),r.appendChild(m),e.appendChild(r),l.appendChild(e)}return e.appendChild(l),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),o=this.getFulfillmentTipInfoArray();if(e&&o.length>0){const e=o.some(e=>e.tip>0);if(e)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(r){this.logger.error("Default tip initialization failed",r),this.isInitialized=![]}}if(null==e)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(s){this.logger.error("Default tip initialization failed during fallback",s),this.isInitialized=![]}}template(){const e=[],o=this.getFulfillmentTipInfoArray();if(0===o.length)return e;o.length>0&&this.initializeDefaultTip();const r=document.createElement("section");r.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",r.appendChild(s);const c=document.createElement("div");c.classList.add("checkout-tip-config-container");const l=this.createTipSelectionButtons();c.appendChild(l),r.appendChild(c);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",r.appendChild(d);const h=this.createTipDistribution();return e.push(r,h),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 o,r;const s=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),s){const e=this.container.querySelector(".input-gift-card-container");if(e){const r=e.nextElementSibling;if((null===(o=null==r?void 0:r.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==r?void 0:r.remove()),s.value){const o=this.createErrorElement(s.value);e.after(o)}const c=e.querySelector(".apply-button");c&&(c.disabled=Boolean(s.value))}}if(c){const e=this.container.querySelector(".input-promo-code-container");if(e){const o=e.nextElementSibling;if((null===(r=null==o?void 0:o.classList)||void 0===r?void 0:r.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),c.value){const o=this.createErrorElement(c.value);e.after(o)}const s=e.querySelector(".apply-button");s&&(s.disabled=Boolean(c.value))}}}updateAppliedGiftCards(e){const o=e&&e.length>0;if(!o)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 o=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(o)})}createAppliedGiftCardElement(e){const o=document.createElement("div");o.classList.add("checkout-pc-gc-applied"),o.setAttribute("data-gift-card-code",e.code);const r=document.createElement("span");r.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",o.appendChild(r);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),o.appendChild(s),o}pcInputContainer(){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return e}gcInputContainer(){const e=ComponentFactoryService.createElement({type:c.CHECKOUT_GIFT_CARDS});return e}inputContainer(){var e;const o=this.getConfigs("checkout"),r=this.getConfigs("global"),s=o.layout.allowGiftCards,c=null===(e=null==r?void 0:r.layout)||void 0===e?void 0:e.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),h=this.gcInputContainer();c&&l.appendChild(d);const p=this.getStoreValue("checkout.promoCodeError");if(p){const e=this.createErrorElement(p);e.classList.add("promo-code-error-wrapper"),l.appendChild(e)}s&&l.appendChild(h);const m=this.getStoreValue("checkout.giftCardError");if(m){const e=this.createErrorElement(m);l.appendChild(e)}return l}createErrorElement(e){const o=document.createElement("div");o.classList.add("error-banner-checkout");const r=document.createElement("div");r.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=e.toString(),o.appendChild(r),o.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),o.remove()},3e3),o}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const o=[];return o.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 o=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(o)}),o.push(this.appliedGiftCardsContainer)),o}disconnected(){this.appliedGiftCardsContainer=null}}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 o=this.getProductId(),r=e.find(e=>e.path==="products."+o+".drawer.isOpen"),s=e.find(e=>e.path==="products."+o+".rerender");r&&this.titleElement&&this.titleElement.classList.toggle("hide",r.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var e;const o=this.getProductId(),r=this.getStoreValue("products."+o);if(r.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:c.PRODUCT});if(r.loading)return ComponentFactoryService.createElement({type:c.PRODUCT_LOADING});const s=r.sizes[r.selectedSizeId],l=document.createElement("div");l.classList.add("product-content-wrapper"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+r.name);const d=document.createElement("div");if(d.classList.add("product-content"),d.setAttribute("role","region"),d.setAttribute("aria-label",""+r.name),this.config.layout.showTitle){const e=document.createElement("h1");e.classList.add("product-title"),e.textContent=r.name,this.titleElement=e,d.appendChild(e)}const h=ComponentFactoryService.createElement({type:c.PRODUCT_OPTIONS,productId:o});d.appendChild(h);const p=ComponentFactoryService.createElement({type:c.PRODUCT_DRAWER,productId:o});if(d.appendChild(p),l.appendChild(d),!this.config.layout.showImages||!(null===(e=r.images)||void 0===e?void 0:e.length))return l;l.classList.add("has-images");const m=ComponentFactoryService.createElement({type:c.PRODUCT_IMAGE_CAROUSEL,images:r.images,mainImage:s.image,productId:o});return l.prepend(m),m.setAttribute("aria-label","Product images"),l}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}class EngravingViewComponent extends BaseComponent{constructor(){super(...arguments),this.openEngravingDrawer=async()=>{const e=this.params.identifier,o=this.createEngravingFormParams();if(this.clientConfig.isMobile()){const r="product"===this.params.context?{...o,productId:e}:o;this.commands.ui.openDrawer(c.ENGRAVING_FORM,r)}if(!this.clientConfig.isMobile())if("product"===this.params.context){const r={...o,productId:e};await this.commands.product.openProductDrawer(e,c.ENGRAVING_FORM,r)}else this.commands.ui.openDrawer(c.ENGRAVING_FORM,o)}}get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}beforeSetupStoreWatchers(){var e;this.reactiveOptions.watchStorePaths=null!==(e=this.params.watchStorePaths)&&void 0!==e?e:[]}createEngravingFormParams(){var e,o;const r=this.params.identifier,s={identifier:r,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("product"===this.params.context){const c=this.getStoreValue("products."+r),l=null===(o=null===(e=c.sizes[c.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===o?void 0:o.engraving;s.lines=c.engravingLines||[],s.maxLines=(null==l?void 0:l.maxLines)||1,s.maxCharsPerLine=(null==l?void 0:l.maxCharsPerLine)||16,s.fee=(null==l?void 0:l.fee)||0,s.location=(null==l?void 0:l.location)||""}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+r);s.lines=(null==e?void 0:e.attributes.engraving.lines)||[],s.maxLines=(null==e?void 0:e.attributes.engraving.maxLines)||1,s.maxCharsPerLine=(null==e?void 0:e.attributes.engraving.maxCharsPerLine)||16,s.fee=(null==e?void 0:e.attributes.engraving.fee)||0,s.location=(null==e?void 0:e.attributes.engraving.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+r);s.lines=(null==e?void 0:e.attributes.engraving.lines)||[],s.maxLines=(null==e?void 0:e.attributes.engraving.maxLines)||1,s.maxCharsPerLine=(null==e?void 0:e.attributes.engraving.maxCharsPerLine)||16,s.fee=(null==e?void 0:e.attributes.engraving.fee)||0,s.location=(null==e?void 0:e.attributes.engraving.location)||""}return s}createEngravingContainer(e,o){const r=document.createElement("div");r.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const c=document.createElement("span");c.textContent=formatCentToDollarText(o,![]),r.appendChild(s),r.appendChild(c);const l=document.createElement("div");l.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const m of e){const e=document.createElement("span");e.className="engraving-line",e.textContent=m,d.appendChild(e)}const h=document.createElement("div");h.className="engraving-actions";const p=document.createElement("button");if(p.type="button",p.classList.add("remove-button"),p.textContent="Remove",p.addEventListener("click",async()=>{const e=this.params.identifier;"product"===this.params.context&&await this.commands.product.updateEngravingLines(e,[]),"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}),h.appendChild(p),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.addEventListener("click",this.openEngravingDrawer),h.appendChild(e)}return l.appendChild(d),l.appendChild(h),[r,l]}isEngravingAvailable(){var e,o,r;const s=this.params.identifier;if("product"===this.params.context){const c=this.getStoreValue("products."+s),l=c.sizes[c.selectedSizeId];return Boolean((null===(e=c.selectedFulfillment)||void 0===e?void 0:e.canEngrave)&&(null===(o=c.selectedFulfillment)||void 0===o?void 0:o.isVariantEngravable)&&(null===(r=l.attributes.engraving)||void 0===r?void 0:r.status))}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+s),o=this.getStoreValue("cart.fulfillments."+e.fulfillmentId),r=e.attributes.engraving.isEngravable,c=(null==o?void 0:o.canEngrave)||![];return Boolean(r&&c)}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+s);return Boolean(null==e?void 0:e.attributes.engraving.isEngravable)}return![]}engravingFee(){var e;const o=this.params.identifier;if("product"===this.params.context){const r=this.getStoreValue("products."+o),s=r.sizes[r.selectedSizeId];return(null===(e=s.attributes.engraving)||void 0===e?void 0:e.fee)||0}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+o);return(null==e?void 0:e.attributes.engraving.fee)||0}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+o);return(null==e?void 0:e.attributes.engraving.fee)||0}return 0}engravingLines(){const e=this.params.identifier;if("product"===this.params.context){const o=this.getStoreValue("products."+e);return o.engravingLines||[]}if("cart"===this.params.context){const o=this.getStoreValue("cart.items."+e);return(null==o?void 0:o.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const o=this.getStoreValue("checkout.items."+e);return(null==o?void 0:o.attributes.engraving.lines)||[]}return[]}template(){const e=this.isEngravingAvailable();if(!e)return this.removeHostClasses("has-header"),"";const o=this.engravingFee(),r=this.engravingLines();if(r&&r.length>0)return this.addHostClasses("has-header"),this.createEngravingContainer(r,o);if(this.removeHostClasses("has-header"),"checkout"===this.params.context)return"";const s=this.getConfigs("global"),c=document.createElement("button");return c.type="button",c.className="add-engraving-button",c.textContent=s.layout.personalizationText+" +"+formatCentToDollarText(o,![]),c.addEventListener("click",this.openEngravingDrawer),c}}function fulfillmentAddress(e,o){if(!e)return"";if(o===l.SHIPPING){const o=[e.city,e.state].filter(Boolean);return o.join(", ")}const r=[e.one,e.two,e.city,e.state].filter(Boolean);return r.join(", ")}const ft=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],gt=1440;function timeToMinutes(e){const o=e.match(/^(\d{1,2}):(\d{2})$/);if(!o)throw new Error("Invalid time format: "+e);const r=Number.parseInt(o[1],10),s=Number.parseInt(o[2],10);if(r<0||r>47||s<0||s>59)throw new Error("Invalid time values: "+e);return 60*r+s}function getCurrentTimeInTimezone(e){var o,r,s;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),h=(null===(o=d.find(e=>"weekday"===e.type))||void 0===o?void 0:o.value.toLowerCase())||"",p=(null===(r=d.find(e=>"hour"===e.type))||void 0===r?void 0:r.value)||"0",m=(null===(s=d.find(e=>"minute"===e.type))||void 0===s?void 0:s.value)||"0",g=60*Number.parseInt(p,10)+Number.parseInt(m,10);return{weekday:h,timeInMinutes:g}}catch(d){throw new Error("Invalid timezone: "+e)}}function format24TimeTo12(e){const o=e.match(/^(\d{1,2}):(\d{2})$/);if(!o||"object"==typeof o)return e;let r=Number.parseInt(o[1],10);const s=o[2];r>=24&&(r-=24);const c=r>=12?"PM":"AM",l=0===r?12:r>12?r-12:r;return l+":"+s+" "+c}function isWithinTimeSlot(e,o){try{const r=timeToMinutes(o.startsAt),s=timeToMinutes(o.endsAt);if(s>gt){if(e>=r||e<s-gt)return"during"}else if(s<r){if(e>=r||e<s)return"during"}else if(e>=r&&e<s)return"during";return e<r?"before":"after"}catch(r){return"after"}}function getNextOpeningTime(e,o,r=7){var s,c;const l=ft.indexOf(o);for(let h=1;h<=r;h++){const o=(l+h)%7,r=ft[o],p=e[r];if((null==p?void 0:p.active)&&p.times&&p.times.length>0)try{const e=1===h?"tomorrow":r;return"Opens "+e+" at "+format24TimeTo12(null!==(c=null===(s=null==p?void 0:p.times[0])||void 0===s?void 0:s.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 o;if(!(null==e?void 0:e.type)||(null==e?void 0:e.type)!==l.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(e))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:r,timeInMinutes:s}=getCurrentTimeInTimezone(e.timezone),c=e.hours[r];if(!(null==c?void 0:c.active)||!(null===(o=c.times)||void 0===o?void 0:o.length)){const o=getNextOpeningTime(e.hours,r);return{message:o,isOpen:![],isClosed:!![]}}for(const e of c.times){const o=isWithinTimeSlot(s,e);switch(o){case"before":return{message:"Opens at "+format24TimeTo12(e.startsAt),isOpen:![],isClosed:!![],openTime:e.startsAt,closeTime:e.endsAt};case"during":{let o=e.endsAt;const r=timeToMinutes(o);if(r>gt){const e=Math.floor(r/60)-24,s=r%60;o=e.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(o),isOpen:!![],isClosed:![],openTime:e.startsAt,closeTime:e.endsAt}}}}const l=getNextOpeningTime(e.hours,r);return{message:l,isOpen:![],isClosed:!![]}}catch(r){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:o,isSelected:r,fulfillmentStatus:s,selectedSizeAttributes:c}){var d,h,p,m,g;let v=0;const y=null==c?void 0:c.presale,b=(null==y?void 0:y.isActive)&&(null==y?void 0:y.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(y.estimatedShipBy):"",x=o===l.SHIPPING,w=o===l.ON_DEMAND;x&&(v=(null===(h=null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.individual)||void 0===h?void 0:h.fee)||0),w&&(v=(null===(p=null==e?void 0:e.fees)||void 0===p?void 0:p.fee)||0);const C=fulfillmentAddress(e.retailerAddress,o);let k=null;o===l.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(k=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const S=o===l.ON_DEMAND&&s&&s.isClosed?"closed":"",E=document.createElement("div");E.className="popup-retailer-card "+(r?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",e.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",r?"true":"false");const T=o===l.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",T+" from "+e.retailerName+", "+formatCentToDollarText(null!==(m=e.price)&&void 0!==m?m:0));const I=document.createElement("div");I.className="row";const P=document.createElement("span");P.className="name",P.textContent=e.retailerName,I.appendChild(P);const F=document.createElement("span");F.className="price",F.textContent=formatCentToDollarText(null!==(g=e.price)&&void 0!==g?g:0),I.appendChild(F),E.appendChild(I);const D=document.createElement("div");D.className="row";const A=document.createElement("span");A.className="expectation",A.textContent=s.isClosed?k:(null==y?void 0:y.isActive)?b:(null==e?void 0:e.expectation.detail)||"No expectation available",D.appendChild(A);const _=document.createElement("span");if(_.className="fee",_.textContent=v>0?formatCentToDollarText(v):"Free Delivery",D.appendChild(_),E.appendChild(D),w){const e=document.createElement("div");e.className="row";const o=document.createElement("span");o.className="address",o.textContent=C,e.appendChild(o),E.appendChild(e)}return E}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:o,shippingSelected:r,onDemandSelected:s,onTabClick:c,enableShippingFulfillment:d,enableOnDemandFulfillment:h}){const p=o.length>0,m=document.createElement("div");if(m.className="fulfillment-tabs-container",m.setAttribute("role","tablist"),m.setAttribute("aria-label","Delivery method options"),d){const o=document.createElement("div");o.className="fulfillment-tab "+(r?"selected":""),o.setAttribute("data-fulfillment-type",l.SHIPPING),o.setAttribute("role","tab"),o.setAttribute("tabindex","0"),o.setAttribute("aria-selected",r?"true":"false"),o.setAttribute("aria-label","Shipping, "+e.length+" options"),o.addEventListener("click",c),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(r?"selected":""),s.textContent="Shipping ("+e.length+")",o.appendChild(s),m.appendChild(o)}if(h){const e=document.createElement("div");e.className="fulfillment-tab "+(s?"selected":"")+" "+(p?"":"disabled"),e.setAttribute("data-fulfillment-type",l.ON_DEMAND),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",s?"true":"false"),e.setAttribute("aria-label","Same-day delivery, "+o.length+" options"),p||e.setAttribute("aria-disabled","true"),e.addEventListener("click",c),e.addEventListener("keydown",o=>{"Enter"!==o.key&&" "!==o.key||(o.preventDefault(),e.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(s?"selected":""),r.textContent="Same-Day Delivery ("+o.length+")",e.appendChild(r),m.appendChild(e)}return m}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","products.{productId}.engravingLines","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var e;const o=this.getProductId(),r=this.getStoreValue("products."+o);if(!r.selectedFulfillment||!r.selectedSizeId)return 0;const s=r.selectedFulfillment.partNumber,c=r.selectedFulfillment.fulfillmentId,l=null===(e=r.sizes[r.selectedSizeId].attributes)||void 0===e?void 0:e.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("cart.items")||{},h=Object.values(d).filter(e=>e.partNumber===s&&e.fulfillmentId===c),p=h.reduce((e,o)=>e+o.quantity,0);return l-p}isFulfillmentClosed(){const e=this.getProductId(),o=this.getStoreValue("products."+e);if(!o.selectedFulfillment)return![];const r=getRetailerOffHours(o.selectedFulfillment);return o.selectedFulfillmentType===l.ON_DEMAND&&r&&r.isClosed}isButtonLoading(){const e=this.getProductId();return this.getStoreValue("products."+e+".updating")}calculateQuantityLimits(){const{quantity:e}=this.calculateTotalPrice(),o=this.getAvailableQuantity(),r=e<o;return{currentQuantity:e,availableQuantity:o,canIncrease:r,canDecrease:e>1}}async handleAddToCart(){var e,o,r;const s=this.getProductId(),c=this.getStoreValue("products."+s);if(!c.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:s,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)===!![],h=this.isPresaleActive(l);d&&h?await this.commands.product.addPresaleToCart(s,{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,engravingLines:c.engravingLines,identifier:s}):await this.commands.product.addToCart(s,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(r=c.selectedFulfillment)||void 0===r?void 0:r.partNumber,quantity:c.quantity,engravingLines:c.engravingLines,identifier:s})}async handleQuantityChange(e){const o=this.getProductId();await this.commands.product.updateQuantity(o,e)}calculateTotalPrice(){var e,o;const r=this.getProductId(),s=this.getStoreValue("products."+r),c=s.sizes[s.selectedSizeId],l=s.selectedFulfillment,d=l.price*s.quantity,h=s.engravingLines.length>0,p=h&&(null===(o=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.engraving)||void 0===o?void 0:o.fee)||0;return{quantity:s.quantity,totalPrice:d+p}}createQuantityContainer(e){const o=this.calculateQuantityLimits(),r=document.createElement("div");return r.className="quantity-container "+e,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!o.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!o.canDecrease).toString()),o.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=o.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+o.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!o.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!o.canIncrease).toString()),o.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(1)}),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantityText),r.appendChild(this.qtyIncreaseButton),r}getSizeAttributes(){const e=this.getProductId(),o=this.getStoreValue("products."+e+".selectedSizeId"),r=this.getStoreValue("products."+e+".sizes."+o);return(null==r?void 0:r.attributes)||{}}isPresaleActive(e){const o=null==e?void 0:e.presale;if(!o)return![];if(!o.isActive)return![];if(o.canPurchaseOn){const e=new Date(o.canPurchaseOn),r=new Date;if(r.getTime()<e.getTime())return![]}return!![]}createAddToCartButton(){var e;const{totalPrice:o}=this.calculateTotalPrice(),r=this.getSizeAttributes(),s=this.calculateQuantityLimits(),c=(null===(e=null==r?void 0:r.presale)||void 0===e?void 0:e.isActive)===!![],l=this.isPresaleActive(r),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(o):d;const h=c&&!l||0===s.availableQuantity||this.isFulfillmentClosed(),p=this.isButtonLoading(),m=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(o):d;return this.addToCartButton.setAttribute("aria-label",m),this.addToCartButton.setAttribute("aria-busy",p.toString()),this.addToCartButton.setAttribute("aria-disabled",h.toString()),h&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),p&&(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(),o=this.getStoreValue("products."+e+".fulfillmentHasAvailability"),r=this.getConfigs("configurations");if(!o||!r.isElementsEnabled)return[];const s=[],c=this.config.layout.showQuantityCounter;if(c){const e=this.config.layout.quantityCounterStyle,o=this.createQuantityContainer(e);s.push(o)}const l=this.createAddToCartButton();return s.push(l),s}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const e=this.params.productId,o=this.getStoreValue("products."+e+".description"),r=this.getStoreValue("products."+e+".htmlDescription"),s="About this product:",c="See More",l="See Less",d=document.createElement("h3");d.className="title",d.textContent=s;const h=document.createElement("div");h.className="content collapsed",h.innerHTML=""===(null==r?void 0:r.trim())?o:sanitizeHTML(r);const p=document.createElement("span");return p.className="collapse-button",p.textContent=c,p.addEventListener("click",()=>{this.isCollapsed=!this.isCollapsed,h.classList.toggle("collapsed"),p.textContent=this.isCollapsed?c:l}),[d,h,p]}}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 o;const r=e.find(e=>e.path==="products."+this.getProductId()+".drawer");if(!r)return![];const s=r.value,c=s.isOpen,l=null===(o=s.contentConfig)||void 0===o?void 0:o.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){const o=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!e)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:o}),void 0;const{type:r,data:s}=e||{},c=ComponentFactoryService.createElement({type:r,...s});this.contentContainer&&this.contentContainer.appendChild(c),this.open()}catch(r){this.logger.error("Failed to open product drawer",r),this.commands.product.closeProductDrawer(o)}}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 o=this.params.productId,r=e.find(e=>e.path==="products."+o+".mainImage");if(null==r?void 0:r.value){const e=this.params.images.indexOf(null==r?void 0:r.value);-1!==e?this.selectImage(e):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+r.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 o=0;o<this.thumbnails.length;o++){const e=this.thumbnails[o];e.addEventListener("click",()=>{this.hasMoved||this.selectImage(o)})}const e=this.container.querySelectorAll(".carousel-dot");for(let o=0;o<e.length;o++){const r=e[o];r.addEventListener("click",()=>this.selectImage(o))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(e){var o,r;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===(o=this.thumbnails[this.currentImageIndex])||void 0===o||o.classList.remove("selected"),null===(r=this.thumbnails[e])||void 0===r||r.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let c=0;c<s.length;c++){const o=s[c];o.classList.toggle("active",c===e)}this.currentImageIndex=e,this.galleryViewport&&this.scrollToIndex(e)}scrollToIndex(e){if(!this.galleryViewport||!this.thumbnails[e])return;const o=this.thumbnails[e],r=this.galleryViewport.offsetWidth,s=o.offsetLeft+o.offsetWidth/2,c=r/2,l=c-s,d=0,h=-(this.galleryContainer.scrollWidth-r);this.translateX=Math.max(h,Math.min(d,l)),this.updateTransform(!![])}setupMainImageSwipe(){var e,o;let r=0,s=0;null===(e=this.mainImageElement)||void 0===e?void 0:e.addEventListener("touchstart",e=>{r=e.touches[0].clientX,s=e.touches[0].clientY},{passive:!![]}),null===(o=this.mainImageElement)||void 0===o||o.addEventListener("touchend",e=>{const o=e.changedTouches[0].clientX-r,c=e.changedTouches[0].clientY-s;Math.abs(o)>Math.abs(c)&&Math.abs(o)>50&&(o>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 o="touches"in e?e.touches[0].clientX:e.clientX,r=o-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,c=0,l=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,s)),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=[],o=this.params.images.length>1,r=document.createElement("div");if(r.className="main-image",r.title="Product main image",r.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",o){const e=document.createElement("div");e.className="carousel-dots";for(let o=0;o<this.params.images.length;o++){const r=document.createElement("button");r.type="button",r.className="carousel-dot "+(0===o?"active":""),r.setAttribute("data-index",o.toString()),e.appendChild(r)}r.appendChild(e)}this.mainImageElement=r,e.push(r);const s=document.createElement("div");s.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],o=document.createElement("div");o.className="gallery-image-wrapper "+(0===l?"selected":"");const r=document.createElement("img");r.src=e,r.className="gallery-image",r.alt="Product thumbnail "+(l+1),r.loading="lazy",o.appendChild(r),c.appendChild(o)}return s.appendChild(c),e.push(s),e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const e=this.getProductId(),o=this.container.querySelectorAll("[select-size]");for(const r of o){const s=r.textContent||"",c=r.classList.contains("selected");r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Select "+s),r.setAttribute("aria-pressed",c?"true":"false"),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r.click())}),r.addEventListener("click",async()=>{const s=r.dataset.sizeId;if(!s)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:e,buttonElement:r.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(e,s);for(const e of o)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");r.classList.add("selected"),r.setAttribute("aria-pressed","true")})}}renderProductSizes(e,o){const r=document.createElement("div");r.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",r.appendChild(s);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(o)){const o=document.createElement("span");o.setAttribute("data-size-id",l.id),o.setAttribute("select-size",""),o.className="size-button "+(l.id===e?"selected":"");const r=l.packDesc?" ("+l.packDesc+")":"";o.textContent=""+l.size+r,c.appendChild(o)}return r.appendChild(c),r}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(){const e=this.getProductId(),o=this.getStoreValue("products."+e),r=this.config.layout.showDescription,s=this.getConfigs("global"),l=[],d=document.createElement("div");d.className="price-personalization-container";const h=ComponentFactoryService.createElement({type:c.PRODUCT_PRICE,productId:e});if(d.appendChild(h),s.layout.enablePersonalization){const o=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:e,context:"product",watchStorePaths:["products.{identifier}.selectedSizeId","products.{identifier}.selectedFulfillmentType","products.{identifier}.selectedFulfillment","products.{identifier}.engravingLines"]});d.appendChild(o)}l.push(d);const p=this.renderProductSizes(o.selectedSizeId,o.sizes);if(l.push(p),!this.hasIndependentAddressComponent()){const o=ComponentFactoryService.createElement({type:c.ADDRESS_DISPLAY,productId:e});l.push(o)}const m=ComponentFactoryService.createElement({type:c.PRODUCT_RETAILERS,productId:e});l.push(m);const g=ComponentFactoryService.createElement({type:c.PRODUCT_ADD_TO_CART_SECTION,productId:e});if(l.push(g),r){const o=ComponentFactoryService.createElement({type:c.PRODUCT_DESCRIPTION,productId:e});l.push(o)}return l}}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 o=this.getProductId(),r=e.find(e=>e.path==="products."+o+".drawer.isOpen");if(r){const e=r.value===!![];e&&this.addHostClasses("hide-content"),e||this.removeHostClasses("hide-content")}}template(){const e=this.getProductId(),o=this.getStoreValue("address.formattedAddress");if(o)return ComponentFactoryService.createElement({type:c.PRODUCT_INTERACTIONS,productId:this.getProductId()});const r=document.createElement("button");return r.type="button",r.className="product-options-open-address-button",r.textContent=this.config.layout.buyNowButtonText,r.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,c.ADDRESS_INPUT,{productId:e})}),r}}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 o=this.getProductId(),r=this.getStoreValue("products."+o);let s=(null===(e=r.priceInfo)||void 0===e?void 0:e.avg)||0;return r.selectedFulfillment&&(s=r.selectedFulfillment.price),formatCentToDollarText(s)}}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(),o=this.getStoreValue("products."+e),r=this.getConfigs("product"),s=[],l=this.getConfigs("configurations");if(!o.productHasAvailability||!l.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",s.push(e),s}const d="carousel"===r.layout.fulfillmentDisplay?c.PRODUCT_RETAILERS_CAROUSEL:c.PRODUCT_RETAILERS_POPUP,h=ComponentFactoryService.createElement({type:d,productId:e});return s.push(h),s}}const vt="This product is currently unavailable to ship to your location.",yt="Same-day delivery is currently unavailable for your location.";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 o=this.getProductId(),r=e.find(e=>e.path==="products."+o+".selectedFulfillmentId");(null==r?void 0:r.value)&&this.updateSelectedCard(r.value)}updateSelectedCard(e){for(const r of this.retailerCards)r.classList.remove("selected"),r.setAttribute("aria-pressed","false");const o=this.retailerCards.findIndex(o=>o.dataset.fulfillmentId===e);-1!==o&&(this.retailerCards[o].classList.add("selected"),this.retailerCards[o].setAttribute("aria-pressed","true"),this.scrollToIndex(o))}scrollToIndex(e){if(!this.listViewport||!this.retailerCards[e])return;const o=this.retailerCards[e],r=this.listViewport.offsetWidth,s=o.offsetLeft+o.offsetWidth/2,c=r/2,l=c-s,d=0,h=-(this.listContainer.scrollWidth-r);this.translateX=Math.max(h,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 o="touches"in e?e.touches[0].clientX:e.clientX,r=o-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,c=0,l=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,s)),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 o=this.getProductId(),r=e.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:o,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(o,r)}async onRetailerCardClick(e){if(this.hasMoved)return;const o=this.getProductId(),r=e.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:o,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+o+".selectedFulfillment");if(s&&s.fulfillmentId===r)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:o,fulfillmentId:r}),void 0;await this.commands.product.selectFulfillment(o,r)}generateRetailerCard({fulfillment:e,selectedFulfillmentType:o,isSelected:r,fulfillmentStatus:s,selectedSizeAttributes:c}){var d,h,p,m,g;let v=0;const y=null==c?void 0:c.presale,b=(null==y?void 0:y.isActive)&&(null==y?void 0:y.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(y.estimatedShipBy):"",x=o===l.SHIPPING,w=o===l.ON_DEMAND;x&&(v=(null===(h=null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.individual)||void 0===h?void 0:h.fee)||0),w&&(v=(null===(p=null==e?void 0:e.fees)||void 0===p?void 0:p.fee)||0);const C=fulfillmentAddress(e.retailerAddress,o);let k=null;o===l.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(k=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const S=o===l.ON_DEMAND&&s&&s.isClosed?"closed":"",E=document.createElement("div");E.className="carousel-retailer-card "+(r?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",e.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",r?"true":"false");const T=o===l.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",T+" from "+e.retailerName+", "+formatCentToDollarText(null!==(m=e.price)&&void 0!==m?m:0));const I=document.createElement("div");I.className="retailer-header";const P=document.createElement("h3");if(P.className="name",P.textContent=e.retailerName,I.appendChild(P),w){const e=document.createElement("h3");e.className="address",e.textContent=C,I.appendChild(e)}const F=document.createElement("div");F.className="retailer-body";const D=document.createElement("span");D.className="product-price",D.textContent=formatCentToDollarText(null!==(g=e.price)&&void 0!==g?g:0);const A=document.createElement("span");A.className="shipping-price",A.textContent=v>0?"+ "+formatCentToDollarText(v):"FREE Delivery";const _=document.createElement("span");return _.className="expectation",_.textContent=s.isClosed?k:(null==y?void 0:y.isActive)?b:(null==e?void 0:e.expectation.detail)||"No expectation available",F.append(D,A,_),E.append(I,F),E}template(){const e=this.getProductId(),o=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+o.selectedSizeId),s=(null==r?void 0:r.attributes)||null,c=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,h=[];for(const l in r.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(r.shippingFulfillments,l)){const e=r.shippingFulfillments[l],o=getRetailerOffHours(e);if(o.isClosed&&!this.config.layout.showOffHours)continue;h.push(e)}const p=[];for(const l in r.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,l)){const e=r.onDemandFulfillments[l],o=getRetailerOffHours(e);if(o.isClosed&&!this.config.layout.showOffHours)continue;p.push(e)}const m=o.selectedFulfillmentType===l.SHIPPING,g=o.selectedFulfillmentType===l.ON_DEMAND,v=m?h:p,y=renderFulfillmentTabsContainer({shippingFulfillments:h,onDemandFulfillments:p,shippingSelected:m,onDemandSelected:g,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:c,enableOnDemandFulfillment:d});if(!o.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent=m?vt:yt,[y,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 b of v){const e=getRetailerOffHours(b),r=this.generateRetailerCard({fulfillment:b,selectedFulfillmentType:o.selectedFulfillmentType,isSelected:b.fulfillmentId===o.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:s}),c=o.selectedFulfillmentType===l.ON_DEMAND&&e&&e.isClosed;c?r.setAttribute("aria-disabled","true"):(r.addEventListener("click",this.onRetailerCardClick.bind(this)),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r.click())})),this.listContainer.appendChild(r)}return this.listViewport.appendChild(this.listContainer),[y,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(),o=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+o.selectedSizeId),s=(null==r?void 0:r.attributes)||null,d=this.config.layout.enableShippingFulfillment,h=this.config.layout.enableOnDemandFulfillment,p=Object.values(r.shippingFulfillments),m=Object.values(r.onDemandFulfillments),g=(d?p.length:0)+(h?m.length:0),v=document.createElement("div");v.className="header";const y=document.createElement("span");y.className="header-label",y.textContent=o.selectedFulfillmentType===l.SHIPPING?"Shipping From:":"Delivering From:";const b=document.createElement("button");if(b.className="delivery-options",b.type="button",b.textContent="See Delivery Options ("+g+")",b.setAttribute("aria-label","View all "+g+" delivery options"),b.addEventListener("click",async()=>{0!==g&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,c.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),v.appendChild(y),v.appendChild(b),!o.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=o.selectedFulfillmentType===l.SHIPPING?vt:yt,[v,e]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";const w=getRetailerOffHours(o.selectedFulfillment),C=renderPopupRetailerCard({fulfillment:o.selectedFulfillment,selectedFulfillmentType:o.selectedFulfillmentType,isSelected:![],fulfillmentStatus:w,selectedSizeAttributes:s});return x.appendChild(C),[v,x]}}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 o=this.getProductId(),r=e.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:o,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(o,r)}async onRetailerCardClick(e){const o=this.getProductId(),r=e.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:o,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const K=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(o),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+o+".selectedFulfillment");if(s&&s.fulfillmentId===r)return await K(),void 0;await this.commands.product.selectFulfillment(o,r),await K()}template(){const e=this.getProductId(),o=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+o.selectedSizeId),s=(null==r?void 0:r.attributes)||null,c=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,h=[];for(const l in r.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(r.shippingFulfillments,l)){const e=r.shippingFulfillments[l],o=getRetailerOffHours(e);if(o.isClosed&&!this.config.layout.showOffHours)continue;h.push(e)}const p=[];for(const l in r.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,l)){const e=r.onDemandFulfillments[l],o=getRetailerOffHours(e);if(o.isClosed&&!this.config.layout.showOffHours)continue;p.push(e)}const m=o.selectedFulfillmentType===l.SHIPPING,g=o.selectedFulfillmentType===l.ON_DEMAND,v=m?h:p,y=document.createElement("h5");y.className="popup-retailers-section-title",y.textContent="Delivery Options";const b=renderFulfillmentTabsContainer({shippingFulfillments:h,onDemandFulfillments:p,shippingSelected:m,onDemandSelected:g,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:c,enableOnDemandFulfillment:d});if(!o.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=m?vt:yt,[y,b,e]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";for(const l of v){const e=getRetailerOffHours(l),r=renderPopupRetailerCard({fulfillment:l,selectedFulfillmentType:o.selectedFulfillmentType,isSelected:l.fulfillmentId===o.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:s});r.addEventListener("click",this.onRetailerCardClick.bind(this)),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r.click())}),x.appendChild(r)}return[y,b,x]}}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,o;const r=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],s=null!==(o=this.params.showFirstEvent)&&void 0!==o?o:!![];if(r){const e=this.store.get(this.params.errorStorePath)||[],o=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return s?o.slice(0,1):o}const c=this.store.get(this.params.errorStorePath);return c?[{message:c,level:"error"}]:[]}createErrorElement(e){const o=document.createElement("div");o.classList.add("alert-container","alert-"+e.level);const r=document.createElement("span");r.classList.add("alert-icon"),r.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=e.message,o.appendChild(r),o.appendChild(s),o}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const o=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},o)}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 o=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];o?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(c.CART)});const o=document.createElement("span");if(o.className="lce-cart-button-icon",o.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",[o,e]}return[o]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const e=this.container.querySelector(".lce-cart-button-badge");if(!e)return;const o=this.getStoreValue("cart.totals.quantity")||0;e.textContent=o.toString(),e.style.visibility=o>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const o=this.getStoreValue("cart.totals.quantity")||0;e.textContent=o.toString(),e.style.visibility=o>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 o;const r=e.find(e=>"ui.drawer"===e.path);if(!r)return![];const s=r.value,c=s.isOpen,l=null===(o=s.contentConfig)||void 0===o?void 0:o.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!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:o,data:r}=e||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:o,...r}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:o}):componentError({message:"Elements is not enabled.",componentType:o}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,o):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(o),this.open()),this.addHostAttribute("data-target",o.toString().toLowerCase())}catch(o){this.logger.error("Drawer content loading failed",o),this.commands.ui.closeDrawer()}}animateContentSwap(e,o){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const r=this.contentContainer.firstElementChild;r.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{r.classList.add("fading")}),setTimeout(()=>{r.remove(),e.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(e),this.updateDrawerContentTypeClass(o),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 o=["drawer"];this.isOpen&&o.push("open"),o.push(e.toString().toLowerCase()),this.drawerElement.className=o.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 o=this.themeProvider.getConfigs("configurations");return null!==(e=null==o?void 0:o.isElementsEnabled)&&void 0!==e?e:![]}catch(o){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",o),!![]}}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.inputs=[],this.charCountElements=[]}get hostClasses(){return["engraving-form-container"]}afterRender(){this.initializeCharacterCounts()}async handleClick(e){const o=e.target;o.matches(".engraving-form-button-save")&&await this.handleSave(),o.matches(".engraving-form-button-cancel")&&await this.closeDrawer()}handleInput(e){const o=e.target;o.matches(".engraving-form-input")&&this.updateCharacterCount(o)}updateCharacterCount(e){const o=Number.parseInt(e.dataset.line||"0",10)-1,r=this.charCountElements[o];if(r){const o=e.value.length,s=this.params.maxCharsPerLine;r.textContent=o+"/"+s}}initializeCharacterCounts(){for(const e of this.inputs)this.updateCharacterCount(e)}async closeDrawer(){const{identifier:e,context:o}=this.params;"product"===o&&(this.clientConfig.isMobile()?this.commands.ui.closeDrawer():await this.commands.product.closeProductDrawer(e)),"cart"===o&&this.commands.ui.openDrawer(c.CART),"checkout"===o&&this.commands.ui.closeDrawer()}collectEngravingLines(){return this.inputs.map(e=>e.value.toString().trim().toUpperCase()).filter(e=>e.length>0)}async handleSave(){const{identifier:e,context:o}=this.params,r=this.collectEngravingLines();if(0===r.length)return await this.closeDrawer(),void 0;"product"===o&&await this.commands.product.updateEngravingLines(e,r),"cart"===o&&await this.commands.cart.updateItemEngraving(e,r),"checkout"===o&&await this.commands.cart.updateItemEngraving(e,r),await this.closeDrawer()}template(){var e;const{maxLines:o,lines:r,location:s,maxCharsPerLine:c}=this.params;this.inputs=[],this.charCountElements=[];const l=Array.from({length:o},(e,o)=>{const s=r[o]||"",l=document.createElement("div");l.className="engraving-form-input-container",l.setAttribute("data-line-container","");const d=document.createElement("input");d.type="text",d.id="engraving-line-"+(o+1),d.dataset.line=(o+1).toString(),d.maxLength=c,d.value=s,d.placeholder="Line "+(o+1),d.className="engraving-form-input",d.autocomplete="off",this.inputs.push(d);const h=document.createElement("span");return h.className="engraving-form-input-char-count",h.textContent=s.length+"/"+c,this.charCountElements.push(h),l.appendChild(d),l.appendChild(h),l}),d=document.createElement("div");d.className="engraving-form-header";const h=document.createElement("p");if(h.className="engraving-form-title",h.textContent="Personalize with a message",d.appendChild(h),s&&(null===(e=null==s?void 0:s.trim())||void 0===e?void 0:e.length)>0){const e=document.createElement("p");e.className="engraving-form-location",e.textContent="Engraving will appear "+s.toLowerCase(),d.appendChild(e)}const p=document.createElement("div");p.className="engraving-form-lines";for(const b of l)p.appendChild(b);const m=document.createElement("div");m.className="engraving-form-actions";const g=document.createElement("button");g.type="button",g.className="engraving-form-button-cancel",g.textContent="Cancel",m.appendChild(g);const v=document.createElement("button");v.type="button",v.className="engraving-form-button-save",v.textContent="Save",m.appendChild(v);const y=document.createElement("p");return y.className="engraving-form-disclaimer",y.innerHTML="\n Personalized orders require up to 10 business days to be processed and then shipped.\n Tracking information will be provided once processed.\n <span>Personalized bottle orders cannot be canceled.</span>\n ",this.container.addEventListener("click",this.handleClick.bind(this)),this.container.addEventListener("input",this.handleInput.bind(this)),[d,p,m,y]}}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 o=e.find(e=>"checkout.focusField"===e.path);o&&o.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 o=e.target;let r=o.value.replace(/\D/g,"");if(r.length>2&&(r=r.substring(0,2)),1===r.length&&Number.parseInt(r,10)>1)r="0"+r;else if(2===r.length){const e=Number.parseInt(r,10);e>12?r="12":e<1&&(r="01")}o.value=r}formatDay(e){const o=e.target;let r=o.value.replace(/\D/g,"");if(r.length>2&&(r=r.substring(0,2)),1===r.length&&Number.parseInt(r,10)>3)r="0"+r;else if(2===r.length){const e=Number.parseInt(r,10);e>31?r="31":e<1&&(r="01")}o.value=r}formatYear(e){const o=e.target;let r=o.value.replace(/\D/g,"");r.length>4&&(r=r.substring(0,4)),o.value=r}handleNavigation(e,o){const r=e.target,s=r===this.yearInput?4:2;r.value.length===s&&o&&o.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"),o=this.dayInput.value.padStart(2,"0"),r=this.yearInput.value;return e&&o&&r&&4===r.length?r+"-"+e+"-"+o:""}validateDate(e,o,r){if(!e||!o||!r||4!==r.length)return![];const s=Number.parseInt(e,10),c=Number.parseInt(o,10),l=Number.parseInt(r,10);if(s<1||s>12||c<1||c>31||l<1e3)return![];const d=new Date(l,s-1,c);return d.getFullYear()===l&&d.getMonth()===s-1&&d.getDate()===c}calculateAge(e){const o=new Date;let r=o.getFullYear()-e.getFullYear();const s=o.getMonth()-e.getMonth();return(s<0||0===s&&o.getDate()<e.getDate())&&r--,r}validateInput(){const e=this.monthInput.value,o=this.dayInput.value,r=this.yearInput.value,s=[],c=this.params.validation;if(!c)return this.showErrors([]),!![];if(c.required&&(e&&o&&r||s.push("Please enter a complete date")),e||o||r)if(e&&o&&r&&4===r.length)if(this.validateDate(e,o,r)){const l=Number.parseInt(e,10),d=Number.parseInt(o,10),h=Number.parseInt(r,10),p=new Date(h,l-1,d);if(void 0!==c.minYear&&h<c.minYear&&s.push("Year must be "+c.minYear+" or later"),void 0!==c.maxYear&&h>c.maxYear&&s.push("Year must be "+c.maxYear+" or earlier"),void 0!==c.minAge||void 0!==c.maxAge){const e=this.calculateAge(p);void 0!==c.minAge&&e<c.minAge&&s.push("Must be at least "+c.minAge+" years old"),void 0!==c.maxAge&&e>c.maxAge&&s.push("Must be no more than "+c.maxAge+" years old")}if(c.customValidator){const e=c.customValidator(this.getFormattedValue());e&&s.push(e)}}else s.push("Please enter a valid date");else s.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(s);const l=0===s.length;return this.params.onValidation&&this.params.onValidation(l,s),l}showErrors(e){this.errorContainer.innerHTML="";const o=[this.monthInput,this.dayInput,this.yearInput];if(e.length>0){this.errorContainer.classList.add("show");for(const e of o)e.classList.add("input-error");for(const o of e){const e=document.createElement("div");e.className="error-message",e.textContent=o,this.errorContainer.appendChild(e)}}else for(const r of o)r.classList.remove("input-error")}clearErrors(){const e=[this.monthInput,this.dayInput,this.yearInput],o=e.some(e=>e.classList.contains("input-error"));if(o){for(const o of e)o.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(e){if(e){const o=e.split("/");3===o.length&&(this.monthInput.value=o[0],this.dayInput.value=o[1],this.yearInput.value=o[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 o=[];if(this.params.label){const r=document.createElement("label");r.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(r.textContent+="*"),r.setAttribute("for",this.params.name+"-month"),o.push(r)}const r=document.createElement("div");r.className="date-input-container";const s=document.createElement("input");s.type="text",s.placeholder="MM",s.name=this.params.name+"-month",s.id=this.params.name+"-month",s.maxLength=2,s.className="date-field month-field",s.setAttribute("data-field","month"),s.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 h=document.createElement("input");h.type="text",h.placeholder="YYYY",h.name=this.params.name+"-year",h.id=this.params.name+"-year",h.maxLength=4,h.className="date-field year-field",h.setAttribute("data-field","year"),h.inputMode="numeric",this.params.disabled&&(s.disabled=!![],l.disabled=!![],h.disabled=!![]),this.params.className&&(r.className+=" "+this.params.className),r.appendChild(s),r.appendChild(c),r.appendChild(l),r.appendChild(d),r.appendChild(h);const p=document.createElement("div");return p.className="error-container",o.push(r),o.push(p),o}}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 o=e.find(e=>"checkout.focusField"===e.path);return o&&o.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(e){if("Backspace"===e.key){const o=e.target,r=o.selectionStart||0,s=o.value;r>0&&/\D/.test(s[r-1])&&setTimeout(()=>{const e=Math.max(0,r-2);o.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const o=e.target;let r=o.value.replace(/\D/g,"");r.length>10&&(r=r.substring(0,10)),r.length>=6?r="("+r.substring(0,3)+") "+r.substring(3,6)+"-"+r.substring(6):r.length>=3&&(r="("+r.substring(0,3)+") "+r.substring(3)),o.value=r}formatDate(e){const o=e.target;let r=o.value.replace(/\D/g,"");r.length>8&&(r=r.substring(0,8)),r.length>=5?r=r.substring(0,2)+"/"+r.substring(2,4)+"/"+r.substring(4):r.length>=3&&(r=r.substring(0,2)+"/"+r.substring(2)),o.value=r}validateEmail(e){const o=/^[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 o.test(e)}validateTel(e){const o=/^\(\d{3}\) \d{3}-\d{4}$/;return o.test(e)}validateDate(e){const o=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!o.test(e))return![];const[r,s,c]=e.split("/").map(Number),l=new Date(c,r-1,s);return l.getFullYear()===c&&l.getMonth()===r-1&&l.getDate()===s}validateInput(){const e=this.inputElement.value,o=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];if(r.required&&!e.trim()&&o.push("This field is required"),e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||o.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||o.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(e)||o.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const s=Number.parseFloat(e);Number.isNaN(s)?e.trim()&&o.push("Please enter a valid number"):(void 0!==r.min&&s<r.min&&o.push("Value must be at least "+r.min),void 0!==r.max&&s>r.max&&o.push("Value must be no more than "+r.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==r.min&&e.length<r.min&&o.push("Must be at least "+r.min+" characters"),void 0!==r.max&&e.length>r.max&&o.push("Must be no more than "+r.max+" characters")),r.pattern){const s=new RegExp(r.pattern);s.test(e)||o.push("Invalid format")}if(r.customValidator){const s=r.customValidator(e);s&&o.push(s)}}this.showErrors(o);const s=0===o.length;return this.params.onValidation&&this.params.onValidation(s,o),s}showErrors(e){if(this.errorContainer.innerHTML="",e.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const o of e){const e=document.createElement("div");e.className="error-message",e.textContent=o,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 o=[];if(this.params.label){const r=document.createElement("label");r.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(r.textContent+="*"),r.setAttribute("for",this.params.name),o.push(r)}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&&"number"===this.params.inputType&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&"number"===this.params.inputType&&(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",o.push(this.inputElement),o.push(this.errorContainer),o}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.q=this.attachShadow({mode:"closed"})}initialize(e,o){if(this.A)return;if(!e||"string"!=typeof e)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(o&&o instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.q)throw new Error("LceElementComponent: Shadow DOM container is not available");this.q.appendChild(o),this.applyBasicStyles();const r=ThemeProviderService.getInstance(),s=r.getStylesheet(e);this.applyThemeStyles(s),this.A=!![],this.q=null}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 o=new CSSStyleSheet;o.replaceSync(e),this.q.adoptedStyleSheets=[o,...this.q.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(L){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.q.adoptedStyleSheets=[...this.q.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const o=document.createElement("style");o.textContent=e,this.q&&this.q.appendChild(o)}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:o,showDescription:r,showQuantityCounter:s,fulfillmentDisplay:c,showImages:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const h=document.createElement("div");if(h.classList.add("skeleton-container"),o){const e=document.createElement("div");e.classList.add("wave","sc-title"),h.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),h.appendChild(e),h}const p=document.createElement("div");p.classList.add("wave","sc-price"),h.appendChild(p);const m=document.createElement("div");m.classList.add("sc-sizes");const g=document.createElement("div");g.classList.add("wave","sc-size-button"),m.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),m.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),m.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),m.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),m.appendChild(x),h.appendChild(m);const w=document.createElement("div");w.classList.add("sc-row");const C=document.createElement("div");C.classList.add("wave","sc-price"),w.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-personalization"),w.appendChild(k),h.appendChild(w);const S=document.createElement("div");S.classList.add("wave","sc-deliver-to"),h.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-address"),h.appendChild(E);const T=document.createElement("div");T.classList.add("wave","sc-retailers",c),h.appendChild(T);const I=document.createElement("div");if(I.classList.add("sc-row"),s){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),I.appendChild(e)}const P=document.createElement("div");if(P.classList.add("wave","sc-add-to-cart"),I.appendChild(P),h.appendChild(I),r){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),h.appendChild(e);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),h.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),h.appendChild(r);const s=document.createElement("div");s.classList.add("wave","sc-description-line"),h.appendChild(s);const c=document.createElement("div");c.classList.add("wave","sc-description-more"),h.appendChild(c)}const F=document.createElement("div");if(F.classList.add("product-content"),F.appendChild(h),d.appendChild(F),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 o=document.createElement("div");o.classList.add("wave","sc-main-image"),o.title="Product main image loading";const r=document.createElement("div");r.classList.add("carousel-dots");for(let l=0;l<3;l++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),r.appendChild(e)}o.appendChild(r),e.appendChild(o);const s=document.createElement("div");s.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 o=document.createElement("div");o.classList.add("wave","sc-gallery-thumbnail"),e.appendChild(o),c.appendChild(e)}return s.appendChild(c),e.appendChild(s),e}}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 o=document.createElement("span");o.className="pb-text",o.textContent="Powered by",e.appendChild(o);const r=document.createElement("span");r.className="pb-lc",r.textContent="LiquidCommerce",e.appendChild(r);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",e.appendChild(s),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const o=this.getDisclaimerConfig();return o.parts.forEach(o=>{"text"===o.type?e.appendChild(document.createTextNode(o.content)):"link"===o.type&&e.appendChild(this.createLink(o.href,o.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,o){const r=document.createElement("a");return r.href=e,r.target="_blank",r.rel="noopener noreferrer",r.className="pb-link",r.textContent=o,r}template(){const e=this.createPoweredBySection(),o=this.createDisclaimerSection();return[e,o]}}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 o=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!o||!this.applyButton||!this.currentActiveTicker)return;const r=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);r&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!r&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const o=this.store.get("cart.promoCode"),r=this.store.get("checkout.promoCode");return(null==o?void 0:o.code)===e||(null==r?void 0:r.code)===e}getActiveTickers(){var e;const o=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var r;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(r=null==o?void 0:o.address)||void 0===r?void 0:r.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const o=document.createElement("div");o.classList.add("promo-ticker__text-group");const r=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const s of r){const r=s.trim();if(!r)continue;const c=document.createElement("span");c.classList.add("promo-ticker__text-item"),c.textContent=r,o.appendChild(c);const l=document.createElement("span");l.classList.add("promo-ticker__separator"),l.textContent=e.separator,o.appendChild(l)}return o}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 o=document.createElement("div");o.classList.add("promo-ticker__content");const r=document.createElement("div");r.classList.add("promo-ticker__track");for(let c=0;c<5;c++)r.appendChild(this.generateTextContent(this.currentActiveTicker));o.appendChild(r);const s=document.createElement("button");return s.type="button",s.classList.add("promo-ticker__cta"),s.textContent="APPLY",this.promoCodeApplied&&(s.disabled=!![],s.textContent="APPLIED"),s.addEventListener("click",()=>this.handlePromoClick()),this.applyButton=s,[o,s]}}const bt=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,o){if(!e||!o)return e;const r={...e},s=[];for(const c in o){const l=o[c],d=r[c];if(!(c in e)){s.push('Property "'+c+'" does not exist in target schema, skipping merge.');continue}const h=getType(l),p=getType(d);h===p?isObject(l)&&isObject(d)?r[c]=deepMergeConfigs(d,l):r[c]=l:s.push('Type mismatch for key "'+c+'": source is '+h+", target is "+p+". Skipping merge.")}return s.length>0&&bt.warn("Merging configurations with warnings:",s),r}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(),o=this.getStoreValue("cart.fulfillments."+e+".items")||{};return Object.values(o).find(o=>o.fulfillmentId===e)}handleItemsUpdate(e,o){const r=new Set(e||[]),s=new Set(o||[]);for(const c of r)if(!s.has(c)){const e=this.container.querySelector('[data-item-id="'+c+'"]');e&&e.remove()}for(const l of s)if(!r.has(l)){const e=ComponentFactoryService.createElement({type:c.CART_ITEM,itemId:l});e.setAttribute("data-item-id",l),this.container.appendChild(e)}}setupItemElements(){const e=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+e+".items")||[],r=this.container.querySelectorAll("[data-item-id]");for(const s of r)s.remove();for(const s of o){const e=ComponentFactoryService.createElement({type:c.CART_ITEM,itemId:s});e.setAttribute("data-item-id",s),this.container.appendChild(e)}}setupMinimumPurchaseAlert(){var e;const o=this.getFulfillmentId(),r=(null===(e=this.getProductStore())||void 0===e?void 0:e.pack)||![],s=this.getStoreValue("cart.fulfillments."+o),l=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(s,r)){const e=getMinimumPurchaseMessage(s,r),o=ComponentFactoryService.createElement({type:c.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});o.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(o)}}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","fulfillment-loading-overlay");const o=document.createElement("div");o.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.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 ',o.appendChild(r),e.appendChild(o),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 o=this.getFulfillmentId(),r=this.getStoreValue("cart.fulfillments."+o);return(null===(e=null==r?void 0:r.items)||void 0===e?void 0:e.length)?r.items.some(e=>{const o=this.getStoreValue("cart.items."+e);return(null==o?void 0:o.updating)===!![]}):![]}checkAndUpdateLoadingState(){const e=this.isAnyItemUpdating(),o=this.hasLoadingOverlay();e&&!o?this.showLoadingOverlay():!e&&o&&this.hideLoadingOverlay()}onStoreChanged(e){const o=this.getFulfillmentId(),r="cart.fulfillments."+o,s=e.find(e=>e.path===r),c=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(c.length>0&&this.checkAndUpdateLoadingState(),s){const e=s.oldValue,o=s.value,r=(null==e?void 0:e.items)||[],c=(null==o?void 0:o.items)||[],l=JSON.stringify(r)!==JSON.stringify(c);l&&(this.handleItemsUpdate(r,c),this.checkAndUpdateLoadingState());const d=this.hasFulfillmentFeesChanged(e,o),h=this.hasFulfillmentDataChanged(e,o,["items","updating"]);if(d&&!h&&this.setupMinimumPurchaseAlert(),!h)return![]}return![]}hasFulfillmentFeesChanged(e,o){return e?e.subtotal!==o.subtotal||e.shippingFee!==o.shippingFee||e.deliveryFee!==o.deliveryFee||JSON.stringify(e.fees)!==JSON.stringify(o.fees):!![]}hasFulfillmentDataChanged(e,o,r=[]){if(!e)return!![];const s=["type","canEngrave","retailerId"];for(const c of s)if(!r.includes(c)&&e[c]!==o[c])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async e=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!e)throw new Error("Global theme configuration is required");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()),this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(o){throw this.logger.error("❌ Failed to update global theme configuration",o),new Error("Global theme update failed")}},updateProductComponent:async e=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!e)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(e),e.layout&&Object.keys(e.layout).length>0&&await this.commands.product.rerenderAllProducts(),this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(o){throw this.logger.error("❌ Failed to update product component theme",o),new Error("Product theme update failed")}},updateCartComponent:e=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!e)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.cart.rerenderCart(),this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(o){throw this.logger.error("❌ Failed to update cart component theme",o),new Error("Cart theme update failed")}},updateCheckoutComponent:e=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!e)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.checkout.rerenderCheckout(),this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(o){throw this.logger.error("❌ Failed to update checkout component theme",o),new Error("Checkout theme update failed")}},updateAddressComponent:e=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!e)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(e),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(o){throw this.logger.error("❌ Failed to update address component theme",o),new Error("Address theme update failed")}},injectElement:async e=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(e)},injectProductElement:async e=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(e)},injectAddressElement:async(e,o)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:c.ADDRESS,containerId:e,options:o})},injectCartElement:async e=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:c.CART,containerId:e})},injectCheckoutElement:async e=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:c.CHECKOUT,containerId:e})}},this.ui={cartButton:(e,o)=>{var r;this.ensureCartDrawerExists();const s=document.getElementById(null!==(r=null==e?void 0:e.replace("#",""))&&void 0!==r?r:"");if(!s)throw new Error("Container with ID '"+e+"' not found");const l=ComponentFactoryService.createElement({type:c.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:o});s.innerHTML="",safeReplaceChildren(s,l)},floatingCartButton:e=>{this.ensureCartDrawerExists();const o=ComponentFactoryService.createElement({type:c.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(o)},cartSubtotal:e=>{var o;const r=document.getElementById(null!==(o=null==e?void 0:e.replace("#",""))&&void 0!==o?o:"");if(!r)throw new Error("Element with ID '"+e+"' not found");r.innerHTML="";const s=this.store.get("cart.totals.subtotal")||0;r.textContent=formatCentToDollarText(s),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.subtotal")||0;r.textContent=formatCentToDollarText(e)})},cartItemsCount:e=>{var o;const r=document.getElementById(null!==(o=null==e?void 0:e.replace("#",""))&&void 0!==o?o:"");if(!r)throw new Error("Element with ID '"+e+"' not found");r.innerHTML="";const s=this.store.get("cart.totals.quantity")||0;r.textContent=s.toString(),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.quantity")||0;r.textContent=e.toString()})}},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",L.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 Error("Authentication failed");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 o=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.logger.debug("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(o.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",s);const c=s?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:s,persistedStore:c}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme");o=deepMergeConfigs(o,e)}await this.themeProvider.initialize(o),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(o){this.logger.error("GTM initialization failed",o)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(r){this.logger.error("Cart pre-loading failed",r)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(e){if(this.isElementsEnabled())await this.processInjectProduct(e);else for(const o of e)this.injectDisabledElementsError(o.containerId,c.PRODUCT)}async injectAddressElement(e,o){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,c.ADDRESS),void 0;await this.processInjectElement({type:c.ADDRESS,containerId:e,options:o})}async injectCartElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,c.CART),void 0;await this.processInjectElement({type:c.CART,containerId:e})}async injectCheckoutElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,c.CHECKOUT),void 0;await this.processInjectElement({type:c.CHECKOUT,containerId:e})}get actions(){return this.clientAction.actions}async processInjectProduct(e){var o,r;if(this.ensureAllComponentsRegistered(),0===e.length)throw new Error("At least one product must be provided");e.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const s=e.slice(0,20),l=[];for(const c of s){const e=null===(r=null===(o=c.containerId)||void 0===o?void 0:o.replace("#",""))||void 0===r?void 0:r.trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+c.identifier+"'");continue}const s=document.getElementById(e);if(!s){this.logger.warn("Container with ID '"+e+"' not found for product '"+c.identifier+"'");continue}const d=l.every(o=>o.containerId!==e);if(!d){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!c.identifier){this.logger.warn("Product identifier is required for container ID '"+e+"'");continue}const h=l.every(e=>e.identifier!==c.identifier);h?l.push({containerId:e,identifier:c.identifier}):this.logger.warn("Duplicate product identifier '"+c.identifier+"' found, skipping")}for(const d of l){const e=ComponentFactoryService.createElement({type:c.PRODUCT,useShadowDom:!![],productId:d.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),o=document.getElementById(d.containerId);o?(o.innerHTML="",safeReplaceChildren(o,e),await this.commands.product.createProductInstance(d.identifier,!![])):this.logger.warn("Product ("+d.identifier+") container with ID '"+d.containerId+"' not found")}await this.commands.product.loadMultipleProducts(l.map(e=>e.identifier))}async processInjectElement(e){this.ensureAllComponentsRegistered();const{type:o,containerId:r,...s}=e;if(!r)throw new Error("Container ID is required");if(!o)throw new Error("Component type is required");const l=e.containerId.replace("#",""),d=document.getElementById(l);if(!d)return console.warn("Container with ID '"+l+"' not found"),void 0;d.innerHTML="";const h={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...s},p=ComponentFactoryService.createElement(h);safeReplaceChildren(d,p),e.type===c.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:c.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=!![])}isElementsEnabled(){var e;try{const o=this.themeProvider.getConfigs("configurations");return null!==(e=null==o?void 0:o.isElementsEnabled)&&void 0!==e?e:![]}catch(o){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",o),!![]}}injectDisabledElementsError(e,o){const r=document.getElementById(e.replace("#",""));if(!r)return this.logger.warn("Container with ID '"+e+"' not found for disabled elements error"),void 0;let s;s=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:o}):componentError({message:"Elements is not enabled.",componentType:o}),r.innerHTML="",safeReplaceChildren(r,s)}registerEssentialComponents(){ComponentFactoryService.registerComponent(c.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(c.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(c.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(c.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(c.CART,AddressInputComponent),ComponentFactoryService.registerComponent(c.ADDRESS_INPUT,AddressInputComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(c.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(c.INPUT,InputComponent),ComponentFactoryService.registerComponent(c.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(c.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(c.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(c.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(c.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(c.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(c.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(c.ALERT,AlertComponent),ComponentFactoryService.registerComponent(c.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(c.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(c.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(c.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(c.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(c.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(c.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(c.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(c.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(c.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(c.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(c.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(c.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(c.CART,CartComponent),ComponentFactoryService.registerComponent(c.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(c.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(c.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(c.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(c.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(c.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(c.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(c.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(c.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(c.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(e){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+e+") is only available in builder mode"),![])}}async function Elements(e,o){try{const s=ClientConfigService.getInstance();s.initialize(e,{env:o.env,isBuilder:o.isBuilder,debugMode:o.debugMode,customTheme:o.customTheme,proxy:o.proxy,promoTicker:o.promoTicker});const c=s.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new Error("Failed to initialize properly");const d={builder:l.builder,injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),ui:l.ui,actions:l.actions};window.elements=d;const h=PubSubService.getInstance();return h.publishAction(r.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:s.get("version")}),d}catch(s){try{const e=LoggerFactory.get("ElementsClientInit");e.error("Elements Client Initialization failed",s)}catch(c){console.error("[LiquidCommerce Elements] Client initialization failed:",null==s?void 0:s.message)}try{const e=ClientConfigService.getInstance(),o=PubSubService.getInstance();o.publishAction(r.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==s?void 0:s.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 o=[];try{const s=e.getAttributeNames().filter(e=>"data-product"===e.substring(0,12));for(const c of s)try{const r=c.match(/^data-product(-(.+))?$/),s=(null==r?void 0:r[2])?"-"+r[2]:"",l="data-container"+s;e.hasAttribute(l)&&o.push({containerId:e.getAttribute(l),identifier:e.getAttribute(c)})}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return o}function pairsFromProductsScript(){const e=[];try{const r=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const s of r)try{const o=JSON.parse(s.textContent||"[]");if(!Array.isArray(o))continue;for(const r of o)r.containerId&&r.identifier&&e.push({containerId:r.containerId,identifier:r.identifier})}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",o)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",r)}return e}function pairsFromAttributedElements(){const e=[];try{const r=document.querySelectorAll("div[data-lce-product]");for(const s of r)try{const o="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));s.setAttribute("id",o);const r=s.getAttribute("data-lce-product");o&&r&&e.push({containerId:o,identifier:r})}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",o)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",r)}return e}function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}async function addProductToCartViaQueryParam(e,o){const r=o.getAttribute("data-product-param"),s=o.getAttribute("data-product-fulfillment-type-param");if(!r)return;if(!startsWithLcePrefix(r))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+r+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),d=c.get(r);if(!d)return;let h=l.SHIPPING;if(s)if(startsWithLcePrefix(s)){const e=c.get(s);e!==l.ON_DEMAND&&e!==l.SHIPPING||(h=e)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+s+'" because it does not start with "lce_" prefix.');try{await e.actions.cart.addProduct([{identifier:d,fulfillmentType:h,quantity:1}],!![])}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",p)}}async function addPromoCodeToCartViaQueryParam(e,o){const r=o.getAttribute("data-promo-code-param");if(!r)return;if(!startsWithLcePrefix(r))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+r+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),c=s.get(r);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 ElementsAutoInitialize(){var e,r,s,c,l,h;try{const h=document.querySelector("script[data-liquid-commerce-elements]");if(!h)return;const y=h.getAttribute("data-token"),b=h.getAttribute("data-env")||o.PRODUCTION,x=h.getAttribute("data-debug-mode");if(!y)throw new Error("Missing API Key (data-token attribute).");const w=h.getAttribute("data-cart-id"),C=h.hasAttribute("data-show-cart-items"),k=h.hasAttribute("data-hide-cart-floating-button"),S=h.getAttribute("data-promo-code"),E=h.getAttribute("data-promo-text"),T=null!==(e=h.getAttribute("data-promo-separator"))&&void 0!==e?e:"•",I=null!==(r=h.getAttribute("data-promo-active-from"))&&void 0!==r?r:void 0,P=null!==(s=h.getAttribute("data-promo-active-until"))&&void 0!==s?s:void 0,F=pairsFromMainScript(h),D=pairsFromProductsScript(),A=pairsFromAttributedElements(),_=[...F,...D,...A],O=S&&E&&I&&P?{promoCode:S,text:E.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:T,activeFrom:null===(c=new Date(I))||void 0===c?void 0:c.toISOString(),activeUntil:null===(l=new Date(P))||void 0===l?void 0:l.toISOString()}:void 0;let z=d.NONE;x&&b!==o.PRODUCTION&&(z=x);const N=await Elements(y,{env:b,debugMode:z,promoTicker:O?[O]:void 0});if(!N)throw new Error("Failed to initialize client.");if(0!==_.length)try{await N.injectProductElement(_)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",p)}try{const e=w&&document.getElementById(w.replace("#",""));e?N.ui.cartButton(w,C):k||(N.ui.floatingCartButton(C),w&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+w+'" not found. Falling back to floating cart button.'))}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",m)}try{await addProductToCartViaQueryParam(N,h)}catch(g){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",g)}try{await addPromoCodeToCartViaQueryParam(N,h)}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!==(h=null==y?void 0:y.message)&&void 0!==h?h:String(y))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",L)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",L)}},50)}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",L)}}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=(o,r,s,c,l)=>{var d,h;const p=(null==r?void 0:r.includes("elements"))||(null==r?void 0:r.includes("liquidcommerce"))||(null===(d=null==l?void 0:l.stack)||void 0===d?void 0:d.includes("LiquidCommerce"))||(null===(h=null==l?void 0:l.stack)||void 0===h?void 0:h.includes("elements-sdk"));return p?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:o,source:r,lineno:s,colno:c,error:l}),!![]):e?e(o,r,s,c,l):![]};const o=window.onunhandledrejection;window.onunhandledrejection=e=>{var r,s,c,l,d,h;const p=(null===(s=null===(r=e.reason)||void 0===r?void 0:r.stack)||void 0===s?void 0:s.includes("LiquidCommerce"))||(null===(l=null===(c=e.reason)||void 0===c?void 0:c.stack)||void 0===l?void 0:l.includes("elements-sdk"))||(null===(h=null===(d=e.reason)||void 0===d?void 0:d.message)||void 0===h?void 0:h.includes("LiquidCommerce"));if(p)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",e.reason),e.preventDefault(),void 0;o&&o.call(window,e)};try{initializeDOMPolyfills()}catch(xt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",xt)}try{triggerElementsAutoInit()}catch(wt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",wt)}}catch(Ct){console.error("[LiquidCommerce Elements] SDK initialization failed:",Ct)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
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(R){console.warn("DOM polyfills initialization failed:",R)}}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 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 Error("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 Error("LiquidCommerce Elements: Client constructor is not set.");const a=new SingletonManager.clientConstructor(e);return await a.prepare(),r.set(o,a),a}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;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,a=!o&&i?i:void 0;if(this.sendToTelemetry("error",e,r,a),!this.enableLogging)return;const[c,...l]=this.getPrefix("error");void 0!==i?console.error(c,...l,e,i):console.error(c,...l,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(a){}}}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)}}var e;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(e){e.CLOSED="CLOSED",e.OPEN="OPEN",e.HALF_OPEN="HALF_OPEN"}(e||(e={}));class CircuitBreakerService{constructor(i){this.state=e.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.config={failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:1e4,countClientErrorsAsFailures:![],...i},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(e){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(e))}async execute(i,o,r){switch(this.totalCalls++,this.state===e.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(o),this.state){case e.OPEN:if(null==r?void 0:r.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:o,failures:this.failures}),this.executeWithTimeout(i,r.critical);if(null==r?void 0:r.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:o}),this.rejectedCalls++,r.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:o,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(o||"unknown")+")");case e.HALF_OPEN:if(this.halfOpenCallsInProgress>=this.config.halfOpenMaxCalls){if(null==r?void 0:r.fallback)return this.logger.info("Circuit breaker HALF_OPEN limit reached - using fallback",{context:o}),this.rejectedCalls++,r.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:o,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(o||"unknown")+")")}this.halfOpenCallsInProgress++}try{const e=await this.executeWithTimeout(i,null==r?void 0:r.critical);return this.onSuccess(o),e}catch(a){throw this.onFailure(a,o),a}}async executeWithFallback(e,i,o,r){return this.execute(e,o,{fallback:i,critical:r})}getStats(){return{state:this.state,failures:this.failures,successes:this.successes,totalCalls:this.totalCalls,rejectedCalls:this.rejectedCalls,lastFailureTime:this.lastFailureTime,lastSuccessTime:this.lastSuccessTime,isHealthy:this.state===e.CLOSED&&0===this.failures}}reset(){this.state=e.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker reset to initial state")}forceOpen(e){this.openCircuit(e)}forceClose(i){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:i})}async executeWithTimeout(e,i){const o=i?2*this.config.timeout:this.config.timeout;return new Promise((i,r)=>{const a=setTimeout(()=>{r(new Error("Request timeout after "+o+"ms"))},o);e().then(e=>{clearTimeout(a),i(e)}).catch(e=>{clearTimeout(a),r(e)})})}onSuccess(i){this.lastSuccessTime=Date.now(),this.state===e.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(i)):this.state===e.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:i,state:this.state,successes:this.successes,failures:this.failures})}onFailure(i,o){const r=(null==i?void 0:i.status)&&i.status>=400&&i.status<500;if(r&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:o,status:i.status,message:i.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===e.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(o)),this.state===e.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(o),this.logger.warn("Circuit breaker failure",{context:o,state:this.state,failures:this.failures,error:(null==i?void 0:i.message)||i,status:null==i?void 0:i.status,threshold:this.config.failureThreshold,isClientError:r})}openCircuit(i){this.state=e.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:i,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(i){this.state=e.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:i,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(i){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:i,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const i={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},o={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",PRODUCT_ENGRAVING_UPDATED:"product_engraving_updated",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"},r={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},a={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_ENGRAVING:"product-engraving",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={[i.LOCAL]:"http://127.0.0.1:8080",[i.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[i.STAGING]:"https://staging-elements.liquidcommerce.us",[i.PRODUCTION]:"https://elements.liquidcommerce.us"},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 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 Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[e]:i})}isDevelopment(){return this.get("env")===i.DEVELOPMENT}isStaging(){return this.get("env")===i.STAGING}isProduction(){return this.get("env")===i.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(e,o){if(!(null==e?void 0:e.trim()))throw new Error("API key is required");if(o.env&&!Object.values(i).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(e,o){var r,a;const c=o.env||i.STAGING,h=d[c];return{apiKey:e.trim(),env:c,isBuilder:null!==(r=o.isBuilder)&&void 0!==r?r:![],debugMode:null!==(a=o.debugMode)&&void 0!==a?a:l.NONE,baseUrl:h,partnerCode: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,a=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,c=(null===(i=window.screen)||void 0===i?void 0:i.height)||0,l=Math.max(a,c),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/],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 d.some(e=>e.test(o))?"tablet":h.some(e=>e.test(o))||r&&l<768?"mobile":r&&l>=768&&l<=1200||r&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&r&&l>=768||/windows nt/i.test(o)&&r&&l>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}function fetchAdapter(e){return async(i,o)=>{var r;const a=await e(i,o);let c;if("function"==typeof(null===(r=a.headers)||void 0===r?void 0:r.entries))c=Object.fromEntries(a.headers.entries());else{c={};for(const[e,i]of a.headers)c[e]=i}return{ok:a.ok,status:a.status,statusText:a.statusText,headers:c,json:()=>a.json(),text:()=>a.text()}}}const xhrFetch=(e,i)=>new Promise((o,r)=>{const a=new XMLHttpRequest;a.open(i.method||"GET",e);for(const[e,c]of objectEntries(i.headers))a.setRequestHeader(e,c);a.onload=()=>{o({ok:a.status>=200&&a.status<300,status:a.status,statusText:a.statusText,headers:a.getAllResponseHeaders().split("\r\n").reduce((e,i)=>{const[o,r]=i.split(": ");return o&&r&&(e[o]=r),e},{}),json:()=>Promise.resolve(JSON.parse(a.responseText)),text:()=>Promise.resolve(a.responseText)})},a.onerror=()=>{r(new TypeError("Network request failed"))},a.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}function objectValues(e){const i=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.push(e[o]);return i}function objectEntries(e){const i=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.push([o,e[o]]);return i}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(),this.circuitBreaker=CircuitBreakerService.getInstance({failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:15e3,countClientErrorsAsFailures:![]})}static getInstance(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(e))}async authenticate(){var e,i;if(this.isAuthenticating)return await new Promise(e=>{const F=()=>{this.isAuthenticating?setTimeout(F,100):e(void 0)};F()}),!!this.accessToken;this.isAuthenticating=!![];try{const o=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.token,this.tokenExpiration=Date.now()+1e3*(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.exp),!![]}catch(o){return this.logger.error("Authentication failed",o),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(e,i,o=![]){return this.circuitBreaker.execute(async()=>{const o=this.buildUrl(e),r={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"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};this.clientConfig.isBuilder()&&(r["X-Liquid-Api-Builder"]=!![]);const a={method:i.method,headers:r,body:i.body?JSON.stringify(i.body):void 0},c=await this.httpClient(o,a);if(!c.ok)throw{message:"HTTP error status: "+c.status,status:c.status};return c.json()},i.method+" "+e+" (no-auth)",{critical:o})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(e,i,o=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const o=this.buildUrl(e),r={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"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};this.clientConfig.isBuilder()&&(r["X-Liquid-Api-Builder"]=!![]);const a={method:i.method,headers:r,body:i.body?JSON.stringify(i.body):void 0},c=await this.httpClient(o,a);let l;try{l=await c.json()}catch(d){const e=await c.text().catch(()=>"HTTP error status: "+c.status);l={message:e||d},this.logger.error("Failed to parse response data",d)}if(!c.ok)throw{...l,status:c.status,message:(null==l?void 0:l.message)||"HTTP error status: "+c.status};return l},i.method+" "+e,{critical:o})}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},null==i?void 0:i.critical)}async post(e,i){return this.request(e,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}async put(e,i){return this.request(e,{method:"PUT",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}async delete(e,i){return this.request(e,{method:"DELETE",headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}}const u="@liquidcommerce/elements-sdk",p="LiquidCommerce Elements SDK",m="UNLICENSED",f="LiquidCommerce Team",g="2.2.0-beta.22",v="https://docs.liquidcommerce.co/elements-sdk",y={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},b={url:"https://github.com/liquidcommerce/elements-sdk/issues"},x="./dist/index.esm.js",w="./umd/elements.js",C="./dist/types/index.d.ts",k="pnpm@10.0.0",S={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},E=["dist","umd","README.md"],T={access:"public",registry:"https://registry.npmjs.org/"},P="module",D=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],A={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"'},_=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],z={"@biomejs/biome":"2.2.6","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.6","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.2","@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":"^11.0.6","@semantic-release/npm":"^13.0.0","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.7.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.4","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.3"},O={node:">=20"},N={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},R={name:u,description:p,license:m,author:f,version:g,homepage:v,repository:y,bugs:b,module:x,browser:w,types:C,packageManager:k,exports:S,files:E,publishConfig:T,type:P,sideEffects:D,scripts:A,keywords:_,devDependencies:z,engines:O,pnpm:N};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)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...e)=>window.dataLayer.push(e),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(e){return new Promise((i,o)=>{if(this.isContainerLoaded(e))return this.logger.info("GTM container "+e+" already loaded, skipping script injection"),i(),void 0;this.logger.info("Loading GTM container "+e);const r=document.createElement("script");r.src="https://www.googletagmanager.com/gtm.js?id="+e,r.async=!![];const a=setTimeout(()=>o(new Error("GTM script timeout: "+e)),5e3);r.onload=()=>{clearTimeout(a),this.logger.info("GTM container "+e+" loaded successfully"),i()},r.onerror=()=>{clearTimeout(a),o(new Error("GTM script failed: "+e))},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 Error("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(a){this.logger.error("Failed to load LiquidCommerce GTM container: "+a+". Checking if partner GTM is available.",a)}if(o||(i&&window.dataLayer?(o=!![],r="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(o=!![],r="GTM initialized with dataLayer (basic functionality available)")),!o)throw this.isInitializing=![],new Error("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(),a={...o,...r.length>0&&{send_to:r},tenant_source:R.description+" v"+R.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:i,eventData:a,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+i+" (initialization pending)",{data:a}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+i+" skipped: dataLayer not available"),void 0;const c={event:i,...a};window.dataLayer.push(c),"function"==="object".gtag&&window.gtag("event",i,a),this.logger.debug("Sent GTM event: "+i,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:r.length>0?r:"no targeting",data:a})}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})}increaseQuantity(e){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}decreaseQuantity(e){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}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})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}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 a=r.split("_")[0];["product","cart","address","checkout"].includes(a)||(a="other");const c=Date.now(),l={eventId:this.generateEventId(c),namespace:o,event:r,originalEvent:e,actionNamespace:"actions"===o?a:void 0,timestamp:c},d={data:i,metadata:l};this.dispatchNativeEvents(e,d)}dispatchNativeEvents(e,i){const[o]=e.split(".",2);try{const r=new CustomEvent(this.eventPrefix+":"+e,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(r);const a=new CustomEvent(this.eventPrefix+":"+o,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(a)}catch(r){this.logger.error("Error dispatching native events for "+e,r)}}generateEventId(e){return"evt_"+e+"_"+Math.random().toString(36).slice(2,9)}}const B="liquid_elements",q={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:c.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,engravingLines:[],drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},j={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee: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:[]},U={drawer:{isOpen:![],contentConfig:null}},V={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},H={products:{},cart:j,address:V,checkout:G,ui:U};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",{critical:!![]});if(!this.validResponseData(e))throw this.logger.error("Invalid response data",e),new Error("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 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&&r.products&&0!==r.products.length?{products:r.products,retailers:r.retailers}:(this.logger.error("Failed to fetch product data",r),null)}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 Error("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 Error("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 Error("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 Error("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,critical:!![]});if(200!==i.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",i),new Error("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,critical:!![]});if(201!==i.statusCode)throw this.logger.error("Failed to get payment session",i),new Error("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},critical:!![]});if(200!==o.statusCode)throw this.logger.error("Failed to confirm payment session",o),new Error("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,critical:!![]});if(200!==i.statusCode)throw this.logger.error("Failed to complete checkout",i),new Error("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 Error(o.error);throw o}}validResponseData(e){return e.data&&"object"==typeof e.data&&Object.keys(e.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}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(a){throw this.logger.error('Error during store action "'+e+'"',a),a}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:e,next:i})=>{const o=performance.now(),r=i(),a=performance.now()-o;return a>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+a.toFixed(2)+"ms"),r},this.state=H,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=B+"_"+e,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.addBeforeUnloadHandler(),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 a=o.pop();for(const c of o){if(void 0===r[c])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];r=r[c]}if(Array.isArray(r))r=r.filter((e,i)=>i!==Number.parseInt(a,10));else{if("object"!=typeof r||null===r)return this.logger.warn('Cannot remove property "'+a+'" from non-object type at path "'+e+'".'),![];{const{[a]: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 a=e.map(e=>this.watch(e,(a,c)=>{o.push({path:e,value:a,oldValue:c}),clearTimeout(r),r=setTimeout(()=>{o.length>0&&(i([...o]),o.length=0)},0)}));return()=>{for(const e of a)e()}}createProductInstance(e){const i="products."+e,o=this.get(i);return o?!![]:this.set(i,q)}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 Z=()=>{if(r>=this.middleware.length)return o();const a=this.middleware[r++];return a({action:e,payload:i,state:this.getState(),next:Z})};return Z()}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[a,...c]=r,l=e[a],d=Array.isArray(l)?[]:{};if(Array.isArray(e)){const i=[...e];return i[a]=this.immutableSet(l||d,c.join("."),o),i}return{...e,[a]:this.immutableSet(l||d,c.join("."),o)}}notifyListeners(e,i,o){const r=this.listeners.get(e);if(r)for(const d of r)try{d(i,o)}catch(c){this.logger.error('Error in store listener for path "'+e+'"',c)}const a=e.split(".");for(let d=a.length-1;d>0;d--){const e=a.slice(0,d).join("."),i=this.listeners.get(e);if(i){const r=this.get(e),c=a.slice(d).join("."),h=this.immutableSet(r,c,o);for(const o of i)try{o(r,h)}catch(l){this.logger.error('Error in store listener for parent path "'+e+'"',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 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)}}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)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(e){if(!e||""===e.trim())return V;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}}:{...V,id:e}}catch(i){return{...V,id:e}}}}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()}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))},Y={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"},W={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:Y[e.type]||"error"})),transformCheckoutEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:W[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,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}},a={};for(const c in e.items||{}){const i=e.items[c];a[c]={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:a,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},updatedAt:e.updatedAt,createdAt:e.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}async loadCart(){var e,i,r,a,c,l;try{this.store.set("cart.loading",!![]);const d=this.store.get("cart"),h=await this.api.getCartData(d.id);for(const e of Object.keys(d.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(d.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(d.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const u={"cart.id":h.id,"cart.error":null,"cart.totals":buildCartTotals(h),"cart.updatedAt":h.updatedAt||(new Date).toISOString(),"cart.createdAt":h.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(i=null===(e=h.attributes)||void 0===e?void 0:e.promoCode)||void 0===i?void 0:i.value)?{code:h.attributes.promoCode.value.toUpperCase(),discountAmount:h.attributes.promoCode.discount||0,error:null}:null};if((null===(r=h.items)||void 0===r?void 0:r.length)>0)for(const e of h.items)u["cart.items."+e.id]=buildCartItemStore(e);if((null===(a=h.retailers)||void 0===a?void 0:a.length)>0)for(const e of h.retailers)if(u["cart.retailers."+e.id]=buildRetailerStore(e),(null===(c=e.fulfillments)||void 0===c?void 0:c.length)>0)for(const i of e.fulfillments)u["cart.fulfillments."+i.id]=buildFulfillmentStore(i,e);(null===(l=h.events)||void 0===l?void 0:l.length)>0&&(u["cart.events"]=transformEventsForCart(h.events||[])),this.store.batch(u),h.id!==d.id&&await this.store.persist();const p=this.store.get("cart"),m=this.store.get("address");this.pubSub.publishAction(o.CART_LOADED,cartDataForEventFromStore(p,m))}catch(d){throw this.store.set("cart.error",(null==d?void 0:d.message)||"Failed to load cart"),this.logger.error("Load cart failed",d),d}finally{this.store.set("cart.loading",![])}}}const K="lce-checkout-stripe-slot",Q={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},X={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},$={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(e){return e/100}function formatCentToDollarText(e,i=!![]){const o=Math.floor(e/100),r=e%100;let a="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||r>0)&&(a+=".",a+=r<10?"0"+r:r.toString()),a}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 Error("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 Error("Invalid time values: "+e);const a=o>=12?"PM":"AM",c=o%12||12;return c+":"+r.toString().padStart(2,"0")+" "+a}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"),a=i.getFullYear().toString();return o+"/"+r+"/"+a}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 a=new Date;if(r>a)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const c=r.getFullYear();if(c<o)return{isValid:![],age:null,error:"Birth year cannot be before "+o+". Please check your birth date."};const l=calculateAge(r,a);return l<i?{isValid:![],age:l,error:"Must be at least "+i+" years old"}:{isValid:!![],age:l}}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]||""}}function validateCustomerInfo(e){const i=[Q.firstName,Q.lastName,Q.email,Q.phone,Q.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=[X.firstName,X.lastName,X.email,X.phone,X.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=[$.firstName,$.lastName,$.email,$.phone,$.addressOne,$.city,$.state,$.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}}const J=[a.PRODUCT,a.PRODUCT_IMAGE_CAROUSEL,a.PRODUCT_OPTIONS,a.PRODUCT_INTERACTIONS,a.PRODUCT_DESCRIPTION,a.PRODUCT_RETAILERS,a.PRODUCT_RETAILERS_CAROUSEL,a.PRODUCT_RETAILERS_POPUP,a.PRODUCT_RETAILERS_POPUP_LIST,a.PRODUCT_PRICE,a.PRODUCT_ADD_TO_CART_SECTION,a.PRODUCT_DRAWER,a.PRODUCT_LOADING,a.ENGRAVING_FORM,a.ENGRAVING_VIEW],tt=[a.ADDRESS_INPUT,a.ADDRESS_DISPLAY],et=[a.CART,a.CART_RETAILER,a.CART_ITEM,a.CART_FOOTER,a.CART_ITEM_QUANTITY_PRICE,a.CART_RETAILER_SUBTOTAL,a.CART_PROMO_CODE,a.CART_HEADER,a.CART_BODY,a.CART_FULFILLMENT,a.BUTTONS_CART_OPEN],nt=[a.CHECKOUT,a.CHECKOUT_INFORMATION_SECTION,a.CHECKOUT_STRIPE_FORM,a.CHECKOUT_PAYMENT_FORM,a.CHECKOUT_BILLING_FORM,a.CHECKOUT_SUMMARY_SECTION,a.CHECKOUT_PROMO_CODE,a.CHECKOUT_GIFT_CARDS,a.CHECKOUT_AMOUNTS,a.CHECKOUT_ITEMS,a.CHECKOUT_COMPLETED,a.CHECKOUT_DELIVERY_INFORMATION_FORM,a.CHECKOUT_BUYER_INFORMATION_FORM,a.CHECKOUT_TIPS,a.CHECKOUT_PC_GC,a.CHECKOUT_ITEM,a.CHECKOUT_ITEM_QUANTITY,a.CHECKOUT_PLACE_ORDER_BUTTON,a.CHECKOUT_HEADER,a.CHECKOUT_PRESALE_COUNTDOWN];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}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("&"),a="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+r+"&"+a,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,i="swap"){const o=document.querySelector("link[data-liquid-fonts]");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",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}if(!i){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute("data-liquid-fonts",""),document.head.appendChild(e)}}const getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n padding-bottom: 8px;\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 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(--heading-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 }\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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\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 .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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 flex-direction: column;\n align-items: flex-start;\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: 400;\n line-height: 20px;\n }\n\n .item-shipping-container {\n display: flex;\n flex-wrap: wrap;\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: 400;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 500;\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: 400;\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: 500;\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\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\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 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 }\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: 400;\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(--heading-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: 400;\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(--heading-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: 400;\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: 400;\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: 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 .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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-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(--heading-font-family, Poppins);\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 width: 64px;\n height: 64px;\n border-radius: var(--card-border-radius, 6px);\n object-fit: cover;\n flex-shrink: 0;}\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n word-break: break-word;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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 h3 {\n overflow: hidden;\n color: var(--base-foreground, #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 }\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: 400;\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: 400;\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 > *: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(--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 p:last-child, .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: 400;\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: 400;\n line-height: 20px;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #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 .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: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: 500;\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(--heading-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(--heading-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: 400;\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 display: flex;\n flex-direction: column;\n align-items: flex-start;\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-weight: 400;\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: 400;\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: 400;\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: 400;\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 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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\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(--heading-font-family, Poppins);\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: 400;\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-container {\n display: flex;\n width: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n .engraving-form-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: 500;\n line-height: 24px;\n margin-bottom: 8px;\n }\n\n .engraving-form-location {\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: 24px;\n }\n\n .engraving-form-header > :not(.engraving-form-location) {\n margin-bottom: 0;\n }\n\n .engraving-form-lines {\n display: flex;\n width: 100%;\n height: auto;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-lines .engraving-form-input-container:not(:last-child) {\n margin-bottom: 16px;\n }\n\n .engraving-form-input-container {\n display: flex;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--border-radius-md, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .engraving-form-input-container .engraving-form-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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-form-input-container .engraving-form-input-char-count {\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: 400;\n line-height: 20px;\n margin-left: 4px;\n }\n\n .engraving-form-actions {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-form-actions > button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: none;\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 cursor: pointer;\n }\n\n .engraving-form-actions > button:first-child {\n margin-right: 8px;\n }\n\n .engraving-form-actions .engraving-form-button-cancel {\n color: var(--primary-color, #1D4ED8);\n }\n\n .engraving-form-actions .engraving-form-button-save {\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 flex: 1 0 0;\n }\n\n .engraving-form-actions .engraving-form-button-save.disabled {\n opacity: 0.5;\n }\n\n .engraving-form-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n }\n\n .engraving-form-disclaimer > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\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: 400;\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.has-header {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined.has-header {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled.has-header {\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.has-header .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: 500;\n line-height: 100%;\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: 400;\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: 400;\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 .engraving-view-container.product .add-engraving-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n height: 36px;\n cursor: pointer;\n\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n background: transparent;\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n\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 .engraving-view-container:not(.product) .add-engraving-button {\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: 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 }\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(--heading-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: 400;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--base-primary, #1E40AF);\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 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: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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\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-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--heading-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: 225px;\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\n // Product Engraving Styles\n .product-engraving {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-engraving > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .product-engraving .product-info-section,\n .product-engraving .fulfillment-section,\n .product-engraving .personalization-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 .product-engraving .product-info-section {\n gap: 16px;\n flex-direction: row;\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 .product-engraving .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 .product-engraving .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: center;\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-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: 400;\n line-height: 20px;\n align-self: stretch;\n }\n\n .personalization-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: 400;\n line-height: 16px;\n align-self: stretch;\n }\n\n .product-engraving .fulfillment-section .shipping-from-text {\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 margin-bottom: 8px;\n }\n\n .product-engraving .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .product-engraving .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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\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 {\n font-weight: 500;\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(--base-primary, #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 .personalization-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .personalization-section .personalization-title {\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 .personalization-section .personalization-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: 400;\n line-height: 20px;\n }\n\n .personalization-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 .personalization-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 .personalization-input-wrapper .personalization-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: 400;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .personalization-input-wrapper .personalization-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: 400;\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: 500;\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: 500;\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 .personalization-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: 400;\n line-height: 16px;\n }\n\n .personalization-disclaimer b {\n font-weight: 600;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 500;\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 cursor: not-allowed;\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; /* 2 lines * 1.4 line-height */\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-weight:700;\n font-style: normal;\n line-height: 20px;\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; /* 2 lines * 1.4 line-height */\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(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\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: 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: 500;\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 cursor: not-allowed;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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 .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 500;\n }\n\n .fulfillments-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";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 /* Image skeleton styles */\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 queries for responsive skeleton images */\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";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(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\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: 400;\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 it={"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"},ot={backgroundColor:"--product-background-color"},rt={backgroundColor:"--cart-background-color"},st={backgroundColor:"--address-background-color"},at={backgroundColor:"--checkout-background-color"},ct={global:it,product:ot,cart:rt,address:st,checkout:at};function getCSSVariableMapping(e){return ct[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[a,c]of Object.entries(r)){const i=this.getValueByPath(e,a);void 0!==i&&this.isCSSValue(i)&&(o[c]=i,this.isColorVariable(c,i)&&this.generateOpacityVariants(o,c,i))}return o}extractVariablesFromPartialTheme(e,i){const o={},r=getCSSVariableMapping(i);for(const[a,c]of Object.entries(r))if(this.hasValueAtPath(e,a)){const i=this.getValueByPath(e,a);void 0!==i&&this.isCSSValue(i)&&(o[c]=i,this.isColorVariable(c,i)&&this.generateOpacityVariants(o,c,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 a of o){if(null==r||!(a in r))return![];r=r[a]}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 a=i+"-"+r.suffix,c=this.addOpacityToHexColor(o,r.value);c&&(e[a]=c)}}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),a=r.toString(16).padStart(2,"0");return"#"+o+a}}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),a=this.getStylesheetStyles(e).join("\n\n"),c=0===r.length?"":":host { "+r+" }",l=("\n "+c+"\n\n "+a+"\n ").trim();this.createStylesheet(e,l)}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(R){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(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];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;this.data.global=this.deepMerge(this.getConfigs("global"),e),((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!==J.indexOf(e)?this.getConfigs("product"):-1!==tt.indexOf(e)?this.getConfigs("address"):-1!==et.indexOf(e)?this.getConfigs("cart"):-1!==nt.indexOf(e)?this.getConfigs("checkout"):void 0}getStylesheet(e){const i=this.getBaseStylesheets();if(e===a.DRAWER){const e=[...i],o=this.stylesheetGenerator.getStylesheet("product"),r=this.stylesheetGenerator.getStylesheet("cart"),a=this.stylesheetGenerator.getStylesheet("checkout"),c=this.stylesheetGenerator.getStylesheet("address");return o&&e.push(o),r&&e.push(r),a&&e.push(a),c&&e.push(c),e}let o;if(tt.includes(e)||e===a.ADDRESS)o="address";else if(J.includes(e)||e===a.PRODUCT)o="product";else if(et.includes(e)||e===a.CART)o="cart";else{if(!nt.includes(e)&&e!==a.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),i;o="checkout"}const r=this.stylesheetGenerator.getStylesheet(o);return r?[...i,r]: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 UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,i){const r={type:e,data:i||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:r}),e===a.CART&&this.pubSub.publishAction(o.CART_OPENED,!![]),e===a.CHECKOUT&&this.pubSub.publishAction(o.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===a.CART&&this.pubSub.publishAction(o.CART_CLOSED,!![]),(null==e?void 0:e.type)===a.CHECKOUT&&this.pubSub.publishAction(o.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.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(e){var i,r,a;try{this.store.set("checkout.loading",!![]);const l=e||this.store.get("cart.id"),d=this.store.get("cart");if(0===(null===(i=Object.values(d.items))||void 0===i?void 0:i.length)&&!e)return;const h=this.themeProvider.getConfigs("checkout"),u={canEmail:h.layout.emailOptIn.checked,canSms:h.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:u});if((null===(r=m.retailers)||void 0===r?void 0:r.length)>0)for(const e of m.retailers)for(const i of e.fulfillments)i.type===c.ON_DEMAND&&(p["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal});if((null===(a=m.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const e of m.items){const i=m.retailers.find(i=>i.id===e.retailerId),o=i.fulfillments.find(i=>i.id===e.fulfillmentId);p["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,i,o)}}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(e=>({code:e.code,discountAmount:e.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(o.CHECKOUT_LOADED,{cartId:m.cartId})}catch(l){throw this.store.set("checkout.error",l.message),this.pubSub.publishAction(o.CHECKOUT_FAILED,{message:l.message}),l}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(e){var i,r,a,l,d;try{let o;if(this.store.set("checkout.updating",!![]),await this.commonCommands.loadCart(),null==e?void 0:e.response)o=e.response;else{const r=null!==(i=null==e?void 0:e.cartId)&&void 0!==i?i:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;o=await this.api.prepareCheckout({cartId:r})}const h={"checkout.token":o.token,"checkout.events":transformEventsForCheckout(o.events||[]),"checkout.amounts":o.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":o.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),"checkout.promoCode":(null===(a=null===(r=null==o?void 0:o.promoCode)||void 0===r?void 0:r.value)||void 0===a?void 0:a.trim())?{code:o.promoCode.value,discountAmount:o.promoCode.discount}:null};if((null===(l=o.retailers)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const e of o.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===(d=o.items)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.items");for(const e of o.items){const i=o.retailers.find(i=>i.id===e.retailerId),r=i.fulfillments.find(i=>i.id===e.fulfillmentId);h["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,i,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(o.CHECKOUT_FAILED,{message:e}),h}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(e){const i=this.store.get("checkout.isGift"),r=null!=e?e:!i;this.store.batch({"checkout.isGift":r,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_IS_GIFT_TOGGLED,{isActive:r})}async toggleBillingSameAsShipping(e){const i=this.store.get("checkout.billingSameAsShipping"),r=null!=e?e:!i;this.store.batch({"checkout.billingSameAsShipping":r,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:r})}toggleMarketingPreferences(e,i){const r=this.store.get("checkout.marketingPreferences."+e),a=null!=i?i:!r;this.store.set("checkout.marketingPreferences."+e,a),this.pubSub.publishAction(o.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:e,isActive:a})}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 Error("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}),a=0!==r.amounts.discounts,c=null===(i=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===i?void 0:i[0];if(!a)return this.store.set("checkout.promoCodeError",c?c.message:'Code "'+e+'" does not exist'),this.googleTagManager.promoCodeFailed(e,(null==c?void 0:c.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(R){const i=R.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),R}}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)||"",a=await this.api.prepareCheckout({...o,promoCode:""});if(0!==a.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(r,0),await this.partialLoadCheckout({response:a})}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||[],a=await this.api.prepareCheckout({...e,giftCards:[...r,o]}),c=null===(i=transformGiftCardCheckoutEvents(a.events||[]))||void 0===i?void 0:i[0],l=hasAnyRetailerGiftCardRestriction(a.events||[]);if(c){if(!l)return this.store.set("checkout.giftCardError",c.message),void 0;this.store.set("checkout.giftCardError",c.message)}const d=a.giftCards.find(e=>e.code===o);if(!d)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(o,(null==c?void 0:c.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(o,d.applied),await this.partialLoadCheckout({response:a})}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(R){throw this.store.set("checkout.error",(null==R?void 0:R.message)||"Failed to clear gift card error. Please try again."),R}}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!==o))||[],a=await this.api.prepareCheckout({...e,giftCards:r}),c=a.giftCards.find(e=>e.code===o);if(c)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;this.googleTagManager.giftCardApplied(o,0),await this.partialLoadCheckout({response:a})}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,i){try{this.store.set("checkout.customer."+e,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:e})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateBillingInfo(e,i){try{this.store.set("checkout.billing."+e,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:e})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateGiftInfo(e,i){try{this.store.set("checkout.giftRecipient."+e,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.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),a={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},a)}}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),a=i.isValid&&o.isValid&&r.isValid,c=[...i.invalidFields.map(e=>"customer."+e),...o.invalidFields.map(e=>"giftRecipient."+e),...r.invalidFields.map(e=>"billing."+e)];this.store.batch({"checkout.isFormValid":a,"checkout.invalidFields":c,"checkout.readyForSubmit.customer":i.isValid,"checkout.readyForSubmit.gift":o.isValid,"checkout.readyForSubmit.billing":r.isValid})}async checkoutComplete(){var e;try{const i=this.store.get("checkout"),r=this.store.get("checkout.payment.paymentMethodId");if(!i.token||!r)return;const c=await this.api.checkoutComplete({token:i.token,payment:r}),l=c.legacyOrderNumber||c.referenceId||"N/A";i.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(a.CHECKOUT_COMPLETED,{orderNumber:l,orderTotal:i.amounts.total,cardLast4:i.card.last4,customerEmail:i.customer.email,giftRecipientEmail:(null===(e=i.giftRecipient)||void 0===e?void 0:e.email)||null}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:l,orderTotal:i.amounts.total}),this.googleTagManager.purchase({transaction_id:l,tax:centToDollar(i.amounts.tax||0),shipping:centToDollar(i.amounts.shipping||0),items:[...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_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(i.amounts.total),subtotal:centToDollar(i.amounts.subtotal),total_before_discounts:centToDollar(i.amounts.subtotal+i.amounts.tax+i.amounts.shipping+i.amounts.delivery+i.amounts.platform+i.amounts.service),discounts:centToDollar(i.amounts.discounts),gift_cards:centToDollar(i.amounts.giftCards||0),net_total:centToDollar(i.amounts.total)})}catch(i){const e=(null==i?void 0:i.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":e,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_FAILED,{message:e}),i}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var e,i,r,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const l={cartId:c.cartId,customer:{firstName:c.customer.firstName,lastName:c.customer.lastName,email:c.customer.email,phone:c.customer.phone,birthDate:c.customer.birthDate,company:c.customer.company},...c.isGift&&{giftOptions:{recipient:{email:c.giftRecipient.email,phone:c.giftRecipient.phone,name:c.giftRecipient.firstName+" "+c.giftRecipient.lastName},message:c.giftRecipient.message||""}},...!c.billingSameAsShipping&&(null==c?void 0:c.billing)&&{billingAddress:{firstName:null==c?void 0:c.billing.firstName,lastName:c.billing.lastName,email:c.billing.email,phone:c.billing.phone,company:null!==(e=c.billing.company)&&void 0!==e?e:void 0,city:c.billing.city,state:c.billing.state,zip:c.billing.zipCode,one:c.billing.addressOne,two:c.billing.addressTwo||""}},billingSameAsShipping:c.billingSameAsShipping,acceptedAccountCreation:c.acceptedAccountCreation,hasAgeVerify:c.hasAgeVerify,shippingAddressTwo:null!==(i=c.isGift?c.giftRecipient.addressTwo:c.customer.addressTwo)&&void 0!==i?i:void 0,hasSubstitutionPolicy:c.hasSubstitutionPolicy,isGift:c.isGift,marketingPreferences:c.marketingPreferences,promoCode:(null===(r=c.promoCode)||void 0===r?void 0:r.code)||void 0,giftCards:(null===(a=c.giftCards)||void 0===a?void 0:a.map(e=>e.code))||[],deliveryInstructions:Object.values(c.onDemandFulfillmentTipInfo||{}).map(e=>({fulfillmentId:e.fulfillmentId,instructions:c.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 h={subtotal:centToDollar(c.amounts.subtotal),total_before_discounts:centToDollar(c.amounts.subtotal+c.amounts.tax+c.amounts.shipping+c.amounts.delivery+c.amounts.platform+c.amounts.service),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)};this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(c.amounts.total),"card",void 0,h)}catch(c){const e=(null==c?void 0:c.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":e,"checkout.loading":![]}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_FAILED,{message:e}),c}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(a.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,a;const c={id:e.cartItemId,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:i},l=(null===(a=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===a?void 0:a.filter(e=>""!==e.trim()))||[];return l.length>0&&(c.engravingLines=l),c}async updateCheckoutItemQuantity(e,i){try{this.store.set("checkout.items."+e+".updating",!![]);const r=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+e);if(!a)throw new Error("Item not found");const c=a.quantity,l=a.quantity+i;if(l<1)return this.removeItem(e,!![]);const d=this.buildItemUpdate(a,l);await this.api.updateCart({id:r,items:[d],loc:this.getLocation()}),this.pubSub.publishAction(i>0?o.CHECKOUT_ITEM_QUANTITY_INCREASE:o.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:a.cartItemId,quantity:l,previousQuantity:c});const h=splitCategoryPath(a.catPath),u={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(i),price:centToDollar(a.unitPrice||0),upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};i<0?this.googleTagManager.removeFromCart(u):i>0&&this.googleTagManager.addToCart(u),await this.partialLoadCheckout()}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 i,r,a;try{const c=this.store.get("checkout.cartId"),l=this.store.get("checkout.items."+e);if(!l)throw new Error("Item not found in checkout");if(!(null===(i=l.attributes)||void 0===i?void 0:i.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const d=(null===(a=null===(r=l.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.lines)||[],h={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:[]};await this.api.updateCart({id:c,items:[h],loc:this.getLocation()}),this.pubSub.publishAction(o.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:l.cartItemId,engravingLines:[],previousEngravingLines:d}),await this.partialLoadCheckout()}catch(c){throw this.store.set("checkout.items."+e+".error",c.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:c.message}),c}}async removeItem(e,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("checkout.items."+e+".updating",!![]);const r=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+e);if(!a)throw new Error("Item not found");const c=this.buildItemUpdate(a,0);await this.api.updateCart({id:r,items:[c],loc:this.getLocation()}),this.store.remove("checkout.items."+e),this.pubSub.publishAction(o.CHECKOUT_ITEM_REMOVED,{cartItemId:a.cartItemId}),await this.partialLoadCheckout()}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 i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(i).map(i=>{const o=Math.round(i.subtotal*e/100);return{fulfillmentId:i.fulfillmentId,tip:o}}),a=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(a),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update tips. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,i){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},a=Object.values(r).map(o=>({fulfillmentId:o.fulfillmentId,tip:o.fulfillmentId===e?i:o.tip})),c={...this.dataForCheckoutPrepare(),deliveryTips:a},l=await this.api.prepareCheckout(c);this.updateStoreFromCheckoutResponse(l),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:a})}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 i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(i).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===e?0:i.tip})),a=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(a),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to remove fulfillment tip. Please try again."),i}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"),a=(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:a,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.pubSubService=PubSubService.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,i){try{this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),a=this.store.get("cart.items."+e);if(!a)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+i),new Error("Item not found");const c=a.quantity+i;if(c<1)return this.removeItem(e,!![]);const l=this.buildItemUpdate(a,c),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[e]),this.updateFulfillment(a.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSubService.publishAction(i<0?o.CART_ITEM_QUANTITY_DECREASE:o.CART_ITEM_QUANTITY_INCREASE,{id:a.id,quantity:c,previousQuantity:a.quantity});const h=splitCategoryPath(a.catPath),u={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(i),price:centToDollar(a.unitPrice||0),upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};i<0?this.googleTagManager.removeFromCart(u):i>0&&this.googleTagManager.addToCart(u)}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,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),a=this.store.get("cart.items."+e);if(!a)throw new Error("Item not found");const c={itemId:a.id,fulfillmentId:a.fulfillmentId,retailerId:a.retailerId},l=this.buildItemUpdate(a,0),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[]),this.cleanupAfterItemRemoval(c,d),this.syncCartMetaFromApiResponse(d),this.pubSubService.publishAction(o.CART_ITEM_REMOVED,{id:a.id});const h=splitCategoryPath(a.catPath);this.googleTagManager.removeFromCart({item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:a.quantity,price:centToDollar(a.unitPrice||0),upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.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,i){var r,a,c;try{const l=this.store.get("cart"),d=null===(r=l.items)||void 0===r?void 0:r[e];if(!d)throw new Error("Item not found");this.store.set("cart.items."+e+".updating",!![]);const h={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:i},u=await this.api.updateCart({id:l.id||"",items:[h],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[e]),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u);const p=this.store.get("cart"),m=this.store.get("address");this.pubSubService.publishAction(o.CART_UPDATED,{previous:cartDataForEventFromStore(l,m),current:cartDataForEventFromStore(p,m)}),this.pubSubService.publishAction(o.CART_ITEM_ENGRAVING_UPDATED,{id:d.id,engravingLines:i,previousEngravingLines:(null===(c=null===(a=d.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||[]})}catch(l){throw this.store.set("cart.items."+e+".error",l.message),this.logger.error("Failed to update item engraving",l),l}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var i,r;try{this.store.set("cart.loading",!![]);const a=this.store.get("cart"),c={...a},l=(null===(i=e.engravingLines)||void 0===i?void 0:i.filter(e=>""!==e.trim()))||[],d=l.length>0,h=Object.values(a.items||{}).find(i=>{var o,r,a,c,h;const u=i.fulfillmentId===e.fulfillmentId&&i.partNumber===e.partNumber;if(!u)return![];if(d){const e=(null===(r=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[];return l.join(",")===e.join(",")}return!(null===(h=null===(c=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||void 0===h?void 0:h.length)}),u={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:h?e.quantity+h.quantity:e.quantity};d&&(u.engravingLines=l);const p=await this.api.updateCart({id:a.id||"",items:[u],loc:this.getLocation()}),m=null===(r=p.items)||void 0===r?void 0:r.find(e=>e.fulfillmentId===u.fulfillmentId&&e.partNumber===u.partNumber&&e.upc===u.upc);if(!m)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const f=this.store.get("cart.fulfillments."+e.fulfillmentId);f?this.updateFulfillment(e.fulfillmentId,p):this.addNewFulfillmentAndRetailer(e.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const g=this.store.get("cart"),v=this.store.get("address");this.pubSubService.publishAction(o.PRODUCT_ADD_TO_CART,{...e}),this.pubSubService.publishAction(o.CART_ITEM_ADDED,{id:m.id,upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSubService.publishAction(o.CART_UPDATED,{previous:cartDataForEventFromStore(c,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_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(a){throw this.store.set("cart.error",a.message),this.logger.error("Failed to add item to cart",a),a}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(a.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_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 Error("Promo code is required");const a=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const c=await this.api.updateCart({id:e,items:[],promoCode:a,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(c)),this.store.set("cart.events",transformEventsForCart(c.events||[]));const l=(null===(r=null===(o=null===(i=c.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===r?void 0:r.toLowerCase())===a.toLowerCase();l?(this.store.set("cart.promoCode",{code:a,discountAmount:c.discounts||0}),this.googleTagManager.promoCodeApplied(a,c.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(c){const e=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",e),this.googleTagManager.promoCodeFailed(a,e),this.logger.error("Failed to apply promo code",c),c}}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",{...G,rerender:!![]}),this.store.set("cart",{...j,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSubService.publishAction(o.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}},a={};for(const c in i.items||{}){const e=i.items[c];a[c]={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:a,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:0,platformFee:i.totals.platformFee,shippingFee:i.totals.shippingFee,subtotal:i.totals.subtotal,total:i.totals.total},updatedAt:i.updatedAt,createdAt:i.createdAt}}buildItemUpdate(e,i){var o,r,a;const c={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:i},l=(null===(a=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===a?void 0:a.filter(e=>""!==e.trim()))||[];return l.length>0&&(c.engravingLines=l),c}syncItemsFromApiResponse(e,i=[]){var o;const r=this.store.get("cart.items")||{},a=new Set((null===(o=e.items)||void 0===o?void 0:o.map(e=>e.id))||[]);for(const l of Object.keys(r))a.has(l)||this.store.remove("cart.items."+l);const c={};for(const l of e.items)0!==i.length&&!i.includes(l.id)&&r[l.id]||(c["cart.items."+l.id]=buildCartItemStore(l));Object.keys(c).length>0&&this.store.batch(c)}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||[])},a=null===(o=null===(i=e.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value;if(a)r["cart.promoCode"]={code:a.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 a=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)}),c=null===(r=null==a?void 0:a.fulfillments)||void 0===r?void 0:r.find(i=>i.id===e);c&&a&&this.store.set("cart.fulfillments."+e,buildFulfillmentStore(c,a))}addNewFulfillmentAndRetailer(e,i){var o,r;const a=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)}),c=null===(r=null==a?void 0:a.fulfillments)||void 0===r?void 0:r.find(i=>i.id===e);if(c&&a){const i={["cart.fulfillments."+e]:buildFulfillmentStore(c,a),["cart.retailers."+a.id]:buildRetailerStore(a)};this.store.batch(i)}}cleanupAfterItemRemoval(e,i){var o,r,a,c;const l=this.store.get("cart.fulfillments."+e.fulfillmentId),d=this.store.get("cart.retailers."+e.retailerId);if(!l||!d)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)}),u=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===(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 if(this.store.remove("cart.fulfillments."+e.fulfillmentId),u){const o=null===(a=i.retailers)||void 0===a?void 0:a.find(i=>i.id===e.retailerId);o&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(o))}else this.store.remove("cart.retailers."+e.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),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 c of o.products){const a=c.sizes.filter(i=>e.some(e=>e===(i.upc||i.id||c.salsifyGrouping))),l=e.find(e=>a.some(i=>e===i.upc||e===i.id)||e===c.salsifyGrouping),d=l||(null===(i=null==a?void 0:a[0])||void 0===i?void 0:i.upc);await this.loadProduct(d,{products:[c],retailers:o.retailers}),r.push(d)}const a=e.filter(e=>-1===r.indexOf(e));this.store.batch(a.reduce((e,i)=>(e["products."+i+".loading"]=![],e["products."+i+".error"]="Product data not found",e),{}))}async loadProduct(e,i=null){var r,a;try{const c=this.store.get("products."+e);c.loading||this.store.set("products."+e+".loading",!![]);let l=null;if(i&&(l=i),i||(l=await this.api.getProductsData([e],this.getLocation())),!l||!(null===(r=null==l?void 0:l.products)||void 0===r?void 0:r[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(l);if(!d)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...d,identifier:e}),this.pubSub.publishAction(o.PRODUCT_LOADED,this.productDataForEventFromStore(e));const h=l.products[0],u=d.sizes[d.selectedSizeId||""],p=Boolean(this.getLocation()),m=d.selectedFulfillment,f=p&&(null==m?void 0:m.price)?m.price:(null===(a=d.priceInfo)||void 0===a?void 0:a.avg)||0,g=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:h.name,item_brand:h.brand,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(f),item_type:h.type,item_subtype:h.subType,upc:null==u?void 0:u.upc,grouping_id:h.salsifyGrouping,product_id:null==u?void 0:u.id})}catch(c){throw this.store.set("products."+e+".error",c.message),this.logger.error("Failed to load product data for ID "+e,c),c}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,i){var r,a,l,d,h,u,p;const m=this.store.get("products."+e);let f=m.selectedFulfillmentType;const g=null===(r=m.sizes[i])||void 0===r?void 0:r.shippingFulfillments,v=null===(a=m.sizes[i])||void 0===a?void 0:a.onDemandFulfillments;let y=null,b=null;if(f!==c.SHIPPING||objectValues(g).length)if(f!==c.ON_DEMAND||objectValues(v).length){const e=f===c.SHIPPING?g:v,i=objectValues(e);y=i[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=c.SHIPPING;const e=objectValues(g);y=e[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=c.ON_DEMAND;const e=objectValues(v);y=e[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}const x=f===c.SHIPPING?g:v,w=m.sizes[i],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_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,T=S||E;if(!T){const e=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:i,sizeName:null==w?void 0:w.size,upc:null==w?void 0:w.upc,groupingId:m.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(o.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:i,size:(null===(h=m.sizes[i])||void 0===h?void 0:h.size)||"",previousSizeId:m.selectedSizeId||"",previousSize:(null===(u=m.sizes[m.selectedSizeId])||void 0===u?void 0:u.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:i,["products."+e+".mainImage"]:(null===(p=m.sizes[i])||void 0===p?void 0:p.image)||null,["products."+e+".productHasAvailability"]:Object.keys(g).length+Object.keys(v).length>0,["products."+e+".fulfillmentHasAvailability"]:Boolean(Object.keys(x).length),["products."+e+".selectedFulfillmentType"]:f,["products."+e+".selectedFulfillment"]:y,["products."+e+".selectedFulfillmentId"]:b,["products."+e+".engravingLines"]:[]})}async selectFulfillment(e,i){var r,a,l;const d=this.store.get("products."+e),h=null===(r=d.sizes[d.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments,u=null===(a=d.sizes[d.selectedSizeId])||void 0===a?void 0:a.onDemandFulfillments,p=d.selectedFulfillmentType===c.SHIPPING?h:u,m=p[i];this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:i,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_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."+e+".selectedFulfillment"]:m,["products."+e+".selectedFulfillmentId"]:i,["products."+e+".engravingLines"]:[],["products."+e+".quantity"]:1})}async updateQuantity(e,i){var r;const a=this.store.get("products."+e),c=a.quantity,l=c+i,d=1,h=(null===(r=null==a?void 0:a.selectedFulfillment)||void 0===r?void 0:r.stock)||5,u=Math.max(d,Math.min(h,l));this.pubSub.publishAction(i<0?o.PRODUCT_QUANTITY_DECREASE:o.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:u,previousQuantity:c}),this.store.set("products."+e+".quantity",u)}async changeFulfillmentType(e,i){var r,a,l;const d=this.store.get("products."+e),{shippingFulfillments:h,onDemandFulfillments:u}=d.sizes[d.selectedSizeId],p=i===c.SHIPPING?h:u,m=objectValues(p);if(0===m.length){this.logger.warn("No fulfillments available for type "+i+" on product "+e);const o=this.store.get("address"),c=d.sizes[d.selectedSizeId],l=splitCategoryPath(d.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==c?void 0:c.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==c?void 0:c.size,fulfillmentType:i,upc:null==c?void 0:c.upc,groupingId:d.salsifyGrouping,address:(null==o?void 0:o.address)?{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country||""}:void 0,reason:"No "+i+" fulfillments available for selected size"}),void 0}const f=m[0]||null,g=(null==f?void 0:f.fulfillmentId)||null;this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:i,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_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."+e+".selectedFulfillmentType"]:i,["products."+e+".selectedFulfillment"]:f,["products."+e+".selectedFulfillmentId"]:g,["products."+e+".fulfillmentHasAvailability"]:m.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async updateEngravingLines(e,i){const r=this.store.get("products."+e);if(!r)return this.logger.warn("Product store for ID "+e+" does not exist."),void 0;this.store.set("products."+e+".engravingLines",i),this.pubSub.publishAction(o.PRODUCT_ENGRAVING_UPDATED,{identifier:e,engravingLines:i,previousEngravingLines:r.engravingLines||[]})}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(a.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+e+".engravingLines"]:[],["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_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(a.CHECKOUT),this.store.batch({["products."+e+".engravingLines"]:[],["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,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,shippingFulfillments:fulfillmentEventData(e.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(e.onDemandFulfillments||{})}}return{identifier:e,id:i.id,name:i.name,brand:i.brand,category:i.category,catPath:i.catPath,classification:i.classification,priceInfo:i.priceInfo||null,sizes:o}}findFirstAvailableSize(e){const i=objectValues(e);for(const o of i){const e=o.shippingFulfillments||{},i=o.onDemandFulfillments||{},r=objectValues(e).length,a=objectValues(i).length;if(r+a>0)return o.id}return null}loadProductStoreUpdate(e){var i,o,r,a,l,d,h,u,p,m,f;try{const{products:[g,...v],retailers:y}=e,b=this.themeProvider.getConfigs("product"),x={};let w=![],C=![],k="",S=null,E=b.layout.enableShippingFulfillment?c.SHIPPING:c.ON_DEMAND,T=null,P=null;const D={};if(y&&Array.isArray(y)&&y.length>0)for(const e of y)for(const i of e.fulfillments)D[i.id]={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:[]};if(g.sizes&&Array.isArray(g.sizes)&&g.sizes.length>0)for(const e of g.sizes){const l={},d={};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=D[e];i?d[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=D[e];i?l[e]={...i,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:e,fulfillmentType:c.SHIPPING,modalities:[...i.modalities,...null!==(a=null==h?void 0:h.modalities)&&void 0!==a?a:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+e)}}x[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:l,onDemandFulfillments:d}}const A=objectValues(x),_=this.findFirstAvailableSize(x);k=_||A[0]&&A[0].id||"",S=(null===(l=x[k])||void 0===l?void 0:l.image)||null;const z=(null===(d=x[k])||void 0===d?void 0:d.shippingFulfillments)||{},O=(null===(h=x[k])||void 0===h?void 0:h.onDemandFulfillments)||{},N=objectValues(z).length,R=objectValues(O).length;w=N+R>0;const B=E===c.SHIPPING?objectValues(z):objectValues(O);if(C=B.length>0,P=B[0]||null,T=(null==P?void 0:P.fulfillmentId)||null,!C){const e=E===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,i=e===c.SHIPPING?objectValues(z):objectValues(O);i.length>0&&(E=e,P=i[0],T=(null==P?void 0:P.fulfillmentId)||null,C=!![])}if(!w){const e=this.store.get("address"),i=splitCategoryPath(g.catPath),o=x[k];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:g.name,productBrand:g.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:g.type,productSubtype:g.subType,productPrice:(null===(u=g.priceInfo)||void 0===u?void 0:u.average)||0,upc:null==o?void 0:o.upc,groupingId:g.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: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,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:T,selectedFulfillment:P,drawer:{isOpen:![],contentConfig:null},engravingLines:[],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(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(i){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==i?void 0:i.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(o.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),i}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(o.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,i){try{const o=buildFormattedAddressString(e),r={id:"",formattedAddress:o,address:e,coordinates:i};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(o.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:e,coordinates:i,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}async clearSelectedAddress(){this.store.set("address",V),this.pubSub.publishAction(o.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.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 Error("Invalid placesId provided");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 Error("Invalid address or coordinates provided");if(!(e.one&&e.city&&e.state&&e.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof i.lat||"number"!=typeof i.long)throw new Error("Coordinates must be valid numbers");if(i.lat<-90||i.lat>90)throw new Error("Latitude must be between -90 and 90");if(i.long<-180||i.long>180)throw new Error("Longitude must be between -180 and 180");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(a.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(a.CART)},addProduct:async(e,i)=>{var r,l;try{if(!e||0===e.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=e,this.pendingCartOpenFlag=null!=i?i:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(a.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;i===!![]&&this.command.ui.openDrawer(a.CART);const h=[...new Set(e.map(e=>e.identifier))],u=await this.api.getProductsData(h,d);if(!u||!u.products||0===u.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const i of e){let e=null;for(let r=0;r<u.products.length;r++){const o=u.products[r];let a=![];for(let e=0;e<o.sizes.length;e++){const r=o.sizes[e];if(r.upc===i.identifier||r.id===i.identifier||o.salsifyGrouping===i.identifier){a=!![];break}}if(a){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===(l=null===(r=null==o?void 0:o.attributes)||void 0===r?void 0:r.presale)||void 0===l?void 0:l.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 a=null;for(let r=0;r<o.variants.length;r++){const e=o.variants[r];let l=![];if(i.fulfillmentType===c.ON_DEMAND&&(l=!(!e.fulfillmentTypes||!e.fulfillmentTypes.onDemand||""===e.fulfillmentTypes.onDemand)),i.fulfillmentType===c.SHIPPING&&(l=!(!e.fulfillmentTypes||!e.fulfillmentTypes.shipping||""===e.fulfillmentTypes.shipping)),l){a=e;break}}if(!a){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 d=i.fulfillmentType===c.ON_DEMAND?a.fulfillmentTypes.onDemand:a.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:o.upc,fulfillmentId:d,partNumber:a.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(o.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(d){throw this.logger.error("Error adding products to cart:",d),this.clearPendingCartOperation(),this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:d.message||"Failed to add products to cart"}),d}},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 i=e.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),a=r.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const c=this.store.get("cart.promoCode");if(c&&c.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(i);const l=this.command.cart.getDetails();this.pubSub.publishAction(o.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:l.amounts.discounts,newTotal:l.amounts.total}),this.logger.info("Promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply promo code:",i),this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode(),this.pubSub.publishAction(o.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(o.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(a.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(a.CHECKOUT)},addProduct:async(e,i)=>{try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;i===!![]&&this.command.ui.openDrawer(a.CHECKOUT);const r=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:r}),this.logger.info("Products added to checkout successfully:",r)}catch(r){throw this.logger.error("Error adding products to checkout:",r),this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:r.message||"Failed to add products to checkout"}),r}},applyPromoCode:async e=>{var i;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(),a=this.themeProvider.getConfigs("global"),c=a.layout.allowPromoCodes;if(!c)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(e);const d=this.store.get("checkout"),h=null==d?void 0:d.promoCode;this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==h?void 0:h.discountAmount)||0,newTotal:(null===(i=null==d?void 0:d.amounts)||void 0===i?void 0:i.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(o.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode(),this.pubSub.publishAction(o.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 i;try{const r=this.themeProvider.getConfigs("checkout"),a=r.layout.allowGiftCards;if(!a)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 c=this.store.get("checkout");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(i=null==c?void 0:c.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){throw this.logger.error("Failed to apply gift card:",r),this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),r}},removeGiftCard:async e=>{try{const i=this.themeProvider.getConfigs("checkout"),r=i.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(o.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(i){throw this.logger.error("Failed to remove gift card:",i),this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),i}},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 objectEntries(e))this.command.checkout.updateCustomerInfo(i,o)},updateBillingInfo:e=>{for(const[i,o]of objectEntries(e))this.command.checkout.updateBillingInfo(i,o)},updateGiftInfo:e=>{for(const[i,o]of objectEntries(e))this.command.checkout.updateGiftInfo(i,o)},getDetails:()=>{var e;const i=this.store.get("checkout"),o=i.items||{},r={};for(const[a,c]of Object.entries(o)){const e=c,{attributes:i,...o}=e;r[a]=o}return{cartId:i.cartId||"",amounts:i.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}}},items:r,isGift:i.isGift||![],hasAgeVerify:i.hasAgeVerify||![],hasPromoCode:!!(null===(e=i.promoCode)||void 0===e?void 0:e.code),hasGiftCards:Array.isArray(i.giftCards)&&i.giftCards.length>0,itemCount:Object.keys(o).length}}},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 L=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+o.ADDRESS_UPDATED,L)}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}}}function componentError({componentType:e,message:i}){const o=document.createElement("div");o.className=e;const r=o.attachShadow({mode:"closed"}),a=document.createElement("style");a.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 c=document.createElement("div"),l=document.createElement("h3");l.textContent="Component </"+e+">";const d=document.createElement("p");return d.textContent=i,c.appendChild(a),c.appendChild(l),c.appendChild(d),r.appendChild(c),o}function productionComponentError({title:e,message:i,componentType:o}){const r=document.createElement("div");r.setAttribute("data-component-type",o);const a=r.attachShadow({mode:"closed"}),c=document.createElement("style");c.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=e;const h=document.createElement("p");return h.textContent=i,l.appendChild(c),l.appendChild(d),l.appendChild(h),a.appendChild(l),r}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 Error("Component type ["+e.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(o)||window.customElements.define(o,i);const r=document.createElement(o);if(r.initialize){const{type:i,useShadowDom:a,wrapInLceElement:c,...l}=e,d={type:i,tagName:o,useShadowDom:a&&c!==!![]};r.initialize({data:l,config:d})}if(e.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(a.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(a.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,i);const c=document.createElement(o);return c.initialize(e.type,r),c}return r}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={[a.DRAWER]:"drawer-lc",[a.INPUT]:"input-lc",[a.BIRTHDATE_INPUT]:"birthdate-input-lc",[a.ENGRAVING_FORM]:"engraving-form-lc",[a.ENGRAVING_VIEW]:"engraving-view-lc",[a.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[a.POWERED_BY]:"powered-by-lc",[a.LCE_ELEMENT]:"lce-element",[a.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[a.ALERT]:"alert-lc",[a.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[a.ADDRESS]:"address-lc",[a.ADDRESS_INPUT]:"address-input-lc",[a.ADDRESS_DISPLAY]:"address-display-lc",[a.PRODUCT]:"product-lc",[a.PRODUCT_OPTIONS]:"product-options-lc",[a.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[a.PRODUCT_INTERACTIONS]:"product-interactions-lc",[a.PRODUCT_DESCRIPTION]:"product-description-lc",[a.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[a.PRODUCT_RETAILERS]:"product-retailers-lc",[a.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[a.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[a.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[a.PRODUCT_PRICE]:"product-price-lc",[a.PRODUCT_DRAWER]:"product-drawer-lc",[a.PRODUCT_LOADING]:"product-loading-lc",[a.PRODUCT_ENGRAVING]:"product-engraving-lc",[a.CART]:"cart-lc",[a.CART_RETAILER]:"cart-retailer-lc",[a.CART_ITEM]:"cart-item-lc",[a.CART_FOOTER]:"cart-footer-lc",[a.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[a.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[a.CART_PROMO_CODE]:"cart-promo-code-lc",[a.CART_HEADER]:"cart-header-lc",[a.CART_BODY]:"cart-body-lc",[a.CART_FULFILLMENT]:"cart-fulfillment-lc",[a.CHECKOUT]:"checkout-lc",[a.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[a.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[a.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[a.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[a.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[a.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[a.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[a.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[a.CHECKOUT_ITEMS]:"checkout-items-lc",[a.CHECKOUT_COMPLETED]:"checkout-completed-lc",[a.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[a.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[a.CHECKOUT_TIPS]:"checkout-tips-lc",[a.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[a.CHECKOUT_ITEM]:"checkout-item-lc",[a.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[a.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[a.CHECKOUT_HEADER]:"checkout-header-lc",[a.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[a.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return i[e]||e.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const lt="\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",dt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const e=LoggerFactory,i=e.instances;if(i)for(const[r,a]of i)this.interceptLoggerInstance(a,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),a=e.warn.bind(e),c=e.error.bind(e),s=(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(s("debug",e,i))},e.info=(e,i)=>{r(e,i),this.addLogEntry(s("info",e,i))},e.warn=(e,i)=>{a(e,i),this.addLogEntry(s("warn",e,i))},e.error=(e,i)=>{c(e,i),this.addLogEntry(s("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(dt);e&&e.remove(),this.panelElement=document.createElement(dt);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=lt,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 a=this.createResizeHandle();this.panelContainer.appendChild(a),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 a=document.createElement("div");a.className="subtitle",a.textContent="Live SDK logs, events & GTM tracking",o.appendChild(r),o.appendChild(a);const c=document.createElement("button");return c.className="minimize",c.innerHTML="−",c.title="Minimize debug panel",c.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(i),e.appendChild(o),e.appendChild(c),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:a})=>{const c=document.createElement("label");c.className="toggle",c.title=r;const l=document.createElement("input");l.type="checkbox",l.checked="showLogs"!==i,l.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 d=document.createElement("span");d.textContent=o,d.style.color=a,c.appendChild(l),c.appendChild(d),e.appendChild(c)});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,a=0,c=0;e.addEventListener("mousedown",e=>{i=!![],o=e.clientX,r=e.clientY,a=Number.parseInt(this.panelElement.style.width,10)||500,c=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",t),document.addEventListener("mouseup",M),e.preventDefault()});const t=e=>{if(!i||!this.panelElement)return;const l=e.clientX-o,d=e.clientY-r,h=window.innerWidth<=768,u=window.innerWidth<=480;let p,m,f,g;u?(p=280,m=window.innerWidth-20,f=200,g=.4*window.innerHeight):h?(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,a+l)),y=Math.max(f,Math.min(g,c+d));this.panelElement.style.width=v+"px",this.panelElement.style.height=y+"px"},M=()=>{i=![],document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",M)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const i=e.querySelector(".header");if(i){let e=![],o=0,r=0,a=0,c=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;e=!![],o=i.clientX,r=i.clientY;const l=this.panelElement.getBoundingClientRect();a=l.left,c=l.top,document.addEventListener("mousemove",t),document.addEventListener("mouseup",M),i.preventDefault()});const t=i=>{if(!e||!this.panelElement)return;const l=i.clientX-o,d=i.clientY-r;this.panelElement.style.left=a+l+"px",this.panelElement.style.top=c+d+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},M=()=>{e=![],document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",M)}}}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=B,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.l()){const i=this.h(e);if(i)return this.u(e,i)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const i=this.u(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()}u(e,i){return(e+"_"+i).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{if(0,!("localStorage"in window))return this.isLocalStorageAvailable=![],![];if(void 0===window.localStorage||null===window.localStorage)return this.isLocalStorageAvailable=![],![];if("object"!=="object".localStorage)return this.isLocalStorageAvailable=![],![];const i=["setItem","getItem","removeItem","clear"];for(const e of i)if("function"!=="object".localStorage[e])return this.isLocalStorageAvailable=![],![];const o="__localStorage_test_"+Date.now()+"__",r="test";window.localStorage.setItem(o,r);const a=window.localStorage.getItem(o);if(a!==r)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(o);try{const e="__quota_test__",i="x".repeat(100);window.localStorage.setItem(e,i),window.localStorage.removeItem(e)}catch(e){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(i){if(this.isLocalStorageAvailable=![],i instanceof DOMException){const e={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},o=e[i.name]||"Storage error: "+i.name,r=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+r+": "+o)}return![]}}h(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.T(i)}v(){try{const e=screen,i=e.colorDepth||24,o=e.pixelDepth||i,r=this.I(),a=Math.round(100*(window.devicePixelRatio||1));return i+"|"+o+"|"+r+"|"+a}catch(e){return"24|24|srgb|100"}}I(){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(R){}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 a=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(a),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 c=["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(c.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"}}T(e){const i=16777619;let o=2166136261,r=2166136261,a=2166136261,c=2166136261;for(let l=0;l<e.length;l++){const d=e.charCodeAt(l);o^=d,o=Math.imul(o,i),r^=d<<1,r=Math.imul(r,i),a^=d<<2,a=Math.imul(a,i),c^=d<<3,c=Math.imul(c,i)}return o=Math.abs(o),r=Math.abs(r),a=Math.abs(a),c=Math.abs(c),o.toString(16)+r.toString(16)+a.toString(16)+c.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();const e=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:o,batchSize:e===i.PRODUCTION?5:10,batchInterval:e===i.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(),a="event_"+r+"_"+Math.random().toString(36).slice(2,11);try{const c={eventId:a,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(){return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![]}}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(),o="batch_"+i+"_"+Math.random().toString(36).slice(2,9);return{batchId:o,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 Error("XHR request failed with status: "+i.status)}catch(i){throw new Error("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.D=Object.freeze(e),this.F=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.D[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.F.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.F)||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.F)||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.F)||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.F.tagName+" watching path: "+o)}handleAutoDestroy(e){var i;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.F.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.F.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.D)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+"]",a=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,e);a!==![]&&this.triggerRender(r)}catch(r){this.logger.error("Store watcher callback error in "+((null===(o=this.F)||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.F)||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.D)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.F)||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.F)||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 a=performance.now()-o;this.logRenderInfo(a);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(r){this.logger.error("❌ afterRender hook error in "+this.F.tagName,r),r instanceof Error&&this.captureComponentError(r,"afterRender")}}catch(a){const e=performance.now()-o;this.logger.error("❌ Component render error in "+this.F.tagName,a),this.captureComponentError(a,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:a instanceof Error?a.message:String(a)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,a,"render")}catch(c){this.logger.error("❌ onError hook error in "+this.F.tagName,c)}}}logRenderInfo(e){const i=this.F.type,o=this.F.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.F.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.F.tagName+":"+i,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.F.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.D}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}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:a.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,i,o,r;const c=this.getStoreValue("address"),l=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],d=null!==(i=this.params.productId)&&void 0!==i?i:"",h=null!==(o=this.params.options)&&void 0!==o?o:{},u=null!==(r=h.showLabel)&&void 0!==r?r:!![],p=[];if(u){const e=document.createElement("span");e.textContent="Delivers to:",p.push(e)}const m=document.createElement("button");m.type="button",m.textContent=c.formattedAddress||"Select an address";const f=c.formattedAddress?"Change delivery address, currently set to "+c.formattedAddress:"Select delivery address";return m.setAttribute("aria-label",f),m.addEventListener("click",async()=>{if(l)return this.commands.ui.openDrawer(a.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!l&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(a.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,a.ADDRESS_INPUT,{productId:d}))}),p.push(m),p}}const ArrowRightIcon=({width:e=16,height:i=16,className:o="",color:r=null})=>{const a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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 a=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="'+a+'" 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(R){this.logger.error("Address edit cancellation failed",R)}},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"),a=null!==(e=this.params.options)&&void 0!==e?e:{},c=null!==(i=a.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),c){const e=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(e)}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===(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),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 h=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),u=[this.inputContainer,h,this.errorContainer],p=this.createElement("div",{className:"action-buttons"}),m=this.createCancelButton();p.appendChild(m);const f=this.createCheckButton();return p.appendChild(f),u.push(p),document.addEventListener("click",this.handleDocumentClick),u}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:a.CART_HEADER});e.push(i)}const o=ComponentFactoryService.createElement({type:a.CART_BODY});e.push(o);const r=ComponentFactoryService.createElement({type:a.CART_FOOTER});return e.push(r),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:a.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),a=this.getValidRetailerIds(i.value),c=r.size,l=a.size,d=this.getValidRetailers(this.getStoreValue("cart.retailers")),h=Object.keys(d).length;if(l>0&&0===h)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===c&&l>0){this.container.innerHTML="";for(const[e,i]of Object.entries(o))this.addRetailerElement(e,i)}else if(c>0&&0===l)this.showEmptyCartState();else if(l>0){for(const e of r)a.has(e)||this.removeRetailerElement(e);for(const i of a){const a=o[i],c=e[i];r.has(i)?this.hasRetailerDataChanged(c,a)&&this.updateRetailerElement(i,a):this.addRetailerElement(i,a)}}else 0===c&&0===l&&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")),a=e.some(e=>"cart.loading"===e.path),c=e.some(e=>e.path.includes("cart.retailers"));if(i&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice){const e=this.getStoreValue("cart.totals.subtotal")||0,i=this.getStoreValue("cart.totals.engravingFee")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(e+i)}(r||o||a||i||c)&&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")||{},a=Object.values(r).some(e=>e.updating);if(a)return!![];const c=this.getStoreValue("cart.retailers")||{},l=Object.values(c).some(e=>e.updating);return l?!![]:![]}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":"")+"):")}template(){const e=this.getConfigs("global"),i=this.getStoreValue("cart.totals.subtotal")||0,o=this.getStoreValue("cart.totals.engravingFee")||0,r=[],c=document.createElement("div");c.className="cart-footer-header";const l=document.createElement("div");l.className="cart-footer-items-price";const d=document.createElement("span");d.className="subtotal-text",d.textContent="Subtotal (0 items):",this.subtotalText=d,l.appendChild(d);const h=document.createElement("span");h.className="subtotal-price",h.textContent=formatCentToDollarText(i+o),this.subtotalPrice=h,l.appendChild(h);const u=document.createElement("p");if(u.textContent="Taxes & fees will be calculated at checkout",u.className="taxes-fees-info",c.appendChild(l),c.appendChild(u),r.push(c),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:a.CART_PROMO_CODE});r.push(e)}const p=ComponentFactoryService.createElement({type:a.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});r.push(p);const m=document.createElement("button");if(m.type="button",m.className="checkout-button",m.addEventListener("click",async e=>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)),m.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=m,r.push(m),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"general"});r.push(e)}return r}}const ht={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"},ut="America/New_York";function detectUserTimezone(e){try{if(e){const i=e.toUpperCase(),o=ht[i];return o||ut}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return ut}}function getCurrentTimeInTimezone$1(e){try{const i=new Date,o=i.getTime(),r=6e4*i.getTimezoneOffset(),a=new Date(o+r),c=new Date(a.toLocaleString("en-US",{timeZone:e})),l=a.getTime()-c.getTime();return new Date(o+l)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(e){const i=detectUserTimezone(e);return getCurrentTimeInTimezone$1(i)}function isDateTimeInRange(e){const{startDate:i,endDate:o,addressState:r}=e;try{const e=getCurrentTimeInUserTimezone(r),a=!i||e>=new Date(i),c=!o||e<=new Date(o);return a&&c}catch(a){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 r=this.config.layout.drawerHeaderText,c=this.getConfigs("global"),l=document.createElement("div");l.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=r,l.appendChild(d);const h=document.createElement("button");h.type="button",h.className="cart-header-close-btn",h.innerHTML=CloseIcon({width:16,height:16}),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),l.appendChild(h);const u=this.clientConfig.get("promoTicker"),p=null!==(i=null===(e=null==c?void 0:c.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],m=null!=u?u:p,f=this.store.get("address"),g=hasActiveItems(m,null===(o=null==f?void 0:f.address)||void 0===o?void 0:o.state);if(!m.length||!g)return[l];const v=ComponentFactoryService.createElement({context:"cart",type:a.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.getItemId()}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}getItemId(){return this.params.itemId}onStoreChanged(e){const i=this.getItemId(),o=e.find(e=>e.path==="cart.items."+i);if(null==o?void 0:o.oldValue){const e=o.oldValue,i=o.value,r=e.attributes.engraving.lines&&e.attributes.engraving.lines.length>0,a=i.attributes.engraving.lines&&i.attributes.engraving.lines.length>0;r!==a&&(this.handleEngravingElement(),this.updateShippingTime())}return![]}handleEngravingElement(){const e=this.getConfigs("global");if(!e.layout.enablePersonalization)return;const i=this.getItemId(),o=this.getStoreValue("cart.items."+i),r=o.attributes.engraving.lines&&o.attributes.engraving.lines.length>0,c=this.container.querySelector(".engraving-view-container");c&&c.remove();const l=ComponentFactoryService.createElement({type:a.ENGRAVING_VIEW,identifier:i,context:"cart",watchStorePaths:["cart.items.{identifier}"]}),d=this.container.querySelector(".item-shipping-container"),h=this.container.querySelector(".cart-item");r?h&&h.insertAdjacentElement("afterend",l):d&&d.appendChild(l)}updateShippingTime(){var e;const i=this.getItemId(),o=this.getStoreValue("cart.items."+i),r=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),a=o.attributes.engraving.lines&&o.attributes.engraving.lines.length>0,c=a?"10 days":(null===(e=null==r?void 0:r.expectation)||void 0===e?void 0:e.short)||"2-3 days",l=this.container.querySelector(".item-shipping span");l&&(l.textContent="Ships in "+c)}template(){var e;const i=this.getItemId(),o=this.getStoreValue("cart.items."+i),r=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),c=o.attributes.engraving.lines&&o.attributes.engraving.lines.length>0,l=c?"Ships in 10 days":(null===(e=null==r?void 0:r.expectation)||void 0===e?void 0:e.detail)||"",d=document.createElement("article");d.className="cart-item";const h=document.createElement("div");h.className="item-image";const u=document.createElement("img");u.src=o.mainImage,u.alt=o.name,h.appendChild(u);const p=document.createElement("div");p.className="item-details";const m=document.createElement("div");m.className="item-header";const f=document.createElement("h3");f.className="item-title",f.textContent=o.name;const g=document.createElement("button");g.className="item-delete",g.innerHTML=TrashIcon({}),g.addEventListener("click",async()=>{await this.commands.cart.removeItem(i)}),m.appendChild(f),m.appendChild(g);const v=document.createElement("div");v.className="item-specs",v.textContent=o.size+", "+o.container;const y=document.createElement("div");y.className="item-shipping-container";const b=document.createElement("div");b.className="item-shipping";const x=document.createElement("span");x.textContent=""+l,b.appendChild(x),y.appendChild(b),p.appendChild(m),p.appendChild(v),p.appendChild(y),d.appendChild(h),d.appendChild(p);const w=[d],C=ComponentFactoryService.createElement({type:a.CART_ITEM_QUANTITY_PRICE,itemId:i});return w.push(C),w}afterRender(){this.handleEngravingElement()}}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 a=this.getItemStore();if(!a)return 0;const c=a.partNumber,l=a.fulfillmentId,d=this.getStoreValue("cart.items")||{},h=Object.values(d).filter(e=>e.partNumber===c&&e.fulfillmentId===l),u=h.reduce((e,i)=>e+i.quantity,0),p=this.getStoreValue("products."+a.upc)||this.getStoreValue("products."+a.salsifyGrouping);if(!p)return a.maxQuantity-u;const m=null!==(r=null===(o=null===(i=null===(e=null==p?void 0:p.sizes)||void 0===e?void 0:e[a.liquidId])||void 0===i?void 0:i.attributes)||void 0===o?void 0:o.maxQuantityPerOrder)&&void 0!==r?r:0;return!m||m<=0?a.maxQuantity-u:m-u}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),a=Boolean(null==e?void 0:e.code);if(!r&&a)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(r&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;if(a&&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.addEventListener("click",async()=>{await 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,o=this.getStoreValue("cart.loading"),r=this.getStoreValue("cart.promoCode"),a=this.getStoreValue("cart.events")||[],c=hasCartAnyPromoCodeEvents(a);this.applyButton.disabled=!i||o||Boolean(null==r?void 0:r.discountAmount)||this.isApplying||c}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:20},onChange:e=>{const i=e.toUpperCase(),o=this.promoInput;o.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.applyButton.disabled=!![],await this.commands.cart.applyPromoCode(e)}catch(i){this.logger.error("Cart promo code application failed",{promoCode:e,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),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.addEventListener("click",async()=>{await 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:a.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 a of o)r.has(a)||this.removeFulfillmentElement(a);for(const a of r)o.has(a)||this.addFulfillmentElement(a)}setupFulfillmentElements(){const e=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const a of o)a.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 a of i)this.addFulfillmentElement(a)}setupSubtotalElement(){const e=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const o=ComponentFactoryService.createElement({type:a.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)||[],a=(null==i?void 0:i.fulfillments)||[];JSON.stringify(o)!==JSON.stringify(a)&&this.handleFulfillmentsUpdate(o,a)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section");e&&i&&(e.addEventListener("change",()=>{e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed")}),e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"))}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 a=document.createElement("div");a.className="retailer-info";const c=document.createElement("h2");c.className="section-title",c.textContent=i.name,a.appendChild(c);const l=document.createElement("input");l.type="checkbox",l.id=i.id,l.className="section-toggle",a.appendChild(l);const d=document.createElement("label");d.htmlFor=i.id,d.className="section-header-label";const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),d.appendChild(h),a.appendChild(d),r.appendChild(a),o.appendChild(r);const u=document.createElement("div");u.className="retailer-body-container";const p=document.createElement("div");p.id="retailer-fulfillment-container",u.appendChild(p);const m=document.createElement("div");return m.id="retailer-subtotal-container",u.appendChild(m),o.appendChild(u),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 a of o)r+=a.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"),a=this.getRetailerItemCount(r,e),c=1===a?"item":"items",l=document.createElement("h3");l.className="retailer-subtotal-header",l.textContent="Subtotal ("+a+" "+c+"):";const d=document.createElement("span");return d.className="retailer-subtotal-amount",d.textContent=formatCentToDollarText(i+o),[l,d]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var e,i,o;const r=this.store.get("checkout.isPresaleLocked"),c=this.store.get("checkout.presaleExpiresAt"),l=this.getConfigs("global"),d=this.clientConfig.get("promoTicker"),h=null!==(i=null===(e=null==l?void 0:l.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],u=null!=d?d:h,p=this.store.get("address"),m=hasActiveItems(u,null===(o=null==p?void 0:p.address)||void 0===o?void 0:o.state),f=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),g=r&&c,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:a.CHECKOUT_INFORMATION_SECTION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:a.CHECKOUT_SUMMARY_SECTION});if(v.appendChild(b),!g&&(!u.length||!m)&&f)return[v];const x=document.createElement("div");if(x.classList.add("checkout-header-wrapper"),!f){const e=ComponentFactoryService.createElement({type:a.CHECKOUT_HEADER});x.appendChild(e)}if(u.length&&m&&!g){const e=ComponentFactoryService.createElement({context:"checkout",type:a.PROMO_CODE_TICKER,tickers:u});x.appendChild(e)}if(g){const e=ComponentFactoryService.createElement({type:a.CHECKOUT_PRESALE_COUNTDOWN});x.appendChild(e)}return[x,v]}}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(a.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),o.appendChild(e)}const r=document.createElement("h1");r.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",r.classList.add("checkout-header-title"),r.setAttribute("aria-label","Checkout Page");const c=document.createElement("button");return c.innerHTML=CloseIcon({width:16,height:16}),c.classList.add("checkout-header-button-close"),c.setAttribute("aria-label","Close Checkout"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o?[o,r,c]:[r,c]}}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:a.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:a.CHECKOUT_DELIVERY_INFORMATION_FORM});e.push(i);const o=ComponentFactoryService.createElement({type:a.CHECKOUT_PAYMENT_FORM});e.push(o);const r=ComponentFactoryService.createElement({type:a.CHECKOUT_BILLING_FORM});return e.push(r),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 a of o){const i=null===(e=this.rootElement)||void 0===e?void 0:e.closest(a);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,a=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<a&&(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,a=Math.max(0,Math.min(100,r/this.totalDuration*100)),c=o<60;if(c!==this.isUnderOneMinute){this.isUnderOneMinute=c;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 l=this.rootElement.querySelector("[data-timer]");l&&(l.textContent=this.formatTime(i));const d=this.rootElement.querySelector("[data-progress-fill]");d&&(d.style.width=a+"%"),0===i&&this.handleExpire()}formatTime(e){const i=Math.floor(e/1e3),o=Math.floor(i/60),r=i%60,a=Math.floor(e%1e3/10);return o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")}handleExpire(){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 a=document.createElement("div");a.classList.add("checkout-presale-timer"),a.setAttribute("data-timer",""),a.textContent="00:00:00",o.appendChild(r),o.appendChild(a);const c=document.createElement("p");c.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",c.classList.add("checkout-presale-subtitle"),i.appendChild(o),i.appendChild(c);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),e.appendChild(i),e.appendChild(l),e}}const pt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],mt={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(pt.includes(o)){const e=document.createElement(o),r=mt[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 a=document.createDocumentFragment();for(const e of Array.from(o.body.childNodes)){const i=cleanNode(e);i&&a.appendChild(i)}const c=document.createElement("div");return c.appendChild(a),c.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)}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 a=document.createElement("span");a.id="emailOptIn",a.classList.add("checkout-checkbox-visual"),r&&a.classList.add("checked"),a.innerHTML=CheckboxIcon({width:16,height:16}),a.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),a.classList.toggle("checked")});const c=document.createElement("label");c.setAttribute("for","emailOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(e.text),c.addEventListener("click",e=>{const i=e.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),a.classList.toggle("checked"))}),i.appendChild(a),i.appendChild(c),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 a=document.createElement("span");a.classList.add("checkout-checkbox-visual"),a.id="smsOptIn",r&&a.classList.add("checked"),a.innerHTML=CheckboxIcon({width:16,height:16}),a.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),a.classList.toggle("checked")});const c=document.createElement("label");c.setAttribute("for","smsOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(i.text),c.addEventListener("click",e=>{const i=e.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),a.classList.toggle("checked"))}),e.appendChild(a),e.appendChild(c),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"),r=this.getConfigs("checkout"),c=this.getConfigs("global"),l=r.layout.allowGiftCards,d=null===(e=null==c?void 0:c.layout)||void 0===e?void 0:e.allowPromoCodes,h=document.createElement("div");h.classList.add("section-title-container");const u=document.createElement("h3");u.textContent="Order Summary",u.classList.add("section-title"),h.appendChild(u),i.push(h);const p=ComponentFactoryService.createElement({type:a.CHECKOUT_ITEMS});i.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),i.push(m),l||d){const e=ComponentFactoryService.createElement({type:a.CHECKOUT_PC_GC});i.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:a.CHECKOUT_TIPS});i.push(e),i.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),i.push(g);const b=ComponentFactoryService.createElement({type:a.CHECKOUT_AMOUNTS});i.push(b);const x=ComponentFactoryService.createElement({type:a.CHECKOUT_PLACE_ORDER_BUTTON});i.push(x);const w=this.marketingOptInsContainer();if(w&&i.push(w),r.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(r.layout.legalMessage.text);const a=document.createElement("div");a.classList.add("checkout-separator"),i.push(e),i.push(o),i.push(a)}if(o.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:a.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($.firstName,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.firstName,fieldValue:e})}async handleLastNameChange(e){this.commands.checkout.updateBillingInfo($.lastName,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.lastName,fieldValue:e})}async handleEmailChange(e){this.commands.checkout.updateBillingInfo($.email,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.email,fieldValue:e})}async handlePhoneChange(e){this.commands.checkout.updateBillingInfo($.phone,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.phone,fieldValue:e})}async handleCompanyChange(e){this.commands.checkout.updateBillingInfo($.company,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.company,fieldValue:e})}async handleAddressOneChange(e){this.commands.checkout.updateBillingInfo($.addressOne,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.addressOne,fieldValue:e})}async handleAddressTwoChange(e){this.commands.checkout.updateBillingInfo($.addressTwo,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.addressTwo,fieldValue:e})}async handleCityChange(e){this.commands.checkout.updateBillingInfo($.city,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.city,fieldValue:e})}async handleStateChange(e){this.commands.checkout.updateBillingInfo($.state,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.state,fieldValue:e})}async handleZipCodeChange(e){this.commands.checkout.updateBillingInfo($.zipCode,e),this.pubSub.publishForm(r.BILLING,{fieldName:$.zipCode,fieldValue:e})}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"),e&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()});const a=document.createElement("label");return a.textContent="Billing address same as shipping address",a.setAttribute("for","billingSameAsShipping"),a.classList.add("billing-checkbox-label"),o.appendChild(r),o.appendChild(a),i.appendChild(o),i}template(){const e=this.getStoreValue("checkout.billingSameAsShipping"),i=[],o=this.billingSameAsShippingToggle();if(i.push(o),e)return i;const r=document.createElement("div");r.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Your billing info",c.classList.add("section-title"),r.appendChild(c);const l=document.createElement("p");l.textContent="Provide the info relevant to your payment method",l.classList.add("section-subtitle"),r.appendChild(l),i.push(r);const d=document.createElement("div");d.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});h.appendChild(u);const p=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});h.appendChild(p),d.appendChild(h);const m=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:$.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});d.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:$.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});f.appendChild(g);const v=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});f.appendChild(v),d.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});y.appendChild(b);const x=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});y.appendChild(x),d.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-three-col-container");const C=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});w.appendChild(C);const k=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.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"});w.appendChild(k);const S=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:$.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return w.appendChild(S),d.appendChild(w),i.push(d),i}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(e){this.commands.checkout.updateCustomerInfo(Q.firstName,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.firstName,fieldValue:e})}async handleLastNameChange(e){this.commands.checkout.updateCustomerInfo(Q.lastName,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.lastName,fieldValue:e})}async handleEmailChange(e){this.commands.checkout.updateCustomerInfo(Q.email,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.email,fieldValue:e})}async handlePhoneChange(e){this.commands.checkout.updateCustomerInfo(Q.phone,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.phone,fieldValue:e})}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(Q.company,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.company,fieldValue:e})}async handleDobChange(e){this.commands.checkout.updateCustomerInfo(Q.birthDate,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.birthDate,fieldValue:e})}template(){const e=this.store.get("checkout.customer"),i=[],o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Buyer Information",r.classList.add("section-title"),o.appendChild(r);const c=document.createElement("p");c.textContent="Buyer information is used to process your order and for delivery purposes.",c.classList.add("section-subtitle"),o.appendChild(c),i.push(o);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:Q.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});d.appendChild(h);const u=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:Q.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});d.appendChild(u),l.appendChild(d);const p=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:Q.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:this.handleCompanyChange.bind(this)});l.appendChild(p);const m=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:Q.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});l.appendChild(m);const f=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:Q.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});l.appendChild(f);const g=ComponentFactoryService.createElement({type:a.BIRTHDATE_INPUT,inputType:"date",name:Q.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return l.appendChild(g),i.push(l),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(X.firstName,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.firstName,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(Q.firstName,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.firstName,fieldValue:e}))}async handleLastNameChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(X.lastName,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.lastName,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(Q.lastName,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.lastName,fieldValue:e}))}async handleEmailChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(X.email,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.email,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(Q.email,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.email,fieldValue:e}))}async handlePhoneChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(X.phone,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.phone,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(Q.phone,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.phone,fieldValue:e}))}async handleAddressTwoChange(e){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo(X.addressTwo,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.addressTwo,fieldValue:e})):(this.commands.checkout.updateCustomerInfo(Q.addressTwo,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.addressTwo,fieldValue:e}))}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(Q.company,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.company,fieldValue:e})}async handleBirthdateChange(e){this.commands.checkout.updateCustomerInfo(Q.birthDate,e),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Q.birthDate,fieldValue:e})}async handleGiftMessageChange(e){this.commands.checkout.updateGiftInfo(X.message,e),this.pubSub.publishForm(r.GIFT,{fieldName:X.message,fieldValue:e})}template(){const e=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift")||![],o=this.store.get("checkout.giftRecipient"),r=this.store.get("checkout.customer"),c=this.store.get("address.formattedAddress"),l=i?o:r,d=[],h=document.createElement("div");h.classList.add("delivery-header-container");const u=document.createElement("div");u.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",i);const w=document.createElement("div");w.classList.add("toggle-slider"),x.appendChild(w),g.appendChild(v),g.appendChild(x),x.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),h.appendChild(g),h.appendChild(p),d.push(h);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:a.INPUT,inputType:"text",name:i?X.firstName:Q.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:l.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:i?"giftRecipient.firstName":"customer.firstName"});k.appendChild(S);const E=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:i?X.lastName:Q.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:l.lastName,onChange:this.handleLastNameChange.bind(this),storePath:i?"giftRecipient.lastName":"customer.lastName"});if(k.appendChild(E),C.appendChild(k),!i){const e=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:Q.company,label:"Company (optional)",autocomplete:!![],value:l.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});C.appendChild(e)}const T=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:i?X.email:Q.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:l.email,onChange:this.handleEmailChange.bind(this),storePath:i?"giftRecipient.email":"customer.email"});C.appendChild(T);const P=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:i?X.phone:Q.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:l.phone,onChange:this.handlePhoneChange.bind(this),storePath:i?"giftRecipient.phone":"customer.phone"});if(C.appendChild(P),!i){const e=ComponentFactoryService.createElement({type:a.BIRTHDATE_INPUT,inputType:"date",name:Q.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(l.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});C.appendChild(e)}const D=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:c,disabled:!![],className:"disabled-input",validation:{required:!![]}});C.appendChild(D);const A=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:i?X.addressTwo:Q.addressTwo,label:"Apt, suite, etc. (optional)",value:l.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:i?"giftRecipient.addressTwo":"customer.addressTwo"});if(C.appendChild(A),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.value=this.store.get("checkout.deliveryInstructions")||"",r.addEventListener("blur",async e=>{await this.handleDeliveryInstructionsChange(e.target.value)});const a=document.createElement("p");a.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",a.classList.add("textarea-message-disclaimer"),i.appendChild(o),i.appendChild(r),i.appendChild(a),C.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",X.message);const a=document.createElement("textarea");a.name=X.message,a.id=X.message,a.rows=4,a.value=o.message||"",a.addEventListener("input",async e=>{await this.handleGiftMessageChange(e.target.value)});const c=document.createElement("p");c.textContent="Your gift message will be emailed to the recipient along with delivery details.",c.classList.add("textarea-message-disclaimer"),i.appendChild(r),i.appendChild(a),i.appendChild(c),C.appendChild(i)}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 e=this,i=null;for(;e&&e!==document.body;){const o=e.hasAttribute("checkout"),r=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(a.LCE_ELEMENT),c=e.hasAttribute("drawer"),l=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(a.DRAWER),d="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(o||r&&c&&l&&d)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="'+K+'"]');if(o.length>0)for(const a of o)a.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:a.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.stripeFormElement.setAttribute("slot",K),i.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(r){this.logger.error("Stripe form element creation failed",r),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 a=document.createElement("slot");return a.setAttribute("name",K),e.push(a),e}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this._=null,this.O=null,this.N=null,this.M=![],this.L=![],this.R=![]}async initialize({data:e}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=e.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const e=this.B;this._=window.Stripe(e.publishableKey),this.O=this._.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.L=o,await this.updateStripeFormStatus({isComplete:o,hasError:i,errorMessage:r,isProcessing:this.M})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.M})}),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.M){this.M=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("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.L,isProcessing:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}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",n),i(new Error("Session refresh timeout"))},5e3),n=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",n),e()};this.addEventListener("lce:s:refreshSession",n,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(R){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 Error("Elements must be provided");try{const{error:e}=await this.O.submit();if(e)throw new Error(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._.createConfirmationToken(i);if(o)throw new Error(o.message);if(!r||!r.id)throw new Error("Confirmation token not found");return r.id}catch(e){throw new Error(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._=null,this.M=![],this.L=![],this.R=![],this.A=![],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"),a=Boolean(r.promoCode),c=Boolean(null===(e=r.giftCards)||void 0===e?void 0:e.length),l=this.getConfigs("global"),d=Object.values(r.items||{}),h=[],u=document.createElement("div");u.classList.add("checkout-amount-line");const p=document.createElement("span");p.textContent="Subtotal ("+d.length+" item"+(d.length>1?"s":"")+")",u.appendChild(p);const m=document.createElement("span");m.textContent=formatCentToDollarText(r.amounts.subtotal),u.appendChild(m),h.push(u);const f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Shipping",f.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(r.amounts.shipping),f.appendChild(v),h.push(f);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Delivery",y.appendChild(b);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(r.amounts.delivery),y.appendChild(x),h.push(y),(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),h.push(e)}const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Taxes & Fees",w.appendChild(C);const k=document.createElement("span");if(k.textContent=formatCentToDollarText(r.amounts.tax+r.amounts.service+r.amounts.platform),w.appendChild(k),h.push(w),a){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 a=document.createElement("span");a.textContent="-"+formatCentToDollarText(r.amounts.discounts),e.appendChild(a),h.push(e)}if(c){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),h.push(e)}const S=document.createElement("div");S.classList.add("checkout-amount-line");const E=document.createElement("span");E.textContent="Tips",S.appendChild(E);const T=document.createElement("span");T.textContent=formatCentToDollarText(r.amounts.tip),S.appendChild(T),h.push(S);const P=document.createElement("div");P.classList.add("checkout-separator"),S.appendChild(P),h.push(P);const D=document.createElement("div");D.classList.add("checkout-amount-total");const A=document.createElement("span");A.textContent="Total",D.appendChild(A);const _=document.createElement("span");_.textContent=formatCentToDollarText(r.amounts.total),D.appendChild(_),h.push(D);const z=this.store.get("checkout.isPresaleLocked");if(z){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),h.push(e);const r=document.createElement("div");r.classList.add("checkout-presale-locked-message");const a=htmlStringToElement(InfoIcon({color:l.theme.defaultTextColor}));r.appendChild(a);const c=document.createElement("p");c.textContent="Pre-ordered items will be charged when shipped.",r.appendChild(c),h.push(r)}return h}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const e=[],i=this.getConfigs("configurations"),o=this.getConfigs("global"),r=this.getConfigs("checkout"),c=this.config.layout.exitUrl||window.location.host,l=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const o=document.createElement("div");o.classList.add("checkout-completed-header-container");const r=document.createElement("img");r.src=this.config.theme.checkoutCompleted.customLogo,r.alt=i.partnerName+" Logo",o.appendChild(r),e.push(o)}const d=document.createElement("div");d.classList.add("checkout-completed-section-container");const h=document.createElement("div");h.classList.add("checkout-completed-title-container");const u=document.createElement("div");u.classList.add("checkout-completed-title-section");const p=document.createElement("h3");p.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",u.appendChild(p);const m=document.createElement("p");m.textContent="Your payment has been successfully processed.",u.appendChild(m),h.appendChild(u),d.appendChild(h);const f=document.createElement("div");f.classList.add("checkout-completed-sub-section");const g=document.createElement("div");g.classList.add("checkout-completed-line");const v=document.createElement("h3");v.textContent="Order Number",g.appendChild(v);const y=document.createElement("span");y.textContent=this.params.orderNumber,g.appendChild(y),f.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-completed-line");const x=document.createElement("h3");x.textContent="Order Amount",b.appendChild(x);const w=document.createElement("span");w.textContent=""+formatCentToDollarText(this.params.orderTotal),b.appendChild(w),f.appendChild(b);const C=document.createElement("div");C.classList.add("checkout-completed-line");const k=document.createElement("h3");k.textContent="Payment Method",C.appendChild(k);const S=document.createElement("span");S.textContent="** "+this.params.cardLast4,C.appendChild(S),f.appendChild(C),d.appendChild(f);const E=document.createElement("div");E.classList.add("checkout-completed-sub-section");const T=document.createElement("h3");T.textContent="Confirmation email sent",E.appendChild(T);const P=document.createElement("p");P.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>.",E.appendChild(P),d.appendChild(E),e.push(d);const D=document.createElement("div");D.classList.add("checkout-completed-section-container");const A=document.createElement("button");A.type="button";const _=document.createElement("span");_.textContent=l,A.appendChild(_);const z=htmlStringToElement(ArrowRightIcon({width:16,height:16}));A.appendChild(z),A.addEventListener("click",()=>{window.location.href=c}),D.appendChild(A),e.push(D);const O=document.createElement("div");O.classList.add("checkout-completed-section-container");const N=document.createElement("div");N.classList.add("checkout-completed-help-section"),O.appendChild(N);const R=document.createElement("p");R.textContent="Questions about your order? Contact us at "+i.supportEmail,N.appendChild(R);const B=document.createElement("p"),q=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(B.textContent="Order placed on "+q,N.appendChild(B),e.push(O),r.layout.legalMessage.show){const i=document.createElement("div");i.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(r.layout.legalMessage.text);const a=document.createElement("div");a.classList.add("checkout-separator"),e.push(i),e.push(o),e.push(a)}if(o.layout.showPoweredBy){const i=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"general"});e.push(i)}return e}}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<=20,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:a.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:20},onChange:e=>{const i=e.toUpperCase(),o=this.giftCardInput;o.setValue(i),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",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()}}),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}}const shouldShowMinimumPurchaseAlert=(e,i=![])=>{var o,r;const a=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&&a<c.pack.min)return!![];if(!i&&(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&a<c.individual.min)return!![]}else if(e.type===c.ON_DEMAND){const i=e.fees;if(i.min>0&&a<i.min)return!![]}return![]},getMinimumPurchaseMessage=(e,i=![])=>{var o,r,a,l;const d=e.subtotal;if(e.type===c.SHIPPING){const c=e.fees;let l=0;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0?l=c.pack.min:(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&(l=c.individual.min),l>0&&d<l)return{message:formatCentToDollarText(l-d)+" more needed - "+(null===(a=null==e?void 0:e.expectation)||void 0===a?void 0:a.detail),type:"warning"}}if(e.type===c.ON_DEMAND){const i=e.fees,o=i.min>0?i.min:0;if(o>0&&d<o)return{message:formatCentToDollarText(o-d)+" more needed - "+(null===(l=null==e?void 0:e.expectation)||void 0===l?void 0:l.detail),type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(e,i=![])=>{var o,r;const a=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&&a<c.pack.min)return!![];if(!i&&(null===(r=c.individual)||void 0===r?void 0:r.active)&&c.individual.min>0&&a<c.individual.min)return!![]}if(e.type===c.ON_DEMAND){const i=e.fees;if(i.min>0&&a<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",a=document.createElement("div");return a.className="alert-icon alert-icon-"+this.params.messageType,a.appendChild(htmlStringToElement(o[r]({width:16,height:16,className:"alert-icon-svg"}))),a}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 CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchOnlyStorePaths:["checkout.items"]}),this.trashButton=null}onStoreWatch(e){const i=e.find(e=>"checkout.items"===e.path);i&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState())}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 r=this.getStoreValue("cart.fulfillments."+i),c=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(c&&c.remove(),shouldShowMinimumPurchaseAlert(r,e.pack)){const i=getMinimumPurchaseMessage(r,e.pack),c=ComponentFactoryService.createElement({type:a.PURCHASE_MIN_ALERT,message:i.message,messageType:i.type,currentTotal:r.subtotal,config:{showIcon:!![],alertType:"minimal"}});c.setAttribute("data-component-type","checkout-retailer-alert"),o.before(c)}}}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;const i=this.getConfigs("global"),o=this.getStoreValue("checkout.items."+this.params.itemId),r=null===(e=null==o?void 0:o.attributes)||void 0===e?void 0:e.presale,c=(null==r?void 0:r.isActive)&&(null==r?void 0:r.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(r.estimatedShipBy):"";if(!o)return[];const l=document.createElement("div");l.classList.add("checkout-item-card-header");const d=document.createElement("img");d.classList.add("checkout-item-image"),d.src=o.mainImage,d.alt=o.name,d.loading="lazy",l.appendChild(d);const h=document.createElement("div");h.classList.add("checkout-item-details-container");const u=document.createElement("h4");u.classList.add("checkout-item-title"),u.textContent=o.name,h.appendChild(u);const p=document.createElement("div");p.classList.add("checkout-item-subtitle");const m=document.createElement("span");m.textContent=r.isActive?""+c:((null==o?void 0:o.expectationDetail)||"")+",",p.appendChild(m);const f=document.createElement("span");f.textContent="From "+((null==o?void 0:o.retailerName)||""),p.appendChild(f),h.appendChild(p),l.appendChild(h),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(o.cartItemId)}catch(r){this.logger.error("Checkout item removal failed",r)}}),l.appendChild(this.trashButton);const g=ComponentFactoryService.createElement({type:a.CHECKOUT_ITEM_QUANTITY,itemId:o.cartItemId}),v=[];if(v.push(l),i.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:a.ENGRAVING_VIEW,identifier:o.cartItemId,context:"checkout",watchStorePaths:["checkout.items.{identifier}"]});v.push(e)}return v.push(g),v}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)}}getCheckoutItemStore(){const e=this.params.itemId,i=this.getStoreValue("checkout.items."+e);return i||null}getAvailableQuantity(){var e,i,o;const r=this.getCheckoutItemStore();if(!r)return 0;const a=this.getStoreValue("products");if(!a)return 0;const c=r.partNumber,l=r.fulfillmentId,d=null===(o=null===(i=null===(e=Object.values(a).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(!d)return 0;const h=this.getStoreValue("checkout.items")||{},u=Object.values(h).filter(e=>e.partNumber===c&&e.fulfillmentId===l),p=u.reduce((e,i)=>e+i.quantity,0);return d-p}calculateQuantityLimits(){var e;const i=this.getCheckoutItemStore();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),a=i.quantity,c=this.getAvailableQuantity(),l=c>0,d=!(r&&1===a);return{currentQuantity:a,availableQuantity:c,isTheOnlyItem:r,canIncrease:l,canDecrease:d}}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)}}}createQuantityContainer(){const e=this.calculateQuantityLimits(),i=document.createElement("div");return i.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)}),i.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),i.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)}),i.appendChild(this.increaseButton),this.updateButtonStates(e),i}template(){const e=this.getCheckoutItemStore();if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const i=this.createQuantityContainer(),o=document.createElement("span");return o.classList.add("checkout-item-price-text"),o.textContent=formatCentToDollarText(e.price),[i,o]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(e){return ComponentFactoryService.createElement({type:a.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 objectValues(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 a of o){const e=a.getAttribute("data-item-id");e&&r.add(e)}for(const a of o){const e=a.getAttribute("data-item-id");e&&!i.has(e)&&a.remove()}for(const[a]of i)if(!r.has(a)){const i=this.createItemElement(a);i.setAttribute("data-item-id",a),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(),![]):![]}setupToggler(){const e=this.container.querySelector(".checkout-items-toggler"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");e&&i&&o&&e.addEventListener("click",()=>{const e=o.classList.contains("show");o.classList.toggle("show"),e?(i.classList.toggle("expanded"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand checkout items")):(i.classList.toggle("expanded"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.items"),i=objectValues(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 a=document.createElement("button");a.type="button",a.classList.add("checkout-items-toggler-button"),a.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(a);const c=document.createElement("div");c.classList.add("checkout-items-list","show");for(const l of i){const e=this.createItemElement(l.cartItemId);e.setAttribute("data-item-id",l.cartItemId),c.appendChild(e)}return[o,c]}}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")||![],a=this.store.get("checkout.error")||null,c=o.isComplete||![],l=o.hasError||![],d=o.isProcessing||![],h=o.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(a,h));const u=this.determineButtonState({isFormValid:e,invalidFieldsCount:i.length,isPaymentComplete:c,hasPaymentError:l,isStripeProcessing:d,isCheckoutLoading:r,hasCheckoutError:!!a});this.applyButtonState(u)}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:a,isStripeProcessing:c,isCheckoutLoading:l,hasCheckoutError:d}=e,h=this.config.layout.placeOrderButtonText,u=this.config.layout.placeOrderButtonShowRequiredFields,p=i&&r&&!a&&!c&&!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 e=this.getStoreValue("cart.fulfillments")||{};y=Object.values(e).some(e=>hasUnmetMinimum(e))}const b=c||l||g;if(l&&!c&&!g)return{state:"processing",text:h,disabled:!![]};if(y)return{state:"disabled",text:h,disabled:!![]};if(b)return m&&f?{state:"processing",text:"Placing Order...",disabled:!![]}:m&&!f?{state:"processing",text:"Preparing Order...",disabled:!![]}:f&&!m&&(c||g)||g||c?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!i){const e=o>0?" ("+o+")":"";return{state:"form-invalid",text:u?"Complete Required Fields"+e:h,disabled:![]}}return r?a?{state:"payment-error",text:h,disabled:![]}:p?{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||![],a=i.hasError||![],c=i.isProcessing||![];if(c||o)return;if(!e)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!r||a)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:a,billing:c}=e,l=i&&o&&r&&c&&a;l&&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.addEventListener("click",this.handlePlaceOrderClick.bind(this));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 r=document.createElement("span");r.classList.add("icon-error"),r.innerHTML=ErrorInfoIcon({});const c=document.createElement("span");c.classList.add("error-text"),o.appendChild(r),o.appendChild(c),i.appendChild(o);const l=ComponentFactoryService.createElement({type:a.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,l,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 r=document.createElement("div");r.classList.add("checkout-completed-title-section");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const l=document.createElement("p");l.textContent="Session Expired",c.appendChild(l);const d=document.createElement("p");d.textContent="Your reservation time has ended. The item has been released for other customers.",c.appendChild(d),r.appendChild(c),o.appendChild(r);const h=document.createElement("div");h.classList.add("checkout-completed-help-section");const u=document.createElement("p");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.",h.appendChild(u),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.appendChild(f);const g=htmlStringToElement(ArrowRightIcon({width:16,height:16}));m.appendChild(g),m.addEventListener("click",()=>this.handleExit()),p.appendChild(m),e.push(p);const v=document.createElement("div");v.classList.add("checkout-completed-section-container");const y=document.createElement("p");y.classList.add("checkout-completed-auto-close-text"),y.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 b=document.createElement("span");if(b.classList.add("checkout-completed-auto-close-text"),b.textContent="seconds",v.appendChild(y),v.appendChild(this.autoCloseElement),v.appendChild(b),e.push(v),i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:a.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),a=Boolean(e);if(!r&&a)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(r&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;a&&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<=20,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.promoCode"),a=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||o||Boolean(r)||Boolean(a)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:20},onChange:e=>{const i=e.toUpperCase(),o=this.promoInput;o.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",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()}}),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 a=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(e,a)}catch(c){this.logger.error("Checkout fulfillment tip update failed",c)}}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 a of i){const i=document.createElement("button");i.type="button",i.textContent=a+"%",i.classList.add("checkout-tip-button"),i.disabled=o,r===a&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(a)),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 a=document.createElement("button");a.type="button",a.classList.add("checkout-items-toggler-button"),a.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(a),e.appendChild(o);const c=document.createElement("div");c.classList.add("retailers-tips-list","show");for(const l of i){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=l.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 a=document.createElement("span");a.classList.add("dollar-sign"),a.textContent="$";const d=document.createElement("input");let h;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",e=>{e.preventDefault()}),d.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),d.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),d.addEventListener("paste",e=>{e.preventDefault()}),d.addEventListener("contextmenu",e=>{e.preventDefault()}),d.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))}}),d.addEventListener("input",e=>{const i=e.target,o=Number.parseFloat(i.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(l.fulfillmentId,o)},500)}),r.appendChild(a),r.appendChild(d),o.appendChild(r);const u=document.createElement("button");u.type="button",u.textContent="Remove",u.classList.add("checkout-tip-remove-button"),u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("click",()=>this.removeTipFromFulfillment(l.fulfillmentId)),o.appendChild(u),e.appendChild(o),c.appendChild(e)}return e.appendChild(c),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 a=document.createElement("div");a.classList.add("checkout-tip-config-container");const c=this.createTipSelectionButtons();a.appendChild(c),o.appendChild(a);const l=document.createElement("p");l.classList.add("checkout-tip-disclaimer"),l.textContent="Tips will be split proportionally between retailers.",o.appendChild(l);const d=this.createTipDistribution();return e.push(o,d),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),a=e.find(e=>"checkout.promoCodeError"===e.path),c=e.find(e=>"checkout.giftCards"===e.path);if(c&&this.updateAppliedGiftCards(c.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 a=e.querySelector(".apply-button");a&&(a.disabled=Boolean(r.value))}}if(a){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()),a.value){const i=this.createErrorElement(a.value);e.after(i)}const r=e.querySelector(".apply-button");r&&(r.disabled=Boolean(a.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:a.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return e}gcInputContainer(){const e=ComponentFactoryService.createElement({type:a.CHECKOUT_GIFT_CARDS});return e}inputContainer(){var e;const i=this.getConfigs("checkout"),o=this.getConfigs("global"),r=i.layout.allowGiftCards,a=null===(e=null==o?void 0:o.layout)||void 0===e?void 0:e.allowPromoCodes,c=document.createElement("div");c.classList.add("checkout-pc-gc-sub-container");const l=this.pcInputContainer(),d=this.gcInputContainer();a&&c.appendChild(l);const h=this.getStoreValue("checkout.promoCodeError");if(h){const e=this.createErrorElement(h);e.classList.add("promo-code-error-wrapper"),c.appendChild(e)}r&&c.appendChild(d);const u=this.getStoreValue("checkout.giftCardError");if(u){const e=this.createErrorElement(u);c.appendChild(e)}return c}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}}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:a.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:a.PRODUCT_LOADING});const r=o.sizes[o.selectedSizeId],c=document.createElement("div");c.classList.add("product-content-wrapper"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+o.name);const l=document.createElement("div");if(l.classList.add("product-content"),l.setAttribute("role","region"),l.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,l.appendChild(e)}const d=ComponentFactoryService.createElement({type:a.PRODUCT_OPTIONS,productId:i});l.appendChild(d);const h=ComponentFactoryService.createElement({type:a.PRODUCT_DRAWER,productId:i});if(l.appendChild(h),c.appendChild(l),!this.config.layout.showImages||!(null===(e=o.images)||void 0===e?void 0:e.length))return c;c.classList.add("has-images");const u=ComponentFactoryService.createElement({type:a.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:r.image,productId:i});return c.prepend(u),u.setAttribute("aria-label","Product images"),c}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}class EngravingViewComponent extends BaseComponent{constructor(){super(...arguments),this.openEngravingDrawer=async()=>{const e=this.params.identifier,i=this.createEngravingFormParams();if(this.clientConfig.isMobile()){const o="product"===this.params.context?{...i,productId:e}:i;this.commands.ui.openDrawer(a.ENGRAVING_FORM,o)}if(!this.clientConfig.isMobile())if("product"===this.params.context){const o={...i,productId:e};await this.commands.product.openProductDrawer(e,a.ENGRAVING_FORM,o)}else this.commands.ui.openDrawer(a.ENGRAVING_FORM,i)}}get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}beforeSetupStoreWatchers(){var e;this.reactiveOptions.watchStorePaths=null!==(e=this.params.watchStorePaths)&&void 0!==e?e:[]}createEngravingFormParams(){var e,i;const o=this.params.identifier,r={identifier:o,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("product"===this.params.context){const a=this.getStoreValue("products."+o),c=null===(i=null===(e=a.sizes[a.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===i?void 0:i.engraving;r.lines=a.engravingLines||[],r.maxLines=(null==c?void 0:c.maxLines)||1,r.maxCharsPerLine=(null==c?void 0:c.maxCharsPerLine)||16,r.fee=(null==c?void 0:c.fee)||0,r.location=(null==c?void 0:c.location)||""}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+o);r.lines=(null==e?void 0:e.attributes.engraving.lines)||[],r.maxLines=(null==e?void 0:e.attributes.engraving.maxLines)||1,r.maxCharsPerLine=(null==e?void 0:e.attributes.engraving.maxCharsPerLine)||16,r.fee=(null==e?void 0:e.attributes.engraving.fee)||0,r.location=(null==e?void 0:e.attributes.engraving.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+o);r.lines=(null==e?void 0:e.attributes.engraving.lines)||[],r.maxLines=(null==e?void 0:e.attributes.engraving.maxLines)||1,r.maxCharsPerLine=(null==e?void 0:e.attributes.engraving.maxCharsPerLine)||16,r.fee=(null==e?void 0:e.attributes.engraving.fee)||0,r.location=(null==e?void 0:e.attributes.engraving.location)||""}return r}createEngravingContainer(e,i){const o=document.createElement("div");o.className="engraving-header";const r=document.createElement("h3");r.textContent="Personalization";const a=document.createElement("span");a.textContent=formatCentToDollarText(i,![]),o.appendChild(r),o.appendChild(a);const c=document.createElement("div");c.className="engraving-body";const l=document.createElement("div");l.className="engraving-lines";for(const u of e){const e=document.createElement("span");e.className="engraving-line",e.textContent=u,l.appendChild(e)}const d=document.createElement("div");d.className="engraving-actions";const h=document.createElement("button");if(h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.addEventListener("click",async()=>{const e=this.params.identifier;"product"===this.params.context&&await this.commands.product.updateEngravingLines(e,[]),"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}),d.appendChild(h),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.addEventListener("click",this.openEngravingDrawer),d.appendChild(e)}return c.appendChild(l),c.appendChild(d),[o,c]}isEngravingAvailable(){var e,i,o;const r=this.params.identifier;if("product"===this.params.context){const a=this.getStoreValue("products."+r),c=a.sizes[a.selectedSizeId];return Boolean((null===(e=a.selectedFulfillment)||void 0===e?void 0:e.canEngrave)&&(null===(i=a.selectedFulfillment)||void 0===i?void 0:i.isVariantEngravable)&&(null===(o=c.attributes.engraving)||void 0===o?void 0:o.status))}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+r),i=this.getStoreValue("cart.fulfillments."+e.fulfillmentId),o=e.attributes.engraving.isEngravable,a=(null==i?void 0:i.canEngrave)||![];return Boolean(o&&a)}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+r);return Boolean(null==e?void 0:e.attributes.engraving.isEngravable)}return![]}engravingFee(){var e;const i=this.params.identifier;if("product"===this.params.context){const o=this.getStoreValue("products."+i),r=o.sizes[o.selectedSizeId];return(null===(e=r.attributes.engraving)||void 0===e?void 0:e.fee)||0}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+i);return(null==e?void 0:e.attributes.engraving.fee)||0}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+i);return(null==e?void 0:e.attributes.engraving.fee)||0}return 0}engravingLines(){const e=this.params.identifier;if("product"===this.params.context){const i=this.getStoreValue("products."+e);return i.engravingLines||[]}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[]}template(){const e=this.isEngravingAvailable();if(!e)return this.removeHostClasses("has-header"),"";const i=this.engravingFee(),o=this.engravingLines();if(o&&o.length>0)return this.addHostClasses("has-header"),this.createEngravingContainer(o,i);if(this.removeHostClasses("has-header"),"checkout"===this.params.context)return"";const r=this.getConfigs("global"),a=document.createElement("button");return a.type="button",a.className="add-engraving-button",a.textContent=r.layout.personalizationText+" +"+formatCentToDollarText(i,![]),a.addEventListener("click",this.openEngravingDrawer),a}}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 ft=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],gt=1440;function timeToMinutes(e){const i=e.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new Error("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 Error("Invalid time values: "+e);return 60*o+r}function getCurrentTimeInTimezone(e){var i,o,r;const a=new Date,c={timeZone:e,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const e=new Intl.DateTimeFormat("en-US",c),l=e.formatToParts(a),d=(null===(i=l.find(e=>"weekday"===e.type))||void 0===i?void 0:i.value.toLowerCase())||"",h=(null===(o=l.find(e=>"hour"===e.type))||void 0===o?void 0:o.value)||"0",u=(null===(r=l.find(e=>"minute"===e.type))||void 0===r?void 0:r.value)||"0",p=60*Number.parseInt(h,10)+Number.parseInt(u,10);return{weekday:d,timeInMinutes:p}}catch(l){throw new Error("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 a=o>=12?"PM":"AM",c=0===o?12:o>12?o-12:o;return c+":"+r+" "+a}function isWithinTimeSlot(e,i){try{const o=timeToMinutes(i.startsAt),r=timeToMinutes(i.endsAt);if(r>gt){if(e>=o||e<r-gt)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,a;const c=ft.indexOf(i);for(let d=1;d<=o;d++){const i=(c+d)%7,o=ft[i],h=e[o];if((null==h?void 0:h.active)&&h.times&&h.times.length>0)try{const e=1===d?"tomorrow":o;return"Opens "+e+" at "+format24TimeTo12(null!==(a=null===(r=null==h?void 0:h.times[0])||void 0===r?void 0:r.startsAt)&&void 0!==a?a:"")}catch(l){}}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(e.timezone),a=e.hours[o];if(!(null==a?void 0:a.active)||!(null===(i=a.times)||void 0===i?void 0:i.length)){const i=getNextOpeningTime(e.hours,o);return{message:i,isOpen:![],isClosed:!![]}}for(const e of a.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>gt){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 c=getNextOpeningTime(e.hours,o);return{message:c,isOpen:![],isClosed:!![]}}catch(o){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:i,isSelected:o,fulfillmentStatus:r,selectedSizeAttributes:a}){var l,d,h,u,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=i===c.SHIPPING,y=i===c.ON_DEMAND;v&&(m=(null===(d=null===(l=null==e?void 0:e.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),y&&(m=(null===(h=null==e?void 0:e.fees)||void 0===h?void 0:h.fee)||0);const b=fulfillmentAddress(e.retailerAddress,i);let x=null;i===c.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=i===c.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="popup-retailer-card "+(o?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",e.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",o?"true":"false");const k=i===c.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+e.retailerName+", "+formatCentToDollarText(null!==(u=e.price)&&void 0!==u?u:0));const S=document.createElement("div");S.className="row";const E=document.createElement("span");E.className="name",E.textContent=e.retailerName,S.appendChild(E);const T=document.createElement("span");T.className="price",T.textContent=formatCentToDollarText(null!==(p=e.price)&&void 0!==p?p:0),S.appendChild(T),C.appendChild(S);const P=document.createElement("div");P.className="row";const D=document.createElement("span");D.className="expectation",D.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==e?void 0:e.expectation.detail)||"No expectation available",P.appendChild(D);const A=document.createElement("span");if(A.className="fee",A.textContent=m>0?formatCentToDollarText(m):"Free Delivery",P.appendChild(A),C.appendChild(P),y){const e=document.createElement("div");e.className="row";const i=document.createElement("span");i.className="address",i.textContent=b,e.appendChild(i),C.appendChild(e)}return C}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:i,shippingSelected:o,onDemandSelected:r,onTabClick:a,enableShippingFulfillment:l,enableOnDemandFulfillment:d}){const h=i.length>0,u=document.createElement("div");if(u.className="fulfillment-tabs-container",u.setAttribute("role","tablist"),u.setAttribute("aria-label","Delivery method options"),l){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",a),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),u.appendChild(i)}if(d){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",a),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),u.appendChild(e)}return u}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","products.{productId}.engravingLines","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,a=o.selectedFulfillment.fulfillmentId,c=null===(e=o.sizes[o.selectedSizeId].attributes)||void 0===e?void 0:e.maxQuantityPerOrder;if(!c)return 0;const l=this.getStoreValue("cart.items")||{},d=Object.values(l).filter(e=>e.partNumber===r&&e.fulfillmentId===a),h=d.reduce((e,i)=>e+i.quantity,0);return c-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(),a=this.getStoreValue("products."+r);if(!a.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:r,selectedSizeId:a.selectedSizeId}),void 0;const c=this.getSizeAttributes(),l=(null===(e=null==c?void 0:c.presale)||void 0===e?void 0:e.isActive)===!![],d=this.isPresaleActive(c);l&&d?await this.commands.product.addPresaleToCart(r,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(i=a.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:a.quantity,engravingLines:a.engravingLines,identifier:r}):await this.commands.product.addToCart(r,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(o=a.selectedFulfillment)||void 0===o?void 0:o.partNumber,quantity:a.quantity,engravingLines:a.engravingLines,identifier:r})}async handleQuantityChange(e){const i=this.getProductId();await this.commands.product.updateQuantity(i,e)}calculateTotalPrice(){var e,i;const o=this.getProductId(),r=this.getStoreValue("products."+o),a=r.sizes[r.selectedSizeId],c=r.selectedFulfillment,l=c.price*r.quantity,d=r.engravingLines.length>0,h=d&&(null===(i=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.fee)||0;return{quantity:r.quantity,totalPrice:l+h}}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(),a=(null===(e=null==o?void 0:o.presale)||void 0===e?void 0:e.isActive)===!![],c=this.isPresaleActive(o),l=a?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(i):l;const d=a&&!c||0===r.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),u=this.config.layout.addToCartButtonShowTotalPrice?l+" for "+formatCentToDollarText(i):l;return this.addToCartButton.setAttribute("aria-label",u),this.addToCartButton.setAttribute("aria-busy",h.toString()),this.addToCartButton.setAttribute("aria-disabled",d.toString()),d&&(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=[],a=this.config.layout.showQuantityCounter;if(a){const e=this.config.layout.quantityCounterStyle,i=this.createQuantityContainer(e);r.push(i)}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:",a="See More",c="See Less",l=document.createElement("h3");l.className="title",l.textContent=r;const d=document.createElement("div");d.className="content collapsed",d.innerHTML=""===(null==o?void 0:o.trim())?i:sanitizeHTML(o);const h=document.createElement("span");return h.className="collapse-button",h.textContent=a,h.addEventListener("click",()=>{this.isCollapsed=!this.isCollapsed,d.classList.toggle("collapsed"),h.textContent=this.isCollapsed?a:c}),[l,d,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,a=r.isOpen,c=null===(i=r.contentConfig)||void 0===i?void 0:i.type,l=c!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=c,this.openWithContent(r),![]):a&&this.isOpen&&!l?![]:a&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(r),![]):!a&&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||{},a=ComponentFactoryService.createElement({type:o,...r});this.contentContainer&&this.contentContainer.appendChild(a),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 ProductEngravingComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.selectedFulfillment=null,this.availableFulfillments=[]}get hostClasses(){return["product-engraving"]}beforeConnected(){const e=this.store.get("products."+this.params.productId),i=e.sizes[e.selectedSizeId];this.availableFulfillments=objectValues(i.shippingFulfillments).filter(e=>e.isVariantEngravable===!![]),this.selectedFulfillment=this.availableFulfillments.length>0?this.availableFulfillments[0]:null}calculateTotalPrice(){var e,i;const o=this.params.productId,r=this.store.get("products."+o),a=r.sizes[r.selectedSizeId],c=this.selectedFulfillment.price,l=(null===(i=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.fee)||0;return c+l}productInformationSection(){const e=this.store.get("products."+this.params.productId),i=e.sizes[e.selectedSizeId],o=document.createElement("div");if(o.className="product-info-section",e.mainImage||e.images.length>0){const i=document.createElement("div");i.className="product-image-container";const r=document.createElement("img");r.src=e.mainImage||e.images[0],r.alt=e.name,r.loading="lazy",r.className="product-image",i.appendChild(r),o.appendChild(i)}const r=document.createElement("div");r.className="product-details-container";const a=document.createElement("div");a.className="product-header";const c=document.createElement("h4");c.className="product-title",c.textContent=e.name,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),a.appendChild(c),a.appendChild(this.productPriceSpan),r.appendChild(a);const l=document.createElement("p");l.className="product-size-text",l.textContent=i.size,r.appendChild(l);const d=document.createElement("p");return d.className="personalization-fees-disclaimer",d.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(d),o.appendChild(r),o}retailersSection(){var e,i,o,r;const a=this.store.get("products."+this.params.productId),c=this.availableFulfillments.length,l=document.createElement("div");l.className="fulfillment-section";const d=document.createElement("p");if(d.className="shipping-from-text",d.innerHTML="Shipping from: <b>"+(null===(e=a.selectedFulfillment)||void 0===e?void 0:e.retailerName)+"</b>",l.appendChild(d),1===c)return l;const h=document.createElement("div");h.className="fulfillment-options-container",l.appendChild(h);const u=document.createElement("span");u.className="see-more-fulfillments",u.textContent="See More Delivery Options ("+c+")",u.addEventListener("click",()=>{h.classList.toggle("expanded"),u.textContent=h.classList.contains("expanded")?"See Less Delivery Options":"See More Delivery Options ("+c+")"}),l.appendChild(u);for(const p of this.availableFulfillments){const e=document.createElement("div");e.className="fulfillment-option",e.setAttribute("data-fulfillment-id",p.fulfillmentId),p.fulfillmentId===(null===(i=a.selectedFulfillment)||void 0===i?void 0:i.fulfillmentId)&&e.classList.add("selected"),e.addEventListener("click",()=>{this.selectedFulfillment=p;const i=this.calculateTotalPrice();this.addToCartButton.textContent="Add to Cart - "+formatCentToDollarText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const o=h.querySelector(".fulfillment-option.selected");o&&o.classList.remove("selected"),e.classList.add("selected"),d.innerHTML="Shipping from: <b>"+p.retailerName+"</b>"});const c=p.price+((null===(r=null===(o=a.sizes[a.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.fee)||0),l=document.createElement("div");l.className="option-row row-1",e.appendChild(l);const u=document.createElement("span");u.className="retailer-name",u.textContent=p.retailerName,l.appendChild(u);const m=document.createElement("span");m.className="fulfillment-price",m.textContent=formatCentToDollarText(c),l.appendChild(m),e.appendChild(l);const f=document.createElement("div");f.className="option-row row-2",e.appendChild(f);const g=document.createElement("span");g.className="estimated-time",g.textContent=""+p.expectation.engraving,f.appendChild(g),e.appendChild(f),h.appendChild(e)}return l}engravingLinesSection(){var e;const i=this.store.get("products."+this.params.productId),o=i.sizes[i.selectedSizeId],{maxLines:r=1,location:a,maxCharsPerLine:c=16}=o.attributes.engraving||{},l=document.createElement("div");l.className="personalization-section";const d=document.createElement("p");if(d.className="personalization-title",d.textContent="Personalize Your Bottle",l.appendChild(d),a&&(null===(e=null==a?void 0:a.trim())||void 0===e?void 0:e.length)>0){const e=document.createElement("p");e.className="personalization-location-text",e.textContent="Your message will appear "+a.toLowerCase()+".",l.appendChild(e)}const h=Array.from({length:r},(e,i)=>{const o=i+1,r=document.createElement("div");r.className="personalization-input-wrapper",r.setAttribute("data-line-number",o.toString());const a=document.createElement("input");a.type="text",a.id="engraving-line-"+o,a.dataset.lineNumber=o.toString(),a.maxLength=c,a.value="",a.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,a.className="personalization-input",a.autocomplete="off";const l=document.createElement("span");return l.className="personalization-char-count",l.textContent=a.value.length+"/"+c,a.addEventListener("input",()=>{l.textContent=a.value.length+"/"+c,this.engravingLines[i]=a.value.trim().toUpperCase(),this.engravingLines[0]&&this.engravingLines[0].length>0?this.addToCartButton.disabled=![]:this.addToCartButton.disabled=!![]}),r.appendChild(a),r.appendChild(l),r}),u=document.createElement("div");return u.className="personalization-inputs-container",u.append(...h),l.appendChild(u),l}actionButtonsSection(){const e=this.params.productId,i=this.store.get("products."+e),o=document.createElement("div");o.className="action-buttons-container";const r=document.createElement("button");return r.type="button",r.className="cancel-action-button",r.textContent="Cancel",r.addEventListener("click",async()=>{await this.commands.product.closeProductDrawer(e)}),o.appendChild(r),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=!![],this.addToCartButton.textContent="Add to Cart - "+formatCentToDollarText(this.calculateTotalPrice()),this.addToCartButton.addEventListener("click",async()=>{await this.commands.product.addToCart(e,{upc:i.sizes[i.selectedSizeId].upc,fulfillmentId:this.selectedFulfillment.fulfillmentId,partNumber:this.selectedFulfillment.partNumber,quantity:1,engravingLines:this.engravingLines,identifier:e}),await this.commands.product.closeProductDrawer(e)}),o.appendChild(this.addToCartButton),o}template(){const e=this.productInformationSection(),i=this.retailersSection(),o=this.engravingLinesSection(),r=this.actionButtonsSection(),a=document.createElement("p");return a.className="personalization-disclaimer",a.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,i,o,r,a]}}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 a=0;a<r.length;a++){const i=r[a];i.classList.toggle("active",a===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,a=o/2,c=a-r,l=0,d=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(d,Math.min(l,c)),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,a=e.changedTouches[0].clientY-r;Math.abs(i)>Math.abs(a)&&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,a=0,c=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(c,Math.min(a,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 a=document.createElement("div");a.className="gallery-container";for(let c=0;c<this.params.images.length;c++){const e=this.params.images[c],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===c?"selected":"");const o=document.createElement("img");o.src=e,o.className="gallery-image",o.alt="Product thumbnail "+(c+1),o.loading="lazy",i.appendChild(o),a.appendChild(i)}return r.appendChild(a),e.push(r),e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]})}onStoreWatch(e){const i=this.getProductId();if(!e.some(e=>e.path==="products."+i+".selectedFulfillmentType"))return;const o=this.getStoreValue("products."+i+".selectedFulfillmentType"),r=this.getConfigs("global");r.layout.enablePersonalization&&o===c.SHIPPING?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||"",a=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+r),o.setAttribute("aria-pressed",a?"true":"false"),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var r,a;const c=o.dataset.sizeId;if(!c)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,c);for(const e of i)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const l=this.getStoreValue("products."+e+".sizes."+c),d=this.getConfigs("global");d.layout.enablePersonalization&&(null===(a=null===(r=null==l?void 0:l.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.status)===!![]?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 a=document.createElement("div");a.className="size-buttons-container",a.setAttribute("role","group"),a.setAttribute("aria-labelledby","size-label");for(const c of Object.values(i)){const i=document.createElement("span");i.setAttribute("data-size-id",c.id),i.setAttribute("select-size",""),i.className="size-button "+(c.id===e?"selected":"");const o=c.packDesc?" ("+c.packDesc+")":"";i.textContent=""+c.size+o,a.appendChild(i)}return o.appendChild(a),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(){const e=this.getProductId(),i=this.getStoreValue("products."+e),o=this.config.layout.showDescription,r=this.getConfigs("global"),c=[],l=document.createElement("div");l.className="price-personalization-container";const d=ComponentFactoryService.createElement({type:a.PRODUCT_PRICE,productId:e});l.appendChild(d),r.layout.enablePersonalization&&(this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.addEventListener("click",async()=>{await this.commands.product.openProductDrawer(e,a.PRODUCT_ENGRAVING,{productId:e})}),l.appendChild(this.addPersonalizationSpan)),c.push(l);const h=this.renderProductSizes(i.selectedSizeId,i.sizes);if(c.push(h),!this.hasIndependentAddressComponent()){const i=ComponentFactoryService.createElement({type:a.ADDRESS_DISPLAY,productId:e});c.push(i)}const u=ComponentFactoryService.createElement({type:a.PRODUCT_RETAILERS,productId:e});c.push(u);const p=ComponentFactoryService.createElement({type:a.PRODUCT_ADD_TO_CART_SECTION,productId:e});if(c.push(p),o){const i=ComponentFactoryService.createElement({type:a.PRODUCT_DESCRIPTION,productId:e});c.push(i)}return c}}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:a.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(a.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,a.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"),r=[],c=this.getConfigs("configurations");if(!i.productHasAvailability||!c.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",r.push(e),r}const l="carousel"===o.layout.fulfillmentDisplay?a.PRODUCT_RETAILERS_CAROUSEL:a.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:l,productId:e});return r.push(d),r}}const vt="This product is currently unavailable to ship to your location.",yt="Same-day delivery is currently unavailable for your location.";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,a=o/2,c=a-r,l=0,d=-(this.listContainer.scrollWidth-o);this.translateX=Math.max(d,Math.min(l,c)),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,a=0,c=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(c,Math.min(a,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:a}){var l,d,h,u,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=i===c.SHIPPING,y=i===c.ON_DEMAND;v&&(m=(null===(d=null===(l=null==e?void 0:e.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),y&&(m=(null===(h=null==e?void 0:e.fees)||void 0===h?void 0:h.fee)||0);const b=fulfillmentAddress(e.retailerAddress,i);let x=null;i===c.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=i===c.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="carousel-retailer-card "+(o?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",e.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",o?"true":"false");const k=i===c.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+e.retailerName+", "+formatCentToDollarText(null!==(u=e.price)&&void 0!==u?u:0));const S=document.createElement("div");S.className="retailer-header";const E=document.createElement("h3");if(E.className="name",E.textContent=e.retailerName,S.appendChild(E),y){const e=document.createElement("h3");e.className="address",e.textContent=b,S.appendChild(e)}const T=document.createElement("div");T.className="retailer-body";const P=document.createElement("span");P.className="product-price",P.textContent=formatCentToDollarText(null!==(p=e.price)&&void 0!==p?p:0);const D=document.createElement("span");D.className="shipping-price",D.textContent=m>0?"+ "+formatCentToDollarText(m):"FREE Delivery";const A=document.createElement("span");return A.className="expectation",A.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==e?void 0:e.expectation.detail)||"No expectation available",T.append(P,D,A),C.append(S,T),C}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,a=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,d=[];for(const c in o.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)){const e=o.shippingFulfillments[c],i=getRetailerOffHours(e);if(i.isClosed&&!this.config.layout.showOffHours)continue;d.push(e)}const h=[];for(const c in o.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)){const e=o.onDemandFulfillments[c],i=getRetailerOffHours(e);if(i.isClosed&&!this.config.layout.showOffHours)continue;h.push(e)}const u=i.selectedFulfillmentType===c.SHIPPING,p=i.selectedFulfillmentType===c.ON_DEMAND,m=u?d:h,f=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:h,shippingSelected:u,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:a,enableOnDemandFulfillment:l});if(!i.fulfillmentHasAvailability||0===m.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent=u?vt:yt,[f,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 g of m){const e=getRetailerOffHours(g),o=this.generateRetailerCard({fulfillment:g,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:g.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:r}),a=i.selectedFulfillmentType===c.ON_DEMAND&&e&&e.isClosed;a?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),[f,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),r=(null==o?void 0:o.attributes)||null,l=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,h=Object.values(o.shippingFulfillments),u=Object.values(o.onDemandFulfillments),p=(l?h.length:0)+(d?u.length:0),m=document.createElement("div");m.className="header";const f=document.createElement("span");f.className="header-label",f.textContent=i.selectedFulfillmentType===c.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(a.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,a.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),m.appendChild(f),m.appendChild(g),!i.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=i.selectedFulfillmentType===c.SHIPPING?vt:yt,[m,e]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";const y=getRetailerOffHours(i.selectedFulfillment),b=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],fulfillmentStatus:y,selectedSizeAttributes:r});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(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 I=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 I(),void 0;await this.commands.product.selectFulfillment(i,o),await I()}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,a=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,d=[];for(const c in o.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)){const e=o.shippingFulfillments[c],i=getRetailerOffHours(e);if(i.isClosed&&!this.config.layout.showOffHours)continue;d.push(e)}const h=[];for(const c in o.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)){const e=o.onDemandFulfillments[c],i=getRetailerOffHours(e);if(i.isClosed&&!this.config.layout.showOffHours)continue;h.push(e)}const u=i.selectedFulfillmentType===c.SHIPPING,p=i.selectedFulfillmentType===c.ON_DEMAND,m=u?d:h,f=document.createElement("h5");f.className="popup-retailers-section-title",f.textContent="Delivery Options";const g=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:h,shippingSelected:u,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:a,enableOnDemandFulfillment:l});if(!i.fulfillmentHasAvailability||0===m.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=u?vt:yt,[f,g,e]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const c of m){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[f,g,v]}}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 a=this.store.get(this.params.errorStorePath);return a?[{message:a,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(a.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,a=r.isOpen,c=null===(i=r.contentConfig)||void 0===i?void 0:i.type,l=c!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=c,this.openWithContent(r),![]):a&&this.isOpen&&!l?![]:a&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(r),![]):!a&&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.inputs=[],this.charCountElements=[]}get hostClasses(){return["engraving-form-container"]}afterRender(){this.initializeCharacterCounts()}handleInput(e){const i=e.target;i.matches(".engraving-form-input")&&this.updateCharacterCount(i)}updateCharacterCount(e){const i=Number.parseInt(e.dataset.line||"0",10)-1,o=this.charCountElements[i];if(o){const i=e.value.length,r=this.params.maxCharsPerLine;o.textContent=i+"/"+r}}initializeCharacterCounts(){for(const e of this.inputs)this.updateCharacterCount(e)}async closeDrawer(){const{identifier:e,context:i}=this.params;"product"===i&&(this.clientConfig.isMobile()?this.commands.ui.closeDrawer():await this.commands.product.closeProductDrawer(e)),"cart"===i&&this.commands.ui.openDrawer(a.CART),"checkout"===i&&this.commands.ui.closeDrawer()}collectEngravingLines(){return this.inputs.map(e=>e.value.toString().trim().toUpperCase()).filter(e=>e.length>0)}async handleSave(){const{identifier:e,context:i}=this.params,o=this.collectEngravingLines();if(0===o.length)return await this.closeDrawer(),void 0;"product"===i&&await this.commands.product.updateEngravingLines(e,o),"cart"===i&&await this.commands.cart.updateItemEngraving(e,o),"checkout"===i&&await this.commands.cart.updateItemEngraving(e,o),await this.closeDrawer()}template(){var e;const{maxLines:i,lines:o,location:r,maxCharsPerLine:a}=this.params;this.inputs=[],this.charCountElements=[];const c=Array.from({length:i},(e,i)=>{const r=o[i]||"",c=i+1,l=document.createElement("div");l.className="engraving-form-input-container",l.setAttribute("data-line-container","");const d=document.createElement("input");d.type="text",d.id="engraving-line-"+(i+1),d.dataset.line=(i+1).toString(),d.maxLength=a,d.value=r,d.placeholder=c>1?"Line "+c+" (optional)":"Line "+c,d.className="engraving-form-input",d.autocomplete="off",this.inputs.push(d);const h=document.createElement("span");return h.className="engraving-form-input-char-count",h.textContent=r.length+"/"+a,this.charCountElements.push(h),l.appendChild(d),l.appendChild(h),l}),l=document.createElement("div");l.className="engraving-form-header";const d=document.createElement("p");if(d.className="engraving-form-title",d.textContent="Personalize with a message",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-form-location",e.textContent="Engraving will appear "+r.toLowerCase(),l.appendChild(e)}const h=document.createElement("div");h.className="engraving-form-lines",h.append(...c);const u=document.createElement("div");u.className="engraving-form-actions";const p=document.createElement("button");p.type="button",p.className="engraving-form-button-cancel",p.textContent="Cancel",p.addEventListener("click",async()=>{await this.closeDrawer()}),u.appendChild(p);const m=document.createElement("button");m.type="button",m.className="engraving-form-button-save",m.textContent="Save",m.addEventListener("click",async()=>{await this.handleSave()}),u.appendChild(m);const f=document.createElement("p");return f.className="engraving-form-disclaimer",f.innerHTML="\n Personalized orders require up to 10 business days to be processed and then shipped.\n Tracking information will be provided once processed.\n <span>Personalized bottle orders cannot be canceled.</span>\n ",this.container.addEventListener("input",this.handleInput.bind(this)),[l,h,u,f]}}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),a=Number.parseInt(i,10),c=Number.parseInt(o,10);if(r<1||r>12||a<1||a>31||c<1e3)return![];const l=new Date(c,r-1,a);return l.getFullYear()===c&&l.getMonth()===r-1&&l.getDate()===a}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=[],a=this.params.validation;if(!a)return this.showErrors([]),!![];if(a.required&&(e&&i&&o||r.push("Please enter a complete date")),e||i||o)if(e&&i&&o&&4===o.length)if(this.validateDate(e,i,o)){const c=Number.parseInt(e,10),l=Number.parseInt(i,10),d=Number.parseInt(o,10),h=new Date(d,c-1,l);if(void 0!==a.minYear&&d<a.minYear&&r.push("Year must be "+a.minYear+" or later"),void 0!==a.maxYear&&d>a.maxYear&&r.push("Year must be "+a.maxYear+" or earlier"),void 0!==a.minAge||void 0!==a.maxAge){const e=this.calculateAge(h);void 0!==a.minAge&&e<a.minAge&&r.push("Must be at least "+a.minAge+" years old"),void 0!==a.maxAge&&e>a.maxAge&&r.push("Must be no more than "+a.maxAge+" years old")}if(a.customValidator){const e=a.customValidator(this.getFormattedValue());e&&r.push(e)}}else r.push("Please enter a valid date");else r.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(r);const c=0===r.length;return this.params.onValidation&&this.params.onValidation(c,r),c}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 a=document.createElement("span");a.className="date-separator",a.textContent="/";const c=document.createElement("input");c.type="text",c.placeholder="DD",c.name=this.params.name+"-day",c.id=this.params.name+"-day",c.maxLength=2,c.className="date-field day-field",c.setAttribute("data-field","day"),c.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=!![],c.disabled=!![],d.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(r),o.appendChild(a),o.appendChild(c),o.appendChild(l),o.appendChild(d);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,a]=e.split("/").map(Number),c=new Date(a,o-1,r);return c.getFullYear()===a&&c.getMonth()===o-1&&c.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&&"number"===this.params.inputType&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&"number"===this.params.inputType&&(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.A=![],this.q=this.attachShadow({mode:"closed"})}initialize(e,i){if(this.A)return;if(!e||"string"!=typeof e)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(i&&i instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.q)throw new Error("LceElementComponent: Shadow DOM container is not available");this.q.appendChild(i),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),r=o.getStylesheet(e);this.applyThemeStyles(r),this.A=!![],this.q=null}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.q.adoptedStyleSheets=[i,...this.q.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(R){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.q.adoptedStyleSheets=[...this.q.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const i=document.createElement("style");i.textContent=e,this.q&&this.q.appendChild(i)}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:o,showQuantityCounter:r,fulfillmentDisplay:a,showImages:c}=this.config.layout,l=document.createElement("div");l.classList.add("product-content-wrapper");const d=document.createElement("div");if(d.classList.add("skeleton-container"),i){const e=document.createElement("div");e.classList.add("wave","sc-title"),d.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),d.appendChild(e),d}const h=document.createElement("div");h.classList.add("wave","sc-price"),d.appendChild(h);const u=document.createElement("div");u.classList.add("sc-sizes");const p=document.createElement("div");p.classList.add("wave","sc-size-button"),u.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),u.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),u.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),u.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),u.appendChild(v),d.appendChild(u);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",a),d.appendChild(k);const S=document.createElement("div");if(S.classList.add("sc-row"),r){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),S.appendChild(e)}const E=document.createElement("div");if(E.classList.add("wave","sc-add-to-cart"),S.appendChild(E),d.appendChild(S),o){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),d.appendChild(e);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),d.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),d.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),d.appendChild(r);const a=document.createElement("div");a.classList.add("wave","sc-description-more"),d.appendChild(a)}const T=document.createElement("div");if(T.classList.add("product-content"),T.appendChild(d),l.appendChild(T),c){l.classList.add("has-images");const e=this.createImageSkeletons();l.prepend(e)}return l}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 c=0;c<3;c++){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 a=document.createElement("div");a.classList.add("gallery-container");for(let c=0;c<4;c++){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),a.appendChild(e)}return r.appendChild(a),e.appendChild(r),e}}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}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 a=document.createElement("span");a.classList.add("promo-ticker__text-item"),a.textContent=o,i.appendChild(a);const c=document.createElement("span");c.classList.add("promo-ticker__separator"),c.textContent=e.separator,i.appendChild(c)}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 a=0;a<5;a++)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",this.promoCodeApplied&&(r.disabled=!![],r.textContent="APPLIED"),r.addEventListener("click",()=>this.handlePromoClick()),this.applyButton=r,[i,r]}}const bt=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 a in i){const c=i[a],l=o[a];if(!(a in e)){r.push('Property "'+a+'" does not exist in target schema, skipping merge.');continue}const d=getType(c),h=getType(l);d===h?isObject(c)&&isObject(l)?o[a]=deepMergeConfigs(l,c):o[a]=c:r.push('Type mismatch for key "'+a+'": source is '+d+", target is "+h+". Skipping merge.")}return r.length>0&&bt.warn("Merging configurations with warnings:",r),o}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||[]),r=new Set(i||[]);for(const a of o)if(!r.has(a)){const e=this.container.querySelector('[data-item-id="'+a+'"]');e&&e.remove()}for(const c of r)if(!o.has(c)){const e=ComponentFactoryService.createElement({type:a.CART_ITEM,itemId:c});e.setAttribute("data-item-id",c),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 r of i){const e=ComponentFactoryService.createElement({type:a.CART_ITEM,itemId:r});e.setAttribute("data-item-id",r),this.container.appendChild(e)}}setupMinimumPurchaseAlert(){var e;const i=this.getFulfillmentId(),o=(null===(e=this.getProductStore())||void 0===e?void 0:e.pack)||![],r=this.getStoreValue("cart.fulfillments."+i),c=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(c&&c.remove(),shouldShowMinimumPurchaseAlert(r,o)){const e=getMinimumPurchaseMessage(r,o),i=ComponentFactoryService.createElement({type:a.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:r.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),a=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(a.length>0&&this.checkAndUpdateLoadingState(),r){const e=r.oldValue,i=r.value,o=(null==e?void 0:e.items)||[],a=(null==i?void 0:i.items)||[],c=JSON.stringify(o)!==JSON.stringify(a);c&&(this.handleItemsUpdate(o,a),this.checkAndUpdateLoadingState());const l=this.hasFulfillmentFeesChanged(e,i),d=this.hasFulfillmentDataChanged(e,i,["items","updating"]);if(l&&!d&&this.setupMinimumPurchaseAlert(),!d)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 a of r)if(!o.includes(a)&&e[a]!==i[a])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async e=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!e)throw new Error("Global theme configuration is required");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()),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 Error("Global theme update failed")}},updateProductComponent:async e=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!e)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(e),e.layout&&Object.keys(e.layout).length>0&&await this.commands.product.rerenderAllProducts(),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 Error("Product theme update failed")}},updateCartComponent:e=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!e)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.cart.rerenderCart(),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 Error("Cart theme update failed")}},updateCheckoutComponent:e=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!e)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.checkout.rerenderCheckout(),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 Error("Checkout theme update failed")}},updateAddressComponent:e=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!e)throw new Error("Address component configuration 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 Error("Address theme update failed")}},injectElement:async e=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(e)},injectProductElement:async e=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(e)},injectAddressElement:async(e,i)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:a.ADDRESS,containerId:e,options:i})},injectCartElement:async e=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:a.CART,containerId:e})},injectCheckoutElement:async e=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:a.CHECKOUT,containerId:e})}},this.ui={cartButton:(e,i)=>{var o;this.ensureCartDrawerExists();const r=document.getElementById(null!==(o=null==e?void 0:e.replace("#",""))&&void 0!==o?o:"");if(!r)throw new Error("Container with ID '"+e+"' not found");const c=ComponentFactoryService.createElement({type:a.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});r.innerHTML="",safeReplaceChildren(r,c)},floatingCartButton:e=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:a.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(i)},cartSubtotal:e=>{var i;const o=document.getElementById(null!==(i=null==e?void 0:e.replace("#",""))&&void 0!==i?i:"");if(!o)throw new Error("Element with ID '"+e+"' not found");o.innerHTML="";const r=this.store.get("cart.totals.subtotal")||0;o.textContent=formatCentToDollarText(r),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.subtotal")||0;o.textContent=formatCentToDollarText(e)})},cartItemsCount:e=>{var i;const o=document.getElementById(null!==(i=null==e?void 0:e.replace("#",""))&&void 0!==i?i:"");if(!o)throw new Error("Element with ID '"+e+"' not found");o.innerHTML="";const r=this.store.get("cart.totals.quantity")||0;o.textContent=r.toString(),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.quantity")||0;o.textContent=e.toString()})}},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",R.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 Error("Authentication failed");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.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 a=r?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:r,persistedStore:a}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme");i=deepMergeConfigs(i,e)}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)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(o){this.logger.error("Cart pre-loading failed",o)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(e){if(this.isElementsEnabled())await this.processInjectProduct(e);else for(const i of e)this.injectDisabledElementsError(i.containerId,a.PRODUCT)}async injectAddressElement(e,i){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,a.ADDRESS),void 0;await this.processInjectElement({type:a.ADDRESS,containerId:e,options:i})}async injectCartElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,a.CART),void 0;await this.processInjectElement({type:a.CART,containerId:e})}async injectCheckoutElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,a.CHECKOUT),void 0;await this.processInjectElement({type:a.CHECKOUT,containerId:e})}get actions(){return this.clientAction.actions}async processInjectProduct(e){var i,o;if(this.ensureAllComponentsRegistered(),0===e.length)throw new Error("At least one product must be provided");e.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const r=e.slice(0,20),c=[];for(const a of r){const e=null===(o=null===(i=a.containerId)||void 0===i?void 0:i.replace("#",""))||void 0===o?void 0:o.trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+a.identifier+"'");continue}const r=document.getElementById(e);if(!r){this.logger.warn("Container with ID '"+e+"' not found for product '"+a.identifier+"'");continue}const l=c.every(i=>i.containerId!==e);if(!l){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!a.identifier){this.logger.warn("Product identifier is required for container ID '"+e+"'");continue}const d=c.every(e=>e.identifier!==a.identifier);d?c.push({containerId:e,identifier:a.identifier}):this.logger.warn("Duplicate product identifier '"+a.identifier+"' found, skipping")}for(const l of c){const e=ComponentFactoryService.createElement({type:a.PRODUCT,useShadowDom:!![],productId:l.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(l.containerId);i?(i.innerHTML="",safeReplaceChildren(i,e),await this.commands.product.createProductInstance(l.identifier,!![])):this.logger.warn("Product ("+l.identifier+") container with ID '"+l.containerId+"' not found")}await this.commands.product.loadMultipleProducts(c.map(e=>e.identifier))}async processInjectElement(e){this.ensureAllComponentsRegistered();const{type:i,containerId:o,...r}=e;if(!o)throw new Error("Container ID is required");if(!i)throw new Error("Component type is required");const c=e.containerId.replace("#",""),l=document.getElementById(c);if(!l)return console.warn("Container with ID '"+c+"' not found"),void 0;l.innerHTML="";const d={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...r},h=ComponentFactoryService.createElement(d);safeReplaceChildren(l,h),e.type===a.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:a.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=!![])}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(a.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(a.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(a.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(a.CART,AddressInputComponent),ComponentFactoryService.registerComponent(a.ADDRESS_INPUT,AddressInputComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(a.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(a.INPUT,InputComponent),ComponentFactoryService.registerComponent(a.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(a.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(a.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(a.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(a.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(a.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(a.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(a.ALERT,AlertComponent),ComponentFactoryService.registerComponent(a.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(a.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(a.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(a.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(a.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(a.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(a.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(a.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(a.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(a.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(a.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(a.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(a.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(a.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(a.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(a.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(a.PRODUCT_ENGRAVING,ProductEngravingComponent),ComponentFactoryService.registerComponent(a.CART,CartComponent),ComponentFactoryService.registerComponent(a.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(a.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(a.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(a.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(a.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(a.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(a.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(a.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(a.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(a.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(e){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+e+") is only available in builder mode"),![])}}async function Elements(e,i){try{const r=ClientConfigService.getInstance();r.initialize(e,{env:i.env,isBuilder:i.isBuilder,debugMode:i.debugMode,customTheme:i.customTheme,proxy:i.proxy,promoTicker:i.promoTicker});const a=r.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const c=await SingletonManager.getClient(a);if(!c.clientPrepared)throw new Error("Failed to initialize properly");const l={builder:c.builder,injectProductElement:c.injectProductElement.bind(c),injectAddressElement:c.injectAddressElement.bind(c),injectCartElement:c.injectCartElement.bind(c),injectCheckoutElement:c.injectCheckoutElement.bind(c),ui:c.ui,actions:c.actions};window.elements=l;const d=PubSubService.getInstance();return d.publishAction(o.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:r.get("version")}),l}catch(r){try{const e=LoggerFactory.get("ElementsClientInit");e.error("Elements Client Initialization failed",r)}catch(a){console.error("[LiquidCommerce Elements] Client initialization failed:",null==r?void 0:r.message)}try{const e=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(o.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(c){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 a of r)try{const o=a.match(/^data-product(-(.+))?$/),r=(null==o?void 0:o[2])?"-"+o[2]:"",c="data-container"+r;e.hasAttribute(c)&&i.push({containerId:e.getAttribute(c),identifier:e.getAttribute(a)})}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 a=new URLSearchParams(window.location.search),l=a.get(o);if(!l)return;let d=c.SHIPPING;if(r)if(startsWithLcePrefix(r)){const e=a.get(r);e!==c.ON_DEMAND&&e!==c.SHIPPING||(d=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:l,fulfillmentType:d,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),a=r.get(o);if(a)try{await e.actions.cart.applyPromoCode(a)}catch(c){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",c)}}async function ElementsAutoInitialize(){var e,o,r,a,c,d;try{const d=document.querySelector("script[data-liquid-commerce-elements]");if(!d)return;const f=d.getAttribute("data-token"),g=d.getAttribute("data-env")||i.PRODUCTION,v=d.getAttribute("data-debug-mode");if(!f)throw new Error("Missing API Key (data-token attribute).");const y=d.getAttribute("data-cart-id"),b=d.hasAttribute("data-show-cart-items"),x=d.hasAttribute("data-hide-cart-floating-button"),w=d.getAttribute("data-promo-code"),C=d.getAttribute("data-promo-text"),k=null!==(e=d.getAttribute("data-promo-separator"))&&void 0!==e?e:"•",S=null!==(o=d.getAttribute("data-promo-active-from"))&&void 0!==o?o:void 0,E=null!==(r=d.getAttribute("data-promo-active-until"))&&void 0!==r?r:void 0,T=pairsFromMainScript(d),P=pairsFromProductsScript(),D=pairsFromAttributedElements(),A=[...T,...P,...D],_=w&&C&&S&&E?{promoCode:w,text:C.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:k,activeFrom:null===(a=new Date(S))||void 0===a?void 0:a.toISOString(),activeUntil:null===(c=new Date(E))||void 0===c?void 0:c.toISOString()}:void 0;let z=l.NONE;v&&g!==i.PRODUCTION&&(z=v);const O=await Elements(f,{env:g,debugMode:z,promoTicker:_?[_]:void 0});if(!O)throw new Error("Failed to initialize client.");if(0!==A.length)try{await O.injectProductElement(A)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",h)}try{const e=y&&document.getElementById(y.replace("#",""));e?O.ui.cartButton(y,b):x||(O.ui.floatingCartButton(b),y&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+y+'" not found. Falling back to floating cart button.'))}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}try{await addProductToCartViaQueryParam(O,d)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",p)}try{await addPromoCodeToCartViaQueryParam(O,d)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",m)}}catch(f){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(d=null==f?void 0:f.message)&&void 0!==d?d:String(f))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",R)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",R)}},50)}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",R)}}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,a,c)=>{var l,d;const h=(null==o?void 0:o.includes("elements"))||(null==o?void 0:o.includes("liquidcommerce"))||(null===(l=null==c?void 0:c.stack)||void 0===l?void 0:l.includes("LiquidCommerce"))||(null===(d=null==c?void 0:c.stack)||void 0===d?void 0:d.includes("elements-sdk"));return h?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:i,source:o,lineno:r,colno:a,error:c}),!![]):e?e(i,o,r,a,c):![]};const i=window.onunhandledrejection;window.onunhandledrejection=e=>{var o,r,a,c,l,d;const h=(null===(r=null===(o=e.reason)||void 0===o?void 0:o.stack)||void 0===r?void 0:r.includes("LiquidCommerce"))||(null===(c=null===(a=e.reason)||void 0===a?void 0:a.stack)||void 0===c?void 0:c.includes("elements-sdk"))||(null===(d=null===(l=e.reason)||void 0===l?void 0:l.message)||void 0===d?void 0:d.includes("LiquidCommerce"));if(h)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",e.reason),e.preventDefault(),void 0;i&&i.call(window,e)};try{initializeDOMPolyfills()}catch(xt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",xt)}try{triggerElementsAutoInit()}catch(wt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",wt)}}catch(Ct){console.error("[LiquidCommerce Elements] SDK initialization failed:",Ct)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|