@liquidcommerce/elements-sdk 2.6.0-beta.19 → 2.6.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/elements.js CHANGED
@@ -1 +1 @@
1
- (function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,o]of t)e[n]=o;return e})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(ot){console.warn("DOM polyfills initialization failed:",ot)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SDKError extends Error{constructor(t,e=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=e,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,e){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return e?isSDKSource(e):![];const n=String((null==t?void 0:t.message)||""),o=/liquidcommerce\s+elements/i.test(n),r=String((null==t?void 0:t.stack)||""),c=(null==t?void 0:t.source)||e||"",l=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],d=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],h=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],u=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],p=isSDKSource(c),m=l.some(t=>t.test(r)),f=d.some(t=>t.test(r)),g=h.some(t=>t.test(r)),v=u.some(t=>t.test(r));return o||p||m||f||g||v}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const e=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return e.some(e=>e.test(t))}const t={BRANDS:"brands",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},o={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},r={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},c={ON_DEMAND:"onDemand",SHIPPING:"shipping"},l={NONE:"none",CONSOLE:"console",PANEL:"panel"},d={PROMO_CODE:"promo-code"},h={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},u={SUCCESS:"success",WARNING:"warning",ERROR:"error"},p={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},m={STANDARD:"standard"},f={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},g={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const o=n.get(t);if(!o)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return o}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,o=SingletonManager.getInstances();if(o.has(n))return o.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const r=new SingletonManager.clientConstructor(t);return await r.prepare(),o.set(n,r),r}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const v="lce",y={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},b={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:c.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},x={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},C={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},S={drawer:{isOpen:![],contentConfig:null}},_={products:{},cart:x,address:y,checkout:C,ui:S};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===l.CONSOLE||t===l.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===l.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===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(t,n){if(!(null==t?void 0:t.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(l).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(l).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),void 0!==n.checkoutUrl&&("string"!=typeof n.checkoutUrl?(console.warn("[LiquidCommerce Elements] checkoutUrl must be a string. Ignoring checkoutUrl configuration."),n.checkoutUrl=void 0):n.checkoutUrl&&!n.checkoutUrl.includes("{id}")&&console.warn('[LiquidCommerce Elements] checkoutUrl does not include "{id}" placeholder and will not include cart IDs.')),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const o="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return o instanceof Date&&!Number.isNaN(o.getTime())?n>=o?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var o,r,c,d,h;const u=n.env||e.PRODUCTION;let m=p[u];const f=u===e.PRODUCTION,g=n.isBuilder||![],y=v+(f?"":"_"+u)+(g?"builder":"");return(null===(o=n.development)||void 0===o?void 0:o.customApiUrl)&&(m=n.development.customApiUrl),{apiKey:t.trim(),env:u,isBuilder:g,debugMode:n.debugMode||l.NONE,baseUrl:m,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:y,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(r=n.development)||void 0===r?void 0:r.paymentMethodId)||void 0,openShadowDom:f?![]:(null===(c=n.development)||void 0===c?void 0:c.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(d=n.development)||void 0===d?void 0:d.customApiUrl),checkoutUrl:(null===(h=n.checkoutUrl)||void 0===h?void 0:h.trim())?n.checkoutUrl.trim():null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),o="ontouchstart"in window||navigator.maxTouchPoints>0,r=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,c=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,l=Math.max(r,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(t=>t.test(n))?"tablet":h.some(t=>t.test(n))||o&&l<768?"mobile":o&&l>=768&&l<=1200||o&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&o&&l>=768||/windows nt/i.test(n)&&o&&l>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...o]=this.getPrefix("debug");void 0!==e?console.debug(n,...o,t,e):console.debug(n,...o,t)}info(t,e){if(!this.enableLogging)return;const[n,...o]=this.getPrefix("info");void 0!==e?console.info(n,...o,t,e):console.info(n,...o,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...o]=this.getPrefix("warn");void 0!==e?console.warn(n,...o,t,e):console.warn(n,...o,t)}error(t,e){const n=e instanceof Error,o=n?e:void 0,r=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,o,r),!this.enableLogging)return;const[c,...l]=this.getPrefix("error");void 0!==e?console.error(c,...l,t,e):console.error(c,...l,t)}sendToTelemetry(t,e,n,o){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:o})}catch(r){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const o=n.attachShadow({mode:"closed"}),r=document.createElement("style");r.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 </"+t+">";const d=document.createElement("p");return d.textContent=e,c.appendChild(r),c.appendChild(l),c.appendChild(d),o.appendChild(c),n}function productionComponentError({title:t,message:e,componentType:n}){const o=document.createElement("div");o.setAttribute("data-component-type",n);const r=o.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=t;const h=document.createElement("p");return h.textContent=e,l.appendChild(c),l.appendChild(d),l.appendChild(h),r.appendChild(l),o}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new SDKError("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:r,wrapInLceElement:c,...l}=t,d={type:e,tagName:n,useShadowDom:r&&c!==!![]};o.initialize({data:l,config:d})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const c=document.createElement(n);return c.initialize(t.type,o),c}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.BIRTHDATE_INPUT]:"birthdate-input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.PRODUCT_LIST]:"product-list-lc",[r.PRODUCT_LIST_CARD]:"product-list-card-lc",[r.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[r.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[r.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION]:"checkout-information-lc",[r.CHECKOUT_PAYMENT]:"checkout-payment-lc",[r.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[r.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING]:"checkout-billing-lc",[r.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[r.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[r.CHECKOUT_BUYER]:"checkout-buyer-lc",[r.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[r.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,o]=t.includes(".")?t.split(".",2):["actions",t];let r=o.split("_")[0];["product","cart","address","checkout"].includes(r)||(r="other");const c=Date.now(),l={eventId:"evt_"+c+"_"+Math.random().toString(36).slice(2,9),namespace:n,event:o,originalEvent:t,actionNamespace:"actions"===n?r:void 0,timestamp:c},d={data:e,metadata:l};this.dispatchNativeEvents(t,d)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=e);const o=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(o);const r=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(r)}catch(o){this.logger.error("Error dispatching native events for "+t,o)}}setupClientReadyBuffering(){const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,o,r)=>{if(n!==e)return t.call(window,n,o,r);if(!this.clientReadyEvent)return t.call(window,n,o,r);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof o?o(t):o&&"function"==typeof o.handleEvent&&o.handleEvent(t)}catch(c){this.logger.error("Error replaying CLIENT_READY event",c)}return t.call(window,n,o,r)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),o=t%100;let r="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||o>0)&&(r+=".",r+=o<10?"0"+o:o.toString()),r}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("Invalid time format: "+t);const n=Number.parseInt(e[1],10),o=Number.parseInt(e[2],10);if(n<0||n>23||o<0||o>59)throw new SDKError("Invalid time values: "+t);const r=n>=12?"PM":"AM",c=n%12||12;return c+":"+o.toString().padStart(2,"0")+" "+r}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),o=e.getDate().toString().padStart(2,"0"),r=e.getFullYear().toString();return n+"/"+o+"/"+r}catch(e){return""}}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{const t=await this.client.get("/configs");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),new SDKError("Failed to fetch all configs: "+(null==t?void 0:t.message))}}async setPersistedStore(t,e){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:e})}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(e){this.logger.error("Error deleting persisted store",e)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const e=await this.client.post("/address/autocomplete",{body:{input:t}});return e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const e=await this.client.post("/address/details",{body:{id:t}});return e.data}catch(e){throw this.logger.error("Error fetching address details",e),new SDKError("Failed to fetch address details: "+(null==e?void 0:e.message))}}async getProductsData(t,e){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const n={identifiers:t,location:e},o=await this.client.post("/product/availability",{body:n});return o.data}catch(n){return this.logger.error("Error fetching product data",n),null}}async catalogSearch(t){var e;try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(n){return this.logger.error("Error fetching catalog search data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const e=await this.client.post("/cart/get",{body:{id:t||void 0}});return e.data}catch(e){throw this.logger.error("Error fetching cart data",e),new SDKError("Failed to fetch cart data: "+e.message)}}async updateCart(t){try{const e=await this.client.post("/cart/update",{body:t});return e.data}catch(e){throw this.logger.error("Error updating cart",e),new SDKError("Failed to update cart: "+(null==e?void 0:e.message))}}async prepareCheckout(t){var e;try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async updateCheckoutItems(t){var e;try{const e=await this.client.post("/checkout/items",{body:t});return e.data}catch(n){throw this.logger.error("Error updating checkout items:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to update checkout items: "+(null==n?void 0:n.message))}}async getPaymentSession(t){var e;try{const e=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t){try{const e=await this.client.post("/checkout/payment/confirm",{body:t});return e.data}catch(e){throw this.logger.error("Error confirming payment session",e),new SDKError("Failed to confirm payment session: "+(null==e?void 0:e.message))}}async checkoutComplete(t){var e;try{const e=await this.client.post("/checkout/complete",{body:{token:t}});return e.data}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,e)=>t||e&&e.status>=500&&e.status<600?!![]:![],this.xhrFetch=(t,e)=>new Promise((n,o)=>{const r=new XMLHttpRequest;r.open(e.method||"GET",t);for(const[t,c]of Object.entries(e.headers))r.setRequestHeader(t,c);r.onload=()=>{const t={ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,headers:r.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,o]=e.split(": ");return n&&o&&(t[n]=o),t},{}),o:r.responseText,json:()=>Promise.resolve(JSON.parse(r.responseText)),text:()=>Promise.resolve(r.responseText)};n(t)},r.onerror=()=>{o(new TypeError("Network request failed"))},r.ontimeout=()=>{o(new TypeError("Network request timed out"))},r.timeout=3e4,r.send(e.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var e,n,o;const{url:r,options:c,retryConfig:l}=t,d=null!==(e=null==l?void 0:l.maxRetries)&&void 0!==e?e:3,h=null!==(n=null==l?void 0:l.retryDelay)&&void 0!==n?n:1e3,u=null!==(o=null==l?void 0:l.shouldRetry)&&void 0!==o?o:this.defaultShouldRetry;let p;const m=Date.now();for(let g=0;g<=d;g++){let t=Date.now();try{t=Date.now();const e=await this.fetchImpl(r,c),n=Date.now()-t;if(e.ok)return e;if(await this.logFailedResponse(r,c,e,n,g,d),g<d&&u(null,e)){await this.delay(h*2**g);continue}return e}catch(f){const e=Date.now()-t;if(p=f,this.logNetworkError(r,c,f,e,g,d),g<d&&u(f,void 0)){await this.delay(h*2**g);continue}throw this.enhanceError(f,r,c,Date.now()-m)}}throw this.enhanceError(p,r,c,Date.now()-m)}async logFailedResponse(t,e,n,o,r,c){const l=r<c;let d,h;try{n.o||(n.o=await n.text());try{d=JSON.parse(n.o)}catch(u){d=n.o}}catch(p){d="[Unable to read response body]"}if(e.body)try{h=JSON.parse(e.body)}catch(m){h=e.body}this.logger.error("HTTP request failed",{method:e.method,url:t,status:n.status,statusText:n.statusText,duration:o+"ms",attempt:r+1+"/"+(c+1),willRetry:l,requestHeaders:e.headers,requestBody:h,responseHeaders:n.headers,responseBody:d})}logNetworkError(t,e,n,o,r,c){var l;const d=r<c;this.logger.error("Network request failed",{method:e.method,url:t,error:(null==n?void 0:n.message)||"Unknown error",errorType:(null===(l=null==n?void 0:n.constructor)||void 0===l?void 0:l.name)||typeof n,duration:o+"ms",attempt:r+1+"/"+(c+1),willRetry:d,possibleCauses:this.diagnosePossibleCauses(n)})}diagnosePossibleCauses(t){var e,n,o,r,c;const l=[];return((null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timeout"))||(null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timed out")))&&l.push("Request timeout - server took too long to respond"),((null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Failed to fetch"))||(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("Network request failed")))&&(l.push("Network connectivity issue"),l.push("CORS policy blocking the request"),l.push("Server is not responding"),l.push("Request was blocked by browser or firewall")),(null===(c=null==t?void 0:t.message)||void 0===c?void 0:c.includes("aborted"))&&l.push("Request was aborted"),0===l.length&&l.push("Unknown network error"),l}enhanceError(t,e,n,o){const r=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return r.url=e,r.method=n.method,r.totalDuration=o+"ms",r.isNetworkError=!![],r.originalError=t,r.possibleCauses=this.diagnosePossibleCauses(t),r}delay(t){return new Promise(e=>setTimeout(e,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(e,n)=>{var o;const r=await t(e,n);let c;if("function"==typeof(null===(o=r.headers)||void 0===o?void 0:o.entries))c=Object.fromEntries(r.headers.entries());else{c={};for(const[t,e]of r.headers)c[t]=e}const l={ok:r.ok,status:r.status,statusText:r.statusText,headers:c,json:async()=>(l.o||(l.o=await r.text()),JSON.parse(l.o)),text:async()=>(l.o||(l.o=await r.text()),l.o)};return l}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(t,e)=>t?!![]:e&&this.isAuthError(e)?![]:e&&e.status>=500&&e.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticateAndGetConfigs(){var t,e,n,o,r,c,l,d,h;try{this.logger.info("Authenticating and fetching configurations in single request");const u=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(e=null===(t=null==u?void 0:u.data)||void 0===t?void 0:t.auth)||void 0===e?void 0:e.accessToken)&&(null===(o=null===(n=null==u?void 0:u.data)||void 0===n?void 0:n.auth)||void 0===o?void 0:o.expiration)?(null===(h=null==u?void 0:u.data)||void 0===h?void 0:h.configs)?(this.accessToken=u.data.auth.accessToken,this.tokenExpiration=u.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:u.data.configs}):(this.logger.error("Combined auth response missing configs data",{response:null==u?void 0:u.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(c=null===(r=null==u?void 0:u.data)||void 0===r?void 0:r.auth)||void 0===c?void 0:c.accessToken),hasExp:!!(null===(d=null===(l=null==u?void 0:u.data)||void 0===l?void 0:l.auth)||void 0===d?void 0:d.expiration),response:null==u?void 0:u.data}),{success:![]})}catch(u){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:(null==u?void 0:u.message)||u,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers})}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}async performAuthentication(){var t,e,n,o;try{const r=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.expiration)?(this.accessToken=r.data.accessToken,this.tokenExpiration=r.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.expiration),response:null==r?void 0:r.data}),![])}catch(r){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:(null==r?void 0:r.message)||r,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,e,n,o;try{this.logger.info("Attempting to refresh access token");const r=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.expiration)?(this.accessToken=r.data.accessToken,this.tokenExpiration=r.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.expiration),response:null==r?void 0:r.data}),![])}catch(r){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:(null==r?void 0:r.message)||r,status:null==r?void 0:r.status,endpoint:"/auth/refresh"}),![]}}async request(t,e,n=![],o=![]){if(!n&&!o&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const r=this.buildUrl(t),c=this.buildHeaders(e.headers,n),l=await this.httpClient.request({url:r,options:{method:e.method,headers:c,body:e.body?JSON.stringify(e.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return l.ok?this.handleSuccessResponse(l,t,e.method):!this.isAuthError(l)||n||o?this.handleErrorResponse(l):this.handleAuthError(l,t,e)}async handleSuccessResponse(t,e,n){try{return await t.json()}catch(o){const r=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:e,method:n,status:t.status,responsePreview:r.substring(0,1e3),error:null==o?void 0:o.message}),{message:r}}}async handleAuthError(t,e,n){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:e,method:n.method});let o=await this.refreshToken();return o||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),o=await this.authenticate()),o?this.request(e,n,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:e,method:n.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let e;try{e=await t.json()}catch(n){const o=await t.text().catch(()=>"HTTP error status: "+t.status);e={message:o||"Unknown error"}}throw{...e,status:t.status,message:(null==e?void 0:e.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}buildHeaders(t,e=![]){const n={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return e?n["X-Liquid-Api-Key"]=this.apiKey:n.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(n["X-Liquid-Api-Builder"]="true"),n}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const P="@liquidcommerce/elements-sdk",I="LiquidCommerce Elements SDK",T="UNLICENSED",F="LiquidCommerce Team",A="2.6.0-beta.19",O="https://docs.liquidcommerce.co/elements-sdk",R={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},M={url:"https://github.com/liquidcommerce/elements-sdk/issues"},N="./dist/index.esm.js",B="./umd/elements.js",j="./dist/types/index.d.ts",q="pnpm@10.0.0",U={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},Y=["dist","umd","docs","README.md","LICENSE"],W={access:"public",registry:"https://registry.npmjs.org/"},X="module",J=["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 node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},tt=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],et={"@biomejs/biome":"2.3.10","@commitlint/cli":"^20.2.0","@commitlint/config-conventional":"^20.2.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.3","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},nt={node:">=22"},it={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},ot={name:P,description:I,license:T,author:F,version:A,homepage:O,repository:R,bugs:M,module:N,browser:B,types:j,packageManager:q,exports:U,files:Y,publishConfig:W,type:X,sideEffects:J,scripts:$,keywords:tt,devDependencies:et,engines:nt,pnpm:it};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const e=await this.waitForContainerInit(t,1e4);return e?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(e){return this.checkFallbackGTM(t)}}waitForContainerInit(t,e){return new Promise(n=>{let o;const r=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(r),clearTimeout(o),n(!![]))},100);o=setTimeout(()=>{clearInterval(r),n(![])},e)})}injectGTMScript(t){return new Promise((e,n)=>{const o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+t,o.async=!![],o.crossOrigin="anonymous";let r=![];const c=setTimeout(()=>{r||(r=!![],this.isContainerInitialized(t)?e():n(new Error("GTM script timeout")))},15e3);o.onload=()=>{r||setTimeout(()=>{r||(r=!![],clearTimeout(c),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?e():n(new Error("GTM script loaded but failed to initialize")))},500)},o.onerror=()=>{setTimeout(()=>{r||(r=!![],clearTimeout(c),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?e():n(new Error("GTM script failed to load")))},100)},document.head.appendChild(o)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const o of e)try{const t={event:o.eventName,...o.eventData};window.dataLayer.push(t)}catch(n){this.logger.error("Error processing queued event "+o.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const e=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!e.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+e.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(e.message),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const o=this.getSendToTargets(),r={...n,...o.length>0&&{send_to:o},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:ot.description+" v"+ot.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:r,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const c={event:e,...r};window.dataLayer.push(c)}catch(o){this.logger.error("GTM "+t+" error",o)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const o=performance.now();try{const r=n(),c=performance.now()-o;return this.logger.info("🏪 Store "+t+" ✓ "+c.toFixed(3)+"ms",e),r}catch(r){const n=performance.now()-o;throw this.logger.error("🏪 Store "+t+" ✗ "+n.toFixed(3)+"ms",{payload:e,error:r}),r}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),o=e(),r=performance.now()-n;return r>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+r.toFixed(2)+"ms"),o},this.state=_,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const o of e){if(null==n)return;n=n[o]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),o=e(n);return this.set(t,o)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let o=this.state;const r=n.pop();for(const c of n){if(void 0===o[c])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];o=o[c]}if(Array.isArray(o))o=o.filter((t,e)=>e!==Number.parseInt(r,10));else{if("object"!=typeof o||null===o)return this.logger.warn('Cannot remove property "'+r+'" from non-object type at path "'+t+'".'),![];{const{[r]:t,...e}=o;o=e}}return this.state=this.immutableSet(this.state,n.join("."),o),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,o]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,o)}}else for(const[n,o]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,o)}for(const{path:t,oldValue:n,newValue:o}of e)this.notifyListeners(t,o,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let o;const r=t.map(t=>this.watch(t,(r,c)=>{n.push({path:t,value:r,oldValue:c}),clearTimeout(o),o=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of r)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,b)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...o}=e;return this.set("products",o)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let o=0;const G=()=>{if(o>=this.middleware.length)return n();const r=this.middleware[o++];return r({action:t,payload:e,state:this.getState(),next:G})};return G()}immutableSet(t,e,n){const o=e.split(".");if(1===o.length){if(Array.isArray(t)){const e=[...t];return e[o[0]]=n,e}return{...t,[o[0]]:n}}const[r,...c]=o,l=t[r],d=Array.isArray(l)?[]:{};if(Array.isArray(t)){const e=[...t];return e[r]=this.immutableSet(l||d,c.join("."),n),e}return{...t,[r]:this.immutableSet(l||d,c.join("."),n)}}notifyListeners(t,e,n){const o=this.listeners.get(t);if(o)for(const d of o)try{d(e,n)}catch(c){this.logger.error('Error in store listener for path "'+t+'"',c)}const r=t.split(".");for(let d=r.length-1;d>0;d--){const t=r.slice(0,d).join("."),e=this.listeners.get(t);if(e){const o=this.get(t),c=r.slice(d).join("."),h=this.immutableSet(o,c,n);for(const n of e)try{n(o,h)}catch(l){this.logger.error('Error in store listener for parent path "'+t+'"',l)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const e=this.get("address.id")||"",n=this.get("cart.id");if(!e&&!n)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const o=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(o,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:o,addressId:e,cartId:n})}catch(o){this.logger.error("Failed to persist session data to DB",o)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(ot){this.logger.error("Failed to clear localStorage entry",ot)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id");(e||n)&&(t=e+":"+n)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes(":")){const[t,n]=e.split(":");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}async getAddressDataFromId(t){if(!t||""===t.trim())return y;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{latitude:e.coordinates.latitude,longitude:e.coordinates.longitude}}:{...y,id:t}}catch(e){return{...y,id:t}}}}const rt=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_LIST,r.PRODUCT_LIST_CARD,r.PRODUCT_LIST_CARD_LOADING,r.PRODUCT_LIST_FILTERS],st=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],at=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],ct=[r.CHECKOUT,r.CHECKOUT_INFORMATION,r.CHECKOUT_STRIPE_HANDLER,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT,r.CHECKOUT_BILLING,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVER_TO,r.CHECKOUT_DELIVER_TO_SUMMARY,r.CHECKOUT_BUYER,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN,r.CHECKOUT_PRESALE_EXPIRED,r.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],o=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),r="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+o+"&"+r,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .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, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+g.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+g.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+g.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: "+g.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+g.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+g.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: "+g.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+g.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 padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+g.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+g.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+g.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+g.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+g.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+g.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+g.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+g.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+g.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+g.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: "+g.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: "+g.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: "+g.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+g.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const lt={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},dt={backgroundColor:"--product-background-color"},ht={backgroundColor:"--cart-background-color"},ut={backgroundColor:"--address-background-color"},pt={backgroundColor:"--checkout-background-color"},mt={global:lt,product:dt,cart:ht,address:ut,checkout:pt};function getCSSVariableMapping(t){return mt[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},o=getCSSVariableMapping(e);for(const[r,c]of Object.entries(o)){const e=this.getValueByPath(t,r);void 0!==e&&this.isCSSValue(e)&&(n[c]=e,this.isColorVariable(c,e)&&this.generateOpacityVariants(n,c,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},o=getCSSVariableMapping(e);for(const[r,c]of Object.entries(o))if(this.hasValueAtPath(t,r)){const e=this.getValueByPath(t,r);void 0!==e&&this.isCSSValue(e)&&(n[c]=e,this.isColorVariable(c,e)&&this.generateOpacityVariants(n,c,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,o]of Object.entries(e))n.style.setProperty(t,String(o))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let o=t;for(const r of n){if(null==o||!(r in o))return![];o=o[r]}return!![]}findOrCreateRule(t){const e=":host";for(const o of Array.from(t.cssRules))if(o instanceof CSSStyleRule&&o.selectorText===e)return o;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const o of this.opacityLevels){const r=e+"-"+o.suffix,c=this.addOpacityToHexColor(n,o.value);c&&(t[r]=c)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),o=/^#[0-9a-f]{3,8}$/i.test(e);return n&&o}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const o=Math.round(255*e),r=o.toString(16).padStart(2,"0");return"#"+n+r}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),o=this.cssProcessor.generateCSSVariablesString(n),r=this.getStylesheetStyles(t).join("\n\n"),c=0===o.length?"":":host { "+o+" }",l=("\n "+c+"\n\n "+r+"\n ").trim();this.createStylesheet(t,l)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(ot){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const o=this.styleSheets.get(t);if(o&&"string"!=typeof o){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(o,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;const o=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=o,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==rt.indexOf(t)?this.getConfigs("product"):-1!==st.indexOf(t)?this.getConfigs("address"):-1!==at.indexOf(t)?this.getConfigs("cart"):-1!==ct.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===r.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),o=this.stylesheetGenerator.getStylesheet("cart"),r=this.stylesheetGenerator.getStylesheet("checkout"),c=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),o&&t.push(o),r&&t.push(r),c&&t.push(c),t}let n;if(st.includes(t)||t===r.ADDRESS)n="address";else if(rt.includes(t)||t===r.PRODUCT)n="product";else if(at.includes(t)||t===r.CART)n="cart";else{if(!ct.includes(t)&&t!==r.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const o in e)null!==e[o]&&void 0!==e[o]&&("object"!=typeof e[o]||Array.isArray(e[o])||"object"!=typeof t[o]||Array.isArray(t[o])?n[o]=e[o]:n[o]=this.deepMerge(t[o],e[o]));return n}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const c=r.quantity+e;if(c<1)return this.removeItem(t,!![]);const l=this.buildItemUpdate(r,c),d=await this.api.updateCart({id:o,items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.updateFulfillment(r.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:o,itemId:r.id,quantity:c,previousQuantity:r.quantity});const h=splitCategoryPath(r.catPath),u={item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(e),price:centToDollar(r.unitPrice||0),item_image:r.mainImage,upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId};e<0?this.googleTagManager.removeFromCart(u):e>0&&this.googleTagManager.addToCart(u)}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to update item quantity",o),o}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw new SDKError("Item not found");const c=this.buildItemUpdate(r,0),l=await this.api.updateCart({id:o,items:[c],location:this.getLocation()}),d={itemId:r.id,fulfillmentId:r.fulfillmentId,retailerId:r.retailerId};this.syncItemsFromApiResponse(l,[]),this.cleanupAfterItemRemoval(d,l),this.syncCartMetaFromApiResponse(l),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:o,itemId:r.id});const h=splitCategoryPath(r.catPath);this.googleTagManager.removeFromCart({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:r.quantity,price:centToDollar(r.unitPrice||0),item_image:r.mainImage,upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to remove item",o),o}}async updateItemEngraving(t,e){var o,r,c;try{const l=this.store.get("cart"),d=null===(o=l.items)||void 0===o?void 0:o[t];if(!d)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const h=this.getDetails(),u={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:e},p=await this.api.updateCart({id:l.id||"",items:[u],location:this.getLocation()});this.syncItemsFromApiResponse(p,[t]),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const m=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:m.cartId,itemId:d.id,engravingLines:e,previousEngravingLines:(null===(c=null===(r=d.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:h,current:m})}catch(l){throw this.store.set("cart.items."+t+".error",l.message),this.logger.error("Failed to update item engraving",l),l}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,o;try{this.store.set("cart.loading",!![]);const r=this.store.get("cart"),c=this.getDetails(),l=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],d=l.length>0,h=Object.values(r.items||{}).find(e=>{var n,o,r,c,h;const u=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!u)return![];if(d){const t=(null===(o=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[];return l.join(",")===t.join(",")}return!(null===(h=null===(c=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.lines)||void 0===h?void 0:h.length)}),u={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:h?t.quantity+h.quantity:t.quantity};d&&(u.engravingLines=l);const p=await this.api.updateCart({id:r.id||"",items:[u],location:this.getLocation()}),m=null===(o=Object.values(p.items))||void 0===o?void 0:o.find(t=>t.fulfillmentId===u.fulfillmentId&&t.partNumber===u.partNumber);if(!m)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const f=this.store.get("cart.fulfillments."+t.fulfillmentId);f?this.updateFulfillment(t.fulfillmentId,p):this.addNewFulfillmentAndRetailer(t.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const g=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:g.cartId,itemId:m.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:c,current:g});const v=splitCategoryPath(m.catPath);this.googleTagManager.addToCart({item_id:m.liquidId,item_name:m.name,item_brand:m.brand,item_size:m.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,quantity:m.quantity,price:centToDollar(m.unitPrice||0),item_image:m.mainImage,upc:m.upc,grouping_id:m.salsifyGrouping,product_id:m.liquidId})}catch(r){this.store.set("cart.error",r.message),this.logger.error("Failed to add item to cart",r)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=this.clientConfig.get("checkoutUrl");if(e){this.trackBeginCheckout(t);const n=this.resolveCheckoutRedirectUrl(e);return window.location.assign(n),void 0}this.pubSub.publishAction(n.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var e;const n=(null===(e=t.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}resolveCheckoutRedirectUrl(t){if(!t.includes("{id}"))return t;const e=this.store.get("cart.id")||this.store.get("checkout.cartId")||"";return e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no cart ID was found. Removing placeholder.'),t.split("{id}").join(""))}async applyPromoCode(t){var e,o,r,c,l;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const d=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(d);const h=await this.api.updateCart({id:t,items:[],promoCode:d,location:this.getLocation()});this.store.batch({"cart.subtotal":h.subtotal,"cart.itemsQuantity":h.itemsQuantity,"cart.events":h.events});const u=(null===(o=null===(e=h.promoCode)||void 0===e?void 0:e.code)||void 0===o?void 0:o.toLowerCase())===d.toLowerCase();u?(this.store.set("cart.promoCode",{code:d,discount:(null===(r=h.promoCode)||void 0===r?void 0:r.discount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(c=h.promoCode)||void 0===c?void 0:c.discount)||0,newSubtotal:h.subtotal||0}),this.googleTagManager.promoCodeApplied(d,(null===(l=h.promoCode)||void 0===l?void 0:l.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(d,'Code "'+d+'" does not exist'))}catch(h){const t=(null==h?void 0:h.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:t}),this.googleTagManager.promoCodeFailed(d,t),this.logger.error("Failed to apply promo code",h),h}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const o=this.store.get("cart.promoCode"),r=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:r,error:e}),(null==o?void 0:o.code)&&this.googleTagManager.promoCodeFailed(o.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...x,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartState(e,!![]),e.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(n.CART_RESET,!![])}catch(t){const e=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",e);const o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_FAILED,{cartId:o,message:e}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),o={};for(const r in e.items||{}){const t=e.items[r];o[r]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:e.id||"",promoCodeDiscount:(null===(t=e.promoCode)||void 0===t?void 0:t.discount)||null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:o,retailers:e.retailers||{},location:n.id?{placesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}buildItemUpdate(t,e){var n,o,r;const c={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},l=(null===(r=null===(o=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];return l.length>0&&(c.engravingLines=l),c}syncItemsFromApiResponse(t,e=[]){const n=this.store.get("cart.items")||{},o=new Set(Object.keys(t.items));for(const c of Object.keys(n))o.has(c)||this.store.remove("cart.items."+c);const r={};for(const c of Object.values(t.items))0!==e.length&&!e.includes(c.id)&&n[c.id]||(r["cart.items."+c.id]=c);Object.keys(r).length>0&&this.store.batch(r)}syncCartMetaFromApiResponse(t){var e,n;const o={"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":t.events},r=null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code;if(r)o["cart.promoCode"]={code:r.toUpperCase(),discount:(null===(n=t.promoCode)||void 0===n?void 0:n.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(o["cart.promoCode"]=null)}this.store.batch(o)}syncRetailersFromApiResponse(t){var e,n;const o=this.store.get("cart.retailers")||{},r=this.store.get("cart.fulfillments")||{},c=new Set(Object.keys(t.retailers)),l=new Set;for(const d of Object.values(t.retailers))if(d.fulfillments)for(const t of Object.keys(d.fulfillments))l.add(t);for(const d of Object.keys(o))c.has(d)||this.store.remove("cart.retailers."+d);for(const d of Object.keys(r))l.has(d)||this.store.remove("cart.fulfillments."+d);if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const o of Object.values(t.retailers))if(e["cart.retailers."+o.id]=o,(null===(n=Object.values(o.fulfillments))||void 0===n?void 0:n.length)>0)for(const t of Object.values(o.fulfillments))e["cart.fulfillments."+t.id]=t;this.store.batch(e)}}updateFulfillment(t,e){var n;const o=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),r=null==o?void 0:o.fulfillments[t];r&&o&&this.store.set("cart.fulfillments."+t,r)}addNewFulfillmentAndRetailer(t,e){var n;const o=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),r=null==o?void 0:o.fulfillments[t];if(r&&o){const e={["cart.fulfillments."+t]:r,["cart.retailers."+o.id]:o};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,o;const r=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.some(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t.fulfillmentId)}),c=null===(o=Object.keys(e.retailers))||void 0===o?void 0:o.some(e=>e===t.retailerId);if(r){this.updateFulfillment(t.fulfillmentId,e);const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),c){const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,e=![]){var o,r,c,l,d;const h=this.store.get("cart");for(const n of Object.keys(h.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(h.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(h.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const u={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(o=t.promoCode)||void 0===o?void 0:o.code)?{...t.promoCode,error:null}:null};if((null===(r=Object.values(t.items))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.items))u["cart.items."+n.id]=n;if((null===(c=Object.values(t.retailers))||void 0===c?void 0:c.length)>0)for(const n of Object.values(t.retailers))if(u["cart.retailers."+n.id]=n,(null===(l=Object.values(n.fulfillments))||void 0===l?void 0:l.length)>0)for(const t of Object.values(n.fulfillments))u["cart.fulfillments."+t.id]=t;if((null===(d=t.events)||void 0===d?void 0:d.length)>0&&(u["cart.events"]=t.events),this.store.batch(u),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var e,n;const o=this.store.get("address"),r={};for(const c of Object.keys(t.items||{})){const e=t.items[c];r[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,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:r,retailers:t.retailers||{},location:(null==o?void 0:o.id)&&o.coordinates&&o.address?{placesId:o.id,formattedAddress:o.formattedAddress,address:o.address,coordinates:o.coordinates}:null}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const o={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===r.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===r.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===r.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===r.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+n.INTERNAL_CART_TO_CHECKOUT,async()=>{await this.loadCheckout({}),this.uiCommands.openDrawer(r.CHECKOUT)}),window.addEventListener("lce:actions."+n.CART_RESET,()=>{this.store.set("checkout",{...C,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const e={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},n=await this.api.updateCart({id:"",items:[e],location:this.getLocation()});await this.loadCheckout({customCartId:n.id,isForPresale:!![]})}catch(e){throw this.store.set("checkout.error",e.message),this.logger.error("Failed to add presale item to checkout",e),e}}async loadCheckout(t){var e;try{this.store.set("checkout.loading",!![]);const o=void 0!==t.customCartId?t.customCartId:this.store.get("cart.id"),r=this.store.get("cart");if(0===(null===(e=Object.values(r.items||{}))||void 0===e?void 0:e.length)&&!t.customCartId)return;const c=this.themeProvider.getConfigs("checkout"),l={canEmail:c.layout.emailOptIn.checked,canSms:c.layout.smsOptIn.checked};if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const d=await this.api.prepareCheckout({cartId:o,marketingPreferences:l});if(t.isForPresale===!![]&&0===Object.values(d.items).length)return this.openPresaleExpiredDrawer("items_unavailable"),void 0;const h={"checkout.cartId":d.cartId,"checkout.isGift":d.isGift,"checkout.marketingPreferences":d.marketingPreferences,"checkout.customerForm":C.customerForm,"checkout.giftRecipientForm":C.giftRecipientForm,"checkout.paymentForm":C.paymentForm,"checkout.paymentForm.billingSameAsShipping":d.billingSameAsShipping,"checkout.shippingAddressTwo":d.shippingAddress.two||"","checkout.presale":d.presale,"checkout.giftRecipientForm.data":d.giftOptions,"checkout.updating":![],"checkout.warning":[]};this.store.batch(h),this.syncCheckoutState(d),this.pubSub.publishAction(n.CHECKOUT_LOADED,this.getDetails())}catch(o){this.store.set("checkout.error",o.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:o.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),o=null!=t?t:!e,r={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":o,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":r});const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{cartId:c,isActive:o,previousIsActive:e})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),o=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",o);const r=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:r,isActive:o,previousIsActive:e})}async toggleMarketingPreferences(t,e){const o=this.store.get("checkout.marketingPreferences."+t),r=null!=e?e:!o,c=this.store.get("checkout.marketingPreferences"),l=this.dataForCheckoutPrepare({marketingPreferences:{...c,[t]:r}}),d=await this.api.prepareCheckout(l);this.store.set("checkout.marketingPreferences",d.marketingPreferences);const h=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:h,fieldName:t,isActive:r,previousIsActive:o})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":e,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const n=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:e});return{id:n.id,card:{brand:n.card.brand,last4:n.card.last4,expMonth:n.card.expMonth,expYear:n.card.expYear}}}catch(n){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const e=this.dataForCheckoutPrepare({}),o=await this.api.prepareCheckout({...e,promoCode:t}),r=0!==o.amounts.discounts,c=o.events.some(t=>t.type===h.PROMO_CODE)?o.events[0]:null;if(!r){this.store.set("checkout.promoCodeError",c?c.message:'Code "'+t+'" does not exist');const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e,error:(null==c?void 0:c.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==c?void 0:c.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:l,discount:o.amounts.discounts,newTotal:o.amounts.total}),this.googleTagManager.promoCodeApplied(t,o.amounts.discounts),await this.refreshCheckout({response:o})}catch(e){const o=(null==e?void 0:e.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",o);const r=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:r,error:o}),this.googleTagManager.promoCodeFailed(t,o),e}}async removePromoCode(){var t,e;try{const o=this.dataForCheckoutPrepare({}),r=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",c=await this.api.prepareCheckout({...o,promoCode:""});if(0!==c.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:l,newTotal:c.amounts.total}),this.googleTagManager.promoCodeApplied(r,0),await this.refreshCheckout({response:c})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"",r=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:r,error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),o}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(ot){const e=ot.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),ot}}async applyGiftCard(t){const e=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(e);const t=this.dataForCheckoutPrepare({}),o=t.giftCards||[],r=await this.api.prepareCheckout({...t,giftCards:[...o,e]}),c=r.events.some(t=>t.type===h.GIFT_CARD&&t.level===u.ERROR)?r.events[0]:null;c&&this.store.set("checkout.giftCardError",c.message);const l=r.giftCards.find(t=>t.code.toLowerCase()===e.toLowerCase());if(!l){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==c?void 0:c.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(e,(null==c?void 0:c.message)||"not_applied"),void 0}const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:d,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(e,l.applied),await this.refreshCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const r=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:r,error:t}),this.googleTagManager.giftCardFailed(e,t),o}}async removeGiftCard(t){var e;const o=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),r=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==o.toLowerCase()))||[],c=await this.api.prepareCheckout({...t,giftCards:r}),l=c.giftCards.find(t=>t.code.toLowerCase()===o.toLowerCase());if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:d,newTotal:c.amounts.total}),this.googleTagManager.giftCardApplied(o,0),await this.refreshCheckout({response:c})}catch(r){const t=(null==r?void 0:r.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(o,t),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(ot){throw this.store.set("checkout.error",(null==ot?void 0:ot.message)||"Failed to clear gift card error. Please try again."),ot}}openPresaleExpiredDrawer(t="time_expired"){this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED,{reason:t})}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var o,r,c;try{this.store.set("checkout.items."+t+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const h=d.quantity,u=d.quantity+e;if(u<1)return this.removeItem(t,!![]);const p={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:u},m=(null===(c=null===(r=null===(o=d.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];m.length>0&&(p.engravingLines=m);const f=await this.api.updateCheckoutItems({cartId:l,items:[p],location:this.getLocation()});this.syncFromItemUpdate(f.cart,f.checkout),this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:l,cartItemId:d.cartItemId,quantity:u,previousQuantity:h});const g=splitCategoryPath(d.catPath),v={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,quantity:Math.abs(e),price:centToDollar(d.unitPrice||0),item_image:d.mainImage,upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};e<0?this.googleTagManager.removeFromCart(v):e>0&&this.googleTagManager.addToCart(v)}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),l}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,o,r;try{const c=this.store.get("checkout.items."+t);if(!c)throw new SDKError("Item not found in checkout");if(!(null===(e=c.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const l=(null===(r=null===(o=c.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],d={id:c.cartItemId,fulfillmentId:c.fulfillmentId,partNumber:c.partNumber,quantity:c.quantity,engravingLines:[]},h=this.store.get("checkout.cartId"),u=await this.api.updateCheckoutItems({cartId:h,items:[d],location:this.getLocation()});this.syncFromItemUpdate(u.cart,u.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:h,cartItemId:c.cartItemId,engravingLines:[],previousEngravingLines:l})}catch(c){throw this.store.set("checkout.items."+t+".error",c.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:c.message}),c}}async removeItem(t,e){var o,r,c;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const h={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:0},u=(null===(c=null===(r=null===(o=d.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];u.length>0&&(h.engravingLines=u);const p=await this.api.updateCheckoutItems({cartId:l,items:[h],location:this.getLocation()});this.syncFromItemUpdate(p.cart,p.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:l,cartItemId:d.cartItemId})}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),l}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.fulfillments"),o=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:Math.round(e.amounts.subtotal*t/100)})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(l);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:d,deliveryTips:r,previousDeliveryTips:o})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.fulfillments"),r=Object.values(o||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),l=Object.values(o||{}).filter(t=>t.type===c.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?e:n.amounts.tip})),d=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:l}));this.updateStoreFromCheckoutResponse(d);const h=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:h,deliveryTips:l,previousDeliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update fulfillment tip. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.fulfillments"),o=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?0:e.amounts.tip})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(l);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:d,deliveryTips:r,previousDeliveryTips:o})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:o}){var r;try{this.store.set("checkout.customerForm.isSaving",!![]);const c=this.store.get("checkout.customerForm.data"),l=this.store.get("checkout.isGift"),d=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...c,...o},isGift:l}),h=await this.api.prepareCheckout(d);this.store.batch({"checkout.customerForm.data":h.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":h.shippingAddress.two,"checkout.deliveryInstructions":e});const u=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:u});const p=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(p.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(r=p.promoCode)||void 0===r?void 0:r.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...o}){var r;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const c=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:o}),l=await this.api.prepareCheckout(c);this.store.batch({"checkout.giftRecipientForm.data":l.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":l.shippingAddress.two,"checkout.deliveryInstructions":e});const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:d});const h=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(h.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(r=h.promoCode)||void 0===r?void 0:r.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var o,r,c;try{this.store.set("checkout.paymentForm.isSaving",!![]);const l=this.store.get("checkout"),d={},h=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let u=null,p=null;if(h||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");u=t.card,p=t.id}const m=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:p||void 0}),f=await this.api.prepareCheckout(m);if(f.payment&&u&&(d["checkout.paymentForm.paymentMethod"]={id:f.payment,card:u}),t&&f.billingAddress){d["checkout.paymentForm.data"]={firstName:f.billingAddress.firstName||"",lastName:f.billingAddress.lastName||"",email:f.billingAddress.email||"",phone:f.billingAddress.phone||"",company:f.billingAddress.company||"",addressOne:f.billingAddress.one||"",addressTwo:f.billingAddress.two||"",city:f.billingAddress.city||"",state:f.billingAddress.state||"",zipCode:f.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}d["checkout.paymentForm.isEditing"]=![],d["checkout.paymentForm.isValid"]=!![],this.store.batch(d);const g=d["checkout.paymentForm.paymentMethod"]||(null===(o=l.paymentForm)||void 0===o?void 0:o.paymentMethod),v=(null===(r=null==g?void 0:g.card)||void 0===r?void 0:r.brand)?g.card.brand+" ****"+g.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(l.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),v,(null===(c=l.promoCode)||void 0===c?void 0:c.code)||void 0)}catch(l){throw this.logger.error("Failed to save payment form",l),this.store.set("checkout.error",l.message),l}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,o,c,l,d;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const h=this.store.get("checkout"),{orderNumber:u}=await this.api.checkoutComplete(h.token);h.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,{orderNumber:u,orderTotal:h.amounts.total,cardLast4:null===(o=null===(e=null===(t=null==h?void 0:h.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===o?void 0:o.last4,customerEmail:h.customerForm.data.email,giftRecipientEmail:(null===(l=null===(c=null==h?void 0:h.giftRecipientForm)||void 0===c?void 0:c.data)||void 0===l?void 0:l.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:u,orderTotal:h.amounts.total}),this.googleTagManager.purchase({transaction_id:u,tax:centToDollar(h.amounts.tax+h.amounts.service+h.amounts.platform),shipping:centToDollar(h.amounts.shipping||0),coupon:(null===(d=h.promoCode)||void 0===d?void 0:d.code)||void 0,items:[...Object.values(h.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(h.amounts.total),subtotal:centToDollar(h.amounts.subtotal),total_before_discounts:centToDollar(h.amounts.subtotal+h.amounts.tax+h.amounts.service+h.amounts.platform+h.amounts.shipping+h.amounts.delivery),discounts:centToDollar(h.amounts.discounts),gift_cards:centToDollar(h.amounts.giftCards||0),net_total:centToDollar(h.amounts.total)})}catch(h){const t=(null==h?void 0:h.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const e={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const n of Object.values(t.retailers))for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t;this.store.batch(e)}syncFromItemUpdate(t,e){var n,o,r,c,l;try{this.store.set("checkout.updating",!![]);const d=this.store.get("cart");for(const t of Object.keys(d.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(d.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(d.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const h={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(n=t.promoCode)||void 0===n?void 0:n.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.items))h["cart.items."+e.id]=e;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const e of Object.values(t.retailers))if(h["cart.retailers."+e.id]=e,(null===(c=Object.values(e.fulfillments))||void 0===c?void 0:c.length)>0)for(const t of Object.values(e.fulfillments))h["cart.fulfillments."+t.id]=t;this.store.batch(h);const u={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(l=null==e?void 0:e.promoCode)||void 0===l?void 0:l.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(e.items))u["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(e.retailers)){u["checkout.retailers."+t.id]=t;for(const e of Object.values(t.fulfillments))u["checkout.fulfillments."+e.id]=e}}this.store.batch(u)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var e;const n={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(t.items))n["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(t.retailers)){n["checkout.retailers."+e.id]=e;for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t}}this.store.batch(n)}async refreshCheckout(t){var e;try{let n;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)n=t.response;else{const o=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const r=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...r,cartId:o})}this.syncCheckoutState(n)}catch(o){const t=(null==o?void 0:o.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),o}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:o,shippingAddressTwo:r,deliveryInstructions:l,deliveryTips:d,paymentMethodId:h,isGift:u}){var p,m,f,g,v,y,b,x,C,S,_,P,I,T,F,A,O,R,M,N,B,j,q;const U=this.store.get("checkout"),Y=null!==(m=null===(p=U.paymentForm)||void 0===p?void 0:p.billingSameAsShipping)&&void 0!==m?m:!![],W=void 0!==u?u:U.isGift,X=e?!![]:null!==(g=null===(f=U.giftRecipientForm)||void 0===f?void 0:f.isValid)&&void 0!==g?g:![],J=W&&X,$={cartId:U.cartId,shippingAddressTwo:r,billingSameAsShipping:Y,marketingPreferences:o||U.marketingPreferences,promoCode:(null===(v=U.promoCode)||void 0===v?void 0:v.code)||void 0,isGift:J,giftCards:(null===(y=null==U?void 0:U.giftCards)||void 0===y?void 0:y.map(t=>t.code))||[],deliveryTips:d||Object.values(U.fulfillments||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};h?$.payment=h:(null===(x=null===(b=U.paymentForm)||void 0===b?void 0:b.paymentMethod)||void 0===x?void 0:x.id)&&($.payment=U.paymentForm.paymentMethod.id);const tt=l||U.deliveryInstructions;if(tt&&($.deliveryInstructions=Object.values(U.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:tt}))),$.customer=t||((null===(S=null===(C=null==U?void 0:U.customerForm)||void 0===C?void 0:C.data)||void 0===S?void 0:S.email)?{firstName:null===(P=null===(_=U.customerForm)||void 0===_?void 0:_.data)||void 0===P?void 0:P.firstName,lastName:null===(T=null===(I=U.customerForm)||void 0===I?void 0:I.data)||void 0===T?void 0:T.lastName,email:null===(A=null===(F=U.customerForm)||void 0===F?void 0:F.data)||void 0===A?void 0:A.email,phone:null===(R=null===(O=U.customerForm)||void 0===O?void 0:O.data)||void 0===R?void 0:R.phone,birthDate:null===(N=null===(M=U.customerForm)||void 0===M?void 0:M.data)||void 0===N?void 0:N.birthDate,company:null===(j=null===(B=U.customerForm)||void 0===B?void 0:B.data)||void 0===j?void 0:j.company}:void 0),J){const t=e||(null===(q=U.giftRecipientForm)||void 0===q?void 0:q.data);t&&($.giftOptions=t)}return Y||(n?$.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip}:U.paymentForm.data&&($.billingAddress=U.paymentForm.data)),$}getDetails(){var t,e,n,o;const r=this.store.get("checkout"),c={};for(const l in r.items||{}){const t=r.items[l];c[l]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:l,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:r.cartId,isGift:r.isGift||![],billingSameAsShipping:(null===(t=r.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(e=r.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(n=r.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:Boolean(null===(o=r.promoCode)||void 0===o?void 0:o.code),hasGiftCards:Array.isArray(r.giftCards)&&r.giftCards.length>0,amounts:r.amounts,itemCount:Object.values(c).reduce((t,e)=>t+(e.quantity||0),0),items:c}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const o=[];for(const c of n.products){const r=Object.values(c.sizes).filter(e=>t.some(t=>t===(e.upc||e.id||c.salsifyGrouping))),l=t.find(t=>r.some(e=>t===e.upc||t===e.id)||t===c.salsifyGrouping),d=l||(null===(e=null==r?void 0:r[0])||void 0===e?void 0:e.upc);await this.loadProduct(d,{products:[c],retailers:n.retailers}),o.push(d)}const r=t.filter(t=>-1===o.indexOf(t));this.store.batch(r.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var o,r;try{const c=this.store.get("products."+t);c.loading||this.store.set("products."+t+".loading",!![]);let l=null;if(e&&(l=e),e||(l=await this.api.getProductsData([t],this.getLocation())),!l||!(null===(o=null==l?void 0:l.products)||void 0===o?void 0:o[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(l);if(!d)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...d,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const h=l.products[0],u=d.sizes[d.selectedSizeId||""],p=Boolean(this.getLocation()),m=d.selectedFulfillment,f=p&&(null==m?void 0:m.variant.price)?m.variant.price:d.noAvailabilityPrice,g=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:h.name,item_brand:h.brand,item_size:null==u?void 0:u.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(f),item_type:h.type,item_subtype:h.subType,item_image:(null==u?void 0:u.image)||(null===(r=h.images)||void 0===r?void 0:r[0]),upc:null==u?void 0:u.upc,grouping_id:h.salsifyGrouping,product_id:null==u?void 0:u.id})}catch(c){this.store.set("products."+t+".error",c.message),this.logger.error("Failed to load product data for ID "+t,c)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var o,r,l;const d=this.store.get("products."+t);let h=d.selectedFulfillmentType;const u=d.sizes[e];let p=null,m=null;if(h!==c.SHIPPING||Object.values(u.shippingFulfillments).length)if(h!==c.ON_DEMAND||Object.values(u.onDemandFulfillments).length){const t=h===c.SHIPPING?u.shippingFulfillments:u.onDemandFulfillments,e=Object.values(t);p=e[0]||null,m=(null==p?void 0:p.id)||null}else{h=c.SHIPPING;const t=Object.values(u.shippingFulfillments);p=t[0]||null,m=(null==p?void 0:p.id)||null}else{h=c.ON_DEMAND;const t=Object.values(u.onDemandFulfillments);p=t[0]||null,m=(null==p?void 0:p.id)||null}const f=h===c.SHIPPING?u.shippingFulfillments:u.onDemandFulfillments,g=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:d.name,item_brand:d.brand,item_size:null==u?void 0:u.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==p?void 0:p.variant.price)||d.noAvailabilityPrice),item_type:d.type,item_subtype:d.subType,item_image:(null==u?void 0:u.image)||(null===(o=d.images)||void 0===o?void 0:o[0]),upc:null==u?void 0:u.upc,grouping_id:d.salsifyGrouping,product_id:null==u?void 0:u.id});const v=Object.keys(u.shippingFulfillments).length>0,y=Object.keys(u.onDemandFulfillments).length>0;v||y||this.googleTagManager.productSizeNoAvailability({productId:null==u?void 0:u.id,productName:d.name,productBrand:d.brand,productCategory:g.category,productCategory2:g.category2,productCategory3:g.category3,productType:d.type,productSubtype:d.subType,productPrice:d.noAvailabilityPrice,sizeId:e,sizeName:null==u?void 0:u.size,upc:null==u?void 0:u.upc,groupingId:d.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,selectedSize:(null===(r=d.sizes[e])||void 0===r?void 0:r.size)||"",previousSizeId:d.selectedSizeId||"",previousSize:(null===(l=d.sizes[d.selectedSizeId])||void 0===l?void 0:l.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:Object.keys(u.shippingFulfillments).length+Object.keys(u.onDemandFulfillments).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(f).length),["products."+t+".selectedFulfillmentType"]:h,["products."+t+".selectedFulfillment"]:p,["products."+t+".selectedFulfillmentId"]:m})}async selectFulfillment(t,e){var o;const r=this.store.get("products."+t),l=r.sizes[r.selectedSizeId],d=r.selectedFulfillmentType===c.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,h=d[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId||"",previousFulfillmentType:r.selectedFulfillmentType});const u=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:r.name,item_brand:r.brand,item_size:null==l?void 0:l.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,price:centToDollar((null==h?void 0:h.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,item_image:(null==l?void 0:l.image)||(null===(o=r.images)||void 0===o?void 0:o[0]),upc:null==l?void 0:l.upc,grouping_id:r.salsifyGrouping,product_id:null==l?void 0:l.id}),this.store.batch({["products."+t+".selectedFulfillment"]:h,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var o;const r=this.store.get("products."+t),c=r.quantity,l=c+e,d=1,h=(null===(o=null==r?void 0:r.selectedFulfillment)||void 0===o?void 0:o.variant.stock)||5,u=Math.max(d,Math.min(h,l));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:u,previousQuantity:c}),this.store.set("products."+t+".quantity",u)}async changeFulfillmentType(t,e){var o,r;const l=this.store.get("products."+t),d=l.sizes[l.selectedSizeId],h=e===c.SHIPPING?d.shippingFulfillments:d.onDemandFulfillments,u=Object.values(h);if(0===u.length){const t=splitCategoryPath(l.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==d?void 0:d.id,productName:l.name,productBrand:l.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:l.type,productSubtype:l.subType,productPrice:l.noAvailabilityPrice,sizeId:null!==(o=l.selectedSizeId)&&void 0!==o?o:void 0,sizeName:null==d?void 0:d.size,fulfillmentType:e,upc:null==d?void 0:d.upc,groupingId:l.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const p=u[0]||null,m=(null==p?void 0:p.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:m,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:u.length>0});const f=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:null==d?void 0:d.id,item_name:l.name,item_brand:l.brand,item_size:null==d?void 0:d.size,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar((null==p?void 0:p.variant.price)||l.noAvailabilityPrice),item_type:l.type,item_subtype:l.subType,item_image:(null==d?void 0:d.image)||(null===(r=l.images)||void 0===r?void 0:r[0]),upc:null==d?void 0:d.upc,grouping_id:l.salsifyGrouping,product_id:null==d?void 0:d.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:p,["products."+t+".selectedFulfillmentId"]:m,["products."+t+".fulfillmentHasAvailability"]:u.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const o={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:o})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding presale item to checkout",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t);if(!e)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[e,n])=>(t[e]={...n},t),{}):{},n=Object.entries(e.sizes||{}).reduce((t,[e,n])=>{const{loading:o,error:r,shippingFulfillments:c,onDemandFulfillments:l,...d}=n;return t[e]={...d,shippingFulfillments:fulfillmentEventData(c),onDemandFulfillments:fulfillmentEventData(l)},t},{});return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentType:e.selectedFulfillmentType,selectedFulfillmentId:e.selectedFulfillmentId||null,productHasAvailability:Boolean(e.productHasAvailability),fulfillmentHasAvailability:Boolean(e.fulfillmentHasAvailability),id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,images:e.images||[],region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,noAvailabilityPrice:e.noAvailabilityPrice,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},o=Object.values(t).length,r=Object.values(e).length;if(o+r>0)return n.id}return null}loadProductStoreUpdate({products:[t,...e],retailers:n}){var o,r,l,d,h;try{const e=this.themeProvider.getConfigs("product"),u={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:e.layout.enableShippingFulfillment?c.SHIPPING:c.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:o,onDemandVariants:r,...c}of Object.values(t.sizes)){u.sizes[c.id]={...c,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(o)){const e=n[t.retailerId];(null==e?void 0:e.shippingFulfillment)&&(u.sizes[c.id].shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}for(const t of Object.values(r)){const e=n[t.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(u.sizes[c.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const p=Object.values(u.sizes),m=this.findFirstAvailableSize(u.sizes);u.selectedSizeId=m||(null===(o=p[0])||void 0===o?void 0:o.id)||"";const f=(null===(r=u.sizes[u.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},g=(null===(l=u.sizes[u.selectedSizeId])||void 0===l?void 0:l.onDemandFulfillments)||{};u.productHasAvailability=Object.values(f).length+Object.values(g).length>0;const v=u.selectedFulfillmentType===c.SHIPPING?Object.values(f):Object.values(g);if(u.fulfillmentHasAvailability=v.length>0,u.selectedFulfillment=v[0]||null,u.selectedFulfillmentId=(null===(d=u.selectedFulfillment)||void 0===d?void 0:d.id)||null,!u.fulfillmentHasAvailability){const t=u.selectedFulfillmentType===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,e=t===c.SHIPPING?Object.values(f):Object.values(g);e.length>0&&(u.selectedFulfillmentType=t,u.selectedFulfillment=e[0],u.selectedFulfillmentId=(null===(h=u.selectedFulfillment)||void 0===h?void 0:h.id)||null,u.fulfillmentHasAvailability=!![])}if(!u.productHasAvailability){const e=splitCategoryPath(t.catPath),n=u.sizes[u.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:t.name,productBrand:t.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==n?void 0:n.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return u}catch(u){throw this.logger.error("Product data processing error",u),u}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=this.buildFormattedAddressString(t),o={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(o)}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==o?void 0:o.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:e,error:(null==o?void 0:o.message)||"Failed to set manual address"}),o}}async clearSelectedAddress(){this.store.set("address",y),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var e,n,o,r,c,l;const d=[],h=[];(null===(e=t.one)||void 0===e?void 0:e.trim())&&h.push(t.one.trim()),(null===(n=t.two)||void 0===n?void 0:n.trim())&&h.push(t.two.trim()),h.length>0&&d.push(h.join(" ")),(null===(o=t.city)||void 0===o?void 0:o.trim())&&d.push(t.city.trim());const u=[];return(null===(r=t.state)||void 0===r?void 0:r.trim())&&u.push(t.state.trim()),(null===(c=t.zip)||void 0===c?void 0:c.trim())&&u.push(t.zip.trim()),u.length>0&&d.push(u.join(" ")),(null===(l=t.country)||void 0===l?void 0:l.trim())&&d.push(t.country.trim()),d.join(", ")}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){t.location=this.getLocation();const e=await this.api.catalogSearch(t);return e.products&&e.products.length>0&&this.trackViewItemList(e.products),e}async addToCart(t){try{this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(t)}catch(e){throw this.logger.error("Error adding product to cart from product list",e),e}}async addPresaleToCart(t){try{await this.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT)}catch(e){throw this.logger.error("Error adding presale product to checkout from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=t.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking view_item_list event",e)}}trackSelectItem(t){try{const e=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking select_item event",e)}}convertProductToBaseItem(t){var e,n;const o=null===(e=t.sizes)||void 0===e?void 0:e[0],r=null==o?void 0:o.shippingVariants[Object.keys(o.shippingVariants)[0]],c=splitCategoryPath(t.catPath);return{item_id:null==o?void 0:o.id,item_name:t.name,item_brand:t.brand,item_size:null==o?void 0:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,price:(null==r?void 0:r.price)?centToDollar(r.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==o?void 0:o.image)||(null===(n=t.images)||void 0===n?void 0:n[0]),upc:null==o?void 0:o.upc,grouping_id:t.salsifyGrouping,product_id:null==o?void 0:o.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var o,r,c,l,d;const h=this.store.get("cart");for(const n of Object.keys(h.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(h.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(h.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const u={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(o=t.promoCode)||void 0===o?void 0:o.code)?{...t.promoCode,error:null}:null};if((null===(r=Object.values(t.items))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.items))u["cart.items."+n.id]=n;if((null===(c=Object.values(t.retailers))||void 0===c?void 0:c.length)>0)for(const n of Object.values(t.retailers))if(u["cart.retailers."+n.id]=n,(null===(l=Object.values(n.fulfillments))||void 0===l?void 0:l.length)>0)for(const t of Object.values(n.fulfillments))u["cart.fulfillments."+t.id]=t;if((null===(d=t.events)||void 0===d?void 0:d.length)>0&&(u["cart.events"]=t.events),this.store.batch(u),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var e,n;const o=this.store.get("address"),r={};for(const c of Object.keys(t.items||{})){const e=t.items[c];r[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,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:r,retailers:t.retailers||{},location:(null==o?void 0:o.id)&&o.coordinates&&o.address?{placesId:o.id,formattedAddress:o.formattedAddress,address:o.address,coordinates:o.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e);const o=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:o,message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const ft="lce-checkout-stripe-slot",gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},yt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientActionService{constructor(){this.allowedCustomerFields=new Set(Object.values(gt)),this.allowedBillingFields=new Set(Object.values(yt)),this.allowedGiftFields=new Set(Object.values(vt)),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>{if(!t||""===t.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(t)}catch(e){throw this.logger.error('Unable to retrieve product details for identifier "'+t+'"',e),new SDKError('Product "'+t+'" has not been loaded yet.',!![])}}},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof e.latitude||"number"!=typeof e.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.latitude+", long: "+typeof e.longitude,!![]);if(e.latitude<-90||e.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.latitude,!![]);if(e.longitude<-180||e.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.longitude,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(r.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CART)},addProduct:async(t,e)=>{var o,l;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const e of t){if(!e.identifier||"string"!=typeof e.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(e.fulfillmentType||(e.fulfillmentType=c.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==c.SHIPPING&&e.fulfillmentType!==c.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+e.fulfillmentType+'" for product "'+e.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(e.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+e.identifier+'"',!![])}const d=this.getLocation();if(void 0===d)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(r.CART);const h=[...new Set(t.map(t=>t.identifier))],u=await this.api.getProductsData(h,d);if(!u||!u.products||0===u.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const e of t){let t=null;for(let o=0;o<u.products.length;o++){const n=u.products[o];let r=![];const c=Object.values(n.sizes);for(let t=0;t<c.length;t++){const o=c[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){r=!![];break}}if(r){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=Object.values(t.sizes)[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(l=null===(o=null==n?void 0:n.attributes)||void 0===o?void 0:o.presale)||void 0===l?void 0:l.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let r=null;const d=e.fulfillmentType===c.SHIPPING?n.shippingVariants:n.onDemandVariants,h=Object.values(d);for(let e=0;e<h.length;e++)if(h[e]){r=h[e];break}if(!r){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const p=e.fulfillmentType===c.ON_DEMAND?r.onDemandFulfillmentId:r.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:p,partNumber:r.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation();const p=this.store.get("cart.id");this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{cartId:p,itemsAdded:t.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(d){this.logger.error("Error adding products to cart:",d),this.clearPendingCartOperation();const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:d.message||"Failed to add products to cart"}),d}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const c=this.store.get("cart.promoCode");if(c&&c.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const l=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:l.cartId,discount:l.promoCodeDiscount||0,newSubtotal:l.subtotal}),this.logger.info("Promo code applied successfully")}catch(e){this.logger.error("Failed to apply promo code:",e);const t=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const o=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:o.cartId,newSubtotal:o.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(r.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const o=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout({});const c=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:c,itemsAdded:t.length,identifiers:o}),this.logger.info("Products added to checkout successfully:",o)}catch(o){this.logger.error("Error adding products to checkout:",o);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:o.message||"Failed to add products to checkout"}),o}},applyPromoCode:async t=>{var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const o=t.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),c=r.layout.allowPromoCodes;if(!c)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const l=this.store.get("checkout.promoCode");if(l&&l.code===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const d=this.store.get("checkout"),h=d.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:d.cartId,discount:(null==h?void 0:h.discount)||0,newTotal:(null===(e=null==d?void 0:d.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(o){this.logger.error("Failed to apply checkout promo code:",o);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{var t;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();const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:r.cartId,newTotal:(null===(t=null==r?void 0:r.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async t=>{var e;try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const c=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:c.cartId,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(o){this.logger.error("Failed to apply gift card:",o);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),o}},removeGiftCard:async t=>{var e;try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const c=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:c.cartId,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(o){this.logger.error("Failed to remove gift card:",o);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),o}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:async(t,e)=>{await this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[n,o]of Object.entries(t)){if(!this.allowedCustomerFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(o);n===gt.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.customerForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(e)},updateBillingInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[n,o]of Object.entries(t))this.allowedBillingFields.has(n)&&(e["checkout.paymentForm.data."+n]=this.normalizeCheckoutFieldValue(o));if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(e)},updateGiftInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[n,o]of Object.entries(t)){if(!this.allowedGiftFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(o);n===vt.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.giftRecipientForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(e)},getDetails:()=>this.command.checkout.getDetails()},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 V=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,V)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}}const bt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",xt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,e=t.instances;if(e)for(const[o,r]of e)this.interceptLoggerInstance(r,o);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.l)return;const n=t.debug.bind(t),o=t.info.bind(t),r=t.warn.bind(t),c=t.error.bind(t),H=(t,n,o)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:o,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(H("debug",t,e))},t.info=(t,e)=>{o(t,e),this.addLogEntry(H("info",t,e))},t.warn=(t,e)=>{r(t,e),this.addLogEntry(H("warn",t,e))},t.error=(t,e)=>{c(t,e),this.addLogEntry(H("error",t,e))},t.l=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,o)=>{e(t,n,o),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:o,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(xt);t&&t.remove(),this.panelElement=document.createElement(xt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),e=document.createElement("style");e.textContent=bt,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const o=this.createToggles();this.panelContainer.appendChild(o),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const r=this.createResizeHandle();this.panelContainer.appendChild(r),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const o=document.createElement("div");o.className="title",o.textContent="Elements Debug Console";const r=document.createElement("div");r.className="subtitle",r.textContent="Live SDK logs, events & GTM tracking",n.appendChild(o),n.appendChild(r);const c=document.createElement("button");return c.className="minimize",c.innerHTML="−",c.title="Minimize debug panel",c.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(c),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];e.forEach(({key:e,label:n,description:o,color:r})=>{const c=document.createElement("label");c.className="toggle",c.title=o;const l=document.createElement("input");l.type="checkbox",l.checked="showLogs"!==e,l.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const d=document.createElement("span");d.textContent=n,d.style.color=r,c.appendChild(l),c.appendChild(d),t.appendChild(c)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,o=0,r=0,c=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,o=t.clientY,r=Number.parseInt(this.panelElement.style.width,10)||500,c=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",L),document.addEventListener("mouseup",D),t.preventDefault()});const L=t=>{if(!e||!this.panelElement)return;const l=t.clientX-n,d=t.clientY-o,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,r+l)),y=Math.max(f,Math.min(g,c+d));this.panelElement.style.width=v+"px",this.panelElement.style.height=y+"px"},D=()=>{e=![],document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",D)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,o=0,r=0,c=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,o=e.clientY;const l=this.panelElement.getBoundingClientRect();r=l.left,c=l.top,document.addEventListener("mousemove",L),document.addEventListener("mouseup",D),e.preventDefault()});const L=e=>{if(!t||!this.panelElement)return;const l=e.clientX-n,d=e.clientY-o;this.panelElement.style.left=r+l+"px",this.panelElement.style.top=c+d+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},D=()=>{t=![],document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",D)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.h()){const e=this.u(t);if(e)return this.m(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.k(),browser:this.C(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,e){return(t+"_"+e).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,e="__localStorage_test_"+Date.now()+"__",n="test";t.setItem(e,n);const o=t.getItem(e);return o!==n?(this.isLocalStorageAvailable=![],![]):(t.removeItem(e),this.isLocalStorageAvailable=!![],!![])}catch(t){const n=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(n)try{const t=window.localStorage;return t&&t.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(e){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const e={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},n=e[t.name]||"Storage error: "+t.name,o=this._()?"webview":"browser";console.warn("localStorage unavailable in "+o+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const e=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}v(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.D(e)}k(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,o=this.P(),r=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+o+"|"+r}catch(t){return"24|24|srgb|100"}}P(){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(ot){}return"srgb"}C(){var t;try{const e=navigator,n=[],o=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(o),n.push(e.hardwareConcurrency||4);const r=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(r),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.I()),n.push(this._()?"webview":"browser");const c=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(c.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}I(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}_(){try{const t=navigator.userAgent.toLowerCase(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}D(t){const e=16777619;let n=2166136261,o=2166136261,r=2166136261,c=2166136261;for(let l=0;l<t.length;l++){const d=t.charCodeAt(l);n^=d,n=Math.imul(n,e),o^=d<<1,o=Math.imul(o,e),r^=d<<2,r=Math.imul(r,e),c^=d<<3,c=Math.imul(c,e)}return n=Math.abs(n),o=Math.abs(o),r=Math.abs(r),c=Math.abs(c),n.toString(16)+o.toString(16)+r.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(),this.store=StoreService.getInstance();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const o=Date.now();try{const r={eventId:"event_"+o,timestamp:o,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(r)}catch(r){this.handleInternalError(r)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(o){this.stats.failedBatches++,this.handleInternalError(o),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now();return{batchId:"batch_"+e,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new SDKError("XHR request failed with status: "+e.status)}catch(e){throw new SDKError("Both sendBeacon and XHR failed: "+e.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(e){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.T=Object.freeze(t),this.F=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const o=this.T[n];return null==o?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(o)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component setup error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),o=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(o)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;null===(e=this.beforeAutoDestroy)||void 0===e?void 0:e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.F.tagName,e),e instanceof Error&&this.captureComponentError(e,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),o="store:["+n+"]",r=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);r!==![]&&this.triggerRender(o)}catch(o){this.logger.error("Store watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(o){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const r=performance.now()-n;this.logRenderInfo(r);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(o){this.logger.error("❌ afterRender hook error in "+this.F.tagName,o),o instanceof Error&&this.captureComponentError(o,"afterRender")}}catch(r){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.F.tagName,r),this.captureComponentError(r,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:r instanceof Error?r.message:String(r)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,r,"render")}catch(c){this.logger.error("❌ onError hook error in "+this.F.tagName,c)}}}logRenderInfo(t){const e=this.F.type,n=this.F.tagName,o=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+o+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.F.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.F.tagName+":"+e,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.F.useShadowDom}})}catch(o){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.T}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const c=this.getStoreValue("address"),l=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],d=null!==(e=this.params.productId)&&void 0!==e?e:"",h=null!==(n=this.params.options)&&void 0!==n?n:{},u=null!==(o=h.showLabel)&&void 0!==o?o:!![],p=[];if(u){const t=document.createElement("span");t.textContent="Delivers to:",p.push(t)}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(r.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!l&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,r.ADDRESS_INPUT,{productId:d}))}),p.push(m),p}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:e=24,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+r+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+r+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+r+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+r+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+r+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");e.value=n;const o=n.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 t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(ot){this.logger.error("Address edit cancellation failed",ot)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const o=this.getConfigs("global"),r=null!==(t=this.params.options)&&void 0!==t?t:{},c=null!==(e=r.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),c){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const l=this.createElement("div",{className:"input-wrapper "+o.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),l.appendChild(this.inputElement);const d=this.createElement("span");d.className="input-icon",d.innerHTML=SearchIcon({width:16,height:16,className:""}),l.appendChild(d),this.inputContainer.appendChild(l),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const 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 t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:r.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:r.CART_BODY});t.push(n);const o=ComponentFactoryService.createElement({type:r.CART_FOOTER});return t.push(o),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=this.config.layout.drawerHeaderText,e=document.createElement("div");e.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your "+t.toLowerCase()+" is empty",e.appendChild(n),e}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:r.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const o=this.createRetailerElement(e);o.setAttribute("data-retailer-id",t),n.replaceWith(o)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,o]of Object.entries(t))o&&"object"==typeof o&&o.id&&(e[n]=o);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),o=this.getValidRetailerIds(e.oldValue),r=this.getValidRetailerIds(e.value),c=o.size,l=r.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[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(c>0&&0===l)this.showEmptyCartState();else if(l>0){for(const t of o)r.has(t)||this.removeRetailerElement(t);for(const e of r){const r=n[e],c=t[e];o.has(e)?this.hasRetailerDataChanged(c,r)&&this.updateRetailerElement(e,r):this.addRetailerElement(e,r)}}else 0===c&&0===l&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const o of e){const t=this.createRetailerElement(o);t.setAttribute("data-retailer-id",o.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.subtotal")),o=t.some(t=>t.path.includes("cart.fulfillments")),r=t.some(t=>"cart.loading"===t.path),c=t.some(t=>t.path.includes("cart.retailers"));e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(o||n||r||e||c)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const o=this.getStoreValue("cart.fulfillments")||{},r=Object.values(o).some(t=>t.updating);if(r)return!![];const c=this.getStoreValue("cart.retailers")||{},l=Object.values(c).some(t=>t.updating);return l?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),o=t||n||!e;this.checkoutButton.disabled=o,this.checkoutButton.classList.toggle("checkout-btn-disabled",o),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.subtotal"),n=[],o=document.createElement("div");o.className="cart-footer-header";const c=document.createElement("div");c.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",c.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e),c.appendChild(this.subtotalPrice);const l=document.createElement("p");if(l.textContent="Taxes & fees will be calculated at checkout",l.className="taxes-fees-info",o.appendChild(c),o.appendChild(l),n.push(o),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:r.CART_PROMO_CODE});n.push(t)}const d=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(d),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});n.push(t)}return n}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const r of n)if(!o.has(r)){const t=this.container.querySelector('[data-item-id="'+r+'"]');t&&t.remove()}for(const c of o)if(!n.has(c)){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:c});t.setAttribute("data-item-id",c),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const o of n)o.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:o});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t),n=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(n&&n.remove(),null==e?void 0:e.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.itemIds)||void 0===t?void 0:t.length)?n.itemIds.some(t=>this.getStoreValue("cart.items."+t+".updating")):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,o=t.find(t=>t.path===n),r=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(r.length>0&&this.checkAndUpdateLoadingState(),o){const t=o.oldValue,e=o.value,n=(null==t?void 0:t.itemIds)||[],r=(null==e?void 0:e.itemIds)||[],c=JSON.stringify(n)!==JSON.stringify(r);c&&(this.handleItemsUpdate(n,r),this.checkAndUpdateLoadingState());const l=(null==t?void 0:t.subtotal)!==(null==e?void 0:e.subtotal),d=this.hasFulfillmentDataChanged(t,e,["itemIds","updating"]);if(l&&!d&&this.setupMinimumPurchaseAlert(),!d)return![]}return![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const o=["type","canEngrave"];for(const r of o)if(!n.includes(r)&&t[r]!==e[r])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const wt={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"},kt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=wt[e];return n||kt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return kt}}function getCurrentTimeInTimezone(t){try{const e=new Date,n=e.getTime(),o=6e4*e.getTimezoneOffset(),r=new Date(n+o),c=new Date(r.toLocaleString("en-US",{timeZone:t})),l=r.getTime()-c.getTime();return new Date(n+l)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:o}=t;try{const t=getCurrentTimeInUserTimezone(o),r=!e||t>=new Date(e),c=!n||t<=new Date(n);return r&&c}catch(r){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const o=this.config.layout.drawerHeaderText,c=this.getConfigs("global"),l=document.createElement("div");l.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=o,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.setAttribute("aria-label","Close cart drawer"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),l.appendChild(h);const u=this.clientConfig.get("promoTicker"),p=null!==(e=null===(t=null==c?void 0:c.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],m=null!=u?u:p,f=this.store.get("address"),g=hasActiveItems(m,null===(n=null==f?void 0:f.address)||void 0===n?void 0:n.state);if(!m.length||!g)return[l];const v=ComponentFactoryService.createElement({context:"cart",type:r.PROMO_CODE_TICKER,tickers:m});return[l,v]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){this.commands.ui.openDrawer(r.ENGRAVING_FORM,{identifier:t,context:"cart",lines:e.attributes.engraving.lines,maxLines:e.attributes.engraving.maxLines,maxCharsPerLine:e.attributes.engraving.maxCharsPerLine,fee:e.attributes.engraving.fee,location:e.attributes.engraving.location})}template(){var t,e;const n=this.params.itemId,o=this.getStoreValue("cart.items."+n),c=this.getConfigs("global"),l=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),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.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.setAttribute("aria-label","Remove "+o.name+" from cart"),g.setAttribute("aria-expanded","true"),g.addEventListener("click",async()=>{await this.commands.cart.removeItem(n)}),g.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(n))}),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");if(b.className="item-shipping",b.textContent=o.attributes.engraving.hasEngraving?l.engravingExpectation:l.expectation,y.appendChild(b),c.layout.enablePersonalization&&(null==o?void 0:o.attributes.engraving.isEngravable)&&(null==o?void 0:o.attributes.engraving.hasEngraving)===![]&&l.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=c.layout.personalizationText+" +"+formatCentToDollarText(o.attributes.engraving.fee,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+o.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(n,o)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(n,o))}),y.appendChild(t)}p.appendChild(m),p.appendChild(v),p.appendChild(y),d.appendChild(h),d.appendChild(p);const x=[d],C=ComponentFactoryService.createElement({type:r.CART_ITEM_QUANTITY_PRICE,itemId:n});if((null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:n,context:"cart"});x.push(t)}return x.push(C),x}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),o=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:o,canDecrease:!![]}}getAvailableQuantity(){var t,e;const n=this.getItemStore();if(!n)return 0;const o=n.partNumber,r=n.fulfillmentId,c=this.getStoreValue("cart.items")||{},l=Object.values(c).filter(t=>t.partNumber===o&&t.fulfillmentId===r),d=l.reduce((t,e)=>t+e.quantity,0),h=this.getStoreValue("products."+n.upc)||this.getStoreValue("products."+n.salsifyGrouping);if(!h)return n.maxQuantity-d;const u=(null===(e=null===(t=null==h?void 0:h.sizes)||void 0===t?void 0:t[n.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder)||0;return!u||u<=0?n.maxQuantity-d:u-d}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,o=Boolean(null==n?void 0:n.code),r=Boolean(null==t?void 0:t.code);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;if(r&&this.promoCodePill&&t.discount!==(null==n?void 0:n.discount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),o=this.getStoreValue("cart.promoCode"),r=this.getStoreValue("cart.events"),c=r.some(t=>t.type===d.PROMO_CODE);this.applyButton.disabled=!e||n||Boolean(null==o?void 0:o.discount)||this.isApplying||c}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const V=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),V())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:r.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const o=this.getFulfillmentContainer();o&&o.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const o=this.container.querySelectorAll("[data-fulfillment-id]");if(0===o.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const r of n)o.has(r)||this.removeFulfillmentElement(r);for(const r of o)n.has(r)||this.addFulfillmentElement(r)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const r of n)r.remove();let o=this.getFulfillmentContainer();if(!o){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");o=document.createElement("div"),o.id="retailer-fulfillment-container",t&&e&&t.insertBefore(o,e)}for(const r of Object.keys(e))this.addFulfillmentElement(r)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:r.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,o=t.find(t=>t.path===n);if(o){const t=o.oldValue,e=o.value,n=Object.keys((null==t?void 0:t.fulfillments)||{}),r=Object.keys(e.fulfillments||{});JSON.stringify(n)!==JSON.stringify(r)&&this.handleFulfillmentsUpdate(n,r)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const w=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),w()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),w()}}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const o=document.createElement("div");o.className="cart-retailer-header";const r=document.createElement("div");r.className="retailer-info";const c=document.createElement("h2");c.className="section-title",c.textContent=e.name,r.appendChild(c);const l=document.createElement("input");l.type="checkbox",l.id=e.id,l.className="section-toggle",r.appendChild(l);const d=document.createElement("label");d.htmlFor=e.id,d.className="section-header-label",d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Collapse retailer section"),d.setAttribute("aria-expanded","true");const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),d.appendChild(h),r.appendChild(d),o.appendChild(r),n.appendChild(o);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),n.appendChild(u),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let o=0;for(const r of n)o+=r.quantity;return o}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,o=this.getStoreValue("cart.items"),r=this.getRetailerItemCount(o,t),c=1===r?"item":"items",l=document.createElement("h3");l.className="retailer-subtotal-header",l.textContent="Subtotal ("+r+" "+c+"):";const d=document.createElement("span");return d.className="retailer-subtotal-amount",d.textContent=formatCentToDollarText(e+n),[l,d]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,e,n;const o=this.store.get("checkout.presale"),c=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),d=null!==(e=null===(t=null==c?void 0:c.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],h=null!=l?l:d,u=this.store.get("address"),p=hasActiveItems(h,null===(n=null==u?void 0:u.address)||void 0===n?void 0:n.state),m=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),f=document.createElement("div");f.classList.add("checkout-container"),m&&f.classList.add("no-header"),this.params.isIndependentComponent&&f.classList.add("independent");const g=ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION});f.appendChild(g);const v=ComponentFactoryService.createElement({type:r.CHECKOUT_ORDER_SUMMARY});if(f.appendChild(v),!o&&(!h.length||!p)&&m)return[f];const y=document.createElement("div");if(y.classList.add("checkout-header-wrapper"),!m){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER});y.appendChild(t)}if(h.length&&p&&!o){const t=ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:h});y.appendChild(t)}if(o){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN});y.appendChild(t)}return[y,f]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const o=this.getStoreValue("checkout"),r=Boolean(o.promoCode),l=Boolean(null===(t=o.giftCards)||void 0===t?void 0:t.length),d=this.getConfigs("global"),h=Object.values(o.fulfillments||{}).some(t=>t.type===c.ON_DEMAND),u=Object.values(o.items||{}),p=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+u.length+" item"+(u.length>1?"s":"")+")",m.appendChild(f);const g=document.createElement("span");g.textContent=formatCentToDollarText(o.amounts.subtotal),m.appendChild(g),p.push(m);const v=document.createElement("div");v.classList.add("checkout-amount-line");const y=document.createElement("span");y.textContent="Shipping",v.appendChild(y);const b=document.createElement("span");b.textContent=formatCentToDollarText(o.amounts.shipping),v.appendChild(b),p.push(v);const x=document.createElement("div");x.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Delivery",x.appendChild(C);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(o.amounts.delivery),x.appendChild(S),p.push(x),(null===(e=null==o?void 0:o.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(o.amounts.engraving),t.appendChild(n),p.push(t)}const _=document.createElement("div");_.classList.add("checkout-amount-line");const P=document.createElement("span");P.textContent="Taxes & Fees",_.appendChild(P);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(o.amounts.tax+o.amounts.service+o.amounts.platform),_.appendChild(I),p.push(_),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=o.promoCode)||void 0===n?void 0:n.code.toUpperCase())+")",t.appendChild(e);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(o.amounts.discounts),t.appendChild(r),p.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(o.amounts.giftCards),t.appendChild(n),p.push(t)}if(h){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(o.amounts.tip),t.appendChild(n),p.push(t)}const T=document.createElement("div");T.classList.add("checkout-separator"),p.push(T);const F=document.createElement("div");F.classList.add("checkout-amount-total");const A=document.createElement("span");A.textContent="Total",F.appendChild(A);const O=document.createElement("span");if(O.textContent=formatCentToDollarText(o.amounts.total),F.appendChild(O),p.push(F),o.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),p.push(t);const o=document.createElement("div");o.classList.add("checkout-presale-locked-message");const r=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));o.appendChild(r);const c=document.createElement("p");c.textContent="Pre-ordered items will be charged when shipped.",o.appendChild(c),p.push(o)}return p}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const o=document.createElement("span");o.id="billingSameAsShipping",o.classList.add("checkout-checkbox-visual"),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Billing same as shipping checkbox"),o.setAttribute("aria-checked",t?"true":"false"),t&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const r=document.createElement("label");return r.textContent="Billing address same as shipping address",r.setAttribute("for","billingSameAsShipping"),r.classList.add("billing-checkbox-label"),n.appendChild(o),n.appendChild(r),e.appendChild(n),e}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),e={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t.billingSameAsShipping)return e;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Your billing info",l.classList.add("section-title"),c.appendChild(l);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),c.appendChild(d),e.push(c);const h=document.createElement("div");h.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","First name input"),u.appendChild(p);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","Last name input"),u.appendChild(m),h.appendChild(u);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:yt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","Email input"),h.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:yt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Phone input"),g.appendChild(v);const y=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});y.setAttribute("aria-label","Company input"),g.appendChild(y),h.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const x=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Street address input"),b.appendChild(x);const C=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});C.setAttribute("aria-label","Apt, suite, etc. (optional) input"),b.appendChild(C),h.appendChild(b);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","City input"),S.appendChild(_);const P=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","State input"),S.appendChild(P);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:yt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return I.setAttribute("aria-label","Zip Code input"),S.appendChild(I),h.appendChild(S),e.push(h),e}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path);e&&(e.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const e=[],n=document.createElement("div");n.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Buyer Information",c.classList.add("section-title"),n.appendChild(c);const l=document.createElement("p");l.textContent="Buyer information is used to process your order and for delivery purposes.",l.classList.add("section-subtitle"),n.appendChild(l),e.push(n);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:r.INPUT,inputType:"text",name:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});h.appendChild(u);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});h.appendChild(p),d.appendChild(h);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});d.appendChild(m);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});d.appendChild(f);const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});d.appendChild(g);const v=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return d.appendChild(v),e.push(d),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),e.push(this.saveButton),this.updateSaveButtonState(),e}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],e=this.getStoreValue("checkout.customerForm.data"),n=document.createElement("div");n.classList.add("checkout-summary-form-header");const o=document.createElement("h2");o.textContent="Buyer: "+e.firstName+" "+e.lastName,n.appendChild(o);const r=document.createElement("span");if(r.textContent="Edit",r.setAttribute("aria-label","Edit Buyer Information"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),r.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),n.appendChild(r),t.push(n),e.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=e.company,t.push(n)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=e.email,t.push(c);const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=e.phone,t.push(l);const d=document.createElement("p");return d.classList.add("checkout-summary-form-line"),d.textContent=formatISODateToMMDDYYYY(e.birthDate),t.push(d),t}}const Ct=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],St={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(Ct.includes(n)){const t=document.createElement(n),o=St[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(o.includes(e)){const o=sanitizeAttributeValue(e,n.value);null!==o&&t.setAttribute(e,o)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const o=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&o.appendChild(e)}return o.childNodes.length>0?o:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),o=n.querySelector("parsererror");if(o)return console.warn("HTML parsing error detected"),"";const r=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&r.appendChild(e)}const c=document.createElement("div");return c.appendChild(r),c.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,o,c,l;const d=[],h=this.getConfigs("configurations"),u=this.getConfigs("global"),p=this.getConfigs("checkout"),m=this.config.layout.exitUrl||window.location.host,f=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(e=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=null===(o=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===o?void 0:o.customLogo,e.alt=h.partnerName+" Logo",t.appendChild(e),d.push(t)}const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-container");const y=document.createElement("div");y.classList.add("checkout-completed-title-section");const b=document.createElement("h3");b.innerHTML=(null===(l=null===(c=this.config.layout)||void 0===c?void 0:c.checkoutCompleted)||void 0===l?void 0:l.customText)||"Thank You for Your Order!",y.appendChild(b);const x=document.createElement("p");x.textContent="Your payment has been successfully processed.",y.appendChild(x),v.appendChild(y),g.appendChild(v);const C=document.createElement("div");C.classList.add("checkout-completed-sub-section");const S=document.createElement("div");S.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Number",S.appendChild(_);const P=document.createElement("span");P.textContent=this.params.orderNumber,S.appendChild(P),C.appendChild(S);const I=document.createElement("div");I.classList.add("checkout-completed-line");const T=document.createElement("h3");T.textContent="Order Amount",I.appendChild(T);const F=document.createElement("span");F.textContent=""+formatCentToDollarText(this.params.orderTotal),I.appendChild(F),C.appendChild(I);const A=document.createElement("div");A.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Payment Method",A.appendChild(O);const R=document.createElement("span");R.textContent="** "+this.params.cardLast4,A.appendChild(R),C.appendChild(A),g.appendChild(C);const M=document.createElement("div");M.classList.add("checkout-completed-sub-section");const N=document.createElement("p");N.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>.",M.appendChild(N),g.appendChild(M),d.push(g);const B=document.createElement("div");B.classList.add("checkout-completed-section-container");const j=document.createElement("button");j.type="button";const q=document.createElement("span");q.textContent=f,j.setAttribute("tabindex","0"),j.setAttribute("role","button"),j.setAttribute("aria-label",f),j.appendChild(q);const U=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:u.theme.selectedTextColor}));j.appendChild(U),j.addEventListener("click",()=>{window.location.href=m}),j.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=m)}),B.appendChild(j),d.push(B);const Y=document.createElement("div");Y.classList.add("checkout-completed-section-container");const W=document.createElement("div");W.classList.add("checkout-completed-help-section"),Y.appendChild(W);const X=document.createElement("p");X.textContent="Questions about your order? Contact us at ";const J=document.createElement("a");J.href="mailto:"+h.supportEmail,J.textContent=h.supportEmail,X.appendChild(J),W.appendChild(X);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,W.appendChild($),d.push(Y),p.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(p.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),d.push(t),d.push(e),d.push(n)}if(u.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});d.push(t)}return d}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path),n=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==e?void 0:e.value)||(null==n?void 0:n.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let e;e=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=e}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift"),n=this.store.get("checkout.giftRecipientForm.data"),l=this.store.get("checkout.customerForm.data"),d=this.store.get("address.formattedAddress"),h=e?n:l,u=this.store.get("checkout.shippingAddressTwo"),p=this.store.get("checkout.deliveryInstructions");l.firstName&&(this.customerData.firstName={isValid:!![],value:l.firstName}),l.lastName&&(this.customerData.lastName={isValid:!![],value:l.lastName}),l.email&&(this.customerData.email={isValid:!![],value:l.email}),l.phone&&(this.customerData.phone={isValid:!![],value:l.phone}),l.company&&(this.customerData.company={isValid:!![],value:l.company}),l.birthDate&&(this.customerData.birthDate={isValid:!![],value:l.birthDate}),n.firstName&&(this.giftData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.giftData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.giftData.email={isValid:!![],value:n.email}),n.phone&&(this.giftData.phone={isValid:!![],value:n.phone}),n.message&&(this.giftData.message={isValid:!![],value:n.message}),u&&(this.customerData.addressTwo={isValid:!![],value:u},this.giftData.addressTwo={isValid:!![],value:u}),p&&(this.customerData.deliveryInstructions={isValid:!![],value:p},this.giftData.deliveryInstructions={isValid:!![],value:p});const m=this.store.get("checkout.fulfillments")||{},f=Object.values(m).some(t=>t.type===c.ON_DEMAND),g=[],v=document.createElement("div");v.classList.add("delivery-header-container");const y=document.createElement("div");y.classList.add("delivery-header-content");const b=document.createElement("div");b.classList.add("delivery-title-container");const x=document.createElement("h3");x.textContent="Deliver to",x.classList.add("delivery-title");const C=document.createElement("p");C.textContent="Package recipient must be 21+",C.classList.add("delivery-subtitle"),b.appendChild(x),b.appendChild(C),v.appendChild(b),g.push(v);const S=document.createElement("div");S.classList.add("section-form-container");const _=document.createElement("div");_.classList.add("checkout-two-col-container");const P=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?vt.firstName:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:h.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","First Name Input"),_.appendChild(P);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?vt.lastName:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:h.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(I.setAttribute("aria-label","Last Name Input"),_.appendChild(I),S.appendChild(_),!e){const t=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:h.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),S.appendChild(t)}const T=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:e?vt.email:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:h.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});T.setAttribute("aria-label","Email Input"),S.appendChild(T);const F=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:e?vt.phone:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:h.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(F.setAttribute("aria-label","Phone Input"),S.appendChild(F),!e){const t=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:h.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),S.appendChild(t)}const A=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:d,disabled:!![],className:"disabled-input"});A.setAttribute("aria-label","Delivery Address Input"),S.appendChild(A);const O=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?vt.addressTwo:gt.addressTwo,label:"Apt, suite, etc. (optional)",value:u,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(O.setAttribute("aria-label","Address Line 2 Input"),S.appendChild(O),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",vt.message);const c=document.createElement("textarea");c.name=vt.message,c.id=vt.message,c.rows=4,c.value=n.message||"",c.setAttribute("aria-label","Gift Message Textarea"),c.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(o.GIFT,{fieldName:vt.message}),this.updateSaveButtonState()});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"),e.appendChild(r),e.appendChild(c),e.appendChild(l),S.appendChild(e)}if(f){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Delivery Instructions",o.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.setAttribute("aria-label","Delivery Instructions Textarea"),r.value=p,r.addEventListener("input",async t=>{const n=t.target.value;e?(this.giftData.deliveryInstructions.value=n,this.giftData.deliveryInstructions.isValid=n.length>0):(this.customerData.deliveryInstructions.value=n,this.customerData.deliveryInstructions.isValid=n.length>0)});const 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"),n.appendChild(o),n.appendChild(r),n.appendChild(c),S.appendChild(n)}g.push(S),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const K=async()=>{e?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",K),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await K())}),g.push(this.saveButton),this.updateSaveButtonState(),g}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.data"),o=this.getStoreValue("checkout.giftRecipientForm.data"),r=this.getStoreValue("address"),c=this.getStoreValue("checkout.deliveryInstructions"),l=this.getStoreValue("checkout.shippingAddressTwo"),d=document.createElement("div");d.classList.add("checkout-summary-form-header");const h=document.createElement("h2");h.textContent=e?"Delivering to "+o.firstName+" "+o.lastName:"Delivering to "+n.firstName+" "+n.lastName,d.appendChild(h);const u=document.createElement("span");u.textContent="Edit",u.setAttribute("aria-label","Edit Delivery Information"),u.setAttribute("role","button"),u.setAttribute("tabindex","0");const H=async()=>{e?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(u.addEventListener("click",H),u.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await H())}),d.appendChild(u),t.push(d),!e&&n.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=n.company,t.push(e)}const p=document.createElement("p");p.classList.add("checkout-summary-form-line"),p.textContent=r.address.one+(l?", "+l:"")+", "+r.address.city+", "+r.address.state+", "+r.address.zip,t.push(p);const m=document.createElement("p");m.classList.add("checkout-summary-form-line"),m.textContent=e?o.email:n.email,t.push(m);const f=document.createElement("p");if(f.classList.add("checkout-summary-form-line"),f.textContent=e?o.phone:n.phone,t.push(f),!e&&n.birthDate){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(e)}if(e){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Gift Message:",e.appendChild(n);const r=document.createElement("span");r.classList.add("checkout-summary-form-line"),r.textContent=o.message||"No message provided.",e.appendChild(r),t.push(e)}if(c){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Delivery Instructions:",e.appendChild(n);const o=document.createElement("span");o.classList.add("checkout-summary-form-line"),o.textContent=c||"No instructions provided.",e.appendChild(o),t.push(e)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),o=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(o)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const V=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),V())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(r.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const o=document.createElement("h1");o.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",o.classList.add("checkout-header-title"),o.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()}),n?[n,o,c]:[o,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.isEditing"),n=this.getStoreValue("checkout.giftRecipientForm.isEditing"),o=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=e?"block":"none",this.buyerSummary.style.display=e?"none":"block",this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block"):(this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=o?"block":"none",this.paymentSummary.style.display=o?"none":"block"}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm"),o=this.getStoreValue("checkout.giftRecipientForm"),c=this.getStoreValue("checkout.paymentForm"),l=ComponentFactoryService.createElement({type:r.CHECKOUT_SEND_AS_GIFT});return t.push(l),this.deliveryToForm=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=e?o.isEditing?"block":"none":n.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=e?o.isEditing?"none":"block":n.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER}),this.buyerForm.style.display=e&&n.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=e&&!n.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT}),this.paymentForm.style.display=c.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=c.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var e,n,o,r;const c=t.find(t=>"checkout.items"===t.path);c&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const l=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(l){const t=l.oldValue,c=l.value;if(c.updating)return![];const d=(null==t?void 0:t.quantity)!==(null==c?void 0:c.quantity),h=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],u=(null===(r=null===(o=null==c?void 0:c.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],p=JSON.stringify(h)!==JSON.stringify(u);(d||p)&&this.updateEngravingElement(c)}return![]}updateEngravingElement(t){var e,n;const o=this.getConfigs("global"),c=this.container.querySelector(".engraving-view-container");if(c&&c.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const t=this.getStoreValue("cart.fulfillments."+e),o=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(o&&o.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","checkout-retailer-alert"),n.before(e)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const o=this.getConfigs("global"),c=this.getStoreValue("checkout.items."+this.params.itemId),l=null===(t=null==c?void 0:c.attributes)||void 0===t?void 0:t.presale,d=(null==l?void 0:l.isActive)&&(null==l?void 0:l.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(l.estimatedShipBy):"";if(!c)return[];const h=this.getStoreValue("checkout.fulfillments."+c.fulfillmentId),u=this.getStoreValue("checkout.retailers."+c.retailerId),p=document.createElement("div");p.classList.add("checkout-item-card-header");const m=document.createElement("div");m.classList.add("checkout-item-image");const f=document.createElement("img");f.src=c.mainImage,f.alt=c.name,f.loading="lazy",m.appendChild(f),p.appendChild(m);const g=document.createElement("div");g.classList.add("checkout-item-details-container");const v=document.createElement("h4");v.classList.add("checkout-item-title"),v.textContent=c.name,g.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=l.isActive?d+",":(c.attributes.engraving.hasEngraving?null==h?void 0:h.engravingExpectation:null==h?void 0:h.expectation)+",",y.appendChild(b);const x=document.createElement("span");x.textContent="From "+((null==u?void 0:u.name)||"Retailer"),y.appendChild(x),g.appendChild(y),p.appendChild(g),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(c.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),p.appendChild(this.trashButton);const C=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:c.cartItemId}),S=[];if(S.push(p),o.layout.enablePersonalization&&(null===(n=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:c.cartItemId,context:"checkout"});S.push(t)}return S.push(C),S}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const o=this.getStoreValue("checkout.items."+this.params.itemId);if(!o)return 0;const r=this.getStoreValue("products");if(!r)return 0;const c=o.partNumber,l=o.fulfillmentId,d=null===(n=null===(e=null===(t=Object.values(r).find(t=>t.sizes[o.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[o.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder;if(!d)return 0;const h=this.getStoreValue("checkout.items")||{},u=Object.values(h).filter(t=>t.partNumber===c&&t.fulfillmentId===l),p=u.reduce((t,e)=>t+e.quantity,0);return d-p}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),o=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),r=e.quantity,c=this.getAvailableQuantity(),l=c>0,d=!(o&&1===r);return{currentQuantity:r,availableQuantity:c,isTheOnlyItem:o,canIncrease:l,canDecrease:d}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(o){this.logger.error("Checkout item quantity change operation failed",o)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.calculateQuantityLimits(),n=document.createElement("div");n.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const o=document.createElement("span");if(o.classList.add("checkout-item-price-text"),o.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",o.appendChild(e)}return[n,o]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of Object.values(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),o=new Set;for(const r of n){const t=r.getAttribute("data-item-id");t&&o.add(t)}for(const r of n){const t=r.getAttribute("data-item-id");t&&!e.has(t)&&r.remove()}for(const[r]of e)if(!o.has(r)){const e=this.createItemElement(r);e.setAttribute("data-item-id",r),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const o=t[n];if("checkout"===o.path||"checkout.items"===o.path||"checkout.items."===o.path.substring(0,15)){e=o;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const o=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",o?"true":"false"),e.setAttribute("aria-label",o?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=Object.values(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const o=document.createElement("span");o.classList.add("checkout-items-toggler-label"),o.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(r);const c=document.createElement("div");c.classList.add("checkout-items-list","show");for(const l of e){const t=this.createItemElement(l.cartItemId);t.setAttribute("data-item-id",l.cartItemId),c.appendChild(t)}return[n,c]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let o;e.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const r=document.createElement("span");r.id="emailOptIn",r.classList.add("checkout-checkbox-visual"),o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Email opt-in checkbox"),r.setAttribute("aria-checked",o?"true":"false"),r.addEventListener("click",()=>this.handleEmailToggle(r)),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(r))});const c=document.createElement("label");c.setAttribute("for","emailOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(t.text),c.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),r.classList.toggle("checked"))}),e.appendChild(r),e.appendChild(c),n.appendChild(e)}if(e.show){const t=document.createElement("div");let o;t.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const r=document.createElement("span");r.classList.add("checkout-checkbox-visual"),r.id="smsOptIn",o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","SMS opt-in checkbox"),r.setAttribute("aria-checked",o?"true":"false"),r.addEventListener("click",()=>this.handleSmsToggle(r)),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(r))});const c=document.createElement("label");c.setAttribute("for","smsOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(e.text),c.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),r.classList.toggle("checked"))}),t.appendChild(r),t.appendChild(c),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).some(t=>t.type===c.ON_DEMAND)}template(){var t;const e=[],n=this.getConfigs("global"),o=this.getConfigs("checkout"),c=this.getConfigs("global"),l=o.layout.allowGiftCards,d=null===(t=null==c?void 0:c.layout)||void 0===t?void 0:t.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),e.push(h);const p=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});e.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),e.push(m),l||d){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});e.push(t),e.push(f)}const g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="100% Secure Payments",v.classList.add("disclaimer-header"),g.appendChild(v);const y=document.createElement("p");y.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",y.classList.add("disclaimer-description"),g.appendChild(y),e.push(g);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});e.push(b);const x=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});e.push(x);const C=this.marketingOptInsContainer();if(C&&e.push(C),o.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(o.layout.legalMessage.text),e.push(t),e.push(n)}const S=document.createElement("div");if(S.classList.add("checkout-separator"),e.push(S),n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=e.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(e.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],e="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)e="Saving...",t=!![];else if(this.stripeFormStatus.hasError)e="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!e}else{const e=this.stripeFormStatus.isFormComplete,n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(e&&n)}this.saveButton.disabled=t,this.saveButton.textContent=e,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const o=document.createElement("p");if(o.textContent="All transactions are secure and encrypted.",o.classList.add("section-subtitle"),e.appendChild(o),t.push(e),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const e=document.createElement("p");e.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(e),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const c=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(c),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in edit mode",e),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in beta mode",n),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,e,n,o,r,c,l,d,h;const u=[],p=this.getStoreValue("checkout.paymentForm"),m=document.createElement("div");m.classList.add("checkout-summary-form-header");const f=document.createElement("h2");f.textContent="Paying with "+capitalizeFirstLetter(null!==(n=null===(e=null===(t=p.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(r=null===(o=p.paymentMethod)||void 0===o?void 0:o.card)||void 0===r?void 0:r.last4),m.appendChild(f);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Payment Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),m.appendChild(g),u.push(m);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(l=null===(c=p.paymentMethod)||void 0===c?void 0:c.card)||void 0===l?void 0:l.expMonth)+"/"+(null===(h=null===(d=p.paymentMethod)||void 0===d?void 0:d.card)||void 0===h?void 0:h.expYear),u.push(v),u}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const e=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);e&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],e=this.store.get("checkout.error")||null;this.updateErrorDisplay(e);const n=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!e});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:e}){const n=this.config.layout.placeOrderButtonText,o=this.store.get("checkout.presale");let r=![];if(!o){const t=this.getStoreValue("cart.fulfillments")||{};r=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const c=this.store.get("checkout.isGift"),l=this.store.get("checkout.customerForm.isValid"),d=this.store.get("checkout.giftRecipientForm.isValid"),h=this.store.get("checkout.paymentForm.isValid");return r||c&&!d||!l||!h?{state:"disabled",text:n,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:e?{state:"disabled",text:n,disabled:!![]}:{state:"ready",text:n,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const c=document.createElement("span");c.classList.add("error-text"),n.appendChild(o),n.appendChild(c),e.appendChild(n);const l=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,l,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presale"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value.expiresAt),!![];const o=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==o?void 0:o.value)||void 0===e?void 0:e.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,e=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&n>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&n<e&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var t,e;const n=[".drawer-content"];for(const r of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(r);if(e&&this.isScrollable(e))return e}let o=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;o&&o!==document.body;){if(this.isScrollable(o))return o;o=o.parentElement}return null}setScrolledState(t){var e,n;this.isCurrentlyScrolled=t,t?(null===(e=this.rootElement)||void 0===e?void 0:e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(n=this.rootElement)||void 0===n?void 0:n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);this.initialDurationSeconds=Math.min(n,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,o=this.initialDurationSeconds-n,r=Math.max(0,Math.min(100,o/this.initialDurationSeconds*100)),c=n<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;c!==this.isUnderOneMinute&&(this.isUnderOneMinute=c,this.updateWarningState()),this.updateTimerDisplay(e),this.updateProgressBar(r),0===e&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-timer]");e&&(e.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-progress-fill]");e&&(e.style.width=t+"%")}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),o=e%60,r=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=this.createTextContainer(),n=this.createProgressBar();return t.appendChild(e),t.appendChild(n),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const e=this.createHeader(),n=this.createSubtitle();return t.appendChild(e),t.appendChild(n),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const e=document.createElement("h2");e.textContent="LIMITED PRE-ORDER:";const n=document.createElement("div");return n.classList.add("checkout-presale-timer"),n.setAttribute("data-timer",""),n.textContent="00:00:00",t.appendChild(e),t.appendChild(n),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const e=document.createElement("div");return e.className="checkout-presale-progress-fill",e.setAttribute("data-progress-fill",""),e.style.width="0%",t.appendChild(e),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,e;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(e=this.params)||void 0===e?void 0:e.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const l=document.createElement("p");l.classList.add("presale-expired-title");const d=document.createElement("p"),h=document.createElement("div");h.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(l.textContent="Items No Longer Available",d.textContent="The presale items you were trying to purchase are no longer available.",h.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(l.textContent="Session Expired",d.textContent="Your reservation time has ended. The item has been released for other customers.",h.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),c.appendChild(l),c.appendChild(d),o.appendChild(c),n.appendChild(o),n.appendChild(h),t.push(n);const u=document.createElement("div");u.classList.add("checkout-completed-section-container");const p=document.createElement("button");p.setAttribute("aria-label","Continue shopping"),p.type="button";const m=document.createElement("span");m.textContent="Continue Shopping",p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label","Continue Shopping"),p.appendChild(m);const f=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:e.theme.selectedTextColor}));if(p.appendChild(f),p.addEventListener("click",()=>this.handleExit()),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),u.appendChild(p),t.push(u),this.isTimeExpired()){const e=document.createElement("div");e.classList.add("checkout-completed-section-container");const n=document.createElement("p");n.classList.add("checkout-completed-auto-close-text"),n.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const o=document.createElement("span");o.classList.add("checkout-completed-auto-close-text"),o.textContent="seconds",e.appendChild(n),e.appendChild(this.autoCloseElement),e.appendChild(o),t.push(e)}if(e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,o=Boolean(n),r=Boolean(t);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;r&&this.promoCodeText&&t.discount!==(null==n?void 0:n.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.promoCode"),r=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(o)||Boolean(r)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const V=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),V())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),e=document.createElement("div");e.classList.add("gift-label-wrapper");const n=document.createElement("span");n.textContent="Send as Gift? (Free)",n.classList.add("gift-toggle-label"),e.appendChild(n);const o=document.createElement("span");o.textContent="With personalized note & gift receipt.",o.classList.add("gift-toggle-description"),e.appendChild(o);const r=document.createElement("div");r.classList.add("toggle-switch"),r.classList.toggle("active",t);const c=document.createElement("div");return c.classList.add("toggle-slider"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Toggle Gift Option"),r.setAttribute("role","switch"),r.setAttribute("aria-checked",t?"true":"false"),r.appendChild(c),r.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),r.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[e,r]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.R=null,this.L=null,this.M=![],this.N=![],this.B=![],this.j=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.R=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.L=this.R.create("payment",t.elementOptions),this.L.mount(this),this.L.on("change",async t=>{const e=!!t.error,n=t.complete,o=e?t.error.message:null;this.N=n,this.M||await this.updateStripeFormStatus({isFormComplete:n,isProcessing:![],hasCompletedPayment:![],errorMessage:o,hasError:e})}),this.L.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){var t,e;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.N)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:n},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(n){console.error("Payment submission error:",n),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"Payment processing failed. Please try again."}),((null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.includes("expired"))||(null===(e=null==n?void 0:n.message)||void 0===e?void 0:e.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.j||(this.j=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",i),this.j=null,e(new Error("Session refresh timeout"))},1e4),i=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",i),this.j=null,t()};this.addEventListener("lce:s:refreshSession",i,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.j}async refreshPaymentSession(){try{this.R&&this.R.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ot){console.error("Failed to refresh payment session:",ot),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.L&&this.L.clear(),this.N=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ot){console.error("Failed to reset form:",ot)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.R)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.R.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.R,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:o}=await this.O.createConfirmationToken(e);if(n)throw new SDKError(n.message||"Failed to create confirmation token");if(!o||!o.id)throw new SDKError("Invalid confirmation token received");return o.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.j=null,this.L&&(this.L.unmount(),this.L=null),this.R&&(null===(e=(t=this.R).destroy)||void 0===e?void 0:e.call(t),this.R=null),this.O=null,this.M=![],this.N=![],this.B=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.querySelector('script[src*="stripe.com"]');if(n)return n.addEventListener("load",()=>t()),n.addEventListener("error",()=>e(new Error("Failed to load Stripe.js"))),void 0;const o=document.createElement("script");o.src="https://js.stripe.com/basil/stripe.js",o.async=!![],o.onload=()=>t(),o.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(o)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(e.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(e.value)}}handleSavedCardChange(t){var e,n,o,r;(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.brand)&&(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(r=(o=this.callbacks).onSavedCardInfoChanged)||void 0===r||r.call(o,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,e,n,o,r,c;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(e=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===e||e.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(o=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===o||o.call(n,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(c=(r=this.callbacks).onEditModeVisibilityChanged)||void 0===c||c.call(r,![]))}async afterRender(){var t,e,n,o;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const r=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(e=null==r?void 0:r.card)||void 0===e?void 0:e.brand)&&r.card.last4&&(this.savedCardInfo={brand:r.card.brand,last4:r.card.last4}),null===(o=(n=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(n,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var e,n;this.stripeFormStatus=t.detail.status,null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var e,n,o,r,c;try{const{confirmationTokenId:o,setupIntentId:r}=t.detail;await(null===(n=(e=this.callbacks).onPaymentSessionConfirmed)||void 0===n?void 0:n.call(e,o,r)),this.isChangingPayment=![]}catch(l){this.logger.error("Failed to save payment form",l),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==l?void 0:l.message)||"Failed to save payment information. Please try again."},null===(r=(o=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(o,this.stripeFormStatus),null===(c=this.stripeFormElement)||void 0===c||c.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}}))}catch(e){this.logger.error("Failed to refresh payment session",e)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const e=document.createElement("button");e.type="button",e.classList.add("change-payment-link"),e.textContent="Change",e.setAttribute("aria-label","Change Payment Method"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>this.handleChangePayment()),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,e),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,e;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(e=(t=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const e=document.createElement("slot");return e.setAttribute("name",ft),this.stripeFormContainer.appendChild(e),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),c=t.hasAttribute("drawer"),l=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),d="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&c&&l&&d)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.paymentForm.paymentSession"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"dark"===n.layout.poweredByMode?"night":"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,e,n;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const c=o.querySelectorAll('[slot="'+ft+'"]');if(c.length>0)for(const r of c)r.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",ft),o.appendChild(this.stripeFormElement)}catch(l){this.logger.error("Stripe form element creation failed",l),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===c.ON_DEMAND)}getRetailerNameForFulfillment(t){const e=this.getStoreValue("checkout.items")||{},n=this.getStoreValue("checkout.retailers")||{},o=Object.values(e).find(e=>e.fulfillmentId===t);if(!o)return"Retailer";const r=n[o.retailerId];return(null==r?void 0:r.name)||"Retailer"}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const o=this.getOnDemandFulfillments();if(!o.find(e=>e.id===t))return;const r=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,r)}catch(c){this.logger.error("Checkout fulfillment tip update failed",c)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillments();if(n.find(e=>e.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(o){this.logger.error("Checkout fulfillment tip removal failed",o)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],o=this.getTipSelection();for(const r of e){const e=document.createElement("button");e.type="button",e.textContent=r+"%",e.classList.add("checkout-tip-button"),e.disabled=n,o===r&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(r)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getOnDemandFulfillments();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const o=document.createElement("h3");o.textContent="View Tip Distribution",o.classList.add("checkout-sub-header"),n.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(r),t.appendChild(n);const c=document.createElement("div");c.classList.add("retailers-tips-list","show");for(const l of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=this.getRetailerNameForFulfillment(l.id),e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const o=document.createElement("div");o.classList.add("dollar-input-container");const r=document.createElement("span");r.classList.add("dollar-sign"),r.textContent="$";const d=document.createElement("input");let h;d.type="number",d.id="tip-input-"+l.id,d.name="tip-"+l.id,d.min="0",d.step="0.01",d.placeholder="0.00",d.classList.add("dollar-input"),d.value=l.amounts.tip>0?(l.amounts.tip/100).toFixed(2):"",d.disabled=this.getStoreValue("checkout.updating")||![],d.addEventListener("wheel",t=>{t.preventDefault()}),d.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),d.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),d.addEventListener("paste",t=>{t.preventDefault()}),d.addEventListener("contextmenu",t=>{t.preventDefault()}),d.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),d.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(l.id,n)},500)}),o.appendChild(r),o.appendChild(d),n.appendChild(o);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.id)),n.appendChild(u),t.appendChild(n),c.appendChild(t)}return t.appendChild(c),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getOnDemandFulfillments();if(t&&e.length>0){const o=e.every(t=>t.amounts.tip>0);if(o)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed during fallback",o),this.isInitialized=![]}}template(){const t=[],e=this.getOnDemandFulfillments();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const o=document.createElement("h3");o.classList.add("checkout-sub-header"),o.textContent="Add a tip",n.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-tip-config-container");const c=this.createTipSelectionButtons();r.appendChild(c),n.appendChild(r);const l=document.createElement("p");l.classList.add("checkout-tip-disclaimer"),l.textContent="Tips will be split proportionally between retailers.",n.appendChild(l);const d=this.createTipDistribution();return t.push(n,d),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const o=t.find(t=>"checkout.giftCardError"===t.path),r=t.find(t=>"checkout.promoCodeError"===t.path),c=t.find(t=>"checkout.giftCards"===t.path);if(c&&this.updateAppliedGiftCards(c.value),o){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),o.value){const e=this.createErrorElement(o.value);t.after(e)}const r=t.querySelector(".apply-button");r&&(r.disabled=Boolean(o.value))}}if(r){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),r.value){const e=this.createErrorElement(r.value);t.after(e)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(r.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.applied)+")",e.appendChild(n);const o=document.createElement("button");return o.type="button",o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(o),e}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),o=e.layout.allowGiftCards,c=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),h=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});c&&l.appendChild(d);const u=this.getStoreValue("checkout.promoCodeError");if(u){const t=this.createErrorElement(u);t.classList.add("promo-code-error-wrapper"),l.appendChild(t)}o&&l.appendChild(h);const p=this.getStoreValue("checkout.giftCardError");if(p){const t=this.createErrorElement(p);l.appendChild(t)}return l}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const o=document.createElement("p");return o.textContent=t.toString(),e.appendChild(n),e.appendChild(o),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:o}){var r,l,d,h,u,p,m,f;const g=e===c.ON_DEMAND;let v=null;g&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(v=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(l=t.hourStatus)||void 0===l?void 0:l.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const y=g&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="popup-retailer-card "+(n?"selected":"")+" "+y,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===c.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.variant.price)&&void 0!==h?h:0));const C=document.createElement("div");C.className="row";const S=document.createElement("span");S.className="name",S.textContent=t.retailerName,C.appendChild(S);const _=document.createElement("span");_.className="price",_.textContent=formatCentToDollarText(null!==(u=t.variant.price)&&void 0!==u?u:0),C.appendChild(_),b.appendChild(C);const P=document.createElement("div");P.className="row";const I=document.createElement("span");I.className="expectation",I.textContent=t.hourStatus.isClosed?v:(null===(p=null==o?void 0:o.presale)||void 0===p?void 0:p.isActive)?(null===(m=null==o?void 0:o.presale)||void 0===m?void 0:m.isActive)&&(null===(f=null==o?void 0:o.presale)||void 0===f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==o?void 0:o.presale.estimatedShipBy):"":null==t?void 0:t.expectation,P.appendChild(I);const T=document.createElement("span");if(T.className="fee",T.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",P.appendChild(T),b.appendChild(P),g){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=t.retailerAddressFormatted,e.appendChild(n),b.appendChild(e)}return b}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:o,onTabClick:r,enableShippingFulfillment:l,enableOnDemandFulfillment:d}){const h=e.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 e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",c.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",r),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(n?"selected":""),o.textContent="Shipping ("+t.length+")",e.appendChild(o),u.appendChild(e)}if(d){const t=document.createElement("div");t.className="fulfillment-tab "+(o?"selected":"")+" "+(h?"":"disabled"),t.setAttribute("data-fulfillment-type",c.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",o?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),h||t.setAttribute("aria-disabled","true"),t.addEventListener("click",r),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(o?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),u.appendChild(t)}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","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const o=n.selectedFulfillment.variant.partNumber,r=n.selectedFulfillment.id,c=null===(t=n.sizes[n.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!c)return 0;const l=this.getStoreValue("cart.items")||{},d=Object.values(l).filter(t=>t.partNumber===o&&t.fulfillmentId===r),h=d.reduce((t,e)=>t+e.quantity,0);return c-h}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);return e.selectedFulfillment?e.selectedFulfillmentType===c.ON_DEMAND&&e.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const o=this.getProductId(),r=this.getStoreValue("products."+o);if(!r.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:o,selectedSizeId:r.selectedSizeId}),void 0;const c=this.getSizeAttributes(),l=(null===(t=null==c?void 0:c.presale)||void 0===t?void 0:t.isActive)===!![],d=this.isPresaleActive(c);l&&d?await this.commands.product.addPresaleToCart(o,{fulfillmentId:r.selectedFulfillment.id,partNumber:null===(e=r.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:r.quantity,identifier:o}):await this.commands.product.addToCart(o,{fulfillmentId:r.selectedFulfillment.id,partNumber:null===(n=r.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:r.quantity,identifier:o})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,o=n.variant.price*e.quantity;return{quantity:e.quantity,totalPrice:o}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),o=this.calculateQuantityLimits(),r=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],c=this.isPresaleActive(n),l=r?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?l+" - "+formatCentToDollarText(e):l;const d=r&&!c||0===o.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),u=this.config.layout.addToCartButtonShowTotalPrice?l+" for "+formatCentToDollarText(e):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 t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const o=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);o.push(t)}const r=this.createAddToCartButton();return o.push(r),o}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),o="About this product:",r="See More",c="See Less",l=document.createElement("h3");l.className="title",l.textContent=o;const d=document.createElement("div");d.className="content collapsed",d.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const h=document.createElement("span");h.className="collapse-button",h.textContent=r,h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label","Show more product information"),h.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,d.classList.toggle("collapsed"),h.textContent=this.isCollapsed?r:c,h.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),h.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return h.addEventListener("click",toggleContent),h.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[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(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const o=n.value,r=o.isOpen,c=null===(e=o.contentConfig)||void 0===e?void 0:e.type,l=c!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=c,this.openWithContent(o),![]):r&&this.isOpen&&!l?![]:r&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(o),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:o}=t||{},r=ComponentFactoryService.createElement({type:n,...o});this.contentContainer&&this.contentContainer.appendChild(r),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay,e=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",t,e]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var e;const n=this.params.productId,o=t.find(t=>t.path==="products."+n+".selectedSizeId");if(null==o?void 0:o.value){const t=this.getStoreValue("products."+n),r=null===(e=null==t?void 0:t.sizes)||void 0===e?void 0:e[o.value],c=null==r?void 0:r.image;if(c){const t=this.params.images.indexOf(c);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+c+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const o=this.container.querySelectorAll(".carousel-dot");for(let r=0;r<o.length;r++){const e=o[r];e.classList.toggle("active",r===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,o=e.offsetLeft+e.offsetWidth/2,r=n/2,c=r-o,l=0,d=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(d,Math.min(l,c)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,o=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,o=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,r=t.changedTouches[0].clientY-o;Math.abs(e)>Math.abs(r)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+n,r=0,c=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(c,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=this.config.layout.showOnlyMainImage,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])+"')",e&&!n){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}o.appendChild(t)}if(this.mainImageElement=o,t.push(o),!n){const e=document.createElement("div");e.className="gallery-viewport";const n=document.createElement("div");n.className="gallery-container";for(let t=0;t<this.params.images.length;t++){const e=this.params.images[t],o=document.createElement("div");o.className="gallery-image-wrapper "+(0===t?"selected":"");const r=document.createElement("img");r.src=e,r.className="gallery-image",r.alt="Product thumbnail "+(t+1),r.loading="lazy",o.appendChild(r),n.appendChild(o)}e.appendChild(n),t.push(e)}return t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e;const n=this.getProductId();if(!t.some(t=>t.path==="products."+n+".selectedFulfillmentType"))return;const o=this.getStoreValue("products."+n),r=this.getConfigs("global");this.addPersonalizationSpan&&(o.selectedFulfillmentType===c.SHIPPING&&r.layout.enablePersonalization&&o.productHasAvailability&&(null===(e=null==o?void 0:o.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const o=n.textContent||"",r=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+o),n.setAttribute("aria-pressed",r?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var o;const r=n.dataset.sizeId;if(!r)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,r);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const c=this.getStoreValue("products."+t),l=this.getConfigs("global");this.addPersonalizationSpan&&(l.layout.enablePersonalization&&c.productHasAvailability&&(null===(o=c.selectedFulfillment)||void 0===o?void 0:o.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const o=document.createElement("h3");o.className="size-label",o.textContent="Size",o.id="size-label",n.appendChild(o);const r=document.createElement("div");r.className="size-buttons-container",r.setAttribute("role","group"),r.setAttribute("aria-labelledby","size-label");for(const c of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",c.id),e.setAttribute("select-size",""),e.className="size-button "+(c.id===t?"selected":"");const n=c.packDesc?" ("+c.packDesc+")":"";e.textContent=""+c.size+n,r.appendChild(e)}return n.appendChild(r),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e;const n=this.getProductId(),o=this.getStoreValue("products."+n),c=o.sizes[o.selectedSizeId],l=this.getConfigs("global"),d=[],h=document.createElement("div");h.className="price-personalization-container";const u=ComponentFactoryService.createElement({type:r.PRODUCT_PRICE,productId:n});if(h.appendChild(u),l.layout.enablePersonalization&&o.productHasAvailability&&(null===(t=null==o?void 0:o.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=l.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",l.layout.personalizationText);const addPersonalization=async()=>{var t,e,c,l,d,h,u,p;const m=o.sizes[o.selectedSizeId];await this.commands.product.openProductDrawer(n,r.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=m.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(l=null===(c=m.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,fee:(null===(h=null===(d=m.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.fee)||0,location:null===(p=null===(u=m.attributes)||void 0===u?void 0:u.engraving)||void 0===p?void 0:p.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),h.appendChild(this.addPersonalizationSpan)}d.push(h);const p=this.renderProductSizes(o.selectedSizeId,o.sizes);if(d.push(p),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,productId:n});d.push(t)}const m=ComponentFactoryService.createElement({type:r.PRODUCT_RETAILERS,productId:n});d.push(m);const f=ComponentFactoryService.createElement({type:r.PRODUCT_ADD_TO_CART_SECTION,productId:n});d.push(f);const g=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.presale;if((null==g?void 0:g.isActive)===!![]&&(null==g?void 0:g.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==g?void 0:g.language)||""),d.push(t)}if(this.config.layout.showDescription&&(o.description.trim().length>0||o.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:r.PRODUCT_DESCRIPTION,productId:n});d.push(t)}return d}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:o,fulfillmentDisplay:r,showImages:c,showOnlyMainImage: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"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),h.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),h.appendChild(t),h}const u=document.createElement("div");u.classList.add("wave","sc-price"),h.appendChild(u);const p=document.createElement("div");p.classList.add("sc-sizes");const m=document.createElement("div");m.classList.add("wave","sc-size-button"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),p.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),p.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),p.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),p.appendChild(y),h.appendChild(p);const b=document.createElement("div");b.classList.add("sc-row");const x=document.createElement("div");x.classList.add("wave","sc-price"),b.appendChild(x);const C=document.createElement("div");C.classList.add("wave","sc-personalization"),b.appendChild(C),h.appendChild(b);const S=document.createElement("div");S.classList.add("wave","sc-deliver-to"),h.appendChild(S);const _=document.createElement("div");_.classList.add("wave","sc-address"),h.appendChild(_);const P=document.createElement("div");P.classList.add("wave","sc-retailers",r),h.appendChild(P);const I=document.createElement("div");if(I.classList.add("sc-row"),o){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),I.appendChild(t)}const T=document.createElement("div");if(T.classList.add("wave","sc-add-to-cart"),I.appendChild(T),h.appendChild(I),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),h.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),h.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),h.appendChild(n);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-more"),h.appendChild(r)}const F=document.createElement("div");if(F.classList.add("product-content"),F.appendChild(h),d.appendChild(F),c){d.classList.add("has-images");const t=this.createImageSkeletons(l);d.prepend(t)}return d}createImageSkeletons(t){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");if(n.classList.add("wave","sc-main-image"),n.title="Product main image loading",!t){const t=document.createElement("div");t.classList.add("carousel-dots");for(let e=0;e<3;e++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),t.appendChild(e)}n.appendChild(t)}if(e.appendChild(n),!t){const t=document.createElement("div");t.classList.add("gallery-viewport");const n=document.createElement("div");n.classList.add("gallery-container");for(let e=0;e<4;e++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),n.appendChild(t)}t.appendChild(n),e.appendChild(t)}return e}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:r.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t);let n=e.noAvailabilityPrice;return e.selectedFulfillment&&(n=e.selectedFulfillment.variant.price),formatCentToDollarText(n)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),o=[],c=this.getConfigs("configurations");if(!e.productHasAvailability||!c.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),o.push(t),o}const l="carousel"===n.layout.fulfillmentDisplay?r.PRODUCT_RETAILERS_CAROUSEL:r.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:l,productId:t});return o.push(d),o}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,o=e.offsetLeft+e.offsetWidth/2,r=n/2,c=r-o,l=0,d=-(this.listContainer.scrollWidth-n);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(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+n,r=0,c=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(c,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const o=this.getStoreValue("products."+e+".selectedFulfillment");if(o&&o.id===n)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:o}){var r,l,d,h,u,p,m,f;const g=e===c.ON_DEMAND;let v=null;g&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(v=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(l=t.hourStatus)||void 0===l?void 0:l.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const y=g&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="carousel-retailer-card "+(n?"selected":"")+" "+y,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===c.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.variant.price)&&void 0!==h?h:0));const C=document.createElement("div");C.className="retailer-header";const S=document.createElement("h3");if(S.className="name",S.textContent=t.retailerName,C.appendChild(S),g){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,C.appendChild(e)}const _=document.createElement("div");_.className="retailer-body";const P=document.createElement("span");P.className="product-price",P.textContent=formatCentToDollarText(null!==(u=t.variant.price)&&void 0!==u?u:0);const I=document.createElement("span");I.className="shipping-price",I.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const T=document.createElement("span");return T.className="expectation",T.textContent=t.hourStatus.isClosed?v:(null===(p=null==o?void 0:o.presale)||void 0===p?void 0:p.isActive)?(null===(m=null==o?void 0:o.presale)||void 0===m?void 0:m.isActive)&&(null===(f=null==o?void 0:o.presale)||void 0===f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==o?void 0:o.presale.estimatedShipBy):"":null==t?void 0:t.expectation,_.append(P,I,T),b.append(C,_),b}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,r=[];for(const c in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,c)&&r.push(n.shippingFulfillments[c]);const l=[];for(const c in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,c)&&l.push(n.onDemandFulfillments[c]);const d=e.selectedFulfillmentType===c.SHIPPING,h=e.selectedFulfillmentType===c.ON_DEMAND,u=d?r:l,p=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===u.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const m of u){const t=this.generateRetailerCard({fulfillment:m,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:m.id===e.selectedFulfillmentId,selectedSizeAttributes:o}),n=e.selectedFulfillmentType===c.ON_DEMAND&&m.hourStatus.isClosed;n?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[p,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,l=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,h=Object.values(n.shippingFulfillments),u=Object.values(n.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=e.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(r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),m.appendChild(f),m.appendChild(g),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,t]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";const y=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:o});return v.appendChild(y),[m,v]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const w=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},o=this.getStoreValue("products."+e+".selectedFulfillment");if(o&&o.id===n)return await w(),void 0;await this.commands.product.selectFulfillment(e,n),await w()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,r=[];for(const c in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,c)&&r.push(n.shippingFulfillments[c]);const l=[];for(const c in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,c)&&l.push(n.onDemandFulfillments[c]);const d=e.selectedFulfillmentType===c.SHIPPING,h=e.selectedFulfillmentType===c.ON_DEMAND,u=d?r:l,p=document.createElement("h5");p.className="popup-retailers-section-title",p.textContent="Delivery Options";const m=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===u.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,m,t]}const f=document.createElement("div");f.className="popup-fulfillment-list-container";for(const c of u){const t=renderPopupRetailerCard({fulfillment:c,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:c.id===e.selectedFulfillmentId,selectedSizeAttributes:o});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),f.appendChild(t)}return[p,m,f]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),o=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==o?void 0:o.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:r.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],c=document.createElement("div");c.classList.add("product-content-wrapper"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+n.name);const l=document.createElement("div");if(l.classList.add("product-content"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,l.appendChild(t)}const d=ComponentFactoryService.createElement({type:r.PRODUCT_OPTIONS,productId:e});l.appendChild(d);const h=ComponentFactoryService.createElement({type:r.PRODUCT_DRAWER,productId:e});if(l.appendChild(h),c.appendChild(l),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return c;c.classList.add("has-images");const u=ComponentFactoryService.createElement({type:r.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return c.prepend(u),u.setAttribute("aria-label","Product images"),c}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t;const e=this.params.product,n=this.getStoreValue("address.address"),o={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==n?void 0:n.state)||"",isPresale:![],isPresaleActive:![]},r=e.sizes[0];if(!r)return o;const c=Object.values(r.shippingVariants)[0];if(!c)return o;o.upc=r.upc;const l=r.attributes||{};return o.isPresale=(null===(t=l.presale)||void 0===t?void 0:t.isActive)===!![],o.isPresaleActive=this.isPresaleActive(l),this.params.shippingFulfillment&&c.shippingFulfillmentId===this.params.shippingFulfillment.id&&c.stock>0?(o.hasAvailability=!![],o.fulfillmentId=this.params.shippingFulfillment.id,o.partNumber=c.partNumber):this.params.onDemandFulfillment&&c.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&c.stock>0&&(o.hasAvailability=!![],o.fulfillmentId=this.params.onDemandFulfillment.id,o.partNumber=c.partNumber),o}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const e=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e}):await this.commands.productList.addToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e})}template(){var t,e,n;const o=this.params.product,r=o.sizes[0],c=r?r.image:o.images[0],l=o.name,d=r?r.size:null,h=null!==(n=null===(e=null===(t=null==r?void 0:r.shippingVariants)||void 0===t?void 0:t[0])||void 0===e?void 0:e.price)&&void 0!==n?n:o.noAvailabilityPrice,u=this.getAvailabilityData();return this.createVariantStandard({image:c,name:l,size:d,price:h,availability:u})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const e=this.params.product,n=null===(t=e.sizes)||void 0===t?void 0:t[0],o=this.params.productUrl;if(o.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?o.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(o.includes("{grouping}")){const t=e.salsifyGrouping||"";return t?o.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:e,name:n,size:o,price:r,availability:c}=t,l=[],d=this.generateProductUrl(),h=document.createElement("div");h.className="plc__image-content";const u=document.createElement("div");u.className="plc__image-wrapper";const p=document.createElement("img");if(p.className="plc__image",p.src=e,p.alt=n,p.loading="lazy",u.appendChild(p),h.appendChild(u),d){const t=document.createElement("a");t.href=d,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(h),l.push(t)}else l.push(h);const m=document.createElement("div");m.className="plc__content";const f=document.createElement("h3");if(f.className="plc__title",f.textContent=n,d){const t=document.createElement("a");t.href=d,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(f),m.appendChild(t)}else m.appendChild(f);const g=document.createElement("div");g.className="plc__size-price-wrapper";const v=document.createElement("div");v.className="plc__price",v.textContent=formatCentToDollarText(r),g.appendChild(v);const y=document.createElement("div");y.className="plc__size",y.textContent=o||"",g.appendChild(y),m.appendChild(g),l.push(m);const b=document.createElement("button");return b.type="button",b.className="plc__button",b.disabled=!c.hasAvailability,c.isPresale?b.textContent="Pre Order":c.hasAvailability?b.textContent="Add to Cart":(b.textContent="Not Available In "+c.state.toUpperCase(),this.addHostClasses("not-available")),b.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(c)}),l.push(b),l}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const e=document.createElement("div");e.classList.add("slc__card");const n=document.createElement("div");n.className="slc__image-content";const o=document.createElement("div");o.className="slc__image-wrapper";const r=document.createElement("div");r.classList.add("wave","slc__image"),o.appendChild(r),n.appendChild(o);const c=document.createElement("div");c.className="slc__content";const l=document.createElement("div");l.className="slc__title-container";const d=document.createElement("div");d.classList.add("wave","slc__title","slc__title-line-1"),l.appendChild(d);const h=document.createElement("div");h.classList.add("wave","slc__title","slc__title-line-2"),l.appendChild(h),c.appendChild(l);const u=document.createElement("div");u.className="slc__size-price-wrapper";const p=document.createElement("div");p.classList.add("wave","slc__price"),u.appendChild(p);const m=document.createElement("div");m.classList.add("wave","slc__size"),u.appendChild(m),c.appendChild(u);const f=document.createElement("div");return f.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(c),e.appendChild(f),e}template(){const t=[],e=100/this.params.columns;this.container.style.setProperty("--card-width",e+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let o=0;o<n;o++){const e=this.createSkeletonCard(o);t.push(e)}return t}}function createApplyFiltersButton(t){const e=document.createElement("div");e.className="product-list-filters-apply-container";const n=document.createElement("button");return n.className="product-list-filters-apply-btn",n.textContent="Apply Filters",n.addEventListener("click",()=>t()),e.appendChild(n),e}function createCheckboxItem(t){const{filter:e,state:n,item:o,onChange:r}=t,c=document.createElement("div");c.className="checkbox-filter-item";const l=document.createElement("input");l.type="checkbox",l.id=e.category+"-"+o.value,l.value=o.value.toString(),l.className="checkbox-filter-checkbox",l.checked=n.selectedValues.has(o.value.toString()),l.addEventListener("change",r);const d=document.createElement("label");d.htmlFor=l.id,d.className="checkbox-filter-item-label";const h=o.formattedValue||o.value.toString(),u=o.count||0,p=document.createElement("span");p.className="checkbox-filter-item-text",p.textContent=h;const m=document.createElement("span");return m.className="checkbox-filter-item-count",m.textContent="("+u+")",d.appendChild(p),d.appendChild(m),c.appendChild(l),c.appendChild(d),c}function handleCheckboxFilterSearch(t){const{filter:e,state:n,searchTerm:o,renderCheckboxItems:r}=t,c=o.toLowerCase().trim();n.filteredItems=c?e.values.filter(t=>{const e=(t.formattedValue||t.value.toString()).toLowerCase();return e.includes(c)}):[...e.values],r()}function createCheckboxFilterHeader(t){const{filter:e,state:n,onToggle:o}=t,r=document.createElement("div");r.className="checkbox-filter-header";const c=document.createElement("button");c.className="checkbox-filter-label",c.type="button";const l=document.createElement("span");l.textContent=formatFilterLabel(e.category);const d=document.createElement("span");return d.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),d.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),n.iconElement=d,c.appendChild(l),c.appendChild(d),c.addEventListener("click",()=>o(e.category)),r.appendChild(c),r}function createCheckboxFilterSearchContainer(t){const{state:e,onSearch:n}=t,o=document.createElement("div");o.className="checkbox-filter-search-wrapper",e.searchInput=document.createElement("input"),e.searchInput.type="text",e.searchInput.className="checkbox-filter-search",e.searchInput.placeholder="Search";const r=document.createElement("span");return r.className="checkbox-filter-search-icon",r.innerHTML=SearchIcon({}),e.searchInput.addEventListener("input",t=>{const e=t.target;n(e.value)}),o.appendChild(e.searchInput),o.appendChild(r),o}function renderCheckboxItems(t){const{filter:e,state:n,onCheckboxChange:o}=t;if(n.checkboxList&&(n.checkboxList.innerHTML="",n.filteredItems.forEach(t=>{const r=createCheckboxItem({filter:e,state:n,item:t,onChange:()=>{const e=r.querySelector("input");o(t.value.toString(),e.checked)}});n.checkboxList.appendChild(r)}),0===n.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",n.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:o,onDeliveryOptionsChange:r,onToggleCollapse:c}=t,l=[],d=document.createElement("div");d.className="product-list-filters-delivery-options";const h=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],u=document.createElement("div");u.className="product-list-filters-delivery-options-header",u.style.cursor="pointer";const p=document.createElement("h3");p.className="product-list-filters-delivery-options-label",p.textContent="Delivery Options";const m=document.createElement("div");m.className="product-list-filters-chevron",m.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),u.appendChild(p),u.appendChild(m),d.appendChild(u);const f=document.createElement("div");f.className="product-list-filters-delivery-options-list",n&&f.classList.add("collapsed");for(const g of h){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+g.value,n.name="delivery-options",n.value=g.value,n.className="product-list-filters-delivery-radio";const c="onDemand"===g.value&&o;n.disabled=c,n.checked=g.value===(null==e?void 0:e.deliveryOptions),n.addEventListener("change",t=>{const e=t.target;null==r?void 0:r(e.value)});const l=document.createElement("label");l.htmlFor="delivery-"+g.value,l.className="product-list-filters-delivery-radio-label "+(c?"disabled":""),l.textContent=g.label,t.appendChild(n),t.appendChild(l),f.appendChild(t)}return d.appendChild(f),u.addEventListener("click",()=>{c()}),l.push(d),{elements:l,chevronContainer:m,deliveryOptionsList:f}}function createPriceFilter(t){var e,n,o,r,c,l,d,h;const{priceConfig:u,currentFilters:p,priceCollapsed:m,onPriceChange:f,onToggleCollapse:g,DEFAULT_MIN:v,DEFAULT_MAX:y}=t,b=[],x=document.createElement("div");x.className="product-list-filters-price";const C=Number.parseInt(null!==(e=null==u?void 0:u.min)&&void 0!==e?e:v,10),S=Number.parseInt(null!==(n=null==u?void 0:u.max)&&void 0!==n?n:y,10),_=Number.parseInt(null!==(c=null!==(r=null===(o=null==p?void 0:p.price)||void 0===o?void 0:o.min)&&void 0!==r?r:null==u?void 0:u.min)&&void 0!==c?c:v,10),P=Number.parseInt(null!==(h=null!==(d=null===(l=null==p?void 0:p.price)||void 0===l?void 0:l.max)&&void 0!==d?d:null==u?void 0:u.max)&&void 0!==h?h:y,10),I=document.createElement("div");I.className="product-list-filters-price-header",I.style.cursor="pointer";const T=document.createElement("h3");T.className="product-list-filters-price-title",T.textContent="Price Range",I.appendChild(T);const F=document.createElement("div");F.className="product-list-filters-chevron",F.innerHTML=m?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),I.appendChild(F),x.appendChild(I);const A=document.createElement("div");A.className="product-list-filters-price-slider-container",m&&A.classList.add("collapsed");const O=document.createElement("div");O.className="product-list-filters-price-range-wrapper";const R=document.createElement("div");R.className="product-list-filters-price-track";const M=document.createElement("div");M.className="product-list-filters-price-track-active",R.appendChild(M),O.appendChild(R);const N=document.createElement("input");N.type="range",N.min=C.toString(),N.max=S.toString(),N.value=_.toString(),N.step="1",N.className="product-list-filters-price-range product-list-filters-price-range-min",O.appendChild(N);const B=document.createElement("input");B.type="range",B.min=C.toString(),B.max=S.toString(),B.value=P.toString(),B.step="1",B.className="product-list-filters-price-range product-list-filters-price-range-max",O.appendChild(B),A.appendChild(O);const j=document.createElement("div");j.className="product-list-filters-price-inputs-container";const q=document.createElement("div");q.className="product-list-filters-price-input-wrapper";const U=document.createElement("span");U.className="product-list-filters-price-input-prefix",U.textContent="$";const Y=document.createElement("input");Y.type="number",Y.min=C.toString(),Y.max=S.toString(),Y.value=_.toString(),Y.className="product-list-filters-price-input",Y.placeholder=C.toString(),q.appendChild(U),q.appendChild(Y);const W=document.createElement("span");W.className="product-list-filters-price-separator",W.textContent="to";const X=document.createElement("div");X.className="product-list-filters-price-input-wrapper";const J=document.createElement("span");J.className="product-list-filters-price-input-prefix",J.textContent="$";const $=document.createElement("input");$.type="number",$.min=C.toString(),$.max=S.toString(),$.value=P.toString(),$.className="product-list-filters-price-input",$.placeholder=S+"+",X.appendChild(J),X.appendChild($),j.appendChild(q),j.appendChild(W),j.appendChild(X),A.appendChild(j),x.appendChild(A);const z=()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(B.value,10),n=S-C,o=(t-C)/n*100,r=(e-C)/n*100;M.style.left=o+"%",M.style.width=r-o+"%"},k=(t,e)=>{N.value=t.toString(),B.value=e.toString(),Y.value=t.toString(),$.value=e.toString(),z()};return N.addEventListener("input",()=>{let t=Number.parseInt(N.value,10);const e=Number.parseInt(B.value,10);t>e&&(t=e),k(t,e)}),N.addEventListener("change",()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(B.value,10);null==f?void 0:f(t.toString(),e.toString())}),B.addEventListener("input",()=>{const t=Number.parseInt(N.value,10);let e=Number.parseInt(B.value,10);e<t&&(e=t),k(t,e)}),B.addEventListener("change",()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(B.value,10);null==f?void 0:f(t.toString(),e.toString())}),Y.addEventListener("input",()=>{let t=Number.parseInt(Y.value,10)||C;const e=Number.parseInt($.value,10)||S;t=Math.max(C,Math.min(t,S)),t>e&&(t=e),k(t,e),null==f||f(t.toString(),e.toString())}),$.addEventListener("input",()=>{const t=Number.parseInt(Y.value,10)||C;let e=Number.parseInt($.value,10)||S;e=Math.max(C,Math.min(e,S)),e<t&&(e=t),k(t,e),null==f||f(t.toString(),e.toString())}),z(),I.addEventListener("click",()=>{g()}),b.push(x),{elements:b,chevronContainer:F,sliderContainer:A}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const t=[],e=document.createElement("div");e.className="product-list-search-box";const n=document.createElement("span");return n.className="product-list-search-icon",n.innerHTML=SearchIcon({}),n.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,o=this.sanitizeInput(n);o!==n&&(e.value=o),this.updateClearButtonVisibility(o),this.params.handleInputChange&&this.params.handleInputChange(o)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),e.appendChild(n),e.appendChild(this.searchInput),e.appendChild(this.clearButton),t.push(e),t}sanitizeInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e=e.trim(),e=e.replace(/\s+/g," "),e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}}function createPersonalizedFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onPersonalizedChange:o}=t,r=[],c=document.createElement("div");c.className="product-list-filters-personalized";const l=document.createElement("label");l.className="product-list-filters-personalized-label",l.setAttribute("for","personalized-switch"),l.textContent="Personalized Bottles",c.appendChild(l);const d=document.createElement("div");d.classList.add("toggle-switch");const h=!!(null==e?void 0:e.personalized);h&&d.classList.add("active");const u=document.createElement("div");u.classList.add("toggle-slider"),d.id="personalized-switch",d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Toggle Personalized Bottles"),d.setAttribute("role","switch"),d.setAttribute("aria-checked",h?"true":"false"),d.appendChild(u);const a=t=>{d.classList.toggle("active",t),d.setAttribute("aria-checked",t?"true":"false")},Q=()=>{const t=d.classList.contains("active"),e=!t;a(e),null==o||o(e)};if(d.addEventListener("click",()=>{n||Q()}),d.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Q())}),c.appendChild(d),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",c.appendChild(t)}return r.push(c),r}function createPreOrderFilter(t){const{currentFilters:e,isPreOrderDisabled:n,onPreOrderChange:o}=t,r=[],c=document.createElement("div");c.className="product-list-filters-pre-order";const l=document.createElement("label");l.className="product-list-filters-pre-order-label",l.setAttribute("for","pre-order-switch"),l.textContent="Pre-Order",c.appendChild(l);const d=document.createElement("div");d.classList.add("toggle-switch");const h=!!(null==e?void 0:e.preOrder);h&&d.classList.add("active"),n&&d.classList.add("disabled");const u=document.createElement("div");u.classList.add("toggle-slider"),d.id="pre-order-switch",d.setAttribute("tabindex",n?"-1":"0"),d.setAttribute("aria-label","Toggle Pre-Order"),d.setAttribute("role","switch"),d.setAttribute("aria-checked",h?"true":"false"),d.setAttribute("aria-disabled",n?"true":"false"),d.appendChild(u);const a=t=>{d.classList.toggle("active",t),d.setAttribute("aria-checked",t?"true":"false")},Q=()=>{const t=d.classList.contains("active"),e=!t;a(e),null==o||o(e)};if(d.addEventListener("click",()=>{n||Q()}),d.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Q())}),c.appendChild(d),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",c.appendChild(t)}return r.push(c),r}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const t=["product-list-filters-container"];return this.params.isDrawerMode&&t.push("drawer-mode"),t}isSameDayDeliveryDisabled(){var t,e;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const t=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=t.chevronContainer,this.deliveryOptionsList=t.deliveryOptionsList,t.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const t=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=t.chevronContainer,this.priceSliderContainer=t.sliderContainer,t.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(t){var e;const n=[];if(!this.checkboxFilterStates.has(t.category)){const n=null===(e=this.params.currentFilters)||void 0===e?void 0:e[t.category],o=Array.isArray(n)?new Set(n):new Set;this.checkboxFilterStates.set(t.category,{isExpanded:o.size>0,selectedValues:o,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:o.size>0})}const o=this.checkboxFilterStates.get(t.category),r=document.createElement("div");r.className="product-list-checkbox-filter",r.setAttribute("data-filter-category",t.category);const c=document.createElement("div");c.className="checkbox-filter-container";const l=createCheckboxFilterHeader({filter:t,state:o,onToggle:t=>this.toggleCheckboxFilter(t)});c.appendChild(l);const d=document.createElement("div");d.className="checkbox-filter-content "+(o.isExpanded?"expanded":"collapsed"),o.contentElement=d;const h=createCheckboxFilterSearchContainer({state:o,onSearch:e=>{handleCheckboxFilterSearch({filter:t,state:o,searchTerm:e,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(t,o)})}});return d.appendChild(h),o.checkboxList=document.createElement("div"),o.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(t,o),d.appendChild(o.checkboxList),c.appendChild(d),r.appendChild(c),n.push(r),n}renderCheckboxItemsWrapper(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,o)=>this.handleCheckboxChange(t.category,e,n,o)})}handleCheckboxChange(t,e,n,o){o?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(t,Array.from(e.selectedValues))}toggleCheckboxFilter(t){const e=this.checkboxFilterStates.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}template(){var t;const e=[],n=document.createElement("div");n.className="product-list-filters-header",this.params.isDrawerMode&&n.classList.add("drawer-mode");const o=document.createElement("h3");if(o.className="product-list-filters-title",o.textContent="Filters",n.appendChild(o),this.params.isDrawerMode){const t=document.createElement("button");t.className="product-list-filters-close-btn",t.innerHTML=CloseIcon({}),t.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n.appendChild(t)}return e.push(n),this.params.enablePersonalized&&e.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&e.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&e.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&e.push(...this.createPriceFilterWrapper()),null===(t=this.params.sanitizedFilters)||void 0===t||t.forEach(t=>{e.push(...this.createCheckboxFilter(t))}),this.params.isDrawerMode&&e.push(createApplyFiltersButton(()=>{var t,e;null===(e=(t=this.params).onApplyFilters)||void 0===e?void 0:e.call(t),this.commands.ui.closeDrawer()})),e}}const FilterIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 24 24" class="filter-icon '+n+'" style="'+r+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var Et;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(Et||(Et={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.filters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=Et.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(Et.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Et.IDLE)}catch(ot){this.logger.error("Error initializing product list:",ot),this.setLoadingState(Et.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[],e=document.createElement("div");e.className="product-list-search__control-container",e.appendChild(this.createSearchContainer()),t.push(e),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),t.push(this.filterButton));const n=document.createElement("div");return n.className="product-list-controls",this.params.filters.length>0&&n.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),n.appendChild(this.cardsContainer),t.push(n),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Et.LOADING_INITIAL:this.renderLoadingState();break;case Et.ERROR:break;case Et.IDLE:case Et.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t,e;try{const n=this.buildApiParams(0),o=await this.commands.productList.getProductList(n);this.filters=(null===(t=o.navigation)||void 0===t?void 0:t.filters)||[],this.products=o.products||[],this.retailers=o.retailers||{},this.updatePagination(o.navigation),this.syncFiltersFromResponse((null===(e=o.navigation)||void 0===e?void 0:e.filters)||[]),this.updateFiltersComponent()}catch(n){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],n}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const t=this.filtersContainer.parentElement;if(!t)return;const e=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),t.replaceChild(this.filtersContainer,e)}async loadMoreProducts(){var t;if(this.loadingState!==Et.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Et.LOADING_MORE);const e=this.pagination.currentPage+1,n=this.buildApiParams(e),o=await this.commands.productList.getProductList(n);this.filters=(null===(t=o.navigation)||void 0===t?void 0:t.filters)||[],o.products&&o.products.length>0?(this.products.push(...o.products),this.mergeRetailers(o.retailers||{}),this.updatePagination(o.navigation),this.appendNewProducts(o.products)):(this.pagination.hasMorePages=![],this.updatePagination(o.navigation)),this.setLoadingState(Et.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(Et.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){for(const[e,n]of Object.entries(t))this.retailers[e]||(this.retailers[e]=n)}updatePagination(t){var e,n,o,r;t&&(this.pagination={currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,hasMorePages:(null!==(o=t.currentPage)&&void 0!==o?o:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1})}buildApiParams(t){const e={page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(e.search=this.searchFilter.searchTerm.trim()),e}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"});const e="all"===this.currentFilters.deliveryOptions?["onDemand","shipping"]:[this.currentFilters.deliveryOptions];if(t.push({key:"fulfillment",values:e}),this.currentFilters.price){const e={};"0"!==this.currentFilters.price.min&&(e.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(e.max=this.currentFilters.price.max),Object.keys(e).length>0&&t.push({key:"price",values:e})}const n=Object.keys(this.currentFilters).filter(t=>!["personalized","preOrder","deliveryOptions","price"].includes(t));for(const o of n){const e=this.currentFilters[o];Array.isArray(e)&&e.length>0&&t.push({key:o,values:e})}return t}syncFiltersFromResponse(t){if(t)for(const e of t)switch(e.key){case"engraving":this.currentFilters.personalized="YES"===e.values;break;case"presale":this.currentFilters.preOrder="YES"===e.values;break;case"fulfillment":Array.isArray(e.values)&&(e.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":e.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(Et.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(Et.IDLE)}catch(ot){this.logger.error("Error handling filter change:",ot),this.setLoadingState(Et.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const e="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=e,e&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,e)})}updateRadioLabel(t,e){const n=this.deliveryRadioLabels.get(t.id);n&&(n.className="product-list-filters-delivery-radio-label "+(e?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const e=100/this.params.columns;return t.style.setProperty("--card-width",e+"%"),t.style.setProperty("--columns",""+this.params.columns),t}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.getResponsiveColumns(),fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const e=this.createProductCard(t);e&&this.cardsContainer.appendChild(e)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const e of t){const t=this.createProductCard(e);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const n=Object.values(e.shippingVariants)[0];if(!n)return this.logger.warn("Product "+t.id+" has no variants"),null;const o=this.retailers[n.retailerId];return o?ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,shippingFulfillment:o.shippingFulfillment,onDemandFulfillment:o.onDemandFulfillment,productUrl:this.params.productUrl}):(this.logger.warn("Retailer "+n.retailerId+" not found for product "+t.id),null)}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const e={[t.BRANDS]:f.BRANDS,[t.CATEGORIES]:f.CATEGORIES,[t.FLAVOR]:f.FLAVOR,[t.REGION]:f.REGION,[t.VARIETY]:f.VARIETY,[t.VINTAGE]:f.VINTAGE,[t.COUNTRY]:f.COUNTRY,[t.APPELLATION]:f.APPELLATION,[t.MATERIALS]:f.MATERIALS,[t.SIZES]:f.SIZES};return this.filters.filter(t=>{const n=e[t.category];return n&&this.params.filters.includes(n)})}buildFiltersParams(t=![]){const i=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(f.PERSONALIZATION),enablePreOrder:this.params.filters.includes(f.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(f.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(f.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async e=>{this.currentFilters.personalized=e,t||await this.onFilterChange()},onPreOrderChange:async e=>{this.currentFilters.preOrder=e,t||await this.onFilterChange()},onDeliveryOptionsChange:async e=>{this.currentFilters.deliveryOptions=e,"onDemand"===e&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),t||await this.onFilterChange()},onPriceChange:async(e,n)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==e?this.currentFilters.price.min=e:delete this.currentFilters.price.min,"1000"!==n?this.currentFilters.price.max=n:delete this.currentFilters.price.max,t||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(e,n)=>{n.length>0?this.currentFilters[e]=n:delete this.currentFilters[e],t||await this.onFilterChange()},isDrawerMode:t,onApplyFilters:async()=>{await i()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async t=>{this.searchFilter.searchTerm=t,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(t={}){const{isDrawerMode:e=![]}=t;return this.filtersContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(e)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var e;const n=null===(e=this.filtersContainer)||void 0===e?void 0:e.querySelector('label[for="'+t.id+'"]');n&&this.deliveryRadioLabels.set(t.id,n)})}openFiltersDrawer(){this.commands.ui.openDrawer(r.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const e=document.createElement("div");e.className="product-list-filter-icon",e.innerHTML=FilterIcon({}),e.addEventListener("click",()=>{this.openFiltersDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",t.appendChild(e),t.appendChild(n),t}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const e=t[0];e.isIntersecting&&this.loadingState===Et.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let e;t.innerHTML="",e=this.loadingState===Et.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(e)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const e=this.createErrorElement(t);this.sentinelElement.appendChild(e)}createLoadingElement(t){const e=document.createElement("div");e.className="product-list-sentinel-container";const n=document.createElement("div");n.className="product-list-sentinel-spinner";const o=document.createElement("div");return o.className="product-list-sentinel-text",o.textContent=t,e.appendChild(n),e.appendChild(o),e}createErrorElement(t){const e=document.createElement("div");e.className="product-list-sentinel-error-container";const n=document.createElement("div");n.className="product-list-sentinel-error-icon",n.innerHTML="⚠";const o=document.createElement("div");return o.className="product-list-sentinel-error-text",o.textContent=t,e.appendChild(n),e.appendChild(o),e}createInfoElement(t,e=![]){const n=document.createElement("div");if(n.className="product-list-sentinel-info-container",!e&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",n.appendChild(t)}else if(e){const t=document.createElement("div");t.className="product-list-sentinel-divider",n.appendChild(t)}const o=document.createElement("div");return o.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",o.textContent=t,n.appendChild(o),n}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const e=this.createErrorElement(t);this.cardsContainer.appendChild(e)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(n){this.logger.error("Error reloading products after address change:",n),this.setLoadingState(Et.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],o=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return o?e.slice(0,1):e}const r=this.store.get(this.params.errorStorePath);return r?[{message:r,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const o=document.createElement("span");return o.classList.add("alert-text"),o.textContent=t.message,e.appendChild(n),e.appendChild(o),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(r.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const o=n.value,r=o.isOpen,c=null===(e=o.contentConfig)||void 0===e?void 0:e.type,l=c!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=c,this.openWithContent(o),![]):r&&this.isOpen&&!l?![]:r&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(o),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let o;o=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(o,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(o),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var t,e,n,o;if(this.engravingLines=this.params.lines,"product"===this.params.context){const r=this.store.get("products."+this.params.identifier);this.fulfillmentId=r.selectedFulfillmentId,this.partNumber=(null===(t=r.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null,this.isPresale=(null===(o=null===(n=null===(e=r.sizes[r.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.presale)||void 0===o?void 0:o.isActive)||![]}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),o=n.sizes[n.selectedSizeId],r=o.shippingFulfillments[this.fulfillmentId],c=r.variant.price,l=(null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return c+l}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier);o.sizes[o.selectedSizeId].image?t.push(o.sizes[o.selectedSizeId].image):t.push(...o.images||[]),e=o.name,n=o.sizes[o.selectedSizeId].size}if("cart"===this.params.context){const o=this.store.get("cart.items."+this.params.identifier);o.mainImage&&t.push(o.mainImage),e=o.name,n=o.size}const o=document.createElement("div");if(o.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const r=document.createElement("img");r.src=t[0],r.alt=e,r.loading="lazy",r.className="product-image",n.appendChild(r),o.appendChild(n)}const r=document.createElement("div");r.className="product-details-container";const c=document.createElement("div");c.className="product-header";const l=document.createElement("h4");l.className="product-title",l.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),c.appendChild(l),c.appendChild(this.productPriceSpan),r.appendChild(c);const d=document.createElement("p");d.className="product-size-text",d.textContent=n,r.appendChild(d);const h=document.createElement("p");return h.className="engraving-fees-disclaimer",h.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(h),o.appendChild(r),o}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=this.isPresale?e.layout.preSaleButtonText:e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,o,r,c,l;const d=this.store.get("products."+this.params.identifier),h=d.sizes[d.selectedSizeId],u=Object.values(h.shippingFulfillments).filter(t=>t.variant.isEngravable),p=document.createElement("div");p.className="fulfillment-section";const m=document.createElement("p");if(m.className="shipping-from-text",m.innerHTML="Shipping from: <b>"+(null===(t=d.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",p.appendChild(m),1===u.length)return p;const f=document.createElement("div");f.className="fulfillment-options-container",p.appendChild(f);const g=document.createElement("span");g.className="see-more-fulfillments",g.textContent="See More Delivery Options ("+u.length+")",g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.setAttribute("aria-label","See More Delivery Options ("+u.length+")"),g.setAttribute("aria-expanded","false");const Z=()=>{const t=f.classList.contains("expanded");f.classList.toggle("expanded"),t?(g.textContent="See More Delivery Options ("+u.length+")",g.setAttribute("aria-label","See More Delivery Options ("+u.length+")"),g.setAttribute("aria-expanded","false")):(g.textContent="See Less Delivery Options",g.setAttribute("aria-label","See Less Delivery Options"),g.setAttribute("aria-expanded","true"))};g.addEventListener("click",Z),g.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Z())}),p.appendChild(g);for(const v of u){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",v.id),v.id===(null===(e=d.selectedFulfillment)||void 0===e?void 0:e.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+v.retailerName+", "+formatCentToDollarText(v.variant.price+((null===(o=null===(n=d.sizes[d.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.fee)||0))+", "+v.engravingExpectation),t.setAttribute("aria-pressed",v.id===(null===(r=d.selectedFulfillment)||void 0===r?void 0:r.id)?"true":"false");const E=()=>{this.fulfillmentId=v.id,this.partNumber=v.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=f.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),m.innerHTML="Shipping from: <b>"+v.retailerName+"</b>"};t.addEventListener("click",E),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),E())});const h=v.variant.price+((null===(l=null===(c=d.sizes[d.selectedSizeId].attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0),u=document.createElement("div");u.className="option-row row-1",t.appendChild(u);const p=document.createElement("span");p.className="retailer-name",p.textContent=v.retailerName,u.appendChild(p);const g=document.createElement("span");g.className="fulfillment-price",g.textContent=formatCentToDollarText(h),u.appendChild(g),t.appendChild(u);const y=document.createElement("div");y.className="option-row row-2",t.appendChild(y);const b=document.createElement("span");b.className="estimated-time",b.textContent=v.engravingExpectation,y.appendChild(b),t.appendChild(y),f.appendChild(t)}return p}engravingLinesSection(){var t;const e=this.getConfigs("global"),{lines:n,maxLines:o,location:r,maxCharsPerLine:c}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent=e.layout.personalizationText,l.appendChild(d),r&&(null===(t=null==r?void 0:r.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+r.toLowerCase()+".",l.appendChild(t)}const h=Array.from({length:o},(t,e)=>{const o=e+1,r=document.createElement("div");r.className="engraving-input-wrapper",r.setAttribute("data-line-number",o.toString());const l=document.createElement("input");l.type="text",l.id="engraving-line-"+o,l.dataset.lineNumber=o.toString(),l.maxLength=c,l.value=n[e]||"",l.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,l.className="engraving-input",l.autocomplete="off",l.setAttribute("aria-label",o>1?"Engraving line "+o+", optional, maximum "+c+" characters":"Engraving line "+o+", maximum "+c+" characters");const d=document.createElement("span");return d.className="engraving-char-count",d.textContent=l.value.length+"/"+c,d.setAttribute("aria-live","polite"),d.setAttribute("aria-atomic","true"),l.addEventListener("input",()=>{d.textContent=l.value.length+"/"+c,this.engravingLines[e]=l.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),r.appendChild(l),r.appendChild(d),r}),u=document.createElement("div");return u.className="engraving-inputs-container",u.append(...h),l.appendChild(u),l}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const o=document.createElement("button");o.type="button",o.className="cancel-action-button",o.textContent="Cancel",o.setAttribute("aria-label","Cancel personalization and close");const G=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(r.CART)};o.addEventListener("click",G),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),G())}),n.appendChild(o),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const H=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t};this.isPresale?await this.commands.product.addPresaleToCart(t,e):await this.commands.product.addToCart(t,e),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(r.CART))};return this.addToCartButton.addEventListener("click",H),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),H())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const o=this.actionButtonsSection();t.push(o);const r=document.createElement("p");return r.className="engraving-disclaimer",r.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(r),t}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,o=(null==e?void 0:e.quantity)||1;return{quantity:o,fee:n,total:n*o}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,o=(null==e?void 0:e.quantity)||1;return{quantity:o,fee:n,total:n*o}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,o,c,l,d,h,u,p,m,f,g,v,y,b,x,C,S,_;const P=this.params.identifier,I={identifier:P,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+P);I.lines=(null===(e=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],I.maxLines=(null===(o=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.maxLines)||1,I.maxCharsPerLine=(null===(l=null===(c=null==r?void 0:r.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,I.fee=(null===(h=null===(d=null==r?void 0:r.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.fee)||0,I.location=(null===(p=null===(u=null==r?void 0:r.attributes)||void 0===u?void 0:u.engraving)||void 0===p?void 0:p.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+P);I.lines=(null===(f=null===(m=null==t?void 0:t.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.lines)||[],I.maxLines=(null===(v=null===(g=null==t?void 0:t.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.maxLines)||1,I.maxCharsPerLine=(null===(b=null===(y=null==t?void 0:t.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxCharsPerLine)||16,I.fee=(null===(C=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===C?void 0:C.fee)||0,I.location=(null===(_=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===_?void 0:_.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,I)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const o=document.createElement("h3");o.textContent="Personalization";const r=document.createElement("span");if(r.className="engraving-fee",1===t.quantity&&(r.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){r.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",r.appendChild(e)}n.appendChild(o),n.appendChild(r);const c=document.createElement("div");c.className="engraving-body";const l=document.createElement("div");l.className="engraving-lines";for(const u of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=u,l.appendChild(t)}const d=document.createElement("div");d.className="engraving-actions";const h=document.createElement("button");h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.setAttribute("aria-label","Remove engraving");const a=async()=>{await this.handleRemove()};if(h.addEventListener("click",a),h.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await a())}),d.appendChild(h),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),d.appendChild(t)}return c.appendChild(l),c.appendChild(d),[n,c]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("-");3===t.length&&(this.yearInput.value=t[0],this.monthInput.value=t[1],this.dayInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>{this.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const e of t)e.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=2&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&"00"!==n&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=4&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&"00"!==n&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}padMonthOnBlur(){const t=this.monthInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.monthInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}padDayOnBlur(){const t=this.dayInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.dayInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}handleNavigation(t,e){const n=t.target,o=n===this.yearInput?4:2;n.value.length===o&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value;return 2===t.length&&2===e.length&&4===n.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const o=Number.parseInt(t,10),r=Number.parseInt(e,10),c=Number.parseInt(n,10);if(o<1||o>12||r<1||r>31||c<1e3)return![];const l=new Date(c,o-1,r);return l.getFullYear()===c&&l.getMonth()===o-1&&l.getDate()===r}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const o=e.getMonth()-t.getMonth();return(o<0||0===o&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,o=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];const c=2===t.length&&2===e.length&&4===n.length,l=t||e||n;if(r.required&&!l)o.push("Please enter a complete date (MM/DD/YYYY)");else if(l&&!c)o.push("Please enter a complete date (MM/DD/YYYY)");else if(c)if(this.validateDate(t,e,n)){const c=Number.parseInt(t,10),l=Number.parseInt(e,10),d=Number.parseInt(n,10),h=new Date(d,c-1,l);if(void 0!==r.minYear&&d<r.minYear&&o.push("Year must be "+r.minYear+" or later"),void 0!==r.maxYear&&d>r.maxYear&&o.push("Year must be "+r.maxYear+" or earlier"),void 0!==r.minAge||void 0!==r.maxAge){const t=this.calculateAge(h);void 0!==r.minAge&&t<r.minAge&&o.push("Must be at least "+r.minAge+" years old"),void 0!==r.maxAge&&t>r.maxAge&&o.push("Must be no more than "+r.maxAge+" years old")}if(r.customValidator){const t=r.customValidator(this.getFormattedValue());t&&o.push(t)}}else o.push("Please enter a valid date");this.showErrors(o);const d=0===o.length;return this.params.onValidation&&this.params.onValidation(d,o),d}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const o=document.createElement("input");o.type="text",o.placeholder="MM",o.name=this.params.name+"-month",o.id=this.params.name+"-month",o.maxLength=2,o.className="date-field month-field",o.setAttribute("data-field","month"),o.inputMode="numeric";const r=document.createElement("span");r.className="date-separator",r.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&&(o.disabled=!![],c.disabled=!![],d.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(o),n.appendChild(r),n.appendChild(c),n.appendChild(l),n.appendChild(d);const h=document.createElement("div");return h.className="error-container",e.push(n),e.push(h),e}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,o=e.value;n>0&&/\D/.test(o[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,o,r]=t.split("/").map(Number),c=new Date(r,n-1,o);return c.getFullYear()===r&&c.getMonth()===n-1&&c.getDate()===o}isFieldComplete(){var t,e,n;const o=this.inputElement.value.trim();if(!o)return![];switch(this.params.inputType){case"tel":return this.validateTel(o);case"date":return this.validateDate(o);case"email":return o.includes("@")&&(null===(t=o.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(o));default:return(null===(e=this.params.validation)||void 0===e?void 0:e.max)&&o.length>=this.params.validation.max||(null===(n=this.params.validation)||void 0===n?void 0:n.min)&&o.length>=this.params.validation.min?!![]:o.length>=3}}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),!n.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const o=Number.parseFloat(t);Number.isNaN(o)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&o<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&o>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const o=new RegExp(n.pattern);o.test(t)||e.push("Invalid format")}if(n.customValidator){const o=n.customValidator(t);o&&e.push(o)}}this.showErrors(e);const o=0===e.length;return this.params.onValidation&&this.params.onValidation(o,e),o}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.U=t=>{e.rerender(t||"LceElementRerender")}),this.V.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),o=n.getStylesheet(t);this.applyThemeStyles(o),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.V.adoptedStyleSheets=[e,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(ot){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.V&&this.V.appendChild(e)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const o=document.createElement("span");return o.className="pb-dot",o.textContent=".",t.appendChild(o),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const o of n){const n=o.trim();if(!n)continue;const r=document.createElement("span");r.classList.add("promo-ticker__text-item"),r.textContent=n,e.appendChild(r);const c=document.createElement("span");c.classList.add("promo-ticker__separator"),c.textContent=t.separator,e.appendChild(c)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let r=0;r<5;r++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const o=document.createElement("button");return o.type="button",o.classList.add("promo-ticker__cta"),o.textContent="APPLY",o.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(o.disabled=!![],o.textContent="APPLIED"),o.addEventListener("click",()=>this.handlePromoClick()),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=o,[e,o]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},o=e[this.params.messageType]||"warning",r=document.createElement("div");return r.className="alert-icon alert-icon-"+this.params.messageType,r.appendChild(htmlStringToElement(n[o]({width:16,height:16,className:"alert-icon-svg"}))),r}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const o=document.createElement("span");if(o.className="alert-message",o.textContent=this.params.message,e.push(o),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}const _t=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},o=[];for(const r in e){const c=e[r],l=n[r];if(!(r in t)){o.push('Property "'+r+'" does not exist in target schema, skipping merge.');continue}const d=getType(c),h=getType(l);d===h?isObject(c)&&isObject(l)?n[r]=deepMergeConfigs(l,c):n[r]=c:o.push('Type mismatch for key "'+r+'": source is '+d+", target is "+h+". Skipping merge.")}return o.length>0&&_t.warn("Merging configurations with warnings:",o),n}const Dt=new Map([["global.layout.enablePersonalization",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_INTERACTIONS,r.CART_ITEM,r.CHECKOUT_ITEM]],["global.layout.personalizationText",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.CART_ITEM]],["global.layout.personalizationCardStyle",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[r.CART,r.CART_PROMO_CODE,r.CART_FOOTER,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[r.CART,r.CHECKOUT,r.ADDRESS,r.INPUT,r.BIRTHDATE_INPUT,r.ADDRESS_INPUT,r.CHECKOUT_DELIVER_TO,r.CHECKOUT_BUYER,r.CHECKOUT_BILLING,r.CHECKOUT_PAYMENT,r.CART_PROMO_CODE]],["global.layout.showPoweredBy",[r.CART,r.CHECKOUT,r.CHECKOUT_COMPLETED,r.POWERED_BY,r.CART_FOOTER,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[r.POWERED_BY]],["product.layout.showImages",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[r.PRODUCT]],["product.layout.showDescription",[r.PRODUCT,r.PRODUCT_DESCRIPTION,r.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[r.PRODUCT,r.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[r.CART,r.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[r.CART,r.CART_FOOTER]],["checkout.layout.emailOptIn",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[r.CHECKOUT,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[r.CHECKOUT,r.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[r.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const o of Object.keys(e)){const e=Dt.get(t+"."+o);if(e)for(const t of e)n.add(t)}return Array.from(n)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",ot.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:t,configs:e}=await this.authClient.authenticateAndGetConfigs();if(!t||!e)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed and configurations loaded"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let n=e;this.clientConfig.set("partnerCode",n.configurations.partnerCode),this.clientConfig.set("partnerName",n.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const o=await this.fingerPrintService.getId(n.configurations.partnerCode),r=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",o),this.clientConfig.set("isLocalStorageAvailable",r);const c=r?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:r,persistedStore:c}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),e=n.global.layout.showPoweredBy;n=deepMergeConfigs(n,t),n.global.layout.showPoweredBy=e}await this.themeProvider.initialize(n),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:e,containerId:n,...o}=t;if(!n||"string"!=typeof n)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);if(!e)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const c=n.replace("#",""),l=document.getElementById(c);if(!l)return console.warn("Container with ID '"+c+"' not found"),null;l.innerHTML="";const d={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},h=ComponentFactoryService.createElement(d);if(safeReplaceChildren(l,h),t.type===r.CHECKOUT){const e=t.checkoutId;await this.commands.checkout.loadCheckout({customCartId:e})}return this.createInjectedComponentWrapper(c,t.type,h)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const e=t.slice(0,20),n=[],o=[];for(const r of e){if(!r||"object"!=typeof r){this.logger.warn("Invalid product parameter: must be an object");continue}if(!r.containerId||"string"!=typeof r.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+r.identifier+"'");continue}const t=r.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+r.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+r.identifier+"'");continue}const o=n.every(e=>e.containerId!==t);if(!o){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!r.identifier||"string"!=typeof r.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const c=n.every(t=>t.identifier!==r.identifier);c?n.push({containerId:t,identifier:r.identifier}):this.logger.warn("Duplicate product identifier '"+r.identifier+"' found, skipping")}for(const c of n){const t=ComponentFactoryService.createElement({type:r.PRODUCT,useShadowDom:!![],productId:c.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(c.containerId);e?(e.innerHTML="",e.appendChild(t),o.push(this.createInjectedComponentWrapper(c.containerId,r.PRODUCT,t)),await this.commands.product.createProductInstance(c.identifier,!![])):this.logger.warn("Product ("+c.identifier+") container with ID '"+c.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(n.map(t=>t.identifier)),o}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,r.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.cardVariant&&!Object.values(m).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(m).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const e=Object.values(f);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const n=ComponentFactoryService.createElement({type:r.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||m.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:r.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const o={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,o),o}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let o;o=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,o)}registerEssentialComponents(){ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(r.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(r.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(r.CART,CartComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(r.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(r.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(r.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(r.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(r.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(r.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(r.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const o=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,o)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);e.innerHTML="",e.classList.add("lce-cart-subtotal");const s=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;s(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;s(t)})},cartItemsCount:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let n=!![];e&&"boolean"==typeof e.hideZero&&(n=e.hideZero);const o=document.getElementById(t.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);o.innerHTML="",o.classList.add("lce-cart-items-count");const G=t=>{o.textContent=t.toString(),0===t?(n&&(o.style.visibility="hidden"),o.classList.add("no-items")):(n&&(o.style.visibility="visible"),o.classList.remove("no-items"))},r=this.store.get("cart.itemsQuantity")||0;G(r),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;G(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,r.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,r.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.CART,containerId:t}):(this.injectDisabledElementsError(t,r.CART),null)}async injectCheckoutElement({containerId:t,checkoutId:e}){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n="string"==typeof e?e.trim():void 0;if(void 0!==e&&("string"!=typeof e||!n))throw new SDKError("Checkout element requires a valid checkout ID when provided. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.CHECKOUT,containerId:t,checkoutId:n}):(this.injectDisabledElementsError(t,r.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,e){try{SingletonManager.setContext({isBuilder:![]});const o=ClientConfigService.getInstance();o.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:e.proxy,development:e.development,checkoutUrl:e.checkoutUrl});const r=o.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const c=await SingletonManager.getClient(r);if(!c.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={injectProductElement:c.injectProductElement.bind(c),injectAddressElement:c.injectAddressElement.bind(c),injectCartElement:c.injectCartElement.bind(c),injectCheckoutElement:c.injectCheckoutElement.bind(c),injectProductList:c.injectProductList.bind(c),ui:c.ui,actions:c.actions,getInjectedComponents:c.getInjectedComponents.bind(c)};window.elements=l;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:o.get("version")}),l}catch(o){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",o)}catch(r){console.error("[LiquidCommerce Elements] Client initialization failed:",null==o?void 0:o.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(c){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Pt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},CHECKOUT:{CHECKOUT:"data-lce-checkout",URL:"data-checkout-url",PARAM:"data-checkout-param"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:e}){const n=Math.random().toString(36).substring(2,7),o=void 0!==t?t:"",r=void 0!==e?e:"",c=o&&r?"-":"";return""+o+c+r+n}function pairsFromMainScript(t){const e=[];try{const o=t.getAttributeNames().filter(t=>t.substring(0,12)===Pt.PRODUCT.PRODUCT);for(const r of o)try{const n=r.match(/^data-product(-(.+))?$/),o=(null==n?void 0:n[2])?"-"+n[2]:"",c=""+Pt.PRODUCT.CONTAINER+o;if(t.hasAttribute(c)){const n=t.getAttribute(c),o=t.getAttribute(r);n&&o&&e.push({containerId:n,identifier:o})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",o)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+Pt.PRODUCT_LIST.SCRIPT+"]");for(const o of n)try{const e=JSON.parse(o.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div["+Pt.PRODUCT.LCE_PRODUCT+"]");let o=0;for(const r of n)try{const e=generateElementId({prefix:"lce-p",index:o});r.setAttribute("id",e);const n=r.getAttribute(Pt.PRODUCT.LCE_PRODUCT);e&&n&&t.push({containerId:e,identifier:n}),o+=1}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}async function addProductToCartViaQueryParam(t,e){try{const o=e.getAttribute(Pt.PRODUCT.PARAM),r=e.getAttribute(Pt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const l=new URLSearchParams(window.location.search),d=l.get(o);if(!d)return;let h=c.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=l.get(r);t!==c.ON_DEMAND&&t!==c.SHIPPING||(h=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:d,fulfillmentType:h,quantity:1}],!![])}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",o)}}async function addPromoCodeToCartViaQueryParam(t,e){try{const o=e.getAttribute(Pt.PROMO_TICKER.CODE_PARAM);if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),c=r.get(o);if(!c)return;try{await t.actions.cart.applyPromoCode(c)}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",o)}}async function setupCartButtonWithPosition(t,e,n,o){var r,c,l;try{const d=n.includes("mobile"),h=d?"mobile":"desktop",u=!d,p=e.getAttribute(n),m=e.getAttribute(o);if(!e.hasAttribute(n)&&!e.hasAttribute(o))return u&&t.ui.floatingCartButton(![]),void 0;if(u){if(e.hasAttribute(n)&&!p)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(o)&&!m)return t.ui.floatingCartButton(!![]),void 0}const f=p||m,g=!!m;if(!f)return u&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(g)),void 0;const v=["above","below","replace","inside"],y=f.match(/^(\w+):(.+)$/),b=y&&v.includes(y[1])?y[1]:"inside";let x=y?y[2]:f;/^[#.]/.test(x)||/\s/.test(x)||(x="#"+x);const C=document.querySelector(x);if(!C)return u&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+x+'" not found. Using floating button.'),t.ui.floatingCartButton(g)),void 0;const S=document.createElement("div");switch(S.classList.add("lce-cart-"+h+"-button-container"),S.id=generateElementId({prefix:"lce-cart-"+h+"-btn"}),b){case"above":null===(r=C.parentNode)||void 0===r?void 0:r.insertBefore(S,C);break;case"below":null===(c=C.parentNode)||void 0===c?void 0:c.insertBefore(S,C.nextSibling);break;case"replace":null===(l=C.parentNode)||void 0===l?void 0:l.replaceChild(S,C);break;default:C.appendChild(S)}t.ui.cartButton(S.id,g)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",d)}}async function setupCartButtons(t,e){e.hasAttribute(Pt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,Pt.CART.BUTTON,Pt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,e,Pt.CART.MOBILE_BUTTON,Pt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+Pt.PRODUCT_LIST.LIST+"]");if(!e)return;const n="lce-products-list-container";e.className="lce-products-list-container",e.id=n;const o=e.getAttribute(Pt.PRODUCT_LIST.CARD)||"standard",r=e.hasAttribute(Pt.PRODUCT_LIST.CARD_FILL),c=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.ROWS)||"3",10)||3,l=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.COLUMNS)||"4",10)||4,d=e.getAttribute(Pt.PRODUCT_LIST.FILTERS),h=e.getAttribute(Pt.PRODUCT_LIST.PRODUCT_URL)||void 0;let u=[];d&&(u=d.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:n,rows:c,columns:l,cardVariant:o,fillCard:r,filters:u,productUrl:h})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",e)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const e=t.detail;if(!e.data.isReady)return;const n=window.elements,o=document.querySelectorAll("["+Pt.CART.TOGGLE_BUTTON+"]");if(o.length>0)for(const c of o)c.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),n.actions.cart.toggleCart()});const r=document.querySelectorAll("["+Pt.CART.ITEMS_COUNT+"]");if(r.length>0){let t=0;for(const e of r){const o=e.getAttribute(Pt.CART.ITEMS_COUNT),r=!(o&&"keep-zero"===o),c=Boolean(null==e?void 0:e.id);let l;c?l=e.id:(l=generateElementId({prefix:"lce-cart-items-count",index:t}),e.id=l),n.ui.cartItemsCount(l,{hideZero:r}),t+=1}}})}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",ot)}}function getDevelopmentConfigs(){const t=document.querySelector("script["+Pt.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(e){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",e),void 0}}async function setupCheckout(t,e){try{const n=document.querySelector("div["+Pt.CHECKOUT.CHECKOUT+"]");if(!n)return;const o="lce-checkout-container";n.className="lce-checkout-container",n.id=o;const r=e.getAttribute(Pt.CHECKOUT.PARAM)||"lce_checkout";if(!r||!startsWithLcePrefix(r))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring checkout query parameter "'+r+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),l=c.get(r);if(!l)return console.warn("[LiquidCommerce Elements Auto Initialization] Checkout ID not found in query parameters."),void 0;await t.injectCheckoutElement({containerId:o,checkoutId:l})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup checkout:",n)}}async function ElementsAutoInitialize(){var t,n,o,r,c,d;try{const d=document.querySelector("script["+Pt.CORE.MAIN_SCRIPT+"]");if(!d)return;const h=d.getAttribute(Pt.CORE.TOKEN),u=d.getAttribute(Pt.CORE.ENV)||e.PRODUCTION,p=d.getAttribute(Pt.CORE.DEBUG_MODE);if(!h)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const m=d.getAttribute(Pt.PROMO_TICKER.CODE),f=d.getAttribute(Pt.PROMO_TICKER.TEXT),g=null!==(t=d.getAttribute(Pt.PROMO_TICKER.SEPARATOR))&&void 0!==t?t:"•",v=null!==(n=d.getAttribute(Pt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,y=null!==(o=d.getAttribute(Pt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==o?o:void 0,b=d.getAttribute(Pt.CHECKOUT.URL)||void 0,x=pairsFromMainScript(d),C=pairsFromProductsScript(),S=pairsFromAttributedElements(),_=[...x,...C,...S],P=m&&f&&v&&y?{promoCode:m,text:f.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:g,activeFrom:null===(r=new Date(v))||void 0===r?void 0:r.toISOString(),activeUntil:null===(c=new Date(y))||void 0===c?void 0:c.toISOString()}:void 0;let I=l.NONE;p&&u!==e.PRODUCTION&&(I=p),setupEventListeners();const T=await Elements(h,{env:u,debugMode:I,promoTicker:P?[P]:void 0,checkoutUrl:b,development:getDevelopmentConfigs()});if(!T)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(T,d),0!==_.length&&T.injectProductElement(_).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(T),addProductToCartViaQueryParam(T,d),addPromoCodeToCartViaQueryParam(T,d),setupCheckout(T,d)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(d=null==h?void 0:h.message)&&void 0!==d?d:String(h))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ot)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ot)}},50)}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",ot)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new SDKError("Failed to update global configuration: "+e.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new SDKError("Failed to update product configuration: "+e.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new SDKError("Failed to update cart configuration: "+e.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new SDKError("Failed to update checkout configuration: "+e.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new SDKError("Failed to update address configuration: "+e.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:r.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:r.CART,containerId:t})}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=await this.processInjectElement({type:r.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:n.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,e){try{SingletonManager.setContext({isBuilder:!![]});const o=ClientConfigService.getInstance();o.initialize(t,{env:e.env,isBuilder:!![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,checkoutUrl:e.checkoutUrl,proxy:void 0,development:void 0});const r=o.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const c=await SingletonManager.getClient(r);if(!c.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={updateComponentGlobalConfigs:c.updateComponentGlobalConfigs.bind(c),updateProductComponent:c.updateProductComponent.bind(c),updateAddressComponent:c.updateAddressComponent.bind(c),updateCartComponent:c.updateCartComponent.bind(c),updateCheckoutComponent:c.updateCheckoutComponent.bind(c),injectElement:c.injectElement.bind(c),injectProductElement:c.injectProductElement.bind(c),injectAddressElement:c.injectAddressElement.bind(c),injectCartElement:c.injectCartElement.bind(c),injectCheckoutElement:c.injectCheckoutElement.bind(c),injectProductList:c.injectProductList.bind(c),actions:c.actions};window.elementsBuilder=l;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:o.get("version")}),l}catch(o){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",o)}catch(r){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==o?void 0:o.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(c){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,o,r,c)=>isSDKError(c,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:o,colno:r,error:c}),!![]):t?t(e,n,o,r,c):![];const e=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(It){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",It)}try{triggerElementsAutoInit()}catch(Tt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Tt)}}catch(Ft){console.error("[LiquidCommerce Elements] SDK initialization failed:",Ft)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const s of t)"string"==typeof s?n.appendChild(document.createTextNode(s)):n.appendChild(s);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const s of t)"string"==typeof s?n.appendChild(document.createTextNode(s)):n.appendChild(s);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const s of t)"string"==typeof s?n.appendChild(document.createTextNode(s)):n.appendChild(s);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,s]of t)e[n]=s;return e})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(ot){console.warn("DOM polyfills initialization failed:",ot)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SDKError extends Error{constructor(t,e=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=e,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,e){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return e?isSDKSource(e):![];const n=String((null==t?void 0:t.message)||""),s=/liquidcommerce\s+elements/i.test(n),a=String((null==t?void 0:t.stack)||""),c=(null==t?void 0:t.source)||e||"",l=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],d=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],p=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],m=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],f=isSDKSource(c),g=l.some(t=>t.test(a)),v=d.some(t=>t.test(a)),b=p.some(t=>t.test(a)),C=m.some(t=>t.test(a));return s||f||g||v||b||C}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const e=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return e.some(e=>e.test(t))}const t={BRANDS:"brands",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},s={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_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},c={ON_DEMAND:"onDemand",SHIPPING:"shipping"},l={NONE:"none",CONSOLE:"console",PANEL:"panel"},d={PROMO_CODE:"promo-code"},p={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},m={SUCCESS:"success",WARNING:"warning",ERROR:"error"},f={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},g={STANDARD:"standard"},v={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},b={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const s=n.get(t);if(!s)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return s}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,s=SingletonManager.getInstances();if(s.has(n))return s.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const a=new SingletonManager.clientConstructor(t);return await a.prepare(),s.set(n,a),a}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const C="lce",S={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},E={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:c.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},_={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},P={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},I={drawer:{isOpen:![],contentConfig:null}},F={products:{},cart:_,address:S,checkout:P,ui:I};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===l.CONSOLE||t===l.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===l.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===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(t,n){if(!(null==t?void 0:t.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(l).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(l).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),void 0!==n.checkoutUrl&&("string"!=typeof n.checkoutUrl?(console.warn("[LiquidCommerce Elements] checkoutUrl must be a string. Ignoring checkoutUrl configuration."),n.checkoutUrl=void 0):n.checkoutUrl&&!n.checkoutUrl.includes("{id}")&&console.warn('[LiquidCommerce Elements] checkoutUrl does not include "{id}" placeholder and will not include cart IDs.')),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?n>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var s,a,c,d,p;const m=n.env||e.PRODUCTION;let g=f[m];const v=m===e.PRODUCTION,b=n.isBuilder||![],S=C+(v?"":"_"+m)+(b?"builder":"");return(null===(s=n.development)||void 0===s?void 0:s.customApiUrl)&&(g=n.development.customApiUrl),{apiKey:t.trim(),env:m,isBuilder:b,debugMode:n.debugMode||l.NONE,baseUrl:g,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:S,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(a=n.development)||void 0===a?void 0:a.paymentMethodId)||void 0,openShadowDom:v?![]:(null===(c=n.development)||void 0===c?void 0:c.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(d=n.development)||void 0===d?void 0:d.customApiUrl),checkoutUrl:(null===(p=n.checkoutUrl)||void 0===p?void 0:p.trim())?n.checkoutUrl.trim():null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,a=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,c=(null===(e=window.screen)||void 0===e?void 0:e.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/],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 d.some(t=>t.test(n))?"tablet":p.some(t=>t.test(n))||s&&l<768?"mobile":s&&l>=768&&l<=1200||s&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&s&&l>=768||/windows nt/i.test(n)&&s&&l>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...s]=this.getPrefix("debug");void 0!==e?console.debug(n,...s,t,e):console.debug(n,...s,t)}info(t,e){if(!this.enableLogging)return;const[n,...s]=this.getPrefix("info");void 0!==e?console.info(n,...s,t,e):console.info(n,...s,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...s]=this.getPrefix("warn");void 0!==e?console.warn(n,...s,t,e):console.warn(n,...s,t)}error(t,e){const n=e instanceof Error,s=n?e:void 0,a=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,s,a),!this.enableLogging)return;const[c,...l]=this.getPrefix("error");void 0!==e?console.error(c,...l,t,e):console.error(c,...l,t)}sendToTelemetry(t,e,n,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:s})}catch(a){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const s=n.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 </"+t+">";const d=document.createElement("p");return d.textContent=e,c.appendChild(a),c.appendChild(l),c.appendChild(d),s.appendChild(c),n}function productionComponentError({title:t,message:e,componentType:n}){const s=document.createElement("div");s.setAttribute("data-component-type",n);const a=s.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=t;const p=document.createElement("p");return p.textContent=e,l.appendChild(c),l.appendChild(d),l.appendChild(p),a.appendChild(l),s}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new SDKError("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const s=document.createElement(n);if(s.initialize){const{type:e,useShadowDom:a,wrapInLceElement:c,...l}=t,d={type:e,tagName:n,useShadowDom:a&&c!==!![]};s.initialize({data:l,config:d})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(a.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(a.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const c=document.createElement(n);return c.initialize(t.type,s),c}return s}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[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_LIST]:"product-list-lc",[a.PRODUCT_LIST_CARD]:"product-list-card-lc",[a.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[a.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[a.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-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]:"checkout-information-lc",[a.CHECKOUT_PAYMENT]:"checkout-payment-lc",[a.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[a.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[a.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[a.CHECKOUT_BILLING]:"checkout-billing-lc",[a.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-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_DELIVER_TO]:"checkout-deliver-to-lc",[a.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[a.CHECKOUT_BUYER]:"checkout-buyer-lc",[a.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-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",[a.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,s]=t.includes(".")?t.split(".",2):["actions",t];let a=s.split("_")[0];["product","cart","address","checkout"].includes(a)||(a="other");const c=Date.now(),l={eventId:"evt_"+c+"_"+Math.random().toString(36).slice(2,9),namespace:n,event:s,originalEvent:t,actionNamespace:"actions"===n?a:void 0,timestamp:c},d={data:e,metadata:l};this.dispatchNativeEvents(t,d)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=e);const s=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const a=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(a)}catch(s){this.logger.error("Error dispatching native events for "+t,s)}}setupClientReadyBuffering(){const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,s,a)=>{if(n!==e)return t.call(window,n,s,a);if(!this.clientReadyEvent)return t.call(window,n,s,a);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof s?s(t):s&&"function"==typeof s.handleEvent&&s.handleEvent(t)}catch(c){this.logger.error("Error replaying CLIENT_READY event",c)}return t.call(window,n,s,a)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),s=t%100;let a="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||s>0)&&(a+=".",a+=s<10?"0"+s:s.toString()),a}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("Invalid time format: "+t);const n=Number.parseInt(e[1],10),s=Number.parseInt(e[2],10);if(n<0||n>23||s<0||s>59)throw new SDKError("Invalid time values: "+t);const a=n>=12?"PM":"AM",c=n%12||12;return c+":"+s.toString().padStart(2,"0")+" "+a}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0"),a=e.getFullYear().toString();return n+"/"+s+"/"+a}catch(e){return""}}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{const t=await this.client.get("/configs");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),new SDKError("Failed to fetch all configs: "+(null==t?void 0:t.message))}}async setPersistedStore(t,e){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:e})}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(e){this.logger.error("Error deleting persisted store",e)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const e=await this.client.post("/address/autocomplete",{body:{input:t}});return e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const e=await this.client.post("/address/details",{body:{id:t}});return e.data}catch(e){throw this.logger.error("Error fetching address details",e),new SDKError("Failed to fetch address details: "+(null==e?void 0:e.message))}}async getProductsData(t,e){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const n={identifiers:t,location:e},s=await this.client.post("/product/availability",{body:n});return s.data}catch(n){return this.logger.error("Error fetching product data",n),null}}async catalogSearch(t){var e;try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(n){return this.logger.error("Error fetching catalog search data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const e=await this.client.post("/cart/get",{body:{id:t||void 0}});return e.data}catch(e){throw this.logger.error("Error fetching cart data",e),new SDKError("Failed to fetch cart data: "+e.message)}}async updateCart(t){try{const e=await this.client.post("/cart/update",{body:t});return e.data}catch(e){throw this.logger.error("Error updating cart",e),new SDKError("Failed to update cart: "+(null==e?void 0:e.message))}}async prepareCheckout(t){var e;try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async updateCheckoutItems(t){var e;try{const e=await this.client.post("/checkout/items",{body:t});return e.data}catch(n){throw this.logger.error("Error updating checkout items:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to update checkout items: "+(null==n?void 0:n.message))}}async getPaymentSession(t){var e;try{const e=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t){try{const e=await this.client.post("/checkout/payment/confirm",{body:t});return e.data}catch(e){throw this.logger.error("Error confirming payment session",e),new SDKError("Failed to confirm payment session: "+(null==e?void 0:e.message))}}async checkoutComplete(t){var e;try{const e=await this.client.post("/checkout/complete",{body:{token:t}});return e.data}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,e)=>t||e&&e.status>=500&&e.status<600?!![]:![],this.xhrFetch=(t,e)=>new Promise((n,s)=>{const a=new XMLHttpRequest;a.open(e.method||"GET",t);for(const[t,c]of Object.entries(e.headers))a.setRequestHeader(t,c);a.onload=()=>{const t={ok:a.status>=200&&a.status<300,status:a.status,statusText:a.statusText,headers:a.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,s]=e.split(": ");return n&&s&&(t[n]=s),t},{}),o:a.responseText,json:()=>Promise.resolve(JSON.parse(a.responseText)),text:()=>Promise.resolve(a.responseText)};n(t)},a.onerror=()=>{s(new TypeError("Network request failed"))},a.ontimeout=()=>{s(new TypeError("Network request timed out"))},a.timeout=3e4,a.send(e.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var e,n,s;const{url:a,options:c,retryConfig:l}=t,d=null!==(e=null==l?void 0:l.maxRetries)&&void 0!==e?e:3,p=null!==(n=null==l?void 0:l.retryDelay)&&void 0!==n?n:1e3,m=null!==(s=null==l?void 0:l.shouldRetry)&&void 0!==s?s:this.defaultShouldRetry;let f;const g=Date.now();for(let b=0;b<=d;b++){let t=Date.now();try{t=Date.now();const e=await this.fetchImpl(a,c),n=Date.now()-t;if(e.ok)return e;if(await this.logFailedResponse(a,c,e,n,b,d),b<d&&m(null,e)){await this.delay(p*2**b);continue}return e}catch(v){const e=Date.now()-t;if(f=v,this.logNetworkError(a,c,v,e,b,d),b<d&&m(v,void 0)){await this.delay(p*2**b);continue}throw this.enhanceError(v,a,c,Date.now()-g)}}throw this.enhanceError(f,a,c,Date.now()-g)}async logFailedResponse(t,e,n,s,a,c){const l=a<c;let d,p;try{n.o||(n.o=await n.text());try{d=JSON.parse(n.o)}catch(m){d=n.o}}catch(f){d="[Unable to read response body]"}if(e.body)try{p=JSON.parse(e.body)}catch(g){p=e.body}this.logger.error("HTTP request failed",{method:e.method,url:t,status:n.status,statusText:n.statusText,duration:s+"ms",attempt:a+1+"/"+(c+1),willRetry:l,requestHeaders:e.headers,requestBody:p,responseHeaders:n.headers,responseBody:d})}logNetworkError(t,e,n,s,a,c){var l;const d=a<c;this.logger.error("Network request failed",{method:e.method,url:t,error:(null==n?void 0:n.message)||"Unknown error",errorType:(null===(l=null==n?void 0:n.constructor)||void 0===l?void 0:l.name)||typeof n,duration:s+"ms",attempt:a+1+"/"+(c+1),willRetry:d,possibleCauses:this.diagnosePossibleCauses(n)})}diagnosePossibleCauses(t){var e,n,s,a,c;const l=[];return((null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timeout"))||(null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timed out")))&&l.push("Request timeout - server took too long to respond"),((null===(s=null==t?void 0:t.message)||void 0===s?void 0:s.includes("Failed to fetch"))||(null===(a=null==t?void 0:t.message)||void 0===a?void 0:a.includes("Network request failed")))&&(l.push("Network connectivity issue"),l.push("CORS policy blocking the request"),l.push("Server is not responding"),l.push("Request was blocked by browser or firewall")),(null===(c=null==t?void 0:t.message)||void 0===c?void 0:c.includes("aborted"))&&l.push("Request was aborted"),0===l.length&&l.push("Unknown network error"),l}enhanceError(t,e,n,s){const a=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return a.url=e,a.method=n.method,a.totalDuration=s+"ms",a.isNetworkError=!![],a.originalError=t,a.possibleCauses=this.diagnosePossibleCauses(t),a}delay(t){return new Promise(e=>setTimeout(e,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(e,n)=>{var s;const a=await t(e,n);let c;if("function"==typeof(null===(s=a.headers)||void 0===s?void 0:s.entries))c=Object.fromEntries(a.headers.entries());else{c={};for(const[t,e]of a.headers)c[t]=e}const l={ok:a.ok,status:a.status,statusText:a.statusText,headers:c,json:async()=>(l.o||(l.o=await a.text()),JSON.parse(l.o)),text:async()=>(l.o||(l.o=await a.text()),l.o)};return l}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(t,e)=>t?!![]:e&&this.isAuthError(e)?![]:e&&e.status>=500&&e.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticateAndGetConfigs(){var t,e,n,s,a,c,l,d,p;try{this.logger.info("Authenticating and fetching configurations in single request");const m=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(e=null===(t=null==m?void 0:m.data)||void 0===t?void 0:t.auth)||void 0===e?void 0:e.accessToken)&&(null===(s=null===(n=null==m?void 0:m.data)||void 0===n?void 0:n.auth)||void 0===s?void 0:s.expiration)?(null===(p=null==m?void 0:m.data)||void 0===p?void 0:p.configs)?(this.accessToken=m.data.auth.accessToken,this.tokenExpiration=m.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:m.data.configs}):(this.logger.error("Combined auth response missing configs data",{response:null==m?void 0:m.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(c=null===(a=null==m?void 0:m.data)||void 0===a?void 0:a.auth)||void 0===c?void 0:c.accessToken),hasExp:!!(null===(d=null===(l=null==m?void 0:m.data)||void 0===l?void 0:l.auth)||void 0===d?void 0:d.expiration),response:null==m?void 0:m.data}),{success:![]})}catch(m){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:(null==m?void 0:m.message)||m,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers})}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}async performAuthentication(){var t,e,n,s;try{const a=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==a?void 0:a.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==a?void 0:a.data)||void 0===e?void 0:e.expiration)?(this.accessToken=a.data.accessToken,this.tokenExpiration=a.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(n=null==a?void 0:a.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(s=null==a?void 0:a.data)||void 0===s?void 0:s.expiration),response:null==a?void 0:a.data}),![])}catch(a){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:(null==a?void 0:a.message)||a,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,e,n,s;try{this.logger.info("Attempting to refresh access token");const a=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==a?void 0:a.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==a?void 0:a.data)||void 0===e?void 0:e.expiration)?(this.accessToken=a.data.accessToken,this.tokenExpiration=a.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(n=null==a?void 0:a.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(s=null==a?void 0:a.data)||void 0===s?void 0:s.expiration),response:null==a?void 0:a.data}),![])}catch(a){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:(null==a?void 0:a.message)||a,status:null==a?void 0:a.status,endpoint:"/auth/refresh"}),![]}}async request(t,e,n=![],s=![]){if(!n&&!s&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const a=this.buildUrl(t),c=this.buildHeaders(e.headers,n),l=await this.httpClient.request({url:a,options:{method:e.method,headers:c,body:e.body?JSON.stringify(e.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return l.ok?this.handleSuccessResponse(l,t,e.method):!this.isAuthError(l)||n||s?this.handleErrorResponse(l):this.handleAuthError(l,t,e)}async handleSuccessResponse(t,e,n){try{return await t.json()}catch(s){const a=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:e,method:n,status:t.status,responsePreview:a.substring(0,1e3),error:null==s?void 0:s.message}),{message:a}}}async handleAuthError(t,e,n){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:e,method:n.method});let s=await this.refreshToken();return s||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),s=await this.authenticate()),s?this.request(e,n,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:e,method:n.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let e;try{e=await t.json()}catch(n){const s=await t.text().catch(()=>"HTTP error status: "+t.status);e={message:s||"Unknown error"}}throw{...e,status:t.status,message:(null==e?void 0:e.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}buildHeaders(t,e=![]){const n={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return e?n["X-Liquid-Api-Key"]=this.apiKey:n.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(n["X-Liquid-Api-Builder"]="true"),n}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const O="@liquidcommerce/elements-sdk",z="LiquidCommerce Elements SDK",R="UNLICENSED",L="LiquidCommerce Team",M="2.6.0-beta.20",B="https://docs.liquidcommerce.co/elements-sdk",j={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},q={url:"https://github.com/liquidcommerce/elements-sdk/issues"},U="./dist/index.esm.js",G="./umd/elements.js",K="./dist/types/index.d.ts",Y="pnpm@10.0.0",W={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},Q=["dist","umd","docs","README.md","LICENSE"],Z={access:"public",registry:"https://registry.npmjs.org/"},X="module",J=["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 node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},tt=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],et={"@biomejs/biome":"2.3.10","@commitlint/cli":"^20.2.0","@commitlint/config-conventional":"^20.2.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.3","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},nt={node:">=22"},it={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},ot={name:O,description:z,license:R,author:L,version:M,homepage:B,repository:j,bugs:q,module:U,browser:G,types:K,packageManager:Y,exports:W,files:Q,publishConfig:Z,type:X,sideEffects:J,scripts:$,keywords:tt,devDependencies:et,engines:nt,pnpm:it};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const e=await this.waitForContainerInit(t,1e4);return e?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(e){return this.checkFallbackGTM(t)}}waitForContainerInit(t,e){return new Promise(n=>{let s;const a=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(a),clearTimeout(s),n(!![]))},100);s=setTimeout(()=>{clearInterval(a),n(![])},e)})}injectGTMScript(t){return new Promise((e,n)=>{const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+t,s.async=!![],s.crossOrigin="anonymous";let a=![];const c=setTimeout(()=>{a||(a=!![],this.isContainerInitialized(t)?e():n(new Error("GTM script timeout")))},15e3);s.onload=()=>{a||setTimeout(()=>{a||(a=!![],clearTimeout(c),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?e():n(new Error("GTM script loaded but failed to initialize")))},500)},s.onerror=()=>{setTimeout(()=>{a||(a=!![],clearTimeout(c),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?e():n(new Error("GTM script failed to load")))},100)},document.head.appendChild(s)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const s of e)try{const t={event:s.eventName,...s.eventData};window.dataLayer.push(t)}catch(n){this.logger.error("Error processing queued event "+s.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const e=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!e.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+e.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(e.message),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),a={...n,...s.length>0&&{send_to:s},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:ot.description+" v"+ot.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:a,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const c={event:e,...a};window.dataLayer.push(c)}catch(s){this.logger.error("GTM "+t+" error",s)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const s=performance.now();try{const a=n(),c=performance.now()-s;return this.logger.info("🏪 Store "+t+" ✓ "+c.toFixed(3)+"ms",e),a}catch(a){const n=performance.now()-s;throw this.logger.error("🏪 Store "+t+" ✗ "+n.toFixed(3)+"ms",{payload:e,error:a}),a}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),s=e(),a=performance.now()-n;return a>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+a.toFixed(2)+"ms"),s},this.state=F,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const s of e){if(null==n)return;n=n[s]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),s=e(n);return this.set(t,s)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let s=this.state;const a=n.pop();for(const c of n){if(void 0===s[c])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];s=s[c]}if(Array.isArray(s))s=s.filter((t,e)=>e!==Number.parseInt(a,10));else{if("object"!=typeof s||null===s)return this.logger.warn('Cannot remove property "'+a+'" from non-object type at path "'+t+'".'),![];{const{[a]:t,...e}=s;s=e}}return this.state=this.immutableSet(this.state,n.join("."),s),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,s]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,s)}}else for(const[n,s]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,s)}for(const{path:t,oldValue:n,newValue:s}of e)this.notifyListeners(t,s,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let s;const a=t.map(t=>this.watch(t,(a,c)=>{n.push({path:t,value:a,oldValue:c}),clearTimeout(s),s=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of a)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,E)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...s}=e;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(t,e,n){let s=0;const h=()=>{if(s>=this.middleware.length)return n();const a=this.middleware[s++];return a({action:t,payload:e,state:this.getState(),next:h})};return h()}immutableSet(t,e,n){const s=e.split(".");if(1===s.length){if(Array.isArray(t)){const e=[...t];return e[s[0]]=n,e}return{...t,[s[0]]:n}}const[a,...c]=s,l=t[a],d=Array.isArray(l)?[]:{};if(Array.isArray(t)){const e=[...t];return e[a]=this.immutableSet(l||d,c.join("."),n),e}return{...t,[a]:this.immutableSet(l||d,c.join("."),n)}}notifyListeners(t,e,n){const s=this.listeners.get(t);if(s)for(const d of s)try{d(e,n)}catch(c){this.logger.error('Error in store listener for path "'+t+'"',c)}const a=t.split(".");for(let d=a.length-1;d>0;d--){const t=a.slice(0,d).join("."),e=this.listeners.get(t);if(e){const s=this.get(t),c=a.slice(d).join("."),p=this.immutableSet(s,c,n);for(const n of e)try{n(s,p)}catch(l){this.logger.error('Error in store listener for parent path "'+t+'"',l)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const e=this.get("address.id")||"",n=this.get("cart.id");if(!e&&!n)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const s=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(s,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:e,cartId:n})}catch(s){this.logger.error("Failed to persist session data to DB",s)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(ot){this.logger.error("Failed to clear localStorage entry",ot)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id");(e||n)&&(t=e+":"+n)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes(":")){const[t,n]=e.split(":");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}async getAddressDataFromId(t){if(!t||""===t.trim())return S;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{latitude:e.coordinates.latitude,longitude:e.coordinates.longitude}}:{...S,id:t}}catch(e){return{...S,id:t}}}}const rt=[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,a.PRODUCT_LIST,a.PRODUCT_LIST_CARD,a.PRODUCT_LIST_CARD_LOADING,a.PRODUCT_LIST_FILTERS],st=[a.ADDRESS_INPUT,a.ADDRESS_DISPLAY],at=[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],ct=[a.CHECKOUT,a.CHECKOUT_INFORMATION,a.CHECKOUT_STRIPE_HANDLER,a.CHECKOUT_STRIPE_FORM,a.CHECKOUT_PAYMENT,a.CHECKOUT_BILLING,a.CHECKOUT_ORDER_SUMMARY,a.CHECKOUT_PROMO_CODE,a.CHECKOUT_GIFT_CARDS,a.CHECKOUT_AMOUNTS,a.CHECKOUT_ITEMS,a.CHECKOUT_COMPLETED,a.CHECKOUT_DELIVER_TO,a.CHECKOUT_DELIVER_TO_SUMMARY,a.CHECKOUT_BUYER,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,a.CHECKOUT_PRESALE_EXPIRED,a.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],s=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),a="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+a,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .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, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+b.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+b.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+b.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: "+b.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+b.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+b.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: "+b.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+b.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 padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+b.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+b.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+b.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+b.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+b.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+b.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+b.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+b.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+b.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+b.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: "+b.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: "+b.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: "+b.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+b.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const lt={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},dt={backgroundColor:"--product-background-color"},ht={backgroundColor:"--cart-background-color"},ut={backgroundColor:"--address-background-color"},pt={backgroundColor:"--checkout-background-color"},mt={global:lt,product:dt,cart:ht,address:ut,checkout:pt};function getCSSVariableMapping(t){return mt[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},s=getCSSVariableMapping(e);for(const[a,c]of Object.entries(s)){const e=this.getValueByPath(t,a);void 0!==e&&this.isCSSValue(e)&&(n[c]=e,this.isColorVariable(c,e)&&this.generateOpacityVariants(n,c,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},s=getCSSVariableMapping(e);for(const[a,c]of Object.entries(s))if(this.hasValueAtPath(t,a)){const e=this.getValueByPath(t,a);void 0!==e&&this.isCSSValue(e)&&(n[c]=e,this.isColorVariable(c,e)&&this.generateOpacityVariants(n,c,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,s]of Object.entries(e))n.style.setProperty(t,String(s))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let s=t;for(const a of n){if(null==s||!(a in s))return![];s=s[a]}return!![]}findOrCreateRule(t){const e=":host";for(const s of Array.from(t.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===e)return s;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const s of this.opacityLevels){const a=e+"-"+s.suffix,c=this.addOpacityToHexColor(n,s.value);c&&(t[a]=c)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(e);return n&&s}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const s=Math.round(255*e),a=s.toString(16).padStart(2,"0");return"#"+n+a}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),s=this.cssProcessor.generateCSSVariablesString(n),a=this.getStylesheetStyles(t).join("\n\n"),c=0===s.length?"":":host { "+s+" }",l=("\n "+c+"\n\n "+a+"\n ").trim();this.createStylesheet(t,l)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(ot){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const s=this.styleSheets.get(t);if(s&&"string"!=typeof s){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(s,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;const s=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=s,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==rt.indexOf(t)?this.getConfigs("product"):-1!==st.indexOf(t)?this.getConfigs("address"):-1!==at.indexOf(t)?this.getConfigs("cart"):-1!==ct.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===a.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),a=this.stylesheetGenerator.getStylesheet("checkout"),c=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),s&&t.push(s),a&&t.push(a),c&&t.push(c),t}let n;if(st.includes(t)||t===a.ADDRESS)n="address";else if(rt.includes(t)||t===a.PRODUCT)n="product";else if(at.includes(t)||t===a.CART)n="cart";else{if(!ct.includes(t)&&t!==a.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const s=this.stylesheetGenerator.getStylesheet(n);return s?[...e,s]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const s in e)null!==e[s]&&void 0!==e[s]&&("object"!=typeof e[s]||Array.isArray(e[s])||"object"!=typeof t[s]||Array.isArray(t[s])?n[s]=e[s]:n[s]=this.deepMerge(t[s],e[s]));return n}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const s=this.store.get("cart.id"),a=this.store.get("cart.items."+t);if(!a)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const c=a.quantity+e;if(c<1)return this.removeItem(t,!![]);const l=this.buildItemUpdate(a,c),d=await this.api.updateCart({id:s,items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.updateFulfillment(a.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:s,itemId:a.id,quantity:c,previousQuantity:a.quantity});const p=splitCategoryPath(a.catPath),m={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:Math.abs(e),price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};e<0?this.googleTagManager.removeFromCart(m):e>0&&this.googleTagManager.addToCart(m)}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to update item quantity",s),s}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const s=this.store.get("cart.id"),a=this.store.get("cart.items."+t);if(!a)throw new SDKError("Item not found");const c=this.buildItemUpdate(a,0),l=await this.api.updateCart({id:s,items:[c],location:this.getLocation()}),d={itemId:a.id,fulfillmentId:a.fulfillmentId,retailerId:a.retailerId};this.syncItemsFromApiResponse(l,[]),this.cleanupAfterItemRemoval(d,l),this.syncCartMetaFromApiResponse(l),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:s,itemId:a.id});const p=splitCategoryPath(a.catPath);this.googleTagManager.removeFromCart({item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:a.quantity,price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to remove item",s),s}}async updateItemEngraving(t,e){var s,a,c;try{const l=this.store.get("cart"),d=null===(s=l.items)||void 0===s?void 0:s[t];if(!d)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const p=this.getDetails(),m={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:e},f=await this.api.updateCart({id:l.id||"",items:[m],location:this.getLocation()});this.syncItemsFromApiResponse(f,[t]),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const g=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:g.cartId,itemId:d.id,engravingLines:e,previousEngravingLines:(null===(c=null===(a=d.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:p,current:g})}catch(l){throw this.store.set("cart.items."+t+".error",l.message),this.logger.error("Failed to update item engraving",l),l}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,s;try{this.store.set("cart.loading",!![]);const a=this.store.get("cart"),c=this.getDetails(),l=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],d=l.length>0,p=Object.values(a.items||{}).find(e=>{var n,s,a,c,p;const m=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!m)return![];if(d){const t=(null===(s=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.lines)||[];return l.join(",")===t.join(",")}return!(null===(p=null===(c=null===(a=e.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||void 0===p?void 0:p.length)}),m={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:p?t.quantity+p.quantity:t.quantity};d&&(m.engravingLines=l);const f=await this.api.updateCart({id:a.id||"",items:[m],location:this.getLocation()}),g=null===(s=Object.values(f.items))||void 0===s?void 0:s.find(t=>t.fulfillmentId===m.fulfillmentId&&t.partNumber===m.partNumber);if(!g)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(f,[]);const v=this.store.get("cart.fulfillments."+t.fulfillmentId);v?this.updateFulfillment(t.fulfillmentId,f):this.addNewFulfillmentAndRetailer(t.fulfillmentId,f),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const b=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:b.cartId,itemId:g.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:c,current:b});const C=splitCategoryPath(g.catPath);this.googleTagManager.addToCart({item_id:g.liquidId,item_name:g.name,item_brand:g.brand,item_size:g.size,item_category:C.category,item_category2:C.category2,item_category3:C.category3,quantity:g.quantity,price:centToDollar(g.unitPrice||0),item_image:g.mainImage,upc:g.upc,grouping_id:g.salsifyGrouping,product_id:g.liquidId})}catch(a){this.store.set("cart.error",a.message),this.logger.error("Failed to add item to cart",a)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=this.clientConfig.get("checkoutUrl");if(e){this.trackBeginCheckout(t);const n=this.resolveCheckoutRedirectUrl(e);return window.location.assign(n),void 0}this.pubSub.publishAction(n.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var e;const n=(null===(e=t.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}resolveCheckoutRedirectUrl(t){if(!t.includes("{id}"))return t;const e=this.store.get("cart.id")||this.store.get("checkout.cartId")||"";return e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no cart ID was found. Removing placeholder.'),t.split("{id}").join(""))}async applyPromoCode(t){var e,s,a,c,l;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const d=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(d);const p=await this.api.updateCart({id:t,items:[],promoCode:d,location:this.getLocation()});this.store.batch({"cart.subtotal":p.subtotal,"cart.itemsQuantity":p.itemsQuantity,"cart.events":p.events});const m=(null===(s=null===(e=p.promoCode)||void 0===e?void 0:e.code)||void 0===s?void 0:s.toLowerCase())===d.toLowerCase();m?(this.store.set("cart.promoCode",{code:d,discount:(null===(a=p.promoCode)||void 0===a?void 0:a.discount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(c=p.promoCode)||void 0===c?void 0:c.discount)||0,newSubtotal:p.subtotal||0}),this.googleTagManager.promoCodeApplied(d,(null===(l=p.promoCode)||void 0===l?void 0:l.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(d,'Code "'+d+'" does not exist'))}catch(p){const t=(null==p?void 0:p.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:t}),this.googleTagManager.promoCodeFailed(d,t),this.logger.error("Failed to apply promo code",p),p}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const s=this.store.get("cart.promoCode"),a=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:a,error:e}),(null==s?void 0:s.code)&&this.googleTagManager.promoCodeFailed(s.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{..._,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartState(e,!![]),e.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(n.CART_RESET,!![])}catch(t){const e=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",e);const s=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_FAILED,{cartId:s,message:e}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),s={};for(const a in e.items||{}){const t=e.items[a];s[a]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:e.id||"",promoCodeDiscount:(null===(t=e.promoCode)||void 0===t?void 0:t.discount)||null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:s,retailers:e.retailers||{},location:n.id?{placesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}buildItemUpdate(t,e){var n,s,a;const c={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},l=(null===(a=null===(s=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(t=>""!==t.trim()))||[];return l.length>0&&(c.engravingLines=l),c}syncItemsFromApiResponse(t,e=[]){const n=this.store.get("cart.items")||{},s=new Set(Object.keys(t.items));for(const c of Object.keys(n))s.has(c)||this.store.remove("cart.items."+c);const a={};for(const c of Object.values(t.items))0!==e.length&&!e.includes(c.id)&&n[c.id]||(a["cart.items."+c.id]=c);Object.keys(a).length>0&&this.store.batch(a)}syncCartMetaFromApiResponse(t){var e,n;const s={"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":t.events},a=null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code;if(a)s["cart.promoCode"]={code:a.toUpperCase(),discount:(null===(n=t.promoCode)||void 0===n?void 0:n.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(t){var e,n;const s=this.store.get("cart.retailers")||{},a=this.store.get("cart.fulfillments")||{},c=new Set(Object.keys(t.retailers)),l=new Set;for(const d of Object.values(t.retailers))if(d.fulfillments)for(const t of Object.keys(d.fulfillments))l.add(t);for(const d of Object.keys(s))c.has(d)||this.store.remove("cart.retailers."+d);for(const d of Object.keys(a))l.has(d)||this.store.remove("cart.fulfillments."+d);if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const s of Object.values(t.retailers))if(e["cart.retailers."+s.id]=s,(null===(n=Object.values(s.fulfillments))||void 0===n?void 0:n.length)>0)for(const t of Object.values(s.fulfillments))e["cart.fulfillments."+t.id]=t;this.store.batch(e)}}updateFulfillment(t,e){var n;const s=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),a=null==s?void 0:s.fulfillments[t];a&&s&&this.store.set("cart.fulfillments."+t,a)}addNewFulfillmentAndRetailer(t,e){var n;const s=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),a=null==s?void 0:s.fulfillments[t];if(a&&s){const e={["cart.fulfillments."+t]:a,["cart.retailers."+s.id]:s};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,s;const a=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.some(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t.fulfillmentId)}),c=null===(s=Object.keys(e.retailers))||void 0===s?void 0:s.some(e=>e===t.retailerId);if(a){this.updateFulfillment(t.fulfillmentId,e);const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),c){const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,e=![]){var s,a,c,l,d;const p=this.store.get("cart");for(const n of Object.keys(p.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(p.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(p.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const m={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(s=t.promoCode)||void 0===s?void 0:s.code)?{...t.promoCode,error:null}:null};if((null===(a=Object.values(t.items))||void 0===a?void 0:a.length)>0)for(const n of Object.values(t.items))m["cart.items."+n.id]=n;if((null===(c=Object.values(t.retailers))||void 0===c?void 0:c.length)>0)for(const n of Object.values(t.retailers))if(m["cart.retailers."+n.id]=n,(null===(l=Object.values(n.fulfillments))||void 0===l?void 0:l.length)>0)for(const t of Object.values(n.fulfillments))m["cart.fulfillments."+t.id]=t;if((null===(d=t.events)||void 0===d?void 0:d.length)>0&&(m["cart.events"]=t.events),this.store.batch(m),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var e,n;const s=this.store.get("address"),a={};for(const c of Object.keys(t.items||{})){const e=t.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,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:a,retailers:t.retailers||{},location:(null==s?void 0:s.id)&&s.coordinates&&s.address?{placesId:s.id,formattedAddress:s.formattedAddress,address:s.address,coordinates:s.coordinates}:null}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const s={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:s}),t===a.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===a.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===a.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===a.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+n.INTERNAL_CART_TO_CHECKOUT,async()=>{await this.loadCheckout({}),this.uiCommands.openDrawer(a.CHECKOUT)}),window.addEventListener("lce:actions."+n.CART_RESET,()=>{this.store.set("checkout",{...P,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const e={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},n=await this.api.updateCart({id:"",items:[e],location:this.getLocation()});await this.loadCheckout({customCartId:n.id,isForPresale:!![]})}catch(e){throw this.store.set("checkout.error",e.message),this.logger.error("Failed to add presale item to checkout",e),e}}async loadCheckout(t){var e;try{this.store.set("checkout.loading",!![]);const s=void 0!==t.customCartId?t.customCartId:this.store.get("cart.id"),a=this.store.get("cart");if(0===(null===(e=Object.values(a.items||{}))||void 0===e?void 0:e.length)&&!t.customCartId)return;const c=this.themeProvider.getConfigs("checkout"),l={canEmail:c.layout.emailOptIn.checked,canSms:c.layout.smsOptIn.checked};if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const d=await this.api.prepareCheckout({cartId:s,marketingPreferences:l});if(t.isForPresale===!![]&&0===Object.values(d.items).length)return this.openPresaleExpiredDrawer("items_unavailable"),void 0;const p={"checkout.cartId":d.cartId,"checkout.isGift":d.isGift,"checkout.marketingPreferences":d.marketingPreferences,"checkout.customerForm":P.customerForm,"checkout.giftRecipientForm":P.giftRecipientForm,"checkout.paymentForm":P.paymentForm,"checkout.paymentForm.billingSameAsShipping":d.billingSameAsShipping,"checkout.shippingAddressTwo":d.shippingAddress.two||"","checkout.presale":d.presale,"checkout.giftRecipientForm.data":d.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":d.itemsQuantity};this.store.batch(p),this.syncCheckoutState(d),this.pubSub.publishAction(n.CHECKOUT_LOADED,this.getDetails())}catch(s){this.store.set("checkout.error",s.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:s.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),s=null!=t?t:!e,a={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":s,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":a});const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{cartId:c,isActive:s,previousIsActive:e})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),s=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:a,isActive:s,previousIsActive:e})}async toggleMarketingPreferences(t,e){const s=this.store.get("checkout.marketingPreferences."+t),a=null!=e?e:!s,c=this.store.get("checkout.marketingPreferences"),l=this.dataForCheckoutPrepare({marketingPreferences:{...c,[t]:a}}),d=await this.api.prepareCheckout(l);this.store.set("checkout.marketingPreferences",d.marketingPreferences);const p=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:p,fieldName:t,isActive:a,previousIsActive:s})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":e,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const n=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:e});return{id:n.id,card:{brand:n.card.brand,last4:n.card.last4,expMonth:n.card.expMonth,expYear:n.card.expYear}}}catch(n){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const e=this.dataForCheckoutPrepare({}),s=await this.api.prepareCheckout({...e,promoCode:t}),a=0!==s.amounts.discounts,c=s.events.some(t=>t.type===p.PROMO_CODE)?s.events[0]:null;if(!a){this.store.set("checkout.promoCodeError",c?c.message:'Code "'+t+'" does not exist');const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e,error:(null==c?void 0:c.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==c?void 0:c.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:l,discount:s.amounts.discounts,newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(t,s.amounts.discounts),await this.refreshCheckout({response:s})}catch(e){const s=(null==e?void 0:e.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",s);const a=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:a,error:s}),this.googleTagManager.promoCodeFailed(t,s),e}}async removePromoCode(){var t,e;try{const s=this.dataForCheckoutPrepare({}),a=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",c=await this.api.prepareCheckout({...s,promoCode:""});if(0!==c.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:l,newTotal:c.amounts.total}),this.googleTagManager.promoCodeApplied(a,0),await this.refreshCheckout({response:c})}catch(s){const t=(null==s?void 0:s.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"",a=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:a,error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),s}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(ot){const e=ot.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),ot}}async applyGiftCard(t){const e=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(e);const t=this.dataForCheckoutPrepare({}),s=t.giftCards||[],a=await this.api.prepareCheckout({...t,giftCards:[...s,e]}),c=a.events.some(t=>t.type===p.GIFT_CARD&&t.level===m.ERROR)?a.events[0]:null;c&&this.store.set("checkout.giftCardError",c.message);const l=a.giftCards.find(t=>t.code.toLowerCase()===e.toLowerCase());if(!l){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==c?void 0:c.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(e,(null==c?void 0:c.message)||"not_applied"),void 0}const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:d,newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(e,l.applied),await this.refreshCheckout({response:a})}catch(s){const t=(null==s?void 0:s.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const a=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:a,error:t}),this.googleTagManager.giftCardFailed(e,t),s}}async removeGiftCard(t){var e;const s=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),a=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==s.toLowerCase()))||[],c=await this.api.prepareCheckout({...t,giftCards:a}),l=c.giftCards.find(t=>t.code.toLowerCase()===s.toLowerCase());if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+s),void 0;const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:d,newTotal:c.amounts.total}),this.googleTagManager.giftCardApplied(s,0),await this.refreshCheckout({response:c})}catch(a){const t=(null==a?void 0:a.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(s,t),a}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(ot){throw this.store.set("checkout.error",(null==ot?void 0:ot.message)||"Failed to clear gift card error. Please try again."),ot}}openPresaleExpiredDrawer(t="time_expired"){this.uiCommands.openDrawer(a.CHECKOUT_PRESALE_EXPIRED,{reason:t})}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var s,a,c;try{this.store.set("checkout.items."+t+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const p=d.quantity,m=d.quantity+e;if(m<1)return this.removeItem(t,!![]);const f={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:m},g=(null===(c=null===(a=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];g.length>0&&(f.engravingLines=g);const v=await this.api.updateCheckoutItems({cartId:l,items:[f],location:this.getLocation()});this.syncFromItemUpdate(v.cart,v.checkout),this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:l,cartItemId:d.cartItemId,quantity:m,previousQuantity:p});const b=splitCategoryPath(d.catPath),C={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,quantity:Math.abs(e),price:centToDollar(d.unitPrice||0),item_image:d.mainImage,upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};e<0?this.googleTagManager.removeFromCart(C):e>0&&this.googleTagManager.addToCart(C)}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),l}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,s,a;try{const c=this.store.get("checkout.items."+t);if(!c)throw new SDKError("Item not found in checkout");if(!(null===(e=c.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const l=(null===(a=null===(s=c.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[],d={id:c.cartItemId,fulfillmentId:c.fulfillmentId,partNumber:c.partNumber,quantity:c.quantity,engravingLines:[]},p=this.store.get("checkout.cartId"),m=await this.api.updateCheckoutItems({cartId:p,items:[d],location:this.getLocation()});this.syncFromItemUpdate(m.cart,m.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:p,cartItemId:c.cartItemId,engravingLines:[],previousEngravingLines:l})}catch(c){throw this.store.set("checkout.items."+t+".error",c.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:c.message}),c}}async removeItem(t,e){var s,a,c;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const p={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:0},m=(null===(c=null===(a=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];m.length>0&&(p.engravingLines=m);const f=await this.api.updateCheckoutItems({cartId:l,items:[p],location:this.getLocation()});this.syncFromItemUpdate(f.cart,f.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:l,cartItemId:d.cartItemId})}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),l}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.fulfillments"),s=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),a=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:Math.round(e.amounts.subtotal*t/100)})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:a}));this.updateStoreFromCheckoutResponse(l);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:d,deliveryTips:a,previousDeliveryTips:s})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const s=this.store.get("checkout.fulfillments"),a=Object.values(s||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),l=Object.values(s||{}).filter(t=>t.type===c.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?e:n.amounts.tip})),d=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:l}));this.updateStoreFromCheckoutResponse(d);const p=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:p,deliveryTips:l,previousDeliveryTips:a})}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(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.fulfillments"),s=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),a=Object.values(e||{}).filter(t=>t.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?0:e.amounts.tip})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:a}));this.updateStoreFromCheckoutResponse(l);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:d,deliveryTips:a,previousDeliveryTips:s})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:s}){var a;try{this.store.set("checkout.customerForm.isSaving",!![]);const c=this.store.get("checkout.customerForm.data"),l=this.store.get("checkout.isGift"),d=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...c,...s},isGift:l}),p=await this.api.prepareCheckout(d);this.store.batch({"checkout.customerForm.data":p.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":p.shippingAddress.two,"checkout.deliveryInstructions":e});const m=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:m});const f=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(f.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(a=f.promoCode)||void 0===a?void 0:a.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...s}){var a;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const c=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:s}),l=await this.api.prepareCheckout(c);this.store.batch({"checkout.giftRecipientForm.data":l.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":l.shippingAddress.two,"checkout.deliveryInstructions":e});const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:d});const p=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(p.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(a=p.promoCode)||void 0===a?void 0:a.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var s,a,c;try{this.store.set("checkout.paymentForm.isSaving",!![]);const l=this.store.get("checkout"),d={},p=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let m=null,f=null;if(p||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");m=t.card,f=t.id}const g=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:f||void 0}),v=await this.api.prepareCheckout(g);if(v.payment&&m&&(d["checkout.paymentForm.paymentMethod"]={id:v.payment,card:m}),t&&v.billingAddress){d["checkout.paymentForm.data"]={firstName:v.billingAddress.firstName||"",lastName:v.billingAddress.lastName||"",email:v.billingAddress.email||"",phone:v.billingAddress.phone||"",company:v.billingAddress.company||"",addressOne:v.billingAddress.one||"",addressTwo:v.billingAddress.two||"",city:v.billingAddress.city||"",state:v.billingAddress.state||"",zipCode:v.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}d["checkout.paymentForm.isEditing"]=![],d["checkout.paymentForm.isValid"]=!![],this.store.batch(d);const b=d["checkout.paymentForm.paymentMethod"]||(null===(s=l.paymentForm)||void 0===s?void 0:s.paymentMethod),C=(null===(a=null==b?void 0:b.card)||void 0===a?void 0:a.brand)?b.card.brand+" ****"+b.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(l.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),C,(null===(c=l.promoCode)||void 0===c?void 0:c.code)||void 0)}catch(l){throw this.logger.error("Failed to save payment form",l),this.store.set("checkout.error",l.message),l}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,s,c,l,d;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const p=this.store.get("checkout"),{orderNumber:m}=await this.api.checkoutComplete(p.token);p.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(a.CHECKOUT_COMPLETED,{orderNumber:m,orderTotal:p.amounts.total,cardLast4:null===(s=null===(e=null===(t=null==p?void 0:p.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===s?void 0:s.last4,customerEmail:p.customerForm.data.email,giftRecipientEmail:(null===(l=null===(c=null==p?void 0:p.giftRecipientForm)||void 0===c?void 0:c.data)||void 0===l?void 0:l.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:m,orderTotal:p.amounts.total}),this.googleTagManager.purchase({transaction_id:m,tax:centToDollar(p.amounts.tax+p.amounts.service+p.amounts.platform),shipping:centToDollar(p.amounts.shipping||0),coupon:(null===(d=p.promoCode)||void 0===d?void 0:d.code)||void 0,items:[...Object.values(p.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(p.amounts.total),subtotal:centToDollar(p.amounts.subtotal),total_before_discounts:centToDollar(p.amounts.subtotal+p.amounts.tax+p.amounts.service+p.amounts.platform+p.amounts.shipping+p.amounts.delivery),discounts:centToDollar(p.amounts.discounts),gift_cards:centToDollar(p.amounts.giftCards||0),net_total:centToDollar(p.amounts.total)})}catch(p){const t=(null==p?void 0:p.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const e={"checkout.amounts":t.amounts,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const n of Object.values(t.retailers))for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t;this.store.batch(e)}syncFromItemUpdate(t,e){var n,s,a,c,l;try{this.store.set("checkout.updating",!![]);const d=this.store.get("cart");for(const t of Object.keys(d.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(d.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(d.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const p={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(n=t.promoCode)||void 0===n?void 0:n.code)?{...t.promoCode,error:null}:null};if((null===(s=Object.values(t.items))||void 0===s?void 0:s.length)>0)for(const e of Object.values(t.items))p["cart.items."+e.id]=e;if((null===(a=Object.values(t.retailers))||void 0===a?void 0:a.length)>0)for(const e of Object.values(t.retailers))if(p["cart.retailers."+e.id]=e,(null===(c=Object.values(e.fulfillments))||void 0===c?void 0:c.length)>0)for(const t of Object.values(e.fulfillments))p["cart.fulfillments."+t.id]=t;this.store.batch(p);const m={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.itemsQuantity":e.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(l=null==e?void 0:e.promoCode)||void 0===l?void 0:l.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(e.items))m["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(e.retailers)){m["checkout.retailers."+t.id]=t;for(const e of Object.values(t.fulfillments))m["checkout.fulfillments."+e.id]=e}}this.store.batch(m)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var e;const n={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(t.items))n["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(t.retailers)){n["checkout.retailers."+e.id]=e;for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t}}this.store.batch(n)}async refreshCheckout(t){var e;try{let n;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)n=t.response;else{const s=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const a=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...a,cartId:s})}this.syncCheckoutState(n)}catch(s){const t=(null==s?void 0:s.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),s}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:s,shippingAddressTwo:a,deliveryInstructions:l,deliveryTips:d,paymentMethodId:p,isGift:m}){var f,g,v,b,C,S,E,_,P,I,F,O,z,R,L,M,B,j,q,U,G,K,Y;const W=this.store.get("checkout"),Q=null!==(g=null===(f=W.paymentForm)||void 0===f?void 0:f.billingSameAsShipping)&&void 0!==g?g:!![],Z=void 0!==m?m:W.isGift,X=e?!![]:null!==(b=null===(v=W.giftRecipientForm)||void 0===v?void 0:v.isValid)&&void 0!==b?b:![],J=Z&&X,$={cartId:W.cartId,shippingAddressTwo:a,billingSameAsShipping:Q,marketingPreferences:s||W.marketingPreferences,promoCode:(null===(C=W.promoCode)||void 0===C?void 0:C.code)||void 0,isGift:J,giftCards:(null===(S=null==W?void 0:W.giftCards)||void 0===S?void 0:S.map(t=>t.code))||[],deliveryTips:d||Object.values(W.fulfillments||{}).filter(t=>t.type===c.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};p?$.payment=p:(null===(_=null===(E=W.paymentForm)||void 0===E?void 0:E.paymentMethod)||void 0===_?void 0:_.id)&&($.payment=W.paymentForm.paymentMethod.id);const tt=l||W.deliveryInstructions;if(tt&&($.deliveryInstructions=Object.values(W.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:tt}))),$.customer=t||((null===(I=null===(P=null==W?void 0:W.customerForm)||void 0===P?void 0:P.data)||void 0===I?void 0:I.email)?{firstName:null===(O=null===(F=W.customerForm)||void 0===F?void 0:F.data)||void 0===O?void 0:O.firstName,lastName:null===(R=null===(z=W.customerForm)||void 0===z?void 0:z.data)||void 0===R?void 0:R.lastName,email:null===(M=null===(L=W.customerForm)||void 0===L?void 0:L.data)||void 0===M?void 0:M.email,phone:null===(j=null===(B=W.customerForm)||void 0===B?void 0:B.data)||void 0===j?void 0:j.phone,birthDate:null===(U=null===(q=W.customerForm)||void 0===q?void 0:q.data)||void 0===U?void 0:U.birthDate,company:null===(K=null===(G=W.customerForm)||void 0===G?void 0:G.data)||void 0===K?void 0:K.company}:void 0),J){const t=e||(null===(Y=W.giftRecipientForm)||void 0===Y?void 0:Y.data);t&&($.giftOptions=t)}return Q||(n?$.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip}:W.paymentForm.data&&($.billingAddress=W.paymentForm.data)),$}getDetails(){var t,e,n,s;const a=this.store.get("checkout"),c={};for(const l in a.items||{}){const t=a.items[l];c[l]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:l,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:a.cartId,isGift:a.isGift||![],billingSameAsShipping:(null===(t=a.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(e=a.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(n=a.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:Boolean(null===(s=a.promoCode)||void 0===s?void 0:s.code),hasGiftCards:Array.isArray(a.giftCards)&&a.giftCards.length>0,amounts:a.amounts,itemCount:Object.values(c).reduce((t,e)=>t+(e.quantity||0),0),items:c}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const s=[];for(const c of n.products){const a=Object.values(c.sizes).filter(e=>t.some(t=>t===(e.upc||e.id||c.salsifyGrouping))),l=t.find(t=>a.some(e=>t===e.upc||t===e.id)||t===c.salsifyGrouping),d=l||(null===(e=null==a?void 0:a[0])||void 0===e?void 0:e.upc);await this.loadProduct(d,{products:[c],retailers:n.retailers}),s.push(d)}const a=t.filter(t=>-1===s.indexOf(t));this.store.batch(a.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var s,a;try{const c=this.store.get("products."+t);c.loading||this.store.set("products."+t+".loading",!![]);let l=null;if(e&&(l=e),e||(l=await this.api.getProductsData([t],this.getLocation())),!l||!(null===(s=null==l?void 0:l.products)||void 0===s?void 0:s[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(l);if(!d)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...d,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const p=l.products[0],m=d.sizes[d.selectedSizeId||""],f=Boolean(this.getLocation()),g=d.selectedFulfillment,v=f&&(null==g?void 0:g.variant.price)?g.variant.price:d.noAvailabilityPrice,b=splitCategoryPath(p.catPath);this.googleTagManager.viewItem({item_id:null==m?void 0:m.id,item_name:p.name,item_brand:p.brand,item_size:null==m?void 0:m.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(v),item_type:p.type,item_subtype:p.subType,item_image:(null==m?void 0:m.image)||(null===(a=p.images)||void 0===a?void 0:a[0]),upc:null==m?void 0:m.upc,grouping_id:p.salsifyGrouping,product_id:null==m?void 0:m.id})}catch(c){this.store.set("products."+t+".error",c.message),this.logger.error("Failed to load product data for ID "+t,c)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var s,a,l;const d=this.store.get("products."+t);let p=d.selectedFulfillmentType;const m=d.sizes[e];let f=null,g=null;if(p!==c.SHIPPING||Object.values(m.shippingFulfillments).length)if(p!==c.ON_DEMAND||Object.values(m.onDemandFulfillments).length){const t=p===c.SHIPPING?m.shippingFulfillments:m.onDemandFulfillments,e=Object.values(t);f=e[0]||null,g=(null==f?void 0:f.id)||null}else{p=c.SHIPPING;const t=Object.values(m.shippingFulfillments);f=t[0]||null,g=(null==f?void 0:f.id)||null}else{p=c.ON_DEMAND;const t=Object.values(m.onDemandFulfillments);f=t[0]||null,g=(null==f?void 0:f.id)||null}const v=p===c.SHIPPING?m.shippingFulfillments:m.onDemandFulfillments,b=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==m?void 0:m.id,item_name:d.name,item_brand:d.brand,item_size:null==m?void 0:m.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar((null==f?void 0:f.variant.price)||d.noAvailabilityPrice),item_type:d.type,item_subtype:d.subType,item_image:(null==m?void 0:m.image)||(null===(s=d.images)||void 0===s?void 0:s[0]),upc:null==m?void 0:m.upc,grouping_id:d.salsifyGrouping,product_id:null==m?void 0:m.id});const C=Object.keys(m.shippingFulfillments).length>0,S=Object.keys(m.onDemandFulfillments).length>0;C||S||this.googleTagManager.productSizeNoAvailability({productId:null==m?void 0:m.id,productName:d.name,productBrand:d.brand,productCategory:b.category,productCategory2:b.category2,productCategory3:b.category3,productType:d.type,productSubtype:d.subType,productPrice:d.noAvailabilityPrice,sizeId:e,sizeName:null==m?void 0:m.size,upc:null==m?void 0:m.upc,groupingId:d.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,selectedSize:(null===(a=d.sizes[e])||void 0===a?void 0:a.size)||"",previousSizeId:d.selectedSizeId||"",previousSize:(null===(l=d.sizes[d.selectedSizeId])||void 0===l?void 0:l.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:Object.keys(m.shippingFulfillments).length+Object.keys(m.onDemandFulfillments).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(v).length),["products."+t+".selectedFulfillmentType"]:p,["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:g})}async selectFulfillment(t,e){var s;const a=this.store.get("products."+t),l=a.sizes[a.selectedSizeId],d=a.selectedFulfillmentType===c.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,p=d[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:a.selectedFulfillmentType,previousFulfillmentId:a.selectedFulfillmentId||"",previousFulfillmentType:a.selectedFulfillmentType});const m=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:a.name,item_brand:a.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar((null==p?void 0:p.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==l?void 0:l.image)||(null===(s=a.images)||void 0===s?void 0:s[0]),upc:null==l?void 0:l.upc,grouping_id:a.salsifyGrouping,product_id:null==l?void 0:l.id}),this.store.batch({["products."+t+".selectedFulfillment"]:p,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var s;const a=this.store.get("products."+t),c=a.quantity,l=c+e,d=1,p=(null===(s=null==a?void 0:a.selectedFulfillment)||void 0===s?void 0:s.variant.stock)||5,m=Math.max(d,Math.min(p,l));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:m,previousQuantity:c}),this.store.set("products."+t+".quantity",m)}async changeFulfillmentType(t,e){var s,a;const l=this.store.get("products."+t),d=l.sizes[l.selectedSizeId],p=e===c.SHIPPING?d.shippingFulfillments:d.onDemandFulfillments,m=Object.values(p);if(0===m.length){const t=splitCategoryPath(l.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==d?void 0:d.id,productName:l.name,productBrand:l.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:l.type,productSubtype:l.subType,productPrice:l.noAvailabilityPrice,sizeId:null!==(s=l.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==d?void 0:d.size,fulfillmentType:e,upc:null==d?void 0:d.upc,groupingId:l.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const f=m[0]||null,g=(null==f?void 0:f.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:g,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:m.length>0});const v=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:null==d?void 0:d.id,item_name:l.name,item_brand:l.brand,item_size:null==d?void 0:d.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar((null==f?void 0:f.variant.price)||l.noAvailabilityPrice),item_type:l.type,item_subtype:l.subType,item_image:(null==d?void 0:d.image)||(null===(a=l.images)||void 0===a?void 0:a[0]),upc:null==d?void 0:d.upc,grouping_id:l.salsifyGrouping,product_id:null==d?void 0:d.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:g,["products."+t+".fulfillmentHasAvailability"]:m.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const s={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:s})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(a.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(a.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding presale item to checkout",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t);if(!e)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[e,n])=>(t[e]={...n},t),{}):{},n=Object.entries(e.sizes||{}).reduce((t,[e,n])=>{const{loading:s,error:a,shippingFulfillments:c,onDemandFulfillments:l,...d}=n;return t[e]={...d,shippingFulfillments:fulfillmentEventData(c),onDemandFulfillments:fulfillmentEventData(l)},t},{});return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentType:e.selectedFulfillmentType,selectedFulfillmentId:e.selectedFulfillmentId||null,productHasAvailability:Boolean(e.productHasAvailability),fulfillmentHasAvailability:Boolean(e.fulfillmentHasAvailability),id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,images:e.images||[],region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,noAvailabilityPrice:e.noAvailabilityPrice,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},s=Object.values(t).length,a=Object.values(e).length;if(s+a>0)return n.id}return null}loadProductStoreUpdate({products:[t,...e],retailers:n}){var s,a,l,d,p;try{const e=this.themeProvider.getConfigs("product"),m={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:e.layout.enableShippingFulfillment?c.SHIPPING:c.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:s,onDemandVariants:a,...c}of Object.values(t.sizes)){m.sizes[c.id]={...c,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(s)){const e=n[t.retailerId];(null==e?void 0:e.shippingFulfillment)&&(m.sizes[c.id].shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}for(const t of Object.values(a)){const e=n[t.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(m.sizes[c.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const f=Object.values(m.sizes),g=this.findFirstAvailableSize(m.sizes);m.selectedSizeId=g||(null===(s=f[0])||void 0===s?void 0:s.id)||"";const v=(null===(a=m.sizes[m.selectedSizeId])||void 0===a?void 0:a.shippingFulfillments)||{},b=(null===(l=m.sizes[m.selectedSizeId])||void 0===l?void 0:l.onDemandFulfillments)||{};m.productHasAvailability=Object.values(v).length+Object.values(b).length>0;const C=m.selectedFulfillmentType===c.SHIPPING?Object.values(v):Object.values(b);if(m.fulfillmentHasAvailability=C.length>0,m.selectedFulfillment=C[0]||null,m.selectedFulfillmentId=(null===(d=m.selectedFulfillment)||void 0===d?void 0:d.id)||null,!m.fulfillmentHasAvailability){const t=m.selectedFulfillmentType===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,e=t===c.SHIPPING?Object.values(v):Object.values(b);e.length>0&&(m.selectedFulfillmentType=t,m.selectedFulfillment=e[0],m.selectedFulfillmentId=(null===(p=m.selectedFulfillment)||void 0===p?void 0:p.id)||null,m.fulfillmentHasAvailability=!![])}if(!m.productHasAvailability){const e=splitCategoryPath(t.catPath),n=m.sizes[m.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:t.name,productBrand:t.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==n?void 0:n.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return m}catch(m){throw this.logger.error("Product data processing error",m),m}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=this.buildFormattedAddressString(t),s={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(s)}catch(s){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==s?void 0:s.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:e,error:(null==s?void 0:s.message)||"Failed to set manual address"}),s}}async clearSelectedAddress(){this.store.set("address",S),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var e,n,s,a,c,l;const d=[],p=[];(null===(e=t.one)||void 0===e?void 0:e.trim())&&p.push(t.one.trim()),(null===(n=t.two)||void 0===n?void 0:n.trim())&&p.push(t.two.trim()),p.length>0&&d.push(p.join(" ")),(null===(s=t.city)||void 0===s?void 0:s.trim())&&d.push(t.city.trim());const m=[];return(null===(a=t.state)||void 0===a?void 0:a.trim())&&m.push(t.state.trim()),(null===(c=t.zip)||void 0===c?void 0:c.trim())&&m.push(t.zip.trim()),m.length>0&&d.push(m.join(" ")),(null===(l=t.country)||void 0===l?void 0:l.trim())&&d.push(t.country.trim()),d.join(", ")}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){t.location=this.getLocation();const e=await this.api.catalogSearch(t);return e.products&&e.products.length>0&&this.trackViewItemList(e.products),e}async addToCart(t){try{this.uiCommands.openDrawer(a.CART),await this.cartCommands.addItem(t)}catch(e){throw this.logger.error("Error adding product to cart from product list",e),e}}async addPresaleToCart(t){try{await this.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(a.CHECKOUT)}catch(e){throw this.logger.error("Error adding presale product to checkout from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=t.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking view_item_list event",e)}}trackSelectItem(t){try{const e=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking select_item event",e)}}convertProductToBaseItem(t){var e,n;const s=null===(e=t.sizes)||void 0===e?void 0:e[0],a=null==s?void 0:s.shippingVariants[Object.keys(s.shippingVariants)[0]],c=splitCategoryPath(t.catPath);return{item_id:null==s?void 0:s.id,item_name:t.name,item_brand:t.brand,item_size:null==s?void 0:s.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,price:(null==a?void 0:a.price)?centToDollar(a.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==s?void 0:s.image)||(null===(n=t.images)||void 0===n?void 0:n[0]),upc:null==s?void 0:s.upc,grouping_id:t.salsifyGrouping,product_id:null==s?void 0:s.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var s,a,c,l,d;const p=this.store.get("cart");for(const n of Object.keys(p.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(p.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(p.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const m={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(s=t.promoCode)||void 0===s?void 0:s.code)?{...t.promoCode,error:null}:null};if((null===(a=Object.values(t.items))||void 0===a?void 0:a.length)>0)for(const n of Object.values(t.items))m["cart.items."+n.id]=n;if((null===(c=Object.values(t.retailers))||void 0===c?void 0:c.length)>0)for(const n of Object.values(t.retailers))if(m["cart.retailers."+n.id]=n,(null===(l=Object.values(n.fulfillments))||void 0===l?void 0:l.length)>0)for(const t of Object.values(n.fulfillments))m["cart.fulfillments."+t.id]=t;if((null===(d=t.events)||void 0===d?void 0:d.length)>0&&(m["cart.events"]=t.events),this.store.batch(m),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var e,n;const s=this.store.get("address"),a={};for(const c of Object.keys(t.items||{})){const e=t.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,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:a,retailers:t.retailers||{},location:(null==s?void 0:s.id)&&s.coordinates&&s.address?{placesId:s.id,formattedAddress:s.formattedAddress,address:s.address,coordinates:s.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e);const s=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:s,message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const ft="lce-checkout-stripe-slot",gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},yt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientActionService{constructor(){this.allowedCustomerFields=new Set(Object.values(gt)),this.allowedBillingFields=new Set(Object.values(yt)),this.allowedGiftFields=new Set(Object.values(vt)),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>{if(!t||""===t.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(t)}catch(e){throw this.logger.error('Unable to retrieve product details for identifier "'+t+'"',e),new SDKError('Product "'+t+'" has not been loaded yet.',!![])}}},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof e.latitude||"number"!=typeof e.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.latitude+", long: "+typeof e.longitude,!![]);if(e.latitude<-90||e.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.latitude,!![]);if(e.longitude<-180||e.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.longitude,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},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 t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(a.CART)},addProduct:async(t,e)=>{var s,l;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const e of t){if(!e.identifier||"string"!=typeof e.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(e.fulfillmentType||(e.fulfillmentType=c.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==c.SHIPPING&&e.fulfillmentType!==c.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+e.fulfillmentType+'" for product "'+e.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(e.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+e.identifier+'"',!![])}const d=this.getLocation();if(void 0===d)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(a.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(a.CART);const p=[...new Set(t.map(t=>t.identifier))],m=await this.api.getProductsData(p,d);if(!m||!m.products||0===m.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const e of t){let t=null;for(let s=0;s<m.products.length;s++){const n=m.products[s];let a=![];const c=Object.values(n.sizes);for(let t=0;t<c.length;t++){const s=c[t];if(s.upc===e.identifier||s.id===e.identifier||n.salsifyGrouping===e.identifier){a=!![];break}}if(a){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=Object.values(t.sizes)[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(l=null===(s=null==n?void 0:n.attributes)||void 0===s?void 0:s.presale)||void 0===l?void 0:l.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let a=null;const d=e.fulfillmentType===c.SHIPPING?n.shippingVariants:n.onDemandVariants,p=Object.values(d);for(let e=0;e<p.length;e++)if(p[e]){a=p[e];break}if(!a){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const f=e.fulfillmentType===c.ON_DEMAND?a.onDemandFulfillmentId:a.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:f,partNumber:a.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation();const f=this.store.get("cart.id");this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{cartId:f,itemsAdded:t.length,identifiers:p}),this.logger.info("Products added to cart successfully:",p)}catch(d){this.logger.error("Error adding products to cart:",d),this.clearPendingCartOperation();const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:d.message||"Failed to add products to cart"}),d}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const c=this.store.get("cart.promoCode");if(c&&c.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const l=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:l.cartId,discount:l.promoCodeDiscount||0,newSubtotal:l.subtotal}),this.logger.info("Promo code applied successfully")}catch(e){this.logger.error("Failed to apply promo code:",e);const t=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const s=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:s.cartId,newSubtotal:s.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(a.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(a.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(a.CHECKOUT);const s=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout({});const c=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:c,itemsAdded:t.length,identifiers:s}),this.logger.info("Products added to checkout successfully:",s)}catch(s){this.logger.error("Error adding products to checkout:",s);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to checkout"}),s}},applyPromoCode:async t=>{var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const s=t.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===s)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const d=this.store.get("checkout"),p=d.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:d.cartId,discount:(null==p?void 0:p.discount)||0,newTotal:(null===(e=null==d?void 0:d.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(s){this.logger.error("Failed to apply checkout promo code:",s);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),s}},removePromoCode:async()=>{var t;try{const e=this.themeProvider.getConfigs("global"),s=e.layout.allowPromoCodes;if(!s)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const a=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:a.cartId,newTotal:(null===(t=null==a?void 0:a.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async t=>{var e;try{const s=this.themeProvider.getConfigs("checkout"),a=s.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(t);const c=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:c.cartId,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(s){this.logger.error("Failed to apply gift card:",s);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),s}},removeGiftCard:async t=>{var e;try{const s=this.themeProvider.getConfigs("checkout"),a=s.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.removeGiftCard(t);const c=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:c.cartId,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(s){this.logger.error("Failed to remove gift card:",s);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),s}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:async(t,e)=>{await this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[n,s]of Object.entries(t)){if(!this.allowedCustomerFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(s);n===gt.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.customerForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(e)},updateBillingInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[n,s]of Object.entries(t))this.allowedBillingFields.has(n)&&(e["checkout.paymentForm.data."+n]=this.normalizeCheckoutFieldValue(s));if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(e)},updateGiftInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[n,s]of Object.entries(t)){if(!this.allowedGiftFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(s);n===vt.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.giftRecipientForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(e)},getDetails:()=>this.command.checkout.getDetails()},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 o=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,o)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}}const bt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",xt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,e=t.instances;if(e)for(const[s,a]of e)this.interceptLoggerInstance(a,s);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.l)return;const n=t.debug.bind(t),s=t.info.bind(t),a=t.warn.bind(t),c=t.error.bind(t),H=(t,n,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:s,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(H("debug",t,e))},t.info=(t,e)=>{s(t,e),this.addLogEntry(H("info",t,e))},t.warn=(t,e)=>{a(t,e),this.addLogEntry(H("warn",t,e))},t.error=(t,e)=>{c(t,e),this.addLogEntry(H("error",t,e))},t.l=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,s)=>{e(t,n,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:s,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(xt);t&&t.remove(),this.panelElement=document.createElement(xt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),e=document.createElement("style");e.textContent=bt,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const 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 a=this.createResizeHandle();this.panelContainer.appendChild(a),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const s=document.createElement("div");s.className="title",s.textContent="Elements Debug Console";const a=document.createElement("div");a.className="subtitle",a.textContent="Live SDK logs, events & GTM tracking",n.appendChild(s),n.appendChild(a);const c=document.createElement("button");return c.className="minimize",c.innerHTML="−",c.title="Minimize debug panel",c.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(c),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];e.forEach(({key:e,label:n,description:s,color:a})=>{const c=document.createElement("label");c.className="toggle",c.title=s;const l=document.createElement("input");l.type="checkbox",l.checked="showLogs"!==e,l.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const d=document.createElement("span");d.textContent=n,d.style.color=a,c.appendChild(l),c.appendChild(d),t.appendChild(c)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,s=0,a=0,c=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,s=t.clientY,a=Number.parseInt(this.panelElement.style.width,10)||500,c=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",V),document.addEventListener("mouseup",D),t.preventDefault()});const V=t=>{if(!e||!this.panelElement)return;const l=t.clientX-n,d=t.clientY-s,p=window.innerWidth<=768,m=window.innerWidth<=480;let f,g,v,b;m?(f=280,g=window.innerWidth-20,v=200,b=.4*window.innerHeight):p?(f=300,g=window.innerWidth-30,v=200,b=.4*window.innerHeight):(f=300,g=800,v=200,b=600);const C=Math.max(f,Math.min(g,a+l)),S=Math.max(v,Math.min(b,c+d));this.panelElement.style.width=C+"px",this.panelElement.style.height=S+"px"},D=()=>{e=![],document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",D)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,s=0,a=0,c=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,s=e.clientY;const l=this.panelElement.getBoundingClientRect();a=l.left,c=l.top,document.addEventListener("mousemove",V),document.addEventListener("mouseup",D),e.preventDefault()});const V=e=>{if(!t||!this.panelElement)return;const l=e.clientX-n,d=e.clientY-s;this.panelElement.style.left=a+l+"px",this.panelElement.style.top=c+d+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},D=()=>{t=![],document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",D)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.h()){const e=this.u(t);if(e)return this.m(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.k(),browser:this.C(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,e){return(t+"_"+e).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,e="__localStorage_test_"+Date.now()+"__",n="test";t.setItem(e,n);const s=t.getItem(e);return s!==n?(this.isLocalStorageAvailable=![],![]):(t.removeItem(e),this.isLocalStorageAvailable=!![],!![])}catch(t){const n=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(n)try{const t=window.localStorage;return t&&t.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(e){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const e={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},n=e[t.name]||"Storage error: "+t.name,s=this._()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const e=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}v(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.D(e)}k(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,s=this.P(),a=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+s+"|"+a}catch(t){return"24|24|srgb|100"}}P(){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(ot){}return"srgb"}C(){var t;try{const e=navigator,n=[],s=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(s),n.push(e.hardwareConcurrency||4);const a=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(a),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.I()),n.push(this._()?"webview":"browser");const c=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(c.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}I(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}_(){try{const t=navigator.userAgent.toLowerCase(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}D(t){const e=16777619;let n=2166136261,s=2166136261,a=2166136261,c=2166136261;for(let l=0;l<t.length;l++){const d=t.charCodeAt(l);n^=d,n=Math.imul(n,e),s^=d<<1,s=Math.imul(s,e),a^=d<<2,a=Math.imul(a,e),c^=d<<3,c=Math.imul(c,e)}return n=Math.abs(n),s=Math.abs(s),a=Math.abs(a),c=Math.abs(c),n.toString(16)+s.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(),this.store=StoreService.getInstance();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const s=Date.now();try{const a={eventId:"event_"+s,timestamp:s,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now();return{batchId:"batch_"+e,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new SDKError("XHR request failed with status: "+e.status)}catch(e){throw new SDKError("Both sendBeacon and XHR failed: "+e.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(e){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.T=Object.freeze(t),this.F=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const s=this.T[n];return null==s?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(s)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(n=this.F)||void 0===n?void 0:n.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 e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),s=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(s)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;null===(e=this.beforeAutoDestroy)||void 0===e?void 0:e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.F.tagName,e),e instanceof Error&&this.captureComponentError(e,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),s="store:["+n+"]",a=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);a!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const a=performance.now()-n;this.logRenderInfo(a);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this.F.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(a){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.F.tagName,a),this.captureComponentError(a,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:a instanceof Error?a.message:String(a)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,a,"render")}catch(c){this.logger.error("❌ onError hook error in "+this.F.tagName,c)}}}logRenderInfo(t){const e=this.F.type,n=this.F.tagName,s=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.F.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.F.tagName+":"+e,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.F.useShadowDom}})}catch(s){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.T}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:a.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,s;const c=this.getStoreValue("address"),l=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],d=null!==(e=this.params.productId)&&void 0!==e?e:"",p=null!==(n=this.params.options)&&void 0!==n?n:{},m=null!==(s=p.showLabel)&&void 0!==s?s:!![],f=[];if(m){const t=document.createElement("span");t.textContent="Delivers to:",f.push(t)}const g=document.createElement("button");g.type="button",g.textContent=c.formattedAddress||"Select an address";const v=c.formattedAddress?"Change delivery address, currently set to "+c.formattedAddress:"Select delivery address";return g.setAttribute("aria-label",v),g.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}))}),f.push(g),f}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+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:t=24,height:e=24,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+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 '},ChevronUpIcon=({width:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+a+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" 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:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" 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 t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");e.value=n;const s=n.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const a=/^\d/.test(s);if(s.length<this.minSearchLength||!a)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(s)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(ot){this.logger.error("Address edit cancellation failed",ot)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const s=this.getConfigs("global"),a=null!==(t=this.params.options)&&void 0!==t?t:{},c=null!==(e=a.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),c){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const l=this.createElement("div",{className:"input-wrapper "+s.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),l.appendChild(this.inputElement);const d=this.createElement("span");d.className="input-icon",d.innerHTML=SearchIcon({width:16,height:16,className:""}),l.appendChild(d),this.inputContainer.appendChild(l),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const 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],f=this.createElement("div",{className:"action-buttons"}),g=this.createCancelButton();f.appendChild(g);const v=this.createCheckButton();return f.appendChild(v),m.push(f),document.addEventListener("click",this.handleDocumentClick),m}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:a.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:a.CART_BODY});t.push(n);const s=ComponentFactoryService.createElement({type:a.CART_FOOTER});return t.push(s),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=this.config.layout.drawerHeaderText,e=document.createElement("div");e.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your "+t.toLowerCase()+" is empty",e.appendChild(n),e}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:a.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const s=this.createRetailerElement(e);s.setAttribute("data-retailer-id",t),n.replaceWith(s)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,s]of Object.entries(t))s&&"object"==typeof s&&s.id&&(e[n]=s);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),s=this.getValidRetailerIds(e.oldValue),a=this.getValidRetailerIds(e.value),c=s.size,l=a.size,d=this.getValidRetailers(this.getStoreValue("cart.retailers")),p=Object.keys(d).length;if(l>0&&0===p)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===c&&l>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(c>0&&0===l)this.showEmptyCartState();else if(l>0){for(const t of s)a.has(t)||this.removeRetailerElement(t);for(const e of a){const a=n[e],c=t[e];s.has(e)?this.hasRetailerDataChanged(c,a)&&this.updateRetailerElement(e,a):this.addRetailerElement(e,a)}}else 0===c&&0===l&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const s of e){const t=this.createRetailerElement(s);t.setAttribute("data-retailer-id",s.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.subtotal")),s=t.some(t=>t.path.includes("cart.fulfillments")),a=t.some(t=>"cart.loading"===t.path),c=t.some(t=>t.path.includes("cart.retailers"));e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(s||n||a||e||c)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const s=this.getStoreValue("cart.fulfillments")||{},a=Object.values(s).some(t=>t.updating);if(a)return!![];const c=this.getStoreValue("cart.retailers")||{},l=Object.values(c).some(t=>t.updating);return l?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),s=t||n||!e;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.subtotal"),n=[],s=document.createElement("div");s.className="cart-footer-header";const c=document.createElement("div");c.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",c.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e),c.appendChild(this.subtotalPrice);const l=document.createElement("p");if(l.textContent="Taxes & fees will be calculated at checkout",l.className="taxes-fees-info",s.appendChild(c),s.appendChild(l),n.push(s),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:a.CART_PROMO_CODE});n.push(t)}const d=ComponentFactoryService.createElement({type:a.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(d),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"general"});n.push(t)}return n}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(t,e){const n=new Set(t||[]),s=new Set(e||[]);for(const a of n)if(!s.has(a)){const t=this.container.querySelector('[data-item-id="'+a+'"]');t&&t.remove()}for(const c of s)if(!n.has(c)){const t=ComponentFactoryService.createElement({type:a.CART_ITEM,itemId:c});t.setAttribute("data-item-id",c),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const s of n)s.remove();for(const s of e){const t=ComponentFactoryService.createElement({type:a.CART_ITEM,itemId:s});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t),n=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(n&&n.remove(),null==e?void 0:e.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:a.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.itemIds)||void 0===t?void 0:t.length)?n.itemIds.some(t=>this.getStoreValue("cart.items."+t+".updating")):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,s=t.find(t=>t.path===n),a=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(a.length>0&&this.checkAndUpdateLoadingState(),s){const t=s.oldValue,e=s.value,n=(null==t?void 0:t.itemIds)||[],a=(null==e?void 0:e.itemIds)||[],c=JSON.stringify(n)!==JSON.stringify(a);c&&(this.handleItemsUpdate(n,a),this.checkAndUpdateLoadingState());const l=(null==t?void 0:t.subtotal)!==(null==e?void 0:e.subtotal),d=this.hasFulfillmentDataChanged(t,e,["itemIds","updating"]);if(l&&!d&&this.setupMinimumPurchaseAlert(),!d)return![]}return![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const s=["type","canEngrave"];for(const a of s)if(!n.includes(a)&&t[a]!==e[a])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const wt={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"},kt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=wt[e];return n||kt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return kt}}function getCurrentTimeInTimezone(t){try{const e=new Date,n=e.getTime(),s=6e4*e.getTimezoneOffset(),a=new Date(n+s),c=new Date(a.toLocaleString("en-US",{timeZone:t})),l=a.getTime()-c.getTime();return new Date(n+l)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:s}=t;try{const t=getCurrentTimeInUserTimezone(s),a=!e||t>=new Date(e),c=!n||t<=new Date(n);return a&&c}catch(a){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const s=this.config.layout.drawerHeaderText,c=this.getConfigs("global"),l=document.createElement("div");l.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=s,l.appendChild(d);const p=document.createElement("button");p.type="button",p.className="cart-header-close-btn",p.innerHTML=CloseIcon({width:16,height:16}),p.setAttribute("aria-label","Close cart drawer"),p.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),l.appendChild(p);const m=this.clientConfig.get("promoTicker"),f=null!==(e=null===(t=null==c?void 0:c.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],g=null!=m?m:f,v=this.store.get("address"),b=hasActiveItems(g,null===(n=null==v?void 0:v.address)||void 0===n?void 0:n.state);if(!g.length||!b)return[l];const C=ComponentFactoryService.createElement({context:"cart",type:a.PROMO_CODE_TICKER,tickers:g});return[l,C]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){this.commands.ui.openDrawer(a.ENGRAVING_FORM,{identifier:t,context:"cart",lines:e.attributes.engraving.lines,maxLines:e.attributes.engraving.maxLines,maxCharsPerLine:e.attributes.engraving.maxCharsPerLine,fee:e.attributes.engraving.fee,location:e.attributes.engraving.location})}template(){var t,e;const n=this.params.itemId,s=this.getStoreValue("cart.items."+n),c=this.getConfigs("global"),l=this.getStoreValue("cart.fulfillments."+s.fulfillmentId),d=document.createElement("article");d.className="cart-item";const p=document.createElement("div");p.className="item-image";const m=document.createElement("img");m.src=s.mainImage,m.alt=s.name,p.appendChild(m);const f=document.createElement("div");f.className="item-details";const g=document.createElement("div");g.className="item-header";const v=document.createElement("h3");v.className="item-title",v.textContent=s.name;const b=document.createElement("button");b.className="item-delete",b.innerHTML=TrashIcon({}),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-label","Remove "+s.name+" from cart"),b.setAttribute("aria-expanded","true"),b.addEventListener("click",async()=>{await this.commands.cart.removeItem(n)}),b.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(n))}),g.appendChild(v),g.appendChild(b);const C=document.createElement("div");C.className="item-specs",C.textContent=s.size+", "+s.container;const S=document.createElement("div");S.className="item-shipping-container";const E=document.createElement("div");if(E.className="item-shipping",E.textContent=s.attributes.engraving.hasEngraving?l.engravingExpectation:l.expectation,S.appendChild(E),c.layout.enablePersonalization&&(null==s?void 0:s.attributes.engraving.isEngravable)&&(null==s?void 0:s.attributes.engraving.hasEngraving)===![]&&l.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=c.layout.personalizationText+" +"+formatCentToDollarText(s.attributes.engraving.fee,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+s.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(n,s)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(n,s))}),S.appendChild(t)}f.appendChild(g),f.appendChild(C),f.appendChild(S),d.appendChild(p),d.appendChild(f);const _=[d],P=ComponentFactoryService.createElement({type:a.CART_ITEM_QUANTITY_PRICE,itemId:n});if((null===(e=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:a.ENGRAVING_VIEW,identifier:n,context:"cart"});_.push(t)}return _.push(P),_}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),s=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var t,e;const n=this.getItemStore();if(!n)return 0;const s=n.partNumber,a=n.fulfillmentId,c=this.getStoreValue("cart.items")||{},l=Object.values(c).filter(t=>t.partNumber===s&&t.fulfillmentId===a),d=l.reduce((t,e)=>t+e.quantity,0),p=this.getStoreValue("products."+n.upc)||this.getStoreValue("products."+n.salsifyGrouping);if(!p)return n.maxQuantity-d;const m=(null===(e=null===(t=null==p?void 0:p.sizes)||void 0===t?void 0:t[n.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder)||0;return!m||m<=0?n.maxQuantity-d:m-d}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,s=Boolean(null==n?void 0:n.code),a=Boolean(null==t?void 0:t.code);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;if(a&&this.promoCodePill&&t.discount!==(null==n?void 0:n.discount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),a=this.getStoreValue("cart.events"),c=a.some(t=>t.type===d.PROMO_CODE);this.applyButton.disabled=!e||n||Boolean(null==s?void 0:s.discount)||this.isApplying||c}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const o=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",o),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:a.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const s=this.getFulfillmentContainer();s&&s.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),s=new Set(e||[]);for(const a of n)s.has(a)||this.removeFulfillmentElement(a);for(const a of s)n.has(a)||this.addFulfillmentElement(a)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const a of n)a.remove();let s=this.getFulfillmentContainer();if(!s){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",t&&e&&t.insertBefore(s,e)}for(const a of Object.keys(e))this.addFulfillmentElement(a)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:a.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,s=t.find(t=>t.path===n);if(s){const t=s.oldValue,e=s.value,n=Object.keys((null==t?void 0:t.fulfillments)||{}),a=Object.keys(e.fulfillments||{});JSON.stringify(n)!==JSON.stringify(a)&&this.handleFulfillmentsUpdate(n,a)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const T=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),T()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),T()}}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const s=document.createElement("div");s.className="cart-retailer-header";const a=document.createElement("div");a.className="retailer-info";const c=document.createElement("h2");c.className="section-title",c.textContent=e.name,a.appendChild(c);const l=document.createElement("input");l.type="checkbox",l.id=e.id,l.className="section-toggle",a.appendChild(l);const d=document.createElement("label");d.htmlFor=e.id,d.className="section-header-label",d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Collapse retailer section"),d.setAttribute("aria-expanded","true");const p=document.createElement("span");p.className="chevron",p.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),d.appendChild(p),a.appendChild(d),s.appendChild(a),n.appendChild(s);const m=document.createElement("div");m.className="retailer-body-container";const f=document.createElement("div");f.id="retailer-fulfillment-container",m.appendChild(f);const g=document.createElement("div");return g.id="retailer-subtotal-container",m.appendChild(g),n.appendChild(m),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let s=0;for(const a of n)s+=a.quantity;return s}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,s=this.getStoreValue("cart.items"),a=this.getRetailerItemCount(s,t),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(e+n),[l,d]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,e,n;const s=this.store.get("checkout.presale"),c=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),d=null!==(e=null===(t=null==c?void 0:c.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],p=null!=l?l:d,m=this.store.get("address"),f=hasActiveItems(p,null===(n=null==m?void 0:m.address)||void 0===n?void 0:n.state),g=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),v=document.createElement("div");v.classList.add("checkout-container"),g&&v.classList.add("no-header"),this.params.isIndependentComponent&&v.classList.add("independent");const b=ComponentFactoryService.createElement({type:a.CHECKOUT_INFORMATION});v.appendChild(b);const C=ComponentFactoryService.createElement({type:a.CHECKOUT_ORDER_SUMMARY});if(v.appendChild(C),!s&&(!p.length||!f)&&g)return[v];const S=document.createElement("div");if(S.classList.add("checkout-header-wrapper"),!g){const t=ComponentFactoryService.createElement({type:a.CHECKOUT_HEADER});S.appendChild(t)}if(p.length&&f&&!s){const t=ComponentFactoryService.createElement({context:"checkout",type:a.PROMO_CODE_TICKER,tickers:p});S.appendChild(t)}if(s){const t=ComponentFactoryService.createElement({type:a.CHECKOUT_PRESALE_COUNTDOWN});S.appendChild(t)}return[S,v]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const s=this.getStoreValue("checkout"),a=Boolean(s.promoCode),l=Boolean(null===(t=s.giftCards)||void 0===t?void 0:t.length),d=this.getConfigs("global"),p=Object.values(s.fulfillments||{}).some(t=>t.type===c.ON_DEMAND),m=[],f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Subtotal ("+s.itemsQuantity+" item"+(s.itemsQuantity>1?"s":"")+")",f.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(s.amounts.subtotal),f.appendChild(v),m.push(f);const b=document.createElement("div");b.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Shipping",b.appendChild(C);const S=document.createElement("span");S.textContent=formatCentToDollarText(s.amounts.shipping),b.appendChild(S),m.push(b);const E=document.createElement("div");E.classList.add("checkout-amount-line");const _=document.createElement("span");_.textContent="Delivery",E.appendChild(_);const P=document.createElement("span");if(P.textContent=formatCentToDollarText(s.amounts.delivery),E.appendChild(P),m.push(E),(null===(e=null==s?void 0:s.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(s.amounts.engraving),t.appendChild(n),m.push(t)}const I=document.createElement("div");I.classList.add("checkout-amount-line");const F=document.createElement("span");F.textContent="Taxes & Fees",I.appendChild(F);const O=document.createElement("span");if(O.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),I.appendChild(O),m.push(I),a){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=s.promoCode)||void 0===n?void 0:n.code.toUpperCase())+")",t.appendChild(e);const a=document.createElement("span");a.textContent="-"+formatCentToDollarText(s.amounts.discounts),t.appendChild(a),m.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(s.amounts.giftCards),t.appendChild(n),m.push(t)}if(p){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(s.amounts.tip),t.appendChild(n),m.push(t)}const z=document.createElement("div");z.classList.add("checkout-separator"),m.push(z);const R=document.createElement("div");R.classList.add("checkout-amount-total");const L=document.createElement("span");L.textContent="Total",R.appendChild(L);const M=document.createElement("span");if(M.textContent=formatCentToDollarText(s.amounts.total),R.appendChild(M),m.push(R),s.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),m.push(t);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const a=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));s.appendChild(a);const c=document.createElement("p");c.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(c),m.push(s)}return m}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const s=document.createElement("span");s.id="billingSameAsShipping",s.classList.add("checkout-checkbox-visual"),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Billing same as shipping checkbox"),s.setAttribute("aria-checked",t?"true":"false"),t&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const a=document.createElement("label");return a.textContent="Billing address same as shipping address",a.setAttribute("for","billingSameAsShipping"),a.classList.add("billing-checkbox-label"),n.appendChild(s),n.appendChild(a),e.appendChild(n),e}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),e={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t.billingSameAsShipping)return e;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Your billing info",l.classList.add("section-title"),c.appendChild(l);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),c.appendChild(d),e.push(c);const p=document.createElement("div");p.classList.add("section-form-container");const m=document.createElement("div");m.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","First name input"),m.appendChild(f);const g=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Last name input"),m.appendChild(g),p.appendChild(m);const v=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:yt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),p.appendChild(v);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:yt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});C.setAttribute("aria-label","Phone input"),b.appendChild(C);const S=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Company input"),b.appendChild(S),p.appendChild(b);const E=document.createElement("div");E.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","Street address input"),E.appendChild(_);const P=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","Apt, suite, etc. (optional) input"),E.appendChild(P),p.appendChild(E);const I=document.createElement("div");I.classList.add("checkout-three-col-container");const F=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});F.setAttribute("aria-label","City input"),I.appendChild(F);const O=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});O.setAttribute("aria-label","State input"),I.appendChild(O);const z=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:yt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(s.BILLING,{fieldName:yt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return z.setAttribute("aria-label","Zip Code input"),I.appendChild(z),p.appendChild(I),e.push(p),e}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path);e&&(e.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const e=[],n=document.createElement("div");n.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Buyer Information",c.classList.add("section-title"),n.appendChild(c);const l=document.createElement("p");l.textContent="Buyer information is used to process your order and for delivery purposes.",l.classList.add("section-subtitle"),n.appendChild(l),e.push(n);const d=document.createElement("div");d.classList.add("section-form-container");const p=document.createElement("div");p.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});p.appendChild(m);const f=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});p.appendChild(f),d.appendChild(p);const g=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});d.appendChild(g);const v=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});d.appendChild(v);const b=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});d.appendChild(b);const C=ComponentFactoryService.createElement({type:a.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return d.appendChild(C),e.push(d),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),e.push(this.saveButton),this.updateSaveButtonState(),e}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],e=this.getStoreValue("checkout.customerForm.data"),n=document.createElement("div");n.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent="Buyer: "+e.firstName+" "+e.lastName,n.appendChild(s);const a=document.createElement("span");if(a.textContent="Edit",a.setAttribute("aria-label","Edit Buyer Information"),a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),a.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),n.appendChild(a),t.push(n),e.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=e.company,t.push(n)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=e.email,t.push(c);const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=e.phone,t.push(l);const d=document.createElement("p");return d.classList.add("checkout-summary-form-line"),d.textContent=formatISODateToMMDDYYYY(e.birthDate),t.push(d),t}}const Ct=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],St={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(Ct.includes(n)){const t=document.createElement(n),s=St[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(s.includes(e)){const s=sanitizeAttributeValue(e,n.value);null!==s&&t.setAttribute(e,s)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const s=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&s.appendChild(e)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),s=n.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const a=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&a.appendChild(e)}const c=document.createElement("div");return c.appendChild(a),c.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,s,c,l;const d=[],p=this.getConfigs("configurations"),m=this.getConfigs("global"),f=this.getConfigs("checkout"),g=this.config.layout.exitUrl||window.location.host,v=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(e=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=null===(s=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===s?void 0:s.customLogo,e.alt=p.partnerName+" Logo",t.appendChild(e),d.push(t)}const b=document.createElement("div");b.classList.add("checkout-completed-section-container");const C=document.createElement("div");C.classList.add("checkout-completed-title-container");const S=document.createElement("div");S.classList.add("checkout-completed-title-section");const E=document.createElement("h3");E.innerHTML=(null===(l=null===(c=this.config.layout)||void 0===c?void 0:c.checkoutCompleted)||void 0===l?void 0:l.customText)||"Thank You for Your Order!",S.appendChild(E);const _=document.createElement("p");_.textContent="Your payment has been successfully processed.",S.appendChild(_),C.appendChild(S),b.appendChild(C);const P=document.createElement("div");P.classList.add("checkout-completed-sub-section");const I=document.createElement("div");I.classList.add("checkout-completed-line");const F=document.createElement("h3");F.textContent="Order Number",I.appendChild(F);const O=document.createElement("span");O.textContent=this.params.orderNumber,I.appendChild(O),P.appendChild(I);const z=document.createElement("div");z.classList.add("checkout-completed-line");const R=document.createElement("h3");R.textContent="Order Amount",z.appendChild(R);const L=document.createElement("span");L.textContent=""+formatCentToDollarText(this.params.orderTotal),z.appendChild(L),P.appendChild(z);const M=document.createElement("div");M.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",M.appendChild(B);const j=document.createElement("span");j.textContent="** "+this.params.cardLast4,M.appendChild(j),P.appendChild(M),b.appendChild(P);const q=document.createElement("div");q.classList.add("checkout-completed-sub-section");const U=document.createElement("p");U.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>.",q.appendChild(U),b.appendChild(q),d.push(b);const G=document.createElement("div");G.classList.add("checkout-completed-section-container");const K=document.createElement("button");K.type="button";const Y=document.createElement("span");Y.textContent=v,K.setAttribute("tabindex","0"),K.setAttribute("role","button"),K.setAttribute("aria-label",v),K.appendChild(Y);const W=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:m.theme.selectedTextColor}));K.appendChild(W),K.addEventListener("click",()=>{window.location.href=g}),K.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=g)}),G.appendChild(K),d.push(G);const Q=document.createElement("div");Q.classList.add("checkout-completed-section-container");const Z=document.createElement("div");Z.classList.add("checkout-completed-help-section"),Q.appendChild(Z);const X=document.createElement("p");X.textContent="Questions about your order? Contact us at ";const J=document.createElement("a");J.href="mailto:"+p.supportEmail,J.textContent=p.supportEmail,X.appendChild(J),Z.appendChild(X);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,Z.appendChild($),d.push(Q),f.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(f.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),d.push(t),d.push(e),d.push(n)}if(m.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"general"});d.push(t)}return d}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path),n=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==e?void 0:e.value)||(null==n?void 0:n.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let e;e=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=e}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift"),n=this.store.get("checkout.giftRecipientForm.data"),l=this.store.get("checkout.customerForm.data"),d=this.store.get("address.formattedAddress"),p=e?n:l,m=this.store.get("checkout.shippingAddressTwo"),f=this.store.get("checkout.deliveryInstructions");l.firstName&&(this.customerData.firstName={isValid:!![],value:l.firstName}),l.lastName&&(this.customerData.lastName={isValid:!![],value:l.lastName}),l.email&&(this.customerData.email={isValid:!![],value:l.email}),l.phone&&(this.customerData.phone={isValid:!![],value:l.phone}),l.company&&(this.customerData.company={isValid:!![],value:l.company}),l.birthDate&&(this.customerData.birthDate={isValid:!![],value:l.birthDate}),n.firstName&&(this.giftData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.giftData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.giftData.email={isValid:!![],value:n.email}),n.phone&&(this.giftData.phone={isValid:!![],value:n.phone}),n.message&&(this.giftData.message={isValid:!![],value:n.message}),m&&(this.customerData.addressTwo={isValid:!![],value:m},this.giftData.addressTwo={isValid:!![],value:m}),f&&(this.customerData.deliveryInstructions={isValid:!![],value:f},this.giftData.deliveryInstructions={isValid:!![],value:f});const g=this.store.get("checkout.fulfillments")||{},v=Object.values(g).some(t=>t.type===c.ON_DEMAND),b=[],C=document.createElement("div");C.classList.add("delivery-header-container");const S=document.createElement("div");S.classList.add("delivery-header-content");const E=document.createElement("div");E.classList.add("delivery-title-container");const _=document.createElement("h3");_.textContent="Deliver to",_.classList.add("delivery-title");const P=document.createElement("p");P.textContent="Package recipient must be 21+",P.classList.add("delivery-subtitle"),E.appendChild(_),E.appendChild(P),C.appendChild(E),b.push(C);const I=document.createElement("div");I.classList.add("section-form-container");const F=document.createElement("div");F.classList.add("checkout-two-col-container");const O=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:e?vt.firstName:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:p.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(s.GIFT,{fieldName:vt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});O.setAttribute("aria-label","First Name Input"),F.appendChild(O);const z=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:e?vt.lastName:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:p.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(s.GIFT,{fieldName:vt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(z.setAttribute("aria-label","Last Name Input"),F.appendChild(z),I.appendChild(F),!e){const t=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:p.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),I.appendChild(t)}const R=ComponentFactoryService.createElement({type:a.INPUT,inputType:"email",name:e?vt.email:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:p.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(s.GIFT,{fieldName:vt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});R.setAttribute("aria-label","Email Input"),I.appendChild(R);const L=ComponentFactoryService.createElement({type:a.INPUT,inputType:"tel",name:e?vt.phone:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:p.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(s.GIFT,{fieldName:vt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(L.setAttribute("aria-label","Phone Input"),I.appendChild(L),!e){const t=ComponentFactoryService.createElement({type:a.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:p.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),I.appendChild(t)}const M=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:d,disabled:!![],className:"disabled-input"});M.setAttribute("aria-label","Delivery Address Input"),I.appendChild(M);const B=ComponentFactoryService.createElement({type:a.INPUT,inputType:"text",name:e?vt.addressTwo:gt.addressTwo,label:"Apt, suite, etc. (optional)",value:m,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(s.GIFT,{fieldName:vt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(s.CUSTOMER,{fieldName:gt.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(B.setAttribute("aria-label","Address Line 2 Input"),I.appendChild(B),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const a=document.createElement("label");a.textContent="Gift Message*",a.setAttribute("for",vt.message);const c=document.createElement("textarea");c.name=vt.message,c.id=vt.message,c.rows=4,c.value=n.message||"",c.setAttribute("aria-label","Gift Message Textarea"),c.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(s.GIFT,{fieldName:vt.message}),this.updateSaveButtonState()});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"),e.appendChild(a),e.appendChild(c),e.appendChild(l),I.appendChild(e)}if(v){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Delivery Instructions",s.setAttribute("for","delivery_instructions");const a=document.createElement("textarea");a.id="delivery_instructions",a.name="delivery_instructions",a.rows=4,a.setAttribute("aria-label","Delivery Instructions Textarea"),a.value=f,a.addEventListener("input",async t=>{const n=t.target.value;e?(this.giftData.deliveryInstructions.value=n,this.giftData.deliveryInstructions.isValid=n.length>0):(this.customerData.deliveryInstructions.value=n,this.customerData.deliveryInstructions.isValid=n.length>0)});const 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"),n.appendChild(s),n.appendChild(a),n.appendChild(c),I.appendChild(n)}b.push(I),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const r=async()=>{e?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",r),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await r())}),b.push(this.saveButton),this.updateSaveButtonState(),b}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.data"),s=this.getStoreValue("checkout.giftRecipientForm.data"),a=this.getStoreValue("address"),c=this.getStoreValue("checkout.deliveryInstructions"),l=this.getStoreValue("checkout.shippingAddressTwo"),d=document.createElement("div");d.classList.add("checkout-summary-form-header");const p=document.createElement("h2");p.textContent=e?"Delivering to "+s.firstName+" "+s.lastName:"Delivering to "+n.firstName+" "+n.lastName,d.appendChild(p);const m=document.createElement("span");m.textContent="Edit",m.setAttribute("aria-label","Edit Delivery Information"),m.setAttribute("role","button"),m.setAttribute("tabindex","0");const H=async()=>{e?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(m.addEventListener("click",H),m.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await H())}),d.appendChild(m),t.push(d),!e&&n.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=n.company,t.push(e)}const f=document.createElement("p");f.classList.add("checkout-summary-form-line"),f.textContent=a.address.one+(l?", "+l:"")+", "+a.address.city+", "+a.address.state+", "+a.address.zip,t.push(f);const g=document.createElement("p");g.classList.add("checkout-summary-form-line"),g.textContent=e?s.email:n.email,t.push(g);const v=document.createElement("p");if(v.classList.add("checkout-summary-form-line"),v.textContent=e?s.phone:n.phone,t.push(v),!e&&n.birthDate){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(e)}if(e){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Gift Message:",e.appendChild(n);const a=document.createElement("span");a.classList.add("checkout-summary-form-line"),a.textContent=s.message||"No message provided.",e.appendChild(a),t.push(e)}if(c){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Delivery Instructions:",e.appendChild(n);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=c||"No instructions provided.",e.appendChild(s),t.push(e)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),s=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(s)||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:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const o=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",o),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(a.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const s=document.createElement("h1");s.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.setAttribute("aria-label","Checkout Page");const 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()}),n?[n,s,c]:[s,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.isEditing"),n=this.getStoreValue("checkout.giftRecipientForm.isEditing"),s=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=e?"block":"none",this.buyerSummary.style.display=e?"none":"block",this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block"):(this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=s?"block":"none",this.paymentSummary.style.display=s?"none":"block"}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm"),s=this.getStoreValue("checkout.giftRecipientForm"),c=this.getStoreValue("checkout.paymentForm"),l=ComponentFactoryService.createElement({type:a.CHECKOUT_SEND_AS_GIFT});return t.push(l),this.deliveryToForm=ComponentFactoryService.createElement({type:a.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=e?s.isEditing?"block":"none":n.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:a.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=e?s.isEditing?"none":"block":n.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:a.CHECKOUT_BUYER}),this.buyerForm.style.display=e&&n.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:a.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=e&&!n.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:a.CHECKOUT_PAYMENT}),this.paymentForm.style.display=c.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:a.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=c.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var e,n,s,a;const c=t.find(t=>"checkout.items"===t.path);c&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const l=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(l){const t=l.oldValue,c=l.value;if(c.updating)return![];const d=(null==t?void 0:t.quantity)!==(null==c?void 0:c.quantity),p=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],m=(null===(a=null===(s=null==c?void 0:c.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[],f=JSON.stringify(p)!==JSON.stringify(m);(d||f)&&this.updateEngravingElement(c)}return![]}updateEngravingElement(t){var e,n;const s=this.getConfigs("global"),c=this.container.querySelector(".engraving-view-container");if(c&&c.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&s.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:a.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const t=this.getStoreValue("cart.fulfillments."+e),s=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(s&&s.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:a.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","checkout-retailer-alert"),n.before(e)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const s=this.getConfigs("global"),c=this.getStoreValue("checkout.items."+this.params.itemId),l=null===(t=null==c?void 0:c.attributes)||void 0===t?void 0:t.presale,d=(null==l?void 0:l.isActive)&&(null==l?void 0:l.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(l.estimatedShipBy):"";if(!c)return[];const p=this.getStoreValue("checkout.fulfillments."+c.fulfillmentId),m=this.getStoreValue("checkout.retailers."+c.retailerId),f=document.createElement("div");f.classList.add("checkout-item-card-header");const g=document.createElement("div");g.classList.add("checkout-item-image");const v=document.createElement("img");v.src=c.mainImage,v.alt=c.name,v.loading="lazy",g.appendChild(v),f.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-item-details-container");const C=document.createElement("h4");C.classList.add("checkout-item-title"),C.textContent=c.name,b.appendChild(C);const S=document.createElement("div");S.classList.add("checkout-item-subtitle");const E=document.createElement("span");E.textContent=l.isActive?d+",":(c.attributes.engraving.hasEngraving?null==p?void 0:p.engravingExpectation:null==p?void 0:p.expectation)+",",S.appendChild(E);const _=document.createElement("span");_.textContent="From "+((null==m?void 0:m.name)||"Retailer"),S.appendChild(_),b.appendChild(S),f.appendChild(b),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(c.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),f.appendChild(this.trashButton);const P=ComponentFactoryService.createElement({type:a.CHECKOUT_ITEM_QUANTITY,itemId:c.cartItemId}),I=[];if(I.push(f),s.layout.enablePersonalization&&(null===(n=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:a.ENGRAVING_VIEW,identifier:c.cartItemId,context:"checkout"});I.push(t)}return I.push(P),I}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const s=this.getStoreValue("checkout.items."+this.params.itemId);if(!s)return 0;const a=this.getStoreValue("products");if(!a)return 0;const c=s.partNumber,l=s.fulfillmentId,d=null===(n=null===(e=null===(t=Object.values(a).find(t=>t.sizes[s.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[s.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder;if(!d)return 0;const p=this.getStoreValue("checkout.items")||{},m=Object.values(p).filter(t=>t.partNumber===c&&t.fulfillmentId===l),f=m.reduce((t,e)=>t+e.quantity,0);return d-f}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),s=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),a=e.quantity,c=this.getAvailableQuantity(),l=c>0,d=!(s&&1===a);return{currentQuantity:a,availableQuantity:c,isTheOnlyItem:s,canIncrease:l,canDecrease:d}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.calculateQuantityLimits(),n=document.createElement("div");n.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const s=document.createElement("span");if(s.classList.add("checkout-item-price-text"),s.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",s.appendChild(e)}return[n,s]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(t){return ComponentFactoryService.createElement({type:a.CHECKOUT_ITEM,itemId:t})}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of Object.values(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){if(!this.itemsList)return;const t=this.getCurrentItemsMap(),e=this.itemsList.querySelectorAll("[data-item-id]"),n=new Set;for(const s of e){const t=s.getAttribute("data-item-id");t&&n.add(t)}for(const s of e){const e=s.getAttribute("data-item-id");e&&!t.has(e)&&s.remove()}for(const[s]of t)if(!n.has(s)){const t=this.createItemElement(s);t.setAttribute("data-item-id",s),this.itemsList.appendChild(t)}if(this.togglerLabel){const t=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=t+" item"+(t>1?"s":"")}}onStoreChanged(t){let e=null;for(let n=0;n<t.length;n++){const s=t[n];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){e=s;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),t?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",t?"true":"false"),this.togglerButton.setAttribute("aria-label",t?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.itemsQuantity"),e=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=t+" item"+(t>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const n of Object.values(e)){const t=this.createItemElement(n.cartItemId);t.setAttribute("data-item-id",n.cartItemId),this.itemsList.appendChild(t)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let s;e.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const a=document.createElement("span");a.id="emailOptIn",a.classList.add("checkout-checkbox-visual"),s&&a.classList.add("checked"),a.innerHTML=CheckboxIcon({width:16,height:16}),a.setAttribute("role","checkbox"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Email opt-in checkbox"),a.setAttribute("aria-checked",s?"true":"false"),a.addEventListener("click",()=>this.handleEmailToggle(a)),a.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(a))});const c=document.createElement("label");c.setAttribute("for","emailOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(t.text),c.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),a.classList.toggle("checked"))}),e.appendChild(a),e.appendChild(c),n.appendChild(e)}if(e.show){const t=document.createElement("div");let s;t.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const a=document.createElement("span");a.classList.add("checkout-checkbox-visual"),a.id="smsOptIn",s&&a.classList.add("checked"),a.innerHTML=CheckboxIcon({width:16,height:16}),a.setAttribute("role","checkbox"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","SMS opt-in checkbox"),a.setAttribute("aria-checked",s?"true":"false"),a.addEventListener("click",()=>this.handleSmsToggle(a)),a.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(a))});const c=document.createElement("label");c.setAttribute("for","smsOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(e.text),c.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),a.classList.toggle("checked"))}),t.appendChild(a),t.appendChild(c),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).some(t=>t.type===c.ON_DEMAND)}template(){var t;const e=[],n=this.getConfigs("global"),s=this.getConfigs("checkout"),c=this.getConfigs("global"),l=s.layout.allowGiftCards,d=null===(t=null==c?void 0:c.layout)||void 0===t?void 0:t.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),e.push(p);const f=ComponentFactoryService.createElement({type:a.CHECKOUT_ITEMS});e.push(f);const g=document.createElement("div");g.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),e.push(g),l||d){const t=ComponentFactoryService.createElement({type:a.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:a.CHECKOUT_TIPS});e.push(t),e.push(v)}const b=document.createElement("div");b.classList.add("section-title-container");const C=document.createElement("h3");C.textContent="100% Secure Payments",C.classList.add("disclaimer-header"),b.appendChild(C);const S=document.createElement("p");S.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.",S.classList.add("disclaimer-description"),b.appendChild(S),e.push(b);const E=ComponentFactoryService.createElement({type:a.CHECKOUT_AMOUNTS});e.push(E);const _=ComponentFactoryService.createElement({type:a.CHECKOUT_PLACE_ORDER_BUTTON});e.push(_);const P=this.marketingOptInsContainer();if(P&&e.push(P),s.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(s.layout.legalMessage.text),e.push(t),e.push(n)}const I=document.createElement("div");if(I.classList.add("checkout-separator"),e.push(I),n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=e.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(e.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],e="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)e="Saving...",t=!![];else if(this.stripeFormStatus.hasError)e="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!e}else{const e=this.stripeFormStatus.isFormComplete,n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(e&&n)}this.saveButton.disabled=t,this.saveButton.textContent=e,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const s=document.createElement("p");if(s.textContent="All transactions are secure and encrypted.",s.classList.add("section-subtitle"),e.appendChild(s),t.push(e),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const e=document.createElement("p");e.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(e),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:a.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const c=ComponentFactoryService.createElement({type:a.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(c),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in edit mode",e),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in beta mode",n),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,e,n,s,a,c,l,d,p;const m=[],f=this.getStoreValue("checkout.paymentForm"),g=document.createElement("div");g.classList.add("checkout-summary-form-header");const v=document.createElement("h2");v.textContent="Paying with "+capitalizeFirstLetter(null!==(n=null===(e=null===(t=f.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(a=null===(s=f.paymentMethod)||void 0===s?void 0:s.card)||void 0===a?void 0:a.last4),g.appendChild(v);const b=document.createElement("span");b.textContent="Edit",b.setAttribute("aria-label","Edit Payment Information"),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),b.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),g.appendChild(b),m.push(g);const C=document.createElement("p");return C.classList.add("checkout-summary-form-line"),C.textContent="Exp. "+(null===(l=null===(c=f.paymentMethod)||void 0===c?void 0:c.card)||void 0===l?void 0:l.expMonth)+"/"+(null===(p=null===(d=f.paymentMethod)||void 0===d?void 0:d.card)||void 0===p?void 0:p.expYear),m.push(C),m}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const e=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);e&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],e=this.store.get("checkout.error")||null;this.updateErrorDisplay(e);const n=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!e});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:e}){const n=this.config.layout.placeOrderButtonText,s=this.store.get("checkout.presale");let a=![];if(!s){const t=this.getStoreValue("cart.fulfillments")||{};a=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const c=this.store.get("checkout.isGift"),l=this.store.get("checkout.customerForm.isValid"),d=this.store.get("checkout.giftRecipientForm.isValid"),p=this.store.get("checkout.paymentForm.isValid");return a||c&&!d||!l||!p?{state:"disabled",text:n,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:e?{state:"disabled",text:n,disabled:!![]}:{state:"ready",text:n,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const c=document.createElement("span");c.classList.add("error-text"),n.appendChild(s),n.appendChild(c),e.appendChild(n);const l=ComponentFactoryService.createElement({type:a.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,l,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presale"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value.expiresAt),!![];const s=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==s?void 0:s.value)||void 0===e?void 0:e.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,e=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&n>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&n<e&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var t,e;const n=[".drawer-content"];for(const a of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(a);if(e&&this.isScrollable(e))return e}let s=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.parentElement}return null}setScrolledState(t){var e,n;this.isCurrentlyScrolled=t,t?(null===(e=this.rootElement)||void 0===e?void 0:e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(n=this.rootElement)||void 0===n?void 0:n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);this.initialDurationSeconds=Math.min(n,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,s=this.initialDurationSeconds-n,a=Math.max(0,Math.min(100,s/this.initialDurationSeconds*100)),c=n<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;c!==this.isUnderOneMinute&&(this.isUnderOneMinute=c,this.updateWarningState()),this.updateTimerDisplay(e),this.updateProgressBar(a),0===e&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-timer]");e&&(e.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-progress-fill]");e&&(e.style.width=t+"%")}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),s=e%60,a=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=this.createTextContainer(),n=this.createProgressBar();return t.appendChild(e),t.appendChild(n),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const e=this.createHeader(),n=this.createSubtitle();return t.appendChild(e),t.appendChild(n),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const e=document.createElement("h2");e.textContent="LIMITED PRE-ORDER:";const n=document.createElement("div");return n.classList.add("checkout-presale-timer"),n.setAttribute("data-timer",""),n.textContent="00:00:00",t.appendChild(e),t.appendChild(n),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const e=document.createElement("div");return e.className="checkout-presale-progress-fill",e.setAttribute("data-progress-fill",""),e.style.width="0%",t.appendChild(e),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,e;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(e=this.params)||void 0===e?void 0:e.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const l=document.createElement("p");l.classList.add("presale-expired-title");const d=document.createElement("p"),p=document.createElement("div");p.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(l.textContent="Items No Longer Available",d.textContent="The presale items you were trying to purchase are no longer available.",p.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(l.textContent="Session Expired",d.textContent="Your reservation time has ended. The item has been released for other customers.",p.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."),c.appendChild(l),c.appendChild(d),s.appendChild(c),n.appendChild(s),n.appendChild(p),t.push(n);const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const f=document.createElement("button");f.setAttribute("aria-label","Continue shopping"),f.type="button";const g=document.createElement("span");g.textContent="Continue Shopping",f.setAttribute("tabindex","0"),f.setAttribute("role","button"),f.setAttribute("aria-label","Continue Shopping"),f.appendChild(g);const v=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:e.theme.selectedTextColor}));if(f.appendChild(v),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),m.appendChild(f),t.push(m),this.isTimeExpired()){const e=document.createElement("div");e.classList.add("checkout-completed-section-container");const n=document.createElement("p");n.classList.add("checkout-completed-auto-close-text"),n.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const s=document.createElement("span");s.classList.add("checkout-completed-auto-close-text"),s.textContent="seconds",e.appendChild(n),e.appendChild(this.autoCloseElement),e.appendChild(s),t.push(e)}if(e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:a.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,s=Boolean(n),a=Boolean(t);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;a&&this.promoCodeText&&t.discount!==(null==n?void 0:n.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),a=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(s)||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:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const o=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",o),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),e=document.createElement("div");e.classList.add("gift-label-wrapper");const n=document.createElement("span");n.textContent="Send as Gift? (Free)",n.classList.add("gift-toggle-label"),e.appendChild(n);const s=document.createElement("span");s.textContent="With personalized note & gift receipt.",s.classList.add("gift-toggle-description"),e.appendChild(s);const a=document.createElement("div");a.classList.add("toggle-switch"),a.classList.toggle("active",t);const c=document.createElement("div");return c.classList.add("toggle-slider"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Toggle Gift Option"),a.setAttribute("role","switch"),a.setAttribute("aria-checked",t?"true":"false"),a.appendChild(c),a.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),a.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[e,a]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.R=null,this.L=null,this.M=![],this.N=![],this.B=![],this.j=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.R=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.L=this.R.create("payment",t.elementOptions),this.L.mount(this),this.L.on("change",async t=>{const e=!!t.error,n=t.complete,s=e?t.error.message:null;this.N=n,this.M||await this.updateStripeFormStatus({isFormComplete:n,isProcessing:![],hasCompletedPayment:![],errorMessage:s,hasError:e})}),this.L.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){var t,e;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.N)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:n},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(n){console.error("Payment submission error:",n),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"Payment processing failed. Please try again."}),((null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.includes("expired"))||(null===(e=null==n?void 0:n.message)||void 0===e?void 0:e.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.j||(this.j=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",w),this.j=null,e(new Error("Session refresh timeout"))},1e4),w=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",w),this.j=null,t()};this.addEventListener("lce:s:refreshSession",w,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.j}async refreshPaymentSession(){try{this.R&&this.R.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ot){console.error("Failed to refresh payment session:",ot),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.L&&this.L.clear(),this.N=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ot){console.error("Failed to reset form:",ot)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.R)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.R.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.R,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:s}=await this.O.createConfirmationToken(e);if(n)throw new SDKError(n.message||"Failed to create confirmation token");if(!s||!s.id)throw new SDKError("Invalid confirmation token received");return s.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.j=null,this.L&&(this.L.unmount(),this.L=null),this.R&&(null===(e=(t=this.R).destroy)||void 0===e?void 0:e.call(t),this.R=null),this.O=null,this.M=![],this.N=![],this.B=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.querySelector('script[src*="stripe.com"]');if(n)return n.addEventListener("load",()=>t()),n.addEventListener("error",()=>e(new Error("Failed to load Stripe.js"))),void 0;const s=document.createElement("script");s.src="https://js.stripe.com/basil/stripe.js",s.async=!![],s.onload=()=>t(),s.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(s)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(e.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(e.value)}}handleSavedCardChange(t){var e,n,s,a;(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.brand)&&(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(a=(s=this.callbacks).onSavedCardInfoChanged)||void 0===a||a.call(s,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,e,n,s,a,c;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(e=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===e||e.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(s=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(n,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(c=(a=this.callbacks).onEditModeVisibilityChanged)||void 0===c||c.call(a,![]))}async afterRender(){var t,e,n,s;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const a=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(e=null==a?void 0:a.card)||void 0===e?void 0:e.brand)&&a.card.last4&&(this.savedCardInfo={brand:a.card.brand,last4:a.card.last4}),null===(s=(n=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(n,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var e,n;this.stripeFormStatus=t.detail.status,null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var e,n,s,a,c;try{const{confirmationTokenId:s,setupIntentId:a}=t.detail;await(null===(n=(e=this.callbacks).onPaymentSessionConfirmed)||void 0===n?void 0:n.call(e,s,a)),this.isChangingPayment=![]}catch(l){this.logger.error("Failed to save payment form",l),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==l?void 0:l.message)||"Failed to save payment information. Please try again."},null===(a=(s=this.callbacks).onStripeFormStatusChanged)||void 0===a||a.call(s,this.stripeFormStatus),null===(c=this.stripeFormElement)||void 0===c||c.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}}))}catch(e){this.logger.error("Failed to refresh payment session",e)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const e=document.createElement("button");e.type="button",e.classList.add("change-payment-link"),e.textContent="Change",e.setAttribute("aria-label","Change Payment Method"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>this.handleChangePayment()),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,e),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,e;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(e=(t=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const e=document.createElement("slot");return e.setAttribute("name",ft),this.stripeFormContainer.appendChild(e),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),s=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(a.LCE_ELEMENT),c=t.hasAttribute("drawer"),l=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(a.DRAWER),d="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||s&&c&&l&&d)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.paymentForm.paymentSession"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"dark"===n.layout.poweredByMode?"night":"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,e,n;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const s=this.findRootComponent();if(!s)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const c=s.querySelectorAll('[slot="'+ft+'"]');if(c.length>0)for(const a of c)a.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:a.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",ft),s.appendChild(this.stripeFormElement)}catch(l){this.logger.error("Stripe form element creation failed",l),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===c.ON_DEMAND)}getRetailerNameForFulfillment(t){const e=this.getStoreValue("checkout.items")||{},n=this.getStoreValue("checkout.retailers")||{},s=Object.values(e).find(e=>e.fulfillmentId===t);if(!s)return"Retailer";const a=n[s.retailerId];return(null==a?void 0:a.name)||"Retailer"}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const s=this.getOnDemandFulfillments();if(!s.find(e=>e.id===t))return;const a=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,a)}catch(c){this.logger.error("Checkout fulfillment tip update failed",c)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillments();if(n.find(e=>e.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const a of e){const e=document.createElement("button");e.type="button",e.textContent=a+"%",e.classList.add("checkout-tip-button"),e.disabled=n,s===a&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(a)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getOnDemandFulfillments();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),n.appendChild(s);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"}),n.appendChild(a),t.appendChild(n);const c=document.createElement("div");c.classList.add("retailers-tips-list","show");for(const l of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=this.getRetailerNameForFulfillment(l.id),e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const s=document.createElement("div");s.classList.add("dollar-input-container");const a=document.createElement("span");a.classList.add("dollar-sign"),a.textContent="$";const d=document.createElement("input");let p;d.type="number",d.id="tip-input-"+l.id,d.name="tip-"+l.id,d.min="0",d.step="0.01",d.placeholder="0.00",d.classList.add("dollar-input"),d.value=l.amounts.tip>0?(l.amounts.tip/100).toFixed(2):"",d.disabled=this.getStoreValue("checkout.updating")||![],d.addEventListener("wheel",t=>{t.preventDefault()}),d.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),d.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),d.addEventListener("paste",t=>{t.preventDefault()}),d.addEventListener("contextmenu",t=>{t.preventDefault()}),d.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),d.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;p&&clearTimeout(p),p=setTimeout(()=>{this.handleFulfillmentTipInput(l.id,n)},500)}),s.appendChild(a),s.appendChild(d),n.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(l.id)),n.appendChild(m),t.appendChild(n),c.appendChild(t)}return t.appendChild(c),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getOnDemandFulfillments();if(t&&e.length>0){const s=e.every(t=>t.amounts.tip>0);if(s)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(s){this.logger.error("Default tip initialization failed during fallback",s),this.isInitialized=![]}}template(){const t=[],e=this.getOnDemandFulfillments();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",n.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-tip-config-container");const c=this.createTipSelectionButtons();a.appendChild(c),n.appendChild(a);const l=document.createElement("p");l.classList.add("checkout-tip-disclaimer"),l.textContent="Tips will be split proportionally between retailers.",n.appendChild(l);const d=this.createTipDistribution();return t.push(n,d),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const s=t.find(t=>"checkout.giftCardError"===t.path),a=t.find(t=>"checkout.promoCodeError"===t.path),c=t.find(t=>"checkout.giftCards"===t.path);if(c&&this.updateAppliedGiftCards(c.value),s){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),s.value){const e=this.createErrorElement(s.value);t.after(e)}const a=t.querySelector(".apply-button");a&&(a.disabled=Boolean(s.value))}}if(a){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),a.value){const e=this.createErrorElement(a.value);t.after(e)}const s=t.querySelector(".apply-button");s&&(s.disabled=Boolean(a.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.applied)+")",e.appendChild(n);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(s),e}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),s=e.layout.allowGiftCards,c=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=ComponentFactoryService.createElement({type:a.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),p=ComponentFactoryService.createElement({type:a.CHECKOUT_GIFT_CARDS});c&&l.appendChild(d);const m=this.getStoreValue("checkout.promoCodeError");if(m){const t=this.createErrorElement(m);t.classList.add("promo-code-error-wrapper"),l.appendChild(t)}s&&l.appendChild(p);const f=this.getStoreValue("checkout.giftCardError");if(f){const t=this.createErrorElement(f);l.appendChild(t)}return l}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=t.toString(),e.appendChild(n),e.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:s}){var a,l,d,p,m,f,g,v;const b=e===c.ON_DEMAND;let C=null;b&&t.hourStatus.openTime&&(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime)&&(C=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(l=t.hourStatus)||void 0===l?void 0:l.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const S=b&&t.hourStatus.isClosed?"closed":"",E=document.createElement("div");E.className="popup-retailer-card "+(n?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",t.id),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",n?"true":"false");const _=e===c.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",_+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.variant.price)&&void 0!==p?p:0));const P=document.createElement("div");P.className="row";const I=document.createElement("span");I.className="name",I.textContent=t.retailerName,P.appendChild(I);const F=document.createElement("span");F.className="price",F.textContent=formatCentToDollarText(null!==(m=t.variant.price)&&void 0!==m?m:0),P.appendChild(F),E.appendChild(P);const O=document.createElement("div");O.className="row";const z=document.createElement("span");z.className="expectation",z.textContent=t.hourStatus.isClosed?C:(null===(f=null==s?void 0:s.presale)||void 0===f?void 0:f.isActive)?(null===(g=null==s?void 0:s.presale)||void 0===g?void 0:g.isActive)&&(null===(v=null==s?void 0:s.presale)||void 0===v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==s?void 0:s.presale.estimatedShipBy):"":null==t?void 0:t.expectation,O.appendChild(z);const R=document.createElement("span");if(R.className="fee",R.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",O.appendChild(R),E.appendChild(O),b){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=t.retailerAddressFormatted,e.appendChild(n),E.appendChild(e)}return E}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:s,onTabClick:a,enableShippingFulfillment:l,enableOnDemandFulfillment:d}){const p=e.length>0,m=document.createElement("div");if(m.className="fulfillment-tabs-container",m.setAttribute("role","tablist"),m.setAttribute("aria-label","Delivery method options"),l){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",c.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",a),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(n?"selected":""),s.textContent="Shipping ("+t.length+")",e.appendChild(s),m.appendChild(e)}if(d){const t=document.createElement("div");t.className="fulfillment-tab "+(s?"selected":"")+" "+(p?"":"disabled"),t.setAttribute("data-fulfillment-type",c.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",s?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),p||t.setAttribute("aria-disabled","true"),t.addEventListener("click",a),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(s?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),m.appendChild(t)}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","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const s=n.selectedFulfillment.variant.partNumber,a=n.selectedFulfillment.id,c=null===(t=n.sizes[n.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!c)return 0;const l=this.getStoreValue("cart.items")||{},d=Object.values(l).filter(t=>t.partNumber===s&&t.fulfillmentId===a),p=d.reduce((t,e)=>t+e.quantity,0);return c-p}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);return e.selectedFulfillment?e.selectedFulfillmentType===c.ON_DEMAND&&e.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const s=this.getProductId(),a=this.getStoreValue("products."+s);if(!a.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:s,selectedSizeId:a.selectedSizeId}),void 0;const c=this.getSizeAttributes(),l=(null===(t=null==c?void 0:c.presale)||void 0===t?void 0:t.isActive)===!![],d=this.isPresaleActive(c);l&&d?await this.commands.product.addPresaleToCart(s,{fulfillmentId:a.selectedFulfillment.id,partNumber:null===(e=a.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:a.quantity,identifier:s}):await this.commands.product.addToCart(s,{fulfillmentId:a.selectedFulfillment.id,partNumber:null===(n=a.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:a.quantity,identifier:s})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,s=n.variant.price*e.quantity;return{quantity:e.quantity,totalPrice:s}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),s=this.calculateQuantityLimits(),a=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],c=this.isPresaleActive(n),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(e):l;const d=a&&!c||0===s.availableQuantity||this.isFulfillmentClosed(),p=this.isButtonLoading(),m=this.config.layout.addToCartButtonShowTotalPrice?l+" for "+formatCentToDollarText(e):l;return this.addToCartButton.setAttribute("aria-label",m),this.addToCartButton.setAttribute("aria-busy",p.toString()),this.addToCartButton.setAttribute("aria-disabled",d.toString()),d&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),p&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const s=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);s.push(t)}const a=this.createAddToCartButton();return s.push(a),s}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),s="About this product:",a="See More",c="See Less",l=document.createElement("h3");l.className="title",l.textContent=s;const d=document.createElement("div");d.className="content collapsed",d.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const p=document.createElement("span");p.className="collapse-button",p.textContent=a,p.setAttribute("role","button"),p.setAttribute("tabindex","0"),p.setAttribute("aria-label","Show more product information"),p.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,d.classList.toggle("collapsed"),p.textContent=this.isCollapsed?a:c,p.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),p.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return p.addEventListener("click",toggleContent),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[l,d,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(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const s=n.value,a=s.isOpen,c=null===(e=s.contentConfig)||void 0===e?void 0:e.type,l=c!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=c,this.openWithContent(s),![]):a&&this.isOpen&&!l?![]:a&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(s),![]):!a&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:s}=t||{},a=ComponentFactoryService.createElement({type:n,...s});this.contentContainer&&this.contentContainer.appendChild(a),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay,e=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",t,e]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var e;const n=this.params.productId,s=t.find(t=>t.path==="products."+n+".selectedSizeId");if(null==s?void 0:s.value){const t=this.getStoreValue("products."+n),a=null===(e=null==t?void 0:t.sizes)||void 0===e?void 0:e[s.value],c=null==a?void 0:a.image;if(c){const t=this.params.images.indexOf(c);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+c+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let a=0;a<s.length;a++){const e=s[a];e.classList.toggle("active",a===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,s=e.offsetLeft+e.offsetWidth/2,a=n/2,c=a-s,l=0,d=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(d,Math.min(l,c)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,s=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,s=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,a=t.changedTouches[0].clientY-s;Math.abs(e)>Math.abs(a)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+n,a=0,c=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(c,Math.min(a,s)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=this.config.layout.showOnlyMainImage,s=document.createElement("div");if(s.className="main-image",s.title="Product main image",s.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e&&!n){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}s.appendChild(t)}if(this.mainImageElement=s,t.push(s),!n){const e=document.createElement("div");e.className="gallery-viewport";const n=document.createElement("div");n.className="gallery-container";for(let t=0;t<this.params.images.length;t++){const e=this.params.images[t],s=document.createElement("div");s.className="gallery-image-wrapper "+(0===t?"selected":"");const a=document.createElement("img");a.src=e,a.className="gallery-image",a.alt="Product thumbnail "+(t+1),a.loading="lazy",s.appendChild(a),n.appendChild(s)}e.appendChild(n),t.push(e)}return t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e;const n=this.getProductId();if(!t.some(t=>t.path==="products."+n+".selectedFulfillmentType"))return;const s=this.getStoreValue("products."+n),a=this.getConfigs("global");this.addPersonalizationSpan&&(s.selectedFulfillmentType===c.SHIPPING&&a.layout.enablePersonalization&&s.productHasAvailability&&(null===(e=null==s?void 0:s.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const s=n.textContent||"",a=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+s),n.setAttribute("aria-pressed",a?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var s;const a=n.dataset.sizeId;if(!a)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,a);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const c=this.getStoreValue("products."+t),l=this.getConfigs("global");this.addPersonalizationSpan&&(l.layout.enablePersonalization&&c.productHasAvailability&&(null===(s=c.selectedFulfillment)||void 0===s?void 0:s.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",n.appendChild(s);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(e)){const e=document.createElement("span");e.setAttribute("data-size-id",c.id),e.setAttribute("select-size",""),e.className="size-button "+(c.id===t?"selected":"");const n=c.packDesc?" ("+c.packDesc+")":"";e.textContent=""+c.size+n,a.appendChild(e)}return n.appendChild(a),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e;const n=this.getProductId(),s=this.getStoreValue("products."+n),c=s.sizes[s.selectedSizeId],l=this.getConfigs("global"),d=[],p=document.createElement("div");p.className="price-personalization-container";const m=ComponentFactoryService.createElement({type:a.PRODUCT_PRICE,productId:n});if(p.appendChild(m),l.layout.enablePersonalization&&s.productHasAvailability&&(null===(t=null==s?void 0:s.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=l.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",l.layout.personalizationText);const addPersonalization=async()=>{var t,e,c,l,d,p,m,f;const g=s.sizes[s.selectedSizeId];await this.commands.product.openProductDrawer(n,a.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=g.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(l=null===(c=g.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,fee:(null===(p=null===(d=g.attributes)||void 0===d?void 0:d.engraving)||void 0===p?void 0:p.fee)||0,location:null===(f=null===(m=g.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),p.appendChild(this.addPersonalizationSpan)}d.push(p);const f=this.renderProductSizes(s.selectedSizeId,s.sizes);if(d.push(f),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:a.ADDRESS_DISPLAY,productId:n});d.push(t)}const g=ComponentFactoryService.createElement({type:a.PRODUCT_RETAILERS,productId:n});d.push(g);const v=ComponentFactoryService.createElement({type:a.PRODUCT_ADD_TO_CART_SECTION,productId:n});d.push(v);const b=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.presale;if((null==b?void 0:b.isActive)===!![]&&(null==b?void 0:b.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==b?void 0:b.language)||""),d.push(t)}if(this.config.layout.showDescription&&(s.description.trim().length>0||s.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:a.PRODUCT_DESCRIPTION,productId:n});d.push(t)}return d}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:s,fulfillmentDisplay:a,showImages:c,showOnlyMainImage:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const p=document.createElement("div");if(p.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),p.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),p.appendChild(t),p}const m=document.createElement("div");m.classList.add("wave","sc-price"),p.appendChild(m);const f=document.createElement("div");f.classList.add("sc-sizes");const g=document.createElement("div");g.classList.add("wave","sc-size-button"),f.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),f.appendChild(v);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),f.appendChild(b);const C=document.createElement("div");C.classList.add("wave","sc-size-button"),f.appendChild(C);const S=document.createElement("div");S.classList.add("wave","sc-size-button"),f.appendChild(S),p.appendChild(f);const E=document.createElement("div");E.classList.add("sc-row");const _=document.createElement("div");_.classList.add("wave","sc-price"),E.appendChild(_);const P=document.createElement("div");P.classList.add("wave","sc-personalization"),E.appendChild(P),p.appendChild(E);const I=document.createElement("div");I.classList.add("wave","sc-deliver-to"),p.appendChild(I);const F=document.createElement("div");F.classList.add("wave","sc-address"),p.appendChild(F);const O=document.createElement("div");O.classList.add("wave","sc-retailers",a),p.appendChild(O);const z=document.createElement("div");if(z.classList.add("sc-row"),s){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),z.appendChild(t)}const R=document.createElement("div");if(R.classList.add("wave","sc-add-to-cart"),z.appendChild(R),p.appendChild(z),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),p.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),p.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),p.appendChild(n);const s=document.createElement("div");s.classList.add("wave","sc-description-line"),p.appendChild(s);const a=document.createElement("div");a.classList.add("wave","sc-description-more"),p.appendChild(a)}const L=document.createElement("div");if(L.classList.add("product-content"),L.appendChild(p),d.appendChild(L),c){d.classList.add("has-images");const t=this.createImageSkeletons(l);d.prepend(t)}return d}createImageSkeletons(t){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");if(n.classList.add("wave","sc-main-image"),n.title="Product main image loading",!t){const t=document.createElement("div");t.classList.add("carousel-dots");for(let e=0;e<3;e++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),t.appendChild(e)}n.appendChild(t)}if(e.appendChild(n),!t){const t=document.createElement("div");t.classList.add("gallery-viewport");const n=document.createElement("div");n.classList.add("gallery-container");for(let e=0;e<4;e++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),n.appendChild(t)}t.appendChild(n),e.appendChild(t)}return e}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:a.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(a.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,a.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t);let n=e.noAvailabilityPrice;return e.selectedFulfillment&&(n=e.selectedFulfillment.variant.price),formatCentToDollarText(n)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),s=[],c=this.getConfigs("configurations");if(!e.productHasAvailability||!c.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),s.push(t),s}const l="carousel"===n.layout.fulfillmentDisplay?a.PRODUCT_RETAILERS_CAROUSEL:a.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:l,productId:t});return s.push(d),s}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,s=e.offsetLeft+e.offsetWidth/2,a=n/2,c=a-s,l=0,d=-(this.listContainer.scrollWidth-n);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(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+n,a=0,c=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(c,Math.min(a,s)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+e+".selectedFulfillment");if(s&&s.id===n)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:s}){var a,l,d,p,m,f,g,v;const b=e===c.ON_DEMAND;let C=null;b&&t.hourStatus.openTime&&(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime)&&(C=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(l=t.hourStatus)||void 0===l?void 0:l.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const S=b&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",E=document.createElement("div");E.className="carousel-retailer-card "+(n?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",t.id),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",n?"true":"false");const _=e===c.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",_+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.variant.price)&&void 0!==p?p:0));const P=document.createElement("div");P.className="retailer-header";const I=document.createElement("h3");if(I.className="name",I.textContent=t.retailerName,P.appendChild(I),b){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,P.appendChild(e)}const F=document.createElement("div");F.className="retailer-body";const O=document.createElement("span");O.className="product-price",O.textContent=formatCentToDollarText(null!==(m=t.variant.price)&&void 0!==m?m:0);const z=document.createElement("span");z.className="shipping-price",z.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const R=document.createElement("span");return R.className="expectation",R.textContent=t.hourStatus.isClosed?C:(null===(f=null==s?void 0:s.presale)||void 0===f?void 0:f.isActive)?(null===(g=null==s?void 0:s.presale)||void 0===g?void 0:g.isActive)&&(null===(v=null==s?void 0:s.presale)||void 0===v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==s?void 0:s.presale.estimatedShipBy):"":null==t?void 0:t.expectation,F.append(O,z,R),E.append(P,F),E}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),s=(null==n?void 0:n.attributes)||null,a=[];for(const c in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,c)&&a.push(n.shippingFulfillments[c]);const l=[];for(const c in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,c)&&l.push(n.onDemandFulfillments[c]);const d=e.selectedFulfillmentType===c.SHIPPING,p=e.selectedFulfillmentType===c.ON_DEMAND,m=d?a:l,f=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===m.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const g of m){const t=this.generateRetailerCard({fulfillment:g,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:g.id===e.selectedFulfillmentId,selectedSizeAttributes:s}),n=e.selectedFulfillmentType===c.ON_DEMAND&&g.hourStatus.isClosed;n?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[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 t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),s=(null==n?void 0:n.attributes)||null,l=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,p=Object.values(n.shippingFulfillments),m=Object.values(n.onDemandFulfillments),f=(l?p.length:0)+(d?m.length:0),g=document.createElement("div");g.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=e.selectedFulfillmentType===c.SHIPPING?"Shipping From:":"Delivering From:";const b=document.createElement("button");if(b.className="delivery-options",b.type="button",b.textContent="See Delivery Options ("+f+")",b.setAttribute("aria-label","View all "+f+" delivery options"),b.addEventListener("click",async()=>{0!==f&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(a.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,a.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),g.appendChild(v),g.appendChild(b),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[g,t]}const C=document.createElement("div");C.className="popup-fulfillment-list-container";const S=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:s});return C.appendChild(S),[g,C]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const T=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+e+".selectedFulfillment");if(s&&s.id===n)return await T(),void 0;await this.commands.product.selectFulfillment(e,n),await T()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),s=(null==n?void 0:n.attributes)||null,a=[];for(const c in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,c)&&a.push(n.shippingFulfillments[c]);const l=[];for(const c in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,c)&&l.push(n.onDemandFulfillments[c]);const d=e.selectedFulfillmentType===c.SHIPPING,p=e.selectedFulfillmentType===c.ON_DEMAND,m=d?a:l,f=document.createElement("h5");f.className="popup-retailers-section-title",f.textContent="Delivery Options";const g=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===m.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,g,t]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const c of m){const t=renderPopupRetailerCard({fulfillment:c,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:c.id===e.selectedFulfillmentId,selectedSizeAttributes:s});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),v.appendChild(t)}return[f,g,v]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),s=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n)return ComponentFactoryService.createElement({type:a.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:a.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:a.PRODUCT_LOADING});const s=n.sizes[n.selectedSizeId],c=document.createElement("div");c.classList.add("product-content-wrapper"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+n.name);const l=document.createElement("div");if(l.classList.add("product-content"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,l.appendChild(t)}const d=ComponentFactoryService.createElement({type:a.PRODUCT_OPTIONS,productId:e});l.appendChild(d);const p=ComponentFactoryService.createElement({type:a.PRODUCT_DRAWER,productId:e});if(l.appendChild(p),c.appendChild(l),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return c;c.classList.add("has-images");const m=ComponentFactoryService.createElement({type:a.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:s.image,productId:e});return c.prepend(m),m.setAttribute("aria-label","Product images"),c}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t;const e=this.params.product,n=this.getStoreValue("address.address"),s={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==n?void 0:n.state)||"",isPresale:![],isPresaleActive:![]},a=e.sizes[0];if(!a)return s;const c=Object.values(a.shippingVariants)[0];if(!c)return s;s.upc=a.upc;const l=a.attributes||{};return s.isPresale=(null===(t=l.presale)||void 0===t?void 0:t.isActive)===!![],s.isPresaleActive=this.isPresaleActive(l),this.params.shippingFulfillment&&c.shippingFulfillmentId===this.params.shippingFulfillment.id&&c.stock>0?(s.hasAvailability=!![],s.fulfillmentId=this.params.shippingFulfillment.id,s.partNumber=c.partNumber):this.params.onDemandFulfillment&&c.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&c.stock>0&&(s.hasAvailability=!![],s.fulfillmentId=this.params.onDemandFulfillment.id,s.partNumber=c.partNumber),s}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const e=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e}):await this.commands.productList.addToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e})}template(){var t,e,n;const s=this.params.product,a=s.sizes[0],c=a?a.image:s.images[0],l=s.name,d=a?a.size:null,p=null!==(n=null===(e=null===(t=null==a?void 0:a.shippingVariants)||void 0===t?void 0:t[0])||void 0===e?void 0:e.price)&&void 0!==n?n:s.noAvailabilityPrice,m=this.getAvailabilityData();return this.createVariantStandard({image:c,name:l,size:d,price:p,availability:m})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const e=this.params.product,n=null===(t=e.sizes)||void 0===t?void 0:t[0],s=this.params.productUrl;if(s.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?s.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(s.includes("{grouping}")){const t=e.salsifyGrouping||"";return t?s.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:e,name:n,size:s,price:a,availability:c}=t,l=[],d=this.generateProductUrl(),p=document.createElement("div");p.className="plc__image-content";const m=document.createElement("div");m.className="plc__image-wrapper";const f=document.createElement("img");if(f.className="plc__image",f.src=e,f.alt=n,f.loading="lazy",m.appendChild(f),p.appendChild(m),d){const t=document.createElement("a");t.href=d,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(p),l.push(t)}else l.push(p);const g=document.createElement("div");g.className="plc__content";const v=document.createElement("h3");if(v.className="plc__title",v.textContent=n,d){const t=document.createElement("a");t.href=d,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(v),g.appendChild(t)}else g.appendChild(v);const b=document.createElement("div");b.className="plc__size-price-wrapper";const C=document.createElement("div");C.className="plc__price",C.textContent=formatCentToDollarText(a),b.appendChild(C);const S=document.createElement("div");S.className="plc__size",S.textContent=s||"",b.appendChild(S),g.appendChild(b),l.push(g);const E=document.createElement("button");return E.type="button",E.className="plc__button",E.disabled=!c.hasAvailability,c.isPresale?E.textContent="Pre Order":c.hasAvailability?E.textContent="Add to Cart":(E.textContent="Not Available In "+c.state.toUpperCase(),this.addHostClasses("not-available")),E.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(c)}),l.push(E),l}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const e=document.createElement("div");e.classList.add("slc__card");const n=document.createElement("div");n.className="slc__image-content";const s=document.createElement("div");s.className="slc__image-wrapper";const a=document.createElement("div");a.classList.add("wave","slc__image"),s.appendChild(a),n.appendChild(s);const c=document.createElement("div");c.className="slc__content";const l=document.createElement("div");l.className="slc__title-container";const d=document.createElement("div");d.classList.add("wave","slc__title","slc__title-line-1"),l.appendChild(d);const p=document.createElement("div");p.classList.add("wave","slc__title","slc__title-line-2"),l.appendChild(p),c.appendChild(l);const m=document.createElement("div");m.className="slc__size-price-wrapper";const f=document.createElement("div");f.classList.add("wave","slc__price"),m.appendChild(f);const g=document.createElement("div");g.classList.add("wave","slc__size"),m.appendChild(g),c.appendChild(m);const v=document.createElement("div");return v.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(c),e.appendChild(v),e}template(){const t=[],e=100/this.params.columns;this.container.style.setProperty("--card-width",e+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let s=0;s<n;s++){const e=this.createSkeletonCard(s);t.push(e)}return t}}function createApplyFiltersButton(t){const e=document.createElement("div");e.className="product-list-filters-apply-container";const n=document.createElement("button");return n.className="product-list-filters-apply-btn",n.textContent="Apply Filters",n.addEventListener("click",()=>t()),e.appendChild(n),e}function createCheckboxItem(t){const{filter:e,state:n,item:s,onChange:a}=t,c=document.createElement("div");c.className="checkbox-filter-item";const l=document.createElement("input");l.type="checkbox",l.id=e.category+"-"+s.value,l.value=s.value.toString(),l.className="checkbox-filter-checkbox",l.checked=n.selectedValues.has(s.value.toString()),l.addEventListener("change",a);const d=document.createElement("label");d.htmlFor=l.id,d.className="checkbox-filter-item-label";const p=s.formattedValue||s.value.toString(),m=s.count||0,f=document.createElement("span");f.className="checkbox-filter-item-text",f.textContent=p;const g=document.createElement("span");return g.className="checkbox-filter-item-count",g.textContent="("+m+")",d.appendChild(f),d.appendChild(g),c.appendChild(l),c.appendChild(d),c}function handleCheckboxFilterSearch(t){const{filter:e,state:n,searchTerm:s,renderCheckboxItems:a}=t,c=s.toLowerCase().trim();n.filteredItems=c?e.values.filter(t=>{const e=(t.formattedValue||t.value.toString()).toLowerCase();return e.includes(c)}):[...e.values],a()}function createCheckboxFilterHeader(t){const{filter:e,state:n,onToggle:s}=t,a=document.createElement("div");a.className="checkbox-filter-header";const c=document.createElement("button");c.className="checkbox-filter-label",c.type="button";const l=document.createElement("span");l.textContent=formatFilterLabel(e.category);const d=document.createElement("span");return d.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),d.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),n.iconElement=d,c.appendChild(l),c.appendChild(d),c.addEventListener("click",()=>s(e.category)),a.appendChild(c),a}function createCheckboxFilterSearchContainer(t){const{state:e,onSearch:n}=t,s=document.createElement("div");s.className="checkbox-filter-search-wrapper",e.searchInput=document.createElement("input"),e.searchInput.type="text",e.searchInput.className="checkbox-filter-search",e.searchInput.placeholder="Search";const a=document.createElement("span");return a.className="checkbox-filter-search-icon",a.innerHTML=SearchIcon({}),e.searchInput.addEventListener("input",t=>{const e=t.target;n(e.value)}),s.appendChild(e.searchInput),s.appendChild(a),s}function renderCheckboxItems(t){const{filter:e,state:n,onCheckboxChange:s}=t;if(n.checkboxList&&(n.checkboxList.innerHTML="",n.filteredItems.forEach(t=>{const a=createCheckboxItem({filter:e,state:n,item:t,onChange:()=>{const e=a.querySelector("input");s(t.value.toString(),e.checked)}});n.checkboxList.appendChild(a)}),0===n.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",n.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:s,onDeliveryOptionsChange:a,onToggleCollapse:c}=t,l=[],d=document.createElement("div");d.className="product-list-filters-delivery-options";const p=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],m=document.createElement("div");m.className="product-list-filters-delivery-options-header",m.style.cursor="pointer";const f=document.createElement("h3");f.className="product-list-filters-delivery-options-label",f.textContent="Delivery Options";const g=document.createElement("div");g.className="product-list-filters-chevron",g.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),m.appendChild(f),m.appendChild(g),d.appendChild(m);const v=document.createElement("div");v.className="product-list-filters-delivery-options-list",n&&v.classList.add("collapsed");for(const b of p){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+b.value,n.name="delivery-options",n.value=b.value,n.className="product-list-filters-delivery-radio";const c="onDemand"===b.value&&s;n.disabled=c,n.checked=b.value===(null==e?void 0:e.deliveryOptions),n.addEventListener("change",t=>{const e=t.target;null==a?void 0:a(e.value)});const l=document.createElement("label");l.htmlFor="delivery-"+b.value,l.className="product-list-filters-delivery-radio-label "+(c?"disabled":""),l.textContent=b.label,t.appendChild(n),t.appendChild(l),v.appendChild(t)}return d.appendChild(v),m.addEventListener("click",()=>{c()}),l.push(d),{elements:l,chevronContainer:g,deliveryOptionsList:v}}function createPriceFilter(t){var e,n,s,a,c,l,d,p;const{priceConfig:m,currentFilters:f,priceCollapsed:g,onPriceChange:v,onToggleCollapse:b,DEFAULT_MIN:C,DEFAULT_MAX:S}=t,E=[],_=document.createElement("div");_.className="product-list-filters-price";const P=Number.parseInt(null!==(e=null==m?void 0:m.min)&&void 0!==e?e:C,10),I=Number.parseInt(null!==(n=null==m?void 0:m.max)&&void 0!==n?n:S,10),F=Number.parseInt(null!==(c=null!==(a=null===(s=null==f?void 0:f.price)||void 0===s?void 0:s.min)&&void 0!==a?a:null==m?void 0:m.min)&&void 0!==c?c:C,10),O=Number.parseInt(null!==(p=null!==(d=null===(l=null==f?void 0:f.price)||void 0===l?void 0:l.max)&&void 0!==d?d:null==m?void 0:m.max)&&void 0!==p?p:S,10),z=document.createElement("div");z.className="product-list-filters-price-header",z.style.cursor="pointer";const R=document.createElement("h3");R.className="product-list-filters-price-title",R.textContent="Price Range",z.appendChild(R);const L=document.createElement("div");L.className="product-list-filters-chevron",L.innerHTML=g?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),z.appendChild(L),_.appendChild(z);const M=document.createElement("div");M.className="product-list-filters-price-slider-container",g&&M.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const j=document.createElement("div");j.className="product-list-filters-price-track";const q=document.createElement("div");q.className="product-list-filters-price-track-active",j.appendChild(q),B.appendChild(j);const U=document.createElement("input");U.type="range",U.min=P.toString(),U.max=I.toString(),U.value=F.toString(),U.step="1",U.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(U);const G=document.createElement("input");G.type="range",G.min=P.toString(),G.max=I.toString(),G.value=O.toString(),G.step="1",G.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(G),M.appendChild(B);const K=document.createElement("div");K.className="product-list-filters-price-inputs-container";const Y=document.createElement("div");Y.className="product-list-filters-price-input-wrapper";const W=document.createElement("span");W.className="product-list-filters-price-input-prefix",W.textContent="$";const Q=document.createElement("input");Q.type="number",Q.min=P.toString(),Q.max=I.toString(),Q.value=F.toString(),Q.className="product-list-filters-price-input",Q.placeholder=P.toString(),Y.appendChild(W),Y.appendChild(Q);const Z=document.createElement("span");Z.className="product-list-filters-price-separator",Z.textContent="to";const X=document.createElement("div");X.className="product-list-filters-price-input-wrapper";const J=document.createElement("span");J.className="product-list-filters-price-input-prefix",J.textContent="$";const $=document.createElement("input");$.type="number",$.min=P.toString(),$.max=I.toString(),$.value=O.toString(),$.className="product-list-filters-price-input",$.placeholder=I+"+",X.appendChild(J),X.appendChild($),K.appendChild(Y),K.appendChild(Z),K.appendChild(X),M.appendChild(K),_.appendChild(M);const i=()=>{const t=Number.parseInt(U.value,10),e=Number.parseInt(G.value,10),n=I-P,s=(t-P)/n*100,a=(e-P)/n*100;q.style.left=s+"%",q.style.width=a-s+"%"},x=(t,e)=>{U.value=t.toString(),G.value=e.toString(),Q.value=t.toString(),$.value=e.toString(),i()};return U.addEventListener("input",()=>{let t=Number.parseInt(U.value,10);const e=Number.parseInt(G.value,10);t>e&&(t=e),x(t,e)}),U.addEventListener("change",()=>{const t=Number.parseInt(U.value,10),e=Number.parseInt(G.value,10);null==v?void 0:v(t.toString(),e.toString())}),G.addEventListener("input",()=>{const t=Number.parseInt(U.value,10);let e=Number.parseInt(G.value,10);e<t&&(e=t),x(t,e)}),G.addEventListener("change",()=>{const t=Number.parseInt(U.value,10),e=Number.parseInt(G.value,10);null==v?void 0:v(t.toString(),e.toString())}),Q.addEventListener("input",()=>{let t=Number.parseInt(Q.value,10)||P;const e=Number.parseInt($.value,10)||I;t=Math.max(P,Math.min(t,I)),t>e&&(t=e),x(t,e),null==v||v(t.toString(),e.toString())}),$.addEventListener("input",()=>{const t=Number.parseInt(Q.value,10)||P;let e=Number.parseInt($.value,10)||I;e=Math.max(P,Math.min(e,I)),e<t&&(e=t),x(t,e),null==v||v(t.toString(),e.toString())}),i(),z.addEventListener("click",()=>{b()}),E.push(_),{elements:E,chevronContainer:L,sliderContainer:M}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const t=[],e=document.createElement("div");e.className="product-list-search-box";const n=document.createElement("span");return n.className="product-list-search-icon",n.innerHTML=SearchIcon({}),n.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,s=this.sanitizeInput(n);s!==n&&(e.value=s),this.updateClearButtonVisibility(s),this.params.handleInputChange&&this.params.handleInputChange(s)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),e.appendChild(n),e.appendChild(this.searchInput),e.appendChild(this.clearButton),t.push(e),t}sanitizeInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e=e.trim(),e=e.replace(/\s+/g," "),e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}}function createPersonalizedFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onPersonalizedChange:s}=t,a=[],c=document.createElement("div");c.className="product-list-filters-personalized";const l=document.createElement("label");l.className="product-list-filters-personalized-label",l.setAttribute("for","personalized-switch"),l.textContent="Personalized Bottles",c.appendChild(l);const d=document.createElement("div");d.classList.add("toggle-switch");const p=!!(null==e?void 0:e.personalized);p&&d.classList.add("active");const m=document.createElement("div");m.classList.add("toggle-slider"),d.id="personalized-switch",d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Toggle Personalized Bottles"),d.setAttribute("role","switch"),d.setAttribute("aria-checked",p?"true":"false"),d.appendChild(m);const N=t=>{d.classList.toggle("active",t),d.setAttribute("aria-checked",t?"true":"false")},y=()=>{const t=d.classList.contains("active"),e=!t;N(e),null==s||s(e)};if(d.addEventListener("click",()=>{n||y()}),d.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),c.appendChild(d),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",c.appendChild(t)}return a.push(c),a}function createPreOrderFilter(t){const{currentFilters:e,isPreOrderDisabled:n,onPreOrderChange:s}=t,a=[],c=document.createElement("div");c.className="product-list-filters-pre-order";const l=document.createElement("label");l.className="product-list-filters-pre-order-label",l.setAttribute("for","pre-order-switch"),l.textContent="Pre-Order",c.appendChild(l);const d=document.createElement("div");d.classList.add("toggle-switch");const p=!!(null==e?void 0:e.preOrder);p&&d.classList.add("active"),n&&d.classList.add("disabled");const m=document.createElement("div");m.classList.add("toggle-slider"),d.id="pre-order-switch",d.setAttribute("tabindex",n?"-1":"0"),d.setAttribute("aria-label","Toggle Pre-Order"),d.setAttribute("role","switch"),d.setAttribute("aria-checked",p?"true":"false"),d.setAttribute("aria-disabled",n?"true":"false"),d.appendChild(m);const N=t=>{d.classList.toggle("active",t),d.setAttribute("aria-checked",t?"true":"false")},y=()=>{const t=d.classList.contains("active"),e=!t;N(e),null==s||s(e)};if(d.addEventListener("click",()=>{n||y()}),d.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),c.appendChild(d),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",c.appendChild(t)}return a.push(c),a}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const t=["product-list-filters-container"];return this.params.isDrawerMode&&t.push("drawer-mode"),t}isSameDayDeliveryDisabled(){var t,e;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const t=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=t.chevronContainer,this.deliveryOptionsList=t.deliveryOptionsList,t.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const t=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=t.chevronContainer,this.priceSliderContainer=t.sliderContainer,t.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(t){var e;const n=[];if(!this.checkboxFilterStates.has(t.category)){const n=null===(e=this.params.currentFilters)||void 0===e?void 0:e[t.category],s=Array.isArray(n)?new Set(n):new Set;this.checkboxFilterStates.set(t.category,{isExpanded:s.size>0,selectedValues:s,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:s.size>0})}const s=this.checkboxFilterStates.get(t.category),a=document.createElement("div");a.className="product-list-checkbox-filter",a.setAttribute("data-filter-category",t.category);const c=document.createElement("div");c.className="checkbox-filter-container";const l=createCheckboxFilterHeader({filter:t,state:s,onToggle:t=>this.toggleCheckboxFilter(t)});c.appendChild(l);const d=document.createElement("div");d.className="checkbox-filter-content "+(s.isExpanded?"expanded":"collapsed"),s.contentElement=d;const p=createCheckboxFilterSearchContainer({state:s,onSearch:e=>{handleCheckboxFilterSearch({filter:t,state:s,searchTerm:e,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(t,s)})}});return d.appendChild(p),s.checkboxList=document.createElement("div"),s.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(t,s),d.appendChild(s.checkboxList),c.appendChild(d),a.appendChild(c),n.push(a),n}renderCheckboxItemsWrapper(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,s)=>this.handleCheckboxChange(t.category,e,n,s)})}handleCheckboxChange(t,e,n,s){s?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(t,Array.from(e.selectedValues))}toggleCheckboxFilter(t){const e=this.checkboxFilterStates.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}template(){var t;const e=[],n=document.createElement("div");n.className="product-list-filters-header",this.params.isDrawerMode&&n.classList.add("drawer-mode");const s=document.createElement("h3");if(s.className="product-list-filters-title",s.textContent="Filters",n.appendChild(s),this.params.isDrawerMode){const t=document.createElement("button");t.className="product-list-filters-close-btn",t.innerHTML=CloseIcon({}),t.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n.appendChild(t)}return e.push(n),this.params.enablePersonalized&&e.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&e.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&e.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&e.push(...this.createPriceFilterWrapper()),null===(t=this.params.sanitizedFilters)||void 0===t||t.forEach(t=>{e.push(...this.createCheckboxFilter(t))}),this.params.isDrawerMode&&e.push(createApplyFiltersButton(()=>{var t,e;null===(e=(t=this.params).onApplyFilters)||void 0===e?void 0:e.call(t),this.commands.ui.closeDrawer()})),e}}const FilterIcon=({width:t=16,height:e=16,className:n="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 24 24" class="filter-icon '+n+'" style="'+a+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var Et;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(Et||(Et={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.filters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=Et.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(Et.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Et.IDLE)}catch(ot){this.logger.error("Error initializing product list:",ot),this.setLoadingState(Et.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[],e=document.createElement("div");e.className="product-list-search__control-container",e.appendChild(this.createSearchContainer()),t.push(e),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),t.push(this.filterButton));const n=document.createElement("div");return n.className="product-list-controls",this.params.filters.length>0&&n.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),n.appendChild(this.cardsContainer),t.push(n),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Et.LOADING_INITIAL:this.renderLoadingState();break;case Et.ERROR:break;case Et.IDLE:case Et.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t,e;try{const n=this.buildApiParams(0),s=await this.commands.productList.getProductList(n);this.filters=(null===(t=s.navigation)||void 0===t?void 0:t.filters)||[],this.products=s.products||[],this.retailers=s.retailers||{},this.updatePagination(s.navigation),this.syncFiltersFromResponse((null===(e=s.navigation)||void 0===e?void 0:e.filters)||[]),this.updateFiltersComponent()}catch(n){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],n}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const t=this.filtersContainer.parentElement;if(!t)return;const e=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),t.replaceChild(this.filtersContainer,e)}async loadMoreProducts(){var t;if(this.loadingState!==Et.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Et.LOADING_MORE);const e=this.pagination.currentPage+1,n=this.buildApiParams(e),s=await this.commands.productList.getProductList(n);this.filters=(null===(t=s.navigation)||void 0===t?void 0:t.filters)||[],s.products&&s.products.length>0?(this.products.push(...s.products),this.mergeRetailers(s.retailers||{}),this.updatePagination(s.navigation),this.appendNewProducts(s.products)):(this.pagination.hasMorePages=![],this.updatePagination(s.navigation)),this.setLoadingState(Et.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(Et.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){for(const[e,n]of Object.entries(t))this.retailers[e]||(this.retailers[e]=n)}updatePagination(t){var e,n,s,a;t&&(this.pagination={currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,hasMorePages:(null!==(s=t.currentPage)&&void 0!==s?s:0)<(null!==(a=t.totalPages)&&void 0!==a?a:1)-1})}buildApiParams(t){const e={page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(e.search=this.searchFilter.searchTerm.trim()),e}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"});const e="all"===this.currentFilters.deliveryOptions?["onDemand","shipping"]:[this.currentFilters.deliveryOptions];if(t.push({key:"fulfillment",values:e}),this.currentFilters.price){const e={};"0"!==this.currentFilters.price.min&&(e.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(e.max=this.currentFilters.price.max),Object.keys(e).length>0&&t.push({key:"price",values:e})}const n=Object.keys(this.currentFilters).filter(t=>!["personalized","preOrder","deliveryOptions","price"].includes(t));for(const s of n){const e=this.currentFilters[s];Array.isArray(e)&&e.length>0&&t.push({key:s,values:e})}return t}syncFiltersFromResponse(t){if(t)for(const e of t)switch(e.key){case"engraving":this.currentFilters.personalized="YES"===e.values;break;case"presale":this.currentFilters.preOrder="YES"===e.values;break;case"fulfillment":Array.isArray(e.values)&&(e.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":e.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(Et.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(Et.IDLE)}catch(ot){this.logger.error("Error handling filter change:",ot),this.setLoadingState(Et.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const e="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=e,e&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,e)})}updateRadioLabel(t,e){const n=this.deliveryRadioLabels.get(t.id);n&&(n.className="product-list-filters-delivery-radio-label "+(e?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const e=100/this.params.columns;return t.style.setProperty("--card-width",e+"%"),t.style.setProperty("--columns",""+this.params.columns),t}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:a.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.getResponsiveColumns(),fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const e=this.createProductCard(t);e&&this.cardsContainer.appendChild(e)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const e of t){const t=this.createProductCard(e);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const n=Object.values(e.shippingVariants)[0];if(!n)return this.logger.warn("Product "+t.id+" has no variants"),null;const s=this.retailers[n.retailerId];return s?ComponentFactoryService.createElement({type:a.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,shippingFulfillment:s.shippingFulfillment,onDemandFulfillment:s.onDemandFulfillment,productUrl:this.params.productUrl}):(this.logger.warn("Retailer "+n.retailerId+" not found for product "+t.id),null)}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const e={[t.BRANDS]:v.BRANDS,[t.CATEGORIES]:v.CATEGORIES,[t.FLAVOR]:v.FLAVOR,[t.REGION]:v.REGION,[t.VARIETY]:v.VARIETY,[t.VINTAGE]:v.VINTAGE,[t.COUNTRY]:v.COUNTRY,[t.APPELLATION]:v.APPELLATION,[t.MATERIALS]:v.MATERIALS,[t.SIZES]:v.SIZES};return this.filters.filter(t=>{const n=e[t.category];return n&&this.params.filters.includes(n)})}buildFiltersParams(t=![]){const w=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(v.PERSONALIZATION),enablePreOrder:this.params.filters.includes(v.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(v.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(v.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async e=>{this.currentFilters.personalized=e,t||await this.onFilterChange()},onPreOrderChange:async e=>{this.currentFilters.preOrder=e,t||await this.onFilterChange()},onDeliveryOptionsChange:async e=>{this.currentFilters.deliveryOptions=e,"onDemand"===e&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),t||await this.onFilterChange()},onPriceChange:async(e,n)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==e?this.currentFilters.price.min=e:delete this.currentFilters.price.min,"1000"!==n?this.currentFilters.price.max=n:delete this.currentFilters.price.max,t||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(e,n)=>{n.length>0?this.currentFilters[e]=n:delete this.currentFilters[e],t||await this.onFilterChange()},isDrawerMode:t,onApplyFilters:async()=>{await w()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:a.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async t=>{this.searchFilter.searchTerm=t,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(t={}){const{isDrawerMode:e=![]}=t;return this.filtersContainer=ComponentFactoryService.createElement({type:a.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(e)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var e;const n=null===(e=this.filtersContainer)||void 0===e?void 0:e.querySelector('label[for="'+t.id+'"]');n&&this.deliveryRadioLabels.set(t.id,n)})}openFiltersDrawer(){this.commands.ui.openDrawer(a.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const e=document.createElement("div");e.className="product-list-filter-icon",e.innerHTML=FilterIcon({}),e.addEventListener("click",()=>{this.openFiltersDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",t.appendChild(e),t.appendChild(n),t}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const e=t[0];e.isIntersecting&&this.loadingState===Et.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let e;t.innerHTML="",e=this.loadingState===Et.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(e)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const e=this.createErrorElement(t);this.sentinelElement.appendChild(e)}createLoadingElement(t){const e=document.createElement("div");e.className="product-list-sentinel-container";const n=document.createElement("div");n.className="product-list-sentinel-spinner";const s=document.createElement("div");return s.className="product-list-sentinel-text",s.textContent=t,e.appendChild(n),e.appendChild(s),e}createErrorElement(t){const e=document.createElement("div");e.className="product-list-sentinel-error-container";const n=document.createElement("div");n.className="product-list-sentinel-error-icon",n.innerHTML="⚠";const s=document.createElement("div");return s.className="product-list-sentinel-error-text",s.textContent=t,e.appendChild(n),e.appendChild(s),e}createInfoElement(t,e=![]){const n=document.createElement("div");if(n.className="product-list-sentinel-info-container",!e&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",n.appendChild(t)}else if(e){const t=document.createElement("div");t.className="product-list-sentinel-divider",n.appendChild(t)}const s=document.createElement("div");return s.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",s.textContent=t,n.appendChild(s),n}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const e=this.createErrorElement(t);this.cardsContainer.appendChild(e)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(n){this.logger.error("Error reloading products after address change:",n),this.setLoadingState(Et.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],s=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return s?e.slice(0,1):e}const a=this.store.get(this.params.errorStorePath);return a?[{message:a,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=t.message,e.appendChild(n),e.appendChild(s),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(a.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const s=n.value,a=s.isOpen,c=null===(e=s.contentConfig)||void 0===e?void 0:e.type,l=c!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=c,this.openWithContent(s),![]):a&&this.isOpen&&!l?![]:a&&this.isOpen&&l?(this.currentContentType=c,this.openWithContent(s),![]):!a&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var t,e,n,s;if(this.engravingLines=this.params.lines,"product"===this.params.context){const a=this.store.get("products."+this.params.identifier);this.fulfillmentId=a.selectedFulfillmentId,this.partNumber=(null===(t=a.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null,this.isPresale=(null===(s=null===(n=null===(e=a.sizes[a.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.presale)||void 0===s?void 0:s.isActive)||![]}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),s=n.sizes[n.selectedSizeId],a=s.shippingFulfillments[this.fulfillmentId],c=a.variant.price,l=(null===(e=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return c+l}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const s=this.store.get("products."+this.params.identifier);s.sizes[s.selectedSizeId].image?t.push(s.sizes[s.selectedSizeId].image):t.push(...s.images||[]),e=s.name,n=s.sizes[s.selectedSizeId].size}if("cart"===this.params.context){const s=this.store.get("cart.items."+this.params.identifier);s.mainImage&&t.push(s.mainImage),e=s.name,n=s.size}const s=document.createElement("div");if(s.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const a=document.createElement("img");a.src=t[0],a.alt=e,a.loading="lazy",a.className="product-image",n.appendChild(a),s.appendChild(n)}const a=document.createElement("div");a.className="product-details-container";const c=document.createElement("div");c.className="product-header";const l=document.createElement("h4");l.className="product-title",l.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),c.appendChild(l),c.appendChild(this.productPriceSpan),a.appendChild(c);const d=document.createElement("p");d.className="product-size-text",d.textContent=n,a.appendChild(d);const p=document.createElement("p");return p.className="engraving-fees-disclaimer",p.textContent="Personalization fees included in total, varies by retailer.",a.appendChild(p),s.appendChild(a),s}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=this.isPresale?e.layout.preSaleButtonText:e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,s,a,c,l;const d=this.store.get("products."+this.params.identifier),p=d.sizes[d.selectedSizeId],m=Object.values(p.shippingFulfillments).filter(t=>t.variant.isEngravable),f=document.createElement("div");f.className="fulfillment-section";const g=document.createElement("p");if(g.className="shipping-from-text",g.innerHTML="Shipping from: <b>"+(null===(t=d.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",f.appendChild(g),1===m.length)return f;const v=document.createElement("div");v.className="fulfillment-options-container",f.appendChild(v);const b=document.createElement("span");b.className="see-more-fulfillments",b.textContent="See More Delivery Options ("+m.length+")",b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-label","See More Delivery Options ("+m.length+")"),b.setAttribute("aria-expanded","false");const u=()=>{const t=v.classList.contains("expanded");v.classList.toggle("expanded"),t?(b.textContent="See More Delivery Options ("+m.length+")",b.setAttribute("aria-label","See More Delivery Options ("+m.length+")"),b.setAttribute("aria-expanded","false")):(b.textContent="See Less Delivery Options",b.setAttribute("aria-label","See Less Delivery Options"),b.setAttribute("aria-expanded","true"))};b.addEventListener("click",u),b.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),u())}),f.appendChild(b);for(const C of m){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",C.id),C.id===(null===(e=d.selectedFulfillment)||void 0===e?void 0:e.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+C.retailerName+", "+formatCentToDollarText(C.variant.price+((null===(s=null===(n=d.sizes[d.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.fee)||0))+", "+C.engravingExpectation),t.setAttribute("aria-pressed",C.id===(null===(a=d.selectedFulfillment)||void 0===a?void 0:a.id)?"true":"false");const k=()=>{this.fulfillmentId=C.id,this.partNumber=C.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=v.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),g.innerHTML="Shipping from: <b>"+C.retailerName+"</b>"};t.addEventListener("click",k),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),k())});const p=C.variant.price+((null===(l=null===(c=d.sizes[d.selectedSizeId].attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0),m=document.createElement("div");m.className="option-row row-1",t.appendChild(m);const f=document.createElement("span");f.className="retailer-name",f.textContent=C.retailerName,m.appendChild(f);const b=document.createElement("span");b.className="fulfillment-price",b.textContent=formatCentToDollarText(p),m.appendChild(b),t.appendChild(m);const S=document.createElement("div");S.className="option-row row-2",t.appendChild(S);const E=document.createElement("span");E.className="estimated-time",E.textContent=C.engravingExpectation,S.appendChild(E),t.appendChild(S),v.appendChild(t)}return f}engravingLinesSection(){var t;const e=this.getConfigs("global"),{lines:n,maxLines:s,location:a,maxCharsPerLine:c}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent=e.layout.personalizationText,l.appendChild(d),a&&(null===(t=null==a?void 0:a.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+a.toLowerCase()+".",l.appendChild(t)}const p=Array.from({length:s},(t,e)=>{const s=e+1,a=document.createElement("div");a.className="engraving-input-wrapper",a.setAttribute("data-line-number",s.toString());const l=document.createElement("input");l.type="text",l.id="engraving-line-"+s,l.dataset.lineNumber=s.toString(),l.maxLength=c,l.value=n[e]||"",l.placeholder=s>1?"Line "+s+" (optional)":"Line "+s,l.className="engraving-input",l.autocomplete="off",l.setAttribute("aria-label",s>1?"Engraving line "+s+", optional, maximum "+c+" characters":"Engraving line "+s+", maximum "+c+" characters");const d=document.createElement("span");return d.className="engraving-char-count",d.textContent=l.value.length+"/"+c,d.setAttribute("aria-live","polite"),d.setAttribute("aria-atomic","true"),l.addEventListener("input",()=>{d.textContent=l.value.length+"/"+c,this.engravingLines[e]=l.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(l),a.appendChild(d),a}),m=document.createElement("div");return m.className="engraving-inputs-container",m.append(...p),l.appendChild(m),l}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const s=document.createElement("button");s.type="button",s.className="cancel-action-button",s.textContent="Cancel",s.setAttribute("aria-label","Cancel personalization and close");const h=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(a.CART)};s.addEventListener("click",h),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),h())}),n.appendChild(s),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const H=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t};this.isPresale?await this.commands.product.addPresaleToCart(t,e):await this.commands.product.addToCart(t,e),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(a.CART))};return this.addToCartButton.addEventListener("click",H),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),H())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const s=this.actionButtonsSection();t.push(s);const a=document.createElement("p");return a.className="engraving-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>",t.push(a),t}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,s=(null==e?void 0:e.quantity)||1;return{quantity:s,fee:n,total:n*s}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,s=(null==e?void 0:e.quantity)||1;return{quantity:s,fee:n,total:n*s}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,s,c,l,d,p,m,f,g,v,b,C,S,E,_,P,I,F;const O=this.params.identifier,z={identifier:O,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const a=this.getStoreValue("cart.items."+O);z.lines=(null===(e=null===(t=null==a?void 0:a.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],z.maxLines=(null===(s=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.engraving)||void 0===s?void 0:s.maxLines)||1,z.maxCharsPerLine=(null===(l=null===(c=null==a?void 0:a.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,z.fee=(null===(p=null===(d=null==a?void 0:a.attributes)||void 0===d?void 0:d.engraving)||void 0===p?void 0:p.fee)||0,z.location=(null===(f=null===(m=null==a?void 0:a.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+O);z.lines=(null===(v=null===(g=null==t?void 0:t.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.lines)||[],z.maxLines=(null===(C=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===C?void 0:C.maxLines)||1,z.maxCharsPerLine=(null===(E=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===E?void 0:E.maxCharsPerLine)||16,z.fee=(null===(P=null===(_=null==t?void 0:t.attributes)||void 0===_?void 0:_.engraving)||void 0===P?void 0:P.fee)||0,z.location=(null===(F=null===(I=null==t?void 0:t.attributes)||void 0===I?void 0:I.engraving)||void 0===F?void 0:F.location)||""}this.commands.ui.openDrawer(a.ENGRAVING_FORM,z)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const a=document.createElement("span");if(a.className="engraving-fee",1===t.quantity&&(a.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){a.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",a.appendChild(e)}n.appendChild(s),n.appendChild(a);const c=document.createElement("div");c.className="engraving-body";const l=document.createElement("div");l.className="engraving-lines";for(const m of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=m,l.appendChild(t)}const d=document.createElement("div");d.className="engraving-actions";const p=document.createElement("button");p.type="button",p.classList.add("remove-button"),p.textContent="Remove",p.setAttribute("aria-label","Remove engraving");const N=async()=>{await this.handleRemove()};if(p.addEventListener("click",N),p.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await N())}),d.appendChild(p),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),d.appendChild(t)}return c.appendChild(l),c.appendChild(d),[n,c]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("-");3===t.length&&(this.yearInput.value=t[0],this.monthInput.value=t[1],this.dayInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>{this.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const e of t)e.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=2&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&"00"!==n&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=4&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&"00"!==n&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}padMonthOnBlur(){const t=this.monthInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.monthInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}padDayOnBlur(){const t=this.dayInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.dayInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}handleNavigation(t,e){const n=t.target,s=n===this.yearInput?4:2;n.value.length===s&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value;return 2===t.length&&2===e.length&&4===n.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const s=Number.parseInt(t,10),a=Number.parseInt(e,10),c=Number.parseInt(n,10);if(s<1||s>12||a<1||a>31||c<1e3)return![];const l=new Date(c,s-1,a);return l.getFullYear()===c&&l.getMonth()===s-1&&l.getDate()===a}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const s=e.getMonth()-t.getMonth();return(s<0||0===s&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,s=[],a=this.params.validation;if(!a)return this.showErrors([]),!![];const c=2===t.length&&2===e.length&&4===n.length,l=t||e||n;if(a.required&&!l)s.push("Please enter a complete date (MM/DD/YYYY)");else if(l&&!c)s.push("Please enter a complete date (MM/DD/YYYY)");else if(c)if(this.validateDate(t,e,n)){const c=Number.parseInt(t,10),l=Number.parseInt(e,10),d=Number.parseInt(n,10),p=new Date(d,c-1,l);if(void 0!==a.minYear&&d<a.minYear&&s.push("Year must be "+a.minYear+" or later"),void 0!==a.maxYear&&d>a.maxYear&&s.push("Year must be "+a.maxYear+" or earlier"),void 0!==a.minAge||void 0!==a.maxAge){const t=this.calculateAge(p);void 0!==a.minAge&&t<a.minAge&&s.push("Must be at least "+a.minAge+" years old"),void 0!==a.maxAge&&t>a.maxAge&&s.push("Must be no more than "+a.maxAge+" years old")}if(a.customValidator){const t=a.customValidator(this.getFormattedValue());t&&s.push(t)}}else s.push("Please enter a valid date");this.showErrors(s);const d=0===s.length;return this.params.onValidation&&this.params.onValidation(d,s),d}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const 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 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&&(s.disabled=!![],c.disabled=!![],d.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(s),n.appendChild(a),n.appendChild(c),n.appendChild(l),n.appendChild(d);const p=document.createElement("div");return p.className="error-container",e.push(n),e.push(p),e}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,s=e.value;n>0&&/\D/.test(s[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,s,a]=t.split("/").map(Number),c=new Date(a,n-1,s);return c.getFullYear()===a&&c.getMonth()===n-1&&c.getDate()===s}isFieldComplete(){var t,e,n;const s=this.inputElement.value.trim();if(!s)return![];switch(this.params.inputType){case"tel":return this.validateTel(s);case"date":return this.validateDate(s);case"email":return s.includes("@")&&(null===(t=s.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(s));default:return(null===(e=this.params.validation)||void 0===e?void 0:e.max)&&s.length>=this.params.validation.max||(null===(n=this.params.validation)||void 0===n?void 0:n.min)&&s.length>=this.params.validation.min?!![]:s.length>=3}}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),!n.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const s=Number.parseFloat(t);Number.isNaN(s)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&s<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&s>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const s=new RegExp(n.pattern);s.test(t)||e.push("Invalid format")}if(n.customValidator){const s=n.customValidator(t);s&&e.push(s)}}this.showErrors(e);const s=0===e.length;return this.params.onValidation&&this.params.onValidation(s,e),s}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.U=t=>{e.rerender(t||"LceElementRerender")}),this.V.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),s=n.getStylesheet(t);this.applyThemeStyles(s),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.V.adoptedStyleSheets=[e,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(ot){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.V&&this.V.appendChild(e)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",t.appendChild(s),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const s of n){const n=s.trim();if(!n)continue;const a=document.createElement("span");a.classList.add("promo-ticker__text-item"),a.textContent=n,e.appendChild(a);const c=document.createElement("span");c.classList.add("promo-ticker__separator"),c.textContent=t.separator,e.appendChild(c)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let a=0;a<5;a++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const s=document.createElement("button");return s.type="button",s.classList.add("promo-ticker__cta"),s.textContent="APPLY",s.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(s.disabled=!![],s.textContent="APPLIED"),s.addEventListener("click",()=>this.handlePromoClick()),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=s,[e,s]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=e[this.params.messageType]||"warning",a=document.createElement("div");return a.className="alert-icon alert-icon-"+this.params.messageType,a.appendChild(htmlStringToElement(n[s]({width:16,height:16,className:"alert-icon-svg"}))),a}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,e.push(s),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}const _t=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},s=[];for(const a in e){const c=e[a],l=n[a];if(!(a in t)){s.push('Property "'+a+'" does not exist in target schema, skipping merge.');continue}const d=getType(c),p=getType(l);d===p?isObject(c)&&isObject(l)?n[a]=deepMergeConfigs(l,c):n[a]=c:s.push('Type mismatch for key "'+a+'": source is '+d+", target is "+p+". Skipping merge.")}return s.length>0&&_t.warn("Merging configurations with warnings:",s),n}const Dt=new Map([["global.layout.enablePersonalization",[a.PRODUCT,a.CART,a.CHECKOUT,a.ENGRAVING_FORM,a.ENGRAVING_VIEW,a.PRODUCT_INTERACTIONS,a.CART_ITEM,a.CHECKOUT_ITEM]],["global.layout.personalizationText",[a.PRODUCT,a.CART,a.CHECKOUT,a.ENGRAVING_FORM,a.ENGRAVING_VIEW,a.CART_ITEM]],["global.layout.personalizationCardStyle",[a.PRODUCT,a.CART,a.CHECKOUT,a.ENGRAVING_FORM,a.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[a.CART,a.CART_PROMO_CODE,a.CART_FOOTER,a.CHECKOUT_ORDER_SUMMARY,a.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[a.CART,a.CHECKOUT,a.ADDRESS,a.INPUT,a.BIRTHDATE_INPUT,a.ADDRESS_INPUT,a.CHECKOUT_DELIVER_TO,a.CHECKOUT_BUYER,a.CHECKOUT_BILLING,a.CHECKOUT_PAYMENT,a.CART_PROMO_CODE]],["global.layout.showPoweredBy",[a.CART,a.CHECKOUT,a.CHECKOUT_COMPLETED,a.POWERED_BY,a.CART_FOOTER,a.CHECKOUT_ORDER_SUMMARY,a.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[a.POWERED_BY]],["product.layout.showImages",[a.PRODUCT,a.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[a.PRODUCT]],["product.layout.showDescription",[a.PRODUCT,a.PRODUCT_DESCRIPTION,a.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[a.PRODUCT,a.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[a.PRODUCT,a.PRODUCT_RETAILERS,a.PRODUCT_RETAILERS_CAROUSEL,a.PRODUCT_RETAILERS_POPUP,a.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[a.PRODUCT,a.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[a.PRODUCT,a.PRODUCT_IMAGE_CAROUSEL,a.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[a.PRODUCT,a.PRODUCT_RETAILERS,a.PRODUCT_RETAILERS_CAROUSEL,a.PRODUCT_RETAILERS_POPUP,a.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[a.PRODUCT,a.PRODUCT_RETAILERS,a.PRODUCT_RETAILERS_CAROUSEL,a.PRODUCT_RETAILERS_POPUP,a.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[a.PRODUCT,a.PRODUCT_ADD_TO_CART_SECTION,a.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[a.PRODUCT,a.PRODUCT_ADD_TO_CART_SECTION,a.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[a.PRODUCT,a.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[a.PRODUCT,a.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[a.CART,a.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[a.CART,a.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[a.CART,a.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[a.CART,a.CART_FOOTER]],["checkout.layout.emailOptIn",[a.CHECKOUT,a.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[a.CHECKOUT,a.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[a.CHECKOUT,a.CHECKOUT_GIFT_CARDS,a.CHECKOUT_ORDER_SUMMARY,a.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[a.CHECKOUT,a.CHECKOUT_ORDER_SUMMARY,a.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[a.CHECKOUT,a.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[a.CHECKOUT,a.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[a.CHECKOUT,a.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[a.CHECKOUT,a.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[a.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const s of Object.keys(e)){const e=Dt.get(t+"."+s);if(e)for(const t of e)n.add(t)}return Array.from(n)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",ot.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:t,configs:e}=await this.authClient.authenticateAndGetConfigs();if(!t||!e)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed and configurations loaded"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let n=e;this.clientConfig.set("partnerCode",n.configurations.partnerCode),this.clientConfig.set("partnerName",n.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const s=await this.fingerPrintService.getId(n.configurations.partnerCode),a=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",s),this.clientConfig.set("isLocalStorageAvailable",a);const c=a?null:await this.apiClient.getPersistedStore(s);if(await this.store.initialize({userDeviceId:s,isLocalStorageAvailable:a,persistedStore:c}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),e=n.global.layout.showPoweredBy;n=deepMergeConfigs(n,t),n.global.layout.showPoweredBy=e}await this.themeProvider.initialize(n),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:e,containerId:n,...s}=t;if(!n||"string"!=typeof n)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);if(!e)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const c=n.replace("#",""),l=document.getElementById(c);if(!l)return console.warn("Container with ID '"+c+"' not found"),null;l.innerHTML="";const d={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...s},p=ComponentFactoryService.createElement(d);if(safeReplaceChildren(l,p),t.type===a.CHECKOUT){const e=t.checkoutId;await this.commands.checkout.loadCheckout({customCartId:e})}return this.createInjectedComponentWrapper(c,t.type,p)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const e=t.slice(0,20),n=[],s=[];for(const a of e){if(!a||"object"!=typeof a){this.logger.warn("Invalid product parameter: must be an object");continue}if(!a.containerId||"string"!=typeof a.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+a.identifier+"'");continue}const t=a.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+a.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+a.identifier+"'");continue}const s=n.every(e=>e.containerId!==t);if(!s){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!a.identifier||"string"!=typeof a.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const c=n.every(t=>t.identifier!==a.identifier);c?n.push({containerId:t,identifier:a.identifier}):this.logger.warn("Duplicate product identifier '"+a.identifier+"' found, skipping")}for(const c of n){const t=ComponentFactoryService.createElement({type:a.PRODUCT,useShadowDom:!![],productId:c.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(c.containerId);e?(e.innerHTML="",e.appendChild(t),s.push(this.createInjectedComponentWrapper(c.containerId,a.PRODUCT,t)),await this.commands.product.createProductInstance(c.identifier,!![])):this.logger.warn("Product ("+c.identifier+") container with ID '"+c.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(n.map(t=>t.identifier)),s}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,a.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.cardVariant&&!Object.values(g).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(g).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const e=Object.values(v);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const n=ComponentFactoryService.createElement({type:a.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||g.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:a.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const s={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,s),s}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let s;s=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,s)}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.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(a.CART,AddressInputComponent),ComponentFactoryService.registerComponent(a.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){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_LIST,ProductListComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(a.PRODUCT_LIST_SEARCH,ProductListSearchComponent),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,CheckoutInformationComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),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_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(a.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(a.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),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),ComponentFactoryService.registerComponent(a.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const s=ComponentFactoryService.createElement({type:a.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,s)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:a.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);e.innerHTML="",e.classList.add("lce-cart-subtotal");const A=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;A(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;A(t)})},cartItemsCount:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let n=!![];e&&"boolean"==typeof e.hideZero&&(n=e.hideZero);const s=document.getElementById(t.replace("#",""));if(!s)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);s.innerHTML="",s.classList.add("lce-cart-items-count");const h=t=>{s.textContent=t.toString(),0===t?(n&&(s.style.visibility="hidden"),s.classList.add("no-items")):(n&&(s.style.visibility="visible"),s.classList.remove("no-items"))},a=this.store.get("cart.itemsQuantity")||0;h(a),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;h(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,a.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:a.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,a.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:a.CART,containerId:t}):(this.injectDisabledElementsError(t,a.CART),null)}async injectCheckoutElement({containerId:t,checkoutId:e}){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n="string"==typeof e?e.trim():void 0;if(void 0!==e&&("string"!=typeof e||!n))throw new SDKError("Checkout element requires a valid checkout ID when provided. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:a.CHECKOUT,containerId:t,checkoutId:n}):(this.injectDisabledElementsError(t,a.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,e){try{SingletonManager.setContext({isBuilder:![]});const s=ClientConfigService.getInstance();s.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:e.proxy,development:e.development,checkoutUrl:e.checkoutUrl});const a=s.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const c=await SingletonManager.getClient(a);if(!c.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={injectProductElement:c.injectProductElement.bind(c),injectAddressElement:c.injectAddressElement.bind(c),injectCartElement:c.injectCartElement.bind(c),injectCheckoutElement:c.injectCheckoutElement.bind(c),injectProductList:c.injectProductList.bind(c),ui:c.ui,actions:c.actions,getInjectedComponents:c.getInjectedComponents.bind(c)};window.elements=l;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:s.get("version")}),l}catch(s){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",s)}catch(a){console.error("[LiquidCommerce Elements] Client initialization failed:",null==s?void 0:s.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==s?void 0:s.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(c){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Pt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},CHECKOUT:{CHECKOUT:"data-lce-checkout",URL:"data-checkout-url",PARAM:"data-checkout-param"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:e}){const n=Math.random().toString(36).substring(2,7),s=void 0!==t?t:"",a=void 0!==e?e:"",c=s&&a?"-":"";return""+s+c+a+n}function pairsFromMainScript(t){const e=[];try{const s=t.getAttributeNames().filter(t=>t.substring(0,12)===Pt.PRODUCT.PRODUCT);for(const a of s)try{const n=a.match(/^data-product(-(.+))?$/),s=(null==n?void 0:n[2])?"-"+n[2]:"",c=""+Pt.PRODUCT.CONTAINER+s;if(t.hasAttribute(c)){const n=t.getAttribute(c),s=t.getAttribute(a);n&&s&&e.push({containerId:n,identifier:s})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+Pt.PRODUCT_LIST.SCRIPT+"]");for(const s of n)try{const e=JSON.parse(s.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div["+Pt.PRODUCT.LCE_PRODUCT+"]");let s=0;for(const a of n)try{const e=generateElementId({prefix:"lce-p",index:s});a.setAttribute("id",e);const n=a.getAttribute(Pt.PRODUCT.LCE_PRODUCT);e&&n&&t.push({containerId:e,identifier:n}),s+=1}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}async function addProductToCartViaQueryParam(t,e){try{const s=e.getAttribute(Pt.PRODUCT.PARAM),a=e.getAttribute(Pt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!s)return;if(!startsWithLcePrefix(s))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+s+'" because it does not start with "lce_" prefix.'),void 0;const l=new URLSearchParams(window.location.search),d=l.get(s);if(!d)return;let p=c.SHIPPING;if(a)if(startsWithLcePrefix(a)){const t=l.get(a);t!==c.ON_DEMAND&&t!==c.SHIPPING||(p=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+a+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:d,fulfillmentType:p,quantity:1}],!![])}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",n)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",s)}}async function addPromoCodeToCartViaQueryParam(t,e){try{const s=e.getAttribute(Pt.PROMO_TICKER.CODE_PARAM);if(!s)return;if(!startsWithLcePrefix(s))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+s+'" because it does not start with "lce_" prefix.'),void 0;const a=new URLSearchParams(window.location.search),c=a.get(s);if(!c)return;try{await t.actions.cart.applyPromoCode(c)}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",n)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",s)}}async function setupCartButtonWithPosition(t,e,n,s){var a,c,l;try{const d=n.includes("mobile"),p=d?"mobile":"desktop",m=!d,f=e.getAttribute(n),g=e.getAttribute(s);if(!e.hasAttribute(n)&&!e.hasAttribute(s))return m&&t.ui.floatingCartButton(![]),void 0;if(m){if(e.hasAttribute(n)&&!f)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(s)&&!g)return t.ui.floatingCartButton(!![]),void 0}const v=f||g,b=!!g;if(!v)return m&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(b)),void 0;const C=["above","below","replace","inside"],S=v.match(/^(\w+):(.+)$/),E=S&&C.includes(S[1])?S[1]:"inside";let _=S?S[2]:v;/^[#.]/.test(_)||/\s/.test(_)||(_="#"+_);const P=document.querySelector(_);if(!P)return m&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+_+'" not found. Using floating button.'),t.ui.floatingCartButton(b)),void 0;const I=document.createElement("div");switch(I.classList.add("lce-cart-"+p+"-button-container"),I.id=generateElementId({prefix:"lce-cart-"+p+"-btn"}),E){case"above":null===(a=P.parentNode)||void 0===a?void 0:a.insertBefore(I,P);break;case"below":null===(c=P.parentNode)||void 0===c?void 0:c.insertBefore(I,P.nextSibling);break;case"replace":null===(l=P.parentNode)||void 0===l?void 0:l.replaceChild(I,P);break;default:P.appendChild(I)}t.ui.cartButton(I.id,b)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",d)}}async function setupCartButtons(t,e){e.hasAttribute(Pt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,Pt.CART.BUTTON,Pt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,e,Pt.CART.MOBILE_BUTTON,Pt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+Pt.PRODUCT_LIST.LIST+"]");if(!e)return;const n="lce-products-list-container";e.className="lce-products-list-container",e.id=n;const s=e.getAttribute(Pt.PRODUCT_LIST.CARD)||"standard",a=e.hasAttribute(Pt.PRODUCT_LIST.CARD_FILL),c=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.ROWS)||"3",10)||3,l=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.COLUMNS)||"4",10)||4,d=e.getAttribute(Pt.PRODUCT_LIST.FILTERS),p=e.getAttribute(Pt.PRODUCT_LIST.PRODUCT_URL)||void 0;let m=[];d&&(m=d.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:n,rows:c,columns:l,cardVariant:s,fillCard:a,filters:m,productUrl:p})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",e)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const e=t.detail;if(!e.data.isReady)return;const n=window.elements,s=document.querySelectorAll("["+Pt.CART.TOGGLE_BUTTON+"]");if(s.length>0)for(const c of s)c.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),n.actions.cart.toggleCart()});const a=document.querySelectorAll("["+Pt.CART.ITEMS_COUNT+"]");if(a.length>0){let t=0;for(const e of a){const s=e.getAttribute(Pt.CART.ITEMS_COUNT),a=!(s&&"keep-zero"===s),c=Boolean(null==e?void 0:e.id);let l;c?l=e.id:(l=generateElementId({prefix:"lce-cart-items-count",index:t}),e.id=l),n.ui.cartItemsCount(l,{hideZero:a}),t+=1}}})}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",ot)}}function getDevelopmentConfigs(){const t=document.querySelector("script["+Pt.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(e){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",e),void 0}}async function setupCheckout(t,e){try{const n=document.querySelector("div["+Pt.CHECKOUT.CHECKOUT+"]");if(!n)return;const s="lce-checkout-container";n.className="lce-checkout-container",n.id=s;const a=e.getAttribute(Pt.CHECKOUT.PARAM)||"lce_checkout";if(!a||!startsWithLcePrefix(a))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring checkout query parameter "'+a+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),l=c.get(a);if(!l)return console.warn("[LiquidCommerce Elements Auto Initialization] Checkout ID not found in query parameters."),void 0;await t.injectCheckoutElement({containerId:s,checkoutId:l})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup checkout:",n)}}async function ElementsAutoInitialize(){var t,n,s,a,c,d;try{const d=document.querySelector("script["+Pt.CORE.MAIN_SCRIPT+"]");if(!d)return;const p=d.getAttribute(Pt.CORE.TOKEN),m=d.getAttribute(Pt.CORE.ENV)||e.PRODUCTION,f=d.getAttribute(Pt.CORE.DEBUG_MODE);if(!p)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const g=d.getAttribute(Pt.PROMO_TICKER.CODE),v=d.getAttribute(Pt.PROMO_TICKER.TEXT),b=null!==(t=d.getAttribute(Pt.PROMO_TICKER.SEPARATOR))&&void 0!==t?t:"•",C=null!==(n=d.getAttribute(Pt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,S=null!==(s=d.getAttribute(Pt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==s?s:void 0,E=d.getAttribute(Pt.CHECKOUT.URL)||void 0,_=pairsFromMainScript(d),P=pairsFromProductsScript(),I=pairsFromAttributedElements(),F=[..._,...P,...I],O=g&&v&&C&&S?{promoCode:g,text:v.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:b,activeFrom:null===(a=new Date(C))||void 0===a?void 0:a.toISOString(),activeUntil:null===(c=new Date(S))||void 0===c?void 0:c.toISOString()}:void 0;let z=l.NONE;f&&m!==e.PRODUCTION&&(z=f),setupEventListeners();const R=await Elements(p,{env:m,debugMode:z,promoTicker:O?[O]:void 0,checkoutUrl:E,development:getDevelopmentConfigs()});if(!R)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(R,d),0!==F.length&&R.injectProductElement(F).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(R),addProductToCartViaQueryParam(R,d),addPromoCodeToCartViaQueryParam(R,d),setupCheckout(R,d)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(d=null==p?void 0:p.message)&&void 0!==d?d:String(p))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ot)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ot)}},50)}catch(ot){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",ot)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new SDKError("Failed to update global configuration: "+e.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new SDKError("Failed to update product configuration: "+e.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new SDKError("Failed to update cart configuration: "+e.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new SDKError("Failed to update checkout configuration: "+e.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new SDKError("Failed to update address configuration: "+e.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:a.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:a.CART,containerId:t})}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=await this.processInjectElement({type:a.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:n.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,e){try{SingletonManager.setContext({isBuilder:!![]});const s=ClientConfigService.getInstance();s.initialize(t,{env:e.env,isBuilder:!![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,checkoutUrl:e.checkoutUrl,proxy:void 0,development:void 0});const a=s.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const c=await SingletonManager.getClient(a);if(!c.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={updateComponentGlobalConfigs:c.updateComponentGlobalConfigs.bind(c),updateProductComponent:c.updateProductComponent.bind(c),updateAddressComponent:c.updateAddressComponent.bind(c),updateCartComponent:c.updateCartComponent.bind(c),updateCheckoutComponent:c.updateCheckoutComponent.bind(c),injectElement:c.injectElement.bind(c),injectProductElement:c.injectProductElement.bind(c),injectAddressElement:c.injectAddressElement.bind(c),injectCartElement:c.injectCartElement.bind(c),injectCheckoutElement:c.injectCheckoutElement.bind(c),injectProductList:c.injectProductList.bind(c),actions:c.actions};window.elementsBuilder=l;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:s.get("version")}),l}catch(s){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",s)}catch(a){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==s?void 0:s.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==s?void 0:s.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(c){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,s,a,c)=>isSDKError(c,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:s,colno:a,error:c}),!![]):t?t(e,n,s,a,c):![];const e=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(It){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",It)}try{triggerElementsAutoInit()}catch(Tt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Tt)}}catch(Ft){console.error("[LiquidCommerce Elements] SDK initialization failed:",Ft)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});