@liquidcommerce/elements-sdk 2.6.0-beta.3 → 2.6.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +10292 -10783
- package/dist/types/core/api/api-client.service.d.ts +9 -9
- package/dist/types/core/api/auth-client.service.d.ts +3 -14
- package/dist/types/core/client/client-action.service.d.ts +7 -4
- package/dist/types/core/client/client-config.service.d.ts +1 -0
- package/dist/types/core/command/base-command.service.d.ts +2 -2
- package/dist/types/core/google-tag-manager.service.d.ts +10 -10
- package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -12
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +3 -9
- package/dist/types/core/store/interfaces/address.interface.d.ts +3 -12
- package/dist/types/core/store/interfaces/cart.interface.d.ts +3 -2
- package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
- package/dist/types/core/store/interfaces/product.interface.d.ts +11 -66
- package/dist/types/core/store/store.constant.d.ts +1 -1
- package/dist/types/core/telemetry/telemetry.interface.d.ts +0 -1
- package/dist/types/interfaces/api/address.interface.d.ts +28 -0
- package/dist/types/interfaces/api/product.interface.d.ts +107 -0
- package/dist/types/interfaces/cloud/cart.interface.d.ts +4 -4
- package/dist/types/interfaces/cloud/catalog.interface.d.ts +3 -3
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +5 -8
- package/dist/types/interfaces/cloud/index.d.ts +0 -2
- package/dist/types/interfaces/cloud/retailer.interface.d.ts +2 -2
- package/dist/types/interfaces/configs/configurations.interface.d.ts +5 -5
- package/dist/types/modules/address/address.command.d.ts +2 -3
- package/dist/types/modules/address/address.interface.d.ts +0 -7
- package/dist/types/modules/product/components/components.d.ts +2 -4
- package/dist/types/modules/product/product.commands.d.ts +2 -2
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +2 -1
- package/dist/types/modules/product-list/product-list.commands.d.ts +2 -1
- package/package.json +2 -3
- package/umd/elements.js +1 -1
- package/dist/types/interfaces/cloud/address.interface.d.ts +0 -36
- package/dist/types/interfaces/cloud/product.interface.d.ts +0 -158
- package/dist/types/modules/product/utils/helpers.d.ts +0 -3
- package/dist/types/modules/product/utils/retailer-hours.d.ts +0 -9
package/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(n,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):(n="undefined"!=typeof globalThis?globalThis:n||self,i(n.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...n){for(;this.firstChild;)this.removeChild(this.firstChild);for(const i of n)"string"==typeof i?this.appendChild(document.createTextNode(i)):this.appendChild(i)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...n){const i=document.createDocumentFragment();for(const r of n)"string"==typeof r?i.appendChild(document.createTextNode(r)):i.appendChild(r);this.insertBefore(i,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...n){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of n)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.replaceChild(r,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...n){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of n)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.insertBefore(r,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...n){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of n)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.insertBefore(r,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=n=>{const i={};for(const[r,s]of n)i[r]=s;return i})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(ut){console.warn("DOM polyfills initialization failed:",ut)}}function safeReplaceChildren(n,...i){try{if("replaceChildren"in n&&"function"==typeof n.replaceChildren)n.replaceChildren(...i);else{for(;n.firstChild;)n.removeChild(n.firstChild);for(const r of i)"string"==typeof r?n.appendChild(document.createTextNode(r)):n.appendChild(r)}}catch(r){console.error("replaceChildren operation failed:",r),1===i.length&&"string"==typeof i[0]&&(n.innerHTML=i[0])}}class SDKError extends Error{constructor(n,i=![]){super(n),this.name="SDKError",this.isSdk=!![],this.reThrow=i,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(n,i){if((null==n?void 0:n.isSdk)===!![])return n instanceof SDKError&&n.reThrow?![]:!![];if(!n||"object"!=typeof n)return i?isSDKSource(i):![];const r=String((null==n?void 0:n.message)||""),s=/liquidcommerce\s+elements/i.test(r),a=String((null==n?void 0:n.stack)||""),l=(null==n?void 0:n.source)||i||"",d=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],u=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],f=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],g=[/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],v=isSDKSource(l),b=d.some(n=>n.test(a)),x=u.some(n=>n.test(a)),w=f.some(n=>n.test(a)),C=g.some(n=>n.test(a));return s||v||b||x||w||C}function isSDKSource(n){if(!n||"string"!=typeof n)return![];const i=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return i.some(i=>i.test(n))}var n,i,r,s,a,l,d,u,f,g,v;(function(n){n.ALE="BEER > ALE",n.LAGER="BEER > LAGER",n.BASE="BEER",n.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",n.OTHER_BEER="BEER > OTHER",n.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",n.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",n.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER"})(n||(n={})),function(n){n.BASE="FOOD",n.PANTRY_OTHER="FOOD > PANTRY > OTHER",n.CANDY="FOOD > CANDY",n.CANDY_OTHER="FOOD > CANDY > OTHER",n.CBD="FOOD > CBD",n.CBD_OTHER="FOOD > CBD > OTHER",n.CHEESE="FOOD > CHEESE",n.CHEESE_OTHER="FOOD > CHEESE > OTHER",n.HOUSEHOLD="FOOD > HOUSEHOLD",n.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",n.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",n.PANTRY="FOOD > PANTRY",n.FRUIT="FOOD > FRUIT",n.OTHER="FOOD > OTHER",n.ICE="FOOD > ICE",n.ICE_CREAM="FOOD > ICE CREAM",n.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",n.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",n.SPIRITS_BASED="FOOD > SPIRITS BASED",n.GARNISHES="FOOD > GARNISHES"}(i||(i={})),function(n){n.BASE="MERCHANDISE",n.GLASSWARE="MERCHANDISE > GLASSWARE",n.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",n.HUMIDOR="MERCHANDISE > HUMIDOR",n.ACCESSORY="MERCHANDISE > ACCESSORY",n.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",n.GIFT_SET="MERCHANDISE > GIFT SET",n.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",n.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",n.BAR_TOOLS="MERCHANDISE > BAR TOOLS",n.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",n.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER"}(r||(r={})),function(n){n.BASE="MISCELLANEOUS",n.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",n.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",n.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP"}(s||(s={})),function(n){n.BASE="NON ALCOHOLIC",n.BITTERS="NON ALCOHOLIC > BITTERS",n.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",n.COFFEE="NON ALCOHOLIC > COFFEE",n.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",n.JUICE="NON ALCOHOLIC > JUICE",n.SODA="NON ALCOHOLIC > SODA",n.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",n.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",n.SPIRITS="NON ALCOHOLIC > SPIRITS",n.TEA="NON ALCOHOLIC > TEA",n.WATER="NON ALCOHOLIC > WATER",n.WINE="NON ALCOHOLIC > WINE",n.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",n.SLURPEES="NON ALCOHOLIC > SLURPEES",n.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",n.DAIRY="NON ALCOHOLIC > DAIRY",n.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",n.OTHER="NON ALCOHOLIC > OTHER"}(a||(a={})),function(n){n.BASE="READY TO DRINK",n.HARD_CIDER="READY TO DRINK > HARD CIDER",n.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",n.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",n.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",n.HARD_TEA="READY TO DRINK > HARD TEA",n.HARD_SELTZER="READY TO DRINK > HARD SELTZER",n.MALT_BASED="READY TO DRINK > MALT BASED",n.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",n.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",n.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",n.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",n.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",n.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",n.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",n.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",n.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",n.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",n.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",n.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",n.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",n.OTHER="READY TO DRINK > OTHER"}(l||(l={})),function(n){n.BASE="SPIRITS",n.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",n.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",n.BAIJIU="SPIRITS > BAIJIU",n.BITTERS="SPIRITS > BITTERS",n.BRANDY="SPIRITS > BRANDY",n.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",n.CACHACA="SPIRITS > CACHACA",n.GIN="SPIRITS > GIN",n.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",n.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",n.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",n.GIN_OTHER="SPIRITS > GIN > OTHER",n.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",n.LIQUEUR="SPIRITS > LIQUEUR",n.MEZCAL="SPIRITS > MEZCAL",n.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",n.RUM="SPIRITS > RUM",n.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",n.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",n.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",n.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",n.RUM_OTHER="SPIRITS > RUM > OTHER",n.RUM_SPICED="SPIRITS > RUM > SPICED",n.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",n.SHOCHU="SPIRITS > SHOCHU",n.SOJU="SPIRITS > SOJU",n.SOTOL="SPIRITS > SOTOL",n.TEQUILA="SPIRITS > TEQUILA",n.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",n.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",n.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",n.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",n.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",n.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",n.VODKA="SPIRITS > VODKA",n.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",n.VODKA_OTHER="SPIRITS > VODKA > OTHER",n.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",n.WHISKEY="SPIRITS > WHISKEY",n.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",n.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",n.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",n.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",n.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",n.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",n.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",n.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH"}(d||(d={})),function(n){n.BASE="WINE",n.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",n.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",n.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",n.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",n.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",n.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",n.COOKING="WINE > COOKING",n.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",n.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",n.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",n.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",n.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",n.RED_WINE="WINE > RED WINE",n.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",n.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",n.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",n.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",n.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",n.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",n.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",n.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",n.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",n.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",n.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",n.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",n.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",n.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",n.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",n.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",n.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",n.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",n.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",n.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",n.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",n.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",n.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",n.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",n.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",n.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",n.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",n.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",n.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",n.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",n.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",n.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",n.RED_WINE_MONICA="WINE > RED WINE > MONICA",n.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",n.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",n.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",n.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",n.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",n.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",n.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",n.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",n.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",n.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",n.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",n.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",n.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",n.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",n.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",n.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",n.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",n.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",n.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",n.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",n.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",n.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",n.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",n.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",n.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",n.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",n.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",n.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",n.RED_WINE_OTHER="WINE > RED WINE > OTHER",n.ROSE_WINE="WINE > ROSE WINE",n.SAKE="WINE > SAKE",n.WHITE_WINE="WINE > WHITE WINE",n.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",n.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",n.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",n.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",n.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",n.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",n.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",n.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",n.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",n.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",n.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",n.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",n.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",n.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",n.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",n.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",n.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",n.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",n.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",n.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",n.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",n.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",n.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",n.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",n.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",n.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",n.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",n.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",n.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",n.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",n.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",n.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",n.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",n.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",n.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",n.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",n.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",n.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",n.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",n.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",n.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",n.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",n.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",n.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",n.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",n.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",n.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",n.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",n.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",n.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",n.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",n.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",n.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",n.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",n.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",n.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",n.WINE_OTHER="WINE > OTHER"}(u||(u={})),function(n){n.BRANDS="brands",n.FLAVOR="flavor",n.FULFILLMENT="fulfillment",n.TAGS="tags",n.REGION="region",n.VARIETY="variety",n.ENGRAVING="engraving",n.PRICE="price",n.PRESALE="presale",n.AVAILABILITY="availability",n.CATEGORIES="categories",n.SIZES="sizes",n.COLORS="colors",n.APPELLATION="appellation",n.COUNTRY="country",n.VINTAGE="vintage",n.MATERIALS="materials",n.COLLECTION_TAGS="collectionTags"}(f||(f={})),function(n){n.UNSPECIFIED="AVAILABILITY_UNSPECIFIED",n.IN_STOCK="IN_STOCK",n.OUT_OF_STOCK="OUT_OF_STOCK",n.PREORDER="PREORDER",n.BACKORDER="BACKORDER"}(g||(g={})),function(n){n.YES="YES",n.NO="NO"}(v||(v={}));const b={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},x={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",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"},w={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},C={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",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"},E={ON_DEMAND:"onDemand",SHIPPING:"shipping"},T={NONE:"none",CONSOLE:"console",PANEL:"panel"},A={[b.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[b.STAGING]:"https://staging-elements.liquidcommerce.us",[b.PRODUCTION]:"https://elements.liquidcommerce.us"},P={STANDARD:"standard"},_={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"},N={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:n}){SingletonManager.currentContext=n?"builder":"regular"}static setClientConstructor(n){SingletonManager.clientConstructor=n}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(n,i){const r=SingletonManager.getInstances();r.has(n)||r.set(n,i());const s=r.get(n);if(!s)throw new SDKError("ElementsSdk: Instance for class "+n+" could not be created.");return s}static async getClient(n){const i=[n.apiKey,n.env,n.isBuilder,n.debugMode].join("_"),r="LiquidCommerceElementsClient_"+i,s=SingletonManager.getInstances();if(s.has(r))return s.get(r);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const a=new SingletonManager.clientConstructor(n);return await a.prepare(),s.set(r,a),a}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const F="lce",R={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:E.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},O={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},L={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:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},M={drawer:{isOpen:![],contentConfig:null}},B={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},W={products:{},cart:O,address:B,checkout:L,ui:M};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(n,i={}){this.validateInputs(n,i),this.config=Object.freeze(this.buildConfiguration(n,i))}getConfigs(){return{...this.config}}get(n){return this.config[n]}set(n,i){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[n]:i})}isDevelopment(){return this.get("env")===b.DEVELOPMENT}isStaging(){return this.get("env")===b.STAGING}isProduction(){return this.get("env")===b.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const n=this.get("debugMode");return n===T.CONSOLE||n===T.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===T.PANEL}debuggingDisabled(){const n=this.get("debugMode");return n===T.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(n,i){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(i.env&&!Object.values(b).includes(i.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+i.env+'". Using default environment.'),i.env=void 0),void 0!==i.isBuilder&&"boolean"!=typeof i.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),i.isBuilder=void 0),void 0===i.debugMode||Object.values(T).includes(i.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+i.debugMode+'". Must be one of: '+Object.values(T).join(", ")+". Using default value."),i.debugMode=void 0),i.promoTicker&&"object"!=typeof i.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),i.promoTicker=void 0),i.promoTicker)if(Array.isArray(i.promoTicker)){const n=i.promoTicker.filter((n,i)=>{if("string"!=typeof n.promoCode||!n.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(n.text)||0===n.text.length||!n.text.every(n=>"string"==typeof n&&n.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof n.separator||!n.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!n.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom is required. Skipping this promo."),![];const r="string"==typeof n.activeFrom?new Date(n.activeFrom):n.activeFrom;if(!(r instanceof Date)||Number.isNaN(r.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!n.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof n.activeUntil?new Date(n.activeUntil):n.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?r>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});i.promoTicker=n.length>0?n:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),i.promoTicker=void 0;i.proxy&&("object"!=typeof i.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),i.proxy=void 0):i.proxy.baseUrl&&"string"==typeof i.proxy.baseUrl?i.proxy.headers&&"object"!=typeof i.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),i.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),i.proxy=void 0))}buildConfiguration(n,i){var r,s,a;const l=i.env||b.PRODUCTION;let d=A[l];const u=l===b.PRODUCTION,f=i.isBuilder||![],g=F+(u?"":"_"+l)+(f?"builder":"");return(null===(r=i.development)||void 0===r?void 0:r.customApiUrl)&&(d=i.development.customApiUrl),{apiKey:n.trim(),env:l,isBuilder:f,debugMode:i.debugMode||T.NONE,baseUrl:d,partnerCode:void 0,partnerName:void 0,customTheme:i.customTheme||null,proxy:i.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:g,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:i.promoTicker||null,paymentMethodId:(null===(s=i.development)||void 0===s?void 0:s.paymentMethodId)||void 0,openShadowDom:u?![]:(null===(a=i.development)||void 0===a?void 0:a.openShadowDom)||![]}}detectDeviceType(){var n,i;if("undefined"==typeof navigator)return"desktop";const r=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,a=(null===(n=window.screen)||void 0===n?void 0:n.width)||0,l=(null===(i=window.screen)||void 0===i?void 0:i.height)||0,d=Math.max(a,l),u=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],f=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return u.some(n=>n.test(r))?"tablet":f.some(n=>n.test(r))||s&&d<768?"mobile":s&&d>=768&&d<=1200||s&&/macintosh/i.test(r)&&navigator.maxTouchPoints>1||/android/i.test(r)&&s&&d>=768||/windows nt/i.test(r)&&s&&d>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(r),"desktop")}}class LoggerService{constructor(n){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=n}static getInstance(n){return SingletonManager.getClassInstance("LoggerService_"+n,()=>new LoggerService(n))}setEnableLogging(n){this.enableLogging=n}setTelemetryService(n){this.telemetryService=n}getPrefix(n){if(!this.enableLogging)return[];const i=(new Date).toISOString().slice(11,23);return["%c["+i+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[n],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[n],"color: "+this.colors[n]]}debug(n,i){if(this.sendToTelemetry("debug",n,void 0,i),!this.enableLogging)return;const[r,...s]=this.getPrefix("debug");void 0!==i?console.debug(r,...s,n,i):console.debug(r,...s,n)}info(n,i){if(!this.enableLogging)return;const[r,...s]=this.getPrefix("info");void 0!==i?console.info(r,...s,n,i):console.info(r,...s,n)}warn(n,i){if(this.sendToTelemetry("warn",n,void 0,i),!this.enableLogging)return;const[r,...s]=this.getPrefix("warn");void 0!==i?console.warn(r,...s,n,i):console.warn(r,...s,n)}error(n,i){const r=i instanceof Error,s=r?i:void 0,a=!r&&i?i:void 0;if(this.sendToTelemetry("error",n,s,a),!this.enableLogging)return;const[l,...d]=this.getPrefix("error");void 0!==i?console.error(l,...d,n,i):console.error(l,...d,n)}sendToTelemetry(n,i,r,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(n,i,{context:this.context,error:r,data:s})}catch(a){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(n){const i=this.getInstances();if(!i.has(n)){const r=LoggerService.getInstance(n);r.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&r.setTelemetryService(this.telemetryService),i.set(n,r)}return i.get(n)}static setEnableLogging(n){this.enableLoggingGlobally=n;const i=this.getInstances();for(const[,r]of i)r.setEnableLogging(n)}static setTelemetryService(n){this.telemetryService=n;const i=this.getInstances();for(const[,r]of i)r.setTelemetryService(n)}}function componentError({componentType:n,message:i}){const r=document.createElement("div");r.className=n;const s=r.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 l=document.createElement("div"),d=document.createElement("h3");d.textContent="Component </"+n+">";const u=document.createElement("p");return u.textContent=i,l.appendChild(a),l.appendChild(d),l.appendChild(u),s.appendChild(l),r}function productionComponentError({title:n,message:i,componentType:r}){const s=document.createElement("div");s.setAttribute("data-component-type",r);const a=s.attachShadow({mode:"closed"}),l=document.createElement("style");l.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const d=document.createElement("div"),u=document.createElement("h2");u.textContent=n;const f=document.createElement("p");return f.textContent=i,d.appendChild(l),d.appendChild(u),d.appendChild(f),a.appendChild(d),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(n,i){ComponentFactoryService.getComponentRegistry().set(n,i)}static createElement(n){try{const i=ComponentFactoryService.getComponentRegistry().get(n.type);if(!i)throw new SDKError("Component type ["+n.type+"] is not registered");const r=ComponentFactoryService.getComponentTagName(n.type);window.customElements.get(r)||window.customElements.define(r,i);const s=document.createElement(r);if(s.initialize){const{type:i,useShadowDom:a,wrapInLceElement:l,...d}=n,u={type:i,tagName:r,useShadowDom:a&&l!==!![]};s.initialize({data:d,config:u})}if(n.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(C.LCE_ELEMENT),r=ComponentFactoryService.getComponentTagName(C.LCE_ELEMENT);window.customElements.get(r)||window.customElements.define(r,i);const a=document.createElement(r);return a.initialize(n.type,s),a}return s}catch(i){return ComponentFactoryService.logger.error("Failed to create component </"+n.type+">",i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n.type}):componentError({componentType:n.type,message:(null==i?void 0:i.message)||i})}}static componentError({componentType:n,message:i}){return ComponentFactoryService.logger.error("Component type "+n+" failed to load: "+i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({componentType:n,message:i})}static getComponentTagName(n){const i={[C.DRAWER]:"drawer-lc",[C.INPUT]:"input-lc",[C.BIRTHDATE_INPUT]:"birthdate-input-lc",[C.ENGRAVING_FORM]:"engraving-form-lc",[C.ENGRAVING_VIEW]:"engraving-view-lc",[C.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[C.POWERED_BY]:"powered-by-lc",[C.LCE_ELEMENT]:"lce-element",[C.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[C.ALERT]:"alert-lc",[C.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[C.ADDRESS]:"address-lc",[C.ADDRESS_INPUT]:"address-input-lc",[C.ADDRESS_DISPLAY]:"address-display-lc",[C.PRODUCT]:"product-lc",[C.PRODUCT_OPTIONS]:"product-options-lc",[C.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[C.PRODUCT_INTERACTIONS]:"product-interactions-lc",[C.PRODUCT_DESCRIPTION]:"product-description-lc",[C.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[C.PRODUCT_RETAILERS]:"product-retailers-lc",[C.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[C.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[C.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[C.PRODUCT_PRICE]:"product-price-lc",[C.PRODUCT_DRAWER]:"product-drawer-lc",[C.PRODUCT_LOADING]:"product-loading-lc",[C.PRODUCT_LIST]:"product-list-lc",[C.PRODUCT_LIST_CARD]:"product-list-card-lc",[C.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[C.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[C.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[C.CART]:"cart-lc",[C.CART_RETAILER]:"cart-retailer-lc",[C.CART_ITEM]:"cart-item-lc",[C.CART_FOOTER]:"cart-footer-lc",[C.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[C.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[C.CART_PROMO_CODE]:"cart-promo-code-lc",[C.CART_HEADER]:"cart-header-lc",[C.CART_BODY]:"cart-body-lc",[C.CART_FULFILLMENT]:"cart-fulfillment-lc",[C.CHECKOUT]:"checkout-lc",[C.CHECKOUT_INFORMATION]:"checkout-information-lc",[C.CHECKOUT_PAYMENT]:"checkout-payment-lc",[C.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[C.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[C.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[C.CHECKOUT_BILLING]:"checkout-billing-lc",[C.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[C.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[C.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[C.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[C.CHECKOUT_ITEMS]:"checkout-items-lc",[C.CHECKOUT_COMPLETED]:"checkout-completed-lc",[C.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[C.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[C.CHECKOUT_BUYER]:"checkout-buyer-lc",[C.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[C.CHECKOUT_TIPS]:"checkout-tips-lc",[C.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[C.CHECKOUT_ITEM]:"checkout-item-lc",[C.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[C.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[C.CHECKOUT_HEADER]:"checkout-header-lc",[C.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[C.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[C.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return i[n]||n.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(n,i){this.publishSpecific("actions."+n,i)}publishForm(n,i){this.publishSpecific("forms."+n,i)}publishSpecific(n,i){const[r,s]=n.includes(".")?n.split(".",2):["actions",n];let a=s.split("_")[0];["product","cart","address","checkout"].includes(a)||(a="other");const l=Date.now(),d={eventId:"evt_"+l+"_"+Math.random().toString(36).slice(2,9),namespace:r,event:s,originalEvent:n,actionNamespace:"actions"===r?a:void 0,timestamp:l},u={data:i,metadata:d};this.dispatchNativeEvents(n,u)}dispatchNativeEvents(n,i){const[r]=n.split(".",2);try{"actions.client_ready"===n&&(this.clientReadyEvent=i);const s=new CustomEvent(this.eventPrefix+":"+n,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const a=new CustomEvent(this.eventPrefix+":"+r,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(a)}catch(s){this.logger.error("Error dispatching native events for "+n,s)}}setupClientReadyBuffering(){const n=window.addEventListener,i=this.eventPrefix+":actions.client_ready";window.addEventListener=(r,s,a)=>{if(r!==i)return n.call(window,r,s,a);if(!this.clientReadyEvent)return n.call(window,r,s,a);try{const n=new CustomEvent(i,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof s?s(n):s&&"function"==typeof s.handleEvent&&s.handleEvent(n)}catch(l){this.logger.error("Error replaying CLIENT_READY event",l)}return n.call(window,r,s,a)}}}function centToDollar(n){return n/100}function formatCentToDollarText(n,i=!![]){const r=Math.floor(n/100),s=n%100;let a="$"+r.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||s>0)&&(a+=".",a+=s<10?"0"+s:s.toString()),a}function htmlStringToElement(n){const i=document.createElement("template");return i.innerHTML=n.trim(),i.content.firstElementChild}function format24TimeTo12$1(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new SDKError("Invalid time format: "+n);const r=Number.parseInt(i[1],10),s=Number.parseInt(i[2],10);if(r<0||r>23||s<0||s>59)throw new SDKError("Invalid time values: "+n);const a=r>=12?"PM":"AM",l=r%12||12;return l+":"+s.toString().padStart(2,"0")+" "+a}function formatISODateToMMDDYYYY(n){if(!n)return"";try{const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const r=(i.getMonth()+1).toString().padStart(2,"0"),s=i.getDate().toString().padStart(2,"0"),a=i.getFullYear().toString();return r+"/"+s+"/"+a}catch(i){return""}}function buildFormattedAddressString(n){const i=[],r=[];n.one&&n.one.trim()&&r.push(n.one.trim()),n.two&&n.two.trim()&&r.push(n.two.trim()),r.length>0&&i.push(r.join(" ")),n.city&&n.city.trim()&&i.push(n.city.trim());const s=[];return n.state&&n.state.trim()&&s.push(n.state.trim()),n.zip&&n.zip.trim()&&s.push(n.zip.trim()),s.length>0&&i.push(s.join(" ")),n.country&&n.country.trim()&&i.push(n.country.trim()),i.join(", ")}function capitalizeFirstLetter(n){return n?n.toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.substring(1)).join(" "):n}function splitCategoryPath(n){const i=(null==n?void 0:n.split(" > ").map(n=>capitalizeFirstLetter(n.trim())))||[];return{category:i[0]||"",category2:i[1]||"",category3:i[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(n){this.client=n}async getAllConfigs(){try{this.ensureClientInitialized();const n=await this.client.get("/configs");if(!this.validResponseData(n))throw this.logger.error("Invalid response data",n),new SDKError("Failed to fetch all configs: Invalid response data");return n.data}catch(n){throw this.logger.error("Error fetching configs",n),n}}async setPersistedStore(n,i){try{if(this.ensureClientInitialized(),!n)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!i||0===Object.keys(i).length)return this.logger.error("No data provided to set persisted store"),void 0;const r=await this.client.post("/configs/store/"+n,{body:i});200!==r.statusCode&&this.logger.error("Failed to set persisted store",r)}catch(r){this.logger.error("Error setting persisted store",r)}}async getPersistedStore(n){try{if(this.ensureClientInitialized(),!n)return this.logger.error("User device ID is required to get persisted store"),null;const i=await this.client.get("/configs/store/"+n);return 200!==i.statusCode?(this.logger.error("Failed to fetch persisted store",i),null):i.data}catch(i){return this.logger.error("Error fetching persisted store",i),null}}async deletePersistedStore(n){try{if(this.ensureClientInitialized(),!n)return this.logger.error("User device ID is required to delete persisted store"),void 0;const i=await this.client.delete("/configs/store/"+n);200!==i.statusCode&&this.logger.error("Failed to delete persisted store",i)}catch(i){this.logger.error("Error deleting persisted store",i)}}async getProductsData(n,i){try{if(this.ensureClientInitialized(),0===n.length)return this.logger.error("No product identifiers provided"),null;const r={upcs:n,ids:n,grouping:n,shouldShowOffHours:!![],isLegacy:!![],loc:i},s=await this.client.post("/cloud/catalog/availability",{body:r});return 200!==s.statusCode?(this.logger.error("Failed to fetch product data",s),null):{products:s.products,retailers:s.retailers}}catch(r){return this.logger.error("Error fetching product data",r),null}}async getCartData(n){try{this.ensureClientInitialized();const i=await this.client.get("/cloud/cart"+(n?"?id="+n:""));if(200!==i.statusCode)throw this.logger.error("Failed to fetch cart data",i),new SDKError("Failed to fetch cart data: "+i.message);return i.cart}catch(i){throw this.logger.error("Error fetching cart data",i),i}}async updateCart(n){try{this.ensureClientInitialized();const i=await this.client.put("/cloud/cart",{body:n});if(200!==i.statusCode)throw this.logger.error("Failed to update cart",i),new SDKError("Failed to update cart: "+i.message);return i.cart}catch(i){throw this.logger.error("Error updating cart",i),i}}async getAddressSuggestions(n){try{if(this.ensureClientInitialized(),!n||0===n.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const i=await this.client.get("/cloud/address/autocomplete?input="+encodeURIComponent(n));return 200!==i.statusCode?(this.logger.error("Failed to fetch address suggestions",i),[]):i.data}catch(i){return this.logger.error("Error fetching address suggestions",i),[]}}async getAddressDetails(n){try{if(this.ensureClientInitialized(),!n||0===n.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const i=await this.client.get("/cloud/address/details/"+n);if(200!==i.statusCode)throw this.logger.error("Failed to fetch address details",i),new SDKError("Failed to fetch address details: "+i.message);return i.data}catch(i){throw this.logger.error("Error fetching address details",i),i}}async prepareCheckout(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/prepare",{body:n});if(200!==i.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",i),new SDKError("Failed to fetch prepare checkout data: "+i.message);return i.checkout}catch(r){throw this.logger.error("Error fetching prepare checkout data:",null!==(i=null==r?void 0:r.message)&&void 0!==i?i:r),r}}async getPaymentSession(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/payment/session",{body:n});if(201!==i.statusCode)throw this.logger.error("Failed to get payment session",i),new SDKError("Failed to get payment session: "+i.message);return i.data}catch(r){throw this.logger.error("Error fetching payment session:",null!==(i=null==r?void 0:r.message)&&void 0!==i?i:r),r}}async confirmPaymentSession(n,i){try{this.ensureClientInitialized();const r=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:n,setupIntentId:i}});if(200!==r.statusCode)throw this.logger.error("Failed to confirm payment session",r),new SDKError("Failed to confirm payment session: "+r.message);return r.data}catch(r){throw this.logger.error("Error confirming payment session",r),r}}async checkoutComplete(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/complete",{body:n});if(200!==i.statusCode)throw this.logger.error("Failed to complete checkout",i),new SDKError("Failed to complete checkout: "+i.message);return i.order}catch(r){if(this.logger.error("Error completing checkout:",null!==(i=null==r?void 0:r.message)&&void 0!==i?i:r),null==r?void 0:r.error)throw new SDKError(r.error);throw r}}async catalogSearch(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/catalog/search",{body:n});if(200!==i.statusCode)throw this.logger.error("Failed to fetch catalog search data",i),new SDKError("Failed to fetch catalog search data: "+i.message);return{products:i.products,retailers:i.retailers,navigation:i.navigation}}catch(r){return this.logger.error("Error fetching catalog search data:",null!==(i=null==r?void 0:r.message)&&void 0!==i?i:r),{products:[],retailers:[],navigation:void 0}}}validResponseData(n){return n.data&&"object"==typeof n.data&&Object.keys(n.data).length>0}ensureClientInitialized(){if(!this.client)throw new SDKError("API client is not initialized")}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(n,i)=>n||i&&i.status>=500&&i.status<600?!![]:![],this.xhrFetch=(n,i)=>new Promise((r,s)=>{const a=new XMLHttpRequest;a.open(i.method||"GET",n);for(const[n,l]of Object.entries(i.headers))a.setRequestHeader(n,l);a.onload=()=>{const n={ok:a.status>=200&&a.status<300,status:a.status,statusText:a.statusText,headers:a.getAllResponseHeaders().split("\r\n").reduce((n,i)=>{const[r,s]=i.split(": ");return r&&s&&(n[r]=s),n},{}),o:a.responseText,json:()=>Promise.resolve(JSON.parse(a.responseText)),text:()=>Promise.resolve(a.responseText)};r(n)},a.onerror=()=>{s(new TypeError("Network request failed"))},a.ontimeout=()=>{s(new TypeError("Network request timed out"))},a.timeout=3e4,a.send(i.body)}),this.fetchImpl=this.getFetchImplementation()}async request(n){var i,r,s;const{url:a,options:l,retryConfig:d}=n,u=null!==(i=null==d?void 0:d.maxRetries)&&void 0!==i?i:3,f=null!==(r=null==d?void 0:d.retryDelay)&&void 0!==r?r:1e3,g=null!==(s=null==d?void 0:d.shouldRetry)&&void 0!==s?s:this.defaultShouldRetry;let v;const b=Date.now();for(let w=0;w<=u;w++){let n=Date.now();try{n=Date.now();const i=await this.fetchImpl(a,l),r=Date.now()-n;if(i.ok)return i;if(await this.logFailedResponse(a,l,i,r,w,u),w<u&&g(null,i)){await this.delay(f*2**w);continue}return i}catch(x){const i=Date.now()-n;if(v=x,this.logNetworkError(a,l,x,i,w,u),w<u&&g(x,void 0)){await this.delay(f*2**w);continue}throw this.enhanceError(x,a,l,Date.now()-b)}}throw this.enhanceError(v,a,l,Date.now()-b)}async logFailedResponse(n,i,r,s,a,l){const d=a<l;let u,f;try{r.o||(r.o=await r.text());try{u=JSON.parse(r.o)}catch(g){u=r.o}}catch(v){u="[Unable to read response body]"}if(i.body)try{f=JSON.parse(i.body)}catch(b){f=i.body}this.logger.error("HTTP request failed",{method:i.method,url:n,status:r.status,statusText:r.statusText,duration:s+"ms",attempt:a+1+"/"+(l+1),willRetry:d,requestHeaders:this.sanitizeHeaders(i.headers),requestBody:f,responseHeaders:this.sanitizeHeaders(r.headers),responseBody:u})}logNetworkError(n,i,r,s,a,l){var d;const u=a<l;this.logger.error("Network request failed",{method:i.method,url:n,error:(null==r?void 0:r.message)||"Unknown error",errorType:(null===(d=null==r?void 0:r.constructor)||void 0===d?void 0:d.name)||typeof r,duration:s+"ms",attempt:a+1+"/"+(l+1),willRetry:u,possibleCauses:this.diagnosePossibleCauses(r)})}diagnosePossibleCauses(n){var i,r,s,a,l;const d=[];return((null===(i=null==n?void 0:n.message)||void 0===i?void 0:i.includes("timeout"))||(null===(r=null==n?void 0:n.message)||void 0===r?void 0:r.includes("timed out")))&&d.push("Request timeout - server took too long to respond"),((null===(s=null==n?void 0:n.message)||void 0===s?void 0:s.includes("Failed to fetch"))||(null===(a=null==n?void 0:n.message)||void 0===a?void 0:a.includes("Network request failed")))&&(d.push("Network connectivity issue"),d.push("CORS policy blocking the request"),d.push("Server is not responding"),d.push("Request was blocked by browser or firewall")),(null===(l=null==n?void 0:n.message)||void 0===l?void 0:l.includes("aborted"))&&d.push("Request was aborted"),0===d.length&&d.push("Unknown network error"),d}enhanceError(n,i,r,s){const a=new Error((null==n?void 0:n.message)||"Network request failed - no response from server");return a.url=i,a.method=r.method,a.totalDuration=s+"ms",a.isNetworkError=!![],a.originalError=n,a.possibleCauses=this.diagnosePossibleCauses(n),a}sanitizeHeaders(n){const i={...n},r=["authorization","x-liquid-api-key","cookie","set-cookie"];for(const s of Object.keys(i))r.includes(s.toLowerCase())&&(i[s]="[REDACTED]");return i}delay(n){return new Promise(i=>setTimeout(i,n))}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(n){return async(i,r)=>{var s;const a=await n(i,r);let l;if("function"==typeof(null===(s=a.headers)||void 0===s?void 0:s.entries))l=Object.fromEntries(a.headers.entries());else{l={};for(const[n,i]of a.headers)l[n]=i}const d={ok:a.ok,status:a.status,statusText:a.statusText,headers:l,json:async()=>(d.o||(d.o=await a.text()),JSON.parse(d.o)),text:async()=>(d.o||(d.o=await a.text()),d.o)};return d}}}class AuthClientService{constructor(n){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=n.apiKey,this.baseUrl=n.baseUrl,this.env=n.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(n){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(n))}async authenticate(){var n,i;if(this.isAuthenticating)return await new Promise(n=>{const t=()=>{this.isAuthenticating?setTimeout(t,100):n(void 0)};t()}),!!this.accessToken;this.isAuthenticating=!![];try{const r=await this.request("/auth",{method:"GET"},!![]),s=3e5;return this.accessToken=null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.token,this.tokenExpiration=(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.exp)-s,!![]}catch(r){return this.logger.error("Authentication failed",r),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(n,i,r=![]){var s;r||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const a=this.buildUrl(n),l={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...i.headers};r?l["X-Liquid-Api-Key"]=this.apiKey:l.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(l["X-Liquid-Api-Builder"]=!![]);const d={method:i.method,headers:l,body:i.body?JSON.stringify(i.body):void 0},G=(n,i)=>{if(n)return!![];if(!r&&i){const n=i.status;if(401===n||403===n)return this.logger.warn("Authorization error detected, will retry with new token"),this.accessToken=null,this.tokenExpiration=null,!![]}return i&&i.status>=500&&i.status<600?!![]:![]};let u,f;try{u=await this.httpClient.request({url:a,options:d,retryConfig:{maxRetries:2,retryDelay:1e3,shouldRetry:G}})}catch(v){throw this.logger.error("Request failed after all retries",{path:n,method:i.method,authType:r?"API Key":"Bearer Token",error:null==v?void 0:v.message,possibleCauses:null==v?void 0:v.possibleCauses}),{status:0,statusCode:0,message:(null==v?void 0:v.message)||"Network error: Unable to connect to the API",url:a,method:i.method,isNetworkError:!![],originalError:v}}if(u.ok)try{return await u.json()}catch(b){const s=await u.text().catch(()=>"Success");return this.logger.error("Failed to parse successful response JSON",{path:n,method:i.method,status:u.status,authType:r?"API Key":"Bearer Token",responsePreview:s,error:null==b?void 0:b.message}),{message:s}}let g="";try{f=await u.json(),g=JSON.stringify(f)}catch(x){g=await u.text().catch(()=>"HTTP error status: "+u.status),f={message:g||"Unknown error"}}throw this.logger.error("API request failed",{path:n,method:i.method,authType:r?"API Key":"Bearer Token",status:u.status,statusText:u.statusText,statusCode:null==f?void 0:f.statusCode,message:null==f?void 0:f.message,requestId:null===(s=null==f?void 0:f.metadata)||void 0===s?void 0:s.requestId,responseBody:g}),{...f,status:u.status,message:(null==f?void 0:f.message)||"Request failed"}}buildUrl(n){const i=this.clientConfig.getProxyConfig();return new URL("api"+n,i?i.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const n=this.clientConfig.getProxyConfig();return n?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...n.headers}:{}}async get(n,i){return this.request(n,{method:"GET",headers:null==i?void 0:i.headers})}async post(n,i){return this.request(n,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}async put(n,i){return this.request(n,{method:"PUT",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}async delete(n,i){return this.request(n,{method:"DELETE",headers:null==i?void 0:i.headers})}}const H="@liquidcommerce/elements-sdk",q="LiquidCommerce Elements SDK",j="UNLICENSED",U="LiquidCommerce Team",V="2.6.0-beta.3",K="https://docs.liquidcommerce.co/elements-sdk",Q={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},Z={url:"https://github.com/liquidcommerce/elements-sdk/issues"},X="./dist/index.esm.js",J="./umd/elements.js",$="./dist/types/index.d.ts",tt="pnpm@10.0.0",et={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},nt=["dist","umd","docs","README.md","LICENSE"],it={access:"public",registry:"https://registry.npmjs.org/"},ot="module",rt=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],st={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd","clean:hard":"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},at=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],lt={"@biomejs/biome":"2.3.5","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.1","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.3","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"},ct={node:">=22"},dt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},ut={name:H,description:q,license:j,author:U,version:V,homepage:K,repository:Q,bugs:Z,module:X,browser:J,types:$,packageManager:tt,exports:et,files:nt,publishConfig:it,type:ot,sideEffects:rt,scripts:st,keywords:at,devDependencies:lt,engines:ct,pnpm:dt};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(n=>{if("loading"!==document.readyState)return n(),void 0;document.addEventListener("DOMContentLoaded",()=>n())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(n){const i=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return i.some(i=>{const r=i.src;return r.includes("id="+n)})}isContainerInitialized(n){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(n)?window.dataLayer.some(n=>n&&"object"==typeof n&&("gtm.start"in n||"gtm.js"===n.event)):![]}async loadGTMScript(n){try{if(this.isContainerInitialized(n))return{success:!![],usingExistingGTM:!![],message:"Container "+n+" already loaded"};if(this.isContainerLoaded(n)){const i=await this.waitForContainerInit(n,1e4);return i?{success:!![],usingExistingGTM:!![],message:"Container "+n+" initialized"}:this.checkFallbackGTM(n)}return await this.injectGTMScript(n),{success:!![],usingExistingGTM:![],message:"Container "+n+" loaded successfully"}}catch(i){return this.checkFallbackGTM(n)}}waitForContainerInit(n,i){return new Promise(r=>{let s;const a=setInterval(()=>{this.isContainerInitialized(n)&&(clearInterval(a),clearTimeout(s),r(!![]))},100);s=setTimeout(()=>{clearInterval(a),r(![])},i)})}injectGTMScript(n){return new Promise((i,r)=>{const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+n,s.async=!![],s.crossOrigin="anonymous";let a=![];const l=setTimeout(()=>{a||(a=!![],this.isContainerInitialized(n)?i():r(new Error("GTM script timeout")))},15e3);s.onload=()=>{a||setTimeout(()=>{a||(a=!![],clearTimeout(l),this.isContainerInitialized(n)||window.dataLayer&&Array.isArray(window.dataLayer)?i():r(new Error("GTM script loaded but failed to initialize")))},500)},s.onerror=()=>{setTimeout(()=>{a||(a=!![],clearTimeout(l),this.isContainerLoaded(n)&&this.isContainerInitialized(n)?i():r(new Error("GTM script failed to load")))},100)},document.head.appendChild(s)})}checkFallbackGTM(n){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 n=window.dataLayer.some(n=>n&&"object"==typeof n&&("gtm.start"in n||"gtm.js"===n.event));if(n)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 "+n+" and no fallback available"}}processEventQueue(){const n=Date.now(),i=this.eventQueue.filter(i=>n-i.timestamp<3e4);for(const s of i)try{const n={event:s.eventName,...s.eventData};window.dataLayer.push(n)}catch(r){this.logger.error("Error processing queued event "+s.methodName,r)}this.eventQueue=[],i.length>0&&this.logger.info("Processed "+i.length+" queued GTM events")}getSendToTargets(){const n=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&this.isContainerInitialized(this.liquidCommerceGtmId)&&n.push(this.liquidCommerceGtmId),this.partnerEnableGaTracking&&this.partnerGtmId&&this.isContainerInitialized(this.partnerGtmId)&&n.push(this.partnerGtmId),n}async initialize(n){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(n),await this.initializationPromise}catch(i){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",i)}}async doInitialize(n){if(!(null==n?void 0:n.partnerName)||!(null==n?void 0:n.liquidCommerceGtmId))return;if(!n.liquidCommerceEnableGaTracking&&!n.partnerEnableGaTracking)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=n.partnerName,this.partnerGtmId=n.partnerGtmId,this.liquidCommerceGtmId=n.liquidCommerceGtmId,this.partnerEnableGaTracking=n.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=n.liquidCommerceEnableGaTracking,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...n)=>window.dataLayer.push(n));const i=n.liquidCommerceEnableGaTracking?await this.loadGTMScript(n.liquidCommerceGtmId):{success:!![],message:"Using partner GTM only"};if(!i.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+i.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(i.message),this.processEventQueue()}executeEvent(n,i,r){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),a={...r,...s.length>0&&{send_to:s},tenant_source:ut.description+" v"+ut.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:n,eventName:i,eventData:a,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const l={event:i,...a};window.dataLayer.push(l)}catch(s){this.logger.error("GTM "+n+" error",s)}}calculateValue(n){const i=n.reduce((n,i)=>n+(i.price||0)*(i.quantity||1),0);return Number.parseFloat(i.toFixed(2))}viewItem(n){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}viewItemList(n,i,r){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:i,item_list_name:r,items:n})}selectItem(n,i,r){this.executeEvent("selectItem","select_item",{item_list_id:i,item_list_name:r,items:[n]})}addToCart(n){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([n]),quantity:n.quantity||1,items:[n]})}viewCart(n){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(n),items:n})}removeFromCart(n){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}beginCheckout(n,i){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addShippingInfo(n,i){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addPaymentInfo(n,i,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(n),payment_type:i,coupon:r,items:n})}purchase(n){this.executeEvent("purchase","purchase",{transaction_id:n.transaction_id,value:n.value,currency:this.currency,tax:n.tax,shipping:n.shipping,coupon:n.coupon,items:n.items,subtotal:n.subtotal,total:n.total_before_discounts,discounts:n.discounts,gift_cards:n.gift_cards,net_total:n.net_total})}promoCodeAttempt(n){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:n})}promoCodeApplied(n,i){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:n,discount_amount:i})}promoCodeFailed(n,i){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:n,reason:i})}giftCardAttempt(n){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:n})}giftCardApplied(n,i){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:n,applied_amount:i})}giftCardFailed(n,i){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:n,reason:i})}addressUpdated(n){this.executeEvent("addressUpdated","address_updated",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,coordinates:n.coordinates})}addressFailed(n){this.executeEvent("addressFailed","address_failed",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,address_error_message:n.error})}productNoAvailability(n){this.executeEvent("productNoAvailability","product_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productSizeNoAvailability(n){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productFulfillmentNoAvailability(n){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,fulfillment_type:n.fulfillmentType,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:n,payload:i,next:r})=>{const s=performance.now();try{const a=r(),l=performance.now()-s;return this.logger.info("🏪 Store "+n+" ✓ "+l.toFixed(3)+"ms",i),a}catch(a){const r=performance.now()-s;throw this.logger.error("🏪 Store "+n+" ✗ "+r.toFixed(3)+"ms",{payload:i,error:a}),a}},this.performanceMiddleware=({action:n,next:i})=>{const r=performance.now(),s=i(),a=performance.now()-r;return a>16&&this.logger.warn('⚠️ Slow store operation "'+n+'": '+a.toFixed(2)+"ms"),s},this.state=W,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:n,isLocalStorageAvailable:i,persistedStore:r}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+n,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():r&&await this.loadFromDBPersistence(r),this.logger.info("Store service initialized successfully",{userDeviceId:n,isLocalStorageAvailable:i,hasPersistedState:null!==r,localStorageKey:this.localStorageKey})}get(n){if(!n)return{...this.state};const i=n.split(".");let r=this.state;for(const s of i){if(null==r)return;r=r[s]}return void 0!==r?Array.isArray(r)?[...r]:"object"==typeof r&&null!==r?{...r}:r:void 0}set(n,i){return this.runWithMiddleware("set",{path:n,value:i},()=>{const r=this.get(n);return this.state=this.immutableSet(this.state,n,i),this.notifyListeners(n,i,r),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(n,i){const r=this.get(n),s=i(r);return this.set(n,s)}remove(n){return this.runWithMiddleware("remove",{path:n},()=>{const i=this.get(n);if(void 0===i)return this.logger.warn('No value found at path "'+n+'" to remove.'),![];const r=n.split(".");let s=this.state;const a=r.pop();for(const l of r){if(void 0===s[l])return this.logger.warn('Path "'+n+'" does not exist in the state.'),![];s=s[l]}if(Array.isArray(s))s=s.filter((n,i)=>i!==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 "'+n+'".'),![];{const{[a]:n,...i}=s;s=i}}return this.state=this.immutableSet(this.state,r.join("."),s),this.notifyListeners(n,void 0,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(n){return this.runWithMiddleware("batch",{updates:n},()=>{const i=[];if("function"==typeof n){const r=n(this.state);for(const[n,s]of Object.entries(r)){const r=this.get(n);i.push({path:n,oldValue:r,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,s)}}else for(const[r,s]of Object.entries(n)){const n=this.get(r);i.push({path:r,oldValue:n,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,r,s)}for(const{path:n,oldValue:r,newValue:s}of i)this.notifyListeners(n,s,r);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(n,i){const r=n;return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(i),()=>{var n;null===(n=this.listeners.get(r))||void 0===n?void 0:n.delete(i)}}watchMany(n,i){const r=[];let s;const a=n.map(n=>this.watch(n,(a,l)=>{r.push({path:n,value:a,oldValue:l}),clearTimeout(s),s=setTimeout(()=>{r.length>0&&(i([...r]),r.length=0)},0)}));return()=>{for(const n of a)n()}}createProductInstance(n){const i="products."+n,r=this.get(i);return r?!![]:this.set(i,R)}removeProductInstance(n){const i=this.get("products"),{[n]:r,...s}=i;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(n,i,r){let s=0;const y=()=>{if(s>=this.middleware.length)return r();const a=this.middleware[s++];return a({action:n,payload:i,state:this.getState(),next:y})};return y()}immutableSet(n,i,r){const s=i.split(".");if(1===s.length){if(Array.isArray(n)){const i=[...n];return i[s[0]]=r,i}return{...n,[s[0]]:r}}const[a,...l]=s,d=n[a],u=Array.isArray(d)?[]:{};if(Array.isArray(n)){const i=[...n];return i[a]=this.immutableSet(d||u,l.join("."),r),i}return{...n,[a]:this.immutableSet(d||u,l.join("."),r)}}notifyListeners(n,i,r){const s=this.listeners.get(n);if(s)for(const u of s)try{u(i,r)}catch(l){this.logger.error('Error in store listener for path "'+n+'"',l)}const a=n.split(".");for(let u=a.length-1;u>0;u--){const n=a.slice(0,u).join("."),i=this.listeners.get(n);if(i){const s=this.get(n),l=a.slice(u).join("."),f=this.immutableSet(s,l,r);for(const r of i)try{r(s,f)}catch(d){this.logger.error('Error in store listener for parent path "'+n+'"',d)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var n;const i=this.get("address.id")||"",r=this.get("cart.id")||"";if(!i&&!r)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:i,cartId:r}),void 0;try{const s=null!==(n=this.clientConfig.get("userDeviceId"))&&void 0!==n?n:"not_defined";await this.api.setPersistedStore(s,{p:i,c:r}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:i,cartId:r})}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(ut){this.logger.error("Failed to clear localStorage entry",ut)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let n="";if(this.clientConfig.debuggingDisabled()){const i=this.get("address.id")||"",r=this.get("cart.id")||"";(i||r)&&(n=i+":"+r)}else n=this.getState();n&&localStorage.setItem(this.localStorageKey,"string"!=typeof n?JSON.stringify(n):n)}catch(n){this.logger.error("Failed to persist store state",n)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const i=localStorage.getItem(this.localStorageKey);if(!i)return;try{const n=JSON.parse(i);for(const[i,r]of Object.entries(n))this.set(i,r);return}catch(n){if(i.includes(":")){const[n,r]=i.split(":");if(void 0!==n){const i=await this.getAddressDataFromId(n);this.set("address",i)}return void 0!==r&&this.set("cart.id",r||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:i})}}catch(i){this.logger.error("Failed to load persisted state",i),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(n){try{if(void 0!==n.p){const i=await this.getAddressDataFromId(n.p);this.set("address",i)}void 0!==n.c&&this.set("cart.id",n.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:n.p,cartId:n.c})}catch(i){this.logger.error("Failed to load session data from DB persistence",i)}}async getAddressDataFromId(n){if(!n||""===n.trim())return B;try{const i=await this.api.getAddressDetails(n);return i&&0!==Object.keys(i).length?{id:n,formattedAddress:i.formattedAddress,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""},coordinates:{lat:i.coords.lat,long:i.coords.long}}:{...B,id:n}}catch(i){return{...B,id:n}}}}const ht=[C.PRODUCT,C.PRODUCT_IMAGE_CAROUSEL,C.PRODUCT_OPTIONS,C.PRODUCT_INTERACTIONS,C.PRODUCT_DESCRIPTION,C.PRODUCT_RETAILERS,C.PRODUCT_RETAILERS_CAROUSEL,C.PRODUCT_RETAILERS_POPUP,C.PRODUCT_RETAILERS_POPUP_LIST,C.PRODUCT_PRICE,C.PRODUCT_ADD_TO_CART_SECTION,C.PRODUCT_DRAWER,C.PRODUCT_LOADING,C.ENGRAVING_FORM,C.ENGRAVING_VIEW,C.PRODUCT_LIST,C.PRODUCT_LIST_CARD,C.PRODUCT_LIST_CARD_LOADING,C.PRODUCT_LIST_FILTERS],pt=[C.ADDRESS_INPUT,C.ADDRESS_DISPLAY],mt=[C.CART,C.CART_RETAILER,C.CART_ITEM,C.CART_FOOTER,C.CART_ITEM_QUANTITY_PRICE,C.CART_RETAILER_SUBTOTAL,C.CART_PROMO_CODE,C.CART_HEADER,C.CART_BODY,C.CART_FULFILLMENT,C.BUTTONS_CART_OPEN],ft=[C.CHECKOUT,C.CHECKOUT_INFORMATION,C.CHECKOUT_STRIPE_HANDLER,C.CHECKOUT_STRIPE_FORM,C.CHECKOUT_PAYMENT,C.CHECKOUT_BILLING,C.CHECKOUT_ORDER_SUMMARY,C.CHECKOUT_PROMO_CODE,C.CHECKOUT_GIFT_CARDS,C.CHECKOUT_AMOUNTS,C.CHECKOUT_ITEMS,C.CHECKOUT_COMPLETED,C.CHECKOUT_DELIVER_TO,C.CHECKOUT_DELIVER_TO_SUMMARY,C.CHECKOUT_BUYER,C.CHECKOUT_TIPS,C.CHECKOUT_PC_GC,C.CHECKOUT_ITEM,C.CHECKOUT_ITEM_QUANTITY,C.CHECKOUT_PLACE_ORDER_BUTTON,C.CHECKOUT_HEADER,C.CHECKOUT_PRESALE_COUNTDOWN,C.CHECKOUT_PRESALE_EXPIRED,C.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(n,i="swap"){if(!n||0===n.length)return;const r=[...this.defaultFontFamilies,...n],s=r.map(n=>{const i=encodeURIComponent(n.name);return"family="+i+":wght@"+n.weights.join(";")}).join("&"),a="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+a,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(n,i="swap"){const r=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(n,i),r&&r.remove()}injectGoogleFontsResourceHints(){const n=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),i=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!n){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.googleapis.com",document.head.appendChild(n)}if(!i){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.gstatic.com",n.crossOrigin="",document.head.appendChild(n)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const n=document.createElement("link");n.rel="stylesheet",n.href=this.googleFontsUrl,n.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(n)}}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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-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: '+N.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: "+N.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 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: "+N.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: "+N.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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: "+N.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 gt={"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"},vt={backgroundColor:"--product-background-color"},yt={backgroundColor:"--cart-background-color"},bt={backgroundColor:"--address-background-color"},xt={backgroundColor:"--checkout-background-color"},wt={global:gt,product:vt,cart:yt,address:bt,checkout:xt};function getCSSVariableMapping(n){return wt[n]||{}}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(n,i){const r={},s=getCSSVariableMapping(i);for(const[a,l]of Object.entries(s)){const i=this.getValueByPath(n,a);void 0!==i&&this.isCSSValue(i)&&(r[l]=i,this.isColorVariable(l,i)&&this.generateOpacityVariants(r,l,i))}return r}extractVariablesFromPartialTheme(n,i){const r={},s=getCSSVariableMapping(i);for(const[a,l]of Object.entries(s))if(this.hasValueAtPath(n,a)){const i=this.getValueByPath(n,a);void 0!==i&&this.isCSSValue(i)&&(r[l]=i,this.isColorVariable(l,i)&&this.generateOpacityVariants(r,l,i))}return r}generateCSSVariablesString(n){return Object.entries(n).map(([n,i])=>" "+n+": "+i+";").join("\n")}updateCSSVariablesInStylesheet(n,i){if(0!==Object.keys(i).length)try{const r=this.findOrCreateRule(n);for(const[n,s]of Object.entries(i))r.style.setProperty(n,String(s))}catch(r){this.logger.warn("Failed to update CSS variables")}}getValueByPath(n,i){return i.split(".").reduce((n,i)=>n&&void 0!==n[i]?n[i]:void 0,n)}hasValueAtPath(n,i){const r=i.split(".");let s=n;for(const a of r){if(null==s||!(a in s))return![];s=s[a]}return!![]}findOrCreateRule(n){const i=":host";for(const s of Array.from(n.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===i)return s;const r=n.insertRule(i+" {}");return n.cssRules[r]}isCSSValue(n){if("string"==typeof n){if(""===n.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(n.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(n))return!![];if(/^[a-z-]+$/.test(n))return!![]}return"number"==typeof n}generateOpacityVariants(n,i,r){for(const s of this.opacityLevels){const a=i+"-"+s.suffix,l=this.addOpacityToHexColor(r,s.value);l&&(n[a]=l)}}isColorVariable(n,i){if("string"!=typeof i)return![];const r=n.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(i);return r&&s}addOpacityToHexColor(n,i){if(!n.startsWith("#"))return null;let r=n.slice(1);if(3===r.length&&(r=r.split("").map(n=>n+n).join("")),6!==r.length)return null;const s=Math.round(255*i),a=s.toString(16).padStart(2,"0");return"#"+r+a}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(n){return this.styleSheets.get(n)}generateSpecificStylesheet(n,i){const r=this.cssProcessor.extractVariablesFromTheme(i,n),s=this.cssProcessor.generateCSSVariablesString(r),a=this.getStylesheetStyles(n).join("\n\n"),l=0===s.length?"":":host { "+s+" }",d=("\n "+l+"\n\n "+a+"\n ").trim();this.createStylesheet(n,d)}createStylesheet(n,i){try{if(this.isCSSStyleSheetSupported()){const r=new CSSStyleSheet;r.replaceSync(i),this.styleSheets.set(n,r)}else this.styleSheets.set(n,i)}catch(ut){this.styleSheets.set(n,i)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}updateVariablesInStylesheet(n,i,r){const s=this.styleSheets.get(n);if(s&&"string"!=typeof s){const n=this.cssProcessor.extractVariablesFromPartialTheme(i,r);this.cssProcessor.updateCSSVariablesInStylesheet(s,n)}}getStylesheetStyles(n){switch(n){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(n){this.data=n,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(n){var i,r;const s=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),n),this.data.global.layout.showPoweredBy=s,((null===(i=n.theme)||void 0===i?void 0:i.headingFont)||(null===(r=n.theme)||void 0===r?void 0:r.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",n.theme,"global")}updateProductComponent(n){this.data.product=this.deepMerge(this.getConfigs("product"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",n.theme,"product")}updateAddressComponent(n){this.data.address=this.deepMerge(this.getConfigs("address"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",n.theme,"address")}updateCartComponent(n){this.data.cart=this.deepMerge(this.getConfigs("cart"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",n.theme,"cart")}updateCheckoutComponent(n){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",n.theme,"checkout")}getConfigs(n){return"all"===n?this.data:this.data[n]}getComponentConfig(n){return-1!==ht.indexOf(n)?this.getConfigs("product"):-1!==pt.indexOf(n)?this.getConfigs("address"):-1!==mt.indexOf(n)?this.getConfigs("cart"):-1!==ft.indexOf(n)?this.getConfigs("checkout"):void 0}getStylesheet(n){const i=this.getBaseStylesheets();if(n===C.DRAWER){const n=[...i],r=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),a=this.stylesheetGenerator.getStylesheet("checkout"),l=this.stylesheetGenerator.getStylesheet("address");return r&&n.push(r),s&&n.push(s),a&&n.push(a),l&&n.push(l),n}let r;if(pt.includes(n)||n===C.ADDRESS)r="address";else if(ht.includes(n)||n===C.PRODUCT)r="product";else if(mt.includes(n)||n===C.CART)r="cart";else{if(!ft.includes(n)&&n!==C.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+n+", returning base stylesheets only."),i;r="checkout"}const s=this.stylesheetGenerator.getStylesheet(r);return s?[...i,s]:i}getBaseStylesheets(){const n=[],i=this.stylesheetGenerator.getStylesheet("global"),r=this.stylesheetGenerator.getStylesheet("ui");return i&&n.push(i),r&&n.push(r),n}deepMerge(n,i){const r={...n};for(const s in i)null!==i[s]&&void 0!==i[s]&&("object"!=typeof i[s]||Array.isArray(i[s])||"object"!=typeof n[s]||Array.isArray(n[s])?r[s]=i[s]:r[s]=this.deepMerge(n[s],i[s]));return r}}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 n=this.store.get("address");if(n.address.one&&n.coordinates.long&&n.coordinates.lat)return{coords:n.coordinates,address:n.address}}}const includeCartEvents=(n,i)=>n.filter(n=>i.includes(n.type)),excludeCartEvents=(n,i)=>n.filter(n=>!i.includes(n.type)),eventsForCart=n=>excludeCartEvents(n,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=n=>{const i=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],r=includeCartEvents(n,i);return r.length>0},includeCheckoutEvents=(n,i)=>n.filter(n=>i.includes(n.type)),eventsForCheckout=n=>includeCheckoutEvents(n,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=n=>includeCheckoutEvents(n,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=n=>includeCheckoutEvents(n,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=n=>{const i=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return n.some(n=>i.includes(n.type))},Ct={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},kt={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=n=>n.map(n=>({type:n.type,message:n.message,level:Ct[n.type]||"error"})),transformCheckoutEventsRaw=n=>n.map(n=>({type:n.type,message:n.message,level:kt[n.type]||"error"})),transformEventsForCart=n=>{const i=eventsForCart(n);return transformCartEventsRaw(i)},transformEventsForCheckout=n=>{const i=eventsForCheckout(n);return transformCheckoutEventsRaw(i)},transformPromoCodeCheckoutEvents=n=>{const i=promoCodeCheckoutEvents(n);return transformCheckoutEventsRaw(i)},transformGiftCardCheckoutEvents=n=>{const i=giftCardCheckoutEvents(n);return transformCheckoutEventsRaw(i)};function buildCartItemStore(n){return{id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes,loading:![],updating:![],error:null}}function buildCartTotals(n){return{subtotal:n.subtotal||0,total:n.total||0,shippingFee:n.shippingFee||0,platformFee:n.platformFee||0,giftCardTotal:n.giftCardTotal||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,discounts:n.discounts||0,quantity:n.quantity||0}}function buildRetailerStore(n){var i;return{id:n.id,name:n.name,platformFee:n.platformFee||0,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,address:n.address,total:n.total||0,deliveryFee:n.deliveryFee||0,engravingFee:n.engravingFee||0,fulfillments:(null===(i=n.fulfillments)||void 0===i?void 0:i.map(n=>n.id))||[]}}function buildFulfillmentStore(n,i){return{id:n.id,canEngrave:n.canEngrave||![],type:n.type,fees:n.fees,expectation:n.expectation,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,items:n.items||[],retailerId:i.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(n,i){var r;const s=i.formattedAddress?i:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},a={};for(const l in n.items||{}){const i=n.items[l];a[l]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,salsifyGrouping:i.salsifyGrouping,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price||0,quantity:i.quantity||0,maxQuantity:i.maxQuantity||0,unitPrice:i.unitPrice||0,mainImage:i.mainImage||"",attributes:i.attributes||{}}}return{id:n.id,promoCode:(null===(r=n.promoCode)||void 0===r?void 0:r.code)||"",items:a,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.coordinates.long}},amounts:{deliveryFee:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:0,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},itemCount:Object.values(a||{}).reduce((n,i)=>n+(i.quantity||0),0),updatedAt:n.updatedAt,createdAt:n.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(n,i=![]){var r,s,a,l,d,u;const f=this.store.get("cart");for(const v of Object.keys(f.items||{}))this.store.remove("cart.items."+v);for(const v of Object.keys(f.retailers||{}))this.store.remove("cart.retailers."+v);for(const v of Object.keys(f.fulfillments||{}))this.store.remove("cart.fulfillments."+v);const g={"cart.id":n.id,"cart.error":null,"cart.totals":buildCartTotals(n),"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(s=null===(r=n.attributes)||void 0===r?void 0:r.promoCode)||void 0===s?void 0:s.value)?{code:n.attributes.promoCode.value.toUpperCase(),discountAmount:n.attributes.promoCode.discount||0,error:null}:null};if((null===(a=n.items)||void 0===a?void 0:a.length)>0)for(const v of n.items)g["cart.items."+v.id]=buildCartItemStore(v);if((null===(l=n.retailers)||void 0===l?void 0:l.length)>0)for(const v of n.retailers)if(g["cart.retailers."+v.id]=buildRetailerStore(v),(null===(d=v.fulfillments)||void 0===d?void 0:d.length)>0)for(const n of v.fulfillments)g["cart.fulfillments."+n.id]=buildFulfillmentStore(n,v);if((null===(u=n.events)||void 0===u?void 0:u.length)>0&&(g["cart.events"]=transformEventsForCart(n.events||[])),this.store.batch(g),i){const n=this.store.get("cart"),i=this.store.get("address");this.pubSub.publishAction(x.CART_LOADED,cartDataForEventFromStore(n,i))}}async loadCart(){try{this.store.set("cart.loading",!![]);const n=this.store.get("cart"),i=await this.api.getCartData(n.id);this.syncCartFromResponse(i,!![]),i.id!==n.id&&await this.store.persist()}catch(n){const i=(null==n?void 0:n.message)||"Failed to load cart";this.store.set("cart.error",i),this.pubSub.publishAction(x.CART_FAILED,{message:i}),this.logger.error("Load cart failed",n)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(n,i){const r={type:n,data:i||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:r}),n===C.CART&&this.pubSub.publishAction(x.CART_OPENED,!![]),n===C.CHECKOUT&&this.pubSub.publishAction(x.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const n=this.store.get("ui.drawer.contentConfig");(null==n?void 0:n.type)===C.CART&&this.pubSub.publishAction(x.CART_CLOSED,!![]),(null==n?void 0:n.type)===C.CHECKOUT&&this.pubSub.publishAction(x.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(n){var i,r,s,a,l,d,u,f,g,v,b,w;try{this.store.set("checkout.loading",!![]);const C=n||this.store.get("cart.id"),T=this.store.get("cart");if(0===(null===(i=Object.values(T.items||{}))||void 0===i?void 0:i.length)&&!n)return;const A=this.themeProvider.getConfigs("checkout"),P={canEmail:A.layout.emailOptIn.checked,canSms:A.layout.smsOptIn.checked};if(!C)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const _={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},N=await this.api.prepareCheckout({cartId:C,marketingPreferences:P});if((null===(r=N.retailers)||void 0===r?void 0:r.length)>0)for(const n of N.retailers)for(const i of n.fulfillments)i.type===E.ON_DEMAND&&(_["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal});if((null===(s=N.items)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.items");for(const n of N.items){const i=N.retailers.find(i=>i.id===n.retailerId),r=i.fulfillments.find(i=>i.id===n.fulfillmentId);_["checkout.items."+n.cartItemId]=this.buildCheckoutItemStore(n,i,r)}}N.isPresaleLocked&&N.presaleExpiresAt&&(_["checkout.presale"]={isLocked:N.isPresaleLocked,expiresAt:N.presaleExpiresAt}),_["checkout.token"]=N.token,_["checkout.cartId"]=N.cartId,_["checkout.isGift"]=N.isGift,_["checkout.giftRecipientForm.data"]={firstName:((null===(l=null===(a=N.giftOptions)||void 0===a?void 0:a.recipient)||void 0===l?void 0:l.name)||"").split(" ")[0],lastName:((null===(u=null===(d=N.giftOptions)||void 0===d?void 0:d.recipient)||void 0===u?void 0:u.name)||"").split(" ")[1],email:(null===(g=null===(f=N.giftOptions)||void 0===f?void 0:f.recipient)||void 0===g?void 0:g.email)||"",phone:(null===(b=null===(v=N.giftOptions)||void 0===v?void 0:v.recipient)||void 0===b?void 0:b.phone)||"",message:(null===(w=N.giftOptions)||void 0===w?void 0:w.message)||""},_["checkout.paymentForm.billingSameAsShipping"]=N.billingSameAsShipping,_["checkout.marketingPreferences"]=N.marketingPreferences,_["checkout.giftCards"]=N.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),_["checkout.promoCode"]=N.promoCode.value?{code:N.promoCode.value,discountAmount:N.promoCode.discount}:null,_["checkout.amounts"]=N.amounts,_["checkout.events"]=N.events||[],this.store.batch(_),this.pubSub.publishAction(x.CHECKOUT_LOADED,{cartId:N.cartId})}catch(C){this.store.set("checkout.error",C.message),this.pubSub.publishAction(x.CHECKOUT_FAILED,{message:C.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(n){const i=this.store.get("checkout.isGift"),r=null!=n?n:!i,s={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":r,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":s}),this.pubSub.publishAction(x.CHECKOUT_IS_GIFT_TOGGLED,{isActive:r})}async toggleBillingSameAsShipping(n){const i=this.store.get("checkout.paymentForm.billingSameAsShipping"),r=null!=n?n:!i;this.store.set("checkout.paymentForm.billingSameAsShipping",r),this.pubSub.publishAction(x.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:r})}async toggleMarketingPreferences(n,i){const r=this.store.get("checkout.marketingPreferences."+n),s=null!=i?i:!r,a=this.store.get("checkout.marketingPreferences"),l=this.dataForCheckoutPrepare({marketingPreferences:{...a,[n]:s}}),d=await this.api.prepareCheckout(l);this.store.set("checkout.marketingPreferences",d.marketingPreferences),this.pubSub.publishAction(x.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:n,isActive:s})}async getPaymentSession(){try{const n=this.store.get("cart.id"),i=await this.api.getPaymentSession({cartId:n});this.store.batch({"checkout.paymentForm.paymentSession":{key:i.key,secret:i.secret},"checkout.paymentForm.paymentMethod":null})}catch(n){throw this.store.batch({"checkout.error":n.message,"checkout.loading":![]}),n}}async confirmPaymentSession(n,i){var r,s,a,l;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const d=await this.api.confirmPaymentSession(n,i);return d&&d.id&&d.card&&d.card.brand&&d.card.last4&&d.card.expMonth&&d.card.expYear?{id:d.id,card:{brand:null===(r=d.card)||void 0===r?void 0:r.brand,last4:null===(s=d.card)||void 0===s?void 0:s.last4.toString(),expMonth:null===(a=d.card)||void 0===a?void 0:a.expMonth.toString(),expYear:null===(l=d.card)||void 0===l?void 0:l.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(d){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(n){var i;try{this.googleTagManager.promoCodeAttempt(n);const r=this.dataForCheckoutPrepare({}),s=await this.api.prepareCheckout({...r,promoCode:n}),a=0!==s.amounts.discounts,l=null===(i=transformPromoCodeCheckoutEvents(s.events||[]))||void 0===i?void 0:i[0];if(!a)return this.store.set("checkout.promoCodeError",l?l.message:'Code "'+n+'" does not exist'),this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_FAILED,{error:(null==l?void 0:l.message)||'Code "'+n+'" does not exist'}),this.googleTagManager.promoCodeFailed(n,(null==l?void 0:l.message)||"not_applied"),void 0;this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:s.amounts.discounts,newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(n,s.amounts.discounts),await this.partialLoadCheckout({response:s})}catch(r){const i=(null==r?void 0:r.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",i),this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_FAILED,{error:i}),this.googleTagManager.promoCodeFailed(n,i),r}}async removePromoCode(){var n,i;try{const r=this.dataForCheckoutPrepare({}),s=(null===(i=null===(n=this.store.get("checkout"))||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.code)||"",a=await this.api.prepareCheckout({...r,promoCode:""});if(0!==a.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:a.amounts.total}),this.googleTagManager.promoCodeApplied(s,0),await this.partialLoadCheckout({response:a})}catch(r){const n=(null==r?void 0:r.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",n);const i=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_FAILED,{error:n}),i&&this.googleTagManager.promoCodeFailed(i,n),r}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(ut){const i=ut.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),ut}}async applyGiftCard(n){var i;const r=n.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(r);const n=this.dataForCheckoutPrepare({}),s=n.giftCards||[],a=await this.api.prepareCheckout({...n,giftCards:[...s,r]}),l=null===(i=transformGiftCardCheckoutEvents(a.events||[]))||void 0===i?void 0:i[0],d=hasAnyRetailerGiftCardRestriction(a.events||[]);if(l&&(this.store.set("checkout.giftCardError",l.message),!d))return;const u=a.giftCards.find(n=>n.code.toLowerCase()===r.toLowerCase());if(!u)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_FAILED,{error:(null==l?void 0:l.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(r,(null==l?void 0:l.message)||"not_applied"),void 0;this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(r,u.applied),await this.partialLoadCheckout({response:a})}catch(s){const n=(null==s?void 0:s.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_FAILED,{error:n}),this.googleTagManager.giftCardFailed(r,n),s}}async removeGiftCard(n){var i;const r=n.trim().toUpperCase();try{const n=this.dataForCheckoutPrepare({}),s=(null===(i=n.giftCards)||void 0===i?void 0:i.filter(n=>n.toLowerCase()!==r.toLowerCase()))||[],a=await this.api.prepareCheckout({...n,giftCards:s}),l=a.giftCards.find(n=>n.code.toLowerCase()===r.toLowerCase());if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+r),void 0;this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(r,0),await this.partialLoadCheckout({response:a})}catch(s){const n=(null==s?void 0:s.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_FAILED,{error:n}),this.googleTagManager.giftCardFailed(r,n),s}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(ut){throw this.store.set("checkout.error",(null==ut?void 0:ut.message)||"Failed to clear gift card error. Please try again."),ut}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(C.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(n,i){var r,s,a;try{this.store.set("checkout.items."+n+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+n);if(!d)throw new SDKError("Item not found");const u=d.quantity,f=d.quantity+i;if(f<1)return this.removeItem(n,!![]);const g={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:f},v=(null===(a=null===(s=null===(r=d.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];v.length>0&&(g.engravingLines=v);const b=await this.api.updateCart({id:l,items:[g],loc:this.getLocation()});this.pubSub.publishAction(i>0?x.CHECKOUT_ITEM_QUANTITY_INCREASE:x.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:d.cartItemId,quantity:f,previousQuantity:u});const w=splitCategoryPath(d.catPath),C={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,quantity:Math.abs(i),price:centToDollar(d.unitPrice||0),upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};i<0?this.googleTagManager.removeFromCart(C):i>0&&this.googleTagManager.addToCart(C),await this.partialLoadCheckout({cartResponse:b})}catch(l){throw this.store.set("checkout.items."+n+".error",l.message),l}finally{this.store.set("checkout.items."+n+".updating",![])}}async removeItemEngraving(n){var i,r,s;try{const a=this.store.get("checkout.items."+n);if(!a)throw new SDKError("Item not found in checkout");if(!(null===(i=a.attributes)||void 0===i?void 0:i.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:n}),void 0;const l=(null===(s=null===(r=a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],d={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},u=this.store.get("checkout.cartId"),f=await this.api.updateCart({id:u,items:[d],loc:this.getLocation()});this.pubSub.publishAction(x.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:l}),await this.partialLoadCheckout({cartResponse:f})}catch(a){throw this.store.set("checkout.items."+n+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:n,error:a.message}),a}}async removeItem(n,i){var r,s,a;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("checkout.items."+n+".updating",!![]);const l=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+n);if(!d)throw new SDKError("Item not found");const u={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:0},f=(null===(a=null===(s=null===(r=d.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];f.length>0&&(u.engravingLines=f);const g=await this.api.updateCart({id:l,items:[u],loc:this.getLocation()});this.store.remove("checkout.items."+n),this.pubSub.publishAction(x.CHECKOUT_ITEM_REMOVED,{cartItemId:d.cartItemId}),await this.partialLoadCheckout({cartResponse:g})}catch(l){throw this.store.set("checkout.items."+n+".error",l.message),l}}async updateTips(n){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",n);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),r=Object.values(i||{}).map(i=>{const r=Math.round(i.subtotal*n/100);return{fulfillmentId:i.fulfillmentId,tip:r}}),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(x.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update tips. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(n,i){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.onDemandFulfillmentTipInfo"),s=Object.values(r||{}).map(r=>({fulfillmentId:r.fulfillmentId,tip:r.fulfillmentId===n?i:r.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(a),this.pubSub.publishAction(x.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update fulfillment tip. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),r=Object.values(i||{}).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===n?0:i.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(x.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to remove fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:n,deliveryInstructions:i,customerData:r}){var s,a,l,d,u,f,g,v,b;try{this.store.set("checkout.customerForm.isSaving",!![]);const w=this.store.get("checkout.customerForm.data"),C=this.store.get("checkout.isGift"),E=this.dataForCheckoutPrepare({shippingAddressTwo:n,deliveryInstructions:i||void 0,customer:{...w,...r},isGift:C}),T=await this.api.prepareCheckout(E),A={id:(null===(s=T.customer)||void 0===s?void 0:s.id)||"",firstName:(null===(a=T.customer)||void 0===a?void 0:a.firstName)||"",lastName:(null===(l=T.customer)||void 0===l?void 0:l.lastName)||"",email:(null===(d=T.customer)||void 0===d?void 0:d.email)||"",phone:(null===(u=T.customer)||void 0===u?void 0:u.phone)||"",birthDate:(null===(g=null===(f=T.customer)||void 0===f?void 0:f.birthDate)||void 0===g?void 0:g.slice(0,10))||"",company:(null===(v=T.customer)||void 0===v?void 0:v.company)||""};this.store.batch({"checkout.customerForm.data":A,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":T.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(x.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const P=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(P.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],(null===(b=P.promoCode)||void 0===b?void 0:b.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:n,deliveryInstructions:i,...r}){var s,a,l,d,u,f;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const g=this.dataForCheckoutPrepare({shippingAddressTwo:n,deliveryInstructions:i||void 0,isGift:!![],giftRecipient:r}),v=await this.api.prepareCheckout(g),b={firstName:(null==r?void 0:r.firstName)||"",lastName:(null==r?void 0:r.lastName)||"",email:(null===(a=null===(s=v.giftOptions)||void 0===s?void 0:s.recipient)||void 0===a?void 0:a.email)||"",phone:(null===(d=null===(l=v.giftOptions)||void 0===l?void 0:l.recipient)||void 0===d?void 0:d.phone)||"",message:(null===(u=v.giftOptions)||void 0===u?void 0:u.message)||""};this.store.batch({"checkout.giftRecipientForm.data":b,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":v.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(x.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const w=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(w.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],(null===(f=w.promoCode)||void 0===f?void 0:f.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:n,paymentSession:i}){var r,s,a;try{this.store.set("checkout.paymentForm.isSaving",!![]);const l=this.store.get("checkout"),d={},u=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let f=null,g=null;if(u||i){const n=await this.confirmPaymentSession((null==i?void 0:i.confirmationTokenId)||"",(null==i?void 0:i.setupIntentId)||"");if(!n)throw new Error("Failed to confirm payment method");f=n.card,g=n.id}const v=this.dataForCheckoutPrepare({billingData:n,paymentMethodId:g||void 0}),b=await this.api.prepareCheckout(v);b.payment&&f&&(d["checkout.paymentForm.paymentMethod"]={id:b.payment,card:f}),n&&b.billingAddress&&(d["checkout.paymentForm.data"]={firstName:b.billingAddress.firstName||"",lastName:b.billingAddress.lastName||"",email:b.billingAddress.email||"",phone:b.billingAddress.phone||"",company:b.billingAddress.company||"",addressOne:b.billingAddress.one||"",addressTwo:b.billingAddress.two||"",city:b.billingAddress.city||"",state:b.billingAddress.state||"",zipCode:b.billingAddress.zip||""},this.pubSub.publishAction(x.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),d["checkout.paymentForm.isEditing"]=![],d["checkout.paymentForm.isValid"]=!![],this.store.batch(d);const w=d["checkout.paymentForm.paymentMethod"]||(null===(r=l.paymentForm)||void 0===r?void 0:r.paymentMethod),C=(null===(s=null==w?void 0:w.card)||void 0===s?void 0:s.brand)?w.card.brand+" ****"+w.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(l.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}}),C,(null===(a=l.promoCode)||void 0===a?void 0:a.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 n,i,r,s,a,l;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(x.CHECKOUT_SUBMIT_STARTED,{started:!![]});const d=this.store.get("checkout"),u=await this.api.checkoutComplete({token:d.token}),f=u.legacyOrderNumber||u.referenceId||"N/A";d.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(C.CHECKOUT_COMPLETED,{orderNumber:f,orderTotal:d.amounts.total,cardLast4:null===(r=null===(i=null===(n=null==d?void 0:d.paymentForm)||void 0===n?void 0:n.paymentMethod)||void 0===i?void 0:i.card)||void 0===r?void 0:r.last4,customerEmail:d.customerForm.data.email,giftRecipientEmail:(null===(a=null===(s=null==d?void 0:d.giftRecipientForm)||void 0===s?void 0:s.data)||void 0===a?void 0:a.email)||null}),this.pubSub.publishAction(x.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:f,orderTotal:d.amounts.total}),this.googleTagManager.purchase({transaction_id:f,tax:centToDollar(d.amounts.tax||0),shipping:centToDollar(d.amounts.shipping||0),coupon:(null===(l=d.promoCode)||void 0===l?void 0:l.code)||void 0,items:[...Object.values(d.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],value:centToDollar(d.amounts.total),subtotal:centToDollar(d.amounts.subtotal),total_before_discounts:centToDollar(d.amounts.subtotal+d.amounts.tax+d.amounts.shipping+d.amounts.delivery+d.amounts.platform+d.amounts.service),discounts:centToDollar(d.amounts.discounts),gift_cards:centToDollar(d.amounts.giftCards||0),net_total:centToDollar(d.amounts.total)})}catch(d){const n=(null==d?void 0:d.message)||"Checkout complete failed";this.store.batch({"checkout.error":n}),this.pubSub.publishAction(x.CHECKOUT_SUBMIT_FAILED,{message:n})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(n){var i;const r={"checkout.amounts":n.amounts,"checkout.warning":n.warning,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.error":null};if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0)for(const s of n.retailers)for(const n of s.fulfillments)n.type===E.ON_DEMAND&&(r["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:s.id,retailerName:s.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});this.store.batch(r)}async partialLoadCheckout(n){var i,r,s,a,l;try{let d;if(this.store.set("checkout.updating",!![]),(null==n?void 0:n.cartResponse)?this.commonCommands.syncCartFromResponse(n.cartResponse):await this.commonCommands.loadCart(),null==n?void 0:n.response)d=n.response;else{const r=null!==(i=null==n?void 0:n.cartId)&&void 0!==i?i:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const s=this.dataForCheckoutPrepare({});d=await this.api.prepareCheckout({...s,cartId:r})}const u={"checkout.token":d.token,"checkout.events":transformEventsForCheckout(d.events||[]),"checkout.amounts":d.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":d.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),"checkout.promoCode":(null===(s=null===(r=null==d?void 0:d.promoCode)||void 0===r?void 0:r.value)||void 0===s?void 0:s.trim())?{code:d.promoCode.value,discountAmount:d.promoCode.discount}:null};if((null===(a=d.retailers)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const n of d.retailers)for(const i of n.fulfillments)i.type===E.ON_DEMAND&&(u["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal})}if((null===(l=d.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const n of d.items){const i=d.retailers.find(i=>i.id===n.retailerId),r=i.fulfillments.find(i=>i.id===n.fulfillmentId);u["checkout.items."+n.cartItemId]=this.buildCheckoutItemStore(n,i,r)}}this.store.batch(u)}catch(d){const n=(null==d?void 0:d.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(x.CHECKOUT_FAILED,{message:n}),d}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:n,giftRecipient:i,billingData:r,marketingPreferences:s,shippingAddressTwo:a,deliveryInstructions:l,deliveryTips:d,paymentMethodId:u,isGift:f}){var g,v,b,x,w,C,E,T,A,P,_,N,F,R,O,L,M,B,W,H,q,j,U,V,K,Q;const Z=this.store.get("checkout"),X=null!==(v=null===(g=Z.paymentForm)||void 0===g?void 0:g.billingSameAsShipping)&&void 0!==v?v:!![],J=void 0!==f?f:Z.isGift,$=i?!![]:null!==(x=null===(b=Z.giftRecipientForm)||void 0===b?void 0:b.isValid)&&void 0!==x?x:![],tt=J&&$,et={cartId:Z.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:a,billingSameAsShipping:X,marketingPreferences:s||Z.marketingPreferences,promoCode:(null===(w=Z.promoCode)||void 0===w?void 0:w.code)||void 0,isGift:tt,giftCards:(null===(C=null==Z?void 0:Z.giftCards)||void 0===C?void 0:C.map(n=>n.code))||[],deliveryTips:d||Object.values(Z.onDemandFulfillmentTipInfo||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.tip}))};u?et.payment=u:(null===(T=null===(E=Z.paymentForm)||void 0===E?void 0:E.paymentMethod)||void 0===T?void 0:T.id)&&(et.payment=Z.paymentForm.paymentMethod.id);const nt=l||Z.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(Z.items||{}).map(n=>({fulfillmentId:n.fulfillmentId,instructions:nt}))),et.customer=n?{...n,id:(null==n?void 0:n.id)||void 0}:(null===(P=null===(A=null==Z?void 0:Z.customerForm)||void 0===A?void 0:A.data)||void 0===P?void 0:P.email)?{id:(null===(N=null===(_=Z.customerForm)||void 0===_?void 0:_.data)||void 0===N?void 0:N.id)||void 0,firstName:null===(R=null===(F=Z.customerForm)||void 0===F?void 0:F.data)||void 0===R?void 0:R.firstName,lastName:null===(L=null===(O=Z.customerForm)||void 0===O?void 0:O.data)||void 0===L?void 0:L.lastName,email:null===(B=null===(M=Z.customerForm)||void 0===M?void 0:M.data)||void 0===B?void 0:B.email,phone:null===(H=null===(W=Z.customerForm)||void 0===W?void 0:W.data)||void 0===H?void 0:H.phone,birthDate:null===(j=null===(q=Z.customerForm)||void 0===q?void 0:q.data)||void 0===j?void 0:j.birthDate,company:null===(V=null===(U=Z.customerForm)||void 0===U?void 0:U.data)||void 0===V?void 0:V.company}:void 0,tt){const n=i||(null===(K=Z.giftRecipientForm)||void 0===K?void 0:K.data);n&&(et.giftOptions={recipient:{name:(n.firstName||"")+" "+(n.lastName||""),email:n.email||"",phone:n.phone||""},message:n.message||""})}if(!X)if(r)et.billingAddress={firstName:r.firstName,lastName:r.lastName,email:r.email,phone:r.phone,company:r.company,one:r.addressOne,two:r.addressTwo,city:r.city,state:r.state,zip:r.zipCode,country:"US"};else{const n=null===(Q=Z.paymentForm)||void 0===Q?void 0:Q.data;et.billingAddress={firstName:null==n?void 0:n.firstName,lastName:null==n?void 0:n.lastName,email:null==n?void 0:n.email,phone:null==n?void 0:n.phone,company:null==n?void 0:n.company,one:null==n?void 0:n.addressOne,two:null==n?void 0:n.addressTwo,city:null==n?void 0:n.city,state:null==n?void 0:n.state,zip:null==n?void 0:n.zipCode,country:"US"}}return et}buildCheckoutItemStore(n,i,r){return{liquidId:n.liquidId,variantId:n.variantId,cartItemId:n.cartItemId,retailerId:n.retailerId,fulfillmentId:n.fulfillmentId,salsifyGrouping:n.salsifyGrouping,name:n.name,catPath:n.catPath,volume:n.volume,uom:n.uom,proof:n.proof,abv:n.abv,containerType:n.containerType,container:n.container,size:n.size,pack:n.pack,packDesc:n.packDesc,mainImage:n.mainImage,brand:n.brand,partNumber:n.partNumber,upc:n.upc,sku:n.sku,price:n.price,unitPrice:n.unitPrice,quantity:n.quantity,unitTax:n.unitTax,bottleDeposits:n.bottleDeposits,attributes:n.attributes,retailerName:i.name,expectationDetail:r.expectation.detail,loading:![],updating:![],error:null}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async n=>{n===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(n,i){try{this.store.set("cart.items."+n+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+n);if(!s)throw this.logger.error("Cart item not found: "+n+" - cannot update quantity by "+i),new SDKError("Item not found");const a=s.quantity+i;if(a<1)return this.removeItem(n,!![]);const l=this.buildItemUpdate(s,a),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[n]),this.updateFulfillment(s.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(i<0?x.CART_ITEM_QUANTITY_DECREASE:x.CART_ITEM_QUANTITY_INCREASE,{id:s.id,quantity:a,previousQuantity:s.quantity});const u=splitCategoryPath(s.catPath),f={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(i),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};i<0?this.googleTagManager.removeFromCart(f):i>0&&this.googleTagManager.addToCart(f)}catch(r){throw this.store.set("cart.items."+n+".error",r.message),this.logger.error("Failed to update item quantity",r),r}finally{this.store.set("cart.items."+n+".updating",![])}}async removeItem(n,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("cart.items."+n+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+n);if(!s)throw new SDKError("Item not found");const a={itemId:s.id,fulfillmentId:s.fulfillmentId,retailerId:s.retailerId},l=this.buildItemUpdate(s,0),d=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[]),this.cleanupAfterItemRemoval(a,d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(x.CART_ITEM_REMOVED,{id:s.id});const u=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(r){throw this.store.set("cart.items."+n+".error",r.message),this.logger.error("Failed to remove item",r),r}}async updateItemEngraving(n,i){var r,s,a;try{const l=this.store.get("cart"),d=null===(r=l.items)||void 0===r?void 0:r[n];if(!d)throw new SDKError("Item not found");this.store.set("cart.items."+n+".updating",!![]);const u={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:i},f=await this.api.updateCart({id:l.id||"",items:[u],loc:this.getLocation()});this.syncItemsFromApiResponse(f,[n]),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const g=this.store.get("cart"),v=this.store.get("address");this.pubSub.publishAction(x.CART_UPDATED,{previous:cartDataForEventFromStore(l,v),current:cartDataForEventFromStore(g,v)}),this.pubSub.publishAction(x.CART_ITEM_ENGRAVING_UPDATED,{id:d.id,engravingLines:i,previousEngravingLines:(null===(a=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[]})}catch(l){throw this.store.set("cart.items."+n+".error",l.message),this.logger.error("Failed to update item engraving",l),l}finally{this.store.set("cart.items."+n+".updating",![])}}async addItem(n){var i,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},l=(null===(i=n.engravingLines)||void 0===i?void 0:i.filter(n=>""!==n.trim()))||[],d=l.length>0,u=Object.values(s.items||{}).find(i=>{var r,s,a,u,f;const g=i.fulfillmentId===n.fulfillmentId&&i.partNumber===n.partNumber;if(!g)return![];if(d){const n=(null===(s=null===(r=i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[];return l.join(",")===n.join(",")}return!(null===(f=null===(u=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===u?void 0:u.lines)||void 0===f?void 0:f.length)}),f={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:u?n.quantity+u.quantity:n.quantity};d&&(f.engravingLines=l);const g=await this.api.updateCart({id:s.id||"",items:[f],loc:this.getLocation()}),v=null===(r=g.items)||void 0===r?void 0:r.find(n=>n.fulfillmentId===f.fulfillmentId&&n.partNumber===f.partNumber&&n.upc===f.upc);if(!v)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(g,[]);const b=this.store.get("cart.fulfillments."+n.fulfillmentId);b?this.updateFulfillment(n.fulfillmentId,g):this.addNewFulfillmentAndRetailer(n.fulfillmentId,g),this.syncRetailersFromApiResponse(g),this.syncCartMetaFromApiResponse(g);const w=this.store.get("cart"),C=this.store.get("address");this.pubSub.publishAction(x.PRODUCT_ADD_TO_CART,{...n}),this.pubSub.publishAction(x.CART_ITEM_ADDED,{id:v.id,upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,engravingLines:n.engravingLines}),this.pubSub.publishAction(x.CART_UPDATED,{previous:cartDataForEventFromStore(a,C),current:cartDataForEventFromStore(w,C)});const E=splitCategoryPath(v.catPath);this.googleTagManager.addToCart({item_id:v.liquidId,item_name:v.name,item_brand:v.brand,item_size:v.size,item_category:E.category,item_category2:E.category2,item_category3:E.category3,item_type:v.type,item_subtype:v.subType,quantity:v.quantity,price:centToDollar(v.unitPrice||0),upc:v.upc,grouping_id:v.salsifyGrouping,product_id:v.liquidId})}catch(s){this.store.set("cart.error",s.message),this.logger.error("Failed to add item to cart",s)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(n){var i;try{const r={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity};(null==n?void 0:n.engravingLines)&&(null===(i=null==n?void 0:n.engravingLines)||void 0===i?void 0:i.length)>0&&(r.engravingLines=n.engravingLines);const s=await this.api.updateCart({id:"",items:[r],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(s.id)}catch(r){throw this.store.set("cart.error",r.message),this.logger.error("Failed to add presale item to cart",r),r}}async handleGoToCheckout(){var n;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(C.CHECKOUT);const i=this.store.get("cart"),r=(null===(n=i.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(i.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],r)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to proceed to checkout",i),i}finally{this.store.set("cart.loading",![])}}async applyPromoCode(n){var i,r,s;if(!(null==n?void 0:n.trim()))throw new SDKError("Promo code is required");const a=n.trim().toUpperCase();try{const n=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const l=await this.api.updateCart({id:n,items:[],promoCode:a,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(l)),this.store.set("cart.events",transformEventsForCart(l.events||[]));const d=(null===(s=null===(r=null===(i=l.attributes)||void 0===i?void 0:i.promoCode)||void 0===r?void 0:r.value)||void 0===s?void 0:s.toLowerCase())===a.toLowerCase();d?(this.store.set("cart.promoCode",{code:a,discountAmount:l.discounts||0}),this.pubSub.publishAction(x.CART_PROMO_CODE_APPLIED,{discountAmount:l.discounts||0,newTotal:l.total||0}),this.googleTagManager.promoCodeApplied(a,l.discounts||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(x.CART_PROMO_CODE_FAILED,{error:'Code "'+a+'" does not exist'}),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(l){const n=(null==l?void 0:l.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",n),this.pubSub.publishAction(x.CART_PROMO_CODE_FAILED,{error:n}),this.googleTagManager.promoCodeFailed(a,n),this.logger.error("Failed to apply promo code",l),l}}async removePromoCode(){try{const n=this.store.get("cart.id"),i=await this.api.updateCart({id:n,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(i),"cart.promoCode":null}),this.pubSub.publishAction(x.CART_PROMO_CODE_REMOVED,{newTotal:i.total||0}),this.googleTagManager.promoCodeApplied("",0)}catch(n){const i=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",i);const r=this.store.get("cart.promoCode");throw this.pubSub.publishAction(x.CART_PROMO_CODE_FAILED,{error:i}),(null==r?void 0:r.code)&&this.googleTagManager.promoCodeFailed(r.code,i),this.logger.error("Failed to remove promo code",n),n}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...L,rerender:!![]}),this.store.set("cart",{...O,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(x.CART_RESET,!![])}getDetails(){var n;const i=this.store.get("cart"),r=this.store.get("address"),s=r.id?r:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},a={};for(const l in i.items||{}){const n=i.items[l];a[l]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:i.id,promoCode:(null===(n=i.promoCode)||void 0===n?void 0:n.code)||"",items:a,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.coordinates.long}},amounts:{deliveryFee:i.totals.deliveryFee,discounts:i.totals.discounts,engravingFee:i.totals.engravingFee,giftCardTotal:i.totals.giftCardTotal,platformFee:i.totals.platformFee,shippingFee:i.totals.shippingFee,subtotal:i.totals.subtotal,total:i.totals.total},itemCount:Object.values(a||{}).reduce((n,i)=>n+(i.quantity||0),0),updatedAt:i.updatedAt,createdAt:i.createdAt}}buildItemUpdate(n,i){var r,s,a;const l={id:n.id,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:i},d=(null===(a=null===(s=null===(r=n.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];return d.length>0&&(l.engravingLines=d),l}syncItemsFromApiResponse(n,i=[]){var r;const s=this.store.get("cart.items")||{},a=new Set((null===(r=n.items)||void 0===r?void 0:r.map(n=>n.id))||[]);for(const d of Object.keys(s))a.has(d)||this.store.remove("cart.items."+d);const l={};for(const d of n.items)0!==i.length&&!i.includes(d.id)&&s[d.id]||(l["cart.items."+d.id]=buildCartItemStore(d));Object.keys(l).length>0&&this.store.batch(l)}syncCartMetaFromApiResponse(n){var i,r;const s={"cart.totals":buildCartTotals(n),"cart.error":null,"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(n.events||[])},a=null===(r=null===(i=n.attributes)||void 0===i?void 0:i.promoCode)||void 0===r?void 0:r.value;if(a)s["cart.promoCode"]={code:a.toUpperCase(),discountAmount:n.discounts||0};else{const n=this.store.get("cart.promoCode");(null==n?void 0:n.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(n){var i;if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0){const i={};for(const r of n.retailers)i["cart.retailers."+r.id]=buildRetailerStore(r);this.store.batch(i)}}updateFulfillment(n,i){var r,s;const a=null===(r=i.retailers)||void 0===r?void 0:r.find(i=>{var r;return null===(r=i.fulfillments)||void 0===r?void 0:r.some(i=>i.id===n)}),l=null===(s=null==a?void 0:a.fulfillments)||void 0===s?void 0:s.find(i=>i.id===n);l&&a&&this.store.set("cart.fulfillments."+n,buildFulfillmentStore(l,a))}addNewFulfillmentAndRetailer(n,i){var r,s;const a=null===(r=i.retailers)||void 0===r?void 0:r.find(i=>{var r;return null===(r=i.fulfillments)||void 0===r?void 0:r.some(i=>i.id===n)}),l=null===(s=null==a?void 0:a.fulfillments)||void 0===s?void 0:s.find(i=>i.id===n);if(l&&a){const i={["cart.fulfillments."+n]:buildFulfillmentStore(l,a),["cart.retailers."+a.id]:buildRetailerStore(a)};this.store.batch(i)}}cleanupAfterItemRemoval(n,i){var r,s,a,l;const d=this.store.get("cart.fulfillments."+n.fulfillmentId),u=this.store.get("cart.retailers."+n.retailerId);if(!d||!u)return;const f=null===(r=i.retailers)||void 0===r?void 0:r.some(i=>{var r;return null===(r=i.fulfillments)||void 0===r?void 0:r.some(i=>i.id===n.fulfillmentId)}),g=null===(s=i.retailers)||void 0===s?void 0:s.some(i=>i.id===n.retailerId);if(f){this.updateFulfillment(n.fulfillmentId,i);const r=null===(l=i.retailers)||void 0===l?void 0:l.find(i=>i.id===n.retailerId);r&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(r))}else if(this.store.remove("cart.fulfillments."+n.fulfillmentId),g){const r=null===(a=i.retailers)||void 0===a?void 0:a.find(i=>i.id===n.retailerId);r&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(r))}else this.store.remove("cart.retailers."+n.retailerId)}}const Et=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],St=1440;function timeToMinutes(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new SDKError("Invalid time format: "+n);const r=Number.parseInt(i[1],10),s=Number.parseInt(i[2],10);if(r<0||r>47||s<0||s>59)throw new SDKError("Invalid time values: "+n);return 60*r+s}function getCurrentTimeInTimezone$1(n){var i,r,s;const a=new Date,l={timeZone:n,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const n=new Intl.DateTimeFormat("en-US",l),d=n.formatToParts(a),u=(null===(i=d.find(n=>"weekday"===n.type))||void 0===i?void 0:i.value.toLowerCase())||"",f=(null===(r=d.find(n=>"hour"===n.type))||void 0===r?void 0:r.value)||"0",g=(null===(s=d.find(n=>"minute"===n.type))||void 0===s?void 0:s.value)||"0",v=60*Number.parseInt(f,10)+Number.parseInt(g,10);return{weekday:u,timeInMinutes:v}}catch(d){throw new SDKError("Invalid timezone: "+n)}}function format24TimeTo12(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i||"object"==typeof i)return n;let r=Number.parseInt(i[1],10);const s=i[2];r>=24&&(r-=24);const a=r>=12?"PM":"AM",l=0===r?12:r>12?r-12:r;return l+":"+s+" "+a}function isWithinTimeSlot(n,i){try{const r=timeToMinutes(i.startsAt),s=timeToMinutes(i.endsAt);if(s>St){if(n>=r||n<s-St)return"during"}else if(s<r){if(n>=r||n<s)return"during"}else if(n>=r&&n<s)return"during";return n<r?"before":"after"}catch(r){return"after"}}function getNextOpeningTime(n,i,r=7){var s,a;const l=Et.indexOf(i);for(let u=1;u<=r;u++){const i=(l+u)%7,r=Et[i],f=n[r];if((null==f?void 0:f.active)&&f.times&&f.times.length>0)try{const n=1===u?"tomorrow":r;return"Opens "+n+" at "+format24TimeTo12(null!==(a=null===(s=null==f?void 0:f.times[0])||void 0===s?void 0:s.startsAt)&&void 0!==a?a:"")}catch(d){}}return null}function validateFulfillmentData(n){return n&&"object"==typeof n&&n.hours&&n.timezone?"string"!=typeof n.timezone?![]:!![]:![]}function getRetailerOffHours(n){var i;if(!(null==n?void 0:n.type)||(null==n?void 0:n.type)!==E.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(n))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:r,timeInMinutes:s}=getCurrentTimeInTimezone$1(n.timezone),a=n.hours[r];if(!(null==a?void 0:a.active)||!(null===(i=a.times)||void 0===i?void 0:i.length)){const i=getNextOpeningTime(n.hours,r);return{message:i,isOpen:![],isClosed:!![]}}for(const n of a.times){const i=isWithinTimeSlot(s,n);switch(i){case"before":return{message:"Opens at "+format24TimeTo12(n.startsAt),isOpen:![],isClosed:!![],openTime:n.startsAt,closeTime:n.endsAt};case"during":{let i=n.endsAt;const r=timeToMinutes(i);if(r>St){const n=Math.floor(r/60)-24,s=r%60;i=n.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(i),isOpen:!![],isClosed:![],openTime:n.startsAt,closeTime:n.endsAt}}}}const l=getNextOpeningTime(n.hours,r);return{message:l,isOpen:![],isClosed:!![]}}catch(r){return{message:null,isOpen:![],isClosed:!![]}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(n,i=![]){this.store.createProductInstance(n),i&&this.store.set("products."+n+".loading",!![])}async loadMultipleProducts(n){var i;if(!Array.isArray(n)||0===n.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=!![],n["products."+i+".error"]=null,n),{}));const r=await this.api.getProductsData(n,this.getLocation());if(!r||!r.products||0===r.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]=!![],n),{})),void 0;const s=[];for(const l of r.products){const a=l.sizes.filter(i=>n.some(n=>n===(i.upc||i.id||l.salsifyGrouping))),d=n.find(n=>a.some(i=>n===i.upc||n===i.id)||n===l.salsifyGrouping),u=d||(null===(i=null==a?void 0:a[0])||void 0===i?void 0:i.upc);await this.loadProduct(u,{products:[l],retailers:r.retailers}),s.push(u)}const a=n.filter(n=>-1===s.indexOf(n));this.store.batch(a.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]="Product data not found",n),{}))}async loadProduct(n,i=null){var r,s;try{const a=this.store.get("products."+n);a.loading||this.store.set("products."+n+".loading",!![]);let l=null;if(i&&(l=i),i||(l=await this.api.getProductsData([n],this.getLocation())),!l||!(null===(r=null==l?void 0:l.products)||void 0===r?void 0:r[0]))return this.store.set("products."+n+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(l);if(!d)return this.store.set("products."+n+".error","Failed to process product data"),void 0;this.store.set("products."+n,{...d,identifier:n}),this.pubSub.publishAction(x.PRODUCT_LOADED,this.productDataForEventFromStore(n));const u=l.products[0],f=d.sizes[d.selectedSizeId||""],g=Boolean(this.getLocation()),v=d.selectedFulfillment,b=g&&(null==v?void 0:v.price)?v.price:(null===(s=d.priceInfo)||void 0===s?void 0:s.avg)||0,w=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==f?void 0:f.id,item_name:u.name,item_brand:u.brand,item_size:null==f?void 0:f.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar(b),item_type:u.type,item_subtype:u.subType,upc:null==f?void 0:f.upc,grouping_id:u.salsifyGrouping,product_id:null==f?void 0:f.id})}catch(a){this.store.set("products."+n+".error",a.message),this.logger.error("Failed to load product data for ID "+n,a)}finally{this.store.set("products."+n+".loading",![])}}async selectSize(n,i){var r,s,a,l,d,u,f;const g=this.store.get("products."+n);let v=g.selectedFulfillmentType;const b=null===(r=g.sizes[i])||void 0===r?void 0:r.shippingFulfillments,w=null===(s=g.sizes[i])||void 0===s?void 0:s.onDemandFulfillments;let C=null,T=null;if(v!==E.SHIPPING||Object.values(b).length)if(v!==E.ON_DEMAND||Object.values(w).length){const n=v===E.SHIPPING?b:w,i=Object.values(n);C=i[0]||null,T=(null==C?void 0:C.fulfillmentId)||null}else{v=E.SHIPPING;const n=Object.values(b);C=n[0]||null,T=(null==C?void 0:C.fulfillmentId)||null}else{v=E.ON_DEMAND;const n=Object.values(w);C=n[0]||null,T=(null==C?void 0:C.fulfillmentId)||null}const A=v===E.SHIPPING?b:w,P=g.sizes[i],_=splitCategoryPath(g.catPath),N=(null==C?void 0:C.price)||(null===(a=g.priceInfo)||void 0===a?void 0:a.avg)||0;this.googleTagManager.viewItem({item_id:null==P?void 0:P.id,item_name:g.name,item_brand:g.brand,item_size:null==P?void 0:P.size,item_category:_.category,item_category2:_.category2,item_category3:_.category3,price:centToDollar(N),item_type:g.type,item_subtype:g.subType,upc:null==P?void 0:P.upc,grouping_id:g.salsifyGrouping,product_id:null==P?void 0:P.id});const F=Object.keys(b).length>0,R=Object.keys(w).length>0,O=F||R;if(!O){const n=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==P?void 0:P.id,productName:g.name,productBrand:g.brand,productCategory:_.category,productCategory2:_.category2,productCategory3:_.category3,productType:g.type,productSubtype:g.subType,productPrice:(null===(l=g.priceInfo)||void 0===l?void 0:l.avg)||0,sizeId:i,sizeName:null==P?void 0:P.size,upc:null==P?void 0:P.upc,groupingId:g.salsifyGrouping,address:(null==n?void 0:n.address)?{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(x.PRODUCT_SIZE_CHANGED,{identifier:n,selectedSizeId:i,size:(null===(d=g.sizes[i])||void 0===d?void 0:d.size)||"",previousSizeId:g.selectedSizeId||"",previousSize:(null===(u=g.sizes[g.selectedSizeId])||void 0===u?void 0:u.size)||""}),this.store.batch({["products."+n+".selectedSizeId"]:i,["products."+n+".mainImage"]:(null===(f=g.sizes[i])||void 0===f?void 0:f.image)||null,["products."+n+".productHasAvailability"]:Object.keys(b).length+Object.keys(w).length>0,["products."+n+".fulfillmentHasAvailability"]:Boolean(Object.keys(A).length),["products."+n+".selectedFulfillmentType"]:v,["products."+n+".selectedFulfillment"]:C,["products."+n+".selectedFulfillmentId"]:T})}async selectFulfillment(n,i){var r,s,a;const l=this.store.get("products."+n),d=null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments,u=null===(s=l.sizes[l.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments,f=l.selectedFulfillmentType===E.SHIPPING?d:u,g=f[i];this.pubSub.publishAction(x.PRODUCT_FULFILLMENT_CHANGED,{identifier:n,selectedFulfillmentId:i,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const v=l.sizes[l.selectedSizeId||""],b=splitCategoryPath(l.catPath),w=(null==g?void 0:g.price)||(null===(a=l.priceInfo)||void 0===a?void 0:a.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:l.name,item_brand:l.brand,item_size:null==v?void 0:v.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(w),item_type:l.type,item_subtype:l.subType,upc:null==v?void 0:v.upc,grouping_id:l.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+n+".selectedFulfillment"]:g,["products."+n+".selectedFulfillmentId"]:i,["products."+n+".quantity"]:1})}async updateQuantity(n,i){var r;const s=this.store.get("products."+n),a=s.quantity,l=a+i,d=1,u=(null===(r=null==s?void 0:s.selectedFulfillment)||void 0===r?void 0:r.stock)||5,f=Math.max(d,Math.min(u,l));this.pubSub.publishAction(i<0?x.PRODUCT_QUANTITY_DECREASE:x.PRODUCT_QUANTITY_INCREASE,{identifier:n,quantity:f,previousQuantity:a}),this.store.set("products."+n+".quantity",f)}async changeFulfillmentType(n,i){var r,s,a;const l=this.store.get("products."+n),{shippingFulfillments:d,onDemandFulfillments:u}=l.sizes[l.selectedSizeId],f=i===E.SHIPPING?d:u,g=Object.values(f);if(0===g.length){const n=this.store.get("address"),a=l.sizes[l.selectedSizeId],d=splitCategoryPath(l.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:l.name,productBrand:l.brand,productCategory:d.category,productCategory2:d.category2,productCategory3:d.category3,productType:l.type,productSubtype:l.subType,productPrice:(null===(r=l.priceInfo)||void 0===r?void 0:r.avg)||0,sizeId:null!==(s=l.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:i,upc:null==a?void 0:a.upc,groupingId:l.salsifyGrouping,address:(null==n?void 0:n.address)?{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""}:void 0,reason:"No "+i+" fulfillments available for selected size"}),void 0}const v=g[0]||null,b=(null==v?void 0:v.fulfillmentId)||null;this.pubSub.publishAction(x.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:n,selectedFulfillmentType:i,selectedFulfillmentId:b,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:g.length>0});const w=l.sizes[l.selectedSizeId||""],C=splitCategoryPath(l.catPath),T=(null==v?void 0:v.price)||(null===(a=l.priceInfo)||void 0===a?void 0:a.avg)||0;this.googleTagManager.viewItem({item_id:null==w?void 0:w.id,item_name:l.name,item_brand:l.brand,item_size:null==w?void 0:w.size,item_category:C.category,item_category2:C.category2,item_category3:C.category3,price:centToDollar(T),item_type:l.type,item_subtype:l.subType,upc:null==w?void 0:w.upc,grouping_id:l.salsifyGrouping,product_id:null==w?void 0:w.id}),this.store.batch({["products."+n+".selectedFulfillmentType"]:i,["products."+n+".selectedFulfillment"]:v,["products."+n+".selectedFulfillmentId"]:b,["products."+n+".fulfillmentHasAvailability"]:g.length>0})}async removeProduct(n){this.store.removeProductInstance(n)}async openProductDrawer(n,i,r){const s={type:i,data:r||{}};this.store.batch({["products."+n+".drawer.isOpen"]:!![],["products."+n+".drawer.contentConfig"]:s})}async closeProductDrawer(n){this.store.set("products."+n+".drawer.isOpen",![])}async rerenderAllProducts(){const n=this.store.getProductInstances(),i=Object.keys(n);for(const r of i)this.store.set("products."+r+".rerender",!![])}async addToCart(n,i){try{this.store.set("products."+n+".updating",!![]),this.uiCommands.openDrawer(C.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]});const r=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(r.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})])}catch(r){this.logger.error("Error adding to cart",r),this.store.set("products."+n+".updating",![])}}async addPresaleToCart(n,i){try{this.store.set("products."+n+".updating",!![]),await this.cartCommands.addPresaleItem(i),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(C.CHECKOUT),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]})}catch(r){this.logger.error("Error adding to cart",r),this.store.set("products."+n+".updating",![])}}productDataForEventFromStore(n){const i=this.store.get("products."+n),r={},fulfillmentEventData=n=>{const i={};for(const r in n){const s=n[r];i[r]={retailerId:s.retailerId,retailerName:s.retailerName,retailerAddress:s.retailerAddress,retailerTimezone:s.timezone,price:s.price,partNumber:s.partNumber,stock:s.stock,isEngravable:s.isVariantEngravable,fulfillmentId:s.fulfillmentId,fulfillmentType:s.fulfillmentType,modalities:s.modalities||[]}}return i};for(const s in i.sizes||{}){const n=i.sizes[s];r[s]={id:n.id,upc:n.upc,size:n.size,pack:n.pack,packDesc:n.packDesc||"",container:n.container,containerType:n.containerType,maxQuantityPerOrder:n.attributes.maxQuantityPerOrder||0,image:n.image,uom:n.uom,volume:n.volume,attributes:{engraving:n.attributes.engraving||void 0,presale:n.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(n.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(n.onDemandFulfillments||{})}}return{identifier:n,selectedSizeId:i.selectedSizeId||null,selectedFulfillmentId:i.selectedFulfillmentId||null,selectedFulfillmentType:i.selectedFulfillmentType,id:i.id,name:i.name,brand:i.brand,catPath:i.catPath,category:i.category,classification:i.classification,type:i.type,salsifyGrouping:i.salsifyGrouping,subType:i.subType,mainImage:i.mainImage||null,images:i.images||[],region:i.region,country:i.country,material:i.material,abv:i.abv,proof:i.proof,age:i.age,color:i.color,flavor:i.flavor,variety:i.variety,appellation:i.appellation,vintage:i.vintage,description:i.description,htmlDescription:i.htmlDescription,tastingNotes:i.tastingNotes,priceInfo:i.priceInfo||null,sizes:r}}findFirstAvailableSize(n){const i=Object.values(n);for(const r of i){const n=r.shippingFulfillments||{},i=r.onDemandFulfillments||{},s=Object.values(n).length,a=Object.values(i).length;if(s+a>0)return r.id}return null}loadProductStoreUpdate(n){var i,r,s,a,l,d,u,f,g,v,b;try{const{products:[x,...w],retailers:C}=n,T=this.themeProvider.getConfigs("product"),A={};let P=![],_=![],N="",F=null,R=T.layout.enableShippingFulfillment?E.SHIPPING:E.ON_DEMAND,O=null,L=null;const M={};if(C&&Array.isArray(C)&&C.length>0)for(const n of C)for(const i of n.fulfillments){const r={retailerName:n.name,retailerAddress:n.address||null,type:i.type,timezone:i.timezone||"",canEngrave:i.canEngrave||![],expectation:i.expectation,fees:i.fees,hours:i.hours,retailerId:n.id,fulfillmentId:i.id,fulfillmentType:i.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]},s=getRetailerOffHours(r);s.isClosed&&!T.layout.showOffHours||(M[i.id]=r)}if(x.sizes&&Array.isArray(x.sizes)&&x.sizes.length>0)for(const n of x.sizes){const l={},d={};for(const u of n.variants){if((null===(i=null==u?void 0:u.fulfillmentTypes)||void 0===i?void 0:i.onDemand)&&""!==u.fulfillmentTypes.onDemand){const n=u.fulfillmentTypes.onDemand,i=M[n];i?d[n]={...i,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:n,fulfillmentType:E.ON_DEMAND,modalities:[...i.modalities,...null!==(r=null==u?void 0:u.modalities)&&void 0!==r?r:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+n)}if((null===(s=null==u?void 0:u.fulfillmentTypes)||void 0===s?void 0:s.shipping)&&""!==u.fulfillmentTypes.shipping){const n=u.fulfillmentTypes.shipping,i=M[n];i?l[n]={...i,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:n,fulfillmentType:E.SHIPPING,modalities:[...i.modalities,...null!==(a=null==u?void 0:u.modalities)&&void 0!==a?a:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+n)}}A[n.id]={id:n.id,upc:n.upc,size:n.size,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,maxQuantityPerOrder:n.attributes.maxQuantityPerOrder||0,image:n.image,uom:n.uom,volume:n.volume,attributes:n.attributes,loading:![],error:null,shippingFulfillments:l,onDemandFulfillments:d}}const B=Object.values(A),W=this.findFirstAvailableSize(A);N=W||B[0]&&B[0].id||"",F=(null===(l=A[N])||void 0===l?void 0:l.image)||null;const H=(null===(d=A[N])||void 0===d?void 0:d.shippingFulfillments)||{},q=(null===(u=A[N])||void 0===u?void 0:u.onDemandFulfillments)||{},j=Object.values(H).length,U=Object.values(q).length;P=j+U>0;const V=R===E.SHIPPING?Object.values(H):Object.values(q);if(_=V.length>0,L=V[0]||null,O=(null==L?void 0:L.fulfillmentId)||null,!_){const n=R===E.SHIPPING?E.ON_DEMAND:E.SHIPPING,i=n===E.SHIPPING?Object.values(H):Object.values(q);i.length>0&&(R=n,L=i[0],O=(null==L?void 0:L.fulfillmentId)||null,_=!![])}if(!P){const n=this.store.get("address"),i=splitCategoryPath(x.catPath),r=A[N];this.googleTagManager.productNoAvailability({productId:null==r?void 0:r.id,productName:x.name,productBrand:x.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:x.type,productSubtype:x.subType,productPrice:(null===(f=x.priceInfo)||void 0===f?void 0:f.average)||0,upc:null==r?void 0:r.upc,groupingId:x.salsifyGrouping,address:(null==n?void 0:n.address)?{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:x.id||"",name:x.name,description:x.description,htmlDescription:x.htmlDescription,images:x.images,priceInfo:{min:(null===(g=x.priceInfo)||void 0===g?void 0:g.minimum)||0,max:(null===(v=x.priceInfo)||void 0===v?void 0:v.maximum)||0,avg:(null===(b=x.priceInfo)||void 0===b?void 0:b.average)||0},brand:x.brand,region:x.region||"",country:x.country||"",material:x.material||"",abv:x.abv||"",proof:x.proof||"",age:x.age||"",color:x.color||"",flavor:x.flavor||"",variety:x.variety||"",appellation:x.appellation||"",vintage:x.vintage||"",tastingNotes:x.tastingNotes||"",catPath:x.catPath,category:x.category,classification:x.classification,type:x.type,subType:x.subType,salsifyGrouping:x.salsifyGrouping,sizes:A,productHasAvailability:P,fulfillmentHasAvailability:_,selectedSizeId:N,mainImage:F,selectedFulfillmentType:R,selectedFulfillmentId:O,selectedFulfillment:L,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(x){throw this.logger.error("Product data processing error",x),x}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(n){return!n||n.length<3?[]:await this.api.getAddressSuggestions(n)}async getAddressDetails(n){return await this.api.getAddressDetails(n)}async setSelectedAddress(n){try{this.store.batch({"address.id":n.id,"address.formattedAddress":n.formattedAddress,"address.address":n.address,"address.coordinates":n.coordinates});const i=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(i)),await this.cartCommands.resetCart(),await this.store.persist()}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(x.ADDRESS_FAILED,{googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates,error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),i}this.googleTagManager.addressUpdated({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:n.coordinates}),this.pubSub.publishAction(x.ADDRESS_UPDATED,{googlePlacesId:n.id,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:n.coordinates,formattedAddress:n.formattedAddress})}async setAddressManually(n,i){try{const r=buildFormattedAddressString(n),s={id:"",formattedAddress:r,address:n,coordinates:i};await this.setSelectedAddress(s)}catch(r){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:{one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip,country:n.country||""},error:(null==r?void 0:r.message)||"Failed to set manual address"}),this.pubSub.publishAction(x.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:n,coordinates:i,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}async clearSelectedAddress(){this.store.set("address",B),this.pubSub.publishAction(x.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const n=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(n),this.store.clearLocalStorage()}getDetails(){const n=this.store.get("address");return n.id?{id:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(n){var i,r;const s=n,a=this.clientConfig.getConfigs();s.entity=null!==(r=null!==(i=window.location.hostname)&&void 0!==i?i:a.partnerName)&&void 0!==r?r:void 0,s.visitorId=a.userDeviceId,s.loc=this.getLocation(),s.isLegacy=!![];const l=await this.api.catalogSearch(s);return l.products&&l.products.length>0&&this.trackViewItemList(l.products),l}async addToCart(n){try{this.uiCommands.openDrawer(C.CART),await this.cartCommands.addItem(n)}catch(i){throw this.logger.error("Error adding product to cart from product list",i),i}}async addPresaleToCart(n){try{await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(C.CHECKOUT)}catch(i){throw this.logger.error("Error adding presale product to cart from product list",i),i}}trackViewItemList(n){if(0!==n.length)try{const i=n.map((n,i)=>({...this.convertProductToBaseItem(n),index:i+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking view_item_list event",i)}}trackSelectItem(n){try{const i=this.convertProductToBaseItem(n);this.googleTagManager.selectItem(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking select_item event",i)}}convertProductToBaseItem(n){var i,r,s;const a=null===(i=n.sizes)||void 0===i?void 0:i[0],l=null===(r=null==a?void 0:a.variants)||void 0===r?void 0:r[0],d=splitCategoryPath(n.catPath);return{item_id:null==a?void 0:a.id,item_name:n.name,item_brand:n.brand,item_size:null==a?void 0:a.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:(null==l?void 0:l.price)?centToDollar(l.price):(null===(s=n.priceInfo)||void 0===s?void 0:s.average)?centToDollar(n.priceInfo.average):void 0,item_type:n.type,item_subtype:n.subType,upc:null==a?void 0:a.upc,grouping_id:n.salsifyGrouping,product_id:null==a?void 0:a.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:n=>this.command.product.productDataForEventFromStore(n)},this.addressActions={setAddressByPlacesId:async n=>{try{if(!n||""===n.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const i=await this.command.address.getAddressDetails(n);await this.command.address.setSelectedAddress({id:n,address:i.address,coordinates:i.coords,formattedAddress:i.formattedAddress})}catch(i){throw this.logger.error("Error setting address by placesId:",i),i}},setAddressManually:async(n,i)=>{try{if(!n||!i)throw new SDKError("Both address and coordinates are required.",!![]);if(!(n.one&&n.city&&n.state&&n.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof i.lat||"number"!=typeof i.long)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof i.lat+", long: "+typeof i.long,!![]);if(i.lat<-90||i.lat>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+i.lat,!![]);if(i.long<-180||i.long>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+i.long,!![]);await this.command.address.setAddressManually(n,i)}catch(r){throw this.logger.error("Error setting manual address:",r),r}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(C.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(C.CART)},addProduct:async(n,i)=>{var r,s;try{if(!n||0===n.length)return this.logger.warn("No products provided to add to cart"),void 0;const a=this.getLocation();if(void 0===a)return this.pendingCartParams=n,this.pendingCartOpenFlag=null!=i?i:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(C.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;i===!![]&&this.command.ui.openDrawer(C.CART);const l=[...new Set(n.map(n=>n.identifier))],d=await this.api.getProductsData(l,a);if(!d||!d.products||0===d.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(x.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const i of n){let n=null;for(let r=0;r<d.products.length;r++){const s=d.products[r];let a=![];for(let n=0;n<s.sizes.length;n++){const r=s.sizes[n];if(r.upc===i.identifier||r.id===i.identifier||s.salsifyGrouping===i.identifier){a=!![];break}}if(a){n=s;break}}if(!n){this.logger.warn("No product found for identifier: "+i.identifier);continue}const a=n.sizes[0];if(!a){this.logger.warn("No sizes found for product: "+i.identifier);continue}if((null===(s=null===(r=null==a?void 0:a.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+i.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let l=null;for(let r=0;r<a.variants.length;r++){const n=a.variants[r];let s=![];if(i.fulfillmentType===E.ON_DEMAND&&(s=!(!n.fulfillmentTypes||!n.fulfillmentTypes.onDemand||""===n.fulfillmentTypes.onDemand)),i.fulfillmentType===E.SHIPPING&&(s=!(!n.fulfillmentTypes||!n.fulfillmentTypes.shipping||""===n.fulfillmentTypes.shipping)),s){l=n;break}}if(!l){this.logger.warn("No supported variant found for product: "+i.identifier+" with fulfillment type: "+i.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const u=i.fulfillmentType===E.ON_DEMAND?l.fulfillmentTypes.onDemand:l.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:a.upc,fulfillmentId:u,partNumber:l.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(x.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:l}),this.logger.info("Products added to cart successfully:",l)}catch(a){throw this.logger.error("Error adding products to cart:",a),this.clearPendingCartOperation(),this.pubSub.publishAction(x.CART_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:a.message||"Failed to add products to cart"}),a}},applyPromoCode:async n=>{try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const i=n.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),s=r.layout.allowPromoCodes;if(!s)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const a=this.store.get("cart.promoCode");if(a&&a.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(i);const l=this.command.cart.getDetails();this.pubSub.publishAction(x.CART_PROMO_CODE_APPLIED,{discountAmount:l.amounts.discounts,newTotal:l.amounts.total}),this.logger.info("Promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply promo code:",i),this.pubSub.publishAction(x.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const r=this.command.cart.getDetails();this.pubSub.publishAction(x.CART_PROMO_CODE_REMOVED,{newTotal:r.amounts.total}),this.logger.info("Promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove promo code:",n),n}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(x.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(C.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(C.CHECKOUT)},addProduct:async(n,i)=>{try{if(!n||0===n.length)return this.logger.warn("No products provided to add to checkout"),void 0;i===!![]&&this.command.ui.openDrawer(C.CHECKOUT);const r=n.map(n=>n.identifier);await this.cartActions.addProduct(n),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:r}),this.logger.info("Products added to checkout successfully:",r)}catch(r){throw this.logger.error("Error adding products to checkout:",r),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:r.message||"Failed to add products to checkout"}),r}},addPresaleProduct:async n=>{var i,r;try{if(!n||"object"!=typeof n||!n.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const s=this.getLocation();if(void 0===s)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(C.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const a=await this.api.getProductsData([n.identifier],s);if(!a||!a.products||0===a.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"No product found",isPresale:!![]}),void 0;const l=a.products[0],d=l.sizes[0];if(!d)return this.logger.warn("No sizes found for presale product: "+n.identifier),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(r=null===(i=null==d?void 0:d.attributes)||void 0===i?void 0:i.presale)||void 0===r?void 0:r.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+n.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let u=null;for(let i=0;i<d.variants.length;i++){const r=d.variants[i];let s=![];if(n.fulfillmentType===E.ON_DEMAND&&(s=!(!r.fulfillmentTypes||!r.fulfillmentTypes.onDemand||""===r.fulfillmentTypes.onDemand)),n.fulfillmentType===E.SHIPPING&&(s=!(!r.fulfillmentTypes||!r.fulfillmentTypes.shipping||""===r.fulfillmentTypes.shipping)),s){u=r;break}}if(!u)return this.logger.warn("No supported variant found for presale product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=n.fulfillmentType===E.ON_DEMAND?u.fulfillmentTypes.onDemand:u.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:d.upc,fulfillmentId:f,partNumber:u.partNumber,quantity:n.quantity,engravingLines:[],identifier:n.identifier}),this.command.ui.openDrawer(C.CHECKOUT),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[n.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+n.identifier)}catch(s){throw this.logger.error("Error adding presale product to checkout:",s),this.pubSub.publishAction(x.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:s.message||"Failed to add presale product to checkout",isPresale:!![]}),s}},applyPromoCode:async n=>{var i;try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const r=n.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const l=this.store.get("checkout.promoCode");if(l&&l.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(n);const d=this.store.get("checkout"),u=null==d?void 0:d.promoCode;this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==u?void 0:u.discountAmount)||0,newTotal:(null===(i=null==d?void 0:d.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(r){throw this.logger.error("Failed to apply checkout promo code:",r),this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{var n;try{const i=this.themeProvider.getConfigs("global"),r=i.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const s=this.store.get("checkout");this.pubSub.publishAction(x.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:(null===(n=null==s?void 0:s.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(i){throw this.logger.error("Failed to remove checkout promo code:",i),i}},applyGiftCard:async n=>{var i;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(n);const a=this.store.get("checkout");this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(i=null==a?void 0:a.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){throw this.logger.error("Failed to apply gift card:",r),this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),r}},removeGiftCard:async n=>{var i;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(n);const a=this.store.get("checkout");this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(i=null==a?void 0:a.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card removed successfully")}catch(r){throw this.logger.error("Failed to remove gift card:",r),this.pubSub.publishAction(x.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),r}},toggleIsGift:async n=>{await this.command.checkout.toggleIsGift(n)},toggleBillingSameAsShipping:async n=>{await this.command.checkout.toggleBillingSameAsShipping(n)},toggleMarketingPreferences:(n,i)=>{this.command.checkout.toggleMarketingPreferences(n,i)},getDetails:()=>{var n,i,r;const s=this.store.get("checkout"),a=s.items||{},l={};for(const[d,u]of Object.entries(a))l[d]={liquidId:u.liquidId,variantId:u.variantId,cartItemId:d,retailerId:u.retailerId,fulfillmentId:u.fulfillmentId,salsifyGrouping:u.salsifyGrouping,name:u.name,catPath:u.catPath,volume:u.volume,uom:u.uom,proof:u.proof,abv:u.abv,containerType:u.containerType,container:u.container,size:u.size,pack:u.pack,packDesc:u.packDesc,mainImage:u.mainImage,brand:u.brand,partNumber:u.partNumber,upc:u.upc,sku:u.sku,price:u.price,unitPrice:u.unitPrice,quantity:u.quantity,unitTax:u.unitTax,bottleDeposits:u.bottleDeposits,attributes:u.attributes,retailerName:u.retailerName,expectationDetail:u.expectationDetail};return{cartId:s.cartId||"",isGift:s.isGift||![],billingSameAsShipping:s.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(n=s.marketingPreferences)||void 0===n?void 0:n.canEmail)||![],canSms:(null===(i=s.marketingPreferences)||void 0===i?void 0:i.canSms)||![]},hasPromoCode:!!(null===(r=s.promoCode)||void 0===r?void 0:r.code),hasGiftCards:Array.isArray(s.giftCards)&&s.giftCards.length>0,itemCount:Object.values(l||{}).reduce((n,i)=>n+(i.quantity||0),0),amounts:s.amounts,items:l}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const m=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+x.ADDRESS_UPDATED,m)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const n=this.pendingCartParams,i=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(n,i)}catch(n){this.logger.error("Failed to retry cart operation after address update",n)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const n=this.store.get("address");if(n.address.one&&n.coordinates.long&&n.coordinates.lat)return{coords:n.coordinates,address:n.address}}}const It="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",Tt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const n=LoggerFactory,i=n.instances;if(i)for(const[s,a]of i)this.interceptLoggerInstance(a,s);const r=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=n=>{const i=r(n);return this.interceptLoggerInstance(i,n),i}}interceptLoggerInstance(n,i){if(n.l)return;const r=n.debug.bind(n),s=n.info.bind(n),a=n.warn.bind(n),l=n.error.bind(n),p=(n,r,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:n,message:r,data:s,context:i});n.debug=(n,i)=>{r(n,i),this.addLogEntry(p("debug",n,i))},n.info=(n,i)=>{s(n,i),this.addLogEntry(p("info",n,i))},n.warn=(n,i)=>{a(n,i),this.addLogEntry(p("warn",n,i))},n.error=(n,i)=>{l(n,i),this.addLogEntry(p("error",n,i))},n.l=!![]}interceptPubSubEvents(){const n=PubSubService.getInstance(),i=n.publishAction.bind(n);n.publishAction=(n,r)=>{i(n,r),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+n,data:r,context:"PubSub"})};const r=n.publishForm.bind(n);n.publishForm=(n,i)=>{r(n,i),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+n,data:i,context:"PubSub"})}}interceptGtmEvents(){const n=GoogleTagManagerService.getInstance(),i=n.executeEvent.bind(n);n.executeEvent=(n,r,s)=>{i(n,r,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+r,data:s,context:"GTM."+n})}}addLogEntry(n){this.logs.push(n),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const n=this.logs.filter(n=>{switch(n.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",n.forEach(n=>{const i=this.createLogElement(n);this.logContainer.appendChild(i)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const n=document.querySelector(Tt);n&&n.remove(),this.panelElement=document.createElement(Tt);const i=window.innerWidth<=768,r=window.innerWidth<=480;r?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):i?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const n=this.panelElement.attachShadow({mode:"closed"}),i=document.createElement("style");i.textContent=It,n.appendChild(i),this.floatingButton=this.createFloatingButton(),n.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const r=this.createHeader();this.panelContainer.appendChild(r);const s=this.createToggles();this.panelContainer.appendChild(s),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const a=this.createResizeHandle();this.panelContainer.appendChild(a),n.appendChild(this.panelContainer),this.setupShadowEventListeners(n)}createHeader(){const n=document.createElement("div");n.className="header",n.title="Drag to move panel";const i=document.createElement("div");i.className="icon",i.innerHTML="🔍",i.title="Elements Debug Console",i.style.cursor="help";const r=document.createElement("div");r.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",r.appendChild(s),r.appendChild(a);const l=document.createElement("button");return l.className="minimize",l.innerHTML="−",l.title="Minimize debug panel",l.addEventListener("click",()=>this.toggleVisibility()),n.appendChild(i),n.appendChild(r),n.appendChild(l),n}createToggles(){const n=document.createElement("div");n.className="toggles";const i=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];i.forEach(({key:i,label:r,description:s,color:a})=>{const l=document.createElement("label");l.className="toggle",l.title=s;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==i,d.addEventListener("change",n=>{const r=n.target;"showEvents"===i&&(this.showEvents=r.checked),"showGtmEvents"===i&&(this.showGtmEvents=r.checked),"showLogs"===i&&(this.showLogs=r.checked),this.renderLogs()});const u=document.createElement("span");u.textContent=r,u.style.color=a,l.appendChild(d),l.appendChild(u),n.appendChild(l)});const r=document.createElement("button");return r.className="clear-btn",r.innerHTML="🗑️",r.title="Clear all logs",r.addEventListener("click",()=>this.clearLogs()),n.appendChild(r),n}createResizeHandle(){const n=document.createElement("div");n.className="resize-handle",n.title="Drag to resize panel",n.style.cursor="nw-resize";let i=![],r=0,s=0,a=0,l=0;n.addEventListener("mousedown",n=>{i=!![],r=n.clientX,s=n.clientY,a=Number.parseInt(this.panelElement.style.width,10)||500,l=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",G),document.addEventListener("mouseup",c),n.preventDefault()});const G=n=>{if(!i||!this.panelElement)return;const d=n.clientX-r,u=n.clientY-s,f=window.innerWidth<=768,g=window.innerWidth<=480;let v,b,x,w;g?(v=280,b=window.innerWidth-20,x=200,w=.4*window.innerHeight):f?(v=300,b=window.innerWidth-30,x=200,w=.4*window.innerHeight):(v=300,b=800,x=200,w=600);const C=Math.max(v,Math.min(b,a+d)),E=Math.max(x,Math.min(w,l+u));this.panelElement.style.width=C+"px",this.panelElement.style.height=E+"px"},c=()=>{i=![],document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",c)};return n}setupShadowEventListeners(n){if(!this.panelElement)return;const i=n.querySelector(".header");if(i){let n=![],r=0,s=0,a=0,l=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;n=!![],r=i.clientX,s=i.clientY;const d=this.panelElement.getBoundingClientRect();a=d.left,l=d.top,document.addEventListener("mousemove",G),document.addEventListener("mouseup",c),i.preventDefault()});const G=i=>{if(!n||!this.panelElement)return;const d=i.clientX-r,u=i.clientY-s;this.panelElement.style.left=a+d+"px",this.panelElement.style.top=l+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},c=()=>{n=![],document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",c)}}}createFloatingButton(){const n=document.createElement("div");return n.className="floating-btn",n.innerHTML="⚙️",n.title="Open Elements Debug Console",n.style.display="none",n.addEventListener("click",()=>{this.toggleVisibility()}),n}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(n){const i=document.createElement("div");i.className="log-entry "+n.type+" "+n.level;const r=new Date(n.timestamp).toLocaleTimeString();return i.innerHTML='\n <div class="log-meta">\n <div class="log-type '+n.type+'">'+n.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+r+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(n.message)+"\n "+(n.context?'<div class="log-context">'+this.escapeHtml(n.context)+"</div>":"")+"\n "+(n.data?'<div class="log-data"><pre>'+this.formatJsonData(n.data)+"</pre></div>":"")+"\n </div>\n ",i}formatJsonData(n){try{return"object"==typeof n&&null!==n?JSON.stringify(n,null,2):String(n)}catch(i){return String(n)}}escapeHtml(n){const i=document.createElement("div");return i.textContent=n,i.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(n){if(this.u()){const i=this.h(n);if(i)return this.m(n,i)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(n,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.u()}m(n,i){return(n+"_"+i).toLowerCase()}u(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const n=window.localStorage,i="__localStorage_test_"+Date.now()+"__",r="test";n.setItem(i,r);const s=n.getItem(i);return s!==r?(this.isLocalStorageAvailable=![],![]):(n.removeItem(i),this.isLocalStorageAvailable=!![],!![])}catch(n){const r=n instanceof DOMException&&(22===n.code||1014===n.code||"QuotaExceededError"===n.name||"NS_ERROR_DOM_QUOTA_REACHED"===n.name);if(r)try{const n=window.localStorage;return n&&n.length>0?(this.I()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(i){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],n instanceof DOMException){const i={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},r=i[n.name]||"Storage error: "+n.name,s=this.I()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+r)}else console.warn("localStorage unavailable:",n.message||"Unknown error");return![]}}h(n){try{const i=this.clientConfig.get("localStorageKeyPrefix")+"_"+n.toLowerCase()+"_";for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);if(null==r?void 0:r.startsWith(i)){const n=r.substring(i.length);if(n&&/^[a-f0-9]+$/.test(n))return n}}return null}catch(i){return null}}v(){const n=this.getFingerprintData(),i=Object.keys(n).sort().map(i=>i+":"+n[i]).join("|");return this.T(i)}C(){try{const n=screen,i=n.colorDepth||24,r=n.pixelDepth||i,s=this.D(),a=Math.round(100*(window.devicePixelRatio||1));return i+"|"+r+"|"+s+"|"+a}catch(n){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(ut){}return"srgb"}k(){var n;try{const i=navigator,r=[],s=((null===(n=i.languages)||void 0===n?void 0:n[0])||i.language||"en").substring(0,2);r.push(s),r.push(i.hardwareConcurrency||4);const a=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);r.push(a),r.push(i.cookieEnabled?"1":"0"),r.push(i.maxTouchPoints||0),r.push(i.deviceMemory||0),r.push(this.A()),r.push(this.I()?"webview":"browser");const l=["bluetooth"in i?"1":"0","usb"in i?"1":"0","mediaDevices"in i?"1":"0","permissions"in i?"1":"0","credentials"in i?"1":"0","storage"in i?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return r.push(l.join("")),r.join("|")}catch(i){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}A(){try{const n=navigator.userAgent.toLowerCase();return n.includes("instagram")?"ig_webview":n.includes("fban")||n.includes("fbav")?"fb_webview":n.includes("tiktok")?"tiktok_webview":n.includes("linkedin")?"linkedin_webview":n.includes("snapchat")?"snapchat_webview":n.includes("twitter")?"twitter_webview":n.includes("line/")?"line_webview":n.includes("micromessenger")?"wechat_webview":n.includes("firefox")?"gecko":n.includes("edg/")?"edge":n.includes("opr/")||n.includes("opera")?"opera":n.includes("chrome")&&!n.includes("edg")?"blink":n.includes("safari")&&!n.includes("chrome")?"webkit":"unknown"}catch(n){return"unknown"}}I(){try{const n=navigator.userAgent.toLowerCase(),i=navigator,r=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return r.some(i=>n.includes(i))?!![]:void 0===i.standalone||i.standalone?window.self!==window.top?!![]:![]:!![]}catch(n){return![]}}S(){try{const n=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return n.replace(/\//g,"_").substring(0,30)}catch(n){return"UTC"}}T(n){const i=16777619;let r=2166136261,s=2166136261,a=2166136261,l=2166136261;for(let d=0;d<n.length;d++){const u=n.charCodeAt(d);r^=u,r=Math.imul(r,i),s^=u<<1,s=Math.imul(s,i),a^=u<<2,a=Math.imul(a,i),l^=u<<3,l=Math.imul(l,i)}return r=Math.abs(r),s=Math.abs(s),a=Math.abs(a),l=Math.abs(l),r.toString(16)+s.toString(16)+a.toString(16)+l.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),i=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:i,batchSize:n===b.PRODUCTION?5:10,batchInterval:n===b.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(n,i,r={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(n))return;const s=Date.now();try{const a={eventId:"event_"+s,timestamp:s,level:n,message:i,context:r.context,error:r.error?this.buildErrorContext(r.error):void 0,component:r.component,data:r.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(n){return{name:n.name,message:n.message,stack:this.truncateStackTrace(n.stack),code:n.code,statusCode:n.status||n.statusCode}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const n=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:n||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(n){switch(n){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(n){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(n),this.stats.totalEvents++,this.stats.eventsByLevel[n.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 n;if(0===this.eventQueue.length||!(null===(n=this.config)||void 0===n?void 0:n.endpoint))return;const i=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const r=this.createBatch(i);try{this.sendBatch(r),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...i),this.stats.queuedEvents=this.eventQueue.length}}createBatch(n){const i=Date.now();return{batchId:"batch_"+i,timestamp:i,events:n}}sendBatch(n){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const i=new Blob([JSON.stringify(n)],{type:"text/plain"}),r=navigator.sendBeacon(this.config.endpoint,i);if(r)return}catch(i){return this.sendBatchViaXHR(n),void 0}this.sendBatchViaXHR(n)}sendBatchViaXHR(n){try{const i=new XMLHttpRequest;if(i.open("POST",this.config.endpoint,![]),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(n)),i.status<200||i.status>=300)throw new SDKError("XHR request failed with status: "+i.status)}catch(i){throw new SDKError("Both sendBeacon and XHR failed: "+i.message)}}truncateStackTrace(n){if(n)return n.split("\n").slice(0,10).join("\n")}handleInternalError(n){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",n)}shutdown(){var n;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(n=this.config)||void 0===n?void 0:n.endpoint))){const n=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(n={}){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,...n}}initialize({data:n,config:i}){var r;this.P=Object.freeze(n),this._=Object.freeze({type:i.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(r=null==i?void 0:i.useShadowDom)&&void 0!==r?r:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(n){return n.map(n=>this.interpolatePath(n))}interpolatePath(n){if("string"!=typeof n)return n;const i=/\{([^}]+)}/g;return n.replace(i,(i,r)=>{const s=this.P[r];return null==s?(this.logger.warn('Parameter "'+r+'" not found in component params for path "'+n+'"'),i):String(s)})}connectedCallback(){var n,i;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this._.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(n=this.connected)||void 0===n||n.call(this)}catch(r){this.logger.error("Component connectedCallback error in "+((null===(i=this._)||void 0===i?void 0:i.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"connectedCallback")}}disconnectedCallback(){var n,i;try{this.cleanup(),null===(n=this.disconnected)||void 0===n||n.call(this)}catch(r){this.logger.error("Component disconnectedCallback error in "+((null===(i=this._)||void 0===i?void 0:i.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"disconnectedCallback")}}setup(){var n,i,r;try{this.updateHostClasses(),this.updateHostAttributes(),null===(n=this.beforeSetupStoreWatchers)||void 0===n||n.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(i=this.beforeConnected)||void 0===i||i.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(r=this._)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const i of this.unsubscribers)try{i()}catch(n){this.logger.error("Cleanup error during component destruction",n),n instanceof Error&&this.captureComponentError(n,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var n;if(!this.reactiveOptions.autoDestroy)return;let i=this.reactiveOptions.autoDestroyPath;if(!i&&(null===(n=this.reactiveOptions.watchStorePaths)||void 0===n?void 0:n.length)&&(i=this.reactiveOptions.watchStorePaths[0]),!i)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const r=this.interpolatePath(i),s=this.store.watch(r,(n,i)=>{this.isDestroyed||void 0===n&&void 0!==i&&this.handleAutoDestroy(r)});this.unsubscribers.push(s)}handleAutoDestroy(n){var i;if(this.isDestroyed)return;null===(i=this.beforeAutoDestroy)||void 0===i?void 0:i.call(this,n);const r=this.reactiveOptions.autoDestroyDelay||0;r>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},r):this.destroyComponent()}destroyComponent(){var n;if(!this.isDestroyed)try{null===(n=this.onAutoDestroy)||void 0===n?void 0:n.call(this),this.remove()}catch(i){this.logger.error("Error during auto-destroy of "+this._.tagName,i),i instanceof Error&&this.captureComponentError(i,"auto-destroy")}}setupStoreWatchers(){var n;try{let n=this.reactiveOptions.watchStorePaths;if(!(null==n?void 0:n.length)||!this.P)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,r;try{if(this.isDestroyed)return;const r=n.map(n=>n.path).join(", "),s="store:["+r+"]",a=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,n);a!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(r=this._)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Store watchers setup error in "+((null===(n=this._)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupStoreWatchers")}}setupNonRenderingWatchers(){var n;try{let n=this.reactiveOptions.watchOnlyStorePaths;if(!(null==n?void 0:n.length)||!this.P)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,r;try{if(this.isDestroyed)return;null===(i=this.onStoreWatch)||void 0===i?void 0:i.call(this,n)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(r=this._)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Non-rendering watchers setup error in "+((null===(n=this._)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupNonRenderingWatchers")}}triggerRender(n){this.lastRenderTrigger=n,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var n,i;if(!this.initialized||this.isDestroyed)return;const r=performance.now();this.renderCount++;try{const i=this.template();"string"==typeof i&&(this.container.innerHTML=i),i instanceof HTMLElement&&safeReplaceChildren(this.container,i),Array.isArray(i)&&safeReplaceChildren(this.container,...i);const a=performance.now()-r;this.logRenderInfo(a);try{null===(n=this.afterRender)||void 0===n?void 0:n.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this._.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(a){const n=performance.now()-r;this.logger.error("❌ Component render error in "+this._.tagName,a),this.captureComponentError(a,"render",n),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this._.type,message:a instanceof Error?a.message:String(a)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,a,"render")}catch(l){this.logger.error("❌ onError hook error in "+this._.tagName,l)}}}logRenderInfo(n){const i=this._.type,r=this._.tagName,s=n>16?"🐌":n>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+i+" </"+r+"> | #"+this.renderCount+" | "+n.toFixed(2)+"ms | "+this.lastRenderTrigger),n>16&&(this.logger.warn("⚠️ Slow render in "+i+"("+r+"): "+n.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:n,threshold:16,componentType:i,tagName:r,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+n.toFixed(2)+"ms",{context:"Component:"+r+":performance",component:{type:i,tagName:r,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this._.useShadowDom}}))}rerender(n){this.triggerRender(n?"manual:rerender:"+n:"manual:rerender()")}captureComponentError(n,i,r){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",n.message,{context:"Component:"+this._.tagName+":"+i,component:{type:this._.type,tagName:this._.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:r,useShadowDom:this._.useShadowDom}})}catch(s){}}updateHostClasses(){const n=this.hostClasses;if(n.length>0){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}}addHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}removeHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.remove(...i)}toggleHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());for(const r of i)this.classList.toggle(r)}addHostAttribute(n,i){n&&"string"==typeof n&&i&&"string"==typeof i&&(this.setAttribute(n,String(i)),this.hostAttributes[n]=String(i))}removeHostAttribute(n){n&&"string"==typeof n&&(this.removeAttribute(n),delete this.hostAttributes[n])}updateHostAttributes(){const n=this.hostAttributes;for(const[i,r]of Object.entries(n))i&&"string"==typeof i&&r&&"string"==typeof r&&this.setAttribute(i,String(r))}get params(){return this.P}get config(){return this.themeProvider.getComponentConfig(this._.type)}get elementConfig(){return this._}getConfigs(n){return this.themeProvider.getConfigs(n)}getStoreValue(n){return this.store.get(n)}setStoreValue(n,i){return this.store.set(n,i)}watchStore(n,i){const r=this.store.watch(n,i);return this.unsubscribers.push(r),r}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var n;const i=null!==(n=this.params.options)&&void 0!==n?n:{};return ComponentFactoryService.createElement({type:C.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var n,i,r,s;const a=this.getStoreValue("address"),l=null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![],d=null!==(i=this.params.productId)&&void 0!==i?i:"",u=null!==(r=this.params.options)&&void 0!==r?r:{},f=null!==(s=u.showLabel)&&void 0!==s?s:!![],g=[];if(f){const n=document.createElement("span");n.textContent="Delivers to:",g.push(n)}const v=document.createElement("button");v.type="button",v.textContent=a.formattedAddress||"Select an address";const b=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return v.setAttribute("aria-label",b),v.addEventListener("click",async()=>{if(l)return this.commands.ui.openDrawer(C.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!l&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(C.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,C.ADDRESS_INPUT,{productId:d}))}),g.push(v),g}}const ArrowRightIcon=({width:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="arrow-right-icon '+r+'" 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:n=24,height:i=24,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 489 489" class="bag-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="checkbox-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="'+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="chevron-left-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="'+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="close-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="error-info-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="info-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="search-icon '+r+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+a+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="success-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="trash-icon '+r+'" 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:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="warning-icon '+r+'" 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 n;return null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![]},this.handleInputChange=n=>{const i=n.target,r=i.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");i.value=r;const s=r.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 n=this.params.productId,i=this.clientConfig.isMobile(),r=this.isIndependentComponent();(i||r)&&this.commands.ui.closeDrawer(),!i&&n&&await this.commands.product.closeProductDrawer(n)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(ut){this.logger.error("Address edit cancellation failed",ut)}},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 n=this.getStoreValue("address"),i=(null==n?void 0:n.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==n?void 0:n.coordinates.long)!==this.selectedAddress.coordinates.long;i&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(n){this.logger.error("Address selection and availability check failed",n),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async n=>{const i=n.currentTarget.dataset.suggestionId;if(i)try{this.error=null,this.updateErrorDisplay();const n=await this.commands.address.getAddressDetails(i);if(0===Object.keys(n).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:i,address:n.address,coordinates:n.coords,formattedAddress:n.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(r){this.logger.error("Address details retrieval failed",r),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=n=>{this.container.contains(n.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const n=this.getStoreValue("address");(null==n?void 0:n.formattedAddress)&&(this.selectedAddress=n)}async searchAddresses(n){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const i=await this.commands.address.searchAddresses(n);this.suggestions=i.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(i){this.logger.error("Address search operation failed",i),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const n=this.errorContainer.querySelector(".error-text");n&&(n.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const n=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(n),void 0}for(const n of this.suggestions){const i=this.createElement("li",{className:"suggestion-item"}),r=this.createElement("span",{textContent:n.description});i.appendChild(r),i.setAttribute("data-suggestion-id",n.id),i.setAttribute("role","option"),i.setAttribute("aria-label","Select address: "+n.description),i.setAttribute("tabindex","0"),i.addEventListener("click",this.handleSuggestionClick),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())}),this.suggestionsContainer.appendChild(i)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(n,i){const r=document.createElement(n);return i&&Object.assign(r,i),r}createErrorContainer(){const n=this.createElement("div",{className:"error-message"});n.style.display="none",n.setAttribute("role","alert"),n.setAttribute("aria-live","assertive"),n.setAttribute("aria-atomic","true");const i=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),r=this.createElement("span",{className:"error-text"});return n.appendChild(i),n.appendChild(r),n}createCheckButton(){const n=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return n.setAttribute("aria-label","Save and check address availability"),n.addEventListener("click",this.handleCheckAvailability),n}createCancelButton(){const n=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return n.setAttribute("aria-label","Cancel address selection"),n.addEventListener("click",this.handleCancel),n}template(){var n,i,r;const s=this.getConfigs("global"),a=null!==(n=this.params.options)&&void 0!==n?n:{},l=null!==(i=a.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),l){const n=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(n)}const d=this.createElement("div",{className:"input-wrapper "+s.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(r=this.selectedAddress)||void 0===r?void 0:r.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),d.appendChild(this.inputElement);const u=this.createElement("span");u.className="input-icon",u.innerHTML=SearchIcon({width:16,height:16,className:""}),d.appendChild(u),this.inputContainer.appendChild(d),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const f=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),g=[this.inputContainer,f,this.errorContainer],v=this.createElement("div",{className:"action-buttons"}),b=this.createCancelButton();v.appendChild(b);const x=this.createCheckButton();return v.appendChild(x),g.push(v),document.addEventListener("click",this.handleDocumentClick),g}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const n=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&n.push("cart-no-header"),this.params.isIndependentComponent&&n.push("independent"),n}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const n=[],i=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!i){const i=ComponentFactoryService.createElement({type:C.CART_HEADER});n.push(i)}const r=ComponentFactoryService.createElement({type:C.CART_BODY});n.push(r);const s=ComponentFactoryService.createElement({type:C.CART_FOOTER});return n.push(s),n}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const n=document.createElement("div");n.className="empty-cart-container";const i=document.createElement("h3");return i.className="empty-cart-content",i.textContent="Your cart is empty",n.appendChild(i),n}createLoadingElement(){const n=document.createElement("div");return n.setAttribute("data-component-type","cart-body-loading"),n.innerHTML=this.loadingTemplate(),n}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(n){try{return ComponentFactoryService.createElement({type:C.CART_RETAILER,retailerId:n.id})}catch(i){return this.logger.error("Cart retailer component creation failed",i),document.createElement("div")}}getRetailerElementById(n){return this.container.querySelector('[data-retailer-id="'+n+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const n=this.createEmptyCartElement();this.container.appendChild(n),this.setupEmptyCartListeners()}addLoadingOverlay(){const n=this.getLoadingElement();if(!n){const n=this.createLoadingElement();this.container.appendChild(n)}}removeLoadingOverlay(){const n=this.getLoadingElement();n&&n.remove()}setupEmptyCartListeners(){const n=this.container.querySelector('[data-action="continue-shopping"]');n&&n.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(n,i){const r=this.createRetailerElement(i);r.setAttribute("data-retailer-id",n),this.container.appendChild(r)}removeRetailerElement(n){const i=this.getRetailerElementById(n);i&&i.remove()}updateRetailerElement(n,i){const r=this.getRetailerElementById(n);if(r){const s=this.createRetailerElement(i);s.setAttribute("data-retailer-id",n),r.replaceWith(s)}}hasRetailerDataChanged(n,i){return n?![]:!![]}getValidRetailers(n){if(!n)return{};const i={};for(const[r,s]of Object.entries(n))s&&"object"==typeof s&&s.id&&(i[r]=s);return i}getValidRetailerIds(n){const i=this.getValidRetailers(n);return new Set(Object.keys(i))}onStoreChanged(n){const i=n.find(n=>"cart.retailers"===n.path),r=n.find(n=>"cart.loading"===n.path);if(i){const n=this.getValidRetailers(i.oldValue),r=this.getValidRetailers(i.value),s=this.getValidRetailerIds(i.oldValue),a=this.getValidRetailerIds(i.value),l=s.size,d=a.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),f=Object.keys(u).length;if(d>0&&0===f)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===l&&d>0){this.container.innerHTML="";for(const[n,i]of Object.entries(r))this.addRetailerElement(n,i)}else if(l>0&&0===d)this.showEmptyCartState();else if(d>0){for(const n of s)a.has(n)||this.removeRetailerElement(n);for(const i of a){const a=r[i],l=n[i];s.has(i)?this.hasRetailerDataChanged(l,a)&&this.updateRetailerElement(i,a):this.addRetailerElement(i,a)}}else 0===l&&0===d&&this.showEmptyCartState()}if(r){const n=r.value,i=r.oldValue;n!==i&&(n?this.addLoadingOverlay():this.removeLoadingOverlay())}return r||i,![]}afterRender(){this.setupEmptyCartListeners();const n=this.getStoreValue("cart.loading");n&&this.addLoadingOverlay()}template(){const n=this.getStoreValue("cart.retailers")||{},i=Object.values(n);if(0===i.length)return this.createEmptyCartElement();const r=[];for(const s of i){const n=this.createRetailerElement(s);n.setAttribute("data-retailer-id",s.id),r.push(n)}return r}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(n){const i=n.some(n=>n.path.includes("cart.items")),r=n.some(n=>n.path.includes("cart.totals")),s=n.some(n=>n.path.includes("cart.fulfillments")),a=n.some(n=>"cart.loading"===n.path),l=n.some(n=>n.path.includes("cart.retailers"));if(i&&this.updateSubtotalItemsCount(),r&&this.subtotalPrice){const n=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(n.subtotal+n.engravingFee-n.discounts)}(s||r||a||i||l)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const n=this.getStoreValue("cart.loading");if(n)return!![];const i=this.getStoreValue("cart.items")||{},r=Object.values(i).some(n=>n.updating);if(r)return!![];const s=this.getStoreValue("cart.fulfillments")||{},a=Object.values(s).some(n=>n.updating);if(a)return!![];const l=this.getStoreValue("cart.retailers")||{},d=Object.values(l).some(n=>n.updating);return d?!![]:![]}hasUnmetMinimum(n){var i;const r=n.subtotal;if(n.type===E.SHIPPING){const s=n.fees;if((null===(i=s.individual)||void 0===i?void 0:i.active)&&s.individual.min>0&&r<s.individual.min)return!![]}if(n.type===E.ON_DEMAND){const i=n.fees;if(i.min>0&&r<i.min)return!![]}return![]}shouldDisableCheckout(){const n=this.getStoreValue("cart.fulfillments")||{};return Object.values(n).some(n=>this.hasUnmetMinimum(n))}updateCheckoutButtonState(){const n=this.getStoreValue("cart.items")||{},i=Object.keys(n).length>0;if(this.checkoutButton){const n=this.isAnythingLoading(),r=this.shouldDisableCheckout(),s=n||r||!i;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",n)}}updateSubtotalItemsCount(){const n=this.getStoreValue("cart.items"),i=Object.values(n).reduce((n,i)=>n+i.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+i+" item"+(1!==i?"s":"")+"):")}async handleCheckout(n){return this.clientConfig.isBuilder()?(n.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(n.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const n=this.getConfigs("global"),i=this.getStoreValue("cart.totals"),r=[],s=document.createElement("div");s.className="cart-footer-header";const a=document.createElement("div");a.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",a.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(i.subtotal+i.engravingFee-i.discounts),a.appendChild(this.subtotalPrice);const l=document.createElement("p");if(l.textContent="Taxes & fees will be calculated at checkout",l.className="taxes-fees-info",s.appendChild(a),s.appendChild(l),r.push(s),n.layout.allowPromoCodes){const n=ComponentFactoryService.createElement({type:C.CART_PROMO_CODE});r.push(n)}const d=ComponentFactoryService.createElement({type:C.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(r.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 n=>{n.preventDefault(),await this.handleCheckout(n)}),this.checkoutButton.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handleCheckout(n))}),r.push(this.checkoutButton),n.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:C.POWERED_BY,context:"general"});r.push(n)}return r}}const shouldShowMinimumPurchaseAlert=(n,i=![])=>{var r,s;if(!n)return![];const a=n.subtotal;if(n.type===E.SHIPPING){const l=n.fees;if(i&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0&&a<l.pack.min)return!![];if(!i&&(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&a<l.individual.min)return!![]}else if(n.type===E.ON_DEMAND){const i=n.fees;if(i.min>0&&a<i.min)return!![]}return![]},getMinimumPurchaseMessage=(n,i=![])=>{var r,s;if(!n)return{message:"",type:"warning"};const a=n.subtotal;if(n.type===E.SHIPPING){const l=n.fees;let d=0;if(i&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0?d=l.pack.min:(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&(d=l.individual.min),d>0&&a<d)return{message:"+"+formatCentToDollarText(d-a)+" needed for order minimum",type:"warning"}}if(n.type===E.ON_DEMAND){const i=n.fees,r=i.min>0?i.min:0;if(r>0&&a<r)return{message:"+"+formatCentToDollarText(r-a)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(n,i=![])=>{var r,s;if(!n)return![];const a=n.subtotal;if(n.type===E.SHIPPING){const l=n.fees;if(i&&(null===(r=l.pack)||void 0===r?void 0:r.active)&&l.pack.min>0&&a<l.pack.min)return!![];if(!i&&(null===(s=l.individual)||void 0===s?void 0:s.active)&&l.individual.min>0&&a<l.individual.min)return!![]}if(n.type===E.ON_DEMAND){const i=n.fees;if(i.min>0&&a<i.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const n=this.config||{};if(n.showIcon===![])return null;const i={warning:"warning",success:"success",info:"info"},r={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=i[this.params.messageType]||"warning",a=document.createElement("div");return a.className="alert-icon alert-icon-"+this.params.messageType,a.appendChild(htmlStringToElement(r[s]({width:16,height:16,className:"alert-icon-svg"}))),a}template(){var n;const i=[],r=this.getIconElement();r&&i.push(r);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,i.push(s),"detailed"===(null===(n=this.config)||void 0===n?void 0:n.alertType)&&this.params.currentTotal){const n=document.createElement("div");n.className="alert-details";const r=document.createElement("small");r.className="alert-details-text",r.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),n.appendChild(r),i.push(n)}return i}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||{};return Object.values(i).find(i=>i.fulfillmentId===n)}handleItemsUpdate(n,i){const r=new Set(n||[]),s=new Set(i||[]);for(const a of r)if(!s.has(a)){const n=this.container.querySelector('[data-item-id="'+a+'"]');n&&n.remove()}for(const a of s)if(!r.has(a)){const n=ComponentFactoryService.createElement({type:C.CART_ITEM,itemId:a});n.setAttribute("data-item-id",a),this.container.appendChild(n)}}setupItemElements(){const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||[],r=this.container.querySelectorAll("[data-item-id]");for(const s of r)s.remove();for(const s of i){const n=ComponentFactoryService.createElement({type:C.CART_ITEM,itemId:s});n.setAttribute("data-item-id",s),this.container.appendChild(n)}}setupMinimumPurchaseAlert(){var n;const i=this.getFulfillmentId(),r=(null===(n=this.getProductStore())||void 0===n?void 0:n.pack)||![],s=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),s&&shouldShowMinimumPurchaseAlert(s,r)){const n=getMinimumPurchaseMessage(s,r),i=ComponentFactoryService.createElement({type:C.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});i.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(i)}}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","fulfillment-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(r),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var n;const i=this.getFulfillmentId(),r=this.getStoreValue("cart.fulfillments."+i);return(null===(n=null==r?void 0:r.items)||void 0===n?void 0:n.length)?r.items.some(n=>{const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.updating)===!![]}):![]}checkAndUpdateLoadingState(){const n=this.isAnyItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}onStoreChanged(n){const i=this.getFulfillmentId(),r="cart.fulfillments."+i,s=n.find(n=>n.path===r),a=n.filter(n=>"cart.items"===n.path||n.path.startsWith("cart.items."));if(a.length>0&&this.checkAndUpdateLoadingState(),s){const n=s.oldValue,i=s.value,r=(null==n?void 0:n.items)||[],a=(null==i?void 0:i.items)||[],l=JSON.stringify(r)!==JSON.stringify(a);l&&(this.handleItemsUpdate(r,a),this.checkAndUpdateLoadingState());const d=this.hasFulfillmentFeesChanged(n,i),u=this.hasFulfillmentDataChanged(n,i,["items","updating"]);if(d&&!u&&this.setupMinimumPurchaseAlert(),!u)return![]}return![]}hasFulfillmentFeesChanged(n,i){return n?n.subtotal!==i.subtotal||n.shippingFee!==i.shippingFee||n.deliveryFee!==i.deliveryFee||JSON.stringify(n.fees)!==JSON.stringify(i.fees):!![]}hasFulfillmentDataChanged(n,i,r=[]){if(!n)return!![];const s=["type","canEngrave","retailerId"];for(const a of s)if(!r.includes(a)&&n[a]!==i[a])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const Dt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},At="America/New_York";function detectUserTimezone(n){try{if(n){const i=n.toUpperCase(),r=Dt[i];return r||At}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return At}}function getCurrentTimeInTimezone(n){try{const i=new Date,r=i.getTime(),s=6e4*i.getTimezoneOffset(),a=new Date(r+s),l=new Date(a.toLocaleString("en-US",{timeZone:n})),d=a.getTime()-l.getTime();return new Date(r+d)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(n){const i=detectUserTimezone(n);return getCurrentTimeInTimezone(i)}function isDateTimeInRange(n){const{startDate:i,endDate:r,addressState:s}=n;try{const n=getCurrentTimeInUserTimezone(s),a=!i||n>=new Date(i),l=!r||n<=new Date(r);return a&&l}catch(a){return![]}}function filterActiveItems(n,i){return n.filter(n=>isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:i}))}function hasActiveItems(n,i){return filterActiveItems(n,i).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var n,i,r;const s=this.config.layout.drawerHeaderText,a=this.getConfigs("global"),l=document.createElement("div");l.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=s,l.appendChild(d);const u=document.createElement("button");u.type="button",u.className="cart-header-close-btn",u.innerHTML=CloseIcon({width:16,height:16}),u.setAttribute("aria-label","Close cart drawer"),u.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),l.appendChild(u);const f=this.clientConfig.get("promoTicker"),g=null!==(i=null===(n=null==a?void 0:a.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],v=null!=f?f:g,b=this.store.get("address"),x=hasActiveItems(v,null===(r=null==b?void 0:b.address)||void 0===r?void 0:r.state);if(!v.length||!x)return[l];const w=ComponentFactoryService.createElement({context:"cart",type:C.PROMO_CODE_TICKER,tickers:v});return[l,w]}}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(n,i){var r,s,a,l,d,u,f,g,v,b;this.commands.ui.openDrawer(C.ENGRAVING_FORM,{identifier:n,context:"cart",lines:(null===(s=null===(r=i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],maxLines:(null===(l=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.maxLines)||1,maxCharsPerLine:(null===(u=null===(d=i.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,fee:(null===(g=null===(f=i.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.fee)||0,location:null===(b=null===(v=i.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.location})}template(){var n,i,r,s,a,l,d,u,f;const g=this.params.itemId,v=this.getStoreValue("cart.items."+g),b=this.getConfigs("global"),x=this.getStoreValue("cart.fulfillments."+v.fulfillmentId),w=v.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(n=null==x?void 0:x.expectation)||void 0===n?void 0:n.detail)||"",E=document.createElement("article");E.className="cart-item";const T=document.createElement("div");T.className="item-image";const A=document.createElement("img");A.src=v.mainImage,A.alt=v.name,T.appendChild(A);const P=document.createElement("div");P.className="item-details";const _=document.createElement("div");_.className="item-header";const N=document.createElement("h3");N.className="item-title",N.textContent=v.name;const F=document.createElement("button");F.className="item-delete",F.innerHTML=TrashIcon({}),F.setAttribute("role","button"),F.setAttribute("tabindex","0"),F.setAttribute("aria-label","Remove "+v.name+" from cart"),F.setAttribute("aria-expanded","true"),F.addEventListener("click",async()=>{await this.commands.cart.removeItem(g)}),F.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.commands.cart.removeItem(g))}),_.appendChild(N),_.appendChild(F);const R=document.createElement("div");R.className="item-specs",R.textContent=v.size+", "+v.container;const O=document.createElement("div");O.className="item-shipping-container";const L=document.createElement("div");if(L.className="item-shipping",L.textContent=w,O.appendChild(L),b.layout.enablePersonalization&&(null===(r=null===(i=null==v?void 0:v.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.isEngravable)&&(null===(a=null===(s=null==v?void 0:v.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&x.canEngrave){const n=document.createElement("span");n.className="cart-add-personalization-span",n.textContent=b.layout.personalizationText+" +"+formatCentToDollarText((null===(d=null===(l=v.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,![]),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Add personalization to "+v.name),n.addEventListener("click",()=>this.handleOpenEngravingForm(g,v)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleOpenEngravingForm(g,v))}),O.appendChild(n)}P.appendChild(_),P.appendChild(R),P.appendChild(O),E.appendChild(T),E.appendChild(P);const M=[E],B=ComponentFactoryService.createElement({type:C.CART_ITEM_QUANTITY_PRICE,itemId:g});if((null===(f=null===(u=null==v?void 0:v.attributes)||void 0===u?void 0:u.engraving)||void 0===f?void 0:f.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:C.ENGRAVING_VIEW,identifier:g,context:"cart"});M.push(n)}return M.push(B),M}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(n){const i=n.find(n=>"cart.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getItemStore(){const n=this.params.itemId,i=this.getStoreValue("cart.items."+n);return i||null}calculateQuantityLimits(){const n=this.getItemStore();if(!n)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const i=n.quantity,r=this.getAvailableQuantity(),s=r>0;return{currentQuantity:i,availableQuantity:r,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var n,i,r,s;const a=this.getItemStore();if(!a)return 0;const l=a.partNumber,d=a.fulfillmentId,u=this.getStoreValue("cart.items")||{},f=Object.values(u).filter(n=>n.partNumber===l&&n.fulfillmentId===d),g=f.reduce((n,i)=>n+i.quantity,0),v=this.getStoreValue("products."+a.upc)||this.getStoreValue("products."+a.salsifyGrouping);if(!v)return a.maxQuantity-g;const b=null!==(s=null===(r=null===(i=null===(n=null==v?void 0:v.sizes)||void 0===n?void 0:n[a.liquidId])||void 0===i?void 0:i.attributes)||void 0===r?void 0:r.maxQuantityPerOrder)&&void 0!==s?s:0;return!b||b<=0?a.maxQuantity-g:b-g}updateButtonStates(n){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!n.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!n.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits();n>0&&!i.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,n)}createQuantityContainer(){const n=this.calculateQuantityLimits(),i=this.getItemStore();if(!i)return document.createElement("div");const r=document.createElement("div");return r.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async n=>{n.preventDefault(),n.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 n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(n),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantitySpan),r.appendChild(this.qtyIncreaseButton),r}createPriceContainer(){const n=this.getItemStore();if(!n)return document.createElement("div");const i=document.createElement("div");i.className="item-price-container";const r=document.createElement("span");if(r.className="item-price",r.textContent=formatCentToDollarText(n.price),i.appendChild(r),n.quantity>1){const r=document.createElement("span");r.className="item-price-per-unit",r.textContent="("+formatCentToDollarText(n.unitPrice)+" ea)",i.appendChild(r)}return i}template(){const n=[];if(this.config.layout.showQuantityCounter){const i=this.createQuantityContainer();n.push(i)}const i=this.createPriceContainer();return n.push(i),n}}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(n){const i=n.find(n=>"cart.promoCode"===n.path);if(i){const{value:n,oldValue:r}=i,s=Boolean(null==r?void 0:r.code),a=Boolean(null==n?void 0:n.code);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;if(a&&this.promoCodePill&&n.discountAmount!==(null==r?void 0:r.discountAmount))return this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",void 0}}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const r=document.createElement("button");r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.setAttribute("role","button"),r.setAttribute("aria-label","Remove promo code "+(null==n?void 0:n.code)),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(r),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){const n=document.createElement("div");n.classList.add("promo-code-container");const i=document.createElement("div");i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),n.appendChild(i),this.container.appendChild(n),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),i=n.length>=3&&n.length<=255,r=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),a=this.getStoreValue("cart.events")||[],l=hasCartAnyPromoCodeEvents(a);this.applyButton.disabled=!i||r||Boolean(null==s?void 0:s.discountAmount)||this.isApplying||l}createPromoInput(){const n=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+n.layout.inputFieldStyle,validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),r=this.promoInput;r.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const m=async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(n),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(i){this.logger.error("Cart promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}};return this.applyButton.addEventListener("click",m),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),m())}),this.applyButton}template(){const n=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==n?void 0:n.code){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const r=document.createElement("button");return r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.setAttribute("role","button"),r.setAttribute("aria-label","Remove promo code "+n.code),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(r),i}const i=document.createElement("div");i.classList.add("promo-code-container");const r=document.createElement("div");return r.classList.add("promo-container"),r.appendChild(this.createPromoInput()),r.appendChild(this.createApplyButton()),i.appendChild(r),i}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(n){return ComponentFactoryService.createElement({type:C.CART_FULFILLMENT,fulfillmentId:n})}getFulfillmentElementById(n){return this.container.querySelector('[data-fulfillment-id="'+n+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const n=this.getFulfillmentContainer();if(n)return{parent:n.parentElement,nextSibling:n.nextElementSibling};const i=this.container.querySelectorAll("[data-fulfillment-id]");if(i.length>0){const n=i[i.length-1];return{parent:n.parentElement,nextSibling:n.nextElementSibling}}return null}addFulfillmentElement(n){const i=this.getFulfillmentInsertionPoint();if(i){const r=this.createFulfillmentElement(n);r.setAttribute("data-fulfillment-id",n);const s=this.getFulfillmentContainer();s&&s.remove(),i.nextSibling?i.parent.insertBefore(r,i.nextSibling):i.parent.appendChild(r)}}removeFulfillmentElement(n){const i=this.getFulfillmentElementById(n);if(i){const n=i.parentElement,r=i.nextElementSibling;i.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const i=document.createElement("div");i.id="retailer-fulfillment-container",r?n.insertBefore(i,r):n.appendChild(i)}}}handleFulfillmentsUpdate(n,i){const r=new Set(n||[]),s=new Set(i||[]);for(const a of r)s.has(a)||this.removeFulfillmentElement(a);for(const a of s)r.has(a)||this.addFulfillmentElement(a)}setupFulfillmentElements(){const n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n+".fulfillments")||[],r=this.container.querySelectorAll("[data-fulfillment-id]");for(const a of r)a.remove();let s=this.getFulfillmentContainer();if(!s){const n=this.container.querySelector(".retailer-body-container"),i=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",n&&i&&n.insertBefore(s,i)}for(const a of i)this.addFulfillmentElement(a)}setupSubtotalElement(){const n=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const r=ComponentFactoryService.createElement({type:C.CART_RETAILER_SUBTOTAL,retailerId:n});i.replaceWith(r)}}onStoreChanged(n){const i=this.getRetailerId(),r="cart.retailers."+i,s=n.find(n=>n.path===r);if(s){const n=s.oldValue,i=s.value,r=(null==n?void 0:n.fulfillments)||[],a=(null==i?void 0:i.fulfillments)||[];JSON.stringify(r)!==JSON.stringify(a)&&this.handleFulfillmentsUpdate(r,a)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const n=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section"),r=this.container.querySelector(".section-header-label");if(n&&i&&r){const D=()=>{const i=n.checked;r.setAttribute("aria-label",i?"Expand retailer section":"Collapse retailer section"),r.setAttribute("aria-expanded",i?"false":"true")};n.addEventListener("change",()=>{n.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),D()}),r.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())}),n.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),D()}}template(){const n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n),r=document.createElement("section");r.className="retailer-section";const s=document.createElement("div");s.className="cart-retailer-header";const a=document.createElement("div");a.className="retailer-info";const l=document.createElement("h2");l.className="section-title",l.textContent=i.name,a.appendChild(l);const d=document.createElement("input");d.type="checkbox",d.id=i.id,d.className="section-toggle",a.appendChild(d);const u=document.createElement("label");u.htmlFor=i.id,u.className="section-header-label",u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Collapse retailer section"),u.setAttribute("aria-expanded","true");const f=document.createElement("span");f.className="chevron",f.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(f),a.appendChild(u),s.appendChild(a),r.appendChild(s);const g=document.createElement("div");g.className="retailer-body-container";const v=document.createElement("div");v.id="retailer-fulfillment-container",g.appendChild(v);const b=document.createElement("div");return b.id="retailer-subtotal-container",g.appendChild(b),r.appendChild(g),r}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(n,i){const r=Object.values(n||{}).filter(n=>n.retailerId===i);let s=0;for(const a of r)s+=a.quantity;return s}template(){const n=this.params.retailerId,i=this.getStoreValue("cart.retailers."+n+".subtotal")||0,r=this.getStoreValue("cart.retailers."+n+".engravingFee")||0,s=this.getStoreValue("cart.items"),a=this.getRetailerItemCount(s,n),l=1===a?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+a+" "+l+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(i+r),[d,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var n,i,r;const s=this.store.get("checkout.presale"),a=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),d=null!==(i=null===(n=null==a?void 0:a.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],u=null!=l?l:d,f=this.store.get("address"),g=hasActiveItems(u,null===(r=null==f?void 0:f.address)||void 0===r?void 0:r.state),v=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),b=document.createElement("div");b.classList.add("checkout-container"),v&&b.classList.add("no-header"),this.params.isIndependentComponent&&b.classList.add("independent");const x=ComponentFactoryService.createElement({type:C.CHECKOUT_INFORMATION});b.appendChild(x);const w=ComponentFactoryService.createElement({type:C.CHECKOUT_ORDER_SUMMARY});if(b.appendChild(w),!s&&(!u.length||!g)&&v)return[b];const E=document.createElement("div");if(E.classList.add("checkout-header-wrapper"),!v){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_HEADER});E.appendChild(n)}if(u.length&&g&&!s){const n=ComponentFactoryService.createElement({context:"checkout",type:C.PROMO_CODE_TICKER,tickers:u});E.appendChild(n)}if(s){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_PRESALE_COUNTDOWN});E.appendChild(n)}return[E,b]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var n,i,r;const s=this.getStoreValue("checkout"),a=Boolean(s.promoCode),l=Boolean(null===(n=s.giftCards)||void 0===n?void 0:n.length),d=this.getConfigs("global"),u=Object.keys(s.onDemandFulfillmentTipInfo||{}).length>0,f=Object.values(s.items||{}),g=[],v=document.createElement("div");v.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Subtotal ("+f.length+" item"+(f.length>1?"s":"")+")",v.appendChild(b);const x=document.createElement("span");x.textContent=formatCentToDollarText(s.amounts.subtotal),v.appendChild(x),g.push(v);const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Shipping",w.appendChild(C);const E=document.createElement("span");E.textContent=formatCentToDollarText(s.amounts.shipping),w.appendChild(E),g.push(w);const T=document.createElement("div");T.classList.add("checkout-amount-line");const A=document.createElement("span");A.textContent="Delivery",T.appendChild(A);const P=document.createElement("span");if(P.textContent=formatCentToDollarText(s.amounts.delivery),T.appendChild(P),g.push(T),(null===(i=null==s?void 0:s.amounts)||void 0===i?void 0:i.engraving)>0){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Engraving",n.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.engraving),n.appendChild(r),g.push(n)}const _=document.createElement("div");_.classList.add("checkout-amount-line");const N=document.createElement("span");N.textContent="Taxes & Fees",_.appendChild(N);const F=document.createElement("span");if(F.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),_.appendChild(F),g.push(_),a){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Promo Code ("+(null===(r=s.promoCode)||void 0===r?void 0:r.code.toUpperCase())+")",n.appendChild(i);const a=document.createElement("span");a.textContent="-"+formatCentToDollarText(s.amounts.discounts),n.appendChild(a),g.push(n)}if(l){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Gift Cards Applied",n.appendChild(i);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(s.amounts.giftCards),n.appendChild(r),g.push(n)}if(u){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Tips",n.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.tip),n.appendChild(r),g.push(n)}const R=document.createElement("div");R.classList.add("checkout-separator"),g.push(R);const O=document.createElement("div");O.classList.add("checkout-amount-total");const L=document.createElement("span");L.textContent="Total",O.appendChild(L);const M=document.createElement("span");if(M.textContent=formatCentToDollarText(s.amounts.total),O.appendChild(M),g.push(O),s.presale){const n=document.createElement("div");n.classList.add("checkout-amount-due");const i=document.createElement("span");i.textContent="Amount due today",n.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(0),n.appendChild(r),g.push(n);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const a=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));s.appendChild(a);const l=document.createElement("p");l.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(l),g.push(s)}return g}}const Pt="lce-checkout-stripe-slot",_t={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Nt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},Ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class 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 n=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),i=document.createElement("div");i.classList.add("checkout-billing-same-as-shipping-toggle-container");const r=document.createElement("div");r.classList.add("checkout-checkbox-container");const s=document.createElement("span");s.id="billingSameAsShipping",s.classList.add("checkout-checkbox-visual"),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Billing same as shipping checkbox"),s.setAttribute("aria-checked",n?"true":"false"),n&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),i.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.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"),r.appendChild(s),r.appendChild(a),i.appendChild(r),i}updateSaveButtonState(){const n=!Object.values(this.billingData).every(n=>n.isValid),i={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,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!n,i)}template(){const n=this.getStoreValue("checkout.paymentForm"),i=[],r=this.billingSameAsShippingToggle();if(i.push(r),n.billingSameAsShipping)return i;n.data&&(n.data.firstName&&(this.billingData.firstName={isValid:!![],value:n.data.firstName}),n.data.lastName&&(this.billingData.lastName={isValid:!![],value:n.data.lastName}),n.data.email&&(this.billingData.email={isValid:!![],value:n.data.email}),n.data.phone&&(this.billingData.phone={isValid:!![],value:n.data.phone}),n.data.company&&(this.billingData.company={isValid:!![],value:n.data.company}),n.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:n.data.addressOne}),n.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:n.data.addressTwo}),n.data.city&&(this.billingData.city={isValid:!![],value:n.data.city}),n.data.state&&(this.billingData.state={isValid:!![],value:n.data.state}),n.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:n.data.zipCode})),this.updateSaveButtonState();const s=document.createElement("div");s.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),s.appendChild(a);const l=document.createElement("p");l.textContent="Provide the info relevant to your payment method",l.classList.add("section-subtitle"),s.appendChild(l),i.push(s);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.firstName.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.firstName})},onValidation:n=>{this.billingData.firstName.isValid=n,this.updateSaveButtonState()}});f.setAttribute("aria-label","First name input"),u.appendChild(f);const g=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.lastName.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.lastName})},onValidation:n=>{this.billingData.lastName.isValid=n,this.updateSaveButtonState()}});g.setAttribute("aria-label","Last name input"),u.appendChild(g),d.appendChild(u);const v=ComponentFactoryService.createElement({type:C.INPUT,inputType:"email",name:Ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.email.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.email})},onValidation:n=>{this.billingData.email.isValid=n,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),d.appendChild(v);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const x=ComponentFactoryService.createElement({type:C.INPUT,inputType:"tel",name:Ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.phone.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.phone})},onValidation:n=>{this.billingData.phone.isValid=n,this.updateSaveButtonState()}});x.setAttribute("aria-label","Phone input"),b.appendChild(x);const E=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.company,label:"Company (optional)",autocomplete:!![],onChange:async n=>{this.billingData.company.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.company})},onValidation:n=>{this.billingData.company.isValid=n,this.updateSaveButtonState()}});E.setAttribute("aria-label","Company input"),b.appendChild(E),d.appendChild(b);const T=document.createElement("div");T.classList.add("checkout-two-col-container");const A=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.addressOne.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.addressOne})},onValidation:n=>{this.billingData.addressOne.isValid=n,this.updateSaveButtonState()}});A.setAttribute("aria-label","Street address input"),T.appendChild(A);const P=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async n=>{this.billingData.addressTwo.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.addressTwo})},onValidation:n=>{this.billingData.addressTwo.isValid=n,this.updateSaveButtonState()}});P.setAttribute("aria-label","Apt, suite, etc. (optional) input"),T.appendChild(P),d.appendChild(T);const _=document.createElement("div");_.classList.add("checkout-three-col-container");const N=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.city.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.city})},onValidation:n=>{this.billingData.city.isValid=n,this.updateSaveButtonState()}});N.setAttribute("aria-label","City input"),_.appendChild(N);const F=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:n=>n&&2===n.length&&/^[A-Z]{2}$/.test(n)?null:"State must be 2 uppercase characters"},onChange:async n=>{this.billingData.state.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.state})},onValidation:n=>{this.billingData.state.isValid=n,this.updateSaveButtonState()}});F.setAttribute("aria-label","State input"),_.appendChild(F);const R=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:Ft.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.zipCode.value=n,this.pubSub.publishForm(w.BILLING,{fieldName:Ft.zipCode})},onValidation:n=>{this.billingData.zipCode.isValid=n,this.updateSaveButtonState()}});return R.setAttribute("aria-label","Zip Code input"),_.appendChild(R),d.appendChild(_),i.push(d),i}}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(n){const i=n.find(n=>"checkout.customerForm.isSaving"===n.path);i&&(i.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 n=this.store.get("checkout.customerForm.data");n.firstName&&(this.customerData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.customerData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.customerData.email={isValid:!![],value:n.email}),n.phone&&(this.customerData.phone={isValid:!![],value:n.phone}),n.company&&(this.customerData.company={isValid:!![],value:n.company}),n.birthDate&&(this.customerData.birthDate={isValid:!![],value:n.birthDate});const i=[],r=document.createElement("div");r.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),r.appendChild(s);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),r.appendChild(a),i.push(r);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:n.firstName,onChange:async n=>{this.customerData.firstName.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.firstName})},onValidation:n=>{this.customerData.firstName.isValid=n,this.updateSaveButtonState()}});d.appendChild(u);const f=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:n.lastName,onChange:async n=>{this.customerData.lastName.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.lastName})},onValidation:n=>{this.customerData.lastName.isValid=n,this.updateSaveButtonState()}});d.appendChild(f),l.appendChild(d);const g=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:n.company,onChange:async n=>{this.customerData.company.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.company})},onValidation:n=>{this.customerData.company.isValid=n,this.updateSaveButtonState()}});l.appendChild(g);const v=ComponentFactoryService.createElement({type:C.INPUT,inputType:"email",name:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:n.email,onChange:async n=>{this.customerData.email.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.email})},onValidation:n=>{this.customerData.email.isValid=n,this.updateSaveButtonState()}});l.appendChild(v);const b=ComponentFactoryService.createElement({type:C.INPUT,inputType:"tel",name:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:n.phone,onChange:async n=>{this.customerData.phone.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.phone})},onValidation:n=>{this.customerData.phone.isValid=n,this.updateSaveButtonState()}});l.appendChild(b);const x=ComponentFactoryService.createElement({type:C.BIRTHDATE_INPUT,inputType:"date",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:n.birthDate,onChange:async n=>{this.customerData.birthDate.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.birthDate})},onValidation:n=>{this.customerData.birthDate.isValid=n,this.updateSaveButtonState()}});return l.appendChild(x),i.push(l),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:""})}),i.push(this.saveButton),this.updateSaveButtonState(),i}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const n=[],i=this.getStoreValue("checkout.customerForm.data"),r=document.createElement("div");r.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent="Buyer: "+i.firstName+" "+i.lastName,r.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 n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.editCustomerForm())}),r.appendChild(a),n.push(r),i.company){const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=i.company,n.push(r)}const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=i.email,n.push(l);const d=document.createElement("p");d.classList.add("checkout-summary-form-line"),d.textContent=i.phone,n.push(d);const u=document.createElement("p");return u.classList.add("checkout-summary-form-line"),u.textContent=formatISODateToMMDDYYYY(i.birthDate),n.push(u),n}}const Rt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Ot={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(n,i){return"href"===n?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(i)?i:null:"src"===n?/^https?:\/\/[^\s<>"']+$/i.test(i)?i:null:"class"===n?i.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():i.replace(/[<>"']/g,"").trim()}function cleanNode(n){if(n.nodeType===Node.TEXT_NODE){const i=n.textContent||"",r=i.replace(/<[^>]*>/g,"");if(r.trim()){const n=document.createTextNode(r);return n}return null}if(n.nodeType===Node.ELEMENT_NODE){const i=n,r=i.tagName.toLowerCase();if(Rt.includes(r)){const n=document.createElement(r),s=Ot[r]||[];for(const r of Array.from(i.attributes)){const i=r.name.toLowerCase();if(s.includes(i)){const s=sanitizeAttributeValue(i,r.value);null!==s&&n.setAttribute(i,s)}}"a"===r&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"));for(const r of Array.from(i.childNodes)){const i=cleanNode(r);i&&n.appendChild(i)}return n}const s=document.createDocumentFragment();for(const n of Array.from(i.childNodes)){const i=cleanNode(n);i&&s.appendChild(i)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(n){if(!n||"string"!=typeof n)return"";try{const i=new DOMParser,r=i.parseFromString(n,"text/html"),s=r.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const a=document.createDocumentFragment();for(const n of Array.from(r.body.childNodes)){const i=cleanNode(n);i&&a.appendChild(i)}const l=document.createElement("div");return l.appendChild(a),l.innerHTML}catch(i){return console.error("HTML sanitization error:",i),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var n,i,r,s,a,l;const d=[],u=this.getConfigs("configurations"),f=this.getConfigs("global"),g=this.getConfigs("checkout"),v=this.config.layout.exitUrl||window.location.host,b=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(i=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===i?void 0:i.customLogo){const n=document.createElement("div");n.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=null===(s=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===s?void 0:s.customLogo,i.alt=u.partnerName+" Logo",n.appendChild(i),d.push(n)}const x=document.createElement("div");x.classList.add("checkout-completed-section-container");const w=document.createElement("div");w.classList.add("checkout-completed-title-container");const E=document.createElement("div");E.classList.add("checkout-completed-title-section");const T=document.createElement("h3");T.innerHTML=(null===(l=null===(a=this.config.layout)||void 0===a?void 0:a.checkoutCompleted)||void 0===l?void 0:l.customText)||"Thank You for Your Order!",E.appendChild(T);const A=document.createElement("p");A.textContent="Your payment has been successfully processed.",E.appendChild(A),w.appendChild(E),x.appendChild(w);const P=document.createElement("div");P.classList.add("checkout-completed-sub-section");const _=document.createElement("div");_.classList.add("checkout-completed-line");const N=document.createElement("h3");N.textContent="Order Number",_.appendChild(N);const F=document.createElement("span");F.textContent=this.params.orderNumber,_.appendChild(F),P.appendChild(_);const R=document.createElement("div");R.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Order Amount",R.appendChild(O);const L=document.createElement("span");L.textContent=""+formatCentToDollarText(this.params.orderTotal),R.appendChild(L),P.appendChild(R);const M=document.createElement("div");M.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",M.appendChild(B);const W=document.createElement("span");W.textContent="** "+this.params.cardLast4,M.appendChild(W),P.appendChild(M),x.appendChild(P);const H=document.createElement("div");H.classList.add("checkout-completed-sub-section");const q=document.createElement("p");q.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",H.appendChild(q),x.appendChild(H),d.push(x);const j=document.createElement("div");j.classList.add("checkout-completed-section-container");const U=document.createElement("button");U.type="button";const V=document.createElement("span");V.textContent=b,U.setAttribute("tabindex","0"),U.setAttribute("role","button"),U.setAttribute("aria-label",b),U.appendChild(V);const K=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:f.theme.selectedTextColor}));U.appendChild(K),U.addEventListener("click",()=>{window.location.href=v}),U.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),window.location.href=v)}),j.appendChild(U),d.push(j);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:"+u.supportEmail,J.textContent=u.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),g.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(g.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),d.push(n),d.push(i),d.push(r)}if(f.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:C.POWERED_BY,context:"general"});d.push(n)}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(n){const i=n.find(n=>"checkout.customerForm.isSaving"===n.path),r=n.find(n=>"checkout.giftRecipientForm.isSaving"===n.path);(null==i?void 0:i.value)||(null==r?void 0:r.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const n=this.getStoreValue("checkout.isGift")||![];let i;i=n?!(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=i}template(){const n=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift"),r=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("address.formattedAddress"),l=i?r:s,d=this.store.get("checkout.shippingAddressTwo"),u=this.store.get("checkout.deliveryInstructions");s.firstName&&(this.customerData.firstName={isValid:!![],value:s.firstName}),s.lastName&&(this.customerData.lastName={isValid:!![],value:s.lastName}),s.email&&(this.customerData.email={isValid:!![],value:s.email}),s.phone&&(this.customerData.phone={isValid:!![],value:s.phone}),s.company&&(this.customerData.company={isValid:!![],value:s.company}),s.birthDate&&(this.customerData.birthDate={isValid:!![],value:s.birthDate}),r.firstName&&(this.giftData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.giftData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.giftData.email={isValid:!![],value:r.email}),r.phone&&(this.giftData.phone={isValid:!![],value:r.phone}),r.message&&(this.giftData.message={isValid:!![],value:r.message}),d&&(this.customerData.addressTwo={isValid:!![],value:d},this.giftData.addressTwo={isValid:!![],value:d}),u&&(this.customerData.deliveryInstructions={isValid:!![],value:u},this.giftData.deliveryInstructions={isValid:!![],value:u});const f=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,g=[],v=document.createElement("div");v.classList.add("delivery-header-container");const b=document.createElement("div");b.classList.add("delivery-header-content");const x=document.createElement("div");x.classList.add("delivery-title-container");const E=document.createElement("h3");E.textContent="Deliver to",E.classList.add("delivery-title");const T=document.createElement("p");T.textContent="Package recipient must be 21+",T.classList.add("delivery-subtitle"),x.appendChild(E),x.appendChild(T),v.appendChild(x),g.push(v);const A=document.createElement("div");A.classList.add("section-form-container");const P=document.createElement("div");P.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:i?Nt.firstName:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:l.firstName,onChange:n=>{i?(this.giftData.firstName.value=n,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.firstName})):(this.customerData.firstName.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.firstName}))},onValidation:n=>{i?this.giftData.firstName.isValid=n:this.customerData.firstName.isValid=n,this.updateSaveButtonState()}});_.setAttribute("aria-label","First Name Input"),P.appendChild(_);const N=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:i?Nt.lastName:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:l.lastName,onChange:n=>{i?(this.giftData.lastName.value=n,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.lastName})):(this.customerData.lastName.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.lastName}))},onValidation:n=>{i?this.giftData.lastName.isValid=n:this.customerData.lastName.isValid=n,this.updateSaveButtonState()}});if(N.setAttribute("aria-label","Last Name Input"),P.appendChild(N),A.appendChild(P),!i){const n=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:l.company,onChange:async n=>{this.customerData.company.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.company})},onValidation:n=>{this.customerData.company.isValid=n,this.updateSaveButtonState()}});n.setAttribute("aria-label","Company Input"),A.appendChild(n)}const F=ComponentFactoryService.createElement({type:C.INPUT,inputType:"email",name:i?Nt.email:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:l.email,onChange:n=>{i?(this.giftData.email.value=n,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.email})):(this.customerData.email.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.email}))},onValidation:n=>{i?this.giftData.email.isValid=n:this.customerData.email.isValid=n,this.updateSaveButtonState()}});F.setAttribute("aria-label","Email Input"),A.appendChild(F);const R=ComponentFactoryService.createElement({type:C.INPUT,inputType:"tel",name:i?Nt.phone:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:l.phone,onChange:n=>{i?(this.giftData.phone.value=n,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.phone})):(this.customerData.phone.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.phone}))},onValidation:n=>{i?this.giftData.phone.isValid=n:this.customerData.phone.isValid=n,this.updateSaveButtonState()}});if(R.setAttribute("aria-label","Phone Input"),A.appendChild(R),!i){const n=ComponentFactoryService.createElement({type:C.BIRTHDATE_INPUT,inputType:"date",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:l.birthDate,onChange:async n=>{this.customerData.birthDate.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.birthDate})},onValidation:n=>{this.customerData.birthDate.isValid=n,this.updateSaveButtonState()}});n.setAttribute("aria-label","Birthdate Input"),A.appendChild(n)}const O=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input"});O.setAttribute("aria-label","Delivery Address Input"),A.appendChild(O);const L=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:i?Nt.addressTwo:_t.addressTwo,label:"Apt, suite, etc. (optional)",value:d,onChange:n=>{i?(this.giftData.addressTwo.value=n,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.addressTwo})):(this.customerData.addressTwo.value=n,this.pubSub.publishForm(w.CUSTOMER,{fieldName:_t.addressTwo}))},onValidation:n=>{i?this.giftData.addressTwo.isValid=n:this.customerData.addressTwo.isValid=n,this.updateSaveButtonState()}});if(L.setAttribute("aria-label","Address Line 2 Input"),A.appendChild(L),i){const i=document.createElement("div");i.classList.add("custom-input","textarea",n.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Gift Message*",s.setAttribute("for",Nt.message);const a=document.createElement("textarea");a.name=Nt.message,a.id=Nt.message,a.rows=4,a.value=r.message||"",a.setAttribute("aria-label","Gift Message Textarea"),a.addEventListener("input",async n=>{const i=n.target.value;this.giftData.message.value=i,this.giftData.message.isValid=i.length>0,this.pubSub.publishForm(w.GIFT,{fieldName:Nt.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"),i.appendChild(s),i.appendChild(a),i.appendChild(l),A.appendChild(i)}if(f){const r=document.createElement("div");r.classList.add("custom-input","textarea",n.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=u,a.addEventListener("input",async n=>{const r=n.target.value;i?(this.giftData.deliveryInstructions.value=r,this.giftData.deliveryInstructions.isValid=r.length>0):(this.customerData.deliveryInstructions.value=r,this.customerData.deliveryInstructions.isValid=r.length>0)});const l=document.createElement("p");l.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",l.classList.add("textarea-message-disclaimer"),r.appendChild(s),r.appendChild(a),r.appendChild(l),A.appendChild(r)}g.push(A),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 e=async()=>{i?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",e),this.saveButton.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await e())}),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 n=[],i=this.getStoreValue("checkout.isGift"),r=this.getStoreValue("checkout.customerForm.data"),s=this.getStoreValue("checkout.giftRecipientForm.data"),a=this.getStoreValue("address"),l=this.getStoreValue("checkout.deliveryInstructions"),d=this.getStoreValue("checkout.shippingAddressTwo"),u=document.createElement("div");u.classList.add("checkout-summary-form-header");const f=document.createElement("h2");f.textContent=i?"Delivering to "+s.firstName+" "+s.lastName:"Delivering to "+r.firstName+" "+r.lastName,u.appendChild(f);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Delivery Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0");const p=async()=>{i?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(g.addEventListener("click",p),g.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await p())}),u.appendChild(g),n.push(u),!i&&r.company){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=r.company,n.push(i)}const v=document.createElement("p");v.classList.add("checkout-summary-form-line"),v.textContent=a.address.one+(d?", "+d:"")+", "+a.address.city+", "+a.address.state+", "+a.address.zip,n.push(v);const b=document.createElement("p");b.classList.add("checkout-summary-form-line"),b.textContent=i?s.email:r.email,n.push(b);const x=document.createElement("p");if(x.classList.add("checkout-summary-form-line"),x.textContent=i?s.phone:r.phone,n.push(x),!i&&r.birthDate){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=formatISODateToMMDDYYYY(r.birthDate),n.push(i)}if(i){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const r=document.createElement("span");r.classList.add("checkout-summary-form-line-container-label"),r.textContent="Gift Message:",i.appendChild(r);const a=document.createElement("span");a.classList.add("checkout-summary-form-line"),a.textContent=s.message||"No message provided.",i.appendChild(a),n.push(i)}if(l){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const r=document.createElement("span");r.classList.add("checkout-summary-form-line-container-label"),r.textContent="Delivery Instructions:",i.appendChild(r);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=l||"No instructions provided.",i.appendChild(s),n.push(i)}return n}}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(n){var i;const r=n.find(n=>"checkout.giftCards"===n.path),s=n.find(n=>"checkout.loading"===n.path);r&&r.value.length>((null===(i=r.oldValue)||void 0===i?void 0:i.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const n=this.giftCardInput.getValue().trim(),i=n.length>=3&&n.length<=255,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!i||r||Boolean(s)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),r=this.giftCardInput;r.setValue(i),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const m=async()=>{const n=this.giftCardInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(n)}catch(i){this.logger.error("Checkout gift card application failed",{giftCardCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",m),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),m())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const n=[];return n.push(this.createGiftCardInput()),n.push(this.createApplyButton()),n}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const n=this.store.get("checkout.presale"),i=this.getConfigs("checkout");let r=null;if(!n){r=document.createElement("button"),r.classList.add("checkout-header-button"),r.setAttribute("aria-label","Back to Cart"),r.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(C.CART)});const n=document.createElement("span");n.innerHTML=ChevronLeftIcon({}),r.appendChild(n)}const s=document.createElement("h1");s.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.setAttribute("aria-label","Checkout Page");const a=document.createElement("button");return a.innerHTML=CloseIcon({width:16,height:16}),a.classList.add("checkout-header-button-close"),a.setAttribute("aria-label","Close Checkout"),a.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),r?[r,s,a]:[s,a]}}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 n=this.getStoreValue("checkout.isGift"),i=this.getStoreValue("checkout.customerForm.isEditing"),r=this.getStoreValue("checkout.giftRecipientForm.isEditing"),s=this.getStoreValue("checkout.paymentForm.isEditing");n?(this.buyerForm.style.display=i?"block":"none",this.buyerSummary.style.display=i?"none":"block",this.deliveryToForm.style.display=r?"block":"none",this.deliverToSummary.style.display=r?"none":"block"):(this.deliveryToForm.style.display=i?"block":"none",this.deliverToSummary.style.display=i?"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 n=[],i=this.getStoreValue("checkout.isGift"),r=this.getStoreValue("checkout.customerForm"),s=this.getStoreValue("checkout.giftRecipientForm"),a=this.getStoreValue("checkout.paymentForm"),l=ComponentFactoryService.createElement({type:C.CHECKOUT_SEND_AS_GIFT});return n.push(l),this.deliveryToForm=ComponentFactoryService.createElement({type:C.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=i?s.isEditing?"block":"none":r.isEditing?"block":"none",n.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:C.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=i?s.isEditing?"none":"block":r.isEditing?"none":"block",n.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:C.CHECKOUT_BUYER}),this.buyerForm.style.display=i&&r.isEditing?"block":"none",n.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:C.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=i&&!r.isEditing?"block":"none",n.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:C.CHECKOUT_PAYMENT}),this.paymentForm.style.display=a.isEditing?"block":"none",n.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:C.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=a.isEditing?"none":"block",n.push(this.paymentSummary),n}}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(n){var i,r,s,a;const l=n.find(n=>"checkout.items"===n.path);l&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const d=n.find(n=>n.path==="checkout.items."+this.params.itemId);if(d){const n=d.oldValue,l=d.value;if(l.updating)return![];const u=(null==n?void 0:n.quantity)!==(null==l?void 0:l.quantity),f=(null===(r=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||[],g=(null===(a=null===(s=null==l?void 0:l.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[],v=JSON.stringify(f)!==JSON.stringify(g);(u||v)&&this.updateEngravingElement(l)}return![]}updateEngravingElement(n){var i,r;const s=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(r=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.hasEngraving)===!![]&&s.layout.enablePersonalization){const i=ComponentFactoryService.createElement({type:C.ENGRAVING_VIEW,identifier:n.cartItemId,context:"checkout"}),r=this.container.querySelector(".checkout-item-card-footer");r&&r.before(i)}}setupMinimumPurchaseAlert(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return;const i=n.fulfillmentId;if(!i)return;if(!this.container)return;const r=this.container.querySelector(".checkout-item-card-header");if(r){const s=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),s&&shouldShowMinimumPurchaseAlert(s,n.pack)){const i=getMinimumPurchaseMessage(s,n.pack),a=ComponentFactoryService.createElement({type:C.PURCHASE_MIN_ALERT,message:i.message,messageType:i.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),r.before(a)}}}updateTrashButtonState(){if(!this.trashButton)return;const n=this.getStoreValue("checkout"),i=Object.keys(n.items).length,r=1===i;this.trashButton.disabled=r,r?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","item-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(r),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="item-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const n=this.getStoreValue("checkout.items."+this.params.itemId);return n?n.updating===!![]:![]}checkAndUpdateLoadingState(){const n=this.isItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var n,i,r;const s=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),l=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.presale,d=(null==l?void 0:l.isActive)&&(null==l?void 0:l.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(l.estimatedShipBy):"";if(!a)return[];const u=document.createElement("div");u.classList.add("checkout-item-card-header");const f=document.createElement("div");f.classList.add("checkout-item-image");const g=document.createElement("img");g.src=a.mainImage,g.alt=a.name,g.loading="lazy",f.appendChild(g),u.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-item-details-container");const b=document.createElement("h4");b.classList.add("checkout-item-title"),b.textContent=a.name,v.appendChild(b);const x=document.createElement("div");x.classList.add("checkout-item-subtitle");const w=document.createElement("span");w.textContent=l.isActive?""+d:((null==a?void 0:a.expectationDetail)||"")+",",x.appendChild(w);const E=document.createElement("span");E.textContent="From "+((null==a?void 0:a.retailerName)||""),x.appendChild(E),v.appendChild(x),u.appendChild(v),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async n=>{var i;if(n.preventDefault(),n.stopPropagation(),!(null===(i=this.trashButton)||void 0===i?void 0:i.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(r){this.logger.error("Checkout item removal failed",r)}}),u.appendChild(this.trashButton);const T=ComponentFactoryService.createElement({type:C.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),A=[];if(A.push(u),s.layout.enablePersonalization&&(null===(r=null===(i=null==a?void 0:a.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:C.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});A.push(n)}return A.push(T),A}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(n){const i=n.find(n=>"checkout.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getAvailableQuantity(){var n,i,r;const s=this.getStoreValue("checkout.items."+this.params.itemId);if(!s)return 0;const a=this.getStoreValue("products");if(!a)return 0;const l=s.partNumber,d=s.fulfillmentId,u=null===(r=null===(i=null===(n=Object.values(a).find(n=>n.sizes[s.liquidId]))||void 0===n?void 0:n.sizes)||void 0===i?void 0:i[s.liquidId])||void 0===r?void 0:r.attributes.maxQuantityPerOrder;if(!u)return 0;const f=this.getStoreValue("checkout.items")||{},g=Object.values(f).filter(n=>n.partNumber===l&&n.fulfillmentId===d),v=g.reduce((n,i)=>n+i.quantity,0);return u-v}calculateQuantityLimits(){var n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const r=this.getStoreValue("checkout"),s=1===(null===(n=Object.values(r.items))||void 0===n?void 0:n.length),a=i.quantity,l=this.getAvailableQuantity(),d=l>0,u=!(s&&1===a);return{currentQuantity:a,availableQuantity:l,isTheOnlyItem:s,canIncrease:d,canDecrease:u}}updateButtonStates(n){this.decreaseButton&&(this.decreaseButton.disabled=!n.canDecrease,this.decreaseButton.classList.toggle("disabled",!n.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!n.canIncrease,this.increaseButton.classList.toggle("disabled",!n.canIncrease),n.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits(),r=this.params.itemId;if((!(n<0)||i.canDecrease)&&(!(n>0)||i.canIncrease)){if(!r)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:n}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(r,n)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}template(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const i=this.calculateQuantityLimits(),r=document.createElement("div");r.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 n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(-1)}),r.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),r.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 n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),r.appendChild(this.increaseButton),this.updateButtonStates(i);const s=document.createElement("span");if(s.classList.add("checkout-item-price-text"),s.textContent=formatCentToDollarText(n.price),n.quantity>1){const i=document.createElement("span");i.classList.add("checkout-item-price-each-text"),i.textContent=" ("+formatCentToDollarText(n.unitPrice)+" ea)",s.appendChild(i)}return[r,s]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(n){return ComponentFactoryService.createElement({type:C.CHECKOUT_ITEM,itemId:n})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const n=this.getStoreValue("checkout.items")||{},i=new Map;for(const r of Object.values(n))r&&r.cartItemId&&i.set(r.cartItemId,r);return i}syncItemsWithStore(){const n=this.getItemsListContainer();if(!n)return;const i=this.getCurrentItemsMap(),r=n.querySelectorAll("[data-item-id]"),s=new Set;for(const a of r){const n=a.getAttribute("data-item-id");n&&s.add(n)}for(const a of r){const n=a.getAttribute("data-item-id");n&&!i.has(n)&&a.remove()}for(const[a]of i)if(!s.has(a)){const i=this.createItemElement(a);i.setAttribute("data-item-id",a),n.appendChild(i)}this.updateItemCount()}updateItemCount(){const n=this.getTogglerLabel();if(!n)return;const i=this.getCurrentItemsMap(),r=i.size;n.textContent=r+" item"+(1!==r?"s":"")}onStoreChanged(n){let i;for(let r=0;r<n.length;r++){const s=n[r];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){i=s;break}}return i?(this.syncItemsWithStore(),![]):![]}handleToggle(){const n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".checkout-items-list");if(n&&i){const r=i.classList.contains("show");i.classList.toggle("show"),n.classList.toggle("expanded"),r?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand checkout items")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const n=this.container.querySelector(".checkout-items-toggler"),i=this.container.querySelector(".checkout-items-toggler-button"),r=this.container.querySelector(".checkout-items-list");if(n&&i&&r){const s=r.classList.contains("show");i.setAttribute("tabindex","0"),i.setAttribute("aria-expanded",s?"true":"false"),i.setAttribute("aria-label",s?"Collapse checkout items":"Expand checkout items"),n.addEventListener("click",()=>this.handleToggle()),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const n=this.getStoreValue("checkout.items"),i=Object.values(n||{}),r=document.createElement("div");r.classList.add("checkout-items-toggler");const s=document.createElement("span");s.classList.add("checkout-items-toggler-label"),s.textContent=i.length+" item"+(1!==i.length?"s":""),r.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"}),r.appendChild(a);const l=document.createElement("div");l.classList.add("checkout-items-list","show");for(const d of i){const n=this.createItemElement(d.cartItemId);n.setAttribute("data-item-id",d.cartItemId),l.appendChild(n)}return[r,l]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(n){const i=n.find(n=>"checkout.amounts"===n.path);if(i){const n=this.getStoreValue("checkout"),i=Object.values(n.items||{}).length;this.updateZeroAmountElement(0===n.amounts.total&&i>0)}}updateZeroAmountElement(n){const i=this.container.querySelector(".checkout-zero-amount-container");if(n&&!i){const n=document.createElement("div");n.classList.add("checkout-zero-amount-container"),n.textContent="Credit card required to complete order (even when fully covered by gift card)";const i=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");i&&i.after(n)}else!n&&i&&i.remove()}afterRender(){const n=this.getStoreValue("checkout.amounts");n&&this.updateZeroAmountElement(0===n.total)}handleEmailToggle(n){this.commands.checkout.toggleMarketingPreferences("canEmail"),n.classList.toggle("checked");const i=n.classList.contains("checked");n.setAttribute("aria-checked",i?"true":"false")}handleSmsToggle(n){this.commands.checkout.toggleMarketingPreferences("canSms"),n.classList.toggle("checked");const i=n.classList.contains("checked");n.setAttribute("aria-checked",i?"true":"false")}marketingOptInsContainer(){const n=this.config.layout.emailOptIn,i=this.config.layout.smsOptIn;if(!n.show&&!i.show)return null;const r=document.createElement("div");if(r.classList.add("checkout-marketing-opt-ins-container"),n.show){const i=document.createElement("div");let s;i.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?n.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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleEmailToggle(a))});const l=document.createElement("label");l.setAttribute("for","emailOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(n.text),l.addEventListener("click",n=>{const i=n.target,r="A"===i.tagName||i.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canEmail"),a.classList.toggle("checked"))}),i.appendChild(a),i.appendChild(l),r.appendChild(i)}if(i.show){const n=document.createElement("div");let s;n.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?i.checked:this.store.get("checkout.marketingPreferences.canSms");const a=document.createElement("span");a.classList.add("checkout-checkbox-visual"),a.id="smsOptIn",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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleSmsToggle(a))});const l=document.createElement("label");l.setAttribute("for","smsOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(i.text),l.addEventListener("click",n=>{const i=n.target,r="A"===i.tagName||i.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canSms"),a.classList.toggle("checked"))}),n.appendChild(a),n.appendChild(l),r.appendChild(n)}return r}hasOnDemandOrder(){const n=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(n).length>0}template(){var n;const i=[],r=this.getConfigs("global"),s=this.getConfigs("checkout"),a=this.getConfigs("global"),l=s.layout.allowGiftCards,d=null===(n=null==a?void 0:a.layout)||void 0===n?void 0:n.allowPromoCodes,u=document.createElement("div");u.classList.add("section-title-container");const f=document.createElement("h3");f.textContent="Order Summary",f.classList.add("section-title"),u.appendChild(f),i.push(u);const g=ComponentFactoryService.createElement({type:C.CHECKOUT_ITEMS});i.push(g);const v=document.createElement("div");v.classList.add("checkout-separator");const b=document.createElement("div");if(b.classList.add("checkout-separator"),i.push(v),l||d){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_PC_GC});i.push(n)}if(this.hasOnDemandOrder()){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_TIPS});i.push(n),i.push(b)}const x=document.createElement("div");x.classList.add("section-title-container");const w=document.createElement("h3");w.textContent="100% Secure Payments",w.classList.add("disclaimer-header"),x.appendChild(w);const E=document.createElement("p");E.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.",E.classList.add("disclaimer-description"),x.appendChild(E),i.push(x);const T=ComponentFactoryService.createElement({type:C.CHECKOUT_AMOUNTS});i.push(T);const A=ComponentFactoryService.createElement({type:C.CHECKOUT_PLACE_ORDER_BUTTON});i.push(A);const P=this.marketingOptInsContainer();if(P&&i.push(P),s.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const r=document.createElement("div");r.classList.add("checkout-legal-message"),r.innerHTML=sanitizeHTML(s.layout.legalMessage.text),i.push(n),i.push(r)}const _=document.createElement("div");if(_.classList.add("checkout-separator"),i.push(_),r.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:C.POWERED_BY,context:"checkout"});i.push(n)}return i}}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(n){for(const i of n)switch(i.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=i.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(i.value)}}handleBillingSameAsShippingChange(n){this.isBillingSameAsShipping=n,n&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var n;this.isBillingSameAsShipping=null!==(n=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==n?n:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let n=!![],i="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)i="Saving...",n=!![];else if(this.stripeFormStatus.hasError)i="Fix Errors and Retry",n=![];else if(this.showingStripeSummary&&this.savedCardInfo){const i=this.isBillingSameAsShipping||this.isValidBillingForm;n=!i}else{const i=this.stripeFormStatus.isFormComplete,r=this.isBillingSameAsShipping||this.isValidBillingForm;n=!(i&&r)}this.saveButton.disabled=n,this.saveButton.textContent=i,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let n="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?n=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(n="Please complete the billing address form"),n?(this.errorMessageElement.textContent=n,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(n){this.errorMessageElement&&(this.errorMessageElement.textContent=n,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===n&&(this.errorMessageElement.style.display="none")},5e3))}template(){const n=[],i=document.createElement("div");i.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Payment",r.classList.add("section-title"),i.appendChild(r);const s=document.createElement("p");if(s.textContent="All transactions are secure and encrypted.",s.classList.add("section-subtitle"),i.appendChild(s),n.push(i),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const i=document.createElement("p");i.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(i),n.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:C.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:n=>{this.stripeFormStatus=n,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:n=>{this.savedCardInfo=n},onEditModeVisibilityChanged:n=>{this.showingStripeSummary=n,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(n,i)=>{const r={paymentSession:{confirmationTokenId:n,setupIntentId:i}};!this.isBillingSameAsShipping&&this.billingFormData&&(r.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(r)}}}),n.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"),n.push(this.errorMessageElement);const a=ComponentFactoryService.createElement({type:C.CHECKOUT_BILLING,isFormValid:(n,i)=>{this.billingFormData=i,this.isValidBillingForm=n,this.updateSaveButtonState(),this.updateErrorMessage()}});return n.push(a),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 n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handleSaveButtonClick())}),n.push(this.saveButton),n}async handleSaveButtonClick(){var n;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const n={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}catch(i){this.logger.error("Failed to save payment form in edit mode",i),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const n={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}catch(r){this.logger.error("Failed to save payment form in beta mode",r),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(n=this.stripeHandlerElement)||void 0===n||n.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 n;this.isSavingPayment=![],null===(n=super.disconnected)||void 0===n||n.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var n,i,r,s,a,l,d,u,f,g;const v=[],b=this.getStoreValue("checkout.paymentForm"),x=document.createElement("div");x.classList.add("checkout-summary-form-header");const w=document.createElement("h2");w.textContent="Paying with "+capitalizeFirstLetter(null!==(r=null===(i=null===(n=b.paymentMethod)||void 0===n?void 0:n.card)||void 0===i?void 0:i.brand)&&void 0!==r?r:"")+" "+(null===(a=null===(s=b.paymentMethod)||void 0===s?void 0:s.card)||void 0===a?void 0:a.last4),x.appendChild(w);const C=document.createElement("span");C.textContent="Edit",C.setAttribute("aria-label","Edit Payment Information"),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),C.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.editPaymentForm())}),x.appendChild(C),v.push(x);const E=document.createElement("p");return E.classList.add("checkout-summary-form-line"),E.textContent="Exp. "+(null===(d=null===(l=b.paymentMethod)||void 0===l?void 0:l.card)||void 0===d?void 0:d.expMonth)+"/"+(null===(g=null===(f=null===(u=b.paymentMethod)||void 0===u?void 0:u.card)||void 0===f?void 0:f.expYear)||void 0===g?void 0:g.slice(-2)),v.push(E),v}}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(n){const i=n.some(n=>"checkout.loading"===n.path||"checkout.error"===n.path||"checkout.customerForm.isValid"===n.path||"checkout.giftRecipientForm.isValid"===n.path||"checkout.paymentForm.isValid"===n.path);i&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const n=this.store.get("checkout.loading")||![],i=this.store.get("checkout.error")||null;this.updateErrorDisplay(i);const r=this.determineButtonState({isCheckoutLoading:n,hasCheckoutError:!!i});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(r.state),this.placeOrderButton.disabled=r.disabled,this.placeOrderButton.textContent=r.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(n){if(!this.errorContainer)return;const i=this.errorContainer.querySelector(".error-text");i&&(this.clearErrorTimeout(),n?(i.textContent=n,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(i.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:n,hasCheckoutError:i}){const r=this.config.layout.placeOrderButtonText,s=this.store.get("checkout.presale");let a=![];if(!s){const n=this.getStoreValue("cart.fulfillments")||{};a=Object.values(n).some(n=>hasUnmetMinimum(n))}const l=this.store.get("checkout.isGift"),d=this.store.get("checkout.customerForm.isValid"),u=this.store.get("checkout.giftRecipientForm.isValid"),f=this.store.get("checkout.paymentForm.isValid");return a||l&&!u||!d||!f?{state:"disabled",text:r,disabled:!![]}:n?{state:"processing",text:"Placing Order...",disabled:!![]}:i?{state:"disabled",text:r,disabled:!![]}:{state:"ready",text:r,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const n=this.store.get("checkout.loading");if(n)return;await this.commands.checkout.checkoutComplete()}catch(n){this.logger.error("Error handling place order click",n)}}template(){const n=document.createElement("button");n.type="button",n.textContent=this.config.layout.placeOrderButtonText,n.classList.add("checkout-place-order-button"),n.disabled=!![],n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label","Place Order"),n.addEventListener("click",this.handlePlaceOrderClick.bind(this)),n.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handlePlaceOrderClick())});const i=document.createElement("div");i.classList.add("checkout-error-wrapper"),i.setAttribute("role","alert"),i.style.display="none";const r=document.createElement("div");r.classList.add("checkout-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),r.appendChild(s),r.appendChild(a),i.appendChild(r);const l=ComponentFactoryService.createElement({type:C.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,l,n]}}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.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(n){var i;const r=n.find(n=>"checkout.presale"===n.path);if(null==r?void 0:r.value)return this.updateExpiresAt(r.value.expiresAt),!![];const s=n.find(n=>"ui.drawer"===n.path);return(null===(i=null==s?void 0:s.value)||void 0===i?void 0:i.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const n=this.store.get("checkout.presale");(null==n?void 0:n.expiresAt)&&this.updateExpiresAt(n.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var n,i;const r=[".drawer-content"];for(const a of r){const i=null===(n=this.rootElement)||void 0===n?void 0:n.closest(a);if(i&&this.isScrollable(i))return i}let s=null===(i=this.rootElement)||void 0===i?void 0:i.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var n,i;if(!this.scrollContainer)return;const r=this.scrollContainer.scrollTop,s=70,a=10;!this.isCurrentlyScrolled&&r>s?(this.isCurrentlyScrolled=!![],null===(n=this.rootElement)||void 0===n||n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&r<a&&(this.isCurrentlyScrolled=![],null===(i=this.rootElement)||void 0===i||i.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(n){const i=window.getComputedStyle(n),r=i.overflowY;return n.scrollHeight>=n.clientHeight&&("auto"===r||"scroll"===r||"overlay"===r)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(n){this.stopCountdown();try{if(this.expiresAt=new Date(n),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:n}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const i=new Date,r=Math.floor((this.expiresAt.getTime()-i.getTime())/1e3);r<this.totalDuration&&(this.totalDuration=Math.max(r,240)),this.startCountdown()}catch(i){this.logger.error("Failed to parse presale expiration date",i),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const n=new Date,i=Math.max(0,this.expiresAt.getTime()-n.getTime()),r=i/1e3,s=this.totalDuration-r,a=Math.max(0,Math.min(100,s/this.totalDuration*100)),l=r<60;if(l!==this.isUnderOneMinute){this.isUnderOneMinute=l;const n=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==n||n.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==n||n.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const d=this.rootElement.querySelector("[data-timer]");d&&(d.textContent=this.formatTime(i));const u=this.rootElement.querySelector("[data-progress-fill]");u&&(u.style.width=a+"%"),0===i&&this.handleExpire()}formatTime(n){const i=Math.floor(n/1e3),r=Math.floor(i/60),s=i%60,a=Math.floor(n%1e3/10);return r.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 n=document.createElement("div");n.classList.add("checkout-presale-countdown"),this.rootElement=n;const i=document.createElement("div");i.classList.add("checkout-presale-text-container");const r=document.createElement("div");r.classList.add("checkout-presale-heading");const s=document.createElement("h2");s.textContent="LIMITED PRE-ORDER:";const a=document.createElement("div");a.classList.add("checkout-presale-timer"),a.setAttribute("data-timer",""),a.textContent="00:00:00",r.appendChild(s),r.appendChild(a);const l=document.createElement("p");l.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",l.classList.add("checkout-presale-subtitle"),i.appendChild(r),i.appendChild(l);const d=document.createElement("div");d.className="checkout-presale-progress-bar",d.setAttribute("data-progress","");const u=document.createElement("div");return u.className="checkout-presale-progress-fill",u.setAttribute("data-progress-fill",""),u.style.width="0%",d.appendChild(u),n.appendChild(i),n.appendChild(d),n}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const n=[],i=this.getConfigs("global"),r=document.createElement("div");r.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const l=document.createElement("p");l.classList.add("presale-expired-title"),l.textContent="Session Expired",a.appendChild(l);const d=document.createElement("p");d.textContent="Your reservation time has ended. The item has been released for other customers.",a.appendChild(d),s.appendChild(a),r.appendChild(s);const u=document.createElement("div");u.classList.add("checkout-completed-help-section"),u.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available.",r.appendChild(u),n.push(r);const f=document.createElement("div");f.classList.add("checkout-completed-section-container");const g=document.createElement("button");g.setAttribute("aria-label","Continue shopping"),g.type="button";const v=document.createElement("span");v.textContent="Continue Shopping",g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-label","Continue Shopping"),g.appendChild(v);const b=htmlStringToElement(ArrowRightIcon({width:16,height:16}));g.appendChild(b),g.addEventListener("click",()=>this.handleExit()),g.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleExit())}),f.appendChild(g),n.push(f);const x=document.createElement("div");x.classList.add("checkout-completed-section-container");const w=document.createElement("p");w.classList.add("checkout-completed-auto-close-text"),w.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const E=document.createElement("span");if(E.classList.add("checkout-completed-auto-close-text"),E.textContent="seconds",x.appendChild(w),x.appendChild(this.autoCloseElement),x.appendChild(E),n.push(x),i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const r=ComponentFactoryService.createElement({type:C.POWERED_BY,context:"checkout"});i.appendChild(r),n.push(i)}return n}}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(n){const i=n.find(n=>"checkout.promoCode"===n.path),r=n.find(n=>"checkout.loading"===n.path);if(i){const{value:n,oldValue:r}=i,s=Boolean(r),a=Boolean(n);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;a&&this.promoCodeText&&n.discountAmount!==(null==r?void 0:r.discountAmount)&&(this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")")}r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().trim(),i=n.length>=3&&n.length<=255,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),a=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||r||Boolean(s)||Boolean(a)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:C.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),r=this.promoInput;r.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const m=async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(n)}catch(i){this.logger.error("Checkout promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",m),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),m())}),this.applyButton}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const r=document.createElement("button");r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(r),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const n=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const r=document.createElement("button");return r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(r),i}const i=[];return i.push(this.createPromoInput()),i.push(this.createApplyButton()),i}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 n=this.getStoreValue("checkout.isGift"),i=document.createElement("div");i.classList.add("gift-label-wrapper");const r=document.createElement("span");r.textContent="Send as Gift? (Free)",r.classList.add("gift-toggle-label"),i.appendChild(r);const s=document.createElement("span");s.textContent="With personalized note & gift receipt.",s.classList.add("gift-toggle-description"),i.appendChild(s);const a=document.createElement("div");a.classList.add("toggle-switch"),a.classList.toggle("active",n);const l=document.createElement("div");return l.classList.add("toggle-slider"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Toggle Gift Option"),a.setAttribute("role","switch"),a.setAttribute("aria-checked",n?"true":"false"),a.appendChild(l),a.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),a.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.toggleIsGift())}),[i,a]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.N=![],this.F=null,this.R=null,this.O=null,this.L=![],this.M=![],this.B=![],this.W=null}async initialize({data:n}){if(this.N)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.H=n.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.N=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const n=this.H;this.F=window.Stripe(n.publishableKey),this.R=this.F.elements({clientSecret:n.clientSecret,appearance:n.appearance}),this.O=this.R.create("payment",n.elementOptions),this.O.mount(this),this.O.on("change",async n=>{const i=!!n.error,r=n.complete,s=i?n.error.message:null;this.M=r,this.L||await this.updateStripeFormStatus({isFormComplete:r,isProcessing:![],hasCompletedPayment:![],errorMessage:s,hasError:i})}),this.O.on("focus",async()=>{this.L||await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(n){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),n}}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(n){const{stripeConfig:i}=n.detail;i&&(this.H=i,await this.refreshPaymentSession())}async handleSubmit(){var n,i;if(this.L)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.M)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.L=!![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const n=await this.createConfirmationTokenId(),i=this.H.clientSecret,r=i.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:n,setupIntentId:r},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(r){console.error("Payment submission error:",r),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==r?void 0:r.message)||"Payment processing failed. Please try again."}),((null===(n=null==r?void 0:r.message)||void 0===n?void 0:n.includes("expired"))||(null===(i=null==r?void 0:r.message)||void 0===i?void 0:i.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.L=![]}}async requestSessionRefresh(){return this.W||(this.W=new Promise((n,i)=>{const r=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",I),this.W=null,i(new Error("Session refresh timeout"))},1e4),I=()=>{clearTimeout(r),this.removeEventListener("lce:s:refreshSession",I),this.W=null,n()};this.addEventListener("lce:s:refreshSession",I,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.W}async refreshPaymentSession(){try{this.R&&this.R.update({clientSecret:this.H.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ut){console.error("Failed to refresh payment session:",ut),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.O&&this.O.clear(),this.M=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ut){console.error("Failed to reset form:",ut)}}async updateStripeFormStatus(n){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:n},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.R)throw new SDKError("Payment elements not initialized");try{const{error:n}=await this.R.submit();if(n)throw new SDKError(n.message||"Failed to submit payment information");const i={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:r,confirmationToken:s}=await this.F.createConfirmationToken(i);if(r)throw new SDKError(r.message||"Failed to create confirmation token");if(!s||!s.id)throw new SDKError("Invalid confirmation token received");return s.id}catch(n){if(n instanceof SDKError)throw n;throw new SDKError("Payment processing error: "+(n.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(n=>{console.error("Error during Stripe form disconnection cleanup:",n)})}async cleanupForm(){var n,i;try{this.W=null,this.O&&(this.O.unmount(),this.O=null),this.R&&(null===(i=(n=this.R).destroy)||void 0===i?void 0:i.call(n),this.R=null),this.F=null,this.L=![],this.M=![],this.B=![],this.N=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(r){console.warn("Error during Stripe form cleanup:",r)}}loadStripeJS(){return new Promise((n,i)=>{const r=document.querySelector('script[src*="stripe.com"]');if(r)return r.addEventListener("load",()=>n()),r.addEventListener("error",()=>i(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=()=>n(),s.onerror=()=>i(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(n){for(const i of n)switch(i.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(i.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(i.value)}}handleSavedCardChange(n){var i,r,s,a;(null===(i=null==n?void 0:n.card)||void 0===i?void 0:i.brand)&&(null===(r=null==n?void 0:n.card)||void 0===r?void 0:r.last4)?this.savedCardInfo={brand:n.card.brand,last4:n.card.last4}:this.savedCardInfo=null,null===(a=(s=this.callbacks).onSavedCardInfoChanged)||void 0===a||a.call(s,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(n){this.isInEditMode=n,this.updateDisplayState()}updateDisplayState(){var n,i,r,s,a,l;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(i=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(n,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(s=(r=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(r,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(n=>{this.logger.error("Failed to create stripe form in updateDisplayState",n)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(l=(a=this.callbacks).onEditModeVisibilityChanged)||void 0===l||l.call(a,![]))}async afterRender(){var n,i,r,s;this.isInEditMode=null!==(n=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==n?n:![];const a=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(i=null==a?void 0:a.card)||void 0===i?void 0:i.brand)&&a.card.last4&&(this.savedCardInfo={brand:a.card.brand,last4:a.card.last4}),null===(s=(r=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(r,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",n=>{var i,r;this.stripeFormStatus=n.detail.status,null===(r=(i=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(i,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async n=>{var i,r,s,a,l;try{const{confirmationTokenId:s,setupIntentId:a}=n.detail;await(null===(r=(i=this.callbacks).onPaymentSessionConfirmed)||void 0===r?void 0:r.call(i,s,a)),this.isChangingPayment=![]}catch(d){this.logger.error("Failed to save payment form",d),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==d?void 0:d.message)||"Failed to save payment information. Please try again."},null===(a=(s=this.callbacks).onStripeFormStatusChanged)||void 0===a||a.call(s,this.stripeFormStatus),null===(l=this.stripeFormElement)||void 0===l||l.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var n;try{const i=await this.doStripeConfig();null===(n=this.stripeFormElement)||void 0===n?void 0:n.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:i}}))}catch(i){this.logger.error("Failed to refresh payment session",i)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const n=document.createElement("span");n.classList.add("stripe-summary-text"),n.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const i=document.createElement("button");i.type="button",i.classList.add("change-payment-link"),i.textContent="Change",i.setAttribute("aria-label","Change Payment Method"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",()=>this.handleChangePayment()),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(n,i),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 n,i;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(i=(n=this.callbacks).onStripeFormStatusChanged)||void 0===i||i.call(n,this.stripeFormStatus),this.updateDisplayState()}template(){const n=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",n.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const i=document.createElement("slot");return i.setAttribute("name",Pt),this.stripeFormContainer.appendChild(i),n.push(this.stripeFormContainer),n}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 n=this,i=null;for(;n&&n!==document.body;){const r=n.hasAttribute("checkout"),s=n.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(C.LCE_ELEMENT),a=n.hasAttribute("drawer"),l=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(C.DRAWER),d="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(r||s&&a&&l&&d)return this.rootComponent=n,n;i=n,n=n.parentElement||n.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const n=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==n?void 0:n.key)&&(null==n?void 0:n.secret)||await this.commands.checkout.getPaymentSession();const i=this.store.get("checkout.paymentForm.paymentSession"),r=this.getConfigs("global");return{publishableKey:i.key,clientSecret:i.secret,appearance:{theme:"stripe",variables:{fontFamily:r.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:r.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===r.layout.inputFieldStyle?"none":"1px solid "+r.theme.accentColor,backgroundColor:"filled"===r.layout.inputFieldStyle?r.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 n,i,r;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===(n=this.stripeFormElement)||void 0===n?void 0:n.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const a=s.querySelectorAll('[slot="'+Pt+'"]');if(a.length>0)for(const d of a)d.remove();this.isCreatingStripeForm=!![];try{const n=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:C.CHECKOUT_STRIPE_FORM,stripeConfig:n}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",Pt),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===(r=(i=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(i,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var n;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(n=super.disconnected)||void 0===n||n.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const n=this.getStoreValue("checkout.tipSelection");return null!=n?n:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(n){const i=this.getStoreValue("checkout.updating")||![];if(!i)try{await this.commands.checkout.updateTips(n)}catch(r){this.logger.error("Checkout tips update failed",r)}}async handleFulfillmentTipInput(n,i){const r=this.getStoreValue("checkout.updating")||![];if(r)return;const s=this.getOnDemandFulfillmentTipInfo();if(!s[n])return;const a=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(n,a)}catch(l){this.logger.error("Checkout fulfillment tip update failed",l)}}async removeTipFromFulfillment(n){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const r=this.getOnDemandFulfillmentTipInfo();if(r[n])try{await this.commands.checkout.removeFulfillmentTip(n)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const n=document.createElement("div");n.classList.add("checkout-tip-selection-container");const i=[10,18,20],r=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const a of i){const i=document.createElement("button");i.type="button",i.textContent=a+"%",i.classList.add("checkout-tip-button"),i.disabled=r,s===a&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(a)),n.appendChild(i)}return n}setupToggler(){const n=this.container.querySelector(".checkout-tip-distribution-header"),i=this.container.querySelector(".checkout-items-toggler-button"),r=this.container.querySelector(".retailers-tips-list");n&&i&&r&&n.addEventListener("click",()=>{const n=r.classList.contains("show");r.classList.toggle("show"),n?(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand tips section")):(i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse tips section")),i.classList.toggle("expanded")})}createTipDistribution(){const n=document.createElement("section");n.classList.add("checkout-tip-distribution-container");const i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;const r=document.createElement("div");r.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),r.appendChild(s);const a=document.createElement("button");a.type="button",a.classList.add("checkout-items-toggler-button"),a.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),r.appendChild(a),n.appendChild(r);const l=document.createElement("div");l.classList.add("retailers-tips-list","show");for(const d of i){const n=document.createElement("div");n.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=d.retailerName,i.classList.add("checkout-sub-header"),n.appendChild(i);const r=document.createElement("div");r.classList.add("checkout-tip-fulfillment-input-wrapper");const s=document.createElement("div");s.classList.add("dollar-input-container");const a=document.createElement("span");a.classList.add("dollar-sign"),a.textContent="$";const u=document.createElement("input");let f;u.type="number",u.id="tip-input-"+d.fulfillmentId,u.name="tip-"+d.fulfillmentId,u.min="0",u.step="0.01",u.placeholder="0.00",u.classList.add("dollar-input"),u.value=d.tip>0?(d.tip/100).toFixed(2):"",u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("wheel",n=>{n.preventDefault()}),u.addEventListener("keydown",n=>{"-"!==n.key&&"+"!==n.key||n.preventDefault()}),u.addEventListener("keydown",n=>{"ArrowUp"!==n.key&&"ArrowDown"!==n.key||n.preventDefault()}),u.addEventListener("paste",n=>{n.preventDefault()}),u.addEventListener("contextmenu",n=>{n.preventDefault()}),u.addEventListener("input",n=>{const i=n.target;let r=i.value;if(Number.parseFloat(r)<0&&(i.value=Math.abs(Number.parseFloat(r)).toString(),r=i.value),r.includes(".")){const n=r.split(".");n.length>1&&n[1].length>2&&(i.value=n[0]+"."+n[1].substring(0,2))}}),u.addEventListener("input",n=>{const i=n.target,r=Number.parseFloat(i.value)||0;f&&clearTimeout(f),f=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,r)},500)}),s.appendChild(a),s.appendChild(u),r.appendChild(s);const g=document.createElement("button");g.type="button",g.textContent="Remove",g.classList.add("checkout-tip-remove-button"),g.disabled=this.getStoreValue("checkout.updating")||![],g.addEventListener("click",()=>this.removeTipFromFulfillment(d.fulfillmentId)),r.appendChild(g),n.appendChild(r),l.appendChild(n)}return n.appendChild(l),n}async initializeDefaultTip(){if(this.isInitialized)return;const n=this.getStoreValue("checkout.tipSelection"),i=this.getFulfillmentTipInfoArray();if(n&&i.length>0){const n=i.some(n=>n.tip>0);if(n)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(r){this.logger.error("Default tip initialization failed",r),this.isInitialized=![]}}if(null==n)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 n=[],i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;i.length>0&&this.initializeDefaultTip();const r=document.createElement("section");r.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",r.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-tip-config-container");const l=this.createTipSelectionButtons();a.appendChild(l),r.appendChild(a);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",r.appendChild(d);const u=this.createTipDistribution();return n.push(r,u),n}}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(n){var i,r;const s=n.find(n=>"checkout.giftCardError"===n.path),a=n.find(n=>"checkout.promoCodeError"===n.path),l=n.find(n=>"checkout.giftCards"===n.path);if(l&&this.updateAppliedGiftCards(l.value),s){const n=this.container.querySelector(".input-gift-card-container");if(n){const r=n.nextElementSibling;if((null===(i=null==r?void 0:r.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==r?void 0:r.remove()),s.value){const i=this.createErrorElement(s.value);n.after(i)}const a=n.querySelector(".apply-button");a&&(a.disabled=Boolean(s.value))}}if(a){const n=this.container.querySelector(".input-promo-code-container");if(n){const i=n.nextElementSibling;if((null===(r=null==i?void 0:i.classList)||void 0===r?void 0:r.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),a.value){const i=this.createErrorElement(a.value);n.after(i)}const s=n.querySelector(".apply-button");s&&(s.disabled=Boolean(a.value))}}}updateAppliedGiftCards(n){const i=n&&n.length>0;if(!i)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)})}createAppliedGiftCardElement(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),i.setAttribute("data-gift-card-code",n.code);const r=document.createElement("span");r.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",i.appendChild(r);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(n.code)}),i.appendChild(s),i}pcInputContainer(){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return n}gcInputContainer(){const n=ComponentFactoryService.createElement({type:C.CHECKOUT_GIFT_CARDS});return n}inputContainer(){var n;const i=this.getConfigs("checkout"),r=this.getConfigs("global"),s=i.layout.allowGiftCards,a=null===(n=null==r?void 0:r.layout)||void 0===n?void 0:n.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),u=this.gcInputContainer();a&&l.appendChild(d);const f=this.getStoreValue("checkout.promoCodeError");if(f){const n=this.createErrorElement(f);n.classList.add("promo-code-error-wrapper"),l.appendChild(n)}s&&l.appendChild(u);const g=this.getStoreValue("checkout.giftCardError");if(g){const n=this.createErrorElement(g);l.appendChild(n)}return l}createErrorElement(n){const i=document.createElement("div");i.classList.add("error-banner-checkout");const r=document.createElement("div");r.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=n.toString(),i.appendChild(r),i.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),i.remove()},3e3),i}template(){const n=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const i=[];return i.push(this.inputContainer()),n&&n.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)}),i.push(this.appliedGiftCardsContainer)),i}disconnected(){this.appliedGiftCardsContainer=null}}function fulfillmentAddress(n,i){if(!n)return"";if(i===E.SHIPPING){const i=[n.city,n.state].filter(Boolean);return i.join(", ")}const r=[n.one,n.two,n.city,n.state].filter(Boolean);return r.join(", ")}function renderPopupRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:r,fulfillmentStatus:s,selectedSizeAttributes:a}){var l,d,u,f,g;let v=0;const b=null==a?void 0:a.presale,x=(null==b?void 0:b.isActive)&&(null==b?void 0:b.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(b.estimatedShipBy):"",w=i===E.SHIPPING,C=i===E.ON_DEMAND;w&&(v=(null===(d=null===(l=null==n?void 0:n.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),C&&(v=(null===(u=null==n?void 0:n.fees)||void 0===u?void 0:u.fee)||0);const T=fulfillmentAddress(n.retailerAddress,i);let A=null;i===E.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(A=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const P=i===E.ON_DEMAND&&s&&s.isClosed?"closed":"",_=document.createElement("div");_.className="popup-retailer-card "+(r?"selected":"")+" "+P,_.setAttribute("data-fulfillment-id",n.fulfillmentId),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-pressed",r?"true":"false");const N=i===E.SHIPPING?"Shipping":"Same-day delivery";_.setAttribute("aria-label",N+" from "+n.retailerName+", "+formatCentToDollarText(null!==(f=n.price)&&void 0!==f?f:0));const F=document.createElement("div");F.className="row";const R=document.createElement("span");R.className="name",R.textContent=n.retailerName,F.appendChild(R);const O=document.createElement("span");O.className="price",O.textContent=formatCentToDollarText(null!==(g=n.price)&&void 0!==g?g:0),F.appendChild(O),_.appendChild(F);const L=document.createElement("div");L.className="row";const M=document.createElement("span");M.className="expectation",M.textContent=s.isClosed?A:(null==b?void 0:b.isActive)?x:(null==n?void 0:n.expectation.detail)||"No expectation available",L.appendChild(M);const B=document.createElement("span");if(B.className="fee",B.textContent=v>0?formatCentToDollarText(v):"Free Delivery",L.appendChild(B),_.appendChild(L),C){const n=document.createElement("div");n.className="row";const i=document.createElement("span");i.className="address",i.textContent=T,n.appendChild(i),_.appendChild(n)}return _}function renderFulfillmentTabsContainer({shippingFulfillments:n,onDemandFulfillments:i,shippingSelected:r,onDemandSelected:s,onTabClick:a,enableShippingFulfillment:l,enableOnDemandFulfillment:d}){const u=i.length>0,f=document.createElement("div");if(f.className="fulfillment-tabs-container",f.setAttribute("role","tablist"),f.setAttribute("aria-label","Delivery method options"),l){const i=document.createElement("div");i.className="fulfillment-tab "+(r?"selected":""),i.setAttribute("data-fulfillment-type",E.SHIPPING),i.setAttribute("role","tab"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected",r?"true":"false"),i.setAttribute("aria-label","Shipping, "+n.length+" options"),i.addEventListener("click",a),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(r?"selected":""),s.textContent="Shipping ("+n.length+")",i.appendChild(s),f.appendChild(i)}if(d){const n=document.createElement("div");n.className="fulfillment-tab "+(s?"selected":"")+" "+(u?"":"disabled"),n.setAttribute("data-fulfillment-type",E.ON_DEMAND),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",s?"true":"false"),n.setAttribute("aria-label","Same-day delivery, "+i.length+" options"),u||n.setAttribute("aria-disabled","true"),n.addEventListener("click",a),n.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(s?"selected":""),r.textContent="Same-Day Delivery ("+i.length+")",n.appendChild(r),f.appendChild(n)}return f}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 n;const i=this.getProductId(),r=this.getStoreValue("products."+i);if(!r.selectedFulfillment||!r.selectedSizeId)return 0;const s=r.selectedFulfillment.partNumber,a=r.selectedFulfillment.fulfillmentId,l=null===(n=r.sizes[r.selectedSizeId].attributes)||void 0===n?void 0:n.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(n=>n.partNumber===s&&n.fulfillmentId===a),f=u.reduce((n,i)=>n+i.quantity,0);return l-f}isFulfillmentClosed(){const n=this.getProductId(),i=this.getStoreValue("products."+n);if(!i.selectedFulfillment)return![];const r=getRetailerOffHours(i.selectedFulfillment);return i.selectedFulfillmentType===E.ON_DEMAND&&r&&r.isClosed}isButtonLoading(){const n=this.getProductId();return this.getStoreValue("products."+n+".updating")}calculateQuantityLimits(){const{quantity:n}=this.calculateTotalPrice(),i=this.getAvailableQuantity(),r=n<i;return{currentQuantity:n,availableQuantity:i,canIncrease:r,canDecrease:n>1}}async handleAddToCart(){var n,i,r;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 l=this.getSizeAttributes(),d=(null===(n=null==l?void 0:l.presale)||void 0===n?void 0:n.isActive)===!![],u=this.isPresaleActive(l);d&&u?await this.commands.product.addPresaleToCart(s,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(i=a.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:a.quantity,identifier:s}):await this.commands.product.addToCart(s,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(r=a.selectedFulfillment)||void 0===r?void 0:r.partNumber,quantity:a.quantity,identifier:s})}async handleQuantityChange(n){const i=this.getProductId();await this.commands.product.updateQuantity(i,n)}calculateTotalPrice(){const n=this.getProductId(),i=this.getStoreValue("products."+n),r=i.selectedFulfillment,s=r.price*i.quantity;return{quantity:i.quantity,totalPrice:s}}createQuantityContainer(n){const i=this.calculateQuantityLimits(),r=document.createElement("div");return r.className="quantity-container "+n,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!i.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!i.canDecrease).toString()),i.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=i.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+i.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!i.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!i.canIncrease).toString()),i.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(1)}),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantityText),r.appendChild(this.qtyIncreaseButton),r}getSizeAttributes(){const n=this.getProductId(),i=this.getStoreValue("products."+n+".selectedSizeId"),r=this.getStoreValue("products."+n+".sizes."+i);return(null==r?void 0:r.attributes)||{}}isPresaleActive(n){const i=null==n?void 0:n.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const n=new Date(i.canPurchaseOn),r=new Date;if(r.getTime()<n.getTime())return![]}return!![]}createAddToCartButton(){var n;const{totalPrice:i}=this.calculateTotalPrice(),r=this.getSizeAttributes(),s=this.calculateQuantityLimits(),a=(null===(n=null==r?void 0:r.presale)||void 0===n?void 0:n.isActive)===!![],l=this.isPresaleActive(r),d=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?d+" - "+formatCentToDollarText(i):d;const u=a&&!l||0===s.availableQuantity||this.isFulfillmentClosed(),f=this.isButtonLoading(),g=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(i):d;return this.addToCartButton.setAttribute("aria-label",g),this.addToCartButton.setAttribute("aria-busy",f.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),f&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async n=>{if(n.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 n=this.getProductId(),i=this.getStoreValue("products."+n+".fulfillmentHasAvailability"),r=this.getConfigs("configurations");if(!i||!r.isElementsEnabled)return[];const s=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer(this.config.layout.quantityCounterStyle);s.push(n)}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 n=this.params.productId,i=this.getStoreValue("products."+n+".description"),r=this.getStoreValue("products."+n+".htmlDescription"),s="About this product:",a="See More",l="See Less",d=document.createElement("h3");d.className="title",d.textContent=s;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==r?void 0:r.trim())?i:sanitizeHTML(r);const f=document.createElement("span");f.className="collapse-button",f.textContent=a,f.setAttribute("role","button"),f.setAttribute("tabindex","0"),f.setAttribute("aria-label","Show more product information"),f.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),f.textContent=this.isCollapsed?a:l,f.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),f.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return f.addEventListener("click",toggleContent),f.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),toggleContent())}),[d,u,f]}}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(n){var i;const r=n.find(n=>n.path==="products."+this.getProductId()+".drawer");if(!r)return![];const s=r.value,a=s.isOpen,l=null===(i=s.contentConfig)||void 0===i?void 0:i.type,d=l!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):a&&this.isOpen&&!d?![]:a&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!a&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:n}){const i=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!n)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:i}),void 0;const{type:r,data:s}=n||{},a=ComponentFactoryService.createElement({type:r,...s});this.contentContainer&&this.contentContainer.appendChild(a),this.open()}catch(r){this.logger.error("Failed to open product drawer",r),this.commands.product.closeProductDrawer(i)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const n=document.createElement("div");return n.classList.add("product-drawer-content"),this.contentContainer=n,n}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const n=this.config.layout.fulfillmentDisplay;return["product-image-carousel",n]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(n){const i=this.params.productId,r=n.find(n=>n.path==="products."+i+".mainImage");if(null==r?void 0:r.value){const n=this.params.images.indexOf(null==r?void 0:r.value);-1!==n?this.selectImage(n):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+r.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let i=0;i<this.thumbnails.length;i++){const n=this.thumbnails[i];n.addEventListener("click",()=>{this.hasMoved||this.selectImage(i)})}const n=this.container.querySelectorAll(".carousel-dot");for(let i=0;i<n.length;i++){const r=n[i];r.addEventListener("click",()=>this.selectImage(i))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(n){var i,r;if(n<0||n>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[n]+"')",this.mainImageElement.title="Product image "+(n+1)),null===(i=this.thumbnails[this.currentImageIndex])||void 0===i||i.classList.remove("selected"),null===(r=this.thumbnails[n])||void 0===r||r.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let a=0;a<s.length;a++){const i=s[a];i.classList.toggle("active",a===n)}this.currentImageIndex=n,this.galleryViewport&&this.scrollToIndex(n)}scrollToIndex(n){if(!this.galleryViewport||!this.thumbnails[n])return;const i=this.thumbnails[n],r=this.galleryViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,a=r/2,l=a-s,d=0,u=-(this.galleryContainer.scrollWidth-r);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupMainImageSwipe(){var n,i;let r=0,s=0;null===(n=this.mainImageElement)||void 0===n?void 0:n.addEventListener("touchstart",n=>{r=n.touches[0].clientX,s=n.touches[0].clientY},{passive:!![]}),null===(i=this.mainImageElement)||void 0===i||i.addEventListener("touchend",n=>{const i=n.changedTouches[0].clientX-r,a=n.changedTouches[0].clientY-s;Math.abs(i)>Math.abs(a)&&Math.abs(i)>50&&(i>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const n of this.galleryContainer.querySelectorAll("img"))n.addEventListener("dragstart",n=>n.preventDefault())}}handleDragStart(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,r=i-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,a=0,l=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(l,Math.min(a,s)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(n){this.galleryContainer&&(this.galleryContainer.style.transition=n?"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 n=[],i=this.params.images.length>1,r=document.createElement("div");if(r.className="main-image",r.title="Product main image",r.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",i){const n=document.createElement("div");n.className="carousel-dots";for(let i=0;i<this.params.images.length;i++){const r=document.createElement("button");r.type="button",r.className="carousel-dot "+(0===i?"active":""),r.setAttribute("data-index",i.toString()),n.appendChild(r)}r.appendChild(n)}this.mainImageElement=r,n.push(r);const s=document.createElement("div");s.className="gallery-viewport";const a=document.createElement("div");a.className="gallery-container";for(let l=0;l<this.params.images.length;l++){const n=this.params.images[l],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===l?"selected":"");const r=document.createElement("img");r.src=n,r.className="gallery-image",r.alt="Product thumbnail "+(l+1),r.loading="lazy",i.appendChild(r),a.appendChild(i)}return s.appendChild(a),n.push(s),n}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(n){var i,r,s,a;const l=this.getProductId();if(!n.some(n=>n.path==="products."+l+".selectedFulfillmentType"))return;const d=this.getStoreValue("products."+l),u=d.sizes[d.selectedSizeId],f=this.getConfigs("global");this.addPersonalizationSpan&&(d.selectedFulfillmentType===E.SHIPPING&&f.layout.enablePersonalization&&d.productHasAvailability&&(null===(r=null===(i=null==u?void 0:u.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.status)===!![]&&(null===(s=null==d?void 0:d.selectedFulfillment)||void 0===s?void 0:s.isVariantEngravable)===!![]&&(null===(a=null==d?void 0:d.selectedFulfillment)||void 0===a?void 0:a.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const n=this.getProductId(),i=this.container.querySelectorAll("[select-size]");for(const r of i){const s=r.textContent||"",a=r.classList.contains("selected");r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Select "+s),r.setAttribute("aria-pressed",a?"true":"false"),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),r.click())}),r.addEventListener("click",async()=>{var s,a,l,d;const u=r.dataset.sizeId;if(!u)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:n,buttonElement:r.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(n,u);for(const n of i)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");r.classList.add("selected"),r.setAttribute("aria-pressed","true");const f=this.getStoreValue("products."+n),g=f.sizes[u],v=this.getConfigs("global");this.addPersonalizationSpan&&(v.layout.enablePersonalization&&(null===(a=null===(s=null==g?void 0:g.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.status)===!![]&&f.productHasAvailability&&(null===(l=f.selectedFulfillment)||void 0===l?void 0:l.isVariantEngravable)===!![]&&(null===(d=f.selectedFulfillment)||void 0===d?void 0:d.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(n,i){const r=document.createElement("div");r.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",r.appendChild(s);const a=document.createElement("div");a.className="size-buttons-container",a.setAttribute("role","group"),a.setAttribute("aria-labelledby","size-label");for(const l of Object.values(i)){const i=document.createElement("span");i.setAttribute("data-size-id",l.id),i.setAttribute("select-size",""),i.className="size-button "+(l.id===n?"selected":"");const r=l.packDesc?" ("+l.packDesc+")":"";i.textContent=""+l.size+r,a.appendChild(i)}return r.appendChild(a),r}hasIndependentAddressComponent(){var n;return(null===(n=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===n?void 0:n.length)>0}template(){var n,i,r,s,a;const l=this.getProductId(),d=this.getStoreValue("products."+l),u=d.sizes[d.selectedSizeId],f=this.getConfigs("global"),g=[],v=document.createElement("div");v.className="price-personalization-container";const b=ComponentFactoryService.createElement({type:C.PRODUCT_PRICE,productId:l});if(v.appendChild(b),f.layout.enablePersonalization&&d.productHasAvailability&&(null===(i=null===(n=null==u?void 0:u.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.status)===!![]&&(null===(r=null==d?void 0:d.selectedFulfillment)||void 0===r?void 0:r.canEngrave)===!![]&&(null===(s=null==d?void 0:d.selectedFulfillment)||void 0===s?void 0:s.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var n,i,r,s,a,u,f,g;const v=d.sizes[d.selectedSizeId];await this.commands.product.openProductDrawer(l,C.ENGRAVING_FORM,{identifier:l,context:"product",lines:[],maxLines:(null===(i=null===(n=v.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.maxLines)||1,maxCharsPerLine:(null===(s=null===(r=v.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(u=null===(a=v.attributes)||void 0===a?void 0:a.engraving)||void 0===u?void 0:u.fee)||0,location:null===(g=null===(f=v.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await addPersonalization())}),v.appendChild(this.addPersonalizationSpan)}g.push(v);const x=this.renderProductSizes(d.selectedSizeId,d.sizes);if(g.push(x),!this.hasIndependentAddressComponent()){const n=ComponentFactoryService.createElement({type:C.ADDRESS_DISPLAY,productId:l});g.push(n)}const w=ComponentFactoryService.createElement({type:C.PRODUCT_RETAILERS,productId:l});g.push(w);const E=ComponentFactoryService.createElement({type:C.PRODUCT_ADD_TO_CART_SECTION,productId:l});g.push(E);const T=null===(a=null==u?void 0:u.attributes)||void 0===a?void 0:a.presale;if((null==T?void 0:T.isActive)===!![]&&(null==T?void 0:T.language)){const n=document.createElement("div");n.className="product-presale-notice",n.innerHTML=sanitizeHTML((null==T?void 0:T.language)||""),g.push(n)}if(this.config.layout.showDescription&&(d.description.trim().length>0||d.htmlDescription.trim().length>0)){const n=ComponentFactoryService.createElement({type:C.PRODUCT_DESCRIPTION,productId:l});g.push(n)}return g}}class ProductLoadingComponent extends BaseComponent{template(){const n=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:r,showQuantityCounter:s,fulfillmentDisplay:a,showImages:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const u=document.createElement("div");if(u.classList.add("skeleton-container"),i){const n=document.createElement("div");n.classList.add("wave","sc-title"),u.appendChild(n)}if(!n){const n=document.createElement("div");return n.classList.add("wave","sc-add-to-cart"),u.appendChild(n),u}const f=document.createElement("div");f.classList.add("wave","sc-price"),u.appendChild(f);const g=document.createElement("div");g.classList.add("sc-sizes");const v=document.createElement("div");v.classList.add("wave","sc-size-button"),g.appendChild(v);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),g.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),g.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-size-button"),g.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-size-button"),g.appendChild(C),u.appendChild(g);const E=document.createElement("div");E.classList.add("sc-row");const T=document.createElement("div");T.classList.add("wave","sc-price"),E.appendChild(T);const A=document.createElement("div");A.classList.add("wave","sc-personalization"),E.appendChild(A),u.appendChild(E);const P=document.createElement("div");P.classList.add("wave","sc-deliver-to"),u.appendChild(P);const _=document.createElement("div");_.classList.add("wave","sc-address"),u.appendChild(_);const N=document.createElement("div");N.classList.add("wave","sc-retailers",a),u.appendChild(N);const F=document.createElement("div");if(F.classList.add("sc-row"),s){const n=document.createElement("div");n.classList.add("wave","sc-quantity"),F.appendChild(n)}const R=document.createElement("div");if(R.classList.add("wave","sc-add-to-cart"),F.appendChild(R),u.appendChild(F),r){const n=document.createElement("div");n.classList.add("wave","sc-description-title"),u.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),u.appendChild(i);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),u.appendChild(r);const s=document.createElement("div");s.classList.add("wave","sc-description-line"),u.appendChild(s);const a=document.createElement("div");a.classList.add("wave","sc-description-more"),u.appendChild(a)}const O=document.createElement("div");if(O.classList.add("product-content"),O.appendChild(u),d.appendChild(O),l){d.classList.add("has-images");const n=this.createImageSkeletons();d.prepend(n)}return d}createImageSkeletons(){const n=document.createElement("div");n.classList.add("product-image-carousel","skeleton");const i=document.createElement("div");i.classList.add("wave","sc-main-image"),i.title="Product main image loading";const r=document.createElement("div");r.classList.add("carousel-dots");for(let l=0;l<3;l++){const n=document.createElement("div");n.classList.add("wave","sc-carousel-dot"),r.appendChild(n)}i.appendChild(r),n.appendChild(i);const s=document.createElement("div");s.classList.add("gallery-viewport");const a=document.createElement("div");a.classList.add("gallery-container");for(let l=0;l<4;l++){const n=document.createElement("div");n.classList.add("gallery-image-wrapper");const i=document.createElement("div");i.classList.add("wave","sc-gallery-thumbnail"),n.appendChild(i),a.appendChild(n)}return s.appendChild(a),n.appendChild(s),n}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),r=n.find(n=>n.path==="products."+i+".drawer.isOpen");if(r){const n=r.value===!![];n&&this.addHostClasses("hide-content"),n||this.removeHostClasses("hide-content")}}template(){const n=this.getProductId(),i=this.getStoreValue("address.formattedAddress");if(i)return ComponentFactoryService.createElement({type:C.PRODUCT_INTERACTIONS,productId:this.getProductId()});const r=document.createElement("button");return r.type="button",r.className="product-options-open-address-button",r.textContent=this.config.layout.buyNowButtonText,r.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(C.ADDRESS_INPUT,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,C.ADDRESS_INPUT,{productId:n})}),r}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var n;const i=this.getProductId(),r=this.getStoreValue("products."+i);let s=(null===(n=r.priceInfo)||void 0===n?void 0:n.avg)||0;return r.selectedFulfillment&&(s=r.selectedFulfillment.price),formatCentToDollarText(s)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),r=this.getConfigs("product"),s=[],a=this.getConfigs("configurations");if(!i.productHasAvailability||!a.isElementsEnabled){const n=document.createElement("p");return n.className="product-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),s.push(n),s}const l="carousel"===r.layout.fulfillmentDisplay?C.PRODUCT_RETAILERS_CAROUSEL:C.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:l,productId:n});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 n=this.retailerCards.findIndex(n=>n.classList.contains("selected"));-1!==n&&this.scrollToIndex(n)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),r=n.find(n=>n.path==="products."+i+".selectedFulfillmentId");(null==r?void 0:r.value)&&this.updateSelectedCard(r.value)}updateSelectedCard(n){for(const r of this.retailerCards)r.classList.remove("selected"),r.setAttribute("aria-pressed","false");const i=this.retailerCards.findIndex(i=>i.dataset.fulfillmentId===n);-1!==i&&(this.retailerCards[i].classList.add("selected"),this.retailerCards[i].setAttribute("aria-pressed","true"),this.scrollToIndex(i))}scrollToIndex(n){if(!this.listViewport||!this.retailerCards[n])return;const i=this.retailerCards[n],r=this.listViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,a=r/2,l=a-s,d=0,u=-(this.listContainer.scrollWidth-r);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.listViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,r=i-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,a=0,l=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(l,Math.min(a,s)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(n){this.listContainer&&(this.listContainer.style.transition=n?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(n){const i=this.getProductId(),r=n.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,r)}async onRetailerCardClick(n){if(this.hasMoved)return;const i=this.getProductId(),r=n.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.fulfillmentId===r)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:i,fulfillmentId:r}),void 0;await this.commands.product.selectFulfillment(i,r)}generateRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:r,fulfillmentStatus:s,selectedSizeAttributes:a}){var l,d,u,f,g;let v=0;const b=null==a?void 0:a.presale,x=(null==b?void 0:b.isActive)&&(null==b?void 0:b.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(b.estimatedShipBy):"",w=i===E.SHIPPING,C=i===E.ON_DEMAND;w&&(v=(null===(d=null===(l=null==n?void 0:n.fees)||void 0===l?void 0:l.individual)||void 0===d?void 0:d.fee)||0),C&&(v=(null===(u=null==n?void 0:n.fees)||void 0===u?void 0:u.fee)||0);const T=fulfillmentAddress(n.retailerAddress,i);let A=null;i===E.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(A=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const P=i===E.ON_DEMAND&&s&&s.isClosed?"closed":"",_=document.createElement("div");_.className="carousel-retailer-card "+(r?"selected":"")+" "+P,_.setAttribute("data-fulfillment-id",n.fulfillmentId),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-pressed",r?"true":"false");const N=i===E.SHIPPING?"Shipping":"Same-day delivery";_.setAttribute("aria-label",N+" from "+n.retailerName+", "+formatCentToDollarText(null!==(f=n.price)&&void 0!==f?f:0));const F=document.createElement("div");F.className="retailer-header";const R=document.createElement("h3");if(R.className="name",R.textContent=n.retailerName,F.appendChild(R),C){const n=document.createElement("h3");n.className="address",n.textContent=T,F.appendChild(n)}const O=document.createElement("div");O.className="retailer-body";const L=document.createElement("span");L.className="product-price",L.textContent=formatCentToDollarText(null!==(g=n.price)&&void 0!==g?g:0);const M=document.createElement("span");M.className="shipping-price",M.textContent=v>0?"+ "+formatCentToDollarText(v):"FREE Delivery";const B=document.createElement("span");return B.className="expectation",B.textContent=s.isClosed?A:(null==b?void 0:b.isActive)?x:(null==n?void 0:n.expectation.detail)||"No expectation available",O.append(L,M,B),_.append(F,O),_}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),r=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==r?void 0:r.attributes)||null,a=[];for(const v in r.shippingFulfillments)Object.prototype.hasOwnProperty.call(r.shippingFulfillments,v)&&a.push(r.shippingFulfillments[v]);const l=[];for(const v in r.onDemandFulfillments)Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,v)&&l.push(r.onDemandFulfillments[v]);const d=i.selectedFulfillmentType===E.SHIPPING,u=i.selectedFulfillmentType===E.ON_DEMAND,f=d?a:l,g=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===f.length){const n=document.createElement("p");return n.className="product-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[g,n]}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 v of f){const n=getRetailerOffHours(v),r=this.generateRetailerCard({fulfillment:v,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:v.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:n,selectedSizeAttributes:s}),a=i.selectedFulfillmentType===E.ON_DEMAND&&n&&n.isClosed;a?r.setAttribute("aria-disabled","true"):(r.addEventListener("click",this.onRetailerCardClick.bind(this)),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),r.click())})),this.listContainer.appendChild(r)}return this.listViewport.appendChild(this.listContainer),[g,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 n=this.getProductId(),i=this.getStoreValue("products."+n),r=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==r?void 0:r.attributes)||null,a=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,d=Object.values(r.shippingFulfillments),u=Object.values(r.onDemandFulfillments),f=(a?d.length:0)+(l?u.length:0),g=document.createElement("div");g.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=i.selectedFulfillmentType===E.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(C.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,C.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}))}),g.appendChild(v),g.appendChild(b),!i.fulfillmentHasAvailability){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[g,n]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";const w=getRetailerOffHours(i.selectedFulfillment),T=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],fulfillmentStatus:w,selectedSizeAttributes:s});return x.appendChild(T),[g,x]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(n){const i=this.getProductId(),r=n.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,r)}async onRetailerCardClick(n){const i=this.getProductId(),r=n.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const D=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(i),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.fulfillmentId===r)return await D(),void 0;await this.commands.product.selectFulfillment(i,r),await D()}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),r=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==r?void 0:r.attributes)||null,a=[];for(const x in r.shippingFulfillments)Object.prototype.hasOwnProperty.call(r.shippingFulfillments,x)&&a.push(r.shippingFulfillments[x]);const l=[];for(const x in r.onDemandFulfillments)Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,x)&&l.push(r.onDemandFulfillments[x]);const d=i.selectedFulfillmentType===E.SHIPPING,u=i.selectedFulfillmentType===E.ON_DEMAND,f=d?a:l,g=document.createElement("h5");g.className="popup-retailers-section-title",g.textContent="Delivery Options";const v=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:l,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===f.length){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[g,v,n]}const b=document.createElement("div");b.className="popup-fulfillment-list-container";for(const x of f){const n=getRetailerOffHours(x),r=renderPopupRetailerCard({fulfillment:x,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:x.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:n,selectedSizeAttributes:s});r.addEventListener("click",this.onRetailerCardClick.bind(this)),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),r.click())}),b.appendChild(r)}return[g,v,b]}}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(n){const i=this.getProductId(),r=n.find(n=>n.path==="products."+i+".drawer.isOpen"),s=n.find(n=>n.path==="products."+i+".rerender");r&&this.titleElement&&this.titleElement.classList.toggle("hide",r.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var n;const i=this.getProductId(),r=this.getStoreValue("products."+i);if(!r)return ComponentFactoryService.createElement({type:C.PRODUCT_LOADING});if(r.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:C.PRODUCT});if(r.loading)return ComponentFactoryService.createElement({type:C.PRODUCT_LOADING});const s=r.sizes[r.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+r.name);const l=document.createElement("div");if(l.classList.add("product-content"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+r.name),this.config.layout.showTitle){const n=document.createElement("h1");n.classList.add("product-title"),n.textContent=r.name,this.titleElement=n,l.appendChild(n)}const d=ComponentFactoryService.createElement({type:C.PRODUCT_OPTIONS,productId:i});l.appendChild(d);const u=ComponentFactoryService.createElement({type:C.PRODUCT_DRAWER,productId:i});if(l.appendChild(u),a.appendChild(l),!this.config.layout.showImages||!(null===(n=r.images)||void 0===n?void 0:n.length))return a;a.classList.add("has-images");const f=ComponentFactoryService.createElement({type:C.PRODUCT_IMAGE_CAROUSEL,images:r.images,mainImage:s.image,productId:i});return a.prepend(f),f.setAttribute("aria-label","Product images"),a}async disconnected(){const n=this.getProductId();n&&await this.commands.product.removeProduct(n)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var n,i,r;const s=this.params.product,a=this.getStoreValue("address.address"),l={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==a?void 0:a.state)||"",isPresale:![],isPresaleActive:![]},d=s.sizes[0];if(!d)return l;const u=d.variants[0];if(!u)return l;l.upc=d.upc;const f=d.attributes||{};l.isPresale=(null===(n=f.presale)||void 0===n?void 0:n.isActive)===!![],l.isPresaleActive=this.isPresaleActive(f);for(const g of this.params.fulfillments){const n=u.fulfillments.some(n=>n===g.id);if(n){const n="shipping"===g.type&&(null===(i=u.fulfillmentTypes)||void 0===i?void 0:i.shipping)||"onDemand"===g.type&&(null===(r=u.fulfillmentTypes)||void 0===r?void 0:r.onDemand);if(n&&u.stock>0){l.hasAvailability=!![],l.fulfillmentId=g.id,l.partNumber=u.partNumber;break}}}return l}isPresaleActive(n){const i=null==n?void 0:n.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const n=new Date(i.canPurchaseOn),r=new Date;if(r.getTime()<n.getTime())return![]}return!![]}async handleAddToCart(n){if(!n.hasAvailability)return;const i=this.params.product.salsifyGrouping||this.params.product.id||"";n.isPresale&&n.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,identifier:i}):await this.commands.productList.addToCart({upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,identifier:i})}template(){var n,i,r,s;const a=this.params.product,l=a.sizes[0],d=l?l.image:a.images[0],u=a.name,f=l?l.size:null,g=null!==(r=null===(i=null===(n=null==l?void 0:l.variants)||void 0===n?void 0:n[0])||void 0===i?void 0:i.price)&&void 0!==r?r:(null===(s=a.priceInfo)||void 0===s?void 0:s.average)||0,v=this.getAvailabilityData();return this.createVariantStandard({image:d,name:u,size:f,price:g,availability:v})}generateProductUrl(){var n;if(!this.params.productUrl)return null;const i=this.params.product,r=null===(n=i.sizes)||void 0===n?void 0:n[0],s=this.params.productUrl;if(s.includes("{upc}")){const n=(null==r?void 0:r.upc)||"";return n?s.replace("{upc}",n):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(s.includes("{grouping}")){const n=i.salsifyGrouping||"";return n?s.replace("{grouping}",n):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(n){const{image:i,name:r,size:s,price:a,availability:l}=n,d=[],u=this.generateProductUrl(),f=document.createElement("div");f.className="plc__image-content";const g=document.createElement("div");g.className="plc__image-wrapper";const v=document.createElement("img");if(v.className="plc__image",v.src=i,v.alt=r,v.loading="lazy",g.appendChild(v),f.appendChild(g),u){const n=document.createElement("a");n.href=u,n.className="plc__image-link",n.target="_blank",n.rel="noopener noreferrer",n.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),n.appendChild(f),d.push(n)}else d.push(f);const b=document.createElement("div");b.className="plc__content";const x=document.createElement("h3");if(x.className="plc__title",x.textContent=r,u){const n=document.createElement("a");n.href=u,n.className="plc__title-link",n.target="_blank",n.rel="noopener noreferrer",n.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),n.appendChild(x),b.appendChild(n)}else b.appendChild(x);const w=document.createElement("div");w.className="plc__size-price-wrapper";const C=document.createElement("div");C.className="plc__price",C.textContent=formatCentToDollarText(a),w.appendChild(C);const E=document.createElement("div");E.className="plc__size",E.textContent=s||"",w.appendChild(E),b.appendChild(w),d.push(b);const T=document.createElement("button");return T.type="button",T.className="plc__button",T.disabled=!l.hasAvailability,l.isPresale?T.textContent="Pre Order":l.hasAvailability?T.textContent="Add to Cart":(T.textContent="Not Available In "+l.state.toUpperCase(),this.addHostClasses("not-available")),T.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleAddToCart(l)}),d.push(T),d}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(n){const i=document.createElement("div");i.classList.add("slc__card");const r=document.createElement("div");r.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),r.appendChild(s);const l=document.createElement("div");l.className="slc__content";const d=document.createElement("div");d.className="slc__title-container";const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-1"),d.appendChild(u);const f=document.createElement("div");f.classList.add("wave","slc__title","slc__title-line-2"),d.appendChild(f),l.appendChild(d);const g=document.createElement("div");g.className="slc__size-price-wrapper";const v=document.createElement("div");v.classList.add("wave","slc__price"),g.appendChild(v);const b=document.createElement("div");b.classList.add("wave","slc__size"),g.appendChild(b),l.appendChild(g);const x=document.createElement("div");return x.classList.add("wave","slc__button"),i.appendChild(r),i.appendChild(l),i.appendChild(x),i}template(){const n=[],i=100/this.params.columns;this.container.style.setProperty("--card-width",i+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const r=this.params.rows*this.params.columns;for(let s=0;s<r;s++){const i=this.createSkeletonCard(s);n.push(i)}return n}}function createApplyFiltersButton(n){const i=document.createElement("div");i.className="product-list-filters-apply-container";const r=document.createElement("button");return r.className="product-list-filters-apply-btn",r.textContent="Apply Filters",r.addEventListener("click",()=>n()),i.appendChild(r),i}function createCheckboxItem(n){const{filter:i,state:r,item:s,onChange:a}=n,l=document.createElement("div");l.className="checkbox-filter-item";const d=document.createElement("input");d.type="checkbox",d.id=i.bucket+"-"+s.value,d.value=s.value.toString(),d.className="checkbox-filter-checkbox",d.checked=r.selectedValues.has(s.value.toString()),d.addEventListener("change",a);const u=document.createElement("label");u.htmlFor=d.id,u.className="checkbox-filter-item-label";const f=s.formattedValue||s.value.toString(),g=s.count||0,v=document.createElement("span");v.className="checkbox-filter-item-text",v.textContent=f;const b=document.createElement("span");return b.className="checkbox-filter-item-count",b.textContent="("+g+")",u.appendChild(v),u.appendChild(b),l.appendChild(d),l.appendChild(u),l}function handleCheckboxFilterSearch(n){const{filter:i,state:r,searchTerm:s,renderCheckboxItems:a}=n,l=s.toLowerCase().trim();r.filteredItems=l?i.values.filter(n=>{const i=(n.formattedValue||n.value.toString()).toLowerCase();return i.includes(l)}):[...i.values],a()}function createCheckboxFilterHeader(n){const{filter:i,state:r,onToggle:s}=n,a=document.createElement("div");a.className="checkbox-filter-header";const l=document.createElement("button");l.className="checkbox-filter-label",l.type="button";const d=document.createElement("span");d.textContent=formatFilterLabel(i.bucket);const u=document.createElement("span");return u.className="checkbox-filter-toggle-icon "+(r.isExpanded?"expanded":"collapsed"),u.innerHTML=r.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),r.iconElement=u,l.appendChild(d),l.appendChild(u),l.addEventListener("click",()=>s(i.bucket)),a.appendChild(l),a}function createCheckboxFilterSearchContainer(n){const{state:i,onSearch:r}=n,s=document.createElement("div");s.className="checkbox-filter-search-wrapper",i.searchInput=document.createElement("input"),i.searchInput.type="text",i.searchInput.className="checkbox-filter-search",i.searchInput.placeholder="Search";const a=document.createElement("span");return a.className="checkbox-filter-search-icon",a.innerHTML=SearchIcon({}),i.searchInput.addEventListener("input",n=>{const i=n.target;r(i.value)}),s.appendChild(i.searchInput),s.appendChild(a),s}function renderCheckboxItems(n){const{filter:i,state:r,onCheckboxChange:s}=n;if(r.checkboxList&&(r.checkboxList.innerHTML="",r.filteredItems.forEach(n=>{const a=createCheckboxItem({filter:i,state:r,item:n,onChange:()=>{const i=a.querySelector("input");s(n.value.toString(),i.checked)}});r.checkboxList.appendChild(a)}),0===r.filteredItems.length)){const n=document.createElement("div");n.className="checkbox-filter-no-results",n.textContent="No results found",r.checkboxList.appendChild(n)}}function updateFilterExpandState(n){n.contentElement&&(n.contentElement.className="checkbox-filter-content "+(n.isExpanded?"expanded":"collapsed")),n.iconElement&&(n.iconElement.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),n.iconElement.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(n){return n.charAt(0).toUpperCase()+n.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(n){const{currentFilters:i,deliveryCollapsed:r,isSameDayDeliveryDisabled:s,onDeliveryOptionsChange:a,onToggleCollapse:l}=n,d=[],u=document.createElement("div");u.className="product-list-filters-delivery-options";const f=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],g=document.createElement("div");g.className="product-list-filters-delivery-options-header",g.style.cursor="pointer";const v=document.createElement("h3");v.className="product-list-filters-delivery-options-label",v.textContent="Delivery Options";const b=document.createElement("div");b.className="product-list-filters-chevron",b.innerHTML=r?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),g.appendChild(v),g.appendChild(b),u.appendChild(g);const x=document.createElement("div");x.className="product-list-filters-delivery-options-list",r&&x.classList.add("collapsed");for(const w of f){const n=document.createElement("div");n.className="product-list-filters-delivery-option";const r=document.createElement("input");r.type="radio",r.id="delivery-"+w.value,r.name="delivery-options",r.value=w.value,r.className="product-list-filters-delivery-radio";const l="onDemand"===w.value&&s;r.disabled=l,r.checked=w.value===(null==i?void 0:i.deliveryOptions),r.addEventListener("change",n=>{const i=n.target;null==a?void 0:a(i.value)});const d=document.createElement("label");d.htmlFor="delivery-"+w.value,d.className="product-list-filters-delivery-radio-label "+(l?"disabled":""),d.textContent=w.label,n.appendChild(r),n.appendChild(d),x.appendChild(n)}return u.appendChild(x),g.addEventListener("click",()=>{l()}),d.push(u),{elements:d,chevronContainer:b,deliveryOptionsList:x}}function createPriceFilter(n){var i,r,s,a,l,d,u,f;const{priceConfig:g,currentFilters:v,priceCollapsed:b,onPriceChange:x,onToggleCollapse:w,DEFAULT_MIN:C,DEFAULT_MAX:E}=n,T=[],A=document.createElement("div");A.className="product-list-filters-price";const P=Number.parseInt(null!==(i=null==g?void 0:g.min)&&void 0!==i?i:C,10),_=Number.parseInt(null!==(r=null==g?void 0:g.max)&&void 0!==r?r:E,10),N=Number.parseInt(null!==(l=null!==(a=null===(s=null==v?void 0:v.price)||void 0===s?void 0:s.min)&&void 0!==a?a:null==g?void 0:g.min)&&void 0!==l?l:C,10),F=Number.parseInt(null!==(f=null!==(u=null===(d=null==v?void 0:v.price)||void 0===d?void 0:d.max)&&void 0!==u?u:null==g?void 0:g.max)&&void 0!==f?f:E,10),R=document.createElement("div");R.className="product-list-filters-price-header",R.style.cursor="pointer";const O=document.createElement("h3");O.className="product-list-filters-price-title",O.textContent="Price Range",R.appendChild(O);const L=document.createElement("div");L.className="product-list-filters-chevron",L.innerHTML=b?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),R.appendChild(L),A.appendChild(R);const M=document.createElement("div");M.className="product-list-filters-price-slider-container",b&&M.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const W=document.createElement("div");W.className="product-list-filters-price-track";const H=document.createElement("div");H.className="product-list-filters-price-track-active",W.appendChild(H),B.appendChild(W);const q=document.createElement("input");q.type="range",q.min=P.toString(),q.max=_.toString(),q.value=N.toString(),q.step="1",q.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(q);const j=document.createElement("input");j.type="range",j.min=P.toString(),j.max=_.toString(),j.value=F.toString(),j.step="1",j.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(j),M.appendChild(B);const U=document.createElement("div");U.className="product-list-filters-price-inputs-container";const V=document.createElement("div");V.className="product-list-filters-price-input-wrapper";const K=document.createElement("span");K.className="product-list-filters-price-input-prefix",K.textContent="$";const Q=document.createElement("input");Q.type="number",Q.min=P.toString(),Q.max=_.toString(),Q.value=N.toString(),Q.className="product-list-filters-price-input",Q.placeholder=P.toString(),V.appendChild(K),V.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=_.toString(),$.value=F.toString(),$.className="product-list-filters-price-input",$.placeholder=_+"+",X.appendChild(J),X.appendChild($),U.appendChild(V),U.appendChild(Z),U.appendChild(X),M.appendChild(U),A.appendChild(M);const Y=()=>{const n=Number.parseInt(q.value,10),i=Number.parseInt(j.value,10),r=_-P,s=(n-P)/r*100,a=(i-P)/r*100;H.style.left=s+"%",H.style.width=a-s+"%"},k=(n,i)=>{q.value=n.toString(),j.value=i.toString(),Q.value=n.toString(),$.value=i.toString(),Y()};return q.addEventListener("input",()=>{let n=Number.parseInt(q.value,10);const i=Number.parseInt(j.value,10);n>i&&(n=i),k(n,i)}),q.addEventListener("change",()=>{const n=Number.parseInt(q.value,10),i=Number.parseInt(j.value,10);null==x?void 0:x(n.toString(),i.toString())}),j.addEventListener("input",()=>{const n=Number.parseInt(q.value,10);let i=Number.parseInt(j.value,10);i<n&&(i=n),k(n,i)}),j.addEventListener("change",()=>{const n=Number.parseInt(q.value,10),i=Number.parseInt(j.value,10);null==x?void 0:x(n.toString(),i.toString())}),Q.addEventListener("input",()=>{let n=Number.parseInt(Q.value,10)||P;const i=Number.parseInt($.value,10)||_;n=Math.max(P,Math.min(n,_)),n>i&&(n=i),k(n,i),null==x||x(n.toString(),i.toString())}),$.addEventListener("input",()=>{const n=Number.parseInt(Q.value,10)||P;let i=Number.parseInt($.value,10)||_;i=Math.max(P,Math.min(i,_)),i<n&&(i=n),k(n,i),null==x||x(n.toString(),i.toString())}),Y(),R.addEventListener("click",()=>{w()}),T.push(A),{elements:T,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 n=[],i=document.createElement("div");i.className="product-list-search-box";const r=document.createElement("span");return r.className="product-list-search-icon",r.innerHTML=SearchIcon({}),r.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",n=>{const i=n.target,r=i.value,s=this.sanitizeInput(r);s!==r&&(i.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("")}),i.appendChild(r),i.appendChild(this.searchInput),i.appendChild(this.clearButton),n.push(i),n}sanitizeInput(n){if(!n)return"";let i=n.replace(this.ALLOWED_CHARACTERS,"");return i=i.trim(),i=i.replace(/\s+/g," "),i.length>this.MAX_LENGTH&&(i=i.substring(0,this.MAX_LENGTH)),i}updateClearButtonVisibility(n){this.clearButton&&(this.clearButton.style.display=n?"flex":"none")}}function createPersonalizedFilter(n){const{currentFilters:i,isPersonalizationDisabled:r,onPersonalizedChange:s}=n,a=[],l=document.createElement("div");l.className="product-list-filters-personalized";const d=document.createElement("label");d.className="product-list-filters-personalized-label",d.setAttribute("for","personalized-switch"),d.textContent="Personalized Bottles",l.appendChild(d);const u=document.createElement("div");u.classList.add("toggle-switch");const f=!!(null==i?void 0:i.personalized);f&&u.classList.add("active");const g=document.createElement("div");g.classList.add("toggle-slider"),u.id="personalized-switch",u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Toggle Personalized Bottles"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",f?"true":"false"),u.appendChild(g);const h=n=>{u.classList.toggle("active",n),u.setAttribute("aria-checked",n?"true":"false")},o=()=>{const n=u.classList.contains("active"),i=!n;h(i),null==s||s(i)};if(u.addEventListener("click",()=>{r||o()}),u.addEventListener("keydown",n=>{r||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o())}),l.appendChild(u),r){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",l.appendChild(n)}return a.push(l),a}function createPreOrderFilter(n){const{currentFilters:i,isPreOrderDisabled:r,onPreOrderChange:s}=n,a=[],l=document.createElement("div");l.className="product-list-filters-pre-order";const d=document.createElement("label");d.className="product-list-filters-pre-order-label",d.setAttribute("for","pre-order-switch"),d.textContent="Pre-Order",l.appendChild(d);const u=document.createElement("div");u.classList.add("toggle-switch");const f=!!(null==i?void 0:i.preOrder);f&&u.classList.add("active"),r&&u.classList.add("disabled");const g=document.createElement("div");g.classList.add("toggle-slider"),u.id="pre-order-switch",u.setAttribute("tabindex",r?"-1":"0"),u.setAttribute("aria-label","Toggle Pre-Order"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",f?"true":"false"),u.setAttribute("aria-disabled",r?"true":"false"),u.appendChild(g);const h=n=>{u.classList.toggle("active",n),u.setAttribute("aria-checked",n?"true":"false")},o=()=>{const n=u.classList.contains("active"),i=!n;h(i),null==s||s(i)};if(u.addEventListener("click",()=>{r||o()}),u.addEventListener("keydown",n=>{r||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o())}),l.appendChild(u),r){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",l.appendChild(n)}return a.push(l),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 n=["product-list-filters-container"];return this.params.isDrawerMode&&n.push("drawer-mode"),n}isSameDayDeliveryDisabled(){var n,i;return!(!(null===(n=this.params.currentFilters)||void 0===n?void 0:n.personalized)&&!(null===(i=this.params.currentFilters)||void 0===i?void 0:i.preOrder))}isPersonalizationDisabled(){var n;return"onDemand"===(null===(n=this.params.currentFilters)||void 0===n?void 0:n.deliveryOptions)}isPreOrderDisabled(){var n;return"onDemand"===(null===(n=this.params.currentFilters)||void 0===n?void 0:n.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 n=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=n.chevronContainer,this.deliveryOptionsList=n.deliveryOptionsList,n.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 n=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=n.chevronContainer,this.priceSliderContainer=n.sliderContainer,n.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(n){var i;const r=[];if(!this.checkboxFilterStates.has(n.bucket)){const r=null===(i=this.params.currentFilters)||void 0===i?void 0:i[n.bucket],s=Array.isArray(r)?new Set(r):new Set;this.checkboxFilterStates.set(n.bucket,{isExpanded:s.size>0,selectedValues:s,searchInput:null,checkboxList:null,filteredItems:[...n.values],contentElement:null,iconElement:null,hasUserInteraction:s.size>0})}const s=this.checkboxFilterStates.get(n.bucket),a=document.createElement("div");a.className="product-list-checkbox-filter",a.setAttribute("data-filter-bucket",n.bucket);const l=document.createElement("div");l.className="checkbox-filter-container";const d=createCheckboxFilterHeader({filter:n,state:s,onToggle:n=>this.toggleCheckboxFilter(n)});l.appendChild(d);const u=document.createElement("div");u.className="checkbox-filter-content "+(s.isExpanded?"expanded":"collapsed"),s.contentElement=u;const f=createCheckboxFilterSearchContainer({state:s,onSearch:i=>{handleCheckboxFilterSearch({filter:n,state:s,searchTerm:i,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(n,s)})}});return u.appendChild(f),s.checkboxList=document.createElement("div"),s.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(n,s),u.appendChild(s.checkboxList),l.appendChild(u),a.appendChild(l),r.push(a),r}renderCheckboxItemsWrapper(n,i){renderCheckboxItems({filter:n,state:i,onCheckboxChange:(r,s)=>this.handleCheckboxChange(n.bucket,i,r,s)})}handleCheckboxChange(n,i,r,s){s?i.selectedValues.add(r):i.selectedValues.delete(r),i.hasUserInteraction=!![],i.isExpanded||(i.isExpanded=!![],updateFilterExpandState(i)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(n,Array.from(i.selectedValues))}toggleCheckboxFilter(n){const i=this.checkboxFilterStates.get(n);i&&(i.isExpanded=!i.isExpanded,i.hasUserInteraction=!![],updateFilterExpandState(i))}template(){var n;const i=[],r=document.createElement("div");r.className="product-list-filters-header",this.params.isDrawerMode&&r.classList.add("drawer-mode");const s=document.createElement("h3");if(s.className="product-list-filters-title",s.textContent="Filters",r.appendChild(s),this.params.isDrawerMode){const n=document.createElement("button");n.className="product-list-filters-close-btn",n.innerHTML=CloseIcon({}),n.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),r.appendChild(n)}return i.push(r),this.params.enablePersonalized&&i.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&i.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&i.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&i.push(...this.createPriceFilterWrapper()),null===(n=this.params.sanitizedFilters)||void 0===n||n.forEach(n=>{i.push(...this.createCheckboxFilter(n))}),this.params.isDrawerMode&&i.push(createApplyFiltersButton(()=>{var n,i;null===(i=(n=this.params).onApplyFilters)||void 0===i?void 0:i.call(n),this.commands.ui.closeDrawer()})),i}}const FilterIcon=({width:n=16,height:i=16,className:r="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 24 24" class="filter-icon '+r+'" 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 Lt;(function(n){n.IDLE="idle",n.LOADING_INITIAL="loading_initial",n.LOADING_MORE="loading_more",n.ERROR="error"})(Lt||(Lt={}));class ProductListComponent extends BaseComponent{get hostClasses(){const n=["product-list"];return this.params.filters.length>0&&n.push("has-filters"),n}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.sanitizedFilters=[],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=Lt.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(Lt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Lt.IDLE)}catch(ut){this.logger.error("Error initializing product list:",ut),this.setLoadingState(Lt.ERROR),this.showErrorState("Failed to load products")}}template(){const n=[],i=document.createElement("div");i.className="product-list-search__control-container",i.appendChild(this.createSearchContainer()),n.push(i),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),n.push(this.filterButton));const r=document.createElement("div");return r.className="product-list-controls",this.params.filters.length>0&&r.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),r.appendChild(this.cardsContainer),n.push(r),this.renderCurrentState(),n}setLoadingState(n){this.loadingState=n,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Lt.LOADING_INITIAL:this.renderLoadingState();break;case Lt.ERROR:break;case Lt.IDLE:case Lt.LOADING_MORE:this.updateSentinel()}}sanitizeFilterValues(n){return n.map(n=>({...n,formattedValue:n.value}))}processResponseFilters(n){var i;return(null===(i=null==n?void 0:n.navigation)||void 0===i?void 0:i.filters)?n.navigation.filters.filter(n=>n.bucket!==f.AVAILABILITY).filter(n=>n.bucket!==f.PRICE).filter(n=>n.bucket!==f.ENGRAVING).filter(n=>n.bucket!==f.PRESALE).filter(n=>n.bucket!==f.TAGS).map(n=>{var i,r;if(n.bucket===f.CATEGORIES){const s=new Set;return{...n,values:null!==(r=null===(i=n.values)||void 0===i?void 0:i.map(n=>{const i=n.value.split(">").map(n=>n.trim()),r=i.pop()||"";let a=r;return s.has(r)&&(a=i.slice(-1).concat(r).join(" > ")),s.add(a),{...n,formattedValue:a}}).slice(1))&&void 0!==r?r:[]}}return{...n,values:this.sanitizeFilterValues(n.values)}}).filter(n=>{var i;return(null===(i=n.values)||void 0===i?void 0:i.length)>0}):[]}async loadInitialProducts(){var n;try{const i=this.buildApiParams(0),r=await this.commands.productList.getProductList(i);this.sanitizedFilters=this.processResponseFilters(r),this.products=r.products||[],this.retailers=r.retailers||[],this.updatePagination(r.navigation),this.syncFiltersFromResponse((null===(n=r.navigation)||void 0===n?void 0:n.filters)||[]),this.updateFiltersComponent()}catch(i){throw this.products=[],this.retailers=[],this.pagination.hasMorePages=![],i}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const n=this.filtersContainer.parentElement;if(!n)return;const i=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),n.replaceChild(this.filtersContainer,i)}async loadMoreProducts(){if(this.loadingState!==Lt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Lt.LOADING_MORE);const n=this.pagination.currentPage+1,i=this.buildApiParams(n),r=await this.commands.productList.getProductList(i);this.sanitizedFilters=this.processResponseFilters(r),r.products&&r.products.length>0?(this.products.push(...r.products),this.mergeRetailers(r.retailers||[]),this.updatePagination(r.navigation),this.appendNewProducts(r.products)):(this.pagination.hasMorePages=![],this.updatePagination(r.navigation)),this.setLoadingState(Lt.IDLE)}catch(n){this.logger.error("Error loading more products:",n),this.setLoadingState(Lt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(n){const i=new Map(this.retailers.map(n=>[n.id,n]));for(const r of n)i.has(r.id)||(this.retailers.push(r),i.set(r.id,r))}updatePagination(n){var i,r,s,a;n&&(this.pagination={currentPage:null!==(i=n.currentPage)&&void 0!==i?i:0,totalPages:null!==(r=n.totalPages)&&void 0!==r?r:0,hasMorePages:(null!==(s=n.currentPage)&&void 0!==s?s:0)<(null!==(a=n.totalPages)&&void 0!==a?a:1)-1})}buildApiParams(n){const i={page:n,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(i.search=this.searchFilter.searchTerm.trim()),i}buildFiltersFromState(){const n=[{key:"availability",values:"IN_STOCK"}];if(this.currentFilters.personalized&&n.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&n.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&n.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),this.currentFilters.price){const i={};"0"!==this.currentFilters.price.min&&(i.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(i.max=this.currentFilters.price.max),Object.keys(i).length>0&&n.push({key:"price",values:i})}const i=Object.keys(this.currentFilters).filter(n=>!["personalized","preOrder","deliveryOptions","price"].includes(n));for(const r of i){const i=this.currentFilters[r];Array.isArray(i)&&i.length>0&&n.push({key:r,values:i})}return n}syncFiltersFromResponse(n){if(n)for(const i of n)switch(i.key){case"engraving":this.currentFilters.personalized="YES"===i.values;break;case"presale":this.currentFilters.preOrder="YES"===i.values;break;case"fulfillment":Array.isArray(i.values)&&(i.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":i.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(Lt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(Lt.IDLE)}catch(ut){this.logger.error("Error handling filter change:",ut),this.setLoadingState(Lt.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(n=>{const i="onDemand"===n.value&&this.isSameDayDeliveryDisabled();n.disabled=i,i&&"onDemand"===n.value||(n.checked=n.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(n,i)})}updateRadioLabel(n,i){const r=this.deliveryRadioLabels.get(n.id);r&&(r.className="product-list-filters-delivery-radio-label "+(i?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const n=document.createElement("div");n.className="product-list-cards__container";const i=100/this.params.columns;return n.style.setProperty("--card-width",i+"%"),n.style.setProperty("--columns",""+this.params.columns),n}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const n=ComponentFactoryService.createElement({type:C.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(n)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const n=this.createInfoElement("No products found");return this.cardsContainer.appendChild(n),void 0}for(const n of this.products){const i=this.createProductCard(n);i&&this.cardsContainer.appendChild(i)}}}appendNewProducts(n){if(this.cardsContainer&&0!==n.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const i of n){const n=this.createProductCard(i);n&&this.cardsContainer.appendChild(n)}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(n){var i;try{const r=null===(i=n.sizes)||void 0===i?void 0:i[0];if(!r)return this.logger.warn("Product "+n.id+" has no sizes"),null;const s=new Map(this.retailers.flatMap(n=>n.fulfillments.map(n=>[n.id,n]))),a=new Set(r.variants.flatMap(n=>n.fulfillments)),l=Array.from(a).map(n=>s.get(n)).filter(n=>Boolean(n));return ComponentFactoryService.createElement({type:C.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:n,fulfillments:l,productUrl:this.params.productUrl})}catch(r){return this.logger.error("Error creating product card for product "+n.id+":",r),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const n={[f.BRANDS]:_.BRANDS,[f.CATEGORIES]:_.CATEGORIES,[f.FLAVOR]:_.FLAVOR,[f.REGION]:_.REGION,[f.VARIETY]:_.VARIETY,[f.VINTAGE]:_.VINTAGE,[f.COUNTRY]:_.COUNTRY,[f.APPELLATION]:_.APPELLATION,[f.MATERIALS]:_.MATERIALS,[f.SIZES]:_.SIZES};return this.sanitizedFilters.filter(i=>{const r=n[i.bucket];return r&&this.params.filters.includes(r)})}buildFiltersParams(n=![]){const I=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(_.PERSONALIZATION),enablePreOrder:this.params.filters.includes(_.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(_.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(_.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async i=>{this.currentFilters.personalized=i,n||await this.onFilterChange()},onPreOrderChange:async i=>{this.currentFilters.preOrder=i,n||await this.onFilterChange()},onDeliveryOptionsChange:async i=>{this.currentFilters.deliveryOptions=i,"onDemand"===i&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),n||await this.onFilterChange()},onPriceChange:async(i,r)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==i?this.currentFilters.price.min=i:delete this.currentFilters.price.min,"1000"!==r?this.currentFilters.price.max=r:delete this.currentFilters.price.max,n||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(i,r)=>{r.length>0?this.currentFilters[i]=r:delete this.currentFilters[i],n||await this.onFilterChange()},isDrawerMode:n,onApplyFilters:async()=>{await I()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:C.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async n=>{this.searchFilter.searchTerm=n,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(n={}){const{isDrawerMode:i=![]}=n;return this.filtersContainer=ComponentFactoryService.createElement({type:C.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(i)}),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 n=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(n),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(n=>{var i;const r=null===(i=this.filtersContainer)||void 0===i?void 0:i.querySelector('label[for="'+n.id+'"]');r&&this.deliveryRadioLabels.set(n.id,r)})}openFiltersDrawer(){this.commands.ui.openDrawer(C.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const n=document.createElement("div");n.className="product-list-filter-container";const i=document.createElement("div");i.className="product-list-filter-icon",i.innerHTML=FilterIcon({}),i.addEventListener("click",()=>{this.openFiltersDrawer()});const r=document.createElement("span");return r.className="product-list-filter-text",r.textContent="Filter",n.appendChild(i),n.appendChild(r),n}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(n=>{const i=n[0];i.isIntersecting&&this.loadingState===Lt.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const n=document.createElement("div");return n.className="product-list-scroll-sentinel",this.updateSentinelContent(n),n}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(n){let i;n.innerHTML="",i=this.loadingState===Lt.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),n.appendChild(i)}showSentinelError(n){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const i=this.createErrorElement(n);this.sentinelElement.appendChild(i)}createLoadingElement(n){const i=document.createElement("div");i.className="product-list-sentinel-container";const r=document.createElement("div");r.className="product-list-sentinel-spinner";const s=document.createElement("div");return s.className="product-list-sentinel-text",s.textContent=n,i.appendChild(r),i.appendChild(s),i}createErrorElement(n){const i=document.createElement("div");i.className="product-list-sentinel-error-container";const r=document.createElement("div");r.className="product-list-sentinel-error-icon",r.innerHTML="⚠";const s=document.createElement("div");return s.className="product-list-sentinel-error-text",s.textContent=n,i.appendChild(r),i.appendChild(s),i}createInfoElement(n,i=![]){const r=document.createElement("div");if(r.className="product-list-sentinel-info-container",!i&&n.includes("Scroll")){const n=document.createElement("div");n.className="product-list-sentinel-icon",n.innerHTML="↓",r.appendChild(n)}else if(i){const n=document.createElement("div");n.className="product-list-sentinel-divider",r.appendChild(n)}const s=document.createElement("div");return s.className=i?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",s.textContent=n,r.appendChild(s),r}showErrorState(n){if(!this.cardsContainer)return;this.clearCardsContainer();const i=this.createErrorElement(n);this.cardsContainer.appendChild(i)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(n){const i=n.find(n=>"address"===n.path);if(i&&void 0!==i.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(r){this.logger.error("Error reloading products after address change:",r),this.setLoadingState(Lt.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(n){n.length>0&&this.updateAlert()}getErrorMessages(){var n,i;const r=null!==(n=this.params.fromEvents)&&void 0!==n?n:![],s=null!==(i=this.params.showFirstEvent)&&void 0!==i?i:!![];if(r){const n=this.store.get(this.params.errorStorePath)||[],i=n.filter(n=>null==n?void 0:n.message).map(n=>({message:n.message,level:n.level||"error",type:n.type}));return s?i.slice(0,1):i}const a=this.store.get(this.params.errorStorePath);return a?[{message:a,level:"error"}]:[]}createErrorElement(n){const i=document.createElement("div");i.classList.add("alert-container","alert-"+n.level);const r=document.createElement("span");r.classList.add("alert-icon"),r.innerHTML=ErrorInfoIcon({className:n.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=n.message,i.appendChild(r),i.appendChild(s),i}scheduleHide(){var n;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i=null!==(n=this.params.autoHideDelay)&&void 0!==n?n:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},i)}hideAllErrors(){var n;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[];const i=null!==(n=this.params.fromEvents)&&void 0!==n?n:![];i?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const n=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[],0===n.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=n.map(n=>this.createErrorElement(n)),this.elements.forEach(n=>{this.container.appendChild(n)}),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 n=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(C.CART)});const i=document.createElement("span");if(i.className="lce-cart-button-icon",i.innerHTML=BagIcon({color:n.theme.primaryColor}),this.params.showItemsCount){const n=document.createElement("span");return n.className="lce-cart-button-badge",n.style.visibility="hidden",[i,n]}return[i]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const n=this.container.querySelector(".lce-cart-button-badge");if(!n)return;const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(n){var i;const r=n.find(n=>"ui.drawer"===n.path);if(!r)return![];const s=r.value,a=s.isOpen,l=null===(i=s.contentConfig)||void 0===i?void 0:i.type,d=l!==this.currentContentType;return a&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):a&&this.isOpen&&!d?![]:a&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!a&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:n}){try{if(!n)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:i,data:r}=n||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...r}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,i):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(i),this.open()),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Drawer content loading failed",i),this.commands.ui.closeDrawer()}}animateContentSwap(n,i){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const r=this.contentContainer.firstElementChild;r.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{r.classList.add("fading")}),setTimeout(()=>{r.remove(),n.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(n),this.updateDrawerContentTypeClass(i),requestAnimationFrame(()=>{n.classList.add("visible"),setTimeout(()=>{n.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(n){this.isOpen&&"Escape"===n.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(n){if(!this.drawerElement)return;const i=["drawer"];this.isOpen&&i.push("open"),i.push(n.toString().toLowerCase()),this.drawerElement.className=i.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var n;if(this.engravingLines=this.params.lines,"product"===this.params.context){const i=this.store.get("products."+this.params.identifier);this.fulfillmentId=i.selectedFulfillmentId,this.partNumber=(null===(n=i.selectedFulfillment)||void 0===n?void 0:n.partNumber)||null}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=n.fulfillmentId,this.partNumber=n.partNumber}}calculateTotalPrice(){var n,i;if("product"===this.params.context){const r=this.store.get("products."+this.params.identifier),s=r.sizes[r.selectedSizeId],a=s.shippingFulfillments[this.fulfillmentId],l=a.price,d=(null===(i=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0;return l+d}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier),i=n.unitPrice,r=n.attributes.engraving.fee||0;return i+r}return 0}productInformationSection(){const n=[];let i="",r="";if("product"===this.params.context){const s=this.store.get("products."+this.params.identifier);s.mainImage?n.push(s.mainImage):n.push(...s.images||[]),i=s.name,r=s.sizes[s.selectedSizeId].size}if("cart"===this.params.context){const s=this.store.get("cart.items."+this.params.identifier);s.mainImage&&n.push(s.mainImage),i=s.name,r=s.size}const s=document.createElement("div");if(s.className="product-info-section",n.length>0){const r=document.createElement("div");r.className="product-image-container";const a=document.createElement("img");a.src=n[0],a.alt=i,a.loading="lazy",a.className="product-image",r.appendChild(a),s.appendChild(r)}const a=document.createElement("div");a.className="product-details-container";const l=document.createElement("div");l.className="product-header";const d=document.createElement("h4");d.className="product-title",d.textContent=i,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),l.appendChild(d),l.appendChild(this.productPriceSpan),a.appendChild(l);const u=document.createElement("p");u.className="product-size-text",u.textContent=r,a.appendChild(u);const f=document.createElement("p");return f.className="engraving-fees-disclaimer",f.textContent="Personalization fees included in total, varies by retailer.",a.appendChild(f),s.appendChild(a),s}addToCartButtonText(n){if("product"!==this.params.context)return"Save";const i=this.getConfigs("product"),r=i.layout.addToCartButtonText;return i.layout.addToCartButtonShowTotalPrice?r+" - "+formatCentToDollarText(n):r}retailersSection(){var n,i,r,s,a,l,d;const u=this.store.get("products."+this.params.identifier),f=u.sizes[u.selectedSizeId],g=Object.values(f.shippingFulfillments).filter(n=>n.isVariantEngravable&&n.canEngrave),v=document.createElement("div");v.className="fulfillment-section";const b=document.createElement("p");if(b.className="shipping-from-text",b.innerHTML="Shipping from: <b>"+(null===(n=u.selectedFulfillment)||void 0===n?void 0:n.retailerName)+"</b>",v.appendChild(b),1===g.length)return v;const x=document.createElement("div");x.className="fulfillment-options-container",v.appendChild(x);const w=document.createElement("span");w.className="see-more-fulfillments",w.textContent="See More Delivery Options ("+g.length+")",w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.setAttribute("aria-label","See More Delivery Options ("+g.length+")"),w.setAttribute("aria-expanded","false");const S=()=>{const n=x.classList.contains("expanded");x.classList.toggle("expanded"),n?(w.textContent="See More Delivery Options ("+g.length+")",w.setAttribute("aria-label","See More Delivery Options ("+g.length+")"),w.setAttribute("aria-expanded","false")):(w.textContent="See Less Delivery Options",w.setAttribute("aria-label","See Less Delivery Options"),w.setAttribute("aria-expanded","true"))};w.addEventListener("click",S),w.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),S())}),v.appendChild(w);for(const C of g){const n=document.createElement("div");n.className="fulfillment-option",n.setAttribute("data-fulfillment-id",C.fulfillmentId),C.fulfillmentId===(null===(i=u.selectedFulfillment)||void 0===i?void 0:i.fulfillmentId)&&n.classList.add("selected"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select delivery from "+C.retailerName+", "+formatCentToDollarText(C.price+((null===(s=null===(r=u.sizes[u.selectedSizeId].attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.fee)||0))+", "+C.expectation.engraving),n.setAttribute("aria-pressed",C.fulfillmentId===(null===(a=u.selectedFulfillment)||void 0===a?void 0:a.fulfillmentId)?"true":"false");const z=()=>{this.fulfillmentId=C.fulfillmentId,this.partNumber=C.partNumber;const i=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const r=x.querySelector(".fulfillment-option.selected");r&&(r.classList.remove("selected"),r.setAttribute("aria-pressed","false")),n.classList.add("selected"),n.setAttribute("aria-pressed","true"),b.innerHTML="Shipping from: <b>"+C.retailerName+"</b>"};n.addEventListener("click",z),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),z())});const f=C.price+((null===(d=null===(l=u.sizes[u.selectedSizeId].attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0),g=document.createElement("div");g.className="option-row row-1",n.appendChild(g);const v=document.createElement("span");v.className="retailer-name",v.textContent=C.retailerName,g.appendChild(v);const w=document.createElement("span");w.className="fulfillment-price",w.textContent=formatCentToDollarText(f),g.appendChild(w),n.appendChild(g);const E=document.createElement("div");E.className="option-row row-2",n.appendChild(E);const T=document.createElement("span");T.className="estimated-time",T.textContent=""+C.expectation.engraving,E.appendChild(T),n.appendChild(E),x.appendChild(n)}return v}engravingLinesSection(){var n;const{lines:i,maxLines:r,location:s,maxCharsPerLine:a}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent="Personalize Your Bottle",l.appendChild(d),s&&(null===(n=null==s?void 0:s.trim())||void 0===n?void 0:n.length)>0){const n=document.createElement("p");n.className="engraving-location-text",n.textContent="Your message will appear "+s.toLowerCase()+".",l.appendChild(n)}const u=Array.from({length:r},(n,r)=>{const s=r+1,l=document.createElement("div");l.className="engraving-input-wrapper",l.setAttribute("data-line-number",s.toString());const d=document.createElement("input");d.type="text",d.id="engraving-line-"+s,d.dataset.lineNumber=s.toString(),d.maxLength=a,d.value=i[r]||"",d.placeholder=s>1?"Line "+s+" (optional)":"Line "+s,d.className="engraving-input",d.autocomplete="off",d.setAttribute("aria-label",s>1?"Engraving line "+s+", optional, maximum "+a+" characters":"Engraving line "+s+", maximum "+a+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=d.value.length+"/"+a,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),d.addEventListener("input",()=>{u.textContent=d.value.length+"/"+a,this.engravingLines[r]=d.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),l.appendChild(d),l.appendChild(u),l}),f=document.createElement("div");return f.className="engraving-inputs-container",f.append(...u),l.appendChild(f),l}actionButtonsSection(){const{identifier:n,context:i}=this.params,r=document.createElement("div");r.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 y=async()=>{"product"===i&&await this.commands.product.closeProductDrawer(n),"cart"===i&&this.commands.ui.openDrawer(C.CART)};s.addEventListener("click",y),s.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),y())}),r.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"===i?"Add personalized item to cart":"Update personalization and return to cart");const p=async()=>{const r=this.engravingLines.map(n=>n.trim().toUpperCase()).filter(n=>n&&n.length>0);if("product"===i&&this.fulfillmentId&&this.partNumber){const i=this.store.get("products."+n);await this.commands.product.addToCart(n,{upc:i.sizes[i.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:r,identifier:n}),await this.commands.product.closeProductDrawer(n)}"cart"===i&&(await this.commands.cart.updateItemEngraving(n,r),this.commands.ui.openDrawer(C.CART))};return this.addToCartButton.addEventListener("click",p),this.addToCartButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),p())}),r.appendChild(this.addToCartButton),r}template(){const n=[],i=this.productInformationSection();if(n.push(i),"product"===this.params.context){const i=this.retailersSection();n.push(i)}const r=this.engravingLinesSection();n.push(r);const s=this.actionButtonsSection();n.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>",n.push(a),n}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const n=this.getConfigs("global");return["engraving-view-container",n.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n),r=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:r,total:r*s}}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n),r=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:r,total:r*s}}return{quantity:0,fee:0,total:0}}engravingLines(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}return[]}handleEdit(){var n,i,r,s,a,l,d,u,f,g,v,b,x,w,E,T,A,P,_,N;const F=this.params.identifier,R={identifier:F,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const v=this.getStoreValue("cart.items."+F);R.lines=(null===(i=null===(n=null==v?void 0:v.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],R.maxLines=(null===(s=null===(r=null==v?void 0:v.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxLines)||1,R.maxCharsPerLine=(null===(l=null===(a=null==v?void 0:v.attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,R.fee=(null===(u=null===(d=null==v?void 0:v.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,R.location=(null===(g=null===(f=null==v?void 0:v.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.location)||""}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+F);R.lines=(null===(b=null===(v=null==n?void 0:n.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.lines)||[],R.maxLines=(null===(w=null===(x=null==n?void 0:n.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.maxLines)||1,R.maxCharsPerLine=(null===(T=null===(E=null==n?void 0:n.attributes)||void 0===E?void 0:E.engraving)||void 0===T?void 0:T.maxCharsPerLine)||16,R.fee=(null===(P=null===(A=null==n?void 0:n.attributes)||void 0===A?void 0:A.engraving)||void 0===P?void 0:P.fee)||0,R.location=(null===(N=null===(_=null==n?void 0:n.attributes)||void 0===_?void 0:_.engraving)||void 0===N?void 0:N.location)||""}this.commands.ui.openDrawer(C.ENGRAVING_FORM,R)}async handleRemove(){const n=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(n,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(n)}template(){const n=this.engravingQuantityFee(),i=this.engravingLines();if(0===i.length)return"";const r=document.createElement("div");r.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const a=document.createElement("span");if(a.className="engraving-fee",1===n.quantity&&(a.textContent=formatCentToDollarText(n.total,![])),n.quantity>1){a.textContent=formatCentToDollarText(n.total,![]);const i=document.createElement("span");i.className="engraving-fee-each",i.textContent=" ("+formatCentToDollarText(n.fee,![])+" ea)",a.appendChild(i)}r.appendChild(s),r.appendChild(a);const l=document.createElement("div");l.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const g of i){const n=document.createElement("span");n.className="engraving-line",n.textContent=g,d.appendChild(n)}const u=document.createElement("div");u.className="engraving-actions";const f=document.createElement("button");f.type="button",f.classList.add("remove-button"),f.textContent="Remove",f.setAttribute("aria-label","Remove engraving");const h=async()=>{await this.handleRemove()};if(f.addEventListener("click",h),f.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await h())}),u.appendChild(f),"checkout"!==this.params.context){const n=document.createElement("button");n.type="button",n.classList.add("edit-button"),n.textContent="Edit",n.setAttribute("aria-label","Edit engraving"),n.addEventListener("click",this.handleEdit.bind(this)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleEdit())}),u.appendChild(n)}return l.appendChild(d),l.appendChild(u),[r,l]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const n=this.getConfigs("global");return["custom-input","birthdate",n.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 n=this.params.value.split("-");3===n.length&&(this.yearInput.value=n[0],this.monthInput.value=n[1],this.dayInput.value=n[2])}}setupEventListeners(){this.monthInput.addEventListener("input",n=>{this.formatMonth(n),this.handleNavigation(n,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",n=>{this.formatDay(n),this.handleNavigation(n,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",n=>{this.formatYear(n),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 n=[this.monthInput,this.dayInput,this.yearInput];for(const i of n)i.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",n=>{"Backspace"===n.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",n=>{"Backspace"===n.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(n){const i=n.target;let r=i.value.replace(/\D/g,"");if(r.length>2&&(r=r.substring(0,2)),1===r.length){const n=Number.parseInt(r,10);n>=2&&n<=9&&(r="0"+r)}else if(2===r.length){const n=Number.parseInt(r,10);n>12?r="12":n<1&&"00"!==r&&(r="01")}i.value=r}formatDay(n){const i=n.target;let r=i.value.replace(/\D/g,"");if(r.length>2&&(r=r.substring(0,2)),1===r.length){const n=Number.parseInt(r,10);n>=4&&n<=9&&(r="0"+r)}else if(2===r.length){const n=Number.parseInt(r,10);n>31?r="31":n<1&&"00"!==r&&(r="01")}i.value=r}formatYear(n){const i=n.target;let r=i.value.replace(/\D/g,"");r.length>4&&(r=r.substring(0,4)),i.value=r}padMonthOnBlur(){const n=this.monthInput.value;if(1===n.length){const i=Number.parseInt(n,10);if(i>=0&&i<=9&&(this.monthInput.value="0"+n,this.params.onChange)){const n=this.getFormattedValue();this.params.onChange(n)}}}padDayOnBlur(){const n=this.dayInput.value;if(1===n.length){const i=Number.parseInt(n,10);if(i>=0&&i<=9&&(this.dayInput.value="0"+n,this.params.onChange)){const n=this.getFormattedValue();this.params.onChange(n)}}}handleNavigation(n,i){const r=n.target,s=r===this.yearInput?4:2;r.value.length===s&&i&&i.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const n=this.getFormattedValue();this.params.onChange(n)}}isFieldsComplete(){const n=this.monthInput.value,i=this.dayInput.value,r=this.yearInput.value;return 2===n.length&&2===i.length&&4===r.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 n=this.monthInput.value.padStart(2,"0"),i=this.dayInput.value.padStart(2,"0"),r=this.yearInput.value;return n&&i&&r&&4===r.length?r+"-"+n+"-"+i:""}validateDate(n,i,r){if(!n||!i||!r||4!==r.length)return![];const s=Number.parseInt(n,10),a=Number.parseInt(i,10),l=Number.parseInt(r,10);if(s<1||s>12||a<1||a>31||l<1e3)return![];const d=new Date(l,s-1,a);return d.getFullYear()===l&&d.getMonth()===s-1&&d.getDate()===a}calculateAge(n){const i=new Date;let r=i.getFullYear()-n.getFullYear();const s=i.getMonth()-n.getMonth();return(s<0||0===s&&i.getDate()<n.getDate())&&r--,r}validateInput(){const n=this.monthInput.value,i=this.dayInput.value,r=this.yearInput.value,s=[],a=this.params.validation;if(!a)return this.showErrors([]),!![];const l=2===n.length&&2===i.length&&4===r.length,d=n||i||r;if(a.required&&!d)s.push("Please enter a complete date (MM/DD/YYYY)");else if(d&&!l)s.push("Please enter a complete date (MM/DD/YYYY)");else if(l)if(this.validateDate(n,i,r)){const l=Number.parseInt(n,10),d=Number.parseInt(i,10),u=Number.parseInt(r,10),f=new Date(u,l-1,d);if(void 0!==a.minYear&&u<a.minYear&&s.push("Year must be "+a.minYear+" or later"),void 0!==a.maxYear&&u>a.maxYear&&s.push("Year must be "+a.maxYear+" or earlier"),void 0!==a.minAge||void 0!==a.maxAge){const n=this.calculateAge(f);void 0!==a.minAge&&n<a.minAge&&s.push("Must be at least "+a.minAge+" years old"),void 0!==a.maxAge&&n>a.maxAge&&s.push("Must be no more than "+a.maxAge+" years old")}if(a.customValidator){const n=a.customValidator(this.getFormattedValue());n&&s.push(n)}}else s.push("Please enter a valid date");this.showErrors(s);const u=0===s.length;return this.params.onValidation&&this.params.onValidation(u,s),u}showErrors(n){this.errorContainer.innerHTML="";const i=[this.monthInput,this.dayInput,this.yearInput];if(n.length>0){this.errorContainer.classList.add("show");for(const n of i)n.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}else for(const r of i)r.classList.remove("input-error")}clearErrors(){const n=[this.monthInput,this.dayInput,this.yearInput],i=n.some(n=>n.classList.contains("input-error"));if(i){for(const i of n)i.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(n){if(n){const i=n.split("/");3===i.length&&(this.monthInput.value=i[0],this.dayInput.value=i[1],this.yearInput.value=i[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var n;const i=[];if(this.params.label){const r=document.createElement("label");r.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(r.textContent+="*"),r.setAttribute("for",this.params.name+"-month"),i.push(r)}const r=document.createElement("div");r.className="date-input-container";const s=document.createElement("input");s.type="text",s.placeholder="MM",s.name=this.params.name+"-month",s.id=this.params.name+"-month",s.maxLength=2,s.className="date-field month-field",s.setAttribute("data-field","month"),s.inputMode="numeric";const a=document.createElement("span");a.className="date-separator",a.textContent="/";const l=document.createElement("input");l.type="text",l.placeholder="DD",l.name=this.params.name+"-day",l.id=this.params.name+"-day",l.maxLength=2,l.className="date-field day-field",l.setAttribute("data-field","day"),l.inputMode="numeric";const d=document.createElement("span");d.className="date-separator",d.textContent="/";const u=document.createElement("input");u.type="text",u.placeholder="YYYY",u.name=this.params.name+"-year",u.id=this.params.name+"-year",u.maxLength=4,u.className="date-field year-field",u.setAttribute("data-field","year"),u.inputMode="numeric",this.params.disabled&&(s.disabled=!![],l.disabled=!![],u.disabled=!![]),this.params.className&&(r.className+=" "+this.params.className),r.appendChild(s),r.appendChild(a),r.appendChild(l),r.appendChild(d),r.appendChild(u);const f=document.createElement("div");return f.className="error-container",i.push(r),i.push(f),i}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const n=this.getConfigs("global");return["custom-input",n.layout.inputFieldStyle]}handlePhoneKeydown(n){if("Backspace"===n.key){const i=n.target,r=i.selectionStart||0,s=i.value;r>0&&/\D/.test(s[r-1])&&setTimeout(()=>{const n=Math.max(0,r-2);i.setSelectionRange(n,n)},0)}}formatPhoneNumber(n){const i=n.target;let r=i.value.replace(/\D/g,"");r.length>10&&(r=r.substring(0,10)),r.length>=6?r="("+r.substring(0,3)+") "+r.substring(3,6)+"-"+r.substring(6):r.length>=3&&(r="("+r.substring(0,3)+") "+r.substring(3)),i.value=r}formatDate(n){const i=n.target;let r=i.value.replace(/\D/g,"");r.length>8&&(r=r.substring(0,8)),r.length>=5?r=r.substring(0,2)+"/"+r.substring(2,4)+"/"+r.substring(4):r.length>=3&&(r=r.substring(0,2)+"/"+r.substring(2)),i.value=r}validateEmail(n){const i=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return i.test(n)}validateTel(n){const i=/^\(\d{3}\) \d{3}-\d{4}$/;return i.test(n)}validateDate(n){const i=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!i.test(n))return![];const[r,s,a]=n.split("/").map(Number),l=new Date(a,r-1,s);return l.getFullYear()===a&&l.getMonth()===r-1&&l.getDate()===s}isFieldComplete(){var n,i,r;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===(n=s.split("@")[1])||void 0===n?void 0:n.includes("."));case"number":return!Number.isNaN(Number.parseFloat(s));default:return(null===(i=this.params.validation)||void 0===i?void 0:i.max)&&s.length>=this.params.validation.max||(null===(r=this.params.validation)||void 0===r?void 0:r.min)&&s.length>=this.params.validation.min?!![]:s.length>=3}}validateInput(){const n=this.inputElement.value,i=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];if(r.required&&!n.trim()&&i.push("This field is required"),!r.required&&!n.trim())return this.showErrors([]),!![];if(n.trim()){if("email"!==this.params.inputType||this.validateEmail(n)||i.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(n)||i.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(n)||i.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const s=Number.parseFloat(n);Number.isNaN(s)?n.trim()&&i.push("Please enter a valid number"):(void 0!==r.min&&s<r.min&&i.push("Value must be at least "+r.min),void 0!==r.max&&s>r.max&&i.push("Value must be no more than "+r.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==r.min&&n.length<r.min&&i.push("Must be at least "+r.min+" characters"),void 0!==r.max&&n.length>r.max&&i.push("Must be no more than "+r.max+" characters")),r.pattern){const s=new RegExp(r.pattern);s.test(n)||i.push("Invalid format")}if(r.customValidator){const s=r.customValidator(n);s&&i.push(s)}}this.showErrors(i);const s=0===i.length;return this.params.onValidation&&this.params.onValidation(s,i),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(n){if(this.errorContainer.innerHTML="",n.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}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(n){this.inputElement.value=n,"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 n;const i=[];if(this.params.label){const r=document.createElement("label");r.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(r.textContent+="*"),r.setAttribute("for",this.params.name),i.push(r)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(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",n=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(n.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",i.push(this.inputElement),i.push(this.errorContainer),i}}class LceElementComponent extends HTMLElement{constructor(){super(),this.N=![],this.q=null;const n=ClientConfigService.getInstance();this.j=this.attachShadow({mode:n.get("openShadowDom")?"open":"closed"})}initialize(n,i){if(this.N)return;if(!n||"string"!=typeof n)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(i&&i instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(n.toLowerCase(),""),!this.j)throw new SDKError("LceElementComponent: Shadow DOM container is not available");i&&"function"==typeof i.rerender&&(this.q=n=>{i.rerender(n||"LceElementRerender")}),this.j.appendChild(i),this.applyBasicStyles();const r=ThemeProviderService.getInstance(),s=r.getStylesheet(n);this.applyThemeStyles(s),this.N=!![],this.j=null}rerender(n){this.q&&this.q(n)}applyBasicStyles(){const n="\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 i=new CSSStyleSheet;i.replaceSync(n),this.j.adoptedStyleSheets=[i,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(n)}catch(ut){this.createFallbackStylesheet(n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}applyThemeStyles(n){n.forEach(n=>{"string"==typeof n?this.createFallbackStylesheet(n):this.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,n]})}createFallbackStylesheet(n){const i=document.createElement("style");i.textContent=n,this.j&&this.j.appendChild(i)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const n=document.createElement("div");n.className="pb-title-container";const i=document.createElement("span");i.className="pb-text",i.textContent="Powered by",n.appendChild(i);const r=document.createElement("span");r.className="pb-lc",r.textContent="LiquidCommerce",n.appendChild(r);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",n.appendChild(s),n}createDisclaimerSection(){const n=document.createElement("div");n.className="pb-disclaimer-container";const i=this.getDisclaimerConfig();return i.parts.forEach(i=>{"text"===i.type?n.appendChild(document.createTextNode(i.content)):"link"===i.type&&n.appendChild(this.createLink(i.href,i.text))}),n}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(n,i){const r=document.createElement("a");return r.href=n,r.target="_blank",r.rel="noopener noreferrer",r.className="pb-link",r.textContent=i,r.setAttribute("role","link"),r.setAttribute("aria-label","Read "+i),r}template(){const n=this.createPoweredBySection(),i=this.createDisclaimerSection();return[n,i]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(n){const i=n.find(n=>"cart.promoCode"===n.path||"checkout.promoCode"===n.path);if(!i||!this.applyButton||!this.currentActiveTicker)return;const r=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);r&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!r&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(n){const i=this.store.get("cart.promoCode"),r=this.store.get("checkout.promoCode");return(null==i?void 0:i.code)===n||(null==r?void 0:r.code)===n}getActiveTickers(){var n;const i=this.store.get("address");return null===(n=this.params.tickers)||void 0===n?void 0:n.filter(n=>{var r;return isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:null===(r=null==i?void 0:i.address)||void 0===r?void 0:r.state})})}selectCurrentTicker(n){return 0===n.length?null:n[0]}generateTextContent(n){const i=document.createElement("div");i.classList.add("promo-ticker__text-group");const r=n.text.map(n=>n.trim()).map(n=>n.substring(0,50)).filter(n=>""!==n.trim()).slice(0,5);for(const s of r){const r=s.trim();if(!r)continue;const a=document.createElement("span");a.classList.add("promo-ticker__text-item"),a.textContent=r,i.appendChild(a);const l=document.createElement("span");l.classList.add("promo-ticker__separator"),l.textContent=n.separator,i.appendChild(l)}return i}async handlePromoClick(){var n;(null===(n=this.currentActiveTicker)||void 0===n?void 0:n.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 n=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(n),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const i=document.createElement("div");i.classList.add("promo-ticker__content");const r=document.createElement("div");r.classList.add("promo-ticker__track");for(let a=0;a<5;a++)r.appendChild(this.generateTextContent(this.currentActiveTicker));i.appendChild(r);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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handlePromoClick())}),this.applyButton=s,[i,s]}}const zt=LoggerFactory.get("ElementsClientHelper"),isObject=n=>null!==n&&"object"==typeof n&&!Array.isArray(n),getType=n=>null===n?"null":Array.isArray(n)?"array":typeof n;function deepMergeConfigs(n,i){if(!n||!i)return n;const r={...n},s=[];for(const a in i){const l=i[a],d=r[a];if(!(a in n)){s.push('Property "'+a+'" does not exist in target schema, skipping merge.');continue}const u=getType(l),f=getType(d);u===f?isObject(l)&&isObject(d)?r[a]=deepMergeConfigs(d,l):r[a]=l:s.push('Type mismatch for key "'+a+'": source is '+u+", target is "+f+". Skipping merge.")}return s.length>0&&zt.warn("Merging configurations with warnings:",s),r}const Mt=new Map([["global.layout.enablePersonalization",[C.PRODUCT,C.CART,C.CHECKOUT,C.ENGRAVING_FORM,C.ENGRAVING_VIEW,C.PRODUCT_INTERACTIONS,C.CART_ITEM,C.CHECKOUT_ITEM]],["global.layout.personalizationText",[C.PRODUCT,C.CART,C.CHECKOUT,C.ENGRAVING_FORM,C.ENGRAVING_VIEW,C.CART_ITEM]],["global.layout.personalizationCardStyle",[C.PRODUCT,C.CART,C.CHECKOUT,C.ENGRAVING_FORM,C.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[C.CART,C.CART_PROMO_CODE,C.CART_FOOTER,C.CHECKOUT_ORDER_SUMMARY,C.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[C.CART,C.CHECKOUT,C.ADDRESS,C.INPUT,C.BIRTHDATE_INPUT,C.ADDRESS_INPUT,C.CHECKOUT_DELIVER_TO,C.CHECKOUT_BUYER,C.CHECKOUT_BILLING,C.CHECKOUT_PAYMENT,C.CART_PROMO_CODE]],["global.layout.showPoweredBy",[C.CART,C.CHECKOUT,C.CHECKOUT_COMPLETED,C.POWERED_BY,C.CART_FOOTER,C.CHECKOUT_ORDER_SUMMARY,C.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[C.POWERED_BY]],["product.layout.showImages",[C.PRODUCT,C.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[C.PRODUCT]],["product.layout.showDescription",[C.PRODUCT,C.PRODUCT_DESCRIPTION,C.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[C.PRODUCT,C.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[C.PRODUCT,C.PRODUCT_RETAILERS,C.PRODUCT_RETAILERS_CAROUSEL,C.PRODUCT_RETAILERS_POPUP,C.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[C.PRODUCT,C.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[C.PRODUCT,C.PRODUCT_IMAGE_CAROUSEL,C.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[C.PRODUCT,C.PRODUCT_RETAILERS,C.PRODUCT_RETAILERS_CAROUSEL,C.PRODUCT_RETAILERS_POPUP,C.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[C.PRODUCT,C.PRODUCT_RETAILERS,C.PRODUCT_RETAILERS_CAROUSEL,C.PRODUCT_RETAILERS_POPUP,C.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[C.PRODUCT,C.PRODUCT_ADD_TO_CART_SECTION,C.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[C.PRODUCT,C.PRODUCT_ADD_TO_CART_SECTION,C.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[C.PRODUCT,C.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[C.PRODUCT,C.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[C.CART,C.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[C.CART,C.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[C.CART,C.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[C.CART,C.CART_FOOTER]],["checkout.layout.emailOptIn",[C.CHECKOUT,C.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[C.CHECKOUT,C.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[C.CHECKOUT,C.CHECKOUT_GIFT_CARDS,C.CHECKOUT_ORDER_SUMMARY,C.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[C.CHECKOUT,C.CHECKOUT_ORDER_SUMMARY,C.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[C.CHECKOUT,C.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[C.CHECKOUT,C.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[C.CHECKOUT,C.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[C.CHECKOUT,C.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[C.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(n,i){const r=new Set;for(const s of Object.keys(i)){const i=Mt.get(n+"."+s);if(i)for(const n of i)r.add(n)}return Array.from(r)}class ElementsBaseClient{constructor(n){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:n.apiKey,env:n.env,baseUrl:n.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(n){throw this.logger.error("Failed to prepare client",n),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),n}}async prepareEssentialServices(){this.clientConfig.set("version",ut.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...");const n=await this.authClient.authenticate();if(!n)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let i=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",i.configurations.partnerCode),this.clientConfig.set("partnerName",i.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(i.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",s);const a=s?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:s,persistedStore:a}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const n=this.clientConfig.get("customTheme"),r=i.global.layout.showPoweredBy;i=deepMergeConfigs(i,n),i.global.layout.showPoweredBy=r}await this.themeProvider.initialize(i),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(n){this.logger.error("Heavy initialization failed",n)}},0)}async initializeHeavyServices(){const n=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:n.partnerName,partnerGtmId:n.googleTagManagerId,partnerEnableGaTracking:n.enablePartnerGaTracking,liquidCommerceEnableGaTracking:n.enableLiquidCommerceGaTracking,liquidCommerceGtmId:n.liquidCommerceGoogleTagManagerId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(n){if(this.ensureAllComponentsRegistered(),!n||"object"!=typeof n)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof n,!![]);const{type:i,containerId:r,...s}=n;if(!r||"string"!=typeof r)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof r?'"'+r+'"':r),!![]);if(!i)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const a=r.replace("#",""),l=document.getElementById(a);if(!l)return console.warn("Container with ID '"+a+"' not found"),null;l.innerHTML="";const d={type:n.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...s},u=ComponentFactoryService.createElement(d);return safeReplaceChildren(l,u),n.type===C.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(a,n.type,u)}async processInjectProduct(n){if(this.ensureAllComponentsRegistered(),0===n.length)throw new SDKError("At least one product is required. Received empty array.",!![]);n.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const i=n.slice(0,20),r=[],s=[];for(const a of i){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 n=a.containerId.replace("#","").trim();if(!n){this.logger.warn("Container ID is required for product with ID '"+a.identifier+"'");continue}const i=document.getElementById(n);if(!i){this.logger.warn("Container with ID '"+n+"' not found for product '"+a.identifier+"'");continue}const s=r.every(i=>i.containerId!==n);if(!s){this.logger.warn("Duplicate container ID '"+n+"' 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 '"+n+"'");continue}const l=r.every(n=>n.identifier!==a.identifier);l?r.push({containerId:n,identifier:a.identifier}):this.logger.warn("Duplicate product identifier '"+a.identifier+"' found, skipping")}for(const a of r){const n=ComponentFactoryService.createElement({type:C.PRODUCT,useShadowDom:!![],productId:a.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(a.containerId);i?(i.innerHTML="",i.appendChild(n),s.push(this.createInjectedComponentWrapper(a.containerId,C.PRODUCT,n)),await this.commands.product.createProductInstance(a.identifier,!![])):this.logger.warn("Product ("+a.identifier+") container with ID '"+a.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(r.map(n=>n.identifier)),s}async injectProductList(n){if(!this.isElementsEnabled())return this.injectDisabledElementsError(n.containerId,C.CHECKOUT),void 0;if(!n)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!n.containerId||"string"!=typeof n.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof n.containerId?'"'+n.containerId+'"':n.containerId),!![]);if(n.rows&&("number"!=typeof n.rows||n.rows<1||n.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+n.rows,!![]);if(n.columns&&("number"!=typeof n.columns||n.columns<1||n.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+n.columns,!![]);if(n.cardVariant&&!Object.values(P).includes(n.cardVariant))throw new SDKError('Invalid card variant "'+n.cardVariant+'". Valid options: '+Object.values(P).join(", "),!![]);if(n.filters&&!Array.isArray(n.filters))throw new SDKError("Filters must be an array. Received: "+typeof n.filters,!![]);if(n.filters&&n.filters.length>0){const i=Object.values(_);for(const r of n.filters)if(!i.includes(r))throw new SDKError('Invalid filter "'+r+'". Valid options: '+i.join(", "),!![])}if(n.productUrl&&"string"==typeof n.productUrl&&!n.productUrl.includes("{upc}")&&!n.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+n.productUrl+'"',!![]);const i=document.getElementById(n.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+n.containerId+'". Make sure the element exists before adding the product list.',!![]);const r=ComponentFactoryService.createElement({type:C.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:n.cardVariant||P.STANDARD,fillCard:n.fillCard||![],rows:n.rows||4,columns:n.columns||4,filters:n.filters||[],productUrl:n.productUrl});safeReplaceChildren(i,r)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const n=ComponentFactoryService.createElement({type:C.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(n),this.cartDrawerCreated=!![]}catch(n){this.logger.warn("Failed to create cart drawer:",n)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(n,i,r){const s={getType:()=>i,getElement:()=>document.getElementById(n),rerender:()=>{try{r&&"function"==typeof r.rerender?r.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+n+"' does not support rerender")}catch(i){this.logger.warn("Failed to rerender component in container '"+n+"'")}}};return this.injectedComponents.set(n,s),s}rerenderInjectedComponentsByType(n){for(const[i,r]of this.injectedComponents)r.getType()===n&&r.rerender()}isElementsEnabled(){var n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",i),!![]}}injectDisabledElementsError(n,i){const r=document.getElementById(n.replace("#",""));if(!r)return this.logger.warn("Container with ID '"+n+"' 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:i}):componentError({message:"Elements is not enabled.",componentType:i}),r.innerHTML="",safeReplaceChildren(r,s)}registerEssentialComponents(){ComponentFactoryService.registerComponent(C.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(C.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(C.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(C.CART,AddressInputComponent),ComponentFactoryService.registerComponent(C.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(C.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(C.INPUT,InputComponent),ComponentFactoryService.registerComponent(C.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(C.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(C.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(C.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(C.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(C.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(C.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(C.ALERT,AlertComponent),ComponentFactoryService.registerComponent(C.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(C.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(C.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(C.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(C.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(C.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(C.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(C.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(C.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(C.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(C.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(C.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(C.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(C.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(C.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(C.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(C.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(C.CART,CartComponent),ComponentFactoryService.registerComponent(C.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(C.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(C.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(C.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(C.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(C.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(C.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(C.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(C.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(C.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(C.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(C.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(n,i)=>{if(!n||"string"!=typeof n)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);this.ensureCartDrawerExists();const r=document.getElementById(n.replace("#",""));if(!r)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before adding the cart button.',!![]);const s=ComponentFactoryService.createElement({type:C.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});r.innerHTML="",safeReplaceChildren(r,s)},floatingCartButton:n=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:C.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:n});document.body.appendChild(i)},cartSubtotal:n=>{if(!n||"string"!=typeof n)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);const i=document.getElementById(n.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before displaying cart subtotal.',!![]);i.innerHTML="",i.classList.add("lce-cart-subtotal");const t=n=>{i.textContent=formatCentToDollarText(n)},r=this.store.get("cart.totals.subtotal")||0;t(r),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.subtotal")||0;t(n)})},cartItemsCount:(n,i)=>{if(!n||"string"!=typeof n)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);let r=!![];i&&"boolean"==typeof i.hideZero&&(r=i.hideZero);const s=document.getElementById(n.replace("#",""));if(!s)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before displaying cart items count.',!![]);s.innerHTML="",s.classList.add("lce-cart-items-count");const y=n=>{s.textContent=n.toString(),0===n?(r&&(s.style.visibility="hidden"),s.classList.add("no-items")):(r&&(s.style.visibility="visible"),s.classList.remove("no-items"))},a=this.store.get("cart.totals.quantity")||0;y(a),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.quantity")||0;y(n)})}}}async injectProductElement(n){if(!Array.isArray(n))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof n,!![]);if(!this.isElementsEnabled()){for(const i of n)this.injectDisabledElementsError(i.containerId,C.PRODUCT);return[]}return await this.processInjectProduct(n)}async injectAddressElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:C.ADDRESS,containerId:n,options:i}):(this.injectDisabledElementsError(n,C.ADDRESS),null)}async injectCartElement(n){if(!n||"string"!=typeof n)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:C.CART,containerId:n}):(this.injectDisabledElementsError(n,C.CART),null)}async injectCheckoutElement(n){if(!n||"string"!=typeof n)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:C.CHECKOUT,containerId:n}):(this.injectDisabledElementsError(n,C.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(n,i){try{SingletonManager.setContext({isBuilder:![]});const r=ClientConfigService.getInstance();r.initialize(n,{env:i.env,isBuilder:![],debugMode:i.debugMode,customTheme:i.customTheme,promoTicker:i.promoTicker,proxy:i.proxy,development:i.development});const s=r.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),ui:a.ui,actions:a.actions,getInjectedComponents:a.getInjectedComponents.bind(a)};window.elements=l;const d=PubSubService.getInstance();return d.publishAction(x.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:r.get("version")}),l}catch(r){try{const n=LoggerFactory.get("ElementsClientInit");n.error("Elements Client Initialization failed",r)}catch(s){console.error("[LiquidCommerce Elements] Client initialization failed:",null==r?void 0:r.message)}try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(x.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Bt={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"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(n){return null!==n&&"lce_"===n.substring(0,4)}function generateElementId({prefix:n,index:i}){const r=Math.random().toString(36).substring(2,7),s=void 0!==n?n:"",a=void 0!==i?i:"",l=s&&a?"-":"";return""+s+l+a+r}function pairsFromMainScript(n){const i=[];try{const s=n.getAttributeNames().filter(n=>n.substring(0,12)===Bt.PRODUCT.PRODUCT);for(const a of s)try{const r=a.match(/^data-product(-(.+))?$/),s=(null==r?void 0:r[2])?"-"+r[2]:"",l=""+Bt.PRODUCT.CONTAINER+s;if(n.hasAttribute(l)){const r=n.getAttribute(l),s=n.getAttribute(a);r&&s&&i.push({containerId:r,identifier:s})}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return i}function pairsFromProductsScript(){const n=[];try{const r=document.querySelectorAll("script["+Bt.PRODUCT_LIST.SCRIPT+"]");for(const s of r)try{const i=JSON.parse(s.textContent||"[]");if(!Array.isArray(i))continue;for(const r of i)r.containerId&&r.identifier&&n.push({containerId:r.containerId,identifier:r.identifier})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",i)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",r)}return n}function pairsFromAttributedElements(){const n=[];try{const r=document.querySelectorAll("div["+Bt.PRODUCT.LCE_PRODUCT+"]");let s=0;for(const a of r)try{const i=generateElementId({prefix:"lce-p",index:s});a.setAttribute("id",i);const r=a.getAttribute(Bt.PRODUCT.LCE_PRODUCT);i&&r&&n.push({containerId:i,identifier:r}),s+=1}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",i)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",r)}return n}async function addProductToCartViaQueryParam(n,i){try{const s=i.getAttribute(Bt.PRODUCT.PARAM),a=i.getAttribute(Bt.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 u=E.SHIPPING;if(a)if(startsWithLcePrefix(a)){const n=l.get(a);n!==E.ON_DEMAND&&n!==E.SHIPPING||(u=n)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+a+'" because it does not start with "lce_" prefix.');try{await n.actions.cart.addProduct([{identifier:d,fulfillmentType:u,quantity:1}],!![])}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",s)}}async function addPromoCodeToCartViaQueryParam(n,i){try{const s=i.getAttribute(Bt.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),l=a.get(s);if(!l)return;try{await n.actions.cart.applyPromoCode(l)}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",s)}}async function setupCartButtonWithPosition(n,i,r,s){var a,l,d;try{const u=r.includes("mobile"),f=u?"mobile":"desktop",g=!u,v=i.getAttribute(r),b=i.getAttribute(s);if(!i.hasAttribute(r)&&!i.hasAttribute(s))return;if(g){if(i.hasAttribute(r)&&!v)return n.ui.floatingCartButton(![]),void 0;if(i.hasAttribute(s)&&!b)return n.ui.floatingCartButton(!![]),void 0}const x=v||b,w=!!b;if(!x)return g&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),n.ui.floatingCartButton(w)),void 0;const C=["above","below","replace","inside"],E=x.match(/^(\w+):(.+)$/),T=E&&C.includes(E[1])?E[1]:"inside";let A=E?E[2]:x;/^[#.]/.test(A)||/\s/.test(A)||(A="#"+A);const P=document.querySelector(A);if(!P)return g&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+A+'" not found. Using floating button.'),n.ui.floatingCartButton(w)),void 0;const _=document.createElement("div");switch(_.classList.add("lce-cart-"+f+"-button-container"),_.id=generateElementId({prefix:"lce-cart-"+f+"-btn"}),T){case"above":null===(a=P.parentNode)||void 0===a?void 0:a.insertBefore(_,P);break;case"below":null===(l=P.parentNode)||void 0===l?void 0:l.insertBefore(_,P.nextSibling);break;case"replace":null===(d=P.parentNode)||void 0===d?void 0:d.replaceChild(_,P);break;default:P.appendChild(_)}n.ui.cartButton(_.id,w)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}}async function setupCartButtons(n,i){i.hasAttribute(Bt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(n,i,Bt.CART.BUTTON,Bt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(n,i,Bt.CART.MOBILE_BUTTON,Bt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(n){try{const i=document.querySelector("div["+Bt.PRODUCT_LIST.LIST+"]");if(!i)return;const r="lce-products-list-container";i.className="lce-products-list-container",i.id=r;const s=i.getAttribute(Bt.PRODUCT_LIST.CARD)||"standard",a=i.hasAttribute(Bt.PRODUCT_LIST.CARD_FILL),l=Number.parseInt(i.getAttribute(Bt.PRODUCT_LIST.ROWS)||"3",10)||3,d=Number.parseInt(i.getAttribute(Bt.PRODUCT_LIST.COLUMNS)||"4",10)||4,u=i.getAttribute(Bt.PRODUCT_LIST.FILTERS),f=i.getAttribute(Bt.PRODUCT_LIST.PRODUCT_URL)||void 0;let g=[];u&&(g=u.split(",").map(n=>n.trim()).filter(n=>n.length>0)),await n.injectProductList({containerId:r,rows:l,columns:d,cardVariant:s,fillCard:a,filters:g,productUrl:f})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",i)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async n=>{const i=n.detail;if(!i.data.isReady)return;const r=window.elements,s=document.querySelectorAll("["+Bt.CART.TOGGLE_BUTTON+"]");if(s.length>0)for(const l of s)l.addEventListener("click",async n=>{n.stopPropagation(),n.preventDefault(),r.actions.cart.toggleCart()});const a=document.querySelectorAll("["+Bt.CART.ITEMS_COUNT+"]");if(a.length>0){let n=0;for(const i of a){const s=i.getAttribute(Bt.CART.ITEMS_COUNT),a=!(s&&"keep-zero"===s),l=Boolean(null==i?void 0:i.id);let d;l?d=i.id:(d=generateElementId({prefix:"lce-cart-items-count",index:n}),i.id=d),r.ui.cartItemsCount(d,{hideZero:a}),n+=1}}})}catch(ut){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",ut)}}function getDevelopmentConfigs(){const n=document.querySelector("script["+Bt.DEVELOPMENT+"]");if(n)try{return JSON.parse(n.textContent||"{}")}catch(i){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",i),void 0}}async function ElementsAutoInitialize(){var n,i,r,s,a,l;try{const l=document.querySelector("script["+Bt.CORE.MAIN_SCRIPT+"]");if(!l)return;const d=l.getAttribute(Bt.CORE.TOKEN),u=l.getAttribute(Bt.CORE.ENV)||b.PRODUCTION,f=l.getAttribute(Bt.CORE.DEBUG_MODE);if(!d)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=l.getAttribute(Bt.PROMO_TICKER.CODE),v=l.getAttribute(Bt.PROMO_TICKER.TEXT),x=null!==(n=l.getAttribute(Bt.PROMO_TICKER.SEPARATOR))&&void 0!==n?n:"•",w=null!==(i=l.getAttribute(Bt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==i?i:void 0,C=null!==(r=l.getAttribute(Bt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==r?r:void 0,E=pairsFromMainScript(l),A=pairsFromProductsScript(),P=pairsFromAttributedElements(),_=[...E,...A,...P],N=g&&v&&w&&C?{promoCode:g,text:v.split("|").map(n=>n.trim()).filter(n=>n.length>0),separator:x,activeFrom:null===(s=new Date(w))||void 0===s?void 0:s.toISOString(),activeUntil:null===(a=new Date(C))||void 0===a?void 0:a.toISOString()}:void 0;let F=T.NONE;f&&u!==b.PRODUCTION&&(F=f),setupEventListeners();const R=await Elements(d,{env:u,debugMode:F,promoTicker:N?[N]:void 0,development:getDevelopmentConfigs()});if(!R)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(R,l),0!==_.length&&R.injectProductElement(_).catch(n=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",n)}),initializeProductsList(R),addProductToCartViaQueryParam(R,l),addPromoCodeToCartViaQueryParam(R,l)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(l=null==d?void 0:d.message)&&void 0!==l?l:String(d))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ut){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ut)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ut){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ut)}},50)}catch(ut){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",ut)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(n){try{if(!n)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(n),n.layout&&Object.keys(n.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("global.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(i){throw this.logger.error("❌ Failed to update global theme configuration",i),new SDKError("Failed to update global configuration: "+i.message,!![])}}async updateProductComponent(n){try{if(!n)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(n),n.layout&&Object.keys(n.layout).length>0){await this.commands.product.rerenderAllProducts();for(const i of getComponentTypesForLayoutFields("product.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(i){throw this.logger.error("❌ Failed to update product component theme",i),new SDKError("Failed to update product configuration: "+i.message,!![])}}updateCartComponent(n){try{if(!n)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(n),n.layout&&Object.keys(n.layout).length>0){this.commands.cart.rerenderCart();for(const i of getComponentTypesForLayoutFields("cart.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(i){throw this.logger.error("❌ Failed to update cart component theme",i),new SDKError("Failed to update cart configuration: "+i.message,!![])}}updateCheckoutComponent(n){try{if(!n)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(n),n.layout&&Object.keys(n.layout).length>0){this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("checkout.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(i){throw this.logger.error("❌ Failed to update checkout component theme",i),new SDKError("Failed to update checkout configuration: "+i.message,!![])}}updateAddressComponent(n){try{if(!n)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(n),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(i){throw this.logger.error("❌ Failed to update address component theme",i),new SDKError("Failed to update address configuration: "+i.message,!![])}}async injectElement(n){if(!n)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!n.containerId||"string"!=typeof n.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n.containerId?'"'+n.containerId+'"':n.containerId),!![]);if(!n.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(n)}async injectProductElement(n){if(!Array.isArray(n))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof n,!![]);return await this.processInjectProduct(n)}async injectAddressElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return await this.processInjectElement({type:C.ADDRESS,containerId:n,options:i})}async injectCartElement(n){if(!n||"string"!=typeof n)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return await this.processInjectElement({type:C.CART,containerId:n})}async injectCheckoutElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);const r=await this.processInjectElement({type:C.CHECKOUT,containerId:n});if(null==i?void 0:i.simulatePresale){const n=i.presaleExpiresInMinutes||15,r=new Date;r.setMinutes(r.getMinutes()+n),this.store.set("checkout.presale",{isLocked:!![],expiresAt:r.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+n+" minutes")}return r}}async function ElementsBuilder(n,i){try{SingletonManager.setContext({isBuilder:!![]});const r=ClientConfigService.getInstance();r.initialize(n,{env:i.env,isBuilder:!![],debugMode:i.debugMode,customTheme:i.customTheme,promoTicker:i.promoTicker,proxy:void 0,development:void 0});const s=r.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const l={updateComponentGlobalConfigs:a.updateComponentGlobalConfigs.bind(a),updateProductComponent:a.updateProductComponent.bind(a),updateAddressComponent:a.updateAddressComponent.bind(a),updateCartComponent:a.updateCartComponent.bind(a),updateCheckoutComponent:a.updateCheckoutComponent.bind(a),injectElement:a.injectElement.bind(a),injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),actions:a.actions};window.elementsBuilder=l;const d=PubSubService.getInstance();return d.publishAction(x.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:r.get("version")}),l}catch(r){try{const n=LoggerFactory.get("ElementsBuilderClientInit");n.error("Elements Builder Client Initialization failed",r)}catch(s){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==r?void 0:r.message)}try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(x.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const n=window.onerror;window.onerror=(i,r,s,a,l)=>isSDKError(l,r)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:i,source:r,lineno:s,colno:a,error:l}),!![]):n?n(i,r,s,a,l):![];const i=window.onunhandledrejection;window.onunhandledrejection=n=>{if(n.reason&&isSDKError(n.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",n.reason),n.preventDefault(),void 0;i&&i.call(window,n)};try{initializeDOMPolyfills()}catch(Wt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Wt)}try{triggerElementsAutoInit()}catch(Ht){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Ht)}}catch(qt){console.error("[LiquidCommerce Elements] SDK initialization failed:",qt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(n,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):(n="undefined"!=typeof globalThis?globalThis:n||self,i(n.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...n){for(;this.firstChild;)this.removeChild(this.firstChild);for(const i of n)"string"==typeof i?this.appendChild(document.createTextNode(i)):this.appendChild(i)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...n){const i=document.createDocumentFragment();for(const o of n)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);this.insertBefore(i,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const s of n)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);i.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const s of n)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);i.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const s of n)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);i.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=n=>{const i={};for(const[o,s]of n)i[o]=s;return i})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(ht){console.warn("DOM polyfills initialization failed:",ht)}}function safeReplaceChildren(n,...i){try{if("replaceChildren"in n&&"function"==typeof n.replaceChildren)n.replaceChildren(...i);else{for(;n.firstChild;)n.removeChild(n.firstChild);for(const o of i)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===i.length&&"string"==typeof i[0]&&(n.innerHTML=i[0])}}class SDKError extends Error{constructor(n,i=![]){super(n),this.name="SDKError",this.isSdk=!![],this.reThrow=i,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(n,i){if((null==n?void 0:n.isSdk)===!![])return n instanceof SDKError&&n.reThrow?![]:!![];if(!n||"object"!=typeof n)return i?isSDKSource(i):![];const o=String((null==n?void 0:n.message)||""),s=/liquidcommerce\s+elements/i.test(o),a=String((null==n?void 0:n.stack)||""),c=(null==n?void 0:n.source)||i||"",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],p=[/\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/],m=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],f=[/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],g=isSDKSource(c),v=l.some(n=>n.test(a)),y=p.some(n=>n.test(a)),b=m.some(n=>n.test(a)),w=f.some(n=>n.test(a));return s||g||v||y||b||w}function isSDKSource(n){if(!n||"string"!=typeof n)return![];const i=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return i.some(i=>i.test(n))}var n,i,o,s,a,c,l,p,m,f,g;(function(n){n.ALE="BEER > ALE",n.LAGER="BEER > LAGER",n.BASE="BEER",n.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",n.OTHER_BEER="BEER > OTHER",n.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",n.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",n.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER"})(n||(n={})),function(n){n.BASE="FOOD",n.PANTRY_OTHER="FOOD > PANTRY > OTHER",n.CANDY="FOOD > CANDY",n.CANDY_OTHER="FOOD > CANDY > OTHER",n.CBD="FOOD > CBD",n.CBD_OTHER="FOOD > CBD > OTHER",n.CHEESE="FOOD > CHEESE",n.CHEESE_OTHER="FOOD > CHEESE > OTHER",n.HOUSEHOLD="FOOD > HOUSEHOLD",n.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",n.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",n.PANTRY="FOOD > PANTRY",n.FRUIT="FOOD > FRUIT",n.OTHER="FOOD > OTHER",n.ICE="FOOD > ICE",n.ICE_CREAM="FOOD > ICE CREAM",n.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",n.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",n.SPIRITS_BASED="FOOD > SPIRITS BASED",n.GARNISHES="FOOD > GARNISHES"}(i||(i={})),function(n){n.BASE="MERCHANDISE",n.GLASSWARE="MERCHANDISE > GLASSWARE",n.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",n.HUMIDOR="MERCHANDISE > HUMIDOR",n.ACCESSORY="MERCHANDISE > ACCESSORY",n.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",n.GIFT_SET="MERCHANDISE > GIFT SET",n.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",n.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",n.BAR_TOOLS="MERCHANDISE > BAR TOOLS",n.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",n.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER"}(o||(o={})),function(n){n.BASE="MISCELLANEOUS",n.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",n.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",n.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP"}(s||(s={})),function(n){n.BASE="NON ALCOHOLIC",n.BITTERS="NON ALCOHOLIC > BITTERS",n.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",n.COFFEE="NON ALCOHOLIC > COFFEE",n.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",n.JUICE="NON ALCOHOLIC > JUICE",n.SODA="NON ALCOHOLIC > SODA",n.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",n.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",n.SPIRITS="NON ALCOHOLIC > SPIRITS",n.TEA="NON ALCOHOLIC > TEA",n.WATER="NON ALCOHOLIC > WATER",n.WINE="NON ALCOHOLIC > WINE",n.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",n.SLURPEES="NON ALCOHOLIC > SLURPEES",n.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",n.DAIRY="NON ALCOHOLIC > DAIRY",n.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",n.OTHER="NON ALCOHOLIC > OTHER"}(a||(a={})),function(n){n.BASE="READY TO DRINK",n.HARD_CIDER="READY TO DRINK > HARD CIDER",n.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",n.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",n.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",n.HARD_TEA="READY TO DRINK > HARD TEA",n.HARD_SELTZER="READY TO DRINK > HARD SELTZER",n.MALT_BASED="READY TO DRINK > MALT BASED",n.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",n.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",n.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",n.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",n.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",n.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",n.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",n.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",n.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",n.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",n.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",n.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",n.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",n.OTHER="READY TO DRINK > OTHER"}(c||(c={})),function(n){n.BASE="SPIRITS",n.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",n.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",n.BAIJIU="SPIRITS > BAIJIU",n.BITTERS="SPIRITS > BITTERS",n.BRANDY="SPIRITS > BRANDY",n.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",n.CACHACA="SPIRITS > CACHACA",n.GIN="SPIRITS > GIN",n.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",n.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",n.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",n.GIN_OTHER="SPIRITS > GIN > OTHER",n.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",n.LIQUEUR="SPIRITS > LIQUEUR",n.MEZCAL="SPIRITS > MEZCAL",n.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",n.RUM="SPIRITS > RUM",n.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",n.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",n.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",n.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",n.RUM_OTHER="SPIRITS > RUM > OTHER",n.RUM_SPICED="SPIRITS > RUM > SPICED",n.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",n.SHOCHU="SPIRITS > SHOCHU",n.SOJU="SPIRITS > SOJU",n.SOTOL="SPIRITS > SOTOL",n.TEQUILA="SPIRITS > TEQUILA",n.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",n.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",n.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",n.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",n.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",n.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",n.VODKA="SPIRITS > VODKA",n.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",n.VODKA_OTHER="SPIRITS > VODKA > OTHER",n.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",n.WHISKEY="SPIRITS > WHISKEY",n.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",n.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",n.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",n.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",n.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",n.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",n.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",n.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH"}(l||(l={})),function(n){n.BASE="WINE",n.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",n.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",n.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",n.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",n.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",n.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",n.COOKING="WINE > COOKING",n.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",n.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",n.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",n.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",n.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",n.RED_WINE="WINE > RED WINE",n.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",n.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",n.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",n.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",n.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",n.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",n.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",n.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",n.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",n.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",n.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",n.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",n.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",n.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",n.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",n.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",n.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",n.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",n.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",n.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",n.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",n.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",n.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",n.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",n.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",n.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",n.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",n.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",n.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",n.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",n.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",n.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",n.RED_WINE_MONICA="WINE > RED WINE > MONICA",n.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",n.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",n.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",n.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",n.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",n.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",n.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",n.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",n.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",n.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",n.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",n.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",n.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",n.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",n.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",n.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",n.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",n.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",n.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",n.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",n.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",n.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",n.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",n.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",n.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",n.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",n.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",n.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",n.RED_WINE_OTHER="WINE > RED WINE > OTHER",n.ROSE_WINE="WINE > ROSE WINE",n.SAKE="WINE > SAKE",n.WHITE_WINE="WINE > WHITE WINE",n.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",n.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",n.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",n.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",n.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",n.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",n.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",n.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",n.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",n.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",n.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",n.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",n.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",n.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",n.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",n.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",n.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",n.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",n.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",n.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",n.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",n.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",n.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",n.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",n.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",n.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",n.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",n.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",n.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",n.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",n.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",n.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",n.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",n.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",n.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",n.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",n.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",n.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",n.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",n.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",n.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",n.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",n.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",n.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",n.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",n.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",n.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",n.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",n.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",n.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",n.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",n.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",n.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",n.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",n.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",n.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",n.WINE_OTHER="WINE > OTHER"}(p||(p={})),function(n){n.BRANDS="brands",n.FLAVOR="flavor",n.FULFILLMENT="fulfillment",n.TAGS="tags",n.REGION="region",n.VARIETY="variety",n.ENGRAVING="engraving",n.PRICE="price",n.PRESALE="presale",n.AVAILABILITY="availability",n.CATEGORIES="categories",n.SIZES="sizes",n.COLORS="colors",n.APPELLATION="appellation",n.COUNTRY="country",n.VINTAGE="vintage",n.MATERIALS="materials",n.COLLECTION_TAGS="collectionTags"}(m||(m={})),function(n){n.UNSPECIFIED="AVAILABILITY_UNSPECIFIED",n.IN_STOCK="IN_STOCK",n.OUT_OF_STOCK="OUT_OF_STOCK",n.PREORDER="PREORDER",n.BACKORDER="BACKORDER"}(f||(f={})),function(n){n.YES="YES",n.NO="NO"}(g||(g={}));const v={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},y={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",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"},b={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},w={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"},k={NONE:"none",CONSOLE:"console",PANEL:"panel"},S={[v.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[v.STAGING]:"https://staging-elements.liquidcommerce.us",[v.PRODUCTION]:"https://elements.liquidcommerce.us"},I={STANDARD:"standard"},T={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"},D={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:n}){SingletonManager.currentContext=n?"builder":"regular"}static setClientConstructor(n){SingletonManager.clientConstructor=n}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(n,i){const o=SingletonManager.getInstances();o.has(n)||o.set(n,i());const s=o.get(n);if(!s)throw new SDKError("ElementsSdk: Instance for class "+n+" could not be created.");return s}static async getClient(n){const i=[n.apiKey,n.env,n.isBuilder,n.debugMode].join("_"),o="LiquidCommerceElementsClient_"+i,s=SingletonManager.getInstances();if(s.has(o))return s.get(o);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const a=new SingletonManager.clientConstructor(n);return await a.prepare(),s.set(o,a),a}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const A="lce",P={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},_={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},N={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},F={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:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},O={drawer:{isOpen:![],contentConfig:null}},L={products:{},cart:N,address:P,checkout:F,ui:O};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(n,i={}){this.validateInputs(n,i),this.config=Object.freeze(this.buildConfiguration(n,i))}getConfigs(){return{...this.config}}get(n){return this.config[n]}set(n,i){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[n]:i})}isDevelopment(){return this.get("env")===v.DEVELOPMENT}isStaging(){return this.get("env")===v.STAGING}isProduction(){return this.get("env")===v.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const n=this.get("debugMode");return n===k.CONSOLE||n===k.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===k.PANEL}debuggingDisabled(){const n=this.get("debugMode");return n===k.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(n,i){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(i.env&&!Object.values(v).includes(i.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+i.env+'". Using default environment.'),i.env=void 0),void 0!==i.isBuilder&&"boolean"!=typeof i.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),i.isBuilder=void 0),void 0===i.debugMode||Object.values(k).includes(i.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+i.debugMode+'". Must be one of: '+Object.values(k).join(", ")+". Using default value."),i.debugMode=void 0),i.promoTicker&&"object"!=typeof i.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),i.promoTicker=void 0),i.promoTicker)if(Array.isArray(i.promoTicker)){const n=i.promoTicker.filter((n,i)=>{if("string"!=typeof n.promoCode||!n.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(n.text)||0===n.text.length||!n.text.every(n=>"string"==typeof n&&n.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof n.separator||!n.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!n.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof n.activeFrom?new Date(n.activeFrom):n.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!n.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof n.activeUntil?new Date(n.activeUntil):n.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?o>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});i.promoTicker=n.length>0?n:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),i.promoTicker=void 0;i.proxy&&("object"!=typeof i.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),i.proxy=void 0):i.proxy.baseUrl&&"string"==typeof i.proxy.baseUrl?i.proxy.headers&&"object"!=typeof i.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),i.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),i.proxy=void 0))}buildConfiguration(n,i){var o,s,a,c;const l=i.env||v.PRODUCTION;let p=S[l];const m=l===v.PRODUCTION,f=i.isBuilder||![],g=A+(m?"":"_"+l)+(f?"builder":"");return(null===(o=i.development)||void 0===o?void 0:o.customApiUrl)&&(p=i.development.customApiUrl),{apiKey:n.trim(),env:l,isBuilder:f,debugMode:i.debugMode||k.NONE,baseUrl:p,partnerCode:void 0,partnerName:void 0,customTheme:i.customTheme||null,proxy:i.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:g,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:i.promoTicker||null,paymentMethodId:(null===(s=i.development)||void 0===s?void 0:s.paymentMethodId)||void 0,openShadowDom:m?![]:(null===(a=i.development)||void 0===a?void 0:a.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(c=i.development)||void 0===c?void 0:c.customApiUrl)}}detectDeviceType(){var n,i;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,a=(null===(n=window.screen)||void 0===n?void 0:n.width)||0,c=(null===(i=window.screen)||void 0===i?void 0:i.height)||0,l=Math.max(a,c),p=[/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/],m=[/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 p.some(n=>n.test(o))?"tablet":m.some(n=>n.test(o))||s&&l<768?"mobile":s&&l>=768&&l<=1200||s&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&s&&l>=768||/windows nt/i.test(o)&&s&&l>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}class LoggerService{constructor(n){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=n}static getInstance(n){return SingletonManager.getClassInstance("LoggerService_"+n,()=>new LoggerService(n))}setEnableLogging(n){this.enableLogging=n}setTelemetryService(n){this.telemetryService=n}getPrefix(n){if(!this.enableLogging)return[];const i=(new Date).toISOString().slice(11,23);return["%c["+i+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[n],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[n],"color: "+this.colors[n]]}debug(n,i){if(this.sendToTelemetry("debug",n,void 0,i),!this.enableLogging)return;const[o,...s]=this.getPrefix("debug");void 0!==i?console.debug(o,...s,n,i):console.debug(o,...s,n)}info(n,i){if(!this.enableLogging)return;const[o,...s]=this.getPrefix("info");void 0!==i?console.info(o,...s,n,i):console.info(o,...s,n)}warn(n,i){if(this.sendToTelemetry("warn",n,void 0,i),!this.enableLogging)return;const[o,...s]=this.getPrefix("warn");void 0!==i?console.warn(o,...s,n,i):console.warn(o,...s,n)}error(n,i){const o=i instanceof Error,s=o?i:void 0,a=!o&&i?i:void 0;if(this.sendToTelemetry("error",n,s,a),!this.enableLogging)return;const[c,...l]=this.getPrefix("error");void 0!==i?console.error(c,...l,n,i):console.error(c,...l,n)}sendToTelemetry(n,i,o,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(n,i,{context:this.context,error:o,data:s})}catch(a){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(n){const i=this.getInstances();if(!i.has(n)){const o=LoggerService.getInstance(n);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),i.set(n,o)}return i.get(n)}static setEnableLogging(n){this.enableLoggingGlobally=n;const i=this.getInstances();for(const[,o]of i)o.setEnableLogging(n)}static setTelemetryService(n){this.telemetryService=n;const i=this.getInstances();for(const[,o]of i)o.setTelemetryService(n)}}function componentError({componentType:n,message:i}){const o=document.createElement("div");o.className=n;const s=o.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const c=document.createElement("div"),l=document.createElement("h3");l.textContent="Component </"+n+">";const p=document.createElement("p");return p.textContent=i,c.appendChild(a),c.appendChild(l),c.appendChild(p),s.appendChild(c),o}function productionComponentError({title:n,message:i,componentType:o}){const s=document.createElement("div");s.setAttribute("data-component-type",o);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"),p=document.createElement("h2");p.textContent=n;const m=document.createElement("p");return m.textContent=i,l.appendChild(c),l.appendChild(p),l.appendChild(m),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(n,i){ComponentFactoryService.getComponentRegistry().set(n,i)}static createElement(n){try{const i=ComponentFactoryService.getComponentRegistry().get(n.type);if(!i)throw new SDKError("Component type ["+n.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(n.type);window.customElements.get(o)||window.customElements.define(o,i);const s=document.createElement(o);if(s.initialize){const{type:i,useShadowDom:a,wrapInLceElement:c,...l}=n,p={type:i,tagName:o,useShadowDom:a&&c!==!![]};s.initialize({data:l,config:p})}if(n.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(w.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(w.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,i);const a=document.createElement(o);return a.initialize(n.type,s),a}return s}catch(i){return ComponentFactoryService.logger.error("Failed to create component </"+n.type+">",i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n.type}):componentError({componentType:n.type,message:(null==i?void 0:i.message)||i})}}static componentError({componentType:n,message:i}){return ComponentFactoryService.logger.error("Component type "+n+" failed to load: "+i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({componentType:n,message:i})}static getComponentTagName(n){const i={[w.DRAWER]:"drawer-lc",[w.INPUT]:"input-lc",[w.BIRTHDATE_INPUT]:"birthdate-input-lc",[w.ENGRAVING_FORM]:"engraving-form-lc",[w.ENGRAVING_VIEW]:"engraving-view-lc",[w.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[w.POWERED_BY]:"powered-by-lc",[w.LCE_ELEMENT]:"lce-element",[w.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[w.ALERT]:"alert-lc",[w.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[w.ADDRESS]:"address-lc",[w.ADDRESS_INPUT]:"address-input-lc",[w.ADDRESS_DISPLAY]:"address-display-lc",[w.PRODUCT]:"product-lc",[w.PRODUCT_OPTIONS]:"product-options-lc",[w.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[w.PRODUCT_INTERACTIONS]:"product-interactions-lc",[w.PRODUCT_DESCRIPTION]:"product-description-lc",[w.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[w.PRODUCT_RETAILERS]:"product-retailers-lc",[w.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[w.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[w.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[w.PRODUCT_PRICE]:"product-price-lc",[w.PRODUCT_DRAWER]:"product-drawer-lc",[w.PRODUCT_LOADING]:"product-loading-lc",[w.PRODUCT_LIST]:"product-list-lc",[w.PRODUCT_LIST_CARD]:"product-list-card-lc",[w.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[w.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[w.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[w.CART]:"cart-lc",[w.CART_RETAILER]:"cart-retailer-lc",[w.CART_ITEM]:"cart-item-lc",[w.CART_FOOTER]:"cart-footer-lc",[w.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[w.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[w.CART_PROMO_CODE]:"cart-promo-code-lc",[w.CART_HEADER]:"cart-header-lc",[w.CART_BODY]:"cart-body-lc",[w.CART_FULFILLMENT]:"cart-fulfillment-lc",[w.CHECKOUT]:"checkout-lc",[w.CHECKOUT_INFORMATION]:"checkout-information-lc",[w.CHECKOUT_PAYMENT]:"checkout-payment-lc",[w.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[w.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[w.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[w.CHECKOUT_BILLING]:"checkout-billing-lc",[w.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[w.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[w.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[w.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[w.CHECKOUT_ITEMS]:"checkout-items-lc",[w.CHECKOUT_COMPLETED]:"checkout-completed-lc",[w.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[w.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[w.CHECKOUT_BUYER]:"checkout-buyer-lc",[w.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[w.CHECKOUT_TIPS]:"checkout-tips-lc",[w.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[w.CHECKOUT_ITEM]:"checkout-item-lc",[w.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[w.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[w.CHECKOUT_HEADER]:"checkout-header-lc",[w.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[w.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[w.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return i[n]||n.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(n,i){this.publishSpecific("actions."+n,i)}publishForm(n,i){this.publishSpecific("forms."+n,i)}publishSpecific(n,i){const[o,s]=n.includes(".")?n.split(".",2):["actions",n];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:o,event:s,originalEvent:n,actionNamespace:"actions"===o?a:void 0,timestamp:c},p={data:i,metadata:l};this.dispatchNativeEvents(n,p)}dispatchNativeEvents(n,i){const[o]=n.split(".",2);try{"actions.client_ready"===n&&(this.clientReadyEvent=i);const s=new CustomEvent(this.eventPrefix+":"+n,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const a=new CustomEvent(this.eventPrefix+":"+o,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(a)}catch(s){this.logger.error("Error dispatching native events for "+n,s)}}setupClientReadyBuffering(){const n=window.addEventListener,i=this.eventPrefix+":actions.client_ready";window.addEventListener=(o,s,a)=>{if(o!==i)return n.call(window,o,s,a);if(!this.clientReadyEvent)return n.call(window,o,s,a);try{const n=new CustomEvent(i,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof s?s(n):s&&"function"==typeof s.handleEvent&&s.handleEvent(n)}catch(c){this.logger.error("Error replaying CLIENT_READY event",c)}return n.call(window,o,s,a)}}}function centToDollar(n){return n/100}function formatCentToDollarText(n,i=!![]){const o=Math.floor(n/100),s=n%100;let a="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||s>0)&&(a+=".",a+=s<10?"0"+s:s.toString()),a}function htmlStringToElement(n){const i=document.createElement("template");return i.innerHTML=n.trim(),i.content.firstElementChild}function format24TimeTo12(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new SDKError("Invalid time format: "+n);const o=Number.parseInt(i[1],10),s=Number.parseInt(i[2],10);if(o<0||o>23||s<0||s>59)throw new SDKError("Invalid time values: "+n);const a=o>=12?"PM":"AM",c=o%12||12;return c+":"+s.toString().padStart(2,"0")+" "+a}function formatISODateToMMDDYYYY(n){if(!n)return"";try{const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=(i.getMonth()+1).toString().padStart(2,"0"),s=i.getDate().toString().padStart(2,"0"),a=i.getFullYear().toString();return o+"/"+s+"/"+a}catch(i){return""}}function buildFormattedAddressString(n){const i=[],o=[];n.one&&n.one.trim()&&o.push(n.one.trim()),n.two&&n.two.trim()&&o.push(n.two.trim()),o.length>0&&i.push(o.join(" ")),n.city&&n.city.trim()&&i.push(n.city.trim());const s=[];return n.state&&n.state.trim()&&s.push(n.state.trim()),n.zip&&n.zip.trim()&&s.push(n.zip.trim()),s.length>0&&i.push(s.join(" ")),n.country&&n.country.trim()&&i.push(n.country.trim()),i.join(", ")}function capitalizeFirstLetter(n){return n?n.toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.substring(1)).join(" "):n}function splitCategoryPath(n){const i=(null==n?void 0:n.split(" > ").map(n=>capitalizeFirstLetter(n.trim())))||[];return{category:i[0]||"",category2:i[1]||"",category3:i[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(n){this.client=n}async getAllConfigs(){try{const n=await this.client.get("/configs");return n.data}catch(n){throw this.logger.error("Error fetching configs",n),new SDKError("Failed to fetch all configs: "+(null==n?void 0:n.message))}}async setPersistedStore(n,i){try{if(!n)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!i||0===Object.keys(i).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+n,{body:i})}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(n){try{if(!n)return this.logger.error("User device ID is required to get persisted store"),null;const i=await this.client.get("/configs/store/"+n);return i.data}catch(i){return this.logger.error("Error fetching persisted store",i),null}}async deletePersistedStore(n){try{if(!n)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+n+"/delete")}catch(i){this.logger.error("Error deleting persisted store",i)}}async getAddressSuggestions(n){try{if(!n||0===n.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const i=await this.client.post("/address/autocomplete",{body:{input:n}});return i.data}catch(i){return this.logger.error("Error fetching address suggestions",i),[]}}async getAddressDetails(n){try{if(!n||0===n.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const i=await this.client.post("/address/details",{body:{id:n}});return i.data}catch(i){throw this.logger.error("Error fetching address details",i),new SDKError("Failed to fetch address details: "+(null==i?void 0:i.message))}}async getProductsData(n,i){try{if(0===n.length)return this.logger.error("No product identifiers provided"),null;const o={identifiers:n,location:i},s=await this.client.post("/product/availability",{body:o});return s.data}catch(o){return this.logger.error("Error fetching product data",o),null}}async catalogSearch(n){var i;try{const i=await this.client.post("/product/search",{body:n});return i.data}catch(o){return this.logger.error("Error fetching catalog search data:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),{products:[],retailers:[],navigation:void 0}}}async getCartData(n){try{const i=await this.client.post("/cart/get",{body:{id:n}});return i.data}catch(i){throw this.logger.error("Error fetching cart data",i),new SDKError("Failed to fetch cart data: "+i.message)}}async updateCart(n){try{const i=await this.client.post("/cart/update",{body:n});return i.data}catch(i){throw this.logger.error("Error updating cart",i),new SDKError("Failed to update cart: "+(null==i?void 0:i.message))}}async prepareCheckout(n){var i;try{const i=await this.client.post("/checkout/prepare",{body:n});return i.data}catch(o){throw this.logger.error("Error fetching prepare checkout data:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),new SDKError("Failed to fetch prepare checkout data: "+(null==o?void 0:o.message))}}async getPaymentSession(n){var i;try{const i=await this.client.post("/checkout/payment/session",{body:n});return i.data}catch(o){throw this.logger.error("Error fetching payment session:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),new SDKError("Failed to get payment session: "+(null==o?void 0:o.message))}}async confirmPaymentSession(n,i){try{const o=await this.client.post("/checkout/payment/confirm",{body:{confirmationTokenId:n,setupIntentId:i}});return o.data}catch(o){throw this.logger.error("Error confirming payment session",o),new SDKError("Failed to confirm payment session: "+(null==o?void 0:o.message))}}async checkoutComplete(n){var i;try{const i=await this.client.post("/checkout/complete",{body:n});return i.data}catch(o){if(this.logger.error("Error completing checkout:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),null==o?void 0:o.error)throw new SDKError("Failed to complete checkout: "+(null==o?void 0:o.message));throw o}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(n,i)=>n||i&&i.status>=500&&i.status<600?!![]:![],this.xhrFetch=(n,i)=>new Promise((o,s)=>{const a=new XMLHttpRequest;a.open(i.method||"GET",n);for(const[n,c]of Object.entries(i.headers))a.setRequestHeader(n,c);a.onload=()=>{const n={ok:a.status>=200&&a.status<300,status:a.status,statusText:a.statusText,headers:a.getAllResponseHeaders().split("\r\n").reduce((n,i)=>{const[o,s]=i.split(": ");return o&&s&&(n[o]=s),n},{}),o:a.responseText,json:()=>Promise.resolve(JSON.parse(a.responseText)),text:()=>Promise.resolve(a.responseText)};o(n)},a.onerror=()=>{s(new TypeError("Network request failed"))},a.ontimeout=()=>{s(new TypeError("Network request timed out"))},a.timeout=3e4,a.send(i.body)}),this.fetchImpl=this.getFetchImplementation()}async request(n){var i,o,s;const{url:a,options:c,retryConfig:l}=n,p=null!==(i=null==l?void 0:l.maxRetries)&&void 0!==i?i:3,m=null!==(o=null==l?void 0:l.retryDelay)&&void 0!==o?o:1e3,f=null!==(s=null==l?void 0:l.shouldRetry)&&void 0!==s?s:this.defaultShouldRetry;let g;const v=Date.now();for(let b=0;b<=p;b++){let n=Date.now();try{n=Date.now();const i=await this.fetchImpl(a,c),o=Date.now()-n;if(i.ok)return i;if(await this.logFailedResponse(a,c,i,o,b,p),b<p&&f(null,i)){await this.delay(m*2**b);continue}return i}catch(y){const i=Date.now()-n;if(g=y,this.logNetworkError(a,c,y,i,b,p),b<p&&f(y,void 0)){await this.delay(m*2**b);continue}throw this.enhanceError(y,a,c,Date.now()-v)}}throw this.enhanceError(g,a,c,Date.now()-v)}async logFailedResponse(n,i,o,s,a,c){const l=a<c;let p,m;try{o.o||(o.o=await o.text());try{p=JSON.parse(o.o)}catch(f){p=o.o}}catch(g){p="[Unable to read response body]"}if(i.body)try{m=JSON.parse(i.body)}catch(v){m=i.body}this.logger.error("HTTP request failed",{method:i.method,url:n,status:o.status,statusText:o.statusText,duration:s+"ms",attempt:a+1+"/"+(c+1),willRetry:l,requestHeaders:this.sanitizeHeaders(i.headers),requestBody:m,responseHeaders:this.sanitizeHeaders(o.headers),responseBody:p})}logNetworkError(n,i,o,s,a,c){var l;const p=a<c;this.logger.error("Network request failed",{method:i.method,url:n,error:(null==o?void 0:o.message)||"Unknown error",errorType:(null===(l=null==o?void 0:o.constructor)||void 0===l?void 0:l.name)||typeof o,duration:s+"ms",attempt:a+1+"/"+(c+1),willRetry:p,possibleCauses:this.diagnosePossibleCauses(o)})}diagnosePossibleCauses(n){var i,o,s,a,c;const l=[];return((null===(i=null==n?void 0:n.message)||void 0===i?void 0:i.includes("timeout"))||(null===(o=null==n?void 0:n.message)||void 0===o?void 0:o.includes("timed out")))&&l.push("Request timeout - server took too long to respond"),((null===(s=null==n?void 0:n.message)||void 0===s?void 0:s.includes("Failed to fetch"))||(null===(a=null==n?void 0:n.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==n?void 0:n.message)||void 0===c?void 0:c.includes("aborted"))&&l.push("Request was aborted"),0===l.length&&l.push("Unknown network error"),l}enhanceError(n,i,o,s){const a=new Error((null==n?void 0:n.message)||"Network request failed - no response from server");return a.url=i,a.method=o.method,a.totalDuration=s+"ms",a.isNetworkError=!![],a.originalError=n,a.possibleCauses=this.diagnosePossibleCauses(n),a}sanitizeHeaders(n){const i={...n},o=["authorization","x-liquid-api-key","cookie","set-cookie"];for(const s of Object.keys(i))o.includes(s.toLowerCase())&&(i[s]="[REDACTED]");return i}delay(n){return new Promise(i=>setTimeout(i,n))}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(n){return async(i,o)=>{var s;const a=await n(i,o);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[n,i]of a.headers)c[n]=i}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(n){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=n.apiKey,this.baseUrl=n.baseUrl,this.env=n.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(n){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(n))}async authenticate(){var n,i;if(this.isAuthenticating)return await new Promise(n=>{const U=()=>{this.isAuthenticating?setTimeout(U,100):n(void 0)};U()}),!!this.accessToken;this.isAuthenticating=!![];try{const o=await this.request("/auth",{method:"GET"},!![]),s=3e5;return this.accessToken=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.token,this.tokenExpiration=(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.exp)-s,!![]}catch(o){return this.logger.error("Authentication failed",o),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(n,i,o=![]){var s;o||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const a=this.buildUrl(n),c={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...i.headers};o?c["X-Liquid-Api-Key"]=this.apiKey:c.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(c["X-Liquid-Api-Builder"]=!![]);const l={method:i.method,headers:c,body:i.body?JSON.stringify(i.body):void 0},q=(n,i)=>{if(n)return!![];if(!o&&i){const n=i.status;if(401===n||403===n)return this.logger.warn("Authorization error detected, will retry with new token"),this.accessToken=null,this.tokenExpiration=null,!![]}return i&&i.status>=500&&i.status<600?!![]:![]};let p,m;try{p=await this.httpClient.request({url:a,options:l,retryConfig:{maxRetries:2,retryDelay:1e3,shouldRetry:q}})}catch(g){throw this.logger.error("Request failed after all retries",{path:n,method:i.method,authType:o?"API Key":"Bearer Token",error:null==g?void 0:g.message,possibleCauses:null==g?void 0:g.possibleCauses}),{status:0,message:(null==g?void 0:g.message)||"Network error: Unable to connect to the API",url:a,method:i.method,isNetworkError:!![],originalError:g}}if(p.ok)try{return await p.json()}catch(v){const s=await p.text().catch(()=>"Success");return this.logger.error("Failed to parse successful response JSON",{path:n,method:i.method,status:p.status,authType:o?"API Key":"Bearer Token",responsePreview:s,error:null==v?void 0:v.message}),{message:s}}let f="";try{m=await p.json(),f=JSON.stringify(m)}catch(y){f=await p.text().catch(()=>"HTTP error status: "+p.status),m={message:f||"Unknown error"}}throw this.logger.error("API request failed",{path:n,method:i.method,authType:o?"API Key":"Bearer Token",status:p.status,statusText:p.statusText,message:null==m?void 0:m.message,requestId:null===(s=null==m?void 0:m.metadata)||void 0===s?void 0:s.requestId,responseBody:f}),{...m,status:p.status,message:(null==m?void 0:m.message)||"Request failed"}}buildUrl(n){const i=this.clientConfig.getProxyConfig();return new URL("api"+n,i?i.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const n=this.clientConfig.getProxyConfig();return n?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...n.headers}:{}}async get(n,i){return this.request(n,{method:"GET",headers:null==i?void 0:i.headers})}async post(n,i){return this.request(n,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}}const z="@liquidcommerce/elements-sdk",M="LiquidCommerce Elements SDK",W="UNLICENSED",H="LiquidCommerce Team",G="2.6.0-beta.4",V="https://docs.liquidcommerce.co/elements-sdk",K={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},Q={url:"https://github.com/liquidcommerce/elements-sdk/issues"},Z="./dist/index.esm.js",X="./umd/elements.js",$="./dist/types/index.d.ts",tt="pnpm@10.0.0",et={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},nt=["dist","umd","docs","README.md","LICENSE"],it={access:"public",registry:"https://registry.npmjs.org/"},ot="module",rt=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],st={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"},at=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],ct={"@biomejs/biome":"2.3.5","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.1","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.3","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"},lt={node:">=22"},dt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},ht={name:z,description:M,license:W,author:H,version:G,homepage:V,repository:K,bugs:Q,module:Z,browser:X,types:$,packageManager:tt,exports:et,files:nt,publishConfig:it,type:ot,sideEffects:rt,scripts:st,keywords:at,devDependencies:ct,engines:lt,pnpm:dt};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(n=>{if("loading"!==document.readyState)return n(),void 0;document.addEventListener("DOMContentLoaded",()=>n())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(n){const i=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return i.some(i=>{const o=i.src;return o.includes("id="+n)})}isContainerInitialized(n){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(n)?window.dataLayer.some(n=>n&&"object"==typeof n&&("gtm.start"in n||"gtm.js"===n.event)):![]}async loadGTMScript(n){try{if(this.isContainerInitialized(n))return{success:!![],usingExistingGTM:!![],message:"Container "+n+" already loaded"};if(this.isContainerLoaded(n)){const i=await this.waitForContainerInit(n,1e4);return i?{success:!![],usingExistingGTM:!![],message:"Container "+n+" initialized"}:this.checkFallbackGTM(n)}return await this.injectGTMScript(n),{success:!![],usingExistingGTM:![],message:"Container "+n+" loaded successfully"}}catch(i){return this.checkFallbackGTM(n)}}waitForContainerInit(n,i){return new Promise(o=>{let s;const a=setInterval(()=>{this.isContainerInitialized(n)&&(clearInterval(a),clearTimeout(s),o(!![]))},100);s=setTimeout(()=>{clearInterval(a),o(![])},i)})}injectGTMScript(n){return new Promise((i,o)=>{const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+n,s.async=!![],s.crossOrigin="anonymous";let a=![];const c=setTimeout(()=>{a||(a=!![],this.isContainerInitialized(n)?i():o(new Error("GTM script timeout")))},15e3);s.onload=()=>{a||setTimeout(()=>{a||(a=!![],clearTimeout(c),this.isContainerInitialized(n)||window.dataLayer&&Array.isArray(window.dataLayer)?i():o(new Error("GTM script loaded but failed to initialize")))},500)},s.onerror=()=>{setTimeout(()=>{a||(a=!![],clearTimeout(c),this.isContainerLoaded(n)&&this.isContainerInitialized(n)?i():o(new Error("GTM script failed to load")))},100)},document.head.appendChild(s)})}checkFallbackGTM(n){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 n=window.dataLayer.some(n=>n&&"object"==typeof n&&("gtm.start"in n||"gtm.js"===n.event));if(n)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 "+n+" and no fallback available"}}processEventQueue(){const n=Date.now(),i=this.eventQueue.filter(i=>n-i.timestamp<3e4);for(const s of i)try{const n={event:s.eventName,...s.eventData};window.dataLayer.push(n)}catch(o){this.logger.error("Error processing queued event "+s.methodName,o)}this.eventQueue=[],i.length>0&&this.logger.info("Processed "+i.length+" queued GTM events")}getSendToTargets(){const n=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&n.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&n.push(this.partnerGTMId),n}async initialize(n){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(n),await this.initializationPromise}catch(i){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",i)}}async doInitialize(n){if(!(null==n?void 0:n.partnerName)||!(null==n?void 0:n.liquidCommerceGTMId))return;if(!n.enableLiquidCommerceGTM&&!n.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=n.partnerName,this.partnerGTMId=n.partnerGTMId,this.liquidCommerceGTMId=n.liquidCommerceGTMId,this.enablePartnerGTM=n.enablePartnerGTM,this.enableLiquidCommerceGTM=n.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...n)=>window.dataLayer.push(n));const i=n.enableLiquidCommerceGTM?await this.loadGTMScript(n.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!i.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+i.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(i.message),this.processEventQueue()}executeEvent(n,i,o){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),a={...o,...s.length>0&&{send_to:s},tenant_source:ht.description+" v"+ht.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:n,eventName:i,eventData:a,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const c={event:i,...a};window.dataLayer.push(c)}catch(s){this.logger.error("GTM "+n+" error",s)}}calculateValue(n){const i=n.reduce((n,i)=>n+(i.price||0)*(i.quantity||1),0);return Number.parseFloat(i.toFixed(2))}viewItem(n){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}viewItemList(n,i,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:i,item_list_name:o,items:n})}selectItem(n,i,o){this.executeEvent("selectItem","select_item",{item_list_id:i,item_list_name:o,items:[n]})}addToCart(n){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([n]),quantity:n.quantity||1,items:[n]})}viewCart(n){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(n),items:n})}removeFromCart(n){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}beginCheckout(n,i){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addShippingInfo(n,i){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addPaymentInfo(n,i,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(n),payment_type:i,coupon:o,items:n})}purchase(n){this.executeEvent("purchase","purchase",{transaction_id:n.transaction_id,value:n.value,currency:this.currency,tax:n.tax,shipping:n.shipping,coupon:n.coupon,items:n.items,subtotal:n.subtotal,total:n.total_before_discounts,discounts:n.discounts,gift_cards:n.gift_cards,net_total:n.net_total})}promoCodeAttempt(n){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:n})}promoCodeApplied(n,i){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:n,discount_amount:i})}promoCodeFailed(n,i){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:n,reason:i})}giftCardAttempt(n){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:n})}giftCardApplied(n,i){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:n,applied_amount:i})}giftCardFailed(n,i){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:n,reason:i})}addressUpdated(n){this.executeEvent("addressUpdated","address_updated",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,coordinates:n.coordinates})}addressFailed(n){this.executeEvent("addressFailed","address_failed",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,address_error_message:n.error})}productNoAvailability(n){this.executeEvent("productNoAvailability","product_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productSizeNoAvailability(n){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productFulfillmentNoAvailability(n){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,fulfillment_type:n.fulfillmentType,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:n,payload:i,next:o})=>{const s=performance.now();try{const a=o(),c=performance.now()-s;return this.logger.info("🏪 Store "+n+" ✓ "+c.toFixed(3)+"ms",i),a}catch(a){const o=performance.now()-s;throw this.logger.error("🏪 Store "+n+" ✗ "+o.toFixed(3)+"ms",{payload:i,error:a}),a}},this.performanceMiddleware=({action:n,next:i})=>{const o=performance.now(),s=i(),a=performance.now()-o;return a>16&&this.logger.warn('⚠️ Slow store operation "'+n+'": '+a.toFixed(2)+"ms"),s},this.state=L,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:n,isLocalStorageAvailable:i,persistedStore:o}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+n,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.logger.info("Store service initialized successfully",{userDeviceId:n,isLocalStorageAvailable:i,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(n){if(!n)return{...this.state};const i=n.split(".");let o=this.state;for(const s of i){if(null==o)return;o=o[s]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(n,i){return this.runWithMiddleware("set",{path:n,value:i},()=>{const o=this.get(n);return this.state=this.immutableSet(this.state,n,i),this.notifyListeners(n,i,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(n,i){const o=this.get(n),s=i(o);return this.set(n,s)}remove(n){return this.runWithMiddleware("remove",{path:n},()=>{const i=this.get(n);if(void 0===i)return this.logger.warn('No value found at path "'+n+'" to remove.'),![];const o=n.split(".");let s=this.state;const a=o.pop();for(const c of o){if(void 0===s[c])return this.logger.warn('Path "'+n+'" does not exist in the state.'),![];s=s[c]}if(Array.isArray(s))s=s.filter((n,i)=>i!==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 "'+n+'".'),![];{const{[a]:n,...i}=s;s=i}}return this.state=this.immutableSet(this.state,o.join("."),s),this.notifyListeners(n,void 0,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(n){return this.runWithMiddleware("batch",{updates:n},()=>{const i=[];if("function"==typeof n){const o=n(this.state);for(const[n,s]of Object.entries(o)){const o=this.get(n);i.push({path:n,oldValue:o,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,s)}}else for(const[o,s]of Object.entries(n)){const n=this.get(o);i.push({path:o,oldValue:n,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,s)}for(const{path:n,oldValue:o,newValue:s}of i)this.notifyListeners(n,s,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(n,i){const o=n;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(i),()=>{var n;null===(n=this.listeners.get(o))||void 0===n?void 0:n.delete(i)}}watchMany(n,i){const o=[];let s;const a=n.map(n=>this.watch(n,(a,c)=>{o.push({path:n,value:a,oldValue:c}),clearTimeout(s),s=setTimeout(()=>{o.length>0&&(i([...o]),o.length=0)},0)}));return()=>{for(const n of a)n()}}createProductInstance(n){const i="products."+n,o=this.get(i);return o?!![]:this.set(i,_)}removeProductInstance(n){const i=this.get("products"),{[n]:o,...s}=i;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(n,i,o){let s=0;const J=()=>{if(s>=this.middleware.length)return o();const a=this.middleware[s++];return a({action:n,payload:i,state:this.getState(),next:J})};return J()}immutableSet(n,i,o){const s=i.split(".");if(1===s.length){if(Array.isArray(n)){const i=[...n];return i[s[0]]=o,i}return{...n,[s[0]]:o}}const[a,...c]=s,l=n[a],p=Array.isArray(l)?[]:{};if(Array.isArray(n)){const i=[...n];return i[a]=this.immutableSet(l||p,c.join("."),o),i}return{...n,[a]:this.immutableSet(l||p,c.join("."),o)}}notifyListeners(n,i,o){const s=this.listeners.get(n);if(s)for(const p of s)try{p(i,o)}catch(c){this.logger.error('Error in store listener for path "'+n+'"',c)}const a=n.split(".");for(let p=a.length-1;p>0;p--){const n=a.slice(0,p).join("."),i=this.listeners.get(n);if(i){const s=this.get(n),c=a.slice(p).join("."),m=this.immutableSet(s,c,o);for(const o of i)try{o(s,m)}catch(l){this.logger.error('Error in store listener for parent path "'+n+'"',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 n;const i=this.get("address.id")||"",o=this.get("cart.id")||"";if(!i&&!o)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:i,cartId:o}),void 0;try{const s=null!==(n=this.clientConfig.get("userDeviceId"))&&void 0!==n?n:"not_defined";await this.api.setPersistedStore(s,{p:i,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:i,cartId:o})}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(ht){this.logger.error("Failed to clear localStorage entry",ht)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let n="";if(this.clientConfig.debuggingDisabled()){const i=this.get("address.id")||"",o=this.get("cart.id")||"";(i||o)&&(n=i+":"+o)}else n=this.getState();n&&localStorage.setItem(this.localStorageKey,"string"!=typeof n?JSON.stringify(n):n)}catch(n){this.logger.error("Failed to persist store state",n)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const i=localStorage.getItem(this.localStorageKey);if(!i)return;try{const n=JSON.parse(i);for(const[i,o]of Object.entries(n))this.set(i,o);return}catch(n){if(i.includes(":")){const[n,o]=i.split(":");if(void 0!==n){const i=await this.getAddressDataFromId(n);this.set("address",i)}return void 0!==o&&this.set("cart.id",o||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:i})}}catch(i){this.logger.error("Failed to load persisted state",i),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(n){try{if(void 0!==n.p){const i=await this.getAddressDataFromId(n.p);this.set("address",i)}void 0!==n.c&&this.set("cart.id",n.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:n.p,cartId:n.c})}catch(i){this.logger.error("Failed to load session data from DB persistence",i)}}async getAddressDataFromId(n){if(!n||""===n.trim())return P;try{const i=await this.api.getAddressDetails(n);return i&&0!==Object.keys(i).length?{id:n,formattedAddress:i.formattedAddress,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""},coordinates:{latitude:i.coordinates.latitude,longitude:i.coordinates.longitude}}:{...P,id:n}}catch(i){return{...P,id:n}}}}const ut=[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL,w.PRODUCT_OPTIONS,w.PRODUCT_INTERACTIONS,w.PRODUCT_DESCRIPTION,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST,w.PRODUCT_PRICE,w.PRODUCT_ADD_TO_CART_SECTION,w.PRODUCT_DRAWER,w.PRODUCT_LOADING,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.PRODUCT_LIST,w.PRODUCT_LIST_CARD,w.PRODUCT_LIST_CARD_LOADING,w.PRODUCT_LIST_FILTERS],pt=[w.ADDRESS_INPUT,w.ADDRESS_DISPLAY],mt=[w.CART,w.CART_RETAILER,w.CART_ITEM,w.CART_FOOTER,w.CART_ITEM_QUANTITY_PRICE,w.CART_RETAILER_SUBTOTAL,w.CART_PROMO_CODE,w.CART_HEADER,w.CART_BODY,w.CART_FULFILLMENT,w.BUTTONS_CART_OPEN],ft=[w.CHECKOUT,w.CHECKOUT_INFORMATION,w.CHECKOUT_STRIPE_HANDLER,w.CHECKOUT_STRIPE_FORM,w.CHECKOUT_PAYMENT,w.CHECKOUT_BILLING,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PROMO_CODE,w.CHECKOUT_GIFT_CARDS,w.CHECKOUT_AMOUNTS,w.CHECKOUT_ITEMS,w.CHECKOUT_COMPLETED,w.CHECKOUT_DELIVER_TO,w.CHECKOUT_DELIVER_TO_SUMMARY,w.CHECKOUT_BUYER,w.CHECKOUT_TIPS,w.CHECKOUT_PC_GC,w.CHECKOUT_ITEM,w.CHECKOUT_ITEM_QUANTITY,w.CHECKOUT_PLACE_ORDER_BUTTON,w.CHECKOUT_HEADER,w.CHECKOUT_PRESALE_COUNTDOWN,w.CHECKOUT_PRESALE_EXPIRED,w.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(n,i="swap"){if(!n||0===n.length)return;const o=[...this.defaultFontFamilies,...n],s=o.map(n=>{const i=encodeURIComponent(n.name);return"family="+i+":wght@"+n.weights.join(";")}).join("&"),a="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+a,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(n,i="swap"){const o=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(n,i),o&&o.remove()}injectGoogleFontsResourceHints(){const n=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),i=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!n){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.googleapis.com",document.head.appendChild(n)}if(!i){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.gstatic.com",n.crossOrigin="",document.head.appendChild(n)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const n=document.createElement("link");n.rel="stylesheet",n.href=this.googleFontsUrl,n.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(n)}}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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-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: '+D.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: "+D.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 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: "+D.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: "+D.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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: "+D.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 gt={"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"},vt={backgroundColor:"--product-background-color"},yt={backgroundColor:"--cart-background-color"},bt={backgroundColor:"--address-background-color"},xt={backgroundColor:"--checkout-background-color"},wt={global:gt,product:vt,cart:yt,address:bt,checkout:xt};function getCSSVariableMapping(n){return wt[n]||{}}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(n,i){const o={},s=getCSSVariableMapping(i);for(const[a,c]of Object.entries(s)){const i=this.getValueByPath(n,a);void 0!==i&&this.isCSSValue(i)&&(o[c]=i,this.isColorVariable(c,i)&&this.generateOpacityVariants(o,c,i))}return o}extractVariablesFromPartialTheme(n,i){const o={},s=getCSSVariableMapping(i);for(const[a,c]of Object.entries(s))if(this.hasValueAtPath(n,a)){const i=this.getValueByPath(n,a);void 0!==i&&this.isCSSValue(i)&&(o[c]=i,this.isColorVariable(c,i)&&this.generateOpacityVariants(o,c,i))}return o}generateCSSVariablesString(n){return Object.entries(n).map(([n,i])=>" "+n+": "+i+";").join("\n")}updateCSSVariablesInStylesheet(n,i){if(0!==Object.keys(i).length)try{const o=this.findOrCreateRule(n);for(const[n,s]of Object.entries(i))o.style.setProperty(n,String(s))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(n,i){return i.split(".").reduce((n,i)=>n&&void 0!==n[i]?n[i]:void 0,n)}hasValueAtPath(n,i){const o=i.split(".");let s=n;for(const a of o){if(null==s||!(a in s))return![];s=s[a]}return!![]}findOrCreateRule(n){const i=":host";for(const s of Array.from(n.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===i)return s;const o=n.insertRule(i+" {}");return n.cssRules[o]}isCSSValue(n){if("string"==typeof n){if(""===n.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(n.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(n))return!![];if(/^[a-z-]+$/.test(n))return!![]}return"number"==typeof n}generateOpacityVariants(n,i,o){for(const s of this.opacityLevels){const a=i+"-"+s.suffix,c=this.addOpacityToHexColor(o,s.value);c&&(n[a]=c)}}isColorVariable(n,i){if("string"!=typeof i)return![];const o=n.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(i);return o&&s}addOpacityToHexColor(n,i){if(!n.startsWith("#"))return null;let o=n.slice(1);if(3===o.length&&(o=o.split("").map(n=>n+n).join("")),6!==o.length)return null;const s=Math.round(255*i),a=s.toString(16).padStart(2,"0");return"#"+o+a}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(n){return this.styleSheets.get(n)}generateSpecificStylesheet(n,i){const o=this.cssProcessor.extractVariablesFromTheme(i,n),s=this.cssProcessor.generateCSSVariablesString(o),a=this.getStylesheetStyles(n).join("\n\n"),c=0===s.length?"":":host { "+s+" }",l=("\n "+c+"\n\n "+a+"\n ").trim();this.createStylesheet(n,l)}createStylesheet(n,i){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(i),this.styleSheets.set(n,o)}else this.styleSheets.set(n,i)}catch(ht){this.styleSheets.set(n,i)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}updateVariablesInStylesheet(n,i,o){const s=this.styleSheets.get(n);if(s&&"string"!=typeof s){const n=this.cssProcessor.extractVariablesFromPartialTheme(i,o);this.cssProcessor.updateCSSVariablesInStylesheet(s,n)}}getStylesheetStyles(n){switch(n){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(n){this.data=n,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(n){var i,o;const s=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),n),this.data.global.layout.showPoweredBy=s,((null===(i=n.theme)||void 0===i?void 0:i.headingFont)||(null===(o=n.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",n.theme,"global")}updateProductComponent(n){this.data.product=this.deepMerge(this.getConfigs("product"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",n.theme,"product")}updateAddressComponent(n){this.data.address=this.deepMerge(this.getConfigs("address"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",n.theme,"address")}updateCartComponent(n){this.data.cart=this.deepMerge(this.getConfigs("cart"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",n.theme,"cart")}updateCheckoutComponent(n){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",n.theme,"checkout")}getConfigs(n){return"all"===n?this.data:this.data[n]}getComponentConfig(n){return-1!==ut.indexOf(n)?this.getConfigs("product"):-1!==pt.indexOf(n)?this.getConfigs("address"):-1!==mt.indexOf(n)?this.getConfigs("cart"):-1!==ft.indexOf(n)?this.getConfigs("checkout"):void 0}getStylesheet(n){const i=this.getBaseStylesheets();if(n===w.DRAWER){const n=[...i],o=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),a=this.stylesheetGenerator.getStylesheet("checkout"),c=this.stylesheetGenerator.getStylesheet("address");return o&&n.push(o),s&&n.push(s),a&&n.push(a),c&&n.push(c),n}let o;if(pt.includes(n)||n===w.ADDRESS)o="address";else if(ut.includes(n)||n===w.PRODUCT)o="product";else if(mt.includes(n)||n===w.CART)o="cart";else{if(!ft.includes(n)&&n!==w.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+n+", returning base stylesheets only."),i;o="checkout"}const s=this.stylesheetGenerator.getStylesheet(o);return s?[...i,s]:i}getBaseStylesheets(){const n=[],i=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return i&&n.push(i),o&&n.push(o),n}deepMerge(n,i){const o={...n};for(const s in i)null!==i[s]&&void 0!==i[s]&&("object"!=typeof i[s]||Array.isArray(i[s])||"object"!=typeof n[s]||Array.isArray(n[s])?o[s]=i[s]:o[s]=this.deepMerge(n[s],i[s]));return o}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const n=this.store.get("address");if(n.address.one&&n.coordinates.longitude&&n.coordinates.latitude)return{coordinates:n.coordinates,address:n.address}}}const includeCartEvents=(n,i)=>n.filter(n=>i.includes(n.type)),excludeCartEvents=(n,i)=>n.filter(n=>!i.includes(n.type)),eventsForCart=n=>excludeCartEvents(n,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=n=>{const i=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],o=includeCartEvents(n,i);return o.length>0},includeCheckoutEvents=(n,i)=>n.filter(n=>i.includes(n.type)),eventsForCheckout=n=>includeCheckoutEvents(n,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=n=>includeCheckoutEvents(n,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=n=>includeCheckoutEvents(n,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=n=>{const i=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return n.some(n=>i.includes(n.type))},Ct={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},kt={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=n=>n.map(n=>({type:n.type,message:n.message,level:Ct[n.type]||"error"})),transformCheckoutEventsRaw=n=>n.map(n=>({type:n.type,message:n.message,level:kt[n.type]||"error"})),transformEventsForCart=n=>{const i=eventsForCart(n);return transformCartEventsRaw(i)},transformEventsForCheckout=n=>{const i=eventsForCheckout(n);return transformCheckoutEventsRaw(i)},transformPromoCodeCheckoutEvents=n=>{const i=promoCodeCheckoutEvents(n);return transformCheckoutEventsRaw(i)},transformGiftCardCheckoutEvents=n=>{const i=giftCardCheckoutEvents(n);return transformCheckoutEventsRaw(i)};function buildCartItemStore(n){return{id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes,loading:![],updating:![],error:null}}function buildCartTotals(n){return{subtotal:n.subtotal||0,total:n.total||0,shippingFee:n.shippingFee||0,platformFee:n.platformFee||0,giftCardTotal:n.giftCardTotal||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,discounts:n.discounts||0,quantity:n.quantity||0}}function buildRetailerStore(n){var i;return{id:n.id,name:n.name,platformFee:n.platformFee||0,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,address:n.address,total:n.total||0,deliveryFee:n.deliveryFee||0,engravingFee:n.engravingFee||0,fulfillments:(null===(i=n.fulfillments)||void 0===i?void 0:i.map(n=>n.id))||[]}}function buildFulfillmentStore(n,i){return{id:n.id,canEngrave:n.canEngrave||![],type:n.type,fees:n.fees,expectation:n.expectation,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,items:n.items||[],retailerId:i.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(n,i){var o;const s=i.formattedAddress?i:P,a={};for(const c in n.items||{}){const i=n.items[c];a[c]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,salsifyGrouping:i.salsifyGrouping,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price||0,quantity:i.quantity||0,maxQuantity:i.maxQuantity||0,unitPrice:i.unitPrice||0,mainImage:i.mainImage||"",attributes:i.attributes||{}}}return{id:n.id,promoCode:(null===(o=n.promoCode)||void 0===o?void 0:o.code)||"",items:a,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.latitude,longitude:s.coordinates.longitude}},amounts:{deliveryFee:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:0,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},itemCount:Object.values(a||{}).reduce((n,i)=>n+(i.quantity||0),0),updatedAt:n.updatedAt,createdAt:n.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(n,i=![]){var o,s,a,c,l,p;const m=this.store.get("cart");for(const g of Object.keys(m.items||{}))this.store.remove("cart.items."+g);for(const g of Object.keys(m.retailers||{}))this.store.remove("cart.retailers."+g);for(const g of Object.keys(m.fulfillments||{}))this.store.remove("cart.fulfillments."+g);const f={"cart.id":n.id,"cart.error":null,"cart.totals":buildCartTotals(n),"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(s=null===(o=n.attributes)||void 0===o?void 0:o.promoCode)||void 0===s?void 0:s.value)?{code:n.attributes.promoCode.value.toUpperCase(),discountAmount:n.attributes.promoCode.discount||0,error:null}:null};if((null===(a=n.items)||void 0===a?void 0:a.length)>0)for(const g of n.items)f["cart.items."+g.id]=buildCartItemStore(g);if((null===(c=n.retailers)||void 0===c?void 0:c.length)>0)for(const g of n.retailers)if(f["cart.retailers."+g.id]=buildRetailerStore(g),(null===(l=g.fulfillments)||void 0===l?void 0:l.length)>0)for(const n of g.fulfillments)f["cart.fulfillments."+n.id]=buildFulfillmentStore(n,g);if((null===(p=n.events)||void 0===p?void 0:p.length)>0&&(f["cart.events"]=transformEventsForCart(n.events||[])),this.store.batch(f),i){const n=this.store.get("cart"),i=this.store.get("address");this.pubSub.publishAction(y.CART_LOADED,cartDataForEventFromStore(n,i))}}async loadCart(){try{this.store.set("cart.loading",!![]);const n=this.store.get("cart"),i=await this.api.getCartData(n.id);this.syncCartFromResponse(i,!![]),i.id!==n.id&&await this.store.persist()}catch(n){const i=(null==n?void 0:n.message)||"Failed to load cart";this.store.set("cart.error",i),this.pubSub.publishAction(y.CART_FAILED,{message:i}),this.logger.error("Load cart failed",n)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(n,i){const o={type:n,data:i||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),n===w.CART&&this.pubSub.publishAction(y.CART_OPENED,!![]),n===w.CHECKOUT&&this.pubSub.publishAction(y.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const n=this.store.get("ui.drawer.contentConfig");(null==n?void 0:n.type)===w.CART&&this.pubSub.publishAction(y.CART_CLOSED,!![]),(null==n?void 0:n.type)===w.CHECKOUT&&this.pubSub.publishAction(y.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(n){var i,o,s,a,c,l,p,m,f,g,v,b;try{this.store.set("checkout.loading",!![]);const w=n||this.store.get("cart.id"),k=this.store.get("cart");if(0===(null===(i=Object.values(k.items||{}))||void 0===i?void 0:i.length)&&!n)return;const S=this.themeProvider.getConfigs("checkout"),I={canEmail:S.layout.emailOptIn.checked,canSms:S.layout.smsOptIn.checked};if(!w)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const T={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},D=await this.api.prepareCheckout({cartId:w,marketingPreferences:I});if((null===(o=D.retailers)||void 0===o?void 0:o.length)>0)for(const n of D.retailers)for(const i of n.fulfillments)i.type===C.ON_DEMAND&&(T["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal});if((null===(s=D.items)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.items");for(const n of D.items){const i=D.retailers.find(i=>i.id===n.retailerId),o=i.fulfillments.find(i=>i.id===n.fulfillmentId);T["checkout.items."+n.cartItemId]=this.buildCheckoutItemStore(n,i,o)}}D.isPresaleLocked&&D.presaleExpiresAt&&(T["checkout.presale"]={isLocked:D.isPresaleLocked,expiresAt:D.presaleExpiresAt}),T["checkout.token"]=D.token,T["checkout.cartId"]=D.cartId,T["checkout.isGift"]=D.isGift,T["checkout.giftRecipientForm.data"]={firstName:((null===(c=null===(a=D.giftOptions)||void 0===a?void 0:a.recipient)||void 0===c?void 0:c.name)||"").split(" ")[0],lastName:((null===(p=null===(l=D.giftOptions)||void 0===l?void 0:l.recipient)||void 0===p?void 0:p.name)||"").split(" ")[1],email:(null===(f=null===(m=D.giftOptions)||void 0===m?void 0:m.recipient)||void 0===f?void 0:f.email)||"",phone:(null===(v=null===(g=D.giftOptions)||void 0===g?void 0:g.recipient)||void 0===v?void 0:v.phone)||"",message:(null===(b=D.giftOptions)||void 0===b?void 0:b.message)||""},T["checkout.paymentForm.billingSameAsShipping"]=D.billingSameAsShipping,T["checkout.marketingPreferences"]=D.marketingPreferences,T["checkout.giftCards"]=D.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),T["checkout.promoCode"]=D.promoCode.value?{code:D.promoCode.value,discountAmount:D.promoCode.discount}:null,T["checkout.amounts"]=D.amounts,T["checkout.events"]=D.events||[],this.store.batch(T),this.pubSub.publishAction(y.CHECKOUT_LOADED,{cartId:D.cartId})}catch(w){this.store.set("checkout.error",w.message),this.pubSub.publishAction(y.CHECKOUT_FAILED,{message:w.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(n){const i=this.store.get("checkout.isGift"),o=null!=n?n:!i,s={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":o,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":s}),this.pubSub.publishAction(y.CHECKOUT_IS_GIFT_TOGGLED,{isActive:o})}async toggleBillingSameAsShipping(n){const i=this.store.get("checkout.paymentForm.billingSameAsShipping"),o=null!=n?n:!i;this.store.set("checkout.paymentForm.billingSameAsShipping",o),this.pubSub.publishAction(y.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:o})}async toggleMarketingPreferences(n,i){const o=this.store.get("checkout.marketingPreferences."+n),s=null!=i?i:!o,a=this.store.get("checkout.marketingPreferences"),c=this.dataForCheckoutPrepare({marketingPreferences:{...a,[n]:s}}),l=await this.api.prepareCheckout(c);this.store.set("checkout.marketingPreferences",l.marketingPreferences),this.pubSub.publishAction(y.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:n,isActive:s})}async getPaymentSession(){try{const n=this.store.get("cart.id"),i=await this.api.getPaymentSession({cartId:n});this.store.batch({"checkout.paymentForm.paymentSession":{key:i.key,secret:i.secret},"checkout.paymentForm.paymentMethod":null})}catch(n){throw this.store.batch({"checkout.error":n.message,"checkout.loading":![]}),n}}async confirmPaymentSession(n,i){var o,s,a,c;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const l=await this.api.confirmPaymentSession(n,i);return l&&l.id&&l.card&&l.card.brand&&l.card.last4&&l.card.expMonth&&l.card.expYear?{id:l.id,card:{brand:null===(o=l.card)||void 0===o?void 0:o.brand,last4:null===(s=l.card)||void 0===s?void 0:s.last4.toString(),expMonth:null===(a=l.card)||void 0===a?void 0:a.expMonth.toString(),expYear:null===(c=l.card)||void 0===c?void 0:c.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(l){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(n){var i;try{this.googleTagManager.promoCodeAttempt(n);const o=this.dataForCheckoutPrepare({}),s=await this.api.prepareCheckout({...o,promoCode:n}),a=0!==s.amounts.discounts,c=null===(i=transformPromoCodeCheckoutEvents(s.events||[]))||void 0===i?void 0:i[0];if(!a)return this.store.set("checkout.promoCodeError",c?c.message:'Code "'+n+'" does not exist'),this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_FAILED,{error:(null==c?void 0:c.message)||'Code "'+n+'" does not exist'}),this.googleTagManager.promoCodeFailed(n,(null==c?void 0:c.message)||"not_applied"),void 0;this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:s.amounts.discounts,newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(n,s.amounts.discounts),await this.partialLoadCheckout({response:s})}catch(o){const i=(null==o?void 0:o.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",i),this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_FAILED,{error:i}),this.googleTagManager.promoCodeFailed(n,i),o}}async removePromoCode(){var n,i;try{const o=this.dataForCheckoutPrepare({}),s=(null===(i=null===(n=this.store.get("checkout"))||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.code)||"",a=await this.api.prepareCheckout({...o,promoCode:""});if(0!==a.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:a.amounts.total}),this.googleTagManager.promoCodeApplied(s,0),await this.partialLoadCheckout({response:a})}catch(o){const n=(null==o?void 0:o.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",n);const i=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_FAILED,{error:n}),i&&this.googleTagManager.promoCodeFailed(i,n),o}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(ht){const i=ht.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),ht}}async applyGiftCard(n){var i;const o=n.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(o);const n=this.dataForCheckoutPrepare({}),s=n.giftCards||[],a=await this.api.prepareCheckout({...n,giftCards:[...s,o]}),c=null===(i=transformGiftCardCheckoutEvents(a.events||[]))||void 0===i?void 0:i[0],l=hasAnyRetailerGiftCardRestriction(a.events||[]);if(c&&(this.store.set("checkout.giftCardError",c.message),!l))return;const p=a.giftCards.find(n=>n.code.toLowerCase()===o.toLowerCase());if(!p)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_FAILED,{error:(null==c?void 0:c.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(o,(null==c?void 0:c.message)||"not_applied"),void 0;this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(o,p.applied),await this.partialLoadCheckout({response:a})}catch(s){const n=(null==s?void 0:s.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_FAILED,{error:n}),this.googleTagManager.giftCardFailed(o,n),s}}async removeGiftCard(n){var i;const o=n.trim().toUpperCase();try{const n=this.dataForCheckoutPrepare({}),s=(null===(i=n.giftCards)||void 0===i?void 0:i.filter(n=>n.toLowerCase()!==o.toLowerCase()))||[],a=await this.api.prepareCheckout({...n,giftCards:s}),c=a.giftCards.find(n=>n.code.toLowerCase()===o.toLowerCase());if(c)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(o,0),await this.partialLoadCheckout({response:a})}catch(s){const n=(null==s?void 0:s.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_FAILED,{error:n}),this.googleTagManager.giftCardFailed(o,n),s}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(ht){throw this.store.set("checkout.error",(null==ht?void 0:ht.message)||"Failed to clear gift card error. Please try again."),ht}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(w.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(n,i){var o,s,a;try{this.store.set("checkout.items."+n+".updating",!![]);const c=this.store.get("checkout.cartId"),l=this.store.get("checkout.items."+n);if(!l)throw new SDKError("Item not found");const p=l.quantity,m=l.quantity+i;if(m<1)return this.removeItem(n,!![]);const f={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:m},g=(null===(a=null===(s=null===(o=l.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];g.length>0&&(f.engravingLines=g);const v=await this.api.updateCart({id:c,items:[f],loc:this.getLocation()});this.pubSub.publishAction(i>0?y.CHECKOUT_ITEM_QUANTITY_INCREASE:y.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:l.cartItemId,quantity:m,previousQuantity:p});const b=splitCategoryPath(l.catPath),w={item_id:l.liquidId,item_name:l.name,item_brand:l.brand,item_size:l.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,quantity:Math.abs(i),price:centToDollar(l.unitPrice||0),upc:l.upc,grouping_id:l.salsifyGrouping,product_id:l.liquidId};i<0?this.googleTagManager.removeFromCart(w):i>0&&this.googleTagManager.addToCart(w),await this.partialLoadCheckout({cartResponse:v})}catch(c){throw this.store.set("checkout.items."+n+".error",c.message),c}finally{this.store.set("checkout.items."+n+".updating",![])}}async removeItemEngraving(n){var i,o,s;try{const a=this.store.get("checkout.items."+n);if(!a)throw new SDKError("Item not found in checkout");if(!(null===(i=a.attributes)||void 0===i?void 0:i.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:n}),void 0;const c=(null===(s=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[],l={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},p=this.store.get("checkout.cartId"),m=await this.api.updateCart({id:p,items:[l],loc:this.getLocation()});this.pubSub.publishAction(y.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:c}),await this.partialLoadCheckout({cartResponse:m})}catch(a){throw this.store.set("checkout.items."+n+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:n,error:a.message}),a}}async removeItem(n,i){var o,s,a;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("checkout.items."+n+".updating",!![]);const c=this.store.get("checkout.cartId"),l=this.store.get("checkout.items."+n);if(!l)throw new SDKError("Item not found");const p={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:0},m=(null===(a=null===(s=null===(o=l.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];m.length>0&&(p.engravingLines=m);const f=await this.api.updateCart({id:c,items:[p],loc:this.getLocation()});this.store.remove("checkout.items."+n),this.pubSub.publishAction(y.CHECKOUT_ITEM_REMOVED,{cartItemId:l.cartItemId}),await this.partialLoadCheckout({cartResponse:f})}catch(c){throw this.store.set("checkout.items."+n+".error",c.message),c}}async updateTips(n){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",n);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),o=Object.values(i||{}).map(i=>{const o=Math.round(i.subtotal*n/100);return{fulfillmentId:i.fulfillmentId,tip:o}}),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(y.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update tips. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(n,i){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo"),s=Object.values(o||{}).map(o=>({fulfillmentId:o.fulfillmentId,tip:o.fulfillmentId===n?i:o.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(a),this.pubSub.publishAction(y.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}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(n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),o=Object.values(i||{}).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===n?0:i.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(y.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to remove fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:n,deliveryInstructions:i,customerData:o}){var s,a,c,l,p,m,f,g,v;try{this.store.set("checkout.customerForm.isSaving",!![]);const b=this.store.get("checkout.customerForm.data"),w=this.store.get("checkout.isGift"),C=this.dataForCheckoutPrepare({shippingAddressTwo:n,deliveryInstructions:i||void 0,customer:{...b,...o},isGift:w}),k=await this.api.prepareCheckout(C),S={id:(null===(s=k.customer)||void 0===s?void 0:s.id)||"",firstName:(null===(a=k.customer)||void 0===a?void 0:a.firstName)||"",lastName:(null===(c=k.customer)||void 0===c?void 0:c.lastName)||"",email:(null===(l=k.customer)||void 0===l?void 0:l.email)||"",phone:(null===(p=k.customer)||void 0===p?void 0:p.phone)||"",birthDate:(null===(f=null===(m=k.customer)||void 0===m?void 0:m.birthDate)||void 0===f?void 0:f.slice(0,10))||"",company:(null===(g=k.customer)||void 0===g?void 0:g.company)||""};this.store.batch({"checkout.customerForm.data":S,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":k.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(y.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const I=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(I.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],(null===(v=I.promoCode)||void 0===v?void 0:v.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:n,deliveryInstructions:i,...o}){var s,a,c,l,p,m;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const f=this.dataForCheckoutPrepare({shippingAddressTwo:n,deliveryInstructions:i||void 0,isGift:!![],giftRecipient:o}),g=await this.api.prepareCheckout(f),v={firstName:(null==o?void 0:o.firstName)||"",lastName:(null==o?void 0:o.lastName)||"",email:(null===(a=null===(s=g.giftOptions)||void 0===s?void 0:s.recipient)||void 0===a?void 0:a.email)||"",phone:(null===(l=null===(c=g.giftOptions)||void 0===c?void 0:c.recipient)||void 0===l?void 0:l.phone)||"",message:(null===(p=g.giftOptions)||void 0===p?void 0:p.message)||""};this.store.batch({"checkout.giftRecipientForm.data":v,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":g.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(y.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const b=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(b.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],(null===(m=b.promoCode)||void 0===m?void 0:m.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:n,paymentSession:i}){var o,s,a;try{this.store.set("checkout.paymentForm.isSaving",!![]);const c=this.store.get("checkout"),l={},p=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let m=null,f=null;if(p||i){const n=await this.confirmPaymentSession((null==i?void 0:i.confirmationTokenId)||"",(null==i?void 0:i.setupIntentId)||"");if(!n)throw new Error("Failed to confirm payment method");m=n.card,f=n.id}const g=this.dataForCheckoutPrepare({billingData:n,paymentMethodId:f||void 0}),v=await this.api.prepareCheckout(g);v.payment&&m&&(l["checkout.paymentForm.paymentMethod"]={id:v.payment,card:m}),n&&v.billingAddress&&(l["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||""},this.pubSub.publishAction(y.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),l["checkout.paymentForm.isEditing"]=![],l["checkout.paymentForm.isValid"]=!![],this.store.batch(l);const b=l["checkout.paymentForm.paymentMethod"]||(null===(o=c.paymentForm)||void 0===o?void 0:o.paymentMethod),w=(null===(s=null==b?void 0:b.card)||void 0===s?void 0:s.brand)?b.card.brand+" ****"+b.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(c.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}}),w,(null===(a=c.promoCode)||void 0===a?void 0:a.code)||void 0)}catch(c){throw this.logger.error("Failed to save payment form",c),this.store.set("checkout.error",c.message),c}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var n,i,o,s,a,c;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(y.CHECKOUT_SUBMIT_STARTED,{started:!![]});const l=this.store.get("checkout"),p=await this.api.checkoutComplete({token:l.token}),m=p.legacyOrderNumber||p.referenceId||"N/A";l.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(w.CHECKOUT_COMPLETED,{orderNumber:m,orderTotal:l.amounts.total,cardLast4:null===(o=null===(i=null===(n=null==l?void 0:l.paymentForm)||void 0===n?void 0:n.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4,customerEmail:l.customerForm.data.email,giftRecipientEmail:(null===(a=null===(s=null==l?void 0:l.giftRecipientForm)||void 0===s?void 0:s.data)||void 0===a?void 0:a.email)||null}),this.pubSub.publishAction(y.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:m,orderTotal:l.amounts.total}),this.googleTagManager.purchase({transaction_id:m,tax:centToDollar(l.amounts.tax||0),shipping:centToDollar(l.amounts.shipping||0),coupon:(null===(c=l.promoCode)||void 0===c?void 0:c.code)||void 0,items:[...Object.values(l.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],value:centToDollar(l.amounts.total),subtotal:centToDollar(l.amounts.subtotal),total_before_discounts:centToDollar(l.amounts.subtotal+l.amounts.tax+l.amounts.shipping+l.amounts.delivery+l.amounts.platform+l.amounts.service),discounts:centToDollar(l.amounts.discounts),gift_cards:centToDollar(l.amounts.giftCards||0),net_total:centToDollar(l.amounts.total)})}catch(l){const n=(null==l?void 0:l.message)||"Checkout complete failed";this.store.batch({"checkout.error":n}),this.pubSub.publishAction(y.CHECKOUT_SUBMIT_FAILED,{message:n})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(n){var i;const o={"checkout.amounts":n.amounts,"checkout.warning":n.warning,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.error":null};if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0)for(const s of n.retailers)for(const n of s.fulfillments)n.type===C.ON_DEMAND&&(o["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:s.id,retailerName:s.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});this.store.batch(o)}async partialLoadCheckout(n){var i,o,s,a,c;try{let l;if(this.store.set("checkout.updating",!![]),(null==n?void 0:n.cartResponse)?this.commonCommands.syncCartFromResponse(n.cartResponse):await this.commonCommands.loadCart(),null==n?void 0:n.response)l=n.response;else{const o=null!==(i=null==n?void 0:n.cartId)&&void 0!==i?i:this.store.get("checkout.cartId");if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const s=this.dataForCheckoutPrepare({});l=await this.api.prepareCheckout({...s,cartId:o})}const p={"checkout.token":l.token,"checkout.events":transformEventsForCheckout(l.events||[]),"checkout.amounts":l.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":l.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),"checkout.promoCode":(null===(s=null===(o=null==l?void 0:l.promoCode)||void 0===o?void 0:o.value)||void 0===s?void 0:s.trim())?{code:l.promoCode.value,discountAmount:l.promoCode.discount}:null};if((null===(a=l.retailers)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const n of l.retailers)for(const i of n.fulfillments)i.type===C.ON_DEMAND&&(p["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal})}if((null===(c=l.items)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.items");for(const n of l.items){const i=l.retailers.find(i=>i.id===n.retailerId),o=i.fulfillments.find(i=>i.id===n.fulfillmentId);p["checkout.items."+n.cartItemId]=this.buildCheckoutItemStore(n,i,o)}}this.store.batch(p)}catch(l){const n=(null==l?void 0:l.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(y.CHECKOUT_FAILED,{message:n}),l}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:n,giftRecipient:i,billingData:o,marketingPreferences:s,shippingAddressTwo:a,deliveryInstructions:c,deliveryTips:l,paymentMethodId:p,isGift:m}){var f,g,v,y,b,w,C,k,S,I,T,D,A,P,_,N,F,O,L,z,M,W,H,G,V,K;const Q=this.store.get("checkout"),Z=null!==(g=null===(f=Q.paymentForm)||void 0===f?void 0:f.billingSameAsShipping)&&void 0!==g?g:!![],X=void 0!==m?m:Q.isGift,$=i?!![]:null!==(y=null===(v=Q.giftRecipientForm)||void 0===v?void 0:v.isValid)&&void 0!==y?y:![],tt=X&&$,et={cartId:Q.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:a,billingSameAsShipping:Z,marketingPreferences:s||Q.marketingPreferences,promoCode:(null===(b=Q.promoCode)||void 0===b?void 0:b.code)||void 0,isGift:tt,giftCards:(null===(w=null==Q?void 0:Q.giftCards)||void 0===w?void 0:w.map(n=>n.code))||[],deliveryTips:l||Object.values(Q.onDemandFulfillmentTipInfo||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.tip}))};p?et.payment=p:(null===(k=null===(C=Q.paymentForm)||void 0===C?void 0:C.paymentMethod)||void 0===k?void 0:k.id)&&(et.payment=Q.paymentForm.paymentMethod.id);const nt=c||Q.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(Q.items||{}).map(n=>({fulfillmentId:n.fulfillmentId,instructions:nt}))),et.customer=n?{...n,id:(null==n?void 0:n.id)||void 0}:(null===(I=null===(S=null==Q?void 0:Q.customerForm)||void 0===S?void 0:S.data)||void 0===I?void 0:I.email)?{id:(null===(D=null===(T=Q.customerForm)||void 0===T?void 0:T.data)||void 0===D?void 0:D.id)||void 0,firstName:null===(P=null===(A=Q.customerForm)||void 0===A?void 0:A.data)||void 0===P?void 0:P.firstName,lastName:null===(N=null===(_=Q.customerForm)||void 0===_?void 0:_.data)||void 0===N?void 0:N.lastName,email:null===(O=null===(F=Q.customerForm)||void 0===F?void 0:F.data)||void 0===O?void 0:O.email,phone:null===(z=null===(L=Q.customerForm)||void 0===L?void 0:L.data)||void 0===z?void 0:z.phone,birthDate:null===(W=null===(M=Q.customerForm)||void 0===M?void 0:M.data)||void 0===W?void 0:W.birthDate,company:null===(G=null===(H=Q.customerForm)||void 0===H?void 0:H.data)||void 0===G?void 0:G.company}:void 0,tt){const n=i||(null===(V=Q.giftRecipientForm)||void 0===V?void 0:V.data);n&&(et.giftOptions={recipient:{name:(n.firstName||"")+" "+(n.lastName||""),email:n.email||"",phone:n.phone||""},message:n.message||""})}if(!Z)if(o)et.billingAddress={firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone,company:o.company,one:o.addressOne,two:o.addressTwo,city:o.city,state:o.state,zip:o.zipCode,country:"US"};else{const n=null===(K=Q.paymentForm)||void 0===K?void 0:K.data;et.billingAddress={firstName:null==n?void 0:n.firstName,lastName:null==n?void 0:n.lastName,email:null==n?void 0:n.email,phone:null==n?void 0:n.phone,company:null==n?void 0:n.company,one:null==n?void 0:n.addressOne,two:null==n?void 0:n.addressTwo,city:null==n?void 0:n.city,state:null==n?void 0:n.state,zip:null==n?void 0:n.zipCode,country:"US"}}return et}buildCheckoutItemStore(n,i,o){return{liquidId:n.liquidId,variantId:n.variantId,cartItemId:n.cartItemId,retailerId:n.retailerId,fulfillmentId:n.fulfillmentId,salsifyGrouping:n.salsifyGrouping,name:n.name,catPath:n.catPath,volume:n.volume,uom:n.uom,proof:n.proof,abv:n.abv,containerType:n.containerType,container:n.container,size:n.size,pack:n.pack,packDesc:n.packDesc,mainImage:n.mainImage,brand:n.brand,partNumber:n.partNumber,upc:n.upc,sku:n.sku,price:n.price,unitPrice:n.unitPrice,quantity:n.quantity,unitTax:n.unitTax,bottleDeposits:n.bottleDeposits,attributes:n.attributes,retailerName:i.name,expectationDetail:o.expectation.detail,loading:![],updating:![],error:null}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async n=>{n===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(n,i){try{this.store.set("cart.items."+n+".updating",!![]);const o=this.store.get("cart.id"),s=this.store.get("cart.items."+n);if(!s)throw this.logger.error("Cart item not found: "+n+" - cannot update quantity by "+i),new SDKError("Item not found");const a=s.quantity+i;if(a<1)return this.removeItem(n,!![]);const c=this.buildItemUpdate(s,a),l=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[n]),this.updateFulfillment(s.fulfillmentId,l),this.syncRetailersFromApiResponse(l),this.syncCartMetaFromApiResponse(l),this.pubSub.publishAction(i<0?y.CART_ITEM_QUANTITY_DECREASE:y.CART_ITEM_QUANTITY_INCREASE,{id:s.id,quantity:a,previousQuantity:s.quantity});const p=splitCategoryPath(s.catPath),m={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:Math.abs(i),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};i<0?this.googleTagManager.removeFromCart(m):i>0&&this.googleTagManager.addToCart(m)}catch(o){throw this.store.set("cart.items."+n+".error",o.message),this.logger.error("Failed to update item quantity",o),o}finally{this.store.set("cart.items."+n+".updating",![])}}async removeItem(n,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("cart.items."+n+".updating",!![]);const o=this.store.get("cart.id"),s=this.store.get("cart.items."+n);if(!s)throw new SDKError("Item not found");const a={itemId:s.id,fulfillmentId:s.fulfillmentId,retailerId:s.retailerId},c=this.buildItemUpdate(s,0),l=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[]),this.cleanupAfterItemRemoval(a,l),this.syncCartMetaFromApiResponse(l),this.pubSub.publishAction(y.CART_ITEM_REMOVED,{id:s.id});const p=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(o){throw this.store.set("cart.items."+n+".error",o.message),this.logger.error("Failed to remove item",o),o}}async updateItemEngraving(n,i){var o,s,a;try{const c=this.store.get("cart"),l=null===(o=c.items)||void 0===o?void 0:o[n];if(!l)throw new SDKError("Item not found");this.store.set("cart.items."+n+".updating",!![]);const p={id:l.id,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:i},m=await this.api.updateCart({id:c.id||"",items:[p],loc:this.getLocation()});this.syncItemsFromApiResponse(m,[n]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const f=this.store.get("cart"),g=this.store.get("address");this.pubSub.publishAction(y.CART_UPDATED,{previous:cartDataForEventFromStore(c,g),current:cartDataForEventFromStore(f,g)}),this.pubSub.publishAction(y.CART_ITEM_ENGRAVING_UPDATED,{id:l.id,engravingLines:i,previousEngravingLines:(null===(a=null===(s=l.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[]})}catch(c){throw this.store.set("cart.items."+n+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+n+".updating",![])}}async addItem(n){var i,o;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},c=(null===(i=n.engravingLines)||void 0===i?void 0:i.filter(n=>""!==n.trim()))||[],l=c.length>0,p=Object.values(s.items||{}).find(i=>{var o,s,a,p,m;const f=i.fulfillmentId===n.fulfillmentId&&i.partNumber===n.partNumber;if(!f)return![];if(l){const n=(null===(s=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[];return c.join(",")===n.join(",")}return!(null===(m=null===(p=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===p?void 0:p.lines)||void 0===m?void 0:m.length)}),m={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:p?n.quantity+p.quantity:n.quantity};l&&(m.engravingLines=c);const f=await this.api.updateCart({id:s.id||"",items:[m],loc:this.getLocation()}),g=null===(o=f.items)||void 0===o?void 0:o.find(n=>n.fulfillmentId===m.fulfillmentId&&n.partNumber===m.partNumber&&n.upc===m.upc);if(!g)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(f,[]);const v=this.store.get("cart.fulfillments."+n.fulfillmentId);v?this.updateFulfillment(n.fulfillmentId,f):this.addNewFulfillmentAndRetailer(n.fulfillmentId,f),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const b=this.store.get("cart"),w=this.store.get("address");this.pubSub.publishAction(y.PRODUCT_ADD_TO_CART,{...n}),this.pubSub.publishAction(y.CART_ITEM_ADDED,{id:g.id,upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,engravingLines:n.engravingLines}),this.pubSub.publishAction(y.CART_UPDATED,{previous:cartDataForEventFromStore(a,w),current:cartDataForEventFromStore(b,w)});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,item_type:g.type,item_subtype:g.subType,quantity:g.quantity,price:centToDollar(g.unitPrice||0),upc:g.upc,grouping_id:g.salsifyGrouping,product_id:g.liquidId})}catch(s){this.store.set("cart.error",s.message),this.logger.error("Failed to add item to cart",s)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(n){var i;try{const o={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity};(null==n?void 0:n.engravingLines)&&(null===(i=null==n?void 0:n.engravingLines)||void 0===i?void 0:i.length)>0&&(o.engravingLines=n.engravingLines);const s=await this.api.updateCart({id:"",items:[o],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(s.id)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to add presale item to cart",o),o}}async handleGoToCheckout(){var n;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(w.CHECKOUT);const i=this.store.get("cart"),o=(null===(n=i.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(i.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],o)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to proceed to checkout",i),i}finally{this.store.set("cart.loading",![])}}async applyPromoCode(n){var i,o,s;if(!(null==n?void 0:n.trim()))throw new SDKError("Promo code is required");const a=n.trim().toUpperCase();try{const n=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const c=await this.api.updateCart({id:n,items:[],promoCode:a,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(c)),this.store.set("cart.events",transformEventsForCart(c.events||[]));const l=(null===(s=null===(o=null===(i=c.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===s?void 0:s.toLowerCase())===a.toLowerCase();l?(this.store.set("cart.promoCode",{code:a,discountAmount:c.discounts||0}),this.pubSub.publishAction(y.CART_PROMO_CODE_APPLIED,{discountAmount:c.discounts||0,newTotal:c.total||0}),this.googleTagManager.promoCodeApplied(a,c.discounts||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(y.CART_PROMO_CODE_FAILED,{error:'Code "'+a+'" does not exist'}),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(c){const n=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",n),this.pubSub.publishAction(y.CART_PROMO_CODE_FAILED,{error:n}),this.googleTagManager.promoCodeFailed(a,n),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const n=this.store.get("cart.id"),i=await this.api.updateCart({id:n,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(i),"cart.promoCode":null}),this.pubSub.publishAction(y.CART_PROMO_CODE_REMOVED,{newTotal:i.total||0}),this.googleTagManager.promoCodeApplied("",0)}catch(n){const i=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",i);const o=this.store.get("cart.promoCode");throw this.pubSub.publishAction(y.CART_PROMO_CODE_FAILED,{error:i}),(null==o?void 0:o.code)&&this.googleTagManager.promoCodeFailed(o.code,i),this.logger.error("Failed to remove promo code",n),n}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...F,rerender:!![]}),this.store.set("cart",{...N,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(y.CART_RESET,!![])}getDetails(){var n;const i=this.store.get("cart"),o=this.store.get("address"),s=o.id?o:P,a={};for(const c in i.items||{}){const n=i.items[c];a[c]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:i.id,promoCode:(null===(n=i.promoCode)||void 0===n?void 0:n.code)||"",items:a,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.latitude,longitude:s.coordinates.longitude}},amounts:{deliveryFee:i.totals.deliveryFee,discounts:i.totals.discounts,engravingFee:i.totals.engravingFee,giftCardTotal:i.totals.giftCardTotal,platformFee:i.totals.platformFee,shippingFee:i.totals.shippingFee,subtotal:i.totals.subtotal,total:i.totals.total},itemCount:Object.values(a||{}).reduce((n,i)=>n+(i.quantity||0),0),updatedAt:i.updatedAt,createdAt:i.createdAt}}buildItemUpdate(n,i){var o,s,a;const c={id:n.id,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:i},l=(null===(a=null===(s=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(n=>""!==n.trim()))||[];return l.length>0&&(c.engravingLines=l),c}syncItemsFromApiResponse(n,i=[]){var o;const s=this.store.get("cart.items")||{},a=new Set((null===(o=n.items)||void 0===o?void 0:o.map(n=>n.id))||[]);for(const l of Object.keys(s))a.has(l)||this.store.remove("cart.items."+l);const c={};for(const l of n.items)0!==i.length&&!i.includes(l.id)&&s[l.id]||(c["cart.items."+l.id]=buildCartItemStore(l));Object.keys(c).length>0&&this.store.batch(c)}syncCartMetaFromApiResponse(n){var i,o;const s={"cart.totals":buildCartTotals(n),"cart.error":null,"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(n.events||[])},a=null===(o=null===(i=n.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value;if(a)s["cart.promoCode"]={code:a.toUpperCase(),discountAmount:n.discounts||0};else{const n=this.store.get("cart.promoCode");(null==n?void 0:n.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(n){var i;if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0){const i={};for(const o of n.retailers)i["cart.retailers."+o.id]=buildRetailerStore(o);this.store.batch(i)}}updateFulfillment(n,i){var o,s;const a=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n)}),c=null===(s=null==a?void 0:a.fulfillments)||void 0===s?void 0:s.find(i=>i.id===n);c&&a&&this.store.set("cart.fulfillments."+n,buildFulfillmentStore(c,a))}addNewFulfillmentAndRetailer(n,i){var o,s;const a=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n)}),c=null===(s=null==a?void 0:a.fulfillments)||void 0===s?void 0:s.find(i=>i.id===n);if(c&&a){const i={["cart.fulfillments."+n]:buildFulfillmentStore(c,a),["cart.retailers."+a.id]:buildRetailerStore(a)};this.store.batch(i)}}cleanupAfterItemRemoval(n,i){var o,s,a,c;const l=this.store.get("cart.fulfillments."+n.fulfillmentId),p=this.store.get("cart.retailers."+n.retailerId);if(!l||!p)return;const m=null===(o=i.retailers)||void 0===o?void 0:o.some(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n.fulfillmentId)}),f=null===(s=i.retailers)||void 0===s?void 0:s.some(i=>i.id===n.retailerId);if(m){this.updateFulfillment(n.fulfillmentId,i);const o=null===(c=i.retailers)||void 0===c?void 0:c.find(i=>i.id===n.retailerId);o&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(o))}else if(this.store.remove("cart.fulfillments."+n.fulfillmentId),f){const o=null===(a=i.retailers)||void 0===a?void 0:a.find(i=>i.id===n.retailerId);o&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(o))}else this.store.remove("cart.retailers."+n.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(n,i=![]){this.store.createProductInstance(n),i&&this.store.set("products."+n+".loading",!![])}async loadMultipleProducts(n){var i;if(!Array.isArray(n)||0===n.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=!![],n["products."+i+".error"]=null,n),{}));const o=await this.api.getProductsData(n,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]=!![],n),{})),void 0;const s=[];for(const c of o.products){const a=Object.values(c.sizes).filter(i=>n.some(n=>n===(i.upc||i.id||c.salsifyGrouping))),l=n.find(n=>a.some(i=>n===i.upc||n===i.id)||n===c.salsifyGrouping),p=l||(null===(i=null==a?void 0:a[0])||void 0===i?void 0:i.upc);await this.loadProduct(p,{products:[c],retailers:o.retailers}),s.push(p)}const a=n.filter(n=>-1===s.indexOf(n));this.store.batch(a.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]="Product data not found",n),{}))}async loadProduct(n,i=null){var o;try{const s=this.store.get("products."+n);s.loading||this.store.set("products."+n+".loading",!![]);let a=null;if(i&&(a=i),i||(a=await this.api.getProductsData([n],this.getLocation())),!a||!(null===(o=null==a?void 0:a.products)||void 0===o?void 0:o[0]))return this.store.set("products."+n+".error","Product data not found"),void 0;const c=this.loadProductStoreUpdate(a);if(!c)return this.store.set("products."+n+".error","Failed to process product data"),void 0;this.store.set("products."+n,{...c,identifier:n}),this.pubSub.publishAction(y.PRODUCT_LOADED,this.productDataForEventFromStore(n));const l=a.products[0],p=c.sizes[c.selectedSizeId||""],m=Boolean(this.getLocation()),f=c.selectedFulfillment,g=m&&(null==f?void 0:f.price)?f.price:c.noAvailabilityPrice,v=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:l.name,item_brand:l.brand,item_size:null==p?void 0:p.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(g),item_type:l.type,item_subtype:l.subType,upc:null==p?void 0:p.upc,grouping_id:l.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(s){this.store.set("products."+n+".error",s.message),this.logger.error("Failed to load product data for ID "+n,s)}finally{this.store.set("products."+n+".loading",![])}}async selectSize(n,i){var o,s;const a=this.store.get("products."+n);let c=a.selectedFulfillmentType;const l=a.sizes[i];let p=null,m=null;if(c!==C.SHIPPING||Object.values(l.shippingFulfillments).length)if(c!==C.ON_DEMAND||Object.values(l.onDemandFulfillments).length){const n=c===C.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,i=Object.values(n);p=i[0]||null,m=(null==p?void 0:p.fulfillmentId)||null}else{c=C.SHIPPING;const n=Object.values(l.shippingFulfillments);p=n[0]||null,m=(null==p?void 0:p.fulfillmentId)||null}else{c=C.ON_DEMAND;const n=Object.values(l.onDemandFulfillments);p=n[0]||null,m=(null==p?void 0:p.fulfillmentId)||null}const f=c===C.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,g=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:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==p?void 0:p.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,upc:null==l?void 0:l.upc,grouping_id:a.salsifyGrouping,product_id:null==l?void 0:l.id});const v=Object.keys(l.shippingFulfillments).length>0,b=Object.keys(l.onDemandFulfillments).length>0;v||b||this.googleTagManager.productSizeNoAvailability({productId:null==l?void 0:l.id,productName:a.name,productBrand:a.brand,productCategory:g.category,productCategory2:g.category2,productCategory3:g.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:i,sizeName:null==l?void 0:l.size,upc:null==l?void 0:l.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(y.PRODUCT_SIZE_CHANGED,{identifier:n,selectedSizeId:i,size:(null===(o=a.sizes[i])||void 0===o?void 0:o.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(s=a.sizes[a.selectedSizeId])||void 0===s?void 0:s.size)||""}),this.store.batch({["products."+n+".selectedSizeId"]:i,["products."+n+".productHasAvailability"]:Object.keys(l.shippingFulfillments).length+Object.keys(l.onDemandFulfillments).length>0,["products."+n+".fulfillmentHasAvailability"]:Boolean(Object.keys(f).length),["products."+n+".selectedFulfillmentType"]:c,["products."+n+".selectedFulfillment"]:p,["products."+n+".selectedFulfillmentId"]:m})}async selectFulfillment(n,i){const o=this.store.get("products."+n),s=o.sizes[o.selectedSizeId],a=o.selectedFulfillmentType===C.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,c=a[i];this.pubSub.publishAction(y.PRODUCT_FULFILLMENT_CHANGED,{identifier:n,selectedFulfillmentId:i,selectedFulfillmentType:o.selectedFulfillmentType,previousFulfillmentId:o.selectedFulfillmentId||"",previousFulfillmentType:o.selectedFulfillmentType});const l=splitCategoryPath(o.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:o.name,item_brand:o.brand,item_size:null==s?void 0:s.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:centToDollar((null==c?void 0:c.price)||o.noAvailabilityPrice),item_type:o.type,item_subtype:o.subType,upc:null==s?void 0:s.upc,grouping_id:o.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+n+".selectedFulfillment"]:c,["products."+n+".selectedFulfillmentId"]:i,["products."+n+".quantity"]:1})}async updateQuantity(n,i){var o;const s=this.store.get("products."+n),a=s.quantity,c=a+i,l=1,p=(null===(o=null==s?void 0:s.selectedFulfillment)||void 0===o?void 0:o.stock)||5,m=Math.max(l,Math.min(p,c));this.pubSub.publishAction(i<0?y.PRODUCT_QUANTITY_DECREASE:y.PRODUCT_QUANTITY_INCREASE,{identifier:n,quantity:m,previousQuantity:a}),this.store.set("products."+n+".quantity",m)}async changeFulfillmentType(n,i){var o;const s=this.store.get("products."+n),a=s.sizes[s.selectedSizeId],c=i===C.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,l=Object.values(c);if(0===l.length){const n=splitCategoryPath(s.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:s.name,productBrand:s.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:null!==(o=s.selectedSizeId)&&void 0!==o?o:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:i,upc:null==a?void 0:a.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+i+" fulfillments available for selected size"}),void 0}const p=l[0]||null,m=(null==p?void 0:p.fulfillmentId)||null;this.pubSub.publishAction(y.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:n,selectedFulfillmentType:i,selectedFulfillmentId:m,previousFulfillmentType:s.selectedFulfillmentType,previousFulfillmentId:s.selectedFulfillmentId,fulfillmentHasAvailability:l.length>0});const f=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:s.name,item_brand:s.brand,item_size:null==a?void 0:a.size,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar((null==p?void 0:p.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,upc:null==a?void 0:a.upc,grouping_id:s.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+n+".selectedFulfillmentType"]:i,["products."+n+".selectedFulfillment"]:p,["products."+n+".selectedFulfillmentId"]:m,["products."+n+".fulfillmentHasAvailability"]:l.length>0})}async removeProduct(n){this.store.removeProductInstance(n)}async openProductDrawer(n,i,o){const s={type:i,data:o||{}};this.store.batch({["products."+n+".drawer.isOpen"]:!![],["products."+n+".drawer.contentConfig"]:s})}async closeProductDrawer(n){this.store.set("products."+n+".drawer.isOpen",![])}async rerenderAllProducts(){const n=this.store.getProductInstances(),i=Object.keys(n);for(const o of i)this.store.set("products."+o+".rerender",!![])}async addToCart(n,i){try{this.store.set("products."+n+".updating",!![]),this.uiCommands.openDrawer(w.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_size:n.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+n+".updating",![])}}async addPresaleToCart(n,i){try{this.store.set("products."+n+".updating",!![]),await this.cartCommands.addPresaleItem(i),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(w.CHECKOUT),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]})}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+n+".updating",![])}}productDataForEventFromStore(n){const i=this.store.get("products."+n),o={},fulfillmentEventData=n=>{const i={};for(const o in n){const s=n[o];i[o]={retailerId:s.retailerId,retailerName:s.retailerName,retailerAddress:s.retailerAddress,retailerTimezone:s.timezone,price:s.price,partNumber:s.partNumber,stock:s.stock,isEngravable:s.isEngravable,fulfillmentId:s.fulfillmentId,fulfillmentType:s.fulfillmentType}}return i};for(const s in i.sizes||{}){const n=i.sizes[s];o[s]={id:n.id,upc:n.upc,size:n.size,pack:n.pack,packDesc:n.packDesc||"",container:n.container,containerType:n.containerType,maxQuantityPerOrder:n.attributes.maxQuantityPerOrder||0,image:n.image,uom:n.uom,volume:n.volume,attributes:n.attributes,shippingFulfillments:fulfillmentEventData(n.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(n.onDemandFulfillments||{})}}return{identifier:n,selectedSizeId:i.selectedSizeId||null,selectedFulfillmentId:i.selectedFulfillmentId||null,selectedFulfillmentType:i.selectedFulfillmentType,id:i.id,name:i.name,brand:i.brand,catPath:i.catPath,category:i.category,classification:i.classification,type:i.type,salsifyGrouping:i.salsifyGrouping,subType:i.subType,images:i.images||[],region:i.region,country:i.country,material:i.material,abv:i.abv,proof:i.proof,age:i.age,color:i.color,flavor:i.flavor,variety:i.variety,appellation:i.appellation,vintage:i.vintage,description:i.description,htmlDescription:i.htmlDescription,tastingNotes:i.tastingNotes,noAvailabilityPrice:i.noAvailabilityPrice,sizes:o}}findFirstAvailableSize(n){const i=Object.values(n);for(const o of i){const n=o.shippingFulfillments||{},i=o.onDemandFulfillments||{},s=Object.values(n).length,a=Object.values(i).length;if(s+a>0)return o.id}return null}loadProductStoreUpdate({products:[n,...i],retailers:o}){var s,a,c,l,p;try{const i=this.themeProvider.getConfigs("product"),m={id:n.id,brand:n.brand,category:n.category,catPath:n.catPath,classification:n.classification,type:n.type,subType:n.subType,salsifyGrouping:n.salsifyGrouping,name:n.name,description:n.description,htmlDescription:n.htmlDescription,images:n.images,region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,tastingNotes:n.tastingNotes,noAvailabilityPrice:n.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:i.layout.enableShippingFulfillment?C.SHIPPING:C.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(n.sizes&&Object.values(n.sizes).length>0)for(const s of Object.values(n.sizes)){m.sizes[s.id]={...s,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const n of Object.values(s.shippingVariants)){const i=o[n.retailerId];(null==i?void 0:i.shippingFulfillment)&&(m.sizes[s.id].shippingFulfillments[i.shippingFulfillment.fulfillmentId]={...n,...i.shippingFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted})}for(const n of Object.values(s.onDemandVariants)){const i=o[n.retailerId];(null==i?void 0:i.onDemandFulfillment)&&(m.sizes[s.id].onDemandFulfillments[i.onDemandFulfillment.fulfillmentId]={...n,...i.onDemandFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted})}}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)||{},y=(null===(c=m.sizes[m.selectedSizeId])||void 0===c?void 0:c.onDemandFulfillments)||{};m.productHasAvailability=Object.values(v).length+Object.values(y).length>0;const b=m.selectedFulfillmentType===C.SHIPPING?Object.values(v):Object.values(y);if(m.fulfillmentHasAvailability=b.length>0,m.selectedFulfillment=b[0]||null,m.selectedFulfillmentId=(null===(l=m.selectedFulfillment)||void 0===l?void 0:l.fulfillmentId)||null,!m.fulfillmentHasAvailability){const n=m.selectedFulfillmentType===C.SHIPPING?C.ON_DEMAND:C.SHIPPING,i=n===C.SHIPPING?Object.values(v):Object.values(y);i.length>0&&(m.selectedFulfillmentType=n,m.selectedFulfillment=i[0],m.selectedFulfillmentId=(null===(p=m.selectedFulfillment)||void 0===p?void 0:p.fulfillmentId)||null,m.fulfillmentHasAvailability=!![])}if(!m.productHasAvailability){const i=splitCategoryPath(n.catPath),o=m.sizes[m.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:n.name,productBrand:n.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:n.type,productSubtype:n.subType,productPrice:n.noAvailabilityPrice,upc:null==o?void 0:o.upc,groupingId:n.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(n){return!n||n.length<3?[]:await this.api.getAddressSuggestions(n)}async getAddressDetails(n){return await this.api.getAddressDetails(n)}async setSelectedAddress(n){try{this.store.batch({"address.id":n.id,"address.formattedAddress":n.formattedAddress,"address.address":n.address,"address.coordinates":n.coordinates});const i=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(i)),await this.cartCommands.resetCart(),await this.store.persist()}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(y.ADDRESS_FAILED,{googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates,error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),i}this.googleTagManager.addressUpdated({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country},coordinates:n.coordinates}),this.pubSub.publishAction(y.ADDRESS_UPDATED,{googlePlacesId:n.id,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country},coordinates:n.coordinates,formattedAddress:n.formattedAddress})}async setAddressManually(n,i){try{const o=buildFormattedAddressString(n),s={id:"",formattedAddress:o,address:n,coordinates:i};await this.setSelectedAddress(s)}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:{one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip,country:n.country},error:(null==o?void 0:o.message)||"Failed to set manual address"}),this.pubSub.publishAction(y.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:n,coordinates:i,error:(null==o?void 0:o.message)||"Failed to set manual address"}),o}}async clearSelectedAddress(){this.store.set("address",P),this.pubSub.publishAction(y.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const n=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(n),this.store.clearLocalStorage()}getDetails(){const n=this.store.get("address");return n.id?{id:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(n){var i,o;const s=n,a=this.clientConfig.getConfigs();s.entity=null!==(o=null!==(i=window.location.hostname)&&void 0!==i?i:a.partnerName)&&void 0!==o?o:void 0,s.visitorId=a.userDeviceId,s.loc=this.getLocation(),s.isLegacy=!![];const c=await this.api.catalogSearch(s);return c.products&&c.products.length>0&&this.trackViewItemList(c.products),c}async addToCart(n){try{this.uiCommands.openDrawer(w.CART),await this.cartCommands.addItem(n)}catch(i){throw this.logger.error("Error adding product to cart from product list",i),i}}async addPresaleToCart(n){try{await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(w.CHECKOUT)}catch(i){throw this.logger.error("Error adding presale product to cart from product list",i),i}}trackViewItemList(n){if(0!==n.length)try{const i=n.map((n,i)=>({...this.convertProductToBaseItem(n),index:i+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking view_item_list event",i)}}trackSelectItem(n){try{const i=this.convertProductToBaseItem(n);this.googleTagManager.selectItem(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking select_item event",i)}}convertProductToBaseItem(n){var i;const o=null===(i=n.sizes)||void 0===i?void 0:i[0],s=null==o?void 0:o.shippingVariants[Object.keys(o.shippingVariants)[0]],a=splitCategoryPath(n.catPath);return{item_id:null==o?void 0:o.id,item_name:n.name,item_brand:n.brand,item_size:null==o?void 0:o.size,item_category:a.category,item_category2:a.category2,item_category3:a.category3,price:(null==s?void 0:s.price)?centToDollar(s.price):n.noAvailabilityPrice?centToDollar(n.noAvailabilityPrice):void 0,item_type:n.type,item_subtype:n.subType,upc:null==o?void 0:o.upc,grouping_id:n.salsifyGrouping,product_id:null==o?void 0:o.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:n=>this.command.product.productDataForEventFromStore(n)},this.addressActions={setAddressByPlacesId:async n=>{try{if(!n||""===n.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const i=await this.command.address.getAddressDetails(n);await this.command.address.setSelectedAddress({id:n,address:i.address,coordinates:i.coordinates,formattedAddress:i.formattedAddress})}catch(i){throw this.logger.error("Error setting address by placesId:",i),i}},setAddressManually:async(n,i)=>{try{if(!n||!i)throw new SDKError("Both address and coordinates are required.",!![]);if(!(n.one&&n.city&&n.state&&n.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof i.latitude||"number"!=typeof i.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof i.latitude+", long: "+typeof i.longitude,!![]);if(i.latitude<-90||i.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+i.latitude,!![]);if(i.longitude<-180||i.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+i.longitude,!![]);await this.command.address.setAddressManually(n,i)}catch(o){throw this.logger.error("Error setting manual address:",o),o}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(w.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(w.CART)},addProduct:async(n,i)=>{var o,s;try{if(!n||0===n.length)return this.logger.warn("No products provided to add to cart"),void 0;const a=this.getLocation();if(void 0===a)return this.pendingCartParams=n,this.pendingCartOpenFlag=null!=i?i:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(w.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;i===!![]&&this.command.ui.openDrawer(w.CART);const c=[...new Set(n.map(n=>n.identifier))],l=await this.api.getProductsData(c,a);if(!l||!l.products||0===l.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(y.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const i of n){let n=null;for(let o=0;o<l.products.length;o++){const s=l.products[o];let a=![];for(let n=0;n<Object.values(s.sizes).length;n++){const o=s.sizes[n];if(o.upc===i.identifier||o.id===i.identifier||s.salsifyGrouping===i.identifier){a=!![];break}}if(a){n=s;break}}if(!n){this.logger.warn("No product found for identifier: "+i.identifier);continue}const a=n.sizes[0];if(!a){this.logger.warn("No sizes found for product: "+i.identifier);continue}if((null===(s=null===(o=null==a?void 0:a.attributes)||void 0===o?void 0:o.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+i.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let c=null;const p=i.fulfillmentType===C.SHIPPING?a.shippingVariants:a.onDemandVariants;for(let i=0;i<Object.values(p).length;i++)if(p[i]){c=p[i];break}if(!c){this.logger.warn("No supported variant found for product: "+i.identifier+" with fulfillment type: "+i.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const m=i.fulfillmentType===C.ON_DEMAND?c.onDemandFulfillmentId:c.shippingFulfillmentId;await this.command.cart.addItem({upc:a.upc,fulfillmentId:m,partNumber:c.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(y.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:c}),this.logger.info("Products added to cart successfully:",c)}catch(a){throw this.logger.error("Error adding products to cart:",a),this.clearPendingCartOperation(),this.pubSub.publishAction(y.CART_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:a.message||"Failed to add products to cart"}),a}},applyPromoCode:async n=>{try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const i=n.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),s=o.layout.allowPromoCodes;if(!s)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const a=this.store.get("cart.promoCode");if(a&&a.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(i);const c=this.command.cart.getDetails();this.pubSub.publishAction(y.CART_PROMO_CODE_APPLIED,{discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.logger.info("Promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply promo code:",i),this.pubSub.publishAction(y.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const o=this.command.cart.getDetails();this.pubSub.publishAction(y.CART_PROMO_CODE_REMOVED,{newTotal:o.amounts.total}),this.logger.info("Promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove promo code:",n),n}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(y.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(w.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(w.CHECKOUT)},addProduct:async(n,i)=>{try{if(!n||0===n.length)return this.logger.warn("No products provided to add to checkout"),void 0;i===!![]&&this.command.ui.openDrawer(w.CHECKOUT);const o=n.map(n=>n.identifier);await this.cartActions.addProduct(n),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:o}),this.logger.info("Products added to checkout successfully:",o)}catch(o){throw this.logger.error("Error adding products to checkout:",o),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:o.message||"Failed to add products to checkout"}),o}},addPresaleProduct:async n=>{var i,o;try{if(!n||"object"!=typeof n||!n.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const s=this.getLocation();if(void 0===s)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(w.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const a=await this.api.getProductsData([n.identifier],s);if(!a||!a.products||0===a.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"No product found",isPresale:!![]}),void 0;const c=a.products[0],l=c.sizes[0];if(!l)return this.logger.warn("No sizes found for presale product: "+n.identifier),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(o=null===(i=null==l?void 0:l.attributes)||void 0===i?void 0:i.presale)||void 0===o?void 0:o.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+n.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let p=null;const m=n.fulfillmentType===C.SHIPPING?l.shippingVariants:l.onDemandVariants;for(let n=0;n<Object.values(m).length;n++)if(m[n]){p=m[n];break}if(!p)return this.logger.warn("No supported variant found for presale product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=n.fulfillmentType===C.ON_DEMAND?p.onDemandFulfillmentId:p.shippingFulfillmentId;await this.command.cart.addPresaleItem({upc:l.upc,fulfillmentId:f,partNumber:p.partNumber,quantity:n.quantity,engravingLines:[],identifier:n.identifier}),this.command.ui.openDrawer(w.CHECKOUT),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[n.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+n.identifier)}catch(s){throw this.logger.error("Error adding presale product to checkout:",s),this.pubSub.publishAction(y.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[n.identifier],error:s.message||"Failed to add presale product to checkout",isPresale:!![]}),s}},applyPromoCode:async n=>{var i;try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const o=n.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const c=this.store.get("checkout.promoCode");if(c&&c.code===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(n);const l=this.store.get("checkout"),p=null==l?void 0:l.promoCode;this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==p?void 0:p.discountAmount)||0,newTotal:(null===(i=null==l?void 0:l.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(o){throw this.logger.error("Failed to apply checkout promo code:",o),this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{var n;try{const i=this.themeProvider.getConfigs("global"),o=i.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 s=this.store.get("checkout");this.pubSub.publishAction(y.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:(null===(n=null==s?void 0:s.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(i){throw this.logger.error("Failed to remove checkout promo code:",i),i}},applyGiftCard:async n=>{var i;try{const o=this.themeProvider.getConfigs("checkout"),s=o.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(n);const a=this.store.get("checkout");this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(i=null==a?void 0:a.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card applied successfully")}catch(o){throw this.logger.error("Failed to apply gift card:",o),this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),o}},removeGiftCard:async n=>{var i;try{const o=this.themeProvider.getConfigs("checkout"),s=o.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(n);const a=this.store.get("checkout");this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(i=null==a?void 0:a.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card removed successfully")}catch(o){throw this.logger.error("Failed to remove gift card:",o),this.pubSub.publishAction(y.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),o}},toggleIsGift:async n=>{await this.command.checkout.toggleIsGift(n)},toggleBillingSameAsShipping:async n=>{await this.command.checkout.toggleBillingSameAsShipping(n)},toggleMarketingPreferences:async(n,i)=>{await this.command.checkout.toggleMarketingPreferences(n,i)},updateCustomerInfo:n=>{for(const[i,o]of Object.entries(n));},updateBillingInfo:n=>{for(const[i,o]of Object.entries(n));},updateGiftInfo:n=>{for(const[i,o]of Object.entries(n));},getDetails:()=>{var n,i,o;const s=this.store.get("checkout"),a=s.items||{},c={};for(const[l,p]of Object.entries(a))c[l]={liquidId:p.liquidId,variantId:p.variantId,cartItemId:l,retailerId:p.retailerId,fulfillmentId:p.fulfillmentId,salsifyGrouping:p.salsifyGrouping,name:p.name,catPath:p.catPath,volume:p.volume,uom:p.uom,proof:p.proof,abv:p.abv,containerType:p.containerType,container:p.container,size:p.size,pack:p.pack,packDesc:p.packDesc,mainImage:p.mainImage,brand:p.brand,partNumber:p.partNumber,upc:p.upc,sku:p.sku,price:p.price,unitPrice:p.unitPrice,quantity:p.quantity,unitTax:p.unitTax,bottleDeposits:p.bottleDeposits,attributes:p.attributes,retailerName:p.retailerName,expectationDetail:p.expectationDetail};return{cartId:s.cartId||"",isGift:s.isGift||![],billingSameAsShipping:s.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(n=s.marketingPreferences)||void 0===n?void 0:n.canEmail)||![],canSms:(null===(i=s.marketingPreferences)||void 0===i?void 0:i.canSms)||![]},hasPromoCode:!!(null===(o=s.promoCode)||void 0===o?void 0:o.code),hasGiftCards:Array.isArray(s.giftCards)&&s.giftCards.length>0,itemCount:Object.values(c||{}).reduce((n,i)=>n+(i.quantity||0),0),amounts:s.amounts,items:c}}},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 t=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+y.ADDRESS_UPDATED,t)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const n=this.pendingCartParams,i=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(n,i)}catch(n){this.logger.error("Failed to retry cart operation after address update",n)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const n=this.store.get("address");if(n.address.one&&n.coordinates.latitude&&n.coordinates.longitude)return{coordinates:n.coordinates,address:n.address}}}const Et="\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",St="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 n=LoggerFactory,i=n.instances;if(i)for(const[s,a]of i)this.interceptLoggerInstance(a,s);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=n=>{const i=o(n);return this.interceptLoggerInstance(i,n),i}}interceptLoggerInstance(n,i){if(n.l)return;const o=n.debug.bind(n),s=n.info.bind(n),a=n.warn.bind(n),c=n.error.bind(n),h=(n,o,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:n,message:o,data:s,context:i});n.debug=(n,i)=>{o(n,i),this.addLogEntry(h("debug",n,i))},n.info=(n,i)=>{s(n,i),this.addLogEntry(h("info",n,i))},n.warn=(n,i)=>{a(n,i),this.addLogEntry(h("warn",n,i))},n.error=(n,i)=>{c(n,i),this.addLogEntry(h("error",n,i))},n.l=!![]}interceptPubSubEvents(){const n=PubSubService.getInstance(),i=n.publishAction.bind(n);n.publishAction=(n,o)=>{i(n,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+n,data:o,context:"PubSub"})};const o=n.publishForm.bind(n);n.publishForm=(n,i)=>{o(n,i),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+n,data:i,context:"PubSub"})}}interceptGtmEvents(){const n=GoogleTagManagerService.getInstance(),i=n.executeEvent.bind(n);n.executeEvent=(n,o,s)=>{i(n,o,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:s,context:"GTM."+n})}}addLogEntry(n){this.logs.push(n),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const n=this.logs.filter(n=>{switch(n.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",n.forEach(n=>{const i=this.createLogElement(n);this.logContainer.appendChild(i)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const n=document.querySelector(St);n&&n.remove(),this.panelElement=document.createElement(St);const i=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):i?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const n=this.panelElement.attachShadow({mode:"closed"}),i=document.createElement("style");i.textContent=Et,n.appendChild(i),this.floatingButton=this.createFloatingButton(),n.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);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),n.appendChild(this.panelContainer),this.setupShadowEventListeners(n)}createHeader(){const n=document.createElement("div");n.className="header",n.title="Drag to move panel";const i=document.createElement("div");i.className="icon",i.innerHTML="🔍",i.title="Elements Debug Console",i.style.cursor="help";const o=document.createElement("div");o.className="title-container";const 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",o.appendChild(s),o.appendChild(a);const c=document.createElement("button");return c.className="minimize",c.innerHTML="−",c.title="Minimize debug panel",c.addEventListener("click",()=>this.toggleVisibility()),n.appendChild(i),n.appendChild(o),n.appendChild(c),n}createToggles(){const n=document.createElement("div");n.className="toggles";const i=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];i.forEach(({key:i,label:o,description: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"!==i,l.addEventListener("change",n=>{const o=n.target;"showEvents"===i&&(this.showEvents=o.checked),"showGtmEvents"===i&&(this.showGtmEvents=o.checked),"showLogs"===i&&(this.showLogs=o.checked),this.renderLogs()});const p=document.createElement("span");p.textContent=o,p.style.color=a,c.appendChild(l),c.appendChild(p),n.appendChild(c)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),n.appendChild(o),n}createResizeHandle(){const n=document.createElement("div");n.className="resize-handle",n.title="Drag to resize panel",n.style.cursor="nw-resize";let i=![],o=0,s=0,a=0,c=0;n.addEventListener("mousedown",n=>{i=!![],o=n.clientX,s=n.clientY,a=Number.parseInt(this.panelElement.style.width,10)||500,c=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",q),document.addEventListener("mouseup",R),n.preventDefault()});const q=n=>{if(!i||!this.panelElement)return;const l=n.clientX-o,p=n.clientY-s,m=window.innerWidth<=768,f=window.innerWidth<=480;let g,v,y,b;f?(g=280,v=window.innerWidth-20,y=200,b=.4*window.innerHeight):m?(g=300,v=window.innerWidth-30,y=200,b=.4*window.innerHeight):(g=300,v=800,y=200,b=600);const w=Math.max(g,Math.min(v,a+l)),C=Math.max(y,Math.min(b,c+p));this.panelElement.style.width=w+"px",this.panelElement.style.height=C+"px"},R=()=>{i=![],document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",R)};return n}setupShadowEventListeners(n){if(!this.panelElement)return;const i=n.querySelector(".header");if(i){let n=![],o=0,s=0,a=0,c=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;n=!![],o=i.clientX,s=i.clientY;const l=this.panelElement.getBoundingClientRect();a=l.left,c=l.top,document.addEventListener("mousemove",q),document.addEventListener("mouseup",R),i.preventDefault()});const q=i=>{if(!n||!this.panelElement)return;const l=i.clientX-o,p=i.clientY-s;this.panelElement.style.left=a+l+"px",this.panelElement.style.top=c+p+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},R=()=>{n=![],document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",R)}}}createFloatingButton(){const n=document.createElement("div");return n.className="floating-btn",n.innerHTML="⚙️",n.title="Open Elements Debug Console",n.style.display="none",n.addEventListener("click",()=>{this.toggleVisibility()}),n}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(n){const i=document.createElement("div");i.className="log-entry "+n.type+" "+n.level;const o=new Date(n.timestamp).toLocaleTimeString();return i.innerHTML='\n <div class="log-meta">\n <div class="log-type '+n.type+'">'+n.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(n.message)+"\n "+(n.context?'<div class="log-context">'+this.escapeHtml(n.context)+"</div>":"")+"\n "+(n.data?'<div class="log-data"><pre>'+this.formatJsonData(n.data)+"</pre></div>":"")+"\n </div>\n ",i}formatJsonData(n){try{return"object"==typeof n&&null!==n?JSON.stringify(n,null,2):String(n)}catch(i){return String(n)}}escapeHtml(n){const i=document.createElement("div");return i.textContent=n,i.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(n){if(this.h()){const i=this.u(n);if(i)return this.m(n,i)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(n,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(n,i){return(n+"_"+i).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const n=window.localStorage,i="__localStorage_test_"+Date.now()+"__",o="test";n.setItem(i,o);const s=n.getItem(i);return s!==o?(this.isLocalStorageAvailable=![],![]):(n.removeItem(i),this.isLocalStorageAvailable=!![],!![])}catch(n){const o=n instanceof DOMException&&(22===n.code||1014===n.code||"QuotaExceededError"===n.name||"NS_ERROR_DOM_QUOTA_REACHED"===n.name);if(o)try{const n=window.localStorage;return n&&n.length>0?(this.I()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(i){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],n instanceof DOMException){const i={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},o=i[n.name]||"Storage error: "+n.name,s=this.I()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+o)}else console.warn("localStorage unavailable:",n.message||"Unknown error");return![]}}u(n){try{const i=this.clientConfig.get("localStorageKeyPrefix")+"_"+n.toLowerCase()+"_";for(let n=0;n<localStorage.length;n++){const o=localStorage.key(n);if(null==o?void 0:o.startsWith(i)){const n=o.substring(i.length);if(n&&/^[a-f0-9]+$/.test(n))return n}}return null}catch(i){return null}}v(){const n=this.getFingerprintData(),i=Object.keys(n).sort().map(i=>i+":"+n[i]).join("|");return this.T(i)}C(){try{const n=screen,i=n.colorDepth||24,o=n.pixelDepth||i,s=this.D(),a=Math.round(100*(window.devicePixelRatio||1));return i+"|"+o+"|"+s+"|"+a}catch(n){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(ht){}return"srgb"}k(){var n;try{const i=navigator,o=[],s=((null===(n=i.languages)||void 0===n?void 0:n[0])||i.language||"en").substring(0,2);o.push(s),o.push(i.hardwareConcurrency||4);const a=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(a),o.push(i.cookieEnabled?"1":"0"),o.push(i.maxTouchPoints||0),o.push(i.deviceMemory||0),o.push(this.A()),o.push(this.I()?"webview":"browser");const c=["bluetooth"in i?"1":"0","usb"in i?"1":"0","mediaDevices"in i?"1":"0","permissions"in i?"1":"0","credentials"in i?"1":"0","storage"in i?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(c.join("")),o.join("|")}catch(i){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}A(){try{const n=navigator.userAgent.toLowerCase();return n.includes("instagram")?"ig_webview":n.includes("fban")||n.includes("fbav")?"fb_webview":n.includes("tiktok")?"tiktok_webview":n.includes("linkedin")?"linkedin_webview":n.includes("snapchat")?"snapchat_webview":n.includes("twitter")?"twitter_webview":n.includes("line/")?"line_webview":n.includes("micromessenger")?"wechat_webview":n.includes("firefox")?"gecko":n.includes("edg/")?"edge":n.includes("opr/")||n.includes("opera")?"opera":n.includes("chrome")&&!n.includes("edg")?"blink":n.includes("safari")&&!n.includes("chrome")?"webkit":"unknown"}catch(n){return"unknown"}}I(){try{const n=navigator.userAgent.toLowerCase(),i=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(i=>n.includes(i))?!![]:void 0===i.standalone||i.standalone?window.self!==window.top?!![]:![]:!![]}catch(n){return![]}}S(){try{const n=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return n.replace(/\//g,"_").substring(0,30)}catch(n){return"UTC"}}T(n){const i=16777619;let o=2166136261,s=2166136261,a=2166136261,c=2166136261;for(let l=0;l<n.length;l++){const p=n.charCodeAt(l);o^=p,o=Math.imul(o,i),s^=p<<1,s=Math.imul(s,i),a^=p<<2,a=Math.imul(a,i),c^=p<<3,c=Math.imul(c,i)}return o=Math.abs(o),s=Math.abs(s),a=Math.abs(a),c=Math.abs(c),o.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 n=this.clientConfig.get("env"),i=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:i,batchSize:n===v.PRODUCTION?5:10,batchInterval:n===v.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(n,i,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(n))return;const s=Date.now();try{const a={eventId:"event_"+s,timestamp:s,level:n,message:i,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(n){return{name:n.name,message:n.message,stack:this.truncateStackTrace(n.stack),code:n.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 n=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:n||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(n){switch(n){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(n){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(n),this.stats.totalEvents++,this.stats.eventsByLevel[n.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 n;if(0===this.eventQueue.length||!(null===(n=this.config)||void 0===n?void 0:n.endpoint))return;const i=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(i);try{this.sendBatch(o),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...i),this.stats.queuedEvents=this.eventQueue.length}}createBatch(n){const i=Date.now();return{batchId:"batch_"+i,timestamp:i,events:n}}sendBatch(n){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const i=new Blob([JSON.stringify(n)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,i);if(o)return}catch(i){return this.sendBatchViaXHR(n),void 0}this.sendBatchViaXHR(n)}sendBatchViaXHR(n){try{const i=new XMLHttpRequest;if(i.open("POST",this.config.endpoint,![]),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(n)),i.status<200||i.status>=300)throw new SDKError("XHR request failed with status: "+i.status)}catch(i){throw new SDKError("Both sendBeacon and XHR failed: "+i.message)}}truncateStackTrace(n){if(n)return n.split("\n").slice(0,10).join("\n")}handleInternalError(n){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",n)}shutdown(){var n;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(n=this.config)||void 0===n?void 0:n.endpoint))){const n=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(n={}){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,...n}}initialize({data:n,config:i}){var o;this.P=Object.freeze(n),this._=Object.freeze({type:i.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==i?void 0:i.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(n){return n.map(n=>this.interpolatePath(n))}interpolatePath(n){if("string"!=typeof n)return n;const i=/\{([^}]+)}/g;return n.replace(i,(i,o)=>{const s=this.P[o];return null==s?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+n+'"'),i):String(s)})}connectedCallback(){var n,i;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this._.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(n=this.connected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(i=this._)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var n,i;try{this.cleanup(),null===(n=this.disconnected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(i=this._)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var n,i,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(n=this.beforeSetupStoreWatchers)||void 0===n||n.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(i=this.beforeConnected)||void 0===i||i.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(o=this._)||void 0===o?void 0:o.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 i of this.unsubscribers)try{i()}catch(n){this.logger.error("Cleanup error during component destruction",n),n instanceof Error&&this.captureComponentError(n,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var n;if(!this.reactiveOptions.autoDestroy)return;let i=this.reactiveOptions.autoDestroyPath;if(!i&&(null===(n=this.reactiveOptions.watchStorePaths)||void 0===n?void 0:n.length)&&(i=this.reactiveOptions.watchStorePaths[0]),!i)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(i),s=this.store.watch(o,(n,i)=>{this.isDestroyed||void 0===n&&void 0!==i&&this.handleAutoDestroy(o)});this.unsubscribers.push(s)}handleAutoDestroy(n){var i;if(this.isDestroyed)return;null===(i=this.beforeAutoDestroy)||void 0===i?void 0:i.call(this,n);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var n;if(!this.isDestroyed)try{null===(n=this.onAutoDestroy)||void 0===n?void 0:n.call(this),this.remove()}catch(i){this.logger.error("Error during auto-destroy of "+this._.tagName,i),i instanceof Error&&this.captureComponentError(i,"auto-destroy")}}setupStoreWatchers(){var n;try{let n=this.reactiveOptions.watchStorePaths;if(!(null==n?void 0:n.length)||!this.P)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,o;try{if(this.isDestroyed)return;const o=n.map(n=>n.path).join(", "),s="store:["+o+"]",a=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,n);a!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(o=this._)||void 0===o?void 0:o.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Store watchers setup error in "+((null===(n=this._)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupStoreWatchers")}}setupNonRenderingWatchers(){var n;try{let n=this.reactiveOptions.watchOnlyStorePaths;if(!(null==n?void 0:n.length)||!this.P)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,o;try{if(this.isDestroyed)return;null===(i=this.onStoreWatch)||void 0===i?void 0:i.call(this,n)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this._)||void 0===o?void 0:o.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Non-rendering watchers setup error in "+((null===(n=this._)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupNonRenderingWatchers")}}triggerRender(n){this.lastRenderTrigger=n,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var n,i;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const i=this.template();"string"==typeof i&&(this.container.innerHTML=i),i instanceof HTMLElement&&safeReplaceChildren(this.container,i),Array.isArray(i)&&safeReplaceChildren(this.container,...i);const a=performance.now()-o;this.logRenderInfo(a);try{null===(n=this.afterRender)||void 0===n?void 0:n.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this._.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(a){const n=performance.now()-o;this.logger.error("❌ Component render error in "+this._.tagName,a),this.captureComponentError(a,"render",n),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this._.type,message:a instanceof Error?a.message:String(a)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,a,"render")}catch(c){this.logger.error("❌ onError hook error in "+this._.tagName,c)}}}logRenderInfo(n){const i=this._.type,o=this._.tagName,s=n>16?"🐌":n>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+i+" </"+o+"> | #"+this.renderCount+" | "+n.toFixed(2)+"ms | "+this.lastRenderTrigger),n>16&&(this.logger.warn("⚠️ Slow render in "+i+"("+o+"): "+n.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:n,threshold:16,componentType:i,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+n.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:i,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this._.useShadowDom}}))}rerender(n){this.triggerRender(n?"manual:rerender:"+n:"manual:rerender()")}captureComponentError(n,i,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",n.message,{context:"Component:"+this._.tagName+":"+i,component:{type:this._.type,tagName:this._.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this._.useShadowDom}})}catch(s){}}updateHostClasses(){const n=this.hostClasses;if(n.length>0){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}}addHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}removeHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.remove(...i)}toggleHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());for(const o of i)this.classList.toggle(o)}addHostAttribute(n,i){n&&"string"==typeof n&&i&&"string"==typeof i&&(this.setAttribute(n,String(i)),this.hostAttributes[n]=String(i))}removeHostAttribute(n){n&&"string"==typeof n&&(this.removeAttribute(n),delete this.hostAttributes[n])}updateHostAttributes(){const n=this.hostAttributes;for(const[i,o]of Object.entries(n))i&&"string"==typeof i&&o&&"string"==typeof o&&this.setAttribute(i,String(o))}get params(){return this.P}get config(){return this.themeProvider.getComponentConfig(this._.type)}get elementConfig(){return this._}getConfigs(n){return this.themeProvider.getConfigs(n)}getStoreValue(n){return this.store.get(n)}setStoreValue(n,i){return this.store.set(n,i)}watchStore(n,i){const o=this.store.watch(n,i);return this.unsubscribers.push(o),o}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var n;const i=null!==(n=this.params.options)&&void 0!==n?n:{};return ComponentFactoryService.createElement({type:w.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var n,i,o,s;const a=this.getStoreValue("address"),c=null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![],l=null!==(i=this.params.productId)&&void 0!==i?i:"",p=null!==(o=this.params.options)&&void 0!==o?o:{},m=null!==(s=p.showLabel)&&void 0!==s?s:!![],f=[];if(m){const n=document.createElement("span");n.textContent="Delivers to:",f.push(n)}const g=document.createElement("button");g.type="button",g.textContent=a.formattedAddress||"Select an address";const v=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return g.setAttribute("aria-label",v),g.addEventListener("click",async()=>{if(c)return this.commands.ui.openDrawer(w.ADDRESS_INPUT,{productId:l,isIndependentComponent:!![]}),void 0;!c&&l&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(w.ADDRESS_INPUT,{productId:l}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(l,w.ADDRESS_INPUT,{productId:l}))}),f.push(g),f}}const ArrowRightIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:n=24,height:i=24,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 489 489" class="bag-icon '+o+'" style="'+a+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="'+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="'+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 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:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+a+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+a+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="search-icon '+o+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+a+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+a+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+a+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var n;return null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![]},this.handleInputChange=n=>{const i=n.target,o=i.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");i.value=o;const s=o.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 n=this.params.productId,i=this.clientConfig.isMobile(),o=this.isIndependentComponent();(i||o)&&this.commands.ui.closeDrawer(),!i&&n&&await this.commands.product.closeProductDrawer(n)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(ht){this.logger.error("Address edit cancellation failed",ht)}},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 n=this.getStoreValue("address"),i=(null==n?void 0:n.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==n?void 0:n.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;i&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(n){this.logger.error("Address selection and availability check failed",n),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async n=>{const i=n.currentTarget.dataset.suggestionId;if(i)try{this.error=null,this.updateErrorDisplay();const n=await this.commands.address.getAddressDetails(i);if(0===Object.keys(n).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:i,address:n.address,coordinates:n.coordinates,formattedAddress:n.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(o){this.logger.error("Address details retrieval failed",o),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=n=>{this.container.contains(n.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const n=this.getStoreValue("address");(null==n?void 0:n.formattedAddress)&&(this.selectedAddress=n)}async searchAddresses(n){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const i=await this.commands.address.searchAddresses(n);this.suggestions=i.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(i){this.logger.error("Address search operation failed",i),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const n=this.errorContainer.querySelector(".error-text");n&&(n.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const n=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(n),void 0}for(const n of this.suggestions){const i=this.createElement("li",{className:"suggestion-item"}),o=this.createElement("span",{textContent:n.description});i.appendChild(o),i.setAttribute("data-suggestion-id",n.id),i.setAttribute("role","option"),i.setAttribute("aria-label","Select address: "+n.description),i.setAttribute("tabindex","0"),i.addEventListener("click",this.handleSuggestionClick),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())}),this.suggestionsContainer.appendChild(i)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(n,i){const o=document.createElement(n);return i&&Object.assign(o,i),o}createErrorContainer(){const n=this.createElement("div",{className:"error-message"});n.style.display="none",n.setAttribute("role","alert"),n.setAttribute("aria-live","assertive"),n.setAttribute("aria-atomic","true");const i=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),o=this.createElement("span",{className:"error-text"});return n.appendChild(i),n.appendChild(o),n}createCheckButton(){const n=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return n.setAttribute("aria-label","Save and check address availability"),n.addEventListener("click",this.handleCheckAvailability),n}createCancelButton(){const n=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return n.setAttribute("aria-label","Cancel address selection"),n.addEventListener("click",this.handleCancel),n}template(){var n,i,o;const s=this.getConfigs("global"),a=null!==(n=this.params.options)&&void 0!==n?n:{},c=null!==(i=a.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),c){const n=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(n)}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===(o=this.selectedAddress)||void 0===o?void 0:o.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),l.appendChild(this.inputElement);const p=this.createElement("span");p.className="input-icon",p.innerHTML=SearchIcon({width:16,height:16,className:""}),l.appendChild(p),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 m=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),f=[this.inputContainer,m,this.errorContainer],g=this.createElement("div",{className:"action-buttons"}),v=this.createCancelButton();g.appendChild(v);const y=this.createCheckButton();return g.appendChild(y),f.push(g),document.addEventListener("click",this.handleDocumentClick),f}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const n=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&n.push("cart-no-header"),this.params.isIndependentComponent&&n.push("independent"),n}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const n=[],i=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!i){const i=ComponentFactoryService.createElement({type:w.CART_HEADER});n.push(i)}const o=ComponentFactoryService.createElement({type:w.CART_BODY});n.push(o);const s=ComponentFactoryService.createElement({type:w.CART_FOOTER});return n.push(s),n}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const n=document.createElement("div");n.className="empty-cart-container";const i=document.createElement("h3");return i.className="empty-cart-content",i.textContent="Your cart is empty",n.appendChild(i),n}createLoadingElement(){const n=document.createElement("div");return n.setAttribute("data-component-type","cart-body-loading"),n.innerHTML=this.loadingTemplate(),n}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(n){try{return ComponentFactoryService.createElement({type:w.CART_RETAILER,retailerId:n.id})}catch(i){return this.logger.error("Cart retailer component creation failed",i),document.createElement("div")}}getRetailerElementById(n){return this.container.querySelector('[data-retailer-id="'+n+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const n=this.createEmptyCartElement();this.container.appendChild(n),this.setupEmptyCartListeners()}addLoadingOverlay(){const n=this.getLoadingElement();if(!n){const n=this.createLoadingElement();this.container.appendChild(n)}}removeLoadingOverlay(){const n=this.getLoadingElement();n&&n.remove()}setupEmptyCartListeners(){const n=this.container.querySelector('[data-action="continue-shopping"]');n&&n.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(n,i){const o=this.createRetailerElement(i);o.setAttribute("data-retailer-id",n),this.container.appendChild(o)}removeRetailerElement(n){const i=this.getRetailerElementById(n);i&&i.remove()}updateRetailerElement(n,i){const o=this.getRetailerElementById(n);if(o){const s=this.createRetailerElement(i);s.setAttribute("data-retailer-id",n),o.replaceWith(s)}}hasRetailerDataChanged(n,i){return n?![]:!![]}getValidRetailers(n){if(!n)return{};const i={};for(const[o,s]of Object.entries(n))s&&"object"==typeof s&&s.id&&(i[o]=s);return i}getValidRetailerIds(n){const i=this.getValidRetailers(n);return new Set(Object.keys(i))}onStoreChanged(n){const i=n.find(n=>"cart.retailers"===n.path),o=n.find(n=>"cart.loading"===n.path);if(i){const n=this.getValidRetailers(i.oldValue),o=this.getValidRetailers(i.value),s=this.getValidRetailerIds(i.oldValue),a=this.getValidRetailerIds(i.value),c=s.size,l=a.size,p=this.getValidRetailers(this.getStoreValue("cart.retailers")),m=Object.keys(p).length;if(l>0&&0===m)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===c&&l>0){this.container.innerHTML="";for(const[n,i]of Object.entries(o))this.addRetailerElement(n,i)}else if(c>0&&0===l)this.showEmptyCartState();else if(l>0){for(const n of s)a.has(n)||this.removeRetailerElement(n);for(const i of a){const a=o[i],c=n[i];s.has(i)?this.hasRetailerDataChanged(c,a)&&this.updateRetailerElement(i,a):this.addRetailerElement(i,a)}}else 0===c&&0===l&&this.showEmptyCartState()}if(o){const n=o.value,i=o.oldValue;n!==i&&(n?this.addLoadingOverlay():this.removeLoadingOverlay())}return o||i,![]}afterRender(){this.setupEmptyCartListeners();const n=this.getStoreValue("cart.loading");n&&this.addLoadingOverlay()}template(){const n=this.getStoreValue("cart.retailers")||{},i=Object.values(n);if(0===i.length)return this.createEmptyCartElement();const o=[];for(const s of i){const n=this.createRetailerElement(s);n.setAttribute("data-retailer-id",s.id),o.push(n)}return o}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(n){const i=n.some(n=>n.path.includes("cart.items")),o=n.some(n=>n.path.includes("cart.totals")),s=n.some(n=>n.path.includes("cart.fulfillments")),a=n.some(n=>"cart.loading"===n.path),c=n.some(n=>n.path.includes("cart.retailers"));if(i&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice){const n=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(n.subtotal+n.engravingFee-n.discounts)}(s||o||a||i||c)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const n=this.getStoreValue("cart.loading");if(n)return!![];const i=this.getStoreValue("cart.items")||{},o=Object.values(i).some(n=>n.updating);if(o)return!![];const s=this.getStoreValue("cart.fulfillments")||{},a=Object.values(s).some(n=>n.updating);if(a)return!![];const c=this.getStoreValue("cart.retailers")||{},l=Object.values(c).some(n=>n.updating);return l?!![]:![]}hasUnmetMinimum(n){var i;const o=n.subtotal;if(n.type===C.SHIPPING){const s=n.fees;if((null===(i=s.individual)||void 0===i?void 0:i.active)&&s.individual.min>0&&o<s.individual.min)return!![]}if(n.type===C.ON_DEMAND){const i=n.fees;if(i.min>0&&o<i.min)return!![]}return![]}shouldDisableCheckout(){const n=this.getStoreValue("cart.fulfillments")||{};return Object.values(n).some(n=>this.hasUnmetMinimum(n))}updateCheckoutButtonState(){const n=this.getStoreValue("cart.items")||{},i=Object.keys(n).length>0;if(this.checkoutButton){const n=this.isAnythingLoading(),o=this.shouldDisableCheckout(),s=n||o||!i;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",n)}}updateSubtotalItemsCount(){const n=this.getStoreValue("cart.items"),i=Object.values(n).reduce((n,i)=>n+i.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+i+" item"+(1!==i?"s":"")+"):")}async handleCheckout(n){return this.clientConfig.isBuilder()?(n.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(n.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const n=this.getConfigs("global"),i=this.getStoreValue("cart.totals"),o=[],s=document.createElement("div");s.className="cart-footer-header";const a=document.createElement("div");a.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",a.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(i.subtotal+i.engravingFee-i.discounts),a.appendChild(this.subtotalPrice);const c=document.createElement("p");if(c.textContent="Taxes & fees will be calculated at checkout",c.className="taxes-fees-info",s.appendChild(a),s.appendChild(c),o.push(s),n.layout.allowPromoCodes){const n=ComponentFactoryService.createElement({type:w.CART_PROMO_CODE});o.push(n)}const l=ComponentFactoryService.createElement({type:w.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(o.push(l),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 n=>{n.preventDefault(),await this.handleCheckout(n)}),this.checkoutButton.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handleCheckout(n))}),o.push(this.checkoutButton),n.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:w.POWERED_BY,context:"general"});o.push(n)}return o}}const shouldShowMinimumPurchaseAlert=(n,i=![])=>{var o,s;if(!n)return![];const a=n.subtotal;if(n.type===C.SHIPPING){const c=n.fees;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&a<c.pack.min)return!![];if(!i&&(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&a<c.individual.min)return!![]}else if(n.type===C.ON_DEMAND){const i=n.fees;if(i.min>0&&a<i.min)return!![]}return![]},getMinimumPurchaseMessage=(n,i=![])=>{var o,s;if(!n)return{message:"",type:"warning"};const a=n.subtotal;if(n.type===C.SHIPPING){const c=n.fees;let l=0;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0?l=c.pack.min:(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&(l=c.individual.min),l>0&&a<l)return{message:"+"+formatCentToDollarText(l-a)+" needed for order minimum",type:"warning"}}if(n.type===C.ON_DEMAND){const i=n.fees,o=i.min>0?i.min:0;if(o>0&&a<o)return{message:"+"+formatCentToDollarText(o-a)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(n,i=![])=>{var o,s;if(!n)return![];const a=n.subtotal;if(n.type===C.SHIPPING){const c=n.fees;if(i&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&a<c.pack.min)return!![];if(!i&&(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&a<c.individual.min)return!![]}if(n.type===C.ON_DEMAND){const i=n.fees;if(i.min>0&&a<i.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const n=this.config||{};if(n.showIcon===![])return null;const i={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=i[this.params.messageType]||"warning",a=document.createElement("div");return a.className="alert-icon alert-icon-"+this.params.messageType,a.appendChild(htmlStringToElement(o[s]({width:16,height:16,className:"alert-icon-svg"}))),a}template(){var n;const i=[],o=this.getIconElement();o&&i.push(o);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,i.push(s),"detailed"===(null===(n=this.config)||void 0===n?void 0:n.alertType)&&this.params.currentTotal){const n=document.createElement("div");n.className="alert-details";const o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),n.appendChild(o),i.push(n)}return i}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||{};return Object.values(i).find(i=>i.fulfillmentId===n)}handleItemsUpdate(n,i){const o=new Set(n||[]),s=new Set(i||[]);for(const a of o)if(!s.has(a)){const n=this.container.querySelector('[data-item-id="'+a+'"]');n&&n.remove()}for(const a of s)if(!o.has(a)){const n=ComponentFactoryService.createElement({type:w.CART_ITEM,itemId:a});n.setAttribute("data-item-id",a),this.container.appendChild(n)}}setupItemElements(){const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||[],o=this.container.querySelectorAll("[data-item-id]");for(const s of o)s.remove();for(const s of i){const n=ComponentFactoryService.createElement({type:w.CART_ITEM,itemId:s});n.setAttribute("data-item-id",s),this.container.appendChild(n)}}setupMinimumPurchaseAlert(){var n;const i=this.getFulfillmentId(),o=(null===(n=this.getProductStore())||void 0===n?void 0:n.pack)||![],s=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),s&&shouldShowMinimumPurchaseAlert(s,o)){const n=getMinimumPurchaseMessage(s,o),i=ComponentFactoryService.createElement({type:w.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});i.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(i)}}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","fulfillment-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(o),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var n;const i=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+i);return(null===(n=null==o?void 0:o.items)||void 0===n?void 0:n.length)?o.items.some(n=>{const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.updating)===!![]}):![]}checkAndUpdateLoadingState(){const n=this.isAnyItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}onStoreChanged(n){const i=this.getFulfillmentId(),o="cart.fulfillments."+i,s=n.find(n=>n.path===o),a=n.filter(n=>"cart.items"===n.path||n.path.startsWith("cart.items."));if(a.length>0&&this.checkAndUpdateLoadingState(),s){const n=s.oldValue,i=s.value,o=(null==n?void 0:n.items)||[],a=(null==i?void 0:i.items)||[],c=JSON.stringify(o)!==JSON.stringify(a);c&&(this.handleItemsUpdate(o,a),this.checkAndUpdateLoadingState());const l=this.hasFulfillmentFeesChanged(n,i),p=this.hasFulfillmentDataChanged(n,i,["items","updating"]);if(l&&!p&&this.setupMinimumPurchaseAlert(),!p)return![]}return![]}hasFulfillmentFeesChanged(n,i){return n?n.subtotal!==i.subtotal||n.shippingFee!==i.shippingFee||n.deliveryFee!==i.deliveryFee||JSON.stringify(n.fees)!==JSON.stringify(i.fees):!![]}hasFulfillmentDataChanged(n,i,o=[]){if(!n)return!![];const s=["type","canEngrave","retailerId"];for(const a of s)if(!o.includes(a)&&n[a]!==i[a])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const It={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"},Tt="America/New_York";function detectUserTimezone(n){try{if(n){const i=n.toUpperCase(),o=It[i];return o||Tt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return Tt}}function getCurrentTimeInTimezone(n){try{const i=new Date,o=i.getTime(),s=6e4*i.getTimezoneOffset(),a=new Date(o+s),c=new Date(a.toLocaleString("en-US",{timeZone:n})),l=a.getTime()-c.getTime();return new Date(o+l)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(n){const i=detectUserTimezone(n);return getCurrentTimeInTimezone(i)}function isDateTimeInRange(n){const{startDate:i,endDate:o,addressState:s}=n;try{const n=getCurrentTimeInUserTimezone(s),a=!i||n>=new Date(i),c=!o||n<=new Date(o);return a&&c}catch(a){return![]}}function filterActiveItems(n,i){return n.filter(n=>isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:i}))}function hasActiveItems(n,i){return filterActiveItems(n,i).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var n,i,o;const s=this.config.layout.drawerHeaderText,a=this.getConfigs("global"),c=document.createElement("div");c.className="cart-header-content";const l=document.createElement("h2");l.className="cart-title",l.textContent=s,c.appendChild(l);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()}),c.appendChild(p);const m=this.clientConfig.get("promoTicker"),f=null!==(i=null===(n=null==a?void 0:a.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],g=null!=m?m:f,v=this.store.get("address"),y=hasActiveItems(g,null===(o=null==v?void 0:v.address)||void 0===o?void 0:o.state);if(!g.length||!y)return[c];const b=ComponentFactoryService.createElement({context:"cart",type:w.PROMO_CODE_TICKER,tickers:g});return[c,b]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(n,i){var o,s,a,c,l,p,m,f,g,v;this.commands.ui.openDrawer(w.ENGRAVING_FORM,{identifier:n,context:"cart",lines:(null===(s=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[],maxLines:(null===(c=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxLines)||1,maxCharsPerLine:(null===(p=null===(l=i.attributes)||void 0===l?void 0:l.engraving)||void 0===p?void 0:p.maxCharsPerLine)||16,fee:(null===(f=null===(m=i.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.fee)||0,location:null===(v=null===(g=i.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.location})}template(){var n,i,o,s,a,c,l,p,m;const f=this.params.itemId,g=this.getStoreValue("cart.items."+f),v=this.getConfigs("global"),y=this.getStoreValue("cart.fulfillments."+g.fulfillmentId),b=g.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(n=null==y?void 0:y.expectation)||void 0===n?void 0:n.detail)||"",C=document.createElement("article");C.className="cart-item";const k=document.createElement("div");k.className="item-image";const S=document.createElement("img");S.src=g.mainImage,S.alt=g.name,k.appendChild(S);const I=document.createElement("div");I.className="item-details";const T=document.createElement("div");T.className="item-header";const D=document.createElement("h3");D.className="item-title",D.textContent=g.name;const A=document.createElement("button");A.className="item-delete",A.innerHTML=TrashIcon({}),A.setAttribute("role","button"),A.setAttribute("tabindex","0"),A.setAttribute("aria-label","Remove "+g.name+" from cart"),A.setAttribute("aria-expanded","true"),A.addEventListener("click",async()=>{await this.commands.cart.removeItem(f)}),A.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.commands.cart.removeItem(f))}),T.appendChild(D),T.appendChild(A);const P=document.createElement("div");P.className="item-specs",P.textContent=g.size+", "+g.container;const _=document.createElement("div");_.className="item-shipping-container";const N=document.createElement("div");if(N.className="item-shipping",N.textContent=b,_.appendChild(N),v.layout.enablePersonalization&&(null===(o=null===(i=null==g?void 0:g.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.isEngravable)&&(null===(a=null===(s=null==g?void 0:g.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&y.canEngrave){const n=document.createElement("span");n.className="cart-add-personalization-span",n.textContent=v.layout.personalizationText+" +"+formatCentToDollarText((null===(l=null===(c=g.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,![]),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Add personalization to "+g.name),n.addEventListener("click",()=>this.handleOpenEngravingForm(f,g)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleOpenEngravingForm(f,g))}),_.appendChild(n)}I.appendChild(T),I.appendChild(P),I.appendChild(_),C.appendChild(k),C.appendChild(I);const F=[C],O=ComponentFactoryService.createElement({type:w.CART_ITEM_QUANTITY_PRICE,itemId:f});if((null===(m=null===(p=null==g?void 0:g.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:w.ENGRAVING_VIEW,identifier:f,context:"cart"});F.push(n)}return F.push(O),F}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(n){const i=n.find(n=>"cart.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getItemStore(){const n=this.params.itemId,i=this.getStoreValue("cart.items."+n);return i||null}calculateQuantityLimits(){const n=this.getItemStore();if(!n)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const i=n.quantity,o=this.getAvailableQuantity(),s=o>0;return{currentQuantity:i,availableQuantity:o,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var n,i,o,s;const a=this.getItemStore();if(!a)return 0;const c=a.partNumber,l=a.fulfillmentId,p=this.getStoreValue("cart.items")||{},m=Object.values(p).filter(n=>n.partNumber===c&&n.fulfillmentId===l),f=m.reduce((n,i)=>n+i.quantity,0),g=this.getStoreValue("products."+a.upc)||this.getStoreValue("products."+a.salsifyGrouping);if(!g)return a.maxQuantity-f;const v=null!==(s=null===(o=null===(i=null===(n=null==g?void 0:g.sizes)||void 0===n?void 0:n[a.liquidId])||void 0===i?void 0:i.attributes)||void 0===o?void 0:o.maxQuantityPerOrder)&&void 0!==s?s:0;return!v||v<=0?a.maxQuantity-f:v-f}updateButtonStates(n){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!n.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!n.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits();n>0&&!i.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,n)}createQuantityContainer(){const n=this.calculateQuantityLimits(),i=this.getItemStore();if(!i)return document.createElement("div");const o=document.createElement("div");return o.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async n=>{n.preventDefault(),n.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 n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(n),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantitySpan),o.appendChild(this.qtyIncreaseButton),o}createPriceContainer(){const n=this.getItemStore();if(!n)return document.createElement("div");const i=document.createElement("div");i.className="item-price-container";const o=document.createElement("span");if(o.className="item-price",o.textContent=formatCentToDollarText(n.price),i.appendChild(o),n.quantity>1){const o=document.createElement("span");o.className="item-price-per-unit",o.textContent="("+formatCentToDollarText(n.unitPrice)+" ea)",i.appendChild(o)}return i}template(){const n=[];if(this.config.layout.showQuantityCounter){const i=this.createQuantityContainer();n.push(i)}const i=this.createPriceContainer();return n.push(i),n}}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(n){const i=n.find(n=>"cart.promoCode"===n.path);if(i){const{value:n,oldValue:o}=i,s=Boolean(null==o?void 0:o.code),a=Boolean(null==n?void 0:n.code);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;if(a&&this.promoCodePill&&n.discountAmount!==(null==o?void 0:o.discountAmount))return this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",void 0}}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+(null==n?void 0:n.code)),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){const n=document.createElement("div");n.classList.add("promo-code-container");const i=document.createElement("div");i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),n.appendChild(i),this.container.appendChild(n),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),a=this.getStoreValue("cart.events")||[],c=hasCartAnyPromoCodeEvents(a);this.applyButton.disabled=!i||o||Boolean(null==s?void 0:s.discountAmount)||this.isApplying||c}createPromoInput(){const n=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+n.layout.inputFieldStyle,validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),o=this.promoInput;o.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const t=async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(n),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(i){this.logger.error("Cart promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}};return this.applyButton.addEventListener("click",t),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t())}),this.applyButton}template(){const n=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==n?void 0:n.code){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+n.code),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),i}const i=document.createElement("div");i.classList.add("promo-code-container");const o=document.createElement("div");return o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),i.appendChild(o),i}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(n){return ComponentFactoryService.createElement({type:w.CART_FULFILLMENT,fulfillmentId:n})}getFulfillmentElementById(n){return this.container.querySelector('[data-fulfillment-id="'+n+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const n=this.getFulfillmentContainer();if(n)return{parent:n.parentElement,nextSibling:n.nextElementSibling};const i=this.container.querySelectorAll("[data-fulfillment-id]");if(i.length>0){const n=i[i.length-1];return{parent:n.parentElement,nextSibling:n.nextElementSibling}}return null}addFulfillmentElement(n){const i=this.getFulfillmentInsertionPoint();if(i){const o=this.createFulfillmentElement(n);o.setAttribute("data-fulfillment-id",n);const s=this.getFulfillmentContainer();s&&s.remove(),i.nextSibling?i.parent.insertBefore(o,i.nextSibling):i.parent.appendChild(o)}}removeFulfillmentElement(n){const i=this.getFulfillmentElementById(n);if(i){const n=i.parentElement,o=i.nextElementSibling;i.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const i=document.createElement("div");i.id="retailer-fulfillment-container",o?n.insertBefore(i,o):n.appendChild(i)}}}handleFulfillmentsUpdate(n,i){const o=new Set(n||[]),s=new Set(i||[]);for(const a of o)s.has(a)||this.removeFulfillmentElement(a);for(const a of s)o.has(a)||this.addFulfillmentElement(a)}setupFulfillmentElements(){const n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const a of o)a.remove();let s=this.getFulfillmentContainer();if(!s){const n=this.container.querySelector(".retailer-body-container"),i=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",n&&i&&n.insertBefore(s,i)}for(const a of i)this.addFulfillmentElement(a)}setupSubtotalElement(){const n=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const o=ComponentFactoryService.createElement({type:w.CART_RETAILER_SUBTOTAL,retailerId:n});i.replaceWith(o)}}onStoreChanged(n){const i=this.getRetailerId(),o="cart.retailers."+i,s=n.find(n=>n.path===o);if(s){const n=s.oldValue,i=s.value,o=(null==n?void 0:n.fulfillments)||[],a=(null==i?void 0:i.fulfillments)||[];JSON.stringify(o)!==JSON.stringify(a)&&this.handleFulfillmentsUpdate(o,a)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const n=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section"),o=this.container.querySelector(".section-header-label");if(n&&i&&o){const u=()=>{const i=n.checked;o.setAttribute("aria-label",i?"Expand retailer section":"Collapse retailer section"),o.setAttribute("aria-expanded",i?"false":"true")};n.addEventListener("change",()=>{n.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),u()}),o.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())}),n.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),u()}}template(){const n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n),o=document.createElement("section");o.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=i.name,a.appendChild(c);const l=document.createElement("input");l.type="checkbox",l.id=i.id,l.className="section-toggle",a.appendChild(l);const p=document.createElement("label");p.htmlFor=i.id,p.className="section-header-label",p.setAttribute("role","button"),p.setAttribute("tabindex","0"),p.setAttribute("aria-label","Collapse retailer section"),p.setAttribute("aria-expanded","true");const m=document.createElement("span");m.className="chevron",m.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),p.appendChild(m),a.appendChild(p),s.appendChild(a),o.appendChild(s);const f=document.createElement("div");f.className="retailer-body-container";const g=document.createElement("div");g.id="retailer-fulfillment-container",f.appendChild(g);const v=document.createElement("div");return v.id="retailer-subtotal-container",f.appendChild(v),o.appendChild(f),o}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(n,i){const o=Object.values(n||{}).filter(n=>n.retailerId===i);let s=0;for(const a of o)s+=a.quantity;return s}template(){const n=this.params.retailerId,i=this.getStoreValue("cart.retailers."+n+".subtotal")||0,o=this.getStoreValue("cart.retailers."+n+".engravingFee")||0,s=this.getStoreValue("cart.items"),a=this.getRetailerItemCount(s,n),c=1===a?"item":"items",l=document.createElement("h3");l.className="retailer-subtotal-header",l.textContent="Subtotal ("+a+" "+c+"):";const p=document.createElement("span");return p.className="retailer-subtotal-amount",p.textContent=formatCentToDollarText(i+o),[l,p]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var n,i,o;const s=this.store.get("checkout.presale"),a=this.getConfigs("global"),c=this.clientConfig.get("promoTicker"),l=null!==(i=null===(n=null==a?void 0:a.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],p=null!=c?c:l,m=this.store.get("address"),f=hasActiveItems(p,null===(o=null==m?void 0:m.address)||void 0===o?void 0:o.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 y=ComponentFactoryService.createElement({type:w.CHECKOUT_INFORMATION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:w.CHECKOUT_ORDER_SUMMARY});if(v.appendChild(b),!s&&(!p.length||!f)&&g)return[v];const C=document.createElement("div");if(C.classList.add("checkout-header-wrapper"),!g){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_HEADER});C.appendChild(n)}if(p.length&&f&&!s){const n=ComponentFactoryService.createElement({context:"checkout",type:w.PROMO_CODE_TICKER,tickers:p});C.appendChild(n)}if(s){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_PRESALE_COUNTDOWN});C.appendChild(n)}return[C,v]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var n,i,o;const s=this.getStoreValue("checkout"),a=Boolean(s.promoCode),c=Boolean(null===(n=s.giftCards)||void 0===n?void 0:n.length),l=this.getConfigs("global"),p=Object.keys(s.onDemandFulfillmentTipInfo||{}).length>0,m=Object.values(s.items||{}),f=[],g=document.createElement("div");g.classList.add("checkout-amount-line");const v=document.createElement("span");v.textContent="Subtotal ("+m.length+" item"+(m.length>1?"s":"")+")",g.appendChild(v);const y=document.createElement("span");y.textContent=formatCentToDollarText(s.amounts.subtotal),g.appendChild(y),f.push(g);const b=document.createElement("div");b.classList.add("checkout-amount-line");const w=document.createElement("span");w.textContent="Shipping",b.appendChild(w);const C=document.createElement("span");C.textContent=formatCentToDollarText(s.amounts.shipping),b.appendChild(C),f.push(b);const k=document.createElement("div");k.classList.add("checkout-amount-line");const S=document.createElement("span");S.textContent="Delivery",k.appendChild(S);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(s.amounts.delivery),k.appendChild(I),f.push(k),(null===(i=null==s?void 0:s.amounts)||void 0===i?void 0:i.engraving)>0){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Engraving",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(s.amounts.engraving),n.appendChild(o),f.push(n)}const T=document.createElement("div");T.classList.add("checkout-amount-line");const D=document.createElement("span");D.textContent="Taxes & Fees",T.appendChild(D);const A=document.createElement("span");if(A.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),T.appendChild(A),f.push(T),a){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Promo Code ("+(null===(o=s.promoCode)||void 0===o?void 0:o.code.toUpperCase())+")",n.appendChild(i);const a=document.createElement("span");a.textContent="-"+formatCentToDollarText(s.amounts.discounts),n.appendChild(a),f.push(n)}if(c){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Gift Cards Applied",n.appendChild(i);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(s.amounts.giftCards),n.appendChild(o),f.push(n)}if(p){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Tips",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(s.amounts.tip),n.appendChild(o),f.push(n)}const P=document.createElement("div");P.classList.add("checkout-separator"),f.push(P);const _=document.createElement("div");_.classList.add("checkout-amount-total");const N=document.createElement("span");N.textContent="Total",_.appendChild(N);const F=document.createElement("span");if(F.textContent=formatCentToDollarText(s.amounts.total),_.appendChild(F),f.push(_),s.presale){const n=document.createElement("div");n.classList.add("checkout-amount-due");const i=document.createElement("span");i.textContent="Amount due today",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),n.appendChild(o),f.push(n);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const a=htmlStringToElement(InfoIcon({color:l.theme.defaultTextColor}));s.appendChild(a);const c=document.createElement("p");c.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(c),f.push(s)}return f}}const Dt="lce-checkout-stripe-slot",At={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Pt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},_t={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};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 n=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),i=document.createElement("div");i.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const 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",n?"true":"false"),n&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),i.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.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"),o.appendChild(s),o.appendChild(a),i.appendChild(o),i}updateSaveButtonState(){const n=!Object.values(this.billingData).every(n=>n.isValid),i={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,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!n,i)}template(){const n=this.getStoreValue("checkout.paymentForm"),i=[],o=this.billingSameAsShippingToggle();if(i.push(o),n.billingSameAsShipping)return i;n.data&&(n.data.firstName&&(this.billingData.firstName={isValid:!![],value:n.data.firstName}),n.data.lastName&&(this.billingData.lastName={isValid:!![],value:n.data.lastName}),n.data.email&&(this.billingData.email={isValid:!![],value:n.data.email}),n.data.phone&&(this.billingData.phone={isValid:!![],value:n.data.phone}),n.data.company&&(this.billingData.company={isValid:!![],value:n.data.company}),n.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:n.data.addressOne}),n.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:n.data.addressTwo}),n.data.city&&(this.billingData.city={isValid:!![],value:n.data.city}),n.data.state&&(this.billingData.state={isValid:!![],value:n.data.state}),n.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:n.data.zipCode})),this.updateSaveButtonState();const s=document.createElement("div");s.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),s.appendChild(a);const c=document.createElement("p");c.textContent="Provide the info relevant to your payment method",c.classList.add("section-subtitle"),s.appendChild(c),i.push(s);const l=document.createElement("div");l.classList.add("section-form-container");const p=document.createElement("div");p.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.firstName.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.firstName})},onValidation:n=>{this.billingData.firstName.isValid=n,this.updateSaveButtonState()}});m.setAttribute("aria-label","First name input"),p.appendChild(m);const f=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.lastName.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.lastName})},onValidation:n=>{this.billingData.lastName.isValid=n,this.updateSaveButtonState()}});f.setAttribute("aria-label","Last name input"),p.appendChild(f),l.appendChild(p);const g=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.email.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.email})},onValidation:n=>{this.billingData.email.isValid=n,this.updateSaveButtonState()}});g.setAttribute("aria-label","Email input"),l.appendChild(g);const v=document.createElement("div");v.classList.add("checkout-two-col-container");const y=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.phone.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.phone})},onValidation:n=>{this.billingData.phone.isValid=n,this.updateSaveButtonState()}});y.setAttribute("aria-label","Phone input"),v.appendChild(y);const C=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],onChange:async n=>{this.billingData.company.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.company})},onValidation:n=>{this.billingData.company.isValid=n,this.updateSaveButtonState()}});C.setAttribute("aria-label","Company input"),v.appendChild(C),l.appendChild(v);const k=document.createElement("div");k.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.addressOne.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.addressOne})},onValidation:n=>{this.billingData.addressOne.isValid=n,this.updateSaveButtonState()}});S.setAttribute("aria-label","Street address input"),k.appendChild(S);const I=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async n=>{this.billingData.addressTwo.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.addressTwo})},onValidation:n=>{this.billingData.addressTwo.isValid=n,this.updateSaveButtonState()}});I.setAttribute("aria-label","Apt, suite, etc. (optional) input"),k.appendChild(I),l.appendChild(k);const T=document.createElement("div");T.classList.add("checkout-three-col-container");const D=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.city.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.city})},onValidation:n=>{this.billingData.city.isValid=n,this.updateSaveButtonState()}});D.setAttribute("aria-label","City input"),T.appendChild(D);const A=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:n=>n&&2===n.length&&/^[A-Z]{2}$/.test(n)?null:"State must be 2 uppercase characters"},onChange:async n=>{this.billingData.state.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.state})},onValidation:n=>{this.billingData.state.isValid=n,this.updateSaveButtonState()}});A.setAttribute("aria-label","State input"),T.appendChild(A);const P=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async n=>{this.billingData.zipCode.value=n,this.pubSub.publishForm(b.BILLING,{fieldName:_t.zipCode})},onValidation:n=>{this.billingData.zipCode.isValid=n,this.updateSaveButtonState()}});return P.setAttribute("aria-label","Zip Code input"),T.appendChild(P),l.appendChild(T),i.push(l),i}}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(n){const i=n.find(n=>"checkout.customerForm.isSaving"===n.path);i&&(i.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 n=this.store.get("checkout.customerForm.data");n.firstName&&(this.customerData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.customerData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.customerData.email={isValid:!![],value:n.email}),n.phone&&(this.customerData.phone={isValid:!![],value:n.phone}),n.company&&(this.customerData.company={isValid:!![],value:n.company}),n.birthDate&&(this.customerData.birthDate={isValid:!![],value:n.birthDate});const i=[],o=document.createElement("div");o.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),o.appendChild(s);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),o.appendChild(a),i.push(o);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:n.firstName,onChange:async n=>{this.customerData.firstName.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.firstName})},onValidation:n=>{this.customerData.firstName.isValid=n,this.updateSaveButtonState()}});l.appendChild(p);const m=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:n.lastName,onChange:async n=>{this.customerData.lastName.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.lastName})},onValidation:n=>{this.customerData.lastName.isValid=n,this.updateSaveButtonState()}});l.appendChild(m),c.appendChild(l);const f=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.company,label:"Company (optional)",autocomplete:!![],value:n.company,onChange:async n=>{this.customerData.company.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.company})},onValidation:n=>{this.customerData.company.isValid=n,this.updateSaveButtonState()}});c.appendChild(f);const g=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:At.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:n.email,onChange:async n=>{this.customerData.email.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.email})},onValidation:n=>{this.customerData.email.isValid=n,this.updateSaveButtonState()}});c.appendChild(g);const v=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:At.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:n.phone,onChange:async n=>{this.customerData.phone.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.phone})},onValidation:n=>{this.customerData.phone.isValid=n,this.updateSaveButtonState()}});c.appendChild(v);const y=ComponentFactoryService.createElement({type:w.BIRTHDATE_INPUT,inputType:"date",name:At.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:n.birthDate,onChange:async n=>{this.customerData.birthDate.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.birthDate})},onValidation:n=>{this.customerData.birthDate.isValid=n,this.updateSaveButtonState()}});return c.appendChild(y),i.push(c),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:""})}),i.push(this.saveButton),this.updateSaveButtonState(),i}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const n=[],i=this.getStoreValue("checkout.customerForm.data"),o=document.createElement("div");o.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent="Buyer: "+i.firstName+" "+i.lastName,o.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 n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.editCustomerForm())}),o.appendChild(a),n.push(o),i.company){const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=i.company,n.push(o)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=i.email,n.push(c);const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=i.phone,n.push(l);const p=document.createElement("p");return p.classList.add("checkout-summary-form-line"),p.textContent=formatISODateToMMDDYYYY(i.birthDate),n.push(p),n}}const Nt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Ft={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(n,i){return"href"===n?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(i)?i:null:"src"===n?/^https?:\/\/[^\s<>"']+$/i.test(i)?i:null:"class"===n?i.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():i.replace(/[<>"']/g,"").trim()}function cleanNode(n){if(n.nodeType===Node.TEXT_NODE){const i=n.textContent||"",o=i.replace(/<[^>]*>/g,"");if(o.trim()){const n=document.createTextNode(o);return n}return null}if(n.nodeType===Node.ELEMENT_NODE){const i=n,o=i.tagName.toLowerCase();if(Nt.includes(o)){const n=document.createElement(o),s=Ft[o]||[];for(const o of Array.from(i.attributes)){const i=o.name.toLowerCase();if(s.includes(i)){const s=sanitizeAttributeValue(i,o.value);null!==s&&n.setAttribute(i,s)}}"a"===o&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(i.childNodes)){const i=cleanNode(o);i&&n.appendChild(i)}return n}const s=document.createDocumentFragment();for(const n of Array.from(i.childNodes)){const i=cleanNode(n);i&&s.appendChild(i)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(n){if(!n||"string"!=typeof n)return"";try{const i=new DOMParser,o=i.parseFromString(n,"text/html"),s=o.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const a=document.createDocumentFragment();for(const n of Array.from(o.body.childNodes)){const i=cleanNode(n);i&&a.appendChild(i)}const c=document.createElement("div");return c.appendChild(a),c.innerHTML}catch(i){return console.error("HTML sanitization error:",i),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var n,i,o,s,a,c;const l=[],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===(i=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===i?void 0:i.customLogo){const n=document.createElement("div");n.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=null===(s=null===(o=this.config.layout)||void 0===o?void 0:o.checkoutCompleted)||void 0===s?void 0:s.customLogo,i.alt=p.partnerName+" Logo",n.appendChild(i),l.push(n)}const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-container");const C=document.createElement("div");C.classList.add("checkout-completed-title-section");const k=document.createElement("h3");k.innerHTML=(null===(c=null===(a=this.config.layout)||void 0===a?void 0:a.checkoutCompleted)||void 0===c?void 0:c.customText)||"Thank You for Your Order!",C.appendChild(k);const S=document.createElement("p");S.textContent="Your payment has been successfully processed.",C.appendChild(S),b.appendChild(C),y.appendChild(b);const I=document.createElement("div");I.classList.add("checkout-completed-sub-section");const T=document.createElement("div");T.classList.add("checkout-completed-line");const D=document.createElement("h3");D.textContent="Order Number",T.appendChild(D);const A=document.createElement("span");A.textContent=this.params.orderNumber,T.appendChild(A),I.appendChild(T);const P=document.createElement("div");P.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Amount",P.appendChild(_);const N=document.createElement("span");N.textContent=""+formatCentToDollarText(this.params.orderTotal),P.appendChild(N),I.appendChild(P);const F=document.createElement("div");F.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Payment Method",F.appendChild(O);const L=document.createElement("span");L.textContent="** "+this.params.cardLast4,F.appendChild(L),I.appendChild(F),y.appendChild(I);const z=document.createElement("div");z.classList.add("checkout-completed-sub-section");const M=document.createElement("p");M.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>.",z.appendChild(M),y.appendChild(z),l.push(y);const W=document.createElement("div");W.classList.add("checkout-completed-section-container");const H=document.createElement("button");H.type="button";const G=document.createElement("span");G.textContent=v,H.setAttribute("tabindex","0"),H.setAttribute("role","button"),H.setAttribute("aria-label",v),H.appendChild(G);const V=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:m.theme.selectedTextColor}));H.appendChild(V),H.addEventListener("click",()=>{window.location.href=g}),H.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),window.location.href=g)}),W.appendChild(H),l.push(W);const K=document.createElement("div");K.classList.add("checkout-completed-section-container");const Q=document.createElement("div");Q.classList.add("checkout-completed-help-section"),K.appendChild(Q);const Z=document.createElement("p");Z.textContent="Questions about your order? Contact us at ";const X=document.createElement("a");X.href="mailto:"+p.supportEmail,X.textContent=p.supportEmail,Z.appendChild(X),Q.appendChild(Z);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,Q.appendChild($),l.push(K),f.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(f.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),l.push(n),l.push(i),l.push(o)}if(m.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:w.POWERED_BY,context:"general"});l.push(n)}return l}}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(n){const i=n.find(n=>"checkout.customerForm.isSaving"===n.path),o=n.find(n=>"checkout.giftRecipientForm.isSaving"===n.path);(null==i?void 0:i.value)||(null==o?void 0:o.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const n=this.getStoreValue("checkout.isGift")||![];let i;i=n?!(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=i}template(){const n=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift"),o=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("address.formattedAddress"),c=i?o:s,l=this.store.get("checkout.shippingAddressTwo"),p=this.store.get("checkout.deliveryInstructions");s.firstName&&(this.customerData.firstName={isValid:!![],value:s.firstName}),s.lastName&&(this.customerData.lastName={isValid:!![],value:s.lastName}),s.email&&(this.customerData.email={isValid:!![],value:s.email}),s.phone&&(this.customerData.phone={isValid:!![],value:s.phone}),s.company&&(this.customerData.company={isValid:!![],value:s.company}),s.birthDate&&(this.customerData.birthDate={isValid:!![],value:s.birthDate}),o.firstName&&(this.giftData.firstName={isValid:!![],value:o.firstName}),o.lastName&&(this.giftData.lastName={isValid:!![],value:o.lastName}),o.email&&(this.giftData.email={isValid:!![],value:o.email}),o.phone&&(this.giftData.phone={isValid:!![],value:o.phone}),o.message&&(this.giftData.message={isValid:!![],value:o.message}),l&&(this.customerData.addressTwo={isValid:!![],value:l},this.giftData.addressTwo={isValid:!![],value:l}),p&&(this.customerData.deliveryInstructions={isValid:!![],value:p},this.giftData.deliveryInstructions={isValid:!![],value:p});const m=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,f=[],g=document.createElement("div");g.classList.add("delivery-header-container");const v=document.createElement("div");v.classList.add("delivery-header-content");const y=document.createElement("div");y.classList.add("delivery-title-container");const C=document.createElement("h3");C.textContent="Deliver to",C.classList.add("delivery-title");const k=document.createElement("p");k.textContent="Package recipient must be 21+",k.classList.add("delivery-subtitle"),y.appendChild(C),y.appendChild(k),g.appendChild(y),f.push(g);const S=document.createElement("div");S.classList.add("section-form-container");const I=document.createElement("div");I.classList.add("checkout-two-col-container");const T=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:i?Pt.firstName:At.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:n=>{i?(this.giftData.firstName.value=n,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.firstName})):(this.customerData.firstName.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.firstName}))},onValidation:n=>{i?this.giftData.firstName.isValid=n:this.customerData.firstName.isValid=n,this.updateSaveButtonState()}});T.setAttribute("aria-label","First Name Input"),I.appendChild(T);const D=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:i?Pt.lastName:At.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:n=>{i?(this.giftData.lastName.value=n,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.lastName})):(this.customerData.lastName.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.lastName}))},onValidation:n=>{i?this.giftData.lastName.isValid=n:this.customerData.lastName.isValid=n,this.updateSaveButtonState()}});if(D.setAttribute("aria-label","Last Name Input"),I.appendChild(D),S.appendChild(I),!i){const n=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async n=>{this.customerData.company.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.company})},onValidation:n=>{this.customerData.company.isValid=n,this.updateSaveButtonState()}});n.setAttribute("aria-label","Company Input"),S.appendChild(n)}const A=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:i?Pt.email:At.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:n=>{i?(this.giftData.email.value=n,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.email})):(this.customerData.email.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.email}))},onValidation:n=>{i?this.giftData.email.isValid=n:this.customerData.email.isValid=n,this.updateSaveButtonState()}});A.setAttribute("aria-label","Email Input"),S.appendChild(A);const P=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:i?Pt.phone:At.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:n=>{i?(this.giftData.phone.value=n,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.phone})):(this.customerData.phone.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.phone}))},onValidation:n=>{i?this.giftData.phone.isValid=n:this.customerData.phone.isValid=n,this.updateSaveButtonState()}});if(P.setAttribute("aria-label","Phone Input"),S.appendChild(P),!i){const n=ComponentFactoryService.createElement({type:w.BIRTHDATE_INPUT,inputType:"date",name:At.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async n=>{this.customerData.birthDate.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.birthDate})},onValidation:n=>{this.customerData.birthDate.isValid=n,this.updateSaveButtonState()}});n.setAttribute("aria-label","Birthdate Input"),S.appendChild(n)}const _=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input"});_.setAttribute("aria-label","Delivery Address Input"),S.appendChild(_);const N=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:i?Pt.addressTwo:At.addressTwo,label:"Apt, suite, etc. (optional)",value:l,onChange:n=>{i?(this.giftData.addressTwo.value=n,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.addressTwo})):(this.customerData.addressTwo.value=n,this.pubSub.publishForm(b.CUSTOMER,{fieldName:At.addressTwo}))},onValidation:n=>{i?this.giftData.addressTwo.isValid=n:this.customerData.addressTwo.isValid=n,this.updateSaveButtonState()}});if(N.setAttribute("aria-label","Address Line 2 Input"),S.appendChild(N),i){const i=document.createElement("div");i.classList.add("custom-input","textarea",n.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Gift Message*",s.setAttribute("for",Pt.message);const a=document.createElement("textarea");a.name=Pt.message,a.id=Pt.message,a.rows=4,a.value=o.message||"",a.setAttribute("aria-label","Gift Message Textarea"),a.addEventListener("input",async n=>{const i=n.target.value;this.giftData.message.value=i,this.giftData.message.isValid=i.length>0,this.pubSub.publishForm(b.GIFT,{fieldName:Pt.message}),this.updateSaveButtonState()});const c=document.createElement("p");c.textContent="Your gift message will be emailed to the recipient along with delivery details.",c.classList.add("textarea-message-disclaimer"),i.appendChild(s),i.appendChild(a),i.appendChild(c),S.appendChild(i)}if(m){const o=document.createElement("div");o.classList.add("custom-input","textarea",n.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=p,a.addEventListener("input",async n=>{const o=n.target.value;i?(this.giftData.deliveryInstructions.value=o,this.giftData.deliveryInstructions.isValid=o.length>0):(this.customerData.deliveryInstructions.value=o,this.customerData.deliveryInstructions.isValid=o.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"),o.appendChild(s),o.appendChild(a),o.appendChild(c),S.appendChild(o)}f.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 x=async()=>{i?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",x),this.saveButton.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await x())}),f.push(this.saveButton),this.updateSaveButtonState(),f}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const n=[],i=this.getStoreValue("checkout.isGift"),o=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"),p=document.createElement("div");p.classList.add("checkout-summary-form-header");const m=document.createElement("h2");m.textContent=i?"Delivering to "+s.firstName+" "+s.lastName:"Delivering to "+o.firstName+" "+o.lastName,p.appendChild(m);const f=document.createElement("span");f.textContent="Edit",f.setAttribute("aria-label","Edit Delivery Information"),f.setAttribute("role","button"),f.setAttribute("tabindex","0");const h=async()=>{i?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(f.addEventListener("click",h),f.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await h())}),p.appendChild(f),n.push(p),!i&&o.company){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=o.company,n.push(i)}const g=document.createElement("p");g.classList.add("checkout-summary-form-line"),g.textContent=a.address.one+(l?", "+l:"")+", "+a.address.city+", "+a.address.state+", "+a.address.zip,n.push(g);const v=document.createElement("p");v.classList.add("checkout-summary-form-line"),v.textContent=i?s.email:o.email,n.push(v);const y=document.createElement("p");if(y.classList.add("checkout-summary-form-line"),y.textContent=i?s.phone:o.phone,n.push(y),!i&&o.birthDate){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=formatISODateToMMDDYYYY(o.birthDate),n.push(i)}if(i){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Gift Message:",i.appendChild(o);const a=document.createElement("span");a.classList.add("checkout-summary-form-line"),a.textContent=s.message||"No message provided.",i.appendChild(a),n.push(i)}if(c){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Delivery Instructions:",i.appendChild(o);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=c||"No instructions provided.",i.appendChild(s),n.push(i)}return n}}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(n){var i;const o=n.find(n=>"checkout.giftCards"===n.path),s=n.find(n=>"checkout.loading"===n.path);o&&o.value.length>((null===(i=o.oldValue)||void 0===i?void 0:i.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const n=this.giftCardInput.getValue().trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!i||o||Boolean(s)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),o=this.giftCardInput;o.setValue(i),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const t=async()=>{const n=this.giftCardInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(n)}catch(i){this.logger.error("Checkout gift card application failed",{giftCardCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",t),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const n=[];return n.push(this.createGiftCardInput()),n.push(this.createApplyButton()),n}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const n=this.store.get("checkout.presale"),i=this.getConfigs("checkout");let o=null;if(!n){o=document.createElement("button"),o.classList.add("checkout-header-button"),o.setAttribute("aria-label","Back to Cart"),o.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(w.CART)});const n=document.createElement("span");n.innerHTML=ChevronLeftIcon({}),o.appendChild(n)}const s=document.createElement("h1");s.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.setAttribute("aria-label","Checkout Page");const a=document.createElement("button");return a.innerHTML=CloseIcon({width:16,height:16}),a.classList.add("checkout-header-button-close"),a.setAttribute("aria-label","Close Checkout"),a.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o?[o,s,a]:[s,a]}}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 n=this.getStoreValue("checkout.isGift"),i=this.getStoreValue("checkout.customerForm.isEditing"),o=this.getStoreValue("checkout.giftRecipientForm.isEditing"),s=this.getStoreValue("checkout.paymentForm.isEditing");n?(this.buyerForm.style.display=i?"block":"none",this.buyerSummary.style.display=i?"none":"block",this.deliveryToForm.style.display=o?"block":"none",this.deliverToSummary.style.display=o?"none":"block"):(this.deliveryToForm.style.display=i?"block":"none",this.deliverToSummary.style.display=i?"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 n=[],i=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm"),s=this.getStoreValue("checkout.giftRecipientForm"),a=this.getStoreValue("checkout.paymentForm"),c=ComponentFactoryService.createElement({type:w.CHECKOUT_SEND_AS_GIFT});return n.push(c),this.deliveryToForm=ComponentFactoryService.createElement({type:w.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=i?s.isEditing?"block":"none":o.isEditing?"block":"none",n.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:w.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=i?s.isEditing?"none":"block":o.isEditing?"none":"block",n.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:w.CHECKOUT_BUYER}),this.buyerForm.style.display=i&&o.isEditing?"block":"none",n.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:w.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=i&&!o.isEditing?"block":"none",n.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:w.CHECKOUT_PAYMENT}),this.paymentForm.style.display=a.isEditing?"block":"none",n.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:w.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=a.isEditing?"none":"block",n.push(this.paymentSummary),n}}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(n){var i,o,s,a;const c=n.find(n=>"checkout.items"===n.path);c&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const l=n.find(n=>n.path==="checkout.items."+this.params.itemId);if(l){const n=l.oldValue,c=l.value;if(c.updating)return![];const p=(null==n?void 0:n.quantity)!==(null==c?void 0:c.quantity),m=(null===(o=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],f=(null===(a=null===(s=null==c?void 0:c.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[],g=JSON.stringify(m)!==JSON.stringify(f);(p||g)&&this.updateEngravingElement(c)}return![]}updateEngravingElement(n){var i,o;const s=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(o=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&s.layout.enablePersonalization){const i=ComponentFactoryService.createElement({type:w.ENGRAVING_VIEW,identifier:n.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(i)}}setupMinimumPurchaseAlert(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return;const i=n.fulfillmentId;if(!i)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const s=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),s&&shouldShowMinimumPurchaseAlert(s,n.pack)){const i=getMinimumPurchaseMessage(s,n.pack),a=ComponentFactoryService.createElement({type:w.PURCHASE_MIN_ALERT,message:i.message,messageType:i.type,currentTotal:s.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),o.before(a)}}}updateTrashButtonState(){if(!this.trashButton)return;const n=this.getStoreValue("checkout"),i=Object.keys(n.items).length,o=1===i;this.trashButton.disabled=o,o?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","item-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(o),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="item-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const n=this.getStoreValue("checkout.items."+this.params.itemId);return n?n.updating===!![]:![]}checkAndUpdateLoadingState(){const n=this.isItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var n,i,o;const s=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.presale,l=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!a)return[];const 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=a.mainImage,f.alt=a.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=a.name,g.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=c.isActive?""+l:((null==a?void 0:a.expectationDetail)||"")+",",y.appendChild(b);const C=document.createElement("span");C.textContent="From "+((null==a?void 0:a.retailerName)||""),y.appendChild(C),g.appendChild(y),p.appendChild(g),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async n=>{var i;if(n.preventDefault(),n.stopPropagation(),!(null===(i=this.trashButton)||void 0===i?void 0:i.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),p.appendChild(this.trashButton);const k=ComponentFactoryService.createElement({type:w.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),S=[];if(S.push(p),s.layout.enablePersonalization&&(null===(o=null===(i=null==a?void 0:a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:w.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});S.push(n)}return S.push(k),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(n){const i=n.find(n=>"checkout.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getAvailableQuantity(){var n,i,o;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,p=null===(o=null===(i=null===(n=Object.values(a).find(n=>n.sizes[s.liquidId]))||void 0===n?void 0:n.sizes)||void 0===i?void 0:i[s.liquidId])||void 0===o?void 0:o.attributes.maxQuantityPerOrder;if(!p)return 0;const m=this.getStoreValue("checkout.items")||{},f=Object.values(m).filter(n=>n.partNumber===c&&n.fulfillmentId===l),g=f.reduce((n,i)=>n+i.quantity,0);return p-g}calculateQuantityLimits(){var n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),s=1===(null===(n=Object.values(o.items))||void 0===n?void 0:n.length),a=i.quantity,c=this.getAvailableQuantity(),l=c>0,p=!(s&&1===a);return{currentQuantity:a,availableQuantity:c,isTheOnlyItem:s,canIncrease:l,canDecrease:p}}updateButtonStates(n){this.decreaseButton&&(this.decreaseButton.disabled=!n.canDecrease,this.decreaseButton.classList.toggle("disabled",!n.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!n.canIncrease,this.increaseButton.classList.toggle("disabled",!n.canIncrease),n.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits(),o=this.params.itemId;if((!(n<0)||i.canDecrease)&&(!(n>0)||i.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:n}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,n)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}template(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const i=this.calculateQuantityLimits(),o=document.createElement("div");o.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(i);const s=document.createElement("span");if(s.classList.add("checkout-item-price-text"),s.textContent=formatCentToDollarText(n.price),n.quantity>1){const i=document.createElement("span");i.classList.add("checkout-item-price-each-text"),i.textContent=" ("+formatCentToDollarText(n.unitPrice)+" ea)",s.appendChild(i)}return[o,s]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(n){return ComponentFactoryService.createElement({type:w.CHECKOUT_ITEM,itemId:n})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const n=this.getStoreValue("checkout.items")||{},i=new Map;for(const o of Object.values(n))o&&o.cartItemId&&i.set(o.cartItemId,o);return i}syncItemsWithStore(){const n=this.getItemsListContainer();if(!n)return;const i=this.getCurrentItemsMap(),o=n.querySelectorAll("[data-item-id]"),s=new Set;for(const a of o){const n=a.getAttribute("data-item-id");n&&s.add(n)}for(const a of o){const n=a.getAttribute("data-item-id");n&&!i.has(n)&&a.remove()}for(const[a]of i)if(!s.has(a)){const i=this.createItemElement(a);i.setAttribute("data-item-id",a),n.appendChild(i)}this.updateItemCount()}updateItemCount(){const n=this.getTogglerLabel();if(!n)return;const i=this.getCurrentItemsMap(),o=i.size;n.textContent=o+" item"+(1!==o?"s":"")}onStoreChanged(n){let i;for(let o=0;o<n.length;o++){const s=n[o];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){i=s;break}}return i?(this.syncItemsWithStore(),![]):![]}handleToggle(){const n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".checkout-items-list");if(n&&i){const o=i.classList.contains("show");i.classList.toggle("show"),n.classList.toggle("expanded"),o?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand checkout items")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const n=this.container.querySelector(".checkout-items-toggler"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");if(n&&i&&o){const s=o.classList.contains("show");i.setAttribute("tabindex","0"),i.setAttribute("aria-expanded",s?"true":"false"),i.setAttribute("aria-label",s?"Collapse checkout items":"Expand checkout items"),n.addEventListener("click",()=>this.handleToggle()),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const n=this.getStoreValue("checkout.items"),i=Object.values(n||{}),o=document.createElement("div");o.classList.add("checkout-items-toggler");const s=document.createElement("span");s.classList.add("checkout-items-toggler-label"),s.textContent=i.length+" item"+(1!==i.length?"s":""),o.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"}),o.appendChild(a);const c=document.createElement("div");c.classList.add("checkout-items-list","show");for(const l of i){const n=this.createItemElement(l.cartItemId);n.setAttribute("data-item-id",l.cartItemId),c.appendChild(n)}return[o,c]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(n){const i=n.find(n=>"checkout.amounts"===n.path);if(i){const n=this.getStoreValue("checkout"),i=Object.values(n.items||{}).length;this.updateZeroAmountElement(0===n.amounts.total&&i>0)}}updateZeroAmountElement(n){const i=this.container.querySelector(".checkout-zero-amount-container");if(n&&!i){const n=document.createElement("div");n.classList.add("checkout-zero-amount-container"),n.textContent="Credit card required to complete order (even when fully covered by gift card)";const i=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");i&&i.after(n)}else!n&&i&&i.remove()}afterRender(){const n=this.getStoreValue("checkout.amounts");n&&this.updateZeroAmountElement(0===n.total)}handleEmailToggle(n){this.commands.checkout.toggleMarketingPreferences("canEmail"),n.classList.toggle("checked");const i=n.classList.contains("checked");n.setAttribute("aria-checked",i?"true":"false")}handleSmsToggle(n){this.commands.checkout.toggleMarketingPreferences("canSms"),n.classList.toggle("checked");const i=n.classList.contains("checked");n.setAttribute("aria-checked",i?"true":"false")}marketingOptInsContainer(){const n=this.config.layout.emailOptIn,i=this.config.layout.smsOptIn;if(!n.show&&!i.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),n.show){const i=document.createElement("div");let s;i.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?n.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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleEmailToggle(a))});const c=document.createElement("label");c.setAttribute("for","emailOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(n.text),c.addEventListener("click",n=>{const i=n.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),a.classList.toggle("checked"))}),i.appendChild(a),i.appendChild(c),o.appendChild(i)}if(i.show){const n=document.createElement("div");let s;n.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?i.checked:this.store.get("checkout.marketingPreferences.canSms");const a=document.createElement("span");a.classList.add("checkout-checkbox-visual"),a.id="smsOptIn",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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleSmsToggle(a))});const c=document.createElement("label");c.setAttribute("for","smsOptIn"),c.classList.add("checkbox-label"),c.innerHTML=sanitizeHTML(i.text),c.addEventListener("click",n=>{const i=n.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),a.classList.toggle("checked"))}),n.appendChild(a),n.appendChild(c),o.appendChild(n)}return o}hasOnDemandOrder(){const n=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(n).length>0}template(){var n;const i=[],o=this.getConfigs("global"),s=this.getConfigs("checkout"),a=this.getConfigs("global"),c=s.layout.allowGiftCards,l=null===(n=null==a?void 0:a.layout)||void 0===n?void 0:n.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),i.push(p);const f=ComponentFactoryService.createElement({type:w.CHECKOUT_ITEMS});i.push(f);const g=document.createElement("div");g.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),i.push(g),c||l){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_PC_GC});i.push(n)}if(this.hasOnDemandOrder()){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_TIPS});i.push(n),i.push(v)}const y=document.createElement("div");y.classList.add("section-title-container");const b=document.createElement("h3");b.textContent="100% Secure Payments",b.classList.add("disclaimer-header"),y.appendChild(b);const C=document.createElement("p");C.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.",C.classList.add("disclaimer-description"),y.appendChild(C),i.push(y);const k=ComponentFactoryService.createElement({type:w.CHECKOUT_AMOUNTS});i.push(k);const S=ComponentFactoryService.createElement({type:w.CHECKOUT_PLACE_ORDER_BUTTON});i.push(S);const I=this.marketingOptInsContainer();if(I&&i.push(I),s.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(s.layout.legalMessage.text),i.push(n),i.push(o)}const T=document.createElement("div");if(T.classList.add("checkout-separator"),i.push(T),o.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:w.POWERED_BY,context:"checkout"});i.push(n)}return i}}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(n){for(const i of n)switch(i.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=i.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(i.value)}}handleBillingSameAsShippingChange(n){this.isBillingSameAsShipping=n,n&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var n;this.isBillingSameAsShipping=null!==(n=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==n?n:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let n=!![],i="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)i="Saving...",n=!![];else if(this.stripeFormStatus.hasError)i="Fix Errors and Retry",n=![];else if(this.showingStripeSummary&&this.savedCardInfo){const i=this.isBillingSameAsShipping||this.isValidBillingForm;n=!i}else{const i=this.stripeFormStatus.isFormComplete,o=this.isBillingSameAsShipping||this.isValidBillingForm;n=!(i&&o)}this.saveButton.disabled=n,this.saveButton.textContent=i,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let n="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?n=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(n="Please complete the billing address form"),n?(this.errorMessageElement.textContent=n,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(n){this.errorMessageElement&&(this.errorMessageElement.textContent=n,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===n&&(this.errorMessageElement.style.display="none")},5e3))}template(){const n=[],i=document.createElement("div");i.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),i.appendChild(o);const s=document.createElement("p");if(s.textContent="All transactions are secure and encrypted.",s.classList.add("section-subtitle"),i.appendChild(s),n.push(i),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const i=document.createElement("p");i.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(i),n.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:w.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:n=>{this.stripeFormStatus=n,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:n=>{this.savedCardInfo=n},onEditModeVisibilityChanged:n=>{this.showingStripeSummary=n,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(n,i)=>{const o={paymentSession:{confirmationTokenId:n,setupIntentId:i}};!this.isBillingSameAsShipping&&this.billingFormData&&(o.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(o)}}}),n.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"),n.push(this.errorMessageElement);const a=ComponentFactoryService.createElement({type:w.CHECKOUT_BILLING,isFormValid:(n,i)=>{this.billingFormData=i,this.isValidBillingForm=n,this.updateSaveButtonState(),this.updateErrorMessage()}});return n.push(a),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 n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handleSaveButtonClick())}),n.push(this.saveButton),n}async handleSaveButtonClick(){var n;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const n={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}catch(i){this.logger.error("Failed to save payment form in edit mode",i),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const n={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}catch(o){this.logger.error("Failed to save payment form in beta mode",o),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(n=this.stripeHandlerElement)||void 0===n||n.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 n;this.isSavingPayment=![],null===(n=super.disconnected)||void 0===n||n.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var n,i,o,s,a,c,l,p,m,f;const g=[],v=this.getStoreValue("checkout.paymentForm"),y=document.createElement("div");y.classList.add("checkout-summary-form-header");const b=document.createElement("h2");b.textContent="Paying with "+capitalizeFirstLetter(null!==(o=null===(i=null===(n=v.paymentMethod)||void 0===n?void 0:n.card)||void 0===i?void 0:i.brand)&&void 0!==o?o:"")+" "+(null===(a=null===(s=v.paymentMethod)||void 0===s?void 0:s.card)||void 0===a?void 0:a.last4),y.appendChild(b);const w=document.createElement("span");w.textContent="Edit",w.setAttribute("aria-label","Edit Payment Information"),w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),w.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.editPaymentForm())}),y.appendChild(w),g.push(y);const C=document.createElement("p");return C.classList.add("checkout-summary-form-line"),C.textContent="Exp. "+(null===(l=null===(c=v.paymentMethod)||void 0===c?void 0:c.card)||void 0===l?void 0:l.expMonth)+"/"+(null===(f=null===(m=null===(p=v.paymentMethod)||void 0===p?void 0:p.card)||void 0===m?void 0:m.expYear)||void 0===f?void 0:f.slice(-2)),g.push(C),g}}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(n){const i=n.some(n=>"checkout.loading"===n.path||"checkout.error"===n.path||"checkout.customerForm.isValid"===n.path||"checkout.giftRecipientForm.isValid"===n.path||"checkout.paymentForm.isValid"===n.path);i&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const n=this.store.get("checkout.loading")||![],i=this.store.get("checkout.error")||null;this.updateErrorDisplay(i);const o=this.determineButtonState({isCheckoutLoading:n,hasCheckoutError:!!i});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(o.state),this.placeOrderButton.disabled=o.disabled,this.placeOrderButton.textContent=o.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(n){if(!this.errorContainer)return;const i=this.errorContainer.querySelector(".error-text");i&&(this.clearErrorTimeout(),n?(i.textContent=n,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(i.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:n,hasCheckoutError:i}){const o=this.config.layout.placeOrderButtonText,s=this.store.get("checkout.presale");let a=![];if(!s){const n=this.getStoreValue("cart.fulfillments")||{};a=Object.values(n).some(n=>hasUnmetMinimum(n))}const c=this.store.get("checkout.isGift"),l=this.store.get("checkout.customerForm.isValid"),p=this.store.get("checkout.giftRecipientForm.isValid"),m=this.store.get("checkout.paymentForm.isValid");return a||c&&!p||!l||!m?{state:"disabled",text:o,disabled:!![]}:n?{state:"processing",text:"Placing Order...",disabled:!![]}:i?{state:"disabled",text:o,disabled:!![]}:{state:"ready",text:o,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const n=this.store.get("checkout.loading");if(n)return;await this.commands.checkout.checkoutComplete()}catch(n){this.logger.error("Error handling place order click",n)}}template(){const n=document.createElement("button");n.type="button",n.textContent=this.config.layout.placeOrderButtonText,n.classList.add("checkout-place-order-button"),n.disabled=!![],n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label","Place Order"),n.addEventListener("click",this.handlePlaceOrderClick.bind(this)),n.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.handlePlaceOrderClick())});const i=document.createElement("div");i.classList.add("checkout-error-wrapper"),i.setAttribute("role","alert"),i.style.display="none";const o=document.createElement("div");o.classList.add("checkout-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),o.appendChild(s),o.appendChild(a),i.appendChild(o);const c=ComponentFactoryService.createElement({type:w.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,c,n]}}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.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(n){var i;const o=n.find(n=>"checkout.presale"===n.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value.expiresAt),!![];const s=n.find(n=>"ui.drawer"===n.path);return(null===(i=null==s?void 0:s.value)||void 0===i?void 0:i.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const n=this.store.get("checkout.presale");(null==n?void 0:n.expiresAt)&&this.updateExpiresAt(n.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var n,i;const o=[".drawer-content"];for(const a of o){const i=null===(n=this.rootElement)||void 0===n?void 0:n.closest(a);if(i&&this.isScrollable(i))return i}let s=null===(i=this.rootElement)||void 0===i?void 0:i.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var n,i;if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop,s=70,a=10;!this.isCurrentlyScrolled&&o>s?(this.isCurrentlyScrolled=!![],null===(n=this.rootElement)||void 0===n||n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&o<a&&(this.isCurrentlyScrolled=![],null===(i=this.rootElement)||void 0===i||i.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(n){const i=window.getComputedStyle(n),o=i.overflowY;return n.scrollHeight>=n.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(n){this.stopCountdown();try{if(this.expiresAt=new Date(n),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:n}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const i=new Date,o=Math.floor((this.expiresAt.getTime()-i.getTime())/1e3);o<this.totalDuration&&(this.totalDuration=Math.max(o,240)),this.startCountdown()}catch(i){this.logger.error("Failed to parse presale expiration date",i),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const n=new Date,i=Math.max(0,this.expiresAt.getTime()-n.getTime()),o=i/1e3,s=this.totalDuration-o,a=Math.max(0,Math.min(100,s/this.totalDuration*100)),c=o<60;if(c!==this.isUnderOneMinute){this.isUnderOneMinute=c;const n=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==n||n.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==n||n.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const l=this.rootElement.querySelector("[data-timer]");l&&(l.textContent=this.formatTime(i));const p=this.rootElement.querySelector("[data-progress-fill]");p&&(p.style.width=a+"%"),0===i&&this.handleExpire()}formatTime(n){const i=Math.floor(n/1e3),o=Math.floor(i/60),s=i%60,a=Math.floor(n%1e3/10);return o.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 n=document.createElement("div");n.classList.add("checkout-presale-countdown"),this.rootElement=n;const i=document.createElement("div");i.classList.add("checkout-presale-text-container");const o=document.createElement("div");o.classList.add("checkout-presale-heading");const s=document.createElement("h2");s.textContent="LIMITED PRE-ORDER:";const a=document.createElement("div");a.classList.add("checkout-presale-timer"),a.setAttribute("data-timer",""),a.textContent="00:00:00",o.appendChild(s),o.appendChild(a);const c=document.createElement("p");c.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",c.classList.add("checkout-presale-subtitle"),i.appendChild(o),i.appendChild(c);const l=document.createElement("div");l.className="checkout-presale-progress-bar",l.setAttribute("data-progress","");const p=document.createElement("div");return p.className="checkout-presale-progress-fill",p.setAttribute("data-progress-fill",""),p.style.width="0%",l.appendChild(p),n.appendChild(i),n.appendChild(l),n}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const n=[],i=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const c=document.createElement("p");c.classList.add("presale-expired-title"),c.textContent="Session Expired",a.appendChild(c);const l=document.createElement("p");l.textContent="Your reservation time has ended. The item has been released for other customers.",a.appendChild(l),s.appendChild(a),o.appendChild(s);const p=document.createElement("div");p.classList.add("checkout-completed-help-section"),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.",o.appendChild(p),n.push(o);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}));f.appendChild(v),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleExit())}),m.appendChild(f),n.push(m);const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("p");b.classList.add("checkout-completed-auto-close-text"),b.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const C=document.createElement("span");if(C.classList.add("checkout-completed-auto-close-text"),C.textContent="seconds",y.appendChild(b),y.appendChild(this.autoCloseElement),y.appendChild(C),n.push(y),i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:w.POWERED_BY,context:"checkout"});i.appendChild(o),n.push(i)}return n}}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(n){const i=n.find(n=>"checkout.promoCode"===n.path),o=n.find(n=>"checkout.loading"===n.path);if(i){const{value:n,oldValue:o}=i,s=Boolean(o),a=Boolean(n);if(!s&&a)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(s&&!a)return this.container.innerHTML="",this.createInputContainer(),void 0;a&&this.promoCodeText&&n.discountAmount!==(null==o?void 0:o.discountAmount)&&(this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),a=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||o||Boolean(s)||Boolean(a)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),o=this.promoInput;o.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const t=async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(n)}catch(i){this.logger.error("Checkout promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",t),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t())}),this.applyButton}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const n=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),i}const i=[];return i.push(this.createPromoInput()),i.push(this.createApplyButton()),i}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const n=this.getStoreValue("checkout.isGift"),i=document.createElement("div");i.classList.add("gift-label-wrapper");const o=document.createElement("span");o.textContent="Send as Gift? (Free)",o.classList.add("gift-toggle-label"),i.appendChild(o);const s=document.createElement("span");s.textContent="With personalized note & gift receipt.",s.classList.add("gift-toggle-description"),i.appendChild(s);const a=document.createElement("div");a.classList.add("toggle-switch"),a.classList.toggle("active",n);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",n?"true":"false"),a.appendChild(c),a.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),a.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await this.commands.checkout.toggleIsGift())}),[i,a]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.N=![],this.F=null,this.R=null,this.O=null,this.L=![],this.M=![],this.B=![],this.W=null}async initialize({data:n}){if(this.N)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=n.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.N=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const n=this.q;this.F=window.Stripe(n.publishableKey),this.R=this.F.elements({clientSecret:n.clientSecret,appearance:n.appearance}),this.O=this.R.create("payment",n.elementOptions),this.O.mount(this),this.O.on("change",async n=>{const i=!!n.error,o=n.complete,s=i?n.error.message:null;this.M=o,this.L||await this.updateStripeFormStatus({isFormComplete:o,isProcessing:![],hasCompletedPayment:![],errorMessage:s,hasError:i})}),this.O.on("focus",async()=>{this.L||await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(n){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),n}}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(n){const{stripeConfig:i}=n.detail;i&&(this.q=i,await this.refreshPaymentSession())}async handleSubmit(){var n,i;if(this.L)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.M)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.L=!![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const n=await this.createConfirmationTokenId(),i=this.q.clientSecret,o=i.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:n,setupIntentId:o},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(o){console.error("Payment submission error:",o),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==o?void 0:o.message)||"Payment processing failed. Please try again."}),((null===(n=null==o?void 0:o.message)||void 0===n?void 0:n.includes("expired"))||(null===(i=null==o?void 0:o.message)||void 0===i?void 0:i.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.L=![]}}async requestSessionRefresh(){return this.W||(this.W=new Promise((n,i)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",B),this.W=null,i(new Error("Session refresh timeout"))},1e4),B=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",B),this.W=null,n()};this.addEventListener("lce:s:refreshSession",B,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.W}async refreshPaymentSession(){try{this.R&&this.R.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ht){console.error("Failed to refresh payment session:",ht),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.O&&this.O.clear(),this.M=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ht){console.error("Failed to reset form:",ht)}}async updateStripeFormStatus(n){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:n},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.R)throw new SDKError("Payment elements not initialized");try{const{error:n}=await this.R.submit();if(n)throw new SDKError(n.message||"Failed to submit payment information");const i={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:o,confirmationToken:s}=await this.F.createConfirmationToken(i);if(o)throw new SDKError(o.message||"Failed to create confirmation token");if(!s||!s.id)throw new SDKError("Invalid confirmation token received");return s.id}catch(n){if(n instanceof SDKError)throw n;throw new SDKError("Payment processing error: "+(n.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(n=>{console.error("Error during Stripe form disconnection cleanup:",n)})}async cleanupForm(){var n,i;try{this.W=null,this.O&&(this.O.unmount(),this.O=null),this.R&&(null===(i=(n=this.R).destroy)||void 0===i?void 0:i.call(n),this.R=null),this.F=null,this.L=![],this.M=![],this.B=![],this.N=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((n,i)=>{const o=document.querySelector('script[src*="stripe.com"]');if(o)return o.addEventListener("load",()=>n()),o.addEventListener("error",()=>i(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=()=>n(),s.onerror=()=>i(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(n){for(const i of n)switch(i.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(i.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(i.value)}}handleSavedCardChange(n){var i,o,s,a;(null===(i=null==n?void 0:n.card)||void 0===i?void 0:i.brand)&&(null===(o=null==n?void 0:n.card)||void 0===o?void 0:o.last4)?this.savedCardInfo={brand:n.card.brand,last4:n.card.last4}:this.savedCardInfo=null,null===(a=(s=this.callbacks).onSavedCardInfoChanged)||void 0===a||a.call(s,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(n){this.isInEditMode=n,this.updateDisplayState()}updateDisplayState(){var n,i,o,s,a,c;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(i=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(n,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(s=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(o,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(n=>{this.logger.error("Failed to create stripe form in updateDisplayState",n)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(c=(a=this.callbacks).onEditModeVisibilityChanged)||void 0===c||c.call(a,![]))}async afterRender(){var n,i,o,s;this.isInEditMode=null!==(n=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==n?n:![];const a=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(i=null==a?void 0:a.card)||void 0===i?void 0:i.brand)&&a.card.last4&&(this.savedCardInfo={brand:a.card.brand,last4:a.card.last4}),null===(s=(o=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(o,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",n=>{var i,o;this.stripeFormStatus=n.detail.status,null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async n=>{var i,o,s,a,c;try{const{confirmationTokenId:s,setupIntentId:a}=n.detail;await(null===(o=(i=this.callbacks).onPaymentSessionConfirmed)||void 0===o?void 0:o.call(i,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 n;try{const i=await this.doStripeConfig();null===(n=this.stripeFormElement)||void 0===n?void 0:n.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:i}}))}catch(i){this.logger.error("Failed to refresh payment session",i)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const n=document.createElement("span");n.classList.add("stripe-summary-text"),n.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const i=document.createElement("button");i.type="button",i.classList.add("change-payment-link"),i.textContent="Change",i.setAttribute("aria-label","Change Payment Method"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",()=>this.handleChangePayment()),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(n,i),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 n,i;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(i=(n=this.callbacks).onStripeFormStatusChanged)||void 0===i||i.call(n,this.stripeFormStatus),this.updateDisplayState()}template(){const n=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",n.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const i=document.createElement("slot");return i.setAttribute("name",Dt),this.stripeFormContainer.appendChild(i),n.push(this.stripeFormContainer),n}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 n=this,i=null;for(;n&&n!==document.body;){const o=n.hasAttribute("checkout"),s=n.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(w.LCE_ELEMENT),a=n.hasAttribute("drawer"),c=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(w.DRAWER),l="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(o||s&&a&&c&&l)return this.rootComponent=n,n;i=n,n=n.parentElement||n.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const n=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==n?void 0:n.key)&&(null==n?void 0:n.secret)||await this.commands.checkout.getPaymentSession();const i=this.store.get("checkout.paymentForm.paymentSession"),o=this.getConfigs("global");return{publishableKey:i.key,clientSecret:i.secret,appearance:{theme:"stripe",variables:{fontFamily:o.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:o.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===o.layout.inputFieldStyle?"none":"1px solid "+o.theme.accentColor,backgroundColor:"filled"===o.layout.inputFieldStyle?o.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var n,i,o;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===(n=this.stripeFormElement)||void 0===n?void 0:n.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const a=s.querySelectorAll('[slot="'+Dt+'"]');if(a.length>0)for(const l of a)l.remove();this.isCreatingStripeForm=!![];try{const n=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:w.CHECKOUT_STRIPE_FORM,stripeConfig:n}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",Dt),s.appendChild(this.stripeFormElement)}catch(c){this.logger.error("Stripe form element creation failed",c),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var n;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(n=super.disconnected)||void 0===n||n.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const n=this.getStoreValue("checkout.tipSelection");return null!=n?n:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(n){const i=this.getStoreValue("checkout.updating")||![];if(!i)try{await this.commands.checkout.updateTips(n)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(n,i){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const s=this.getOnDemandFulfillmentTipInfo();if(!s[n])return;const a=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(n,a)}catch(c){this.logger.error("Checkout fulfillment tip update failed",c)}}async removeTipFromFulfillment(n){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const o=this.getOnDemandFulfillmentTipInfo();if(o[n])try{await this.commands.checkout.removeFulfillmentTip(n)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const n=document.createElement("div");n.classList.add("checkout-tip-selection-container");const i=[10,18,20],o=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const a of i){const i=document.createElement("button");i.type="button",i.textContent=a+"%",i.classList.add("checkout-tip-button"),i.disabled=o,s===a&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(a)),n.appendChild(i)}return n}setupToggler(){const n=this.container.querySelector(".checkout-tip-distribution-header"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");n&&i&&o&&n.addEventListener("click",()=>{const n=o.classList.contains("show");o.classList.toggle("show"),n?(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand tips section")):(i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse tips section")),i.classList.toggle("expanded")})}createTipDistribution(){const n=document.createElement("section");n.classList.add("checkout-tip-distribution-container");const i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),o.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"}),o.appendChild(a),n.appendChild(o);const c=document.createElement("div");c.classList.add("retailers-tips-list","show");for(const l of i){const n=document.createElement("div");n.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=l.retailerName,i.classList.add("checkout-sub-header"),n.appendChild(i);const o=document.createElement("div");o.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 p=document.createElement("input");let m;p.type="number",p.id="tip-input-"+l.fulfillmentId,p.name="tip-"+l.fulfillmentId,p.min="0",p.step="0.01",p.placeholder="0.00",p.classList.add("dollar-input"),p.value=l.tip>0?(l.tip/100).toFixed(2):"",p.disabled=this.getStoreValue("checkout.updating")||![],p.addEventListener("wheel",n=>{n.preventDefault()}),p.addEventListener("keydown",n=>{"-"!==n.key&&"+"!==n.key||n.preventDefault()}),p.addEventListener("keydown",n=>{"ArrowUp"!==n.key&&"ArrowDown"!==n.key||n.preventDefault()}),p.addEventListener("paste",n=>{n.preventDefault()}),p.addEventListener("contextmenu",n=>{n.preventDefault()}),p.addEventListener("input",n=>{const i=n.target;let o=i.value;if(Number.parseFloat(o)<0&&(i.value=Math.abs(Number.parseFloat(o)).toString(),o=i.value),o.includes(".")){const n=o.split(".");n.length>1&&n[1].length>2&&(i.value=n[0]+"."+n[1].substring(0,2))}}),p.addEventListener("input",n=>{const i=n.target,o=Number.parseFloat(i.value)||0;m&&clearTimeout(m),m=setTimeout(()=>{this.handleFulfillmentTipInput(l.fulfillmentId,o)},500)}),s.appendChild(a),s.appendChild(p),o.appendChild(s);const f=document.createElement("button");f.type="button",f.textContent="Remove",f.classList.add("checkout-tip-remove-button"),f.disabled=this.getStoreValue("checkout.updating")||![],f.addEventListener("click",()=>this.removeTipFromFulfillment(l.fulfillmentId)),o.appendChild(f),n.appendChild(o),c.appendChild(n)}return n.appendChild(c),n}async initializeDefaultTip(){if(this.isInitialized)return;const n=this.getStoreValue("checkout.tipSelection"),i=this.getFulfillmentTipInfoArray();if(n&&i.length>0){const n=i.some(n=>n.tip>0);if(n)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==n)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 n=[],i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;i.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",o.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-tip-config-container");const c=this.createTipSelectionButtons();a.appendChild(c),o.appendChild(a);const l=document.createElement("p");l.classList.add("checkout-tip-disclaimer"),l.textContent="Tips will be split proportionally between retailers.",o.appendChild(l);const p=this.createTipDistribution();return n.push(o,p),n}}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(n){var i,o;const s=n.find(n=>"checkout.giftCardError"===n.path),a=n.find(n=>"checkout.promoCodeError"===n.path),c=n.find(n=>"checkout.giftCards"===n.path);if(c&&this.updateAppliedGiftCards(c.value),s){const n=this.container.querySelector(".input-gift-card-container");if(n){const o=n.nextElementSibling;if((null===(i=null==o?void 0:o.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),s.value){const i=this.createErrorElement(s.value);n.after(i)}const a=n.querySelector(".apply-button");a&&(a.disabled=Boolean(s.value))}}if(a){const n=this.container.querySelector(".input-promo-code-container");if(n){const i=n.nextElementSibling;if((null===(o=null==i?void 0:i.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),a.value){const i=this.createErrorElement(a.value);n.after(i)}const s=n.querySelector(".apply-button");s&&(s.disabled=Boolean(a.value))}}}updateAppliedGiftCards(n){const i=n&&n.length>0;if(!i)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)})}createAppliedGiftCardElement(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),i.setAttribute("data-gift-card-code",n.code);const o=document.createElement("span");o.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",i.appendChild(o);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(n.code)}),i.appendChild(s),i}pcInputContainer(){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return n}gcInputContainer(){const n=ComponentFactoryService.createElement({type:w.CHECKOUT_GIFT_CARDS});return n}inputContainer(){var n;const i=this.getConfigs("checkout"),o=this.getConfigs("global"),s=i.layout.allowGiftCards,a=null===(n=null==o?void 0:o.layout)||void 0===n?void 0:n.allowPromoCodes,c=document.createElement("div");c.classList.add("checkout-pc-gc-sub-container");const l=this.pcInputContainer(),p=this.gcInputContainer();a&&c.appendChild(l);const m=this.getStoreValue("checkout.promoCodeError");if(m){const n=this.createErrorElement(m);n.classList.add("promo-code-error-wrapper"),c.appendChild(n)}s&&c.appendChild(p);const f=this.getStoreValue("checkout.giftCardError");if(f){const n=this.createErrorElement(f);c.appendChild(n)}return c}createErrorElement(n){const i=document.createElement("div");i.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=n.toString(),i.appendChild(o),i.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),i.remove()},3e3),i}template(){const n=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const i=[];return i.push(this.inputContainer()),n&&n.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)}),i.push(this.appliedGiftCardsContainer)),i}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:o,selectedSizeAttributes:s}){var a,c,l,p,m,f,g,v;const y=i===C.ON_DEMAND;let b=null;y&&n.hourStatus.openTime&&(null===(a=n.hourStatus)||void 0===a?void 0:a.closeTime)&&(b=n.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(c=n.hourStatus)||void 0===c?void 0:c.closeTime):"Opens at "+format24TimeTo12(null===(l=n.hourStatus)||void 0===l?void 0:l.openTime));const w=y&&n.hourStatus.isClosed?"closed":"",k=document.createElement("div");k.className="popup-retailer-card "+(o?"selected":"")+" "+w,k.setAttribute("data-fulfillment-id",n.fulfillmentId),k.setAttribute("role","button"),k.setAttribute("tabindex","0"),k.setAttribute("aria-pressed",o?"true":"false");const S=i===C.SHIPPING?"Shipping":"Same-day delivery";k.setAttribute("aria-label",S+" from "+n.retailerName+", "+formatCentToDollarText(null!==(p=n.price)&&void 0!==p?p:0));const I=document.createElement("div");I.className="row";const T=document.createElement("span");T.className="name",T.textContent=n.retailerName,I.appendChild(T);const D=document.createElement("span");D.className="price",D.textContent=formatCentToDollarText(null!==(m=n.price)&&void 0!==m?m:0),I.appendChild(D),k.appendChild(I);const A=document.createElement("div");A.className="row";const P=document.createElement("span");P.className="expectation",P.textContent=n.hourStatus.isClosed?b:(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==n?void 0:n.expectationText,A.appendChild(P);const _=document.createElement("span");if(_.className="fee",_.textContent=n.fee>0?formatCentToDollarText(n.fee):"Free Delivery",A.appendChild(_),k.appendChild(A),y){const i=document.createElement("div");i.className="row";const o=document.createElement("span");o.className="address",o.textContent=n.retailerAddressFormatted,i.appendChild(o),k.appendChild(i)}return k}function renderFulfillmentTabsContainer({shippingFulfillments:n,onDemandFulfillments:i,shippingSelected:o,onDemandSelected:s,onTabClick:a,enableShippingFulfillment:c,enableOnDemandFulfillment:l}){const p=i.length>0,m=document.createElement("div");if(m.className="fulfillment-tabs-container",m.setAttribute("role","tablist"),m.setAttribute("aria-label","Delivery method options"),c){const i=document.createElement("div");i.className="fulfillment-tab "+(o?"selected":""),i.setAttribute("data-fulfillment-type",C.SHIPPING),i.setAttribute("role","tab"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected",o?"true":"false"),i.setAttribute("aria-label","Shipping, "+n.length+" options"),i.addEventListener("click",a),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(o?"selected":""),s.textContent="Shipping ("+n.length+")",i.appendChild(s),m.appendChild(i)}if(l){const n=document.createElement("div");n.className="fulfillment-tab "+(s?"selected":"")+" "+(p?"":"disabled"),n.setAttribute("data-fulfillment-type",C.ON_DEMAND),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",s?"true":"false"),n.setAttribute("aria-label","Same-day delivery, "+i.length+" options"),p||n.setAttribute("aria-disabled","true"),n.addEventListener("click",a),n.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(s?"selected":""),o.textContent="Same-Day Delivery ("+i.length+")",n.appendChild(o),m.appendChild(n)}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 n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment||!o.selectedSizeId)return 0;const s=o.selectedFulfillment.partNumber,a=o.selectedFulfillment.fulfillmentId,c=null===(n=o.sizes[o.selectedSizeId].attributes)||void 0===n?void 0:n.maxQuantityPerOrder;if(!c)return 0;const l=this.getStoreValue("cart.items")||{},p=Object.values(l).filter(n=>n.partNumber===s&&n.fulfillmentId===a),m=p.reduce((n,i)=>n+i.quantity,0);return c-m}isFulfillmentClosed(){const n=this.getProductId(),i=this.getStoreValue("products."+n);return i.selectedFulfillment?i.selectedFulfillmentType===C.ON_DEMAND&&i.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const n=this.getProductId();return this.getStoreValue("products."+n+".updating")}calculateQuantityLimits(){const{quantity:n}=this.calculateTotalPrice(),i=this.getAvailableQuantity(),o=n<i;return{currentQuantity:n,availableQuantity:i,canIncrease:o,canDecrease:n>1}}async handleAddToCart(){var n,i,o;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===(n=null==c?void 0:c.presale)||void 0===n?void 0:n.isActive)===!![],p=this.isPresaleActive(c);l&&p?await this.commands.product.addPresaleToCart(s,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(i=a.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:a.quantity,identifier:s}):await this.commands.product.addToCart(s,{upc:a.sizes[a.selectedSizeId].upc,fulfillmentId:a.selectedFulfillment.fulfillmentId,partNumber:null===(o=a.selectedFulfillment)||void 0===o?void 0:o.partNumber,quantity:a.quantity,identifier:s})}async handleQuantityChange(n){const i=this.getProductId();await this.commands.product.updateQuantity(i,n)}calculateTotalPrice(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=i.selectedFulfillment,s=o.price*i.quantity;return{quantity:i.quantity,totalPrice:s}}createQuantityContainer(n){const i=this.calculateQuantityLimits(),o=document.createElement("div");return o.className="quantity-container "+n,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!i.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!i.canDecrease).toString()),i.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=i.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+i.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!i.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!i.canIncrease).toString()),i.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(1)}),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantityText),o.appendChild(this.qtyIncreaseButton),o}getSizeAttributes(){const n=this.getProductId(),i=this.getStoreValue("products."+n+".selectedSizeId"),o=this.getStoreValue("products."+n+".sizes."+i);return(null==o?void 0:o.attributes)||{}}isPresaleActive(n){const i=null==n?void 0:n.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const n=new Date(i.canPurchaseOn),o=new Date;if(o.getTime()<n.getTime())return![]}return!![]}createAddToCartButton(){var n;const{totalPrice:i}=this.calculateTotalPrice(),o=this.getSizeAttributes(),s=this.calculateQuantityLimits(),a=(null===(n=null==o?void 0:o.presale)||void 0===n?void 0:n.isActive)===!![],c=this.isPresaleActive(o),l=a?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?l+" - "+formatCentToDollarText(i):l;const p=a&&!c||0===s.availableQuantity||this.isFulfillmentClosed(),m=this.isButtonLoading(),f=this.config.layout.addToCartButtonShowTotalPrice?l+" for "+formatCentToDollarText(i):l;return this.addToCartButton.setAttribute("aria-label",f),this.addToCartButton.setAttribute("aria-busy",m.toString()),this.addToCartButton.setAttribute("aria-disabled",p.toString()),p&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),m&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async n=>{if(n.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 n=this.getProductId(),i=this.getStoreValue("products."+n+".fulfillmentHasAvailability"),o=this.getConfigs("configurations");if(!i||!o.isElementsEnabled)return[];const s=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer(this.config.layout.quantityCounterStyle);s.push(n)}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 n=this.params.productId,i=this.getStoreValue("products."+n+".description"),o=this.getStoreValue("products."+n+".htmlDescription"),s="About this product:",a="See More",c="See Less",l=document.createElement("h3");l.className="title",l.textContent=s;const p=document.createElement("div");p.className="content collapsed",p.innerHTML=""===(null==o?void 0:o.trim())?i:sanitizeHTML(o);const m=document.createElement("span");m.className="collapse-button",m.textContent=a,m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.setAttribute("aria-label","Show more product information"),m.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,p.classList.toggle("collapsed"),m.textContent=this.isCollapsed?a:c,m.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),m.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return m.addEventListener("click",toggleContent),m.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),toggleContent())}),[l,p,m]}}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(n){var i;const o=n.find(n=>n.path==="products."+this.getProductId()+".drawer");if(!o)return![];const s=o.value,a=s.isOpen,c=null===(i=s.contentConfig)||void 0===i?void 0:i.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:n}){const i=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!n)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:i}),void 0;const{type:o,data:s}=n||{},a=ComponentFactoryService.createElement({type:o,...s});this.contentContainer&&this.contentContainer.appendChild(a),this.open()}catch(o){this.logger.error("Failed to open product drawer",o),this.commands.product.closeProductDrawer(i)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const n=document.createElement("div");return n.classList.add("product-drawer-content"),this.contentContainer=n,n}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const n=this.config.layout.fulfillmentDisplay;return["product-image-carousel",n]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(n){var i;const o=this.params.productId,s=n.find(n=>n.path==="products."+o+".selectedSizeId");if(null==s?void 0:s.value){const n=this.getStoreValue("products."+o),a=null===(i=null==n?void 0:n.sizes)||void 0===i?void 0:i[s.value],c=null==a?void 0:a.image;if(c){const n=this.params.images.indexOf(c);-1!==n?this.selectImage(n):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 i=0;i<this.thumbnails.length;i++){const n=this.thumbnails[i];n.addEventListener("click",()=>{this.hasMoved||this.selectImage(i)})}const n=this.container.querySelectorAll(".carousel-dot");for(let i=0;i<n.length;i++){const o=n[i];o.addEventListener("click",()=>this.selectImage(i))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(n){var i,o;if(n<0||n>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[n]+"')",this.mainImageElement.title="Product image "+(n+1)),null===(i=this.thumbnails[this.currentImageIndex])||void 0===i||i.classList.remove("selected"),null===(o=this.thumbnails[n])||void 0===o||o.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let a=0;a<s.length;a++){const i=s[a];i.classList.toggle("active",a===n)}this.currentImageIndex=n,this.galleryViewport&&this.scrollToIndex(n)}scrollToIndex(n){if(!this.galleryViewport||!this.thumbnails[n])return;const i=this.thumbnails[n],o=this.galleryViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,a=o/2,c=a-s,l=0,p=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(p,Math.min(l,c)),this.updateTransform(!![])}setupMainImageSwipe(){var n,i;let o=0,s=0;null===(n=this.mainImageElement)||void 0===n?void 0:n.addEventListener("touchstart",n=>{o=n.touches[0].clientX,s=n.touches[0].clientY},{passive:!![]}),null===(i=this.mainImageElement)||void 0===i||i.addEventListener("touchend",n=>{const i=n.changedTouches[0].clientX-o,a=n.changedTouches[0].clientY-s;Math.abs(i)>Math.abs(a)&&Math.abs(i)>50&&(i>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const n of this.galleryContainer.querySelectorAll("img"))n.addEventListener("dragstart",n=>n.preventDefault())}}handleDragStart(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+o,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(n){this.galleryContainer&&(this.galleryContainer.style.transition=n?"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 n=[],i=this.params.images.length>1,o=document.createElement("div");if(o.className="main-image",o.title="Product main image",o.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",i){const n=document.createElement("div");n.className="carousel-dots";for(let i=0;i<this.params.images.length;i++){const o=document.createElement("button");o.type="button",o.className="carousel-dot "+(0===i?"active":""),o.setAttribute("data-index",i.toString()),n.appendChild(o)}o.appendChild(n)}this.mainImageElement=o,n.push(o);const s=document.createElement("div");s.className="gallery-viewport";const a=document.createElement("div");a.className="gallery-container";for(let c=0;c<this.params.images.length;c++){const n=this.params.images[c],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===c?"selected":"");const o=document.createElement("img");o.src=n,o.className="gallery-image",o.alt="Product thumbnail "+(c+1),o.loading="lazy",i.appendChild(o),a.appendChild(i)}return s.appendChild(a),n.push(s),n}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(n){var i;const o=this.getProductId();if(!n.some(n=>n.path==="products."+o+".selectedFulfillmentType"))return;const s=this.getStoreValue("products."+o),a=this.getConfigs("global");this.addPersonalizationSpan&&(s.selectedFulfillmentType===C.SHIPPING&&a.layout.enablePersonalization&&s.productHasAvailability&&(null===(i=null==s?void 0:s.selectedFulfillment)||void 0===i?void 0:i.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const n=this.getProductId(),i=this.container.querySelectorAll("[select-size]");for(const o of i){const s=o.textContent||"",a=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+s),o.setAttribute("aria-pressed",a?"true":"false"),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var s;const a=o.dataset.sizeId;if(!a)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:n,buttonElement:o.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(n,a);for(const n of i)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const c=this.getStoreValue("products."+n),l=this.getConfigs("global");this.addPersonalizationSpan&&(l.layout.enablePersonalization&&c.productHasAvailability&&(null===(s=c.selectedFulfillment)||void 0===s?void 0:s.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(n,i){const o=document.createElement("div");o.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",o.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(i)){const i=document.createElement("span");i.setAttribute("data-size-id",c.id),i.setAttribute("select-size",""),i.className="size-button "+(c.id===n?"selected":"");const o=c.packDesc?" ("+c.packDesc+")":"";i.textContent=""+c.size+o,a.appendChild(i)}return o.appendChild(a),o}hasIndependentAddressComponent(){var n;return(null===(n=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===n?void 0:n.length)>0}template(){var n,i;const o=this.getProductId(),s=this.getStoreValue("products."+o),a=s.sizes[s.selectedSizeId],c=this.getConfigs("global"),l=[],p=document.createElement("div");p.className="price-personalization-container";const m=ComponentFactoryService.createElement({type:w.PRODUCT_PRICE,productId:o});if(p.appendChild(m),c.layout.enablePersonalization&&s.productHasAvailability&&(null===(n=null==s?void 0:s.selectedFulfillment)||void 0===n?void 0:n.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var n,i,a,c,l,p,m,f;const g=s.sizes[s.selectedSizeId];await this.commands.product.openProductDrawer(o,w.ENGRAVING_FORM,{identifier:o,context:"product",lines:[],maxLines:(null===(i=null===(n=g.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.maxLines)||1,maxCharsPerLine:(null===(c=null===(a=g.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,fee:(null===(p=null===(l=g.attributes)||void 0===l?void 0:l.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 n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await addPersonalization())}),p.appendChild(this.addPersonalizationSpan)}l.push(p);const f=this.renderProductSizes(s.selectedSizeId,s.sizes);if(l.push(f),!this.hasIndependentAddressComponent()){const n=ComponentFactoryService.createElement({type:w.ADDRESS_DISPLAY,productId:o});l.push(n)}const g=ComponentFactoryService.createElement({type:w.PRODUCT_RETAILERS,productId:o});l.push(g);const v=ComponentFactoryService.createElement({type:w.PRODUCT_ADD_TO_CART_SECTION,productId:o});l.push(v);const y=null===(i=null==a?void 0:a.attributes)||void 0===i?void 0:i.presale;if((null==y?void 0:y.isActive)===!![]&&(null==y?void 0:y.language)){const n=document.createElement("div");n.className="product-presale-notice",n.innerHTML=sanitizeHTML((null==y?void 0:y.language)||""),l.push(n)}if(this.config.layout.showDescription&&(s.description.trim().length>0||s.htmlDescription.trim().length>0)){const n=ComponentFactoryService.createElement({type:w.PRODUCT_DESCRIPTION,productId:o});l.push(n)}return l}}class ProductLoadingComponent extends BaseComponent{template(){const n=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:o,showQuantityCounter:s,fulfillmentDisplay:a,showImages:c}=this.config.layout,l=document.createElement("div");l.classList.add("product-content-wrapper");const p=document.createElement("div");if(p.classList.add("skeleton-container"),i){const n=document.createElement("div");n.classList.add("wave","sc-title"),p.appendChild(n)}if(!n){const n=document.createElement("div");return n.classList.add("wave","sc-add-to-cart"),p.appendChild(n),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 y=document.createElement("div");y.classList.add("wave","sc-size-button"),f.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),f.appendChild(b);const w=document.createElement("div");w.classList.add("wave","sc-size-button"),f.appendChild(w),p.appendChild(f);const C=document.createElement("div");C.classList.add("sc-row");const k=document.createElement("div");k.classList.add("wave","sc-price"),C.appendChild(k);const S=document.createElement("div");S.classList.add("wave","sc-personalization"),C.appendChild(S),p.appendChild(C);const I=document.createElement("div");I.classList.add("wave","sc-deliver-to"),p.appendChild(I);const T=document.createElement("div");T.classList.add("wave","sc-address"),p.appendChild(T);const D=document.createElement("div");D.classList.add("wave","sc-retailers",a),p.appendChild(D);const A=document.createElement("div");if(A.classList.add("sc-row"),s){const n=document.createElement("div");n.classList.add("wave","sc-quantity"),A.appendChild(n)}const P=document.createElement("div");if(P.classList.add("wave","sc-add-to-cart"),A.appendChild(P),p.appendChild(A),o){const n=document.createElement("div");n.classList.add("wave","sc-description-title"),p.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),p.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),p.appendChild(o);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 _=document.createElement("div");if(_.classList.add("product-content"),_.appendChild(p),l.appendChild(_),c){l.classList.add("has-images");const n=this.createImageSkeletons();l.prepend(n)}return l}createImageSkeletons(){const n=document.createElement("div");n.classList.add("product-image-carousel","skeleton");const i=document.createElement("div");i.classList.add("wave","sc-main-image"),i.title="Product main image loading";const o=document.createElement("div");o.classList.add("carousel-dots");for(let c=0;c<3;c++){const n=document.createElement("div");n.classList.add("wave","sc-carousel-dot"),o.appendChild(n)}i.appendChild(o),n.appendChild(i);const s=document.createElement("div");s.classList.add("gallery-viewport");const a=document.createElement("div");a.classList.add("gallery-container");for(let c=0;c<4;c++){const n=document.createElement("div");n.classList.add("gallery-image-wrapper");const i=document.createElement("div");i.classList.add("wave","sc-gallery-thumbnail"),n.appendChild(i),a.appendChild(n)}return s.appendChild(a),n.appendChild(s),n}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".drawer.isOpen");if(o){const n=o.value===!![];n&&this.addHostClasses("hide-content"),n||this.removeHostClasses("hide-content")}}template(){const n=this.getProductId(),i=this.getStoreValue("address.formattedAddress");if(i)return ComponentFactoryService.createElement({type:w.PRODUCT_INTERACTIONS,productId:this.getProductId()});const o=document.createElement("button");return o.type="button",o.className="product-options-open-address-button",o.textContent=this.config.layout.buyNowButtonText,o.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(w.ADDRESS_INPUT,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,w.ADDRESS_INPUT,{productId:n})}),o}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n);let o=i.noAvailabilityPrice;return i.selectedFulfillment&&(o=i.selectedFulfillment.price),formatCentToDollarText(o)}}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 n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getConfigs("product"),s=[],a=this.getConfigs("configurations");if(!i.productHasAvailability||!a.isElementsEnabled){const n=document.createElement("p");return n.className="product-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),s.push(n),s}const c="carousel"===o.layout.fulfillmentDisplay?w.PRODUCT_RETAILERS_CAROUSEL:w.PRODUCT_RETAILERS_POPUP,l=ComponentFactoryService.createElement({type:c,productId:n});return s.push(l),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 n=this.retailerCards.findIndex(n=>n.classList.contains("selected"));-1!==n&&this.scrollToIndex(n)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".selectedFulfillmentId");(null==o?void 0:o.value)&&this.updateSelectedCard(o.value)}updateSelectedCard(n){for(const o of this.retailerCards)o.classList.remove("selected"),o.setAttribute("aria-pressed","false");const i=this.retailerCards.findIndex(i=>i.dataset.fulfillmentId===n);-1!==i&&(this.retailerCards[i].classList.add("selected"),this.retailerCards[i].setAttribute("aria-pressed","true"),this.scrollToIndex(i))}scrollToIndex(n){if(!this.listViewport||!this.retailerCards[n])return;const i=this.retailerCards[n],o=this.listViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,a=o/2,c=a-s,l=0,p=-(this.listContainer.scrollWidth-o);this.translateX=Math.max(p,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(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.listViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+o,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(n){this.listContainer&&(this.listContainer.style.transition=n?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(n){if(this.hasMoved)return;const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.fulfillmentId===o)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:i,fulfillmentId:o}),void 0;await this.commands.product.selectFulfillment(i,o)}generateRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:o,selectedSizeAttributes:s}){var a,c,l,p,m,f,g,v;const y=i===C.ON_DEMAND;let b=null;y&&n.hourStatus.openTime&&(null===(a=n.hourStatus)||void 0===a?void 0:a.closeTime)&&(b=n.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(c=n.hourStatus)||void 0===c?void 0:c.closeTime):"Opens at "+format24TimeTo12(null===(l=n.hourStatus)||void 0===l?void 0:l.openTime));const w=y&&n.hourStatus&&n.hourStatus.isClosed?"closed":"",k=document.createElement("div");k.className="carousel-retailer-card "+(o?"selected":"")+" "+w,k.setAttribute("data-fulfillment-id",n.fulfillmentId),k.setAttribute("role","button"),k.setAttribute("tabindex","0"),k.setAttribute("aria-pressed",o?"true":"false");const S=i===C.SHIPPING?"Shipping":"Same-day delivery";k.setAttribute("aria-label",S+" from "+n.retailerName+", "+formatCentToDollarText(null!==(p=n.price)&&void 0!==p?p:0));const I=document.createElement("div");I.className="retailer-header";const T=document.createElement("h3");if(T.className="name",T.textContent=n.retailerName,I.appendChild(T),y){const i=document.createElement("h3");i.className="address",i.textContent=n.retailerAddressFormatted,I.appendChild(i)}const D=document.createElement("div");D.className="retailer-body";const A=document.createElement("span");A.className="product-price",A.textContent=formatCentToDollarText(null!==(m=n.price)&&void 0!==m?m:0);const P=document.createElement("span");P.className="shipping-price",P.textContent=n.fee>0?"+ "+formatCentToDollarText(n.fee):"FREE Delivery";const _=document.createElement("span");return _.className="expectation",_.textContent=n.hourStatus.isClosed?b:(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==n?void 0:n.expectationText,D.append(A,P,_),k.append(I,D),k}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==o?void 0:o.attributes)||null,a=[];for(const g in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,g)&&a.push(o.shippingFulfillments[g]);const c=[];for(const g in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,g)&&c.push(o.onDemandFulfillments[g]);const l=i.selectedFulfillmentType===C.SHIPPING,p=i.selectedFulfillmentType===C.ON_DEMAND,m=l?a:c,f=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===m.length){const n=document.createElement("p");return n.className="product-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,n]}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 n=this.generateRetailerCard({fulfillment:g,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:g.fulfillmentId===i.selectedFulfillmentId,selectedSizeAttributes:s}),o=i.selectedFulfillmentType===C.ON_DEMAND&&g.hourStatus.isClosed;o?n.setAttribute("aria-disabled","true"):(n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())})),this.listContainer.appendChild(n)}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 n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==o?void 0:o.attributes)||null,a=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=Object.values(o.shippingFulfillments),p=Object.values(o.onDemandFulfillments),m=(a?l.length:0)+(c?p.length:0),f=document.createElement("div");f.className="header";const g=document.createElement("span");g.className="header-label",g.textContent=i.selectedFulfillmentType===C.SHIPPING?"Shipping From:":"Delivering From:";const v=document.createElement("button");if(v.className="delivery-options",v.type="button",v.textContent="See Delivery Options ("+m+")",v.setAttribute("aria-label","View all "+m+" delivery options"),v.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(w.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,w.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}))}),f.appendChild(g),f.appendChild(v),!i.fulfillmentHasAvailability){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,n]}const y=document.createElement("div");y.className="popup-fulfillment-list-container";const b=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:s});return y.appendChild(b),[f,y]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const u=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(i),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.fulfillmentId===o)return await u(),void 0;await this.commands.product.selectFulfillment(i,o),await u()}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),s=(null==o?void 0:o.attributes)||null,a=[];for(const y in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,y)&&a.push(o.shippingFulfillments[y]);const c=[];for(const y in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,y)&&c.push(o.onDemandFulfillments[y]);const l=i.selectedFulfillmentType===C.SHIPPING,p=i.selectedFulfillmentType===C.ON_DEMAND,m=l?a:c,f=document.createElement("h5");f.className="popup-retailers-section-title",f.textContent="Delivery Options";const g=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===m.length){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,g,n]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const y of m){const n=renderPopupRetailerCard({fulfillment:y,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:y.fulfillmentId===i.selectedFulfillmentId,selectedSizeAttributes:s});n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())}),v.appendChild(n)}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(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".drawer.isOpen"),s=n.find(n=>n.path==="products."+i+".rerender");o&&this.titleElement&&this.titleElement.classList.toggle("hide",o.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o)return ComponentFactoryService.createElement({type:w.PRODUCT_LOADING});if(o.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:w.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:w.PRODUCT_LOADING});const s=o.sizes[o.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+o.name);const c=document.createElement("div");if(c.classList.add("product-content"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+o.name),this.config.layout.showTitle){const n=document.createElement("h1");n.classList.add("product-title"),n.textContent=o.name,this.titleElement=n,c.appendChild(n)}const l=ComponentFactoryService.createElement({type:w.PRODUCT_OPTIONS,productId:i});c.appendChild(l);const p=ComponentFactoryService.createElement({type:w.PRODUCT_DRAWER,productId:i});if(c.appendChild(p),a.appendChild(c),!this.config.layout.showImages||!(null===(n=o.images)||void 0===n?void 0:n.length))return a;a.classList.add("has-images");const m=ComponentFactoryService.createElement({type:w.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:s.image,productId:i});return a.prepend(m),m.setAttribute("aria-label","Product images"),a}async disconnected(){const n=this.getProductId();n&&await this.commands.product.removeProduct(n)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var n;const i=this.params.product,o=this.getStoreValue("address.address"),s={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==o?void 0:o.state)||"",isPresale:![],isPresaleActive:![]},a=i.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||{};s.isPresale=(null===(n=l.presale)||void 0===n?void 0:n.isActive)===!![],s.isPresaleActive=this.isPresaleActive(l);for(const p of this.params.fulfillments){const n=c.shippingFulfillmentId===p.id||c.shippingFulfillmentId===p.id;if(n){const n="shipping"===p.type&&c.shippingFulfillmentId||"onDemand"===p.type&&c.onDemandFulfillmentId;if(n&&c.stock>0){s.hasAvailability=!![],s.fulfillmentId=p.id,s.partNumber=c.partNumber;break}}}return s}isPresaleActive(n){const i=null==n?void 0:n.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const n=new Date(i.canPurchaseOn),o=new Date;if(o.getTime()<n.getTime())return![]}return!![]}async handleAddToCart(n){if(!n.hasAvailability)return;const i=this.params.product.salsifyGrouping||this.params.product.id||"";n.isPresale&&n.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,identifier:i}):await this.commands.productList.addToCart({upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,identifier:i})}template(){var n,i,o;const s=this.params.product,a=s.sizes[0],c=a?a.image:s.images[0],l=s.name,p=a?a.size:null,m=null!==(o=null===(i=null===(n=null==a?void 0:a.shippingVariants)||void 0===n?void 0:n[0])||void 0===i?void 0:i.price)&&void 0!==o?o:s.noAvailabilityPrice,f=this.getAvailabilityData();return this.createVariantStandard({image:c,name:l,size:p,price:m,availability:f})}generateProductUrl(){var n;if(!this.params.productUrl)return null;const i=this.params.product,o=null===(n=i.sizes)||void 0===n?void 0:n[0],s=this.params.productUrl;if(s.includes("{upc}")){const n=(null==o?void 0:o.upc)||"";return n?s.replace("{upc}",n):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(s.includes("{grouping}")){const n=i.salsifyGrouping||"";return n?s.replace("{grouping}",n):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(n){const{image:i,name:o,size:s,price:a,availability:c}=n,l=[],p=this.generateProductUrl(),m=document.createElement("div");m.className="plc__image-content";const f=document.createElement("div");f.className="plc__image-wrapper";const g=document.createElement("img");if(g.className="plc__image",g.src=i,g.alt=o,g.loading="lazy",f.appendChild(g),m.appendChild(f),p){const n=document.createElement("a");n.href=p,n.className="plc__image-link",n.target="_blank",n.rel="noopener noreferrer",n.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),n.appendChild(m),l.push(n)}else l.push(m);const v=document.createElement("div");v.className="plc__content";const y=document.createElement("h3");if(y.className="plc__title",y.textContent=o,p){const n=document.createElement("a");n.href=p,n.className="plc__title-link",n.target="_blank",n.rel="noopener noreferrer",n.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),n.appendChild(y),v.appendChild(n)}else v.appendChild(y);const b=document.createElement("div");b.className="plc__size-price-wrapper";const w=document.createElement("div");w.className="plc__price",w.textContent=formatCentToDollarText(a),b.appendChild(w);const C=document.createElement("div");C.className="plc__size",C.textContent=s||"",b.appendChild(C),v.appendChild(b),l.push(v);const k=document.createElement("button");return k.type="button",k.className="plc__button",k.disabled=!c.hasAvailability,c.isPresale?k.textContent="Pre Order":c.hasAvailability?k.textContent="Add to Cart":(k.textContent="Not Available In "+c.state.toUpperCase(),this.addHostClasses("not-available")),k.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleAddToCart(c)}),l.push(k),l}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(n){const i=document.createElement("div");i.classList.add("slc__card");const o=document.createElement("div");o.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),o.appendChild(s);const c=document.createElement("div");c.className="slc__content";const l=document.createElement("div");l.className="slc__title-container";const p=document.createElement("div");p.classList.add("wave","slc__title","slc__title-line-1"),l.appendChild(p);const m=document.createElement("div");m.classList.add("wave","slc__title","slc__title-line-2"),l.appendChild(m),c.appendChild(l);const f=document.createElement("div");f.className="slc__size-price-wrapper";const g=document.createElement("div");g.classList.add("wave","slc__price"),f.appendChild(g);const v=document.createElement("div");v.classList.add("wave","slc__size"),f.appendChild(v),c.appendChild(f);const y=document.createElement("div");return y.classList.add("wave","slc__button"),i.appendChild(o),i.appendChild(c),i.appendChild(y),i}template(){const n=[],i=100/this.params.columns;this.container.style.setProperty("--card-width",i+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const o=this.params.rows*this.params.columns;for(let s=0;s<o;s++){const i=this.createSkeletonCard(s);n.push(i)}return n}}function createApplyFiltersButton(n){const i=document.createElement("div");i.className="product-list-filters-apply-container";const o=document.createElement("button");return o.className="product-list-filters-apply-btn",o.textContent="Apply Filters",o.addEventListener("click",()=>n()),i.appendChild(o),i}function createCheckboxItem(n){const{filter:i,state:o,item:s,onChange:a}=n,c=document.createElement("div");c.className="checkbox-filter-item";const l=document.createElement("input");l.type="checkbox",l.id=i.bucket+"-"+s.value,l.value=s.value.toString(),l.className="checkbox-filter-checkbox",l.checked=o.selectedValues.has(s.value.toString()),l.addEventListener("change",a);const p=document.createElement("label");p.htmlFor=l.id,p.className="checkbox-filter-item-label";const m=s.formattedValue||s.value.toString(),f=s.count||0,g=document.createElement("span");g.className="checkbox-filter-item-text",g.textContent=m;const v=document.createElement("span");return v.className="checkbox-filter-item-count",v.textContent="("+f+")",p.appendChild(g),p.appendChild(v),c.appendChild(l),c.appendChild(p),c}function handleCheckboxFilterSearch(n){const{filter:i,state:o,searchTerm:s,renderCheckboxItems:a}=n,c=s.toLowerCase().trim();o.filteredItems=c?i.values.filter(n=>{const i=(n.formattedValue||n.value.toString()).toLowerCase();return i.includes(c)}):[...i.values],a()}function createCheckboxFilterHeader(n){const{filter:i,state:o,onToggle:s}=n,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(i.bucket);const p=document.createElement("span");return p.className="checkbox-filter-toggle-icon "+(o.isExpanded?"expanded":"collapsed"),p.innerHTML=o.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),o.iconElement=p,c.appendChild(l),c.appendChild(p),c.addEventListener("click",()=>s(i.bucket)),a.appendChild(c),a}function createCheckboxFilterSearchContainer(n){const{state:i,onSearch:o}=n,s=document.createElement("div");s.className="checkbox-filter-search-wrapper",i.searchInput=document.createElement("input"),i.searchInput.type="text",i.searchInput.className="checkbox-filter-search",i.searchInput.placeholder="Search";const a=document.createElement("span");return a.className="checkbox-filter-search-icon",a.innerHTML=SearchIcon({}),i.searchInput.addEventListener("input",n=>{const i=n.target;o(i.value)}),s.appendChild(i.searchInput),s.appendChild(a),s}function renderCheckboxItems(n){const{filter:i,state:o,onCheckboxChange:s}=n;if(o.checkboxList&&(o.checkboxList.innerHTML="",o.filteredItems.forEach(n=>{const a=createCheckboxItem({filter:i,state:o,item:n,onChange:()=>{const i=a.querySelector("input");s(n.value.toString(),i.checked)}});o.checkboxList.appendChild(a)}),0===o.filteredItems.length)){const n=document.createElement("div");n.className="checkbox-filter-no-results",n.textContent="No results found",o.checkboxList.appendChild(n)}}function updateFilterExpandState(n){n.contentElement&&(n.contentElement.className="checkbox-filter-content "+(n.isExpanded?"expanded":"collapsed")),n.iconElement&&(n.iconElement.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),n.iconElement.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(n){return n.charAt(0).toUpperCase()+n.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(n){const{currentFilters:i,deliveryCollapsed:o,isSameDayDeliveryDisabled:s,onDeliveryOptionsChange:a,onToggleCollapse:c}=n,l=[],p=document.createElement("div");p.className="product-list-filters-delivery-options";const m=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],f=document.createElement("div");f.className="product-list-filters-delivery-options-header",f.style.cursor="pointer";const g=document.createElement("h3");g.className="product-list-filters-delivery-options-label",g.textContent="Delivery Options";const v=document.createElement("div");v.className="product-list-filters-chevron",v.innerHTML=o?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),f.appendChild(g),f.appendChild(v),p.appendChild(f);const y=document.createElement("div");y.className="product-list-filters-delivery-options-list",o&&y.classList.add("collapsed");for(const b of m){const n=document.createElement("div");n.className="product-list-filters-delivery-option";const o=document.createElement("input");o.type="radio",o.id="delivery-"+b.value,o.name="delivery-options",o.value=b.value,o.className="product-list-filters-delivery-radio";const c="onDemand"===b.value&&s;o.disabled=c,o.checked=b.value===(null==i?void 0:i.deliveryOptions),o.addEventListener("change",n=>{const i=n.target;null==a?void 0:a(i.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,n.appendChild(o),n.appendChild(l),y.appendChild(n)}return p.appendChild(y),f.addEventListener("click",()=>{c()}),l.push(p),{elements:l,chevronContainer:v,deliveryOptionsList:y}}function createPriceFilter(n){var i,o,s,a,c,l,p,m;const{priceConfig:f,currentFilters:g,priceCollapsed:v,onPriceChange:y,onToggleCollapse:b,DEFAULT_MIN:w,DEFAULT_MAX:C}=n,k=[],S=document.createElement("div");S.className="product-list-filters-price";const I=Number.parseInt(null!==(i=null==f?void 0:f.min)&&void 0!==i?i:w,10),T=Number.parseInt(null!==(o=null==f?void 0:f.max)&&void 0!==o?o:C,10),D=Number.parseInt(null!==(c=null!==(a=null===(s=null==g?void 0:g.price)||void 0===s?void 0:s.min)&&void 0!==a?a:null==f?void 0:f.min)&&void 0!==c?c:w,10),A=Number.parseInt(null!==(m=null!==(p=null===(l=null==g?void 0:g.price)||void 0===l?void 0:l.max)&&void 0!==p?p:null==f?void 0:f.max)&&void 0!==m?m:C,10),P=document.createElement("div");P.className="product-list-filters-price-header",P.style.cursor="pointer";const _=document.createElement("h3");_.className="product-list-filters-price-title",_.textContent="Price Range",P.appendChild(_);const N=document.createElement("div");N.className="product-list-filters-chevron",N.innerHTML=v?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),P.appendChild(N),S.appendChild(P);const F=document.createElement("div");F.className="product-list-filters-price-slider-container",v&&F.classList.add("collapsed");const O=document.createElement("div");O.className="product-list-filters-price-range-wrapper";const L=document.createElement("div");L.className="product-list-filters-price-track";const z=document.createElement("div");z.className="product-list-filters-price-track-active",L.appendChild(z),O.appendChild(L);const M=document.createElement("input");M.type="range",M.min=I.toString(),M.max=T.toString(),M.value=D.toString(),M.step="1",M.className="product-list-filters-price-range product-list-filters-price-range-min",O.appendChild(M);const W=document.createElement("input");W.type="range",W.min=I.toString(),W.max=T.toString(),W.value=A.toString(),W.step="1",W.className="product-list-filters-price-range product-list-filters-price-range-max",O.appendChild(W),F.appendChild(O);const H=document.createElement("div");H.className="product-list-filters-price-inputs-container";const G=document.createElement("div");G.className="product-list-filters-price-input-wrapper";const V=document.createElement("span");V.className="product-list-filters-price-input-prefix",V.textContent="$";const K=document.createElement("input");K.type="number",K.min=I.toString(),K.max=T.toString(),K.value=D.toString(),K.className="product-list-filters-price-input",K.placeholder=I.toString(),G.appendChild(V),G.appendChild(K);const Q=document.createElement("span");Q.className="product-list-filters-price-separator",Q.textContent="to";const Z=document.createElement("div");Z.className="product-list-filters-price-input-wrapper";const X=document.createElement("span");X.className="product-list-filters-price-input-prefix",X.textContent="$";const $=document.createElement("input");$.type="number",$.min=I.toString(),$.max=T.toString(),$.value=A.toString(),$.className="product-list-filters-price-input",$.placeholder=T+"+",Z.appendChild(X),Z.appendChild($),H.appendChild(G),H.appendChild(Q),H.appendChild(Z),F.appendChild(H),S.appendChild(F);const j=()=>{const n=Number.parseInt(M.value,10),i=Number.parseInt(W.value,10),o=T-I,s=(n-I)/o*100,a=(i-I)/o*100;z.style.left=s+"%",z.style.width=a-s+"%"},d=(n,i)=>{M.value=n.toString(),W.value=i.toString(),K.value=n.toString(),$.value=i.toString(),j()};return M.addEventListener("input",()=>{let n=Number.parseInt(M.value,10);const i=Number.parseInt(W.value,10);n>i&&(n=i),d(n,i)}),M.addEventListener("change",()=>{const n=Number.parseInt(M.value,10),i=Number.parseInt(W.value,10);null==y?void 0:y(n.toString(),i.toString())}),W.addEventListener("input",()=>{const n=Number.parseInt(M.value,10);let i=Number.parseInt(W.value,10);i<n&&(i=n),d(n,i)}),W.addEventListener("change",()=>{const n=Number.parseInt(M.value,10),i=Number.parseInt(W.value,10);null==y?void 0:y(n.toString(),i.toString())}),K.addEventListener("input",()=>{let n=Number.parseInt(K.value,10)||I;const i=Number.parseInt($.value,10)||T;n=Math.max(I,Math.min(n,T)),n>i&&(n=i),d(n,i),null==y||y(n.toString(),i.toString())}),$.addEventListener("input",()=>{const n=Number.parseInt(K.value,10)||I;let i=Number.parseInt($.value,10)||T;i=Math.max(I,Math.min(i,T)),i<n&&(i=n),d(n,i),null==y||y(n.toString(),i.toString())}),j(),P.addEventListener("click",()=>{b()}),k.push(S),{elements:k,chevronContainer:N,sliderContainer:F}}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 n=[],i=document.createElement("div");i.className="product-list-search-box";const o=document.createElement("span");return o.className="product-list-search-icon",o.innerHTML=SearchIcon({}),o.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",n=>{const i=n.target,o=i.value,s=this.sanitizeInput(o);s!==o&&(i.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("")}),i.appendChild(o),i.appendChild(this.searchInput),i.appendChild(this.clearButton),n.push(i),n}sanitizeInput(n){if(!n)return"";let i=n.replace(this.ALLOWED_CHARACTERS,"");return i=i.trim(),i=i.replace(/\s+/g," "),i.length>this.MAX_LENGTH&&(i=i.substring(0,this.MAX_LENGTH)),i}updateClearButtonVisibility(n){this.clearButton&&(this.clearButton.style.display=n?"flex":"none")}}function createPersonalizedFilter(n){const{currentFilters:i,isPersonalizationDisabled:o,onPersonalizedChange:s}=n,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 p=document.createElement("div");p.classList.add("toggle-switch");const m=!!(null==i?void 0:i.personalized);m&&p.classList.add("active");const f=document.createElement("div");f.classList.add("toggle-slider"),p.id="personalized-switch",p.setAttribute("tabindex","0"),p.setAttribute("aria-label","Toggle Personalized Bottles"),p.setAttribute("role","switch"),p.setAttribute("aria-checked",m?"true":"false"),p.appendChild(f);const e=n=>{p.classList.toggle("active",n),p.setAttribute("aria-checked",n?"true":"false")},r=()=>{const n=p.classList.contains("active"),i=!n;e(i),null==s||s(i)};if(p.addEventListener("click",()=>{o||r()}),p.addEventListener("keydown",n=>{o||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),r())}),c.appendChild(p),o){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",c.appendChild(n)}return a.push(c),a}function createPreOrderFilter(n){const{currentFilters:i,isPreOrderDisabled:o,onPreOrderChange:s}=n,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 p=document.createElement("div");p.classList.add("toggle-switch");const m=!!(null==i?void 0:i.preOrder);m&&p.classList.add("active"),o&&p.classList.add("disabled");const f=document.createElement("div");f.classList.add("toggle-slider"),p.id="pre-order-switch",p.setAttribute("tabindex",o?"-1":"0"),p.setAttribute("aria-label","Toggle Pre-Order"),p.setAttribute("role","switch"),p.setAttribute("aria-checked",m?"true":"false"),p.setAttribute("aria-disabled",o?"true":"false"),p.appendChild(f);const e=n=>{p.classList.toggle("active",n),p.setAttribute("aria-checked",n?"true":"false")},r=()=>{const n=p.classList.contains("active"),i=!n;e(i),null==s||s(i)};if(p.addEventListener("click",()=>{o||r()}),p.addEventListener("keydown",n=>{o||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),r())}),c.appendChild(p),o){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",c.appendChild(n)}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 n=["product-list-filters-container"];return this.params.isDrawerMode&&n.push("drawer-mode"),n}isSameDayDeliveryDisabled(){var n,i;return!(!(null===(n=this.params.currentFilters)||void 0===n?void 0:n.personalized)&&!(null===(i=this.params.currentFilters)||void 0===i?void 0:i.preOrder))}isPersonalizationDisabled(){var n;return"onDemand"===(null===(n=this.params.currentFilters)||void 0===n?void 0:n.deliveryOptions)}isPreOrderDisabled(){var n;return"onDemand"===(null===(n=this.params.currentFilters)||void 0===n?void 0:n.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 n=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=n.chevronContainer,this.deliveryOptionsList=n.deliveryOptionsList,n.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 n=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=n.chevronContainer,this.priceSliderContainer=n.sliderContainer,n.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(n){var i;const o=[];if(!this.checkboxFilterStates.has(n.bucket)){const o=null===(i=this.params.currentFilters)||void 0===i?void 0:i[n.bucket],s=Array.isArray(o)?new Set(o):new Set;this.checkboxFilterStates.set(n.bucket,{isExpanded:s.size>0,selectedValues:s,searchInput:null,checkboxList:null,filteredItems:[...n.values],contentElement:null,iconElement:null,hasUserInteraction:s.size>0})}const s=this.checkboxFilterStates.get(n.bucket),a=document.createElement("div");a.className="product-list-checkbox-filter",a.setAttribute("data-filter-bucket",n.bucket);const c=document.createElement("div");c.className="checkbox-filter-container";const l=createCheckboxFilterHeader({filter:n,state:s,onToggle:n=>this.toggleCheckboxFilter(n)});c.appendChild(l);const p=document.createElement("div");p.className="checkbox-filter-content "+(s.isExpanded?"expanded":"collapsed"),s.contentElement=p;const m=createCheckboxFilterSearchContainer({state:s,onSearch:i=>{handleCheckboxFilterSearch({filter:n,state:s,searchTerm:i,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(n,s)})}});return p.appendChild(m),s.checkboxList=document.createElement("div"),s.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(n,s),p.appendChild(s.checkboxList),c.appendChild(p),a.appendChild(c),o.push(a),o}renderCheckboxItemsWrapper(n,i){renderCheckboxItems({filter:n,state:i,onCheckboxChange:(o,s)=>this.handleCheckboxChange(n.bucket,i,o,s)})}handleCheckboxChange(n,i,o,s){s?i.selectedValues.add(o):i.selectedValues.delete(o),i.hasUserInteraction=!![],i.isExpanded||(i.isExpanded=!![],updateFilterExpandState(i)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(n,Array.from(i.selectedValues))}toggleCheckboxFilter(n){const i=this.checkboxFilterStates.get(n);i&&(i.isExpanded=!i.isExpanded,i.hasUserInteraction=!![],updateFilterExpandState(i))}template(){var n;const i=[],o=document.createElement("div");o.className="product-list-filters-header",this.params.isDrawerMode&&o.classList.add("drawer-mode");const s=document.createElement("h3");if(s.className="product-list-filters-title",s.textContent="Filters",o.appendChild(s),this.params.isDrawerMode){const n=document.createElement("button");n.className="product-list-filters-close-btn",n.innerHTML=CloseIcon({}),n.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o.appendChild(n)}return i.push(o),this.params.enablePersonalized&&i.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&i.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&i.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&i.push(...this.createPriceFilterWrapper()),null===(n=this.params.sanitizedFilters)||void 0===n||n.forEach(n=>{i.push(...this.createCheckboxFilter(n))}),this.params.isDrawerMode&&i.push(createApplyFiltersButton(()=>{var n,i;null===(i=(n=this.params).onApplyFilters)||void 0===i?void 0:i.call(n),this.commands.ui.closeDrawer()})),i}}const FilterIcon=({width:n=16,height:i=16,className:o="",color:s=null})=>{const a=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 24 24" class="filter-icon '+o+'" 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 Rt;(function(n){n.IDLE="idle",n.LOADING_INITIAL="loading_initial",n.LOADING_MORE="loading_more",n.ERROR="error"})(Rt||(Rt={}));class ProductListComponent extends BaseComponent{get hostClasses(){const n=["product-list"];return this.params.filters.length>0&&n.push("has-filters"),n}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.sanitizedFilters=[],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=Rt.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(Rt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Rt.IDLE)}catch(ht){this.logger.error("Error initializing product list:",ht),this.setLoadingState(Rt.ERROR),this.showErrorState("Failed to load products")}}template(){const n=[],i=document.createElement("div");i.className="product-list-search__control-container",i.appendChild(this.createSearchContainer()),n.push(i),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),n.push(this.filterButton));const o=document.createElement("div");return o.className="product-list-controls",this.params.filters.length>0&&o.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),o.appendChild(this.cardsContainer),n.push(o),this.renderCurrentState(),n}setLoadingState(n){this.loadingState=n,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Rt.LOADING_INITIAL:this.renderLoadingState();break;case Rt.ERROR:break;case Rt.IDLE:case Rt.LOADING_MORE:this.updateSentinel()}}sanitizeFilterValues(n){return n.map(n=>({...n,formattedValue:n.value}))}processResponseFilters(n){var i;return(null===(i=null==n?void 0:n.navigation)||void 0===i?void 0:i.filters)?n.navigation.filters.filter(n=>n.bucket!==m.AVAILABILITY).filter(n=>n.bucket!==m.PRICE).filter(n=>n.bucket!==m.ENGRAVING).filter(n=>n.bucket!==m.PRESALE).filter(n=>n.bucket!==m.TAGS).map(n=>{var i,o;if(n.bucket===m.CATEGORIES){const s=new Set;return{...n,values:null!==(o=null===(i=n.values)||void 0===i?void 0:i.map(n=>{const i=n.value.split(">").map(n=>n.trim()),o=i.pop()||"";let a=o;return s.has(o)&&(a=i.slice(-1).concat(o).join(" > ")),s.add(a),{...n,formattedValue:a}}).slice(1))&&void 0!==o?o:[]}}return{...n,values:this.sanitizeFilterValues(n.values)}}).filter(n=>{var i;return(null===(i=n.values)||void 0===i?void 0:i.length)>0}):[]}async loadInitialProducts(){var n;try{const i=this.buildApiParams(0),o=await this.commands.productList.getProductList(i);this.sanitizedFilters=this.processResponseFilters(o),this.products=o.products||[],this.retailers=o.retailers||[],this.updatePagination(o.navigation),this.syncFiltersFromResponse((null===(n=o.navigation)||void 0===n?void 0:n.filters)||[]),this.updateFiltersComponent()}catch(i){throw this.products=[],this.retailers=[],this.pagination.hasMorePages=![],i}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const n=this.filtersContainer.parentElement;if(!n)return;const i=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),n.replaceChild(this.filtersContainer,i)}async loadMoreProducts(){if(this.loadingState!==Rt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Rt.LOADING_MORE);const n=this.pagination.currentPage+1,i=this.buildApiParams(n),o=await this.commands.productList.getProductList(i);this.sanitizedFilters=this.processResponseFilters(o),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(Rt.IDLE)}catch(n){this.logger.error("Error loading more products:",n),this.setLoadingState(Rt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(n){const i=new Map(this.retailers.map(n=>[n.id,n]));for(const o of n)i.has(o.id)||(this.retailers.push(o),i.set(o.id,o))}updatePagination(n){var i,o,s,a;n&&(this.pagination={currentPage:null!==(i=n.currentPage)&&void 0!==i?i:0,totalPages:null!==(o=n.totalPages)&&void 0!==o?o:0,hasMorePages:(null!==(s=n.currentPage)&&void 0!==s?s:0)<(null!==(a=n.totalPages)&&void 0!==a?a:1)-1})}buildApiParams(n){const i={page:n,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(i.search=this.searchFilter.searchTerm.trim()),i}buildFiltersFromState(){const n=[{key:"availability",values:"IN_STOCK"}];if(this.currentFilters.personalized&&n.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&n.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&n.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),this.currentFilters.price){const i={};"0"!==this.currentFilters.price.min&&(i.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(i.max=this.currentFilters.price.max),Object.keys(i).length>0&&n.push({key:"price",values:i})}const i=Object.keys(this.currentFilters).filter(n=>!["personalized","preOrder","deliveryOptions","price"].includes(n));for(const o of i){const i=this.currentFilters[o];Array.isArray(i)&&i.length>0&&n.push({key:o,values:i})}return n}syncFiltersFromResponse(n){if(n)for(const i of n)switch(i.key){case"engraving":this.currentFilters.personalized="YES"===i.values;break;case"presale":this.currentFilters.preOrder="YES"===i.values;break;case"fulfillment":Array.isArray(i.values)&&(i.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":i.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(Rt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(Rt.IDLE)}catch(ht){this.logger.error("Error handling filter change:",ht),this.setLoadingState(Rt.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(n=>{const i="onDemand"===n.value&&this.isSameDayDeliveryDisabled();n.disabled=i,i&&"onDemand"===n.value||(n.checked=n.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(n,i)})}updateRadioLabel(n,i){const o=this.deliveryRadioLabels.get(n.id);o&&(o.className="product-list-filters-delivery-radio-label "+(i?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const n=document.createElement("div");n.className="product-list-cards__container";const i=100/this.params.columns;return n.style.setProperty("--card-width",i+"%"),n.style.setProperty("--columns",""+this.params.columns),n}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const n=ComponentFactoryService.createElement({type:w.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(n)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const n=this.createInfoElement("No products found");return this.cardsContainer.appendChild(n),void 0}for(const n of this.products){const i=this.createProductCard(n);i&&this.cardsContainer.appendChild(i)}}}appendNewProducts(n){if(this.cardsContainer&&0!==n.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const i of n){const n=this.createProductCard(i);n&&this.cardsContainer.appendChild(n)}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(n){var i;try{const o=null===(i=n.sizes)||void 0===i?void 0:i[0];if(!o)return this.logger.warn("Product "+n.id+" has no sizes"),null;const s=new Map(this.retailers.flatMap(n=>n.fulfillments.map(n=>[n.id,n]))),a=new Set(Object.values(o.shippingVariants).flatMap(n=>n.shippingFulfillmentId)),c=Array.from(a).map(n=>s.get(n)).filter(n=>Boolean(n));return ComponentFactoryService.createElement({type:w.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:n,fulfillments:c,productUrl:this.params.productUrl})}catch(o){return this.logger.error("Error creating product card for product "+n.id+":",o),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const n={[m.BRANDS]:T.BRANDS,[m.CATEGORIES]:T.CATEGORIES,[m.FLAVOR]:T.FLAVOR,[m.REGION]:T.REGION,[m.VARIETY]:T.VARIETY,[m.VINTAGE]:T.VINTAGE,[m.COUNTRY]:T.COUNTRY,[m.APPELLATION]:T.APPELLATION,[m.MATERIALS]:T.MATERIALS,[m.SIZES]:T.SIZES};return this.sanitizedFilters.filter(i=>{const o=n[i.bucket];return o&&this.params.filters.includes(o)})}buildFiltersParams(n=![]){const B=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(T.PERSONALIZATION),enablePreOrder:this.params.filters.includes(T.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(T.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(T.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async i=>{this.currentFilters.personalized=i,n||await this.onFilterChange()},onPreOrderChange:async i=>{this.currentFilters.preOrder=i,n||await this.onFilterChange()},onDeliveryOptionsChange:async i=>{this.currentFilters.deliveryOptions=i,"onDemand"===i&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),n||await this.onFilterChange()},onPriceChange:async(i,o)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==i?this.currentFilters.price.min=i:delete this.currentFilters.price.min,"1000"!==o?this.currentFilters.price.max=o:delete this.currentFilters.price.max,n||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(i,o)=>{o.length>0?this.currentFilters[i]=o:delete this.currentFilters[i],n||await this.onFilterChange()},isDrawerMode:n,onApplyFilters:async()=>{await B()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:w.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async n=>{this.searchFilter.searchTerm=n,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(n={}){const{isDrawerMode:i=![]}=n;return this.filtersContainer=ComponentFactoryService.createElement({type:w.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(i)}),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 n=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(n),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(n=>{var i;const o=null===(i=this.filtersContainer)||void 0===i?void 0:i.querySelector('label[for="'+n.id+'"]');o&&this.deliveryRadioLabels.set(n.id,o)})}openFiltersDrawer(){this.commands.ui.openDrawer(w.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const n=document.createElement("div");n.className="product-list-filter-container";const i=document.createElement("div");i.className="product-list-filter-icon",i.innerHTML=FilterIcon({}),i.addEventListener("click",()=>{this.openFiltersDrawer()});const o=document.createElement("span");return o.className="product-list-filter-text",o.textContent="Filter",n.appendChild(i),n.appendChild(o),n}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(n=>{const i=n[0];i.isIntersecting&&this.loadingState===Rt.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const n=document.createElement("div");return n.className="product-list-scroll-sentinel",this.updateSentinelContent(n),n}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(n){let i;n.innerHTML="",i=this.loadingState===Rt.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),n.appendChild(i)}showSentinelError(n){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const i=this.createErrorElement(n);this.sentinelElement.appendChild(i)}createLoadingElement(n){const i=document.createElement("div");i.className="product-list-sentinel-container";const o=document.createElement("div");o.className="product-list-sentinel-spinner";const s=document.createElement("div");return s.className="product-list-sentinel-text",s.textContent=n,i.appendChild(o),i.appendChild(s),i}createErrorElement(n){const i=document.createElement("div");i.className="product-list-sentinel-error-container";const o=document.createElement("div");o.className="product-list-sentinel-error-icon",o.innerHTML="⚠";const s=document.createElement("div");return s.className="product-list-sentinel-error-text",s.textContent=n,i.appendChild(o),i.appendChild(s),i}createInfoElement(n,i=![]){const o=document.createElement("div");if(o.className="product-list-sentinel-info-container",!i&&n.includes("Scroll")){const n=document.createElement("div");n.className="product-list-sentinel-icon",n.innerHTML="↓",o.appendChild(n)}else if(i){const n=document.createElement("div");n.className="product-list-sentinel-divider",o.appendChild(n)}const s=document.createElement("div");return s.className=i?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",s.textContent=n,o.appendChild(s),o}showErrorState(n){if(!this.cardsContainer)return;this.clearCardsContainer();const i=this.createErrorElement(n);this.cardsContainer.appendChild(i)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(n){const i=n.find(n=>"address"===n.path);if(i&&void 0!==i.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(o){this.logger.error("Error reloading products after address change:",o),this.setLoadingState(Rt.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(n){n.length>0&&this.updateAlert()}getErrorMessages(){var n,i;const o=null!==(n=this.params.fromEvents)&&void 0!==n?n:![],s=null!==(i=this.params.showFirstEvent)&&void 0!==i?i:!![];if(o){const n=this.store.get(this.params.errorStorePath)||[],i=n.filter(n=>null==n?void 0:n.message).map(n=>({message:n.message,level:n.level||"error",type:n.type}));return s?i.slice(0,1):i}const a=this.store.get(this.params.errorStorePath);return a?[{message:a,level:"error"}]:[]}createErrorElement(n){const i=document.createElement("div");i.classList.add("alert-container","alert-"+n.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:n.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=n.message,i.appendChild(o),i.appendChild(s),i}scheduleHide(){var n;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i=null!==(n=this.params.autoHideDelay)&&void 0!==n?n:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},i)}hideAllErrors(){var n;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[];const i=null!==(n=this.params.fromEvents)&&void 0!==n?n:![];i?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const n=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[],0===n.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=n.map(n=>this.createErrorElement(n)),this.elements.forEach(n=>{this.container.appendChild(n)}),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 n=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(w.CART)});const i=document.createElement("span");if(i.className="lce-cart-button-icon",i.innerHTML=BagIcon({color:n.theme.primaryColor}),this.params.showItemsCount){const n=document.createElement("span");return n.className="lce-cart-button-badge",n.style.visibility="hidden",[i,n]}return[i]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const n=this.container.querySelector(".lce-cart-button-badge");if(!n)return;const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(n){var i;const o=n.find(n=>"ui.drawer"===n.path);if(!o)return![];const s=o.value,a=s.isOpen,c=null===(i=s.contentConfig)||void 0===i?void 0:i.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:n}){try{if(!n)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:i,data:o}=n||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...o}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,i):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(i),this.open()),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Drawer content loading failed",i),this.commands.ui.closeDrawer()}}animateContentSwap(n,i){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const o=this.contentContainer.firstElementChild;o.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{o.classList.add("fading")}),setTimeout(()=>{o.remove(),n.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(n),this.updateDrawerContentTypeClass(i),requestAnimationFrame(()=>{n.classList.add("visible"),setTimeout(()=>{n.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(n){this.isOpen&&"Escape"===n.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(n){if(!this.drawerElement)return;const i=["drawer"];this.isOpen&&i.push("open"),i.push(n.toString().toLowerCase()),this.drawerElement.className=i.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var n;if(this.engravingLines=this.params.lines,"product"===this.params.context){const i=this.store.get("products."+this.params.identifier);this.fulfillmentId=i.selectedFulfillmentId,this.partNumber=(null===(n=i.selectedFulfillment)||void 0===n?void 0:n.partNumber)||null}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=n.fulfillmentId,this.partNumber=n.partNumber}}calculateTotalPrice(){var n,i;if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier),s=o.sizes[o.selectedSizeId],a=s.shippingFulfillments[this.fulfillmentId],c=a.price,l=(null===(i=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0;return c+l}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier),i=n.unitPrice,o=n.attributes.engraving.fee||0;return i+o}return 0}productInformationSection(){const n=[];let i="",o="";if("product"===this.params.context){const s=this.store.get("products."+this.params.identifier);s.sizes[s.selectedSizeId].image?n.push(s.sizes[s.selectedSizeId].image):n.push(...s.images||[]),i=s.name,o=s.sizes[s.selectedSizeId].size}if("cart"===this.params.context){const s=this.store.get("cart.items."+this.params.identifier);s.mainImage&&n.push(s.mainImage),i=s.name,o=s.size}const s=document.createElement("div");if(s.className="product-info-section",n.length>0){const o=document.createElement("div");o.className="product-image-container";const a=document.createElement("img");a.src=n[0],a.alt=i,a.loading="lazy",a.className="product-image",o.appendChild(a),s.appendChild(o)}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=i,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 p=document.createElement("p");p.className="product-size-text",p.textContent=o,a.appendChild(p);const m=document.createElement("p");return m.className="engraving-fees-disclaimer",m.textContent="Personalization fees included in total, varies by retailer.",a.appendChild(m),s.appendChild(a),s}addToCartButtonText(n){if("product"!==this.params.context)return"Save";const i=this.getConfigs("product"),o=i.layout.addToCartButtonText;return i.layout.addToCartButtonShowTotalPrice?o+" - "+formatCentToDollarText(n):o}retailersSection(){var n,i,o,s,a,c,l;const p=this.store.get("products."+this.params.identifier),m=p.sizes[p.selectedSizeId],f=Object.values(m.shippingFulfillments).filter(n=>n.isEngravable),g=document.createElement("div");g.className="fulfillment-section";const v=document.createElement("p");if(v.className="shipping-from-text",v.innerHTML="Shipping from: <b>"+(null===(n=p.selectedFulfillment)||void 0===n?void 0:n.retailerName)+"</b>",g.appendChild(v),1===f.length)return g;const y=document.createElement("div");y.className="fulfillment-options-container",g.appendChild(y);const b=document.createElement("span");b.className="see-more-fulfillments",b.textContent="See More Delivery Options ("+f.length+")",b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-label","See More Delivery Options ("+f.length+")"),b.setAttribute("aria-expanded","false");const E=()=>{const n=y.classList.contains("expanded");y.classList.toggle("expanded"),n?(b.textContent="See More Delivery Options ("+f.length+")",b.setAttribute("aria-label","See More Delivery Options ("+f.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",E),b.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),E())}),g.appendChild(b);for(const w of f){const n=document.createElement("div");n.className="fulfillment-option",n.setAttribute("data-fulfillment-id",w.fulfillmentId),w.fulfillmentId===(null===(i=p.selectedFulfillment)||void 0===i?void 0:i.fulfillmentId)&&n.classList.add("selected"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select delivery from "+w.retailerName+", "+formatCentToDollarText(w.price+((null===(s=null===(o=p.sizes[p.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.fee)||0))+", "+w.engravingExpectationText),n.setAttribute("aria-pressed",w.fulfillmentId===(null===(a=p.selectedFulfillment)||void 0===a?void 0:a.fulfillmentId)?"true":"false");const Y=()=>{this.fulfillmentId=w.fulfillmentId,this.partNumber=w.partNumber;const i=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const o=y.querySelector(".fulfillment-option.selected");o&&(o.classList.remove("selected"),o.setAttribute("aria-pressed","false")),n.classList.add("selected"),n.setAttribute("aria-pressed","true"),v.innerHTML="Shipping from: <b>"+w.retailerName+"</b>"};n.addEventListener("click",Y),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),Y())});const m=w.price+((null===(l=null===(c=p.sizes[p.selectedSizeId].attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0),f=document.createElement("div");f.className="option-row row-1",n.appendChild(f);const g=document.createElement("span");g.className="retailer-name",g.textContent=w.retailerName,f.appendChild(g);const b=document.createElement("span");b.className="fulfillment-price",b.textContent=formatCentToDollarText(m),f.appendChild(b),n.appendChild(f);const C=document.createElement("div");C.className="option-row row-2",n.appendChild(C);const k=document.createElement("span");k.className="estimated-time",k.textContent=""+w.engravingExpectationText,C.appendChild(k),n.appendChild(C),y.appendChild(n)}return g}engravingLinesSection(){var n;const{lines:i,maxLines:o,location:s,maxCharsPerLine:a}=this.params,c=document.createElement("div");c.className="engraving-section";const l=document.createElement("p");if(l.className="engraving-title",l.textContent="Personalize Your Bottle",c.appendChild(l),s&&(null===(n=null==s?void 0:s.trim())||void 0===n?void 0:n.length)>0){const n=document.createElement("p");n.className="engraving-location-text",n.textContent="Your message will appear "+s.toLowerCase()+".",c.appendChild(n)}const p=Array.from({length:o},(n,o)=>{const s=o+1,c=document.createElement("div");c.className="engraving-input-wrapper",c.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=a,l.value=i[o]||"",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 "+a+" characters":"Engraving line "+s+", maximum "+a+" characters");const p=document.createElement("span");return p.className="engraving-char-count",p.textContent=l.value.length+"/"+a,p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true"),l.addEventListener("input",()=>{p.textContent=l.value.length+"/"+a,this.engravingLines[o]=l.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),c.appendChild(l),c.appendChild(p),c}),m=document.createElement("div");return m.className="engraving-inputs-container",m.append(...p),c.appendChild(m),c}actionButtonsSection(){const{identifier:n,context:i}=this.params,o=document.createElement("div");o.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 J=async()=>{"product"===i&&await this.commands.product.closeProductDrawer(n),"cart"===i&&this.commands.ui.openDrawer(w.CART)};s.addEventListener("click",J),s.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),J())}),o.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"===i?"Add personalized item to cart":"Update personalization and return to cart");const h=async()=>{const o=this.engravingLines.map(n=>n.trim().toUpperCase()).filter(n=>n&&n.length>0);if("product"===i&&this.fulfillmentId&&this.partNumber){const i=this.store.get("products."+n);await this.commands.product.addToCart(n,{upc:i.sizes[i.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:n}),await this.commands.product.closeProductDrawer(n)}"cart"===i&&(await this.commands.cart.updateItemEngraving(n,o),this.commands.ui.openDrawer(w.CART))};return this.addToCartButton.addEventListener("click",h),this.addToCartButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),h())}),o.appendChild(this.addToCartButton),o}template(){const n=[],i=this.productInformationSection();if(n.push(i),"product"===this.params.context){const i=this.retailersSection();n.push(i)}const o=this.engravingLinesSection();n.push(o);const s=this.actionButtonsSection();n.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>",n.push(a),n}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const n=this.getConfigs("global");return["engraving-view-container",n.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n),o=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:o,total:o*s}}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n),o=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:o,total:o*s}}return{quantity:0,fee:0,total:0}}engravingLines(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}return[]}handleEdit(){var n,i,o,s,a,c,l,p,m,f,g,v,y,b,C,k,S,I,T,D;const A=this.params.identifier,P={identifier:A,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const g=this.getStoreValue("cart.items."+A);P.lines=(null===(i=null===(n=null==g?void 0:g.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],P.maxLines=(null===(s=null===(o=null==g?void 0:g.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.maxLines)||1,P.maxCharsPerLine=(null===(c=null===(a=null==g?void 0:g.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,P.fee=(null===(p=null===(l=null==g?void 0:g.attributes)||void 0===l?void 0:l.engraving)||void 0===p?void 0:p.fee)||0,P.location=(null===(f=null===(m=null==g?void 0:g.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location)||""}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+A);P.lines=(null===(v=null===(g=null==n?void 0:n.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.lines)||[],P.maxLines=(null===(b=null===(y=null==n?void 0:n.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxLines)||1,P.maxCharsPerLine=(null===(k=null===(C=null==n?void 0:n.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.maxCharsPerLine)||16,P.fee=(null===(I=null===(S=null==n?void 0:n.attributes)||void 0===S?void 0:S.engraving)||void 0===I?void 0:I.fee)||0,P.location=(null===(D=null===(T=null==n?void 0:n.attributes)||void 0===T?void 0:T.engraving)||void 0===D?void 0:D.location)||""}this.commands.ui.openDrawer(w.ENGRAVING_FORM,P)}async handleRemove(){const n=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(n,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(n)}template(){const n=this.engravingQuantityFee(),i=this.engravingLines();if(0===i.length)return"";const o=document.createElement("div");o.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const a=document.createElement("span");if(a.className="engraving-fee",1===n.quantity&&(a.textContent=formatCentToDollarText(n.total,![])),n.quantity>1){a.textContent=formatCentToDollarText(n.total,![]);const i=document.createElement("span");i.className="engraving-fee-each",i.textContent=" ("+formatCentToDollarText(n.fee,![])+" ea)",a.appendChild(i)}o.appendChild(s),o.appendChild(a);const c=document.createElement("div");c.className="engraving-body";const l=document.createElement("div");l.className="engraving-lines";for(const f of i){const n=document.createElement("span");n.className="engraving-line",n.textContent=f,l.appendChild(n)}const p=document.createElement("div");p.className="engraving-actions";const m=document.createElement("button");m.type="button",m.classList.add("remove-button"),m.textContent="Remove",m.setAttribute("aria-label","Remove engraving");const e=async()=>{await this.handleRemove()};if(m.addEventListener("click",e),m.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await e())}),p.appendChild(m),"checkout"!==this.params.context){const n=document.createElement("button");n.type="button",n.classList.add("edit-button"),n.textContent="Edit",n.setAttribute("aria-label","Edit engraving"),n.addEventListener("click",this.handleEdit.bind(this)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleEdit())}),p.appendChild(n)}return c.appendChild(l),c.appendChild(p),[o,c]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const n=this.getConfigs("global");return["custom-input","birthdate",n.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 n=this.params.value.split("-");3===n.length&&(this.yearInput.value=n[0],this.monthInput.value=n[1],this.dayInput.value=n[2])}}setupEventListeners(){this.monthInput.addEventListener("input",n=>{this.formatMonth(n),this.handleNavigation(n,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",n=>{this.formatDay(n),this.handleNavigation(n,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",n=>{this.formatYear(n),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 n=[this.monthInput,this.dayInput,this.yearInput];for(const i of n)i.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",n=>{"Backspace"===n.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",n=>{"Backspace"===n.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(n){const i=n.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const n=Number.parseInt(o,10);n>=2&&n<=9&&(o="0"+o)}else if(2===o.length){const n=Number.parseInt(o,10);n>12?o="12":n<1&&"00"!==o&&(o="01")}i.value=o}formatDay(n){const i=n.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const n=Number.parseInt(o,10);n>=4&&n<=9&&(o="0"+o)}else if(2===o.length){const n=Number.parseInt(o,10);n>31?o="31":n<1&&"00"!==o&&(o="01")}i.value=o}formatYear(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>4&&(o=o.substring(0,4)),i.value=o}padMonthOnBlur(){const n=this.monthInput.value;if(1===n.length){const i=Number.parseInt(n,10);if(i>=0&&i<=9&&(this.monthInput.value="0"+n,this.params.onChange)){const n=this.getFormattedValue();this.params.onChange(n)}}}padDayOnBlur(){const n=this.dayInput.value;if(1===n.length){const i=Number.parseInt(n,10);if(i>=0&&i<=9&&(this.dayInput.value="0"+n,this.params.onChange)){const n=this.getFormattedValue();this.params.onChange(n)}}}handleNavigation(n,i){const o=n.target,s=o===this.yearInput?4:2;o.value.length===s&&i&&i.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const n=this.getFormattedValue();this.params.onChange(n)}}isFieldsComplete(){const n=this.monthInput.value,i=this.dayInput.value,o=this.yearInput.value;return 2===n.length&&2===i.length&&4===o.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 n=this.monthInput.value.padStart(2,"0"),i=this.dayInput.value.padStart(2,"0"),o=this.yearInput.value;return n&&i&&o&&4===o.length?o+"-"+n+"-"+i:""}validateDate(n,i,o){if(!n||!i||!o||4!==o.length)return![];const s=Number.parseInt(n,10),a=Number.parseInt(i,10),c=Number.parseInt(o,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(n){const i=new Date;let o=i.getFullYear()-n.getFullYear();const s=i.getMonth()-n.getMonth();return(s<0||0===s&&i.getDate()<n.getDate())&&o--,o}validateInput(){const n=this.monthInput.value,i=this.dayInput.value,o=this.yearInput.value,s=[],a=this.params.validation;if(!a)return this.showErrors([]),!![];const c=2===n.length&&2===i.length&&4===o.length,l=n||i||o;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(n,i,o)){const c=Number.parseInt(n,10),l=Number.parseInt(i,10),p=Number.parseInt(o,10),m=new Date(p,c-1,l);if(void 0!==a.minYear&&p<a.minYear&&s.push("Year must be "+a.minYear+" or later"),void 0!==a.maxYear&&p>a.maxYear&&s.push("Year must be "+a.maxYear+" or earlier"),void 0!==a.minAge||void 0!==a.maxAge){const n=this.calculateAge(m);void 0!==a.minAge&&n<a.minAge&&s.push("Must be at least "+a.minAge+" years old"),void 0!==a.maxAge&&n>a.maxAge&&s.push("Must be no more than "+a.maxAge+" years old")}if(a.customValidator){const n=a.customValidator(this.getFormattedValue());n&&s.push(n)}}else s.push("Please enter a valid date");this.showErrors(s);const p=0===s.length;return this.params.onValidation&&this.params.onValidation(p,s),p}showErrors(n){this.errorContainer.innerHTML="";const i=[this.monthInput,this.dayInput,this.yearInput];if(n.length>0){this.errorContainer.classList.add("show");for(const n of i)n.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}else for(const o of i)o.classList.remove("input-error")}clearErrors(){const n=[this.monthInput,this.dayInput,this.yearInput],i=n.some(n=>n.classList.contains("input-error"));if(i){for(const i of n)i.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(n){if(n){const i=n.split("/");3===i.length&&(this.monthInput.value=i[0],this.dayInput.value=i[1],this.yearInput.value=i[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var n;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name+"-month"),i.push(o)}const o=document.createElement("div");o.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 p=document.createElement("input");p.type="text",p.placeholder="YYYY",p.name=this.params.name+"-year",p.id=this.params.name+"-year",p.maxLength=4,p.className="date-field year-field",p.setAttribute("data-field","year"),p.inputMode="numeric",this.params.disabled&&(s.disabled=!![],c.disabled=!![],p.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(s),o.appendChild(a),o.appendChild(c),o.appendChild(l),o.appendChild(p);const m=document.createElement("div");return m.className="error-container",i.push(o),i.push(m),i}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const n=this.getConfigs("global");return["custom-input",n.layout.inputFieldStyle]}handlePhoneKeydown(n){if("Backspace"===n.key){const i=n.target,o=i.selectionStart||0,s=i.value;o>0&&/\D/.test(s[o-1])&&setTimeout(()=>{const n=Math.max(0,o-2);i.setSelectionRange(n,n)},0)}}formatPhoneNumber(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),i.value=o}formatDate(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>8&&(o=o.substring(0,8)),o.length>=5?o=o.substring(0,2)+"/"+o.substring(2,4)+"/"+o.substring(4):o.length>=3&&(o=o.substring(0,2)+"/"+o.substring(2)),i.value=o}validateEmail(n){const i=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return i.test(n)}validateTel(n){const i=/^\(\d{3}\) \d{3}-\d{4}$/;return i.test(n)}validateDate(n){const i=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!i.test(n))return![];const[o,s,a]=n.split("/").map(Number),c=new Date(a,o-1,s);return c.getFullYear()===a&&c.getMonth()===o-1&&c.getDate()===s}isFieldComplete(){var n,i,o;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===(n=s.split("@")[1])||void 0===n?void 0:n.includes("."));case"number":return!Number.isNaN(Number.parseFloat(s));default:return(null===(i=this.params.validation)||void 0===i?void 0:i.max)&&s.length>=this.params.validation.max||(null===(o=this.params.validation)||void 0===o?void 0:o.min)&&s.length>=this.params.validation.min?!![]:s.length>=3}}validateInput(){const n=this.inputElement.value,i=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!n.trim()&&i.push("This field is required"),!o.required&&!n.trim())return this.showErrors([]),!![];if(n.trim()){if("email"!==this.params.inputType||this.validateEmail(n)||i.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(n)||i.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(n)||i.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const s=Number.parseFloat(n);Number.isNaN(s)?n.trim()&&i.push("Please enter a valid number"):(void 0!==o.min&&s<o.min&&i.push("Value must be at least "+o.min),void 0!==o.max&&s>o.max&&i.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&n.length<o.min&&i.push("Must be at least "+o.min+" characters"),void 0!==o.max&&n.length>o.max&&i.push("Must be no more than "+o.max+" characters")),o.pattern){const s=new RegExp(o.pattern);s.test(n)||i.push("Invalid format")}if(o.customValidator){const s=o.customValidator(n);s&&i.push(s)}}this.showErrors(i);const s=0===i.length;return this.params.onValidation&&this.params.onValidation(s,i),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(n){if(this.errorContainer.innerHTML="",n.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}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(n){this.inputElement.value=n,"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 n;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),i.push(o)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",n=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(n.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",i.push(this.inputElement),i.push(this.errorContainer),i}}class LceElementComponent extends HTMLElement{constructor(){super(),this.N=![],this.H=null;const n=ClientConfigService.getInstance();this.j=this.attachShadow({mode:n.get("openShadowDom")?"open":"closed"})}initialize(n,i){if(this.N)return;if(!n||"string"!=typeof n)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(i&&i instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(n.toLowerCase(),""),!this.j)throw new SDKError("LceElementComponent: Shadow DOM container is not available");i&&"function"==typeof i.rerender&&(this.H=n=>{i.rerender(n||"LceElementRerender")}),this.j.appendChild(i),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),s=o.getStylesheet(n);this.applyThemeStyles(s),this.N=!![],this.j=null}rerender(n){this.H&&this.H(n)}applyBasicStyles(){const n="\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 i=new CSSStyleSheet;i.replaceSync(n),this.j.adoptedStyleSheets=[i,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(n)}catch(ht){this.createFallbackStylesheet(n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}applyThemeStyles(n){n.forEach(n=>{"string"==typeof n?this.createFallbackStylesheet(n):this.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,n]})}createFallbackStylesheet(n){const i=document.createElement("style");i.textContent=n,this.j&&this.j.appendChild(i)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const n=document.createElement("div");n.className="pb-title-container";const i=document.createElement("span");i.className="pb-text",i.textContent="Powered by",n.appendChild(i);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",n.appendChild(o);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",n.appendChild(s),n}createDisclaimerSection(){const n=document.createElement("div");n.className="pb-disclaimer-container";const i=this.getDisclaimerConfig();return i.parts.forEach(i=>{"text"===i.type?n.appendChild(document.createTextNode(i.content)):"link"===i.type&&n.appendChild(this.createLink(i.href,i.text))}),n}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(n,i){const o=document.createElement("a");return o.href=n,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=i,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+i),o}template(){const n=this.createPoweredBySection(),i=this.createDisclaimerSection();return[n,i]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(n){const i=n.find(n=>"cart.promoCode"===n.path||"checkout.promoCode"===n.path);if(!i||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(n){const i=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==i?void 0:i.code)===n||(null==o?void 0:o.code)===n}getActiveTickers(){var n;const i=this.store.get("address");return null===(n=this.params.tickers)||void 0===n?void 0:n.filter(n=>{var o;return isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:null===(o=null==i?void 0:i.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(n){return 0===n.length?null:n[0]}generateTextContent(n){const i=document.createElement("div");i.classList.add("promo-ticker__text-group");const o=n.text.map(n=>n.trim()).map(n=>n.substring(0,50)).filter(n=>""!==n.trim()).slice(0,5);for(const s of o){const o=s.trim();if(!o)continue;const a=document.createElement("span");a.classList.add("promo-ticker__text-item"),a.textContent=o,i.appendChild(a);const c=document.createElement("span");c.classList.add("promo-ticker__separator"),c.textContent=n.separator,i.appendChild(c)}return i}async handlePromoClick(){var n;(null===(n=this.currentActiveTicker)||void 0===n?void 0:n.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 n=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(n),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const i=document.createElement("div");i.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let a=0;a<5;a++)o.appendChild(this.generateTextContent(this.currentActiveTicker));i.appendChild(o);const 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",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handlePromoClick())}),this.applyButton=s,[i,s]}}const Ot=LoggerFactory.get("ElementsClientHelper"),isObject=n=>null!==n&&"object"==typeof n&&!Array.isArray(n),getType=n=>null===n?"null":Array.isArray(n)?"array":typeof n;function deepMergeConfigs(n,i){if(!n||!i)return n;const o={...n},s=[];for(const a in i){const c=i[a],l=o[a];if(!(a in n)){s.push('Property "'+a+'" does not exist in target schema, skipping merge.');continue}const p=getType(c),m=getType(l);p===m?isObject(c)&&isObject(l)?o[a]=deepMergeConfigs(l,c):o[a]=c:s.push('Type mismatch for key "'+a+'": source is '+p+", target is "+m+". Skipping merge.")}return s.length>0&&Ot.warn("Merging configurations with warnings:",s),o}const Lt=new Map([["global.layout.enablePersonalization",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.PRODUCT_INTERACTIONS,w.CART_ITEM,w.CHECKOUT_ITEM]],["global.layout.personalizationText",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.CART_ITEM]],["global.layout.personalizationCardStyle",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[w.CART,w.CART_PROMO_CODE,w.CART_FOOTER,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[w.CART,w.CHECKOUT,w.ADDRESS,w.INPUT,w.BIRTHDATE_INPUT,w.ADDRESS_INPUT,w.CHECKOUT_DELIVER_TO,w.CHECKOUT_BUYER,w.CHECKOUT_BILLING,w.CHECKOUT_PAYMENT,w.CART_PROMO_CODE]],["global.layout.showPoweredBy",[w.CART,w.CHECKOUT,w.CHECKOUT_COMPLETED,w.POWERED_BY,w.CART_FOOTER,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[w.POWERED_BY]],["product.layout.showImages",[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[w.PRODUCT]],["product.layout.showDescription",[w.PRODUCT,w.PRODUCT_DESCRIPTION,w.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL,w.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION,w.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION,w.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[w.PRODUCT,w.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[w.CART,w.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[w.CART,w.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[w.CART,w.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[w.CART,w.CART_FOOTER]],["checkout.layout.emailOptIn",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[w.CHECKOUT,w.CHECKOUT_GIFT_CARDS,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[w.CHECKOUT,w.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[w.CHECKOUT,w.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[w.CHECKOUT,w.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[w.CHECKOUT,w.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[w.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(n,i){const o=new Set;for(const s of Object.keys(i)){const i=Lt.get(n+"."+s);if(i)for(const n of i)o.add(n)}return Array.from(o)}class ElementsBaseClient{constructor(n){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:n.apiKey,env:n.env,baseUrl:n.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(n){throw this.logger.error("Failed to prepare client",n),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),n}}async prepareEssentialServices(){this.clientConfig.set("version",ht.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...");const n=await this.authClient.authenticate();if(!n)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let i=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",i.configurations.partnerCode),this.clientConfig.set("partnerName",i.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const o=await this.fingerPrintService.getId(i.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",o),this.clientConfig.set("isLocalStorageAvailable",s);const a=s?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:s,persistedStore:a}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const n=this.clientConfig.get("customTheme"),o=i.global.layout.showPoweredBy;i=deepMergeConfigs(i,n),i.global.layout.showPoweredBy=o}await this.themeProvider.initialize(i),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(n){this.logger.error("Heavy initialization failed",n)}},0)}async initializeHeavyServices(){const n=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:n.partnerName,enablePartnerGTM:n.enablePartnerGTM,partnerGTMId:n.partnerGTMId||void 0,enableLiquidCommerceGTM:n.enableLiquidCommerceGTM,liquidCommerceGTMId:n.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(n){if(this.ensureAllComponentsRegistered(),!n||"object"!=typeof n)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof n,!![]);const{type:i,containerId:o,...s}=n;if(!o||"string"!=typeof o)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof o?'"'+o+'"':o),!![]);if(!i)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const a=o.replace("#",""),c=document.getElementById(a);if(!c)return console.warn("Container with ID '"+a+"' not found"),null;c.innerHTML="";const l={type:n.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...s},p=ComponentFactoryService.createElement(l);return safeReplaceChildren(c,p),n.type===w.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(a,n.type,p)}async processInjectProduct(n){if(this.ensureAllComponentsRegistered(),0===n.length)throw new SDKError("At least one product is required. Received empty array.",!![]);n.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const i=n.slice(0,20),o=[],s=[];for(const a of i){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 n=a.containerId.replace("#","").trim();if(!n){this.logger.warn("Container ID is required for product with ID '"+a.identifier+"'");continue}const i=document.getElementById(n);if(!i){this.logger.warn("Container with ID '"+n+"' not found for product '"+a.identifier+"'");continue}const s=o.every(i=>i.containerId!==n);if(!s){this.logger.warn("Duplicate container ID '"+n+"' 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 '"+n+"'");continue}const c=o.every(n=>n.identifier!==a.identifier);c?o.push({containerId:n,identifier:a.identifier}):this.logger.warn("Duplicate product identifier '"+a.identifier+"' found, skipping")}for(const a of o){const n=ComponentFactoryService.createElement({type:w.PRODUCT,useShadowDom:!![],productId:a.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(a.containerId);i?(i.innerHTML="",i.appendChild(n),s.push(this.createInjectedComponentWrapper(a.containerId,w.PRODUCT,n)),await this.commands.product.createProductInstance(a.identifier,!![])):this.logger.warn("Product ("+a.identifier+") container with ID '"+a.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(o.map(n=>n.identifier)),s}async injectProductList(n){if(!this.isElementsEnabled())return this.injectDisabledElementsError(n.containerId,w.CHECKOUT),void 0;if(!n)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!n.containerId||"string"!=typeof n.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof n.containerId?'"'+n.containerId+'"':n.containerId),!![]);if(n.rows&&("number"!=typeof n.rows||n.rows<1||n.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+n.rows,!![]);if(n.columns&&("number"!=typeof n.columns||n.columns<1||n.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+n.columns,!![]);if(n.cardVariant&&!Object.values(I).includes(n.cardVariant))throw new SDKError('Invalid card variant "'+n.cardVariant+'". Valid options: '+Object.values(I).join(", "),!![]);if(n.filters&&!Array.isArray(n.filters))throw new SDKError("Filters must be an array. Received: "+typeof n.filters,!![]);if(n.filters&&n.filters.length>0){const i=Object.values(T);for(const o of n.filters)if(!i.includes(o))throw new SDKError('Invalid filter "'+o+'". Valid options: '+i.join(", "),!![])}if(n.productUrl&&"string"==typeof n.productUrl&&!n.productUrl.includes("{upc}")&&!n.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+n.productUrl+'"',!![]);const i=document.getElementById(n.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+n.containerId+'". Make sure the element exists before adding the product list.',!![]);const o=ComponentFactoryService.createElement({type:w.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:n.cardVariant||I.STANDARD,fillCard:n.fillCard||![],rows:n.rows||4,columns:n.columns||4,filters:n.filters||[],productUrl:n.productUrl});safeReplaceChildren(i,o)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const n=ComponentFactoryService.createElement({type:w.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(n),this.cartDrawerCreated=!![]}catch(n){this.logger.warn("Failed to create cart drawer:",n)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(n,i,o){const s={getType:()=>i,getElement:()=>document.getElementById(n),rerender:()=>{try{o&&"function"==typeof o.rerender?o.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+n+"' does not support rerender")}catch(i){this.logger.warn("Failed to rerender component in container '"+n+"'")}}};return this.injectedComponents.set(n,s),s}rerenderInjectedComponentsByType(n){for(const[i,o]of this.injectedComponents)o.getType()===n&&o.rerender()}isElementsEnabled(){var n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",i),!![]}}injectDisabledElementsError(n,i){const o=document.getElementById(n.replace("#",""));if(!o)return this.logger.warn("Container with ID '"+n+"' 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:i}):componentError({message:"Elements is not enabled.",componentType:i}),o.innerHTML="",safeReplaceChildren(o,s)}registerEssentialComponents(){ComponentFactoryService.registerComponent(w.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(w.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(w.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(w.CART,AddressInputComponent),ComponentFactoryService.registerComponent(w.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(w.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(w.INPUT,InputComponent),ComponentFactoryService.registerComponent(w.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(w.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(w.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(w.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(w.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(w.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(w.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(w.ALERT,AlertComponent),ComponentFactoryService.registerComponent(w.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(w.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(w.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(w.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(w.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(w.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(w.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(w.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(w.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(w.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(w.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(w.CART,CartComponent),ComponentFactoryService.registerComponent(w.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(w.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(w.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(w.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(w.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(w.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(w.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(w.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(w.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(w.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(w.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(n,i)=>{if(!n||"string"!=typeof n)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);this.ensureCartDrawerExists();const o=document.getElementById(n.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before adding the cart button.',!![]);const s=ComponentFactoryService.createElement({type:w.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});o.innerHTML="",safeReplaceChildren(o,s)},floatingCartButton:n=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:w.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:n});document.body.appendChild(i)},cartSubtotal:n=>{if(!n||"string"!=typeof n)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);const i=document.getElementById(n.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before displaying cart subtotal.',!![]);i.innerHTML="",i.classList.add("lce-cart-subtotal");const U=n=>{i.textContent=formatCentToDollarText(n)},o=this.store.get("cart.totals.subtotal")||0;U(o),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.subtotal")||0;U(n)})},cartItemsCount:(n,i)=>{if(!n||"string"!=typeof n)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);let o=!![];i&&"boolean"==typeof i.hideZero&&(o=i.hideZero);const s=document.getElementById(n.replace("#",""));if(!s)throw new SDKError('Cannot find element with ID "'+n+'". Make sure the element exists before displaying cart items count.',!![]);s.innerHTML="",s.classList.add("lce-cart-items-count");const J=n=>{s.textContent=n.toString(),0===n?(o&&(s.style.visibility="hidden"),s.classList.add("no-items")):(o&&(s.style.visibility="visible"),s.classList.remove("no-items"))},a=this.store.get("cart.totals.quantity")||0;J(a),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.quantity")||0;J(n)})}}}async injectProductElement(n){if(!Array.isArray(n))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof n,!![]);if(!this.isElementsEnabled()){for(const i of n)this.injectDisabledElementsError(i.containerId,w.PRODUCT);return[]}return await this.processInjectProduct(n)}async injectAddressElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:w.ADDRESS,containerId:n,options:i}):(this.injectDisabledElementsError(n,w.ADDRESS),null)}async injectCartElement(n){if(!n||"string"!=typeof n)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:w.CART,containerId:n}):(this.injectDisabledElementsError(n,w.CART),null)}async injectCheckoutElement(n){if(!n||"string"!=typeof n)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:w.CHECKOUT,containerId:n}):(this.injectDisabledElementsError(n,w.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(n,i){try{SingletonManager.setContext({isBuilder:![]});const o=ClientConfigService.getInstance();o.initialize(n,{env:i.env,isBuilder:![],debugMode:i.debugMode,customTheme:i.customTheme,promoTicker:i.promoTicker,proxy:i.proxy,development:i.development});const s=o.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const c={injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),ui:a.ui,actions:a.actions,getInjectedComponents:a.getInjectedComponents.bind(a)};window.elements=c;const l=PubSubService.getInstance();return l.publishAction(y.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const n=LoggerFactory.get("ElementsClientInit");n.error("Elements Client Initialization failed",o)}catch(s){console.error("[LiquidCommerce Elements] Client initialization failed:",null==o?void 0:o.message)}try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(y.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const zt={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"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(n){return null!==n&&"lce_"===n.substring(0,4)}function generateElementId({prefix:n,index:i}){const o=Math.random().toString(36).substring(2,7),s=void 0!==n?n:"",a=void 0!==i?i:"",c=s&&a?"-":"";return""+s+c+a+o}function pairsFromMainScript(n){const i=[];try{const s=n.getAttributeNames().filter(n=>n.substring(0,12)===zt.PRODUCT.PRODUCT);for(const a of s)try{const o=a.match(/^data-product(-(.+))?$/),s=(null==o?void 0:o[2])?"-"+o[2]:"",c=""+zt.PRODUCT.CONTAINER+s;if(n.hasAttribute(c)){const o=n.getAttribute(c),s=n.getAttribute(a);o&&s&&i.push({containerId:o,identifier:s})}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return i}function pairsFromProductsScript(){const n=[];try{const o=document.querySelectorAll("script["+zt.PRODUCT_LIST.SCRIPT+"]");for(const s of o)try{const i=JSON.parse(s.textContent||"[]");if(!Array.isArray(i))continue;for(const o of i)o.containerId&&o.identifier&&n.push({containerId:o.containerId,identifier:o.identifier})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",o)}return n}function pairsFromAttributedElements(){const n=[];try{const o=document.querySelectorAll("div["+zt.PRODUCT.LCE_PRODUCT+"]");let s=0;for(const a of o)try{const i=generateElementId({prefix:"lce-p",index:s});a.setAttribute("id",i);const o=a.getAttribute(zt.PRODUCT.LCE_PRODUCT);i&&o&&n.push({containerId:i,identifier:o}),s+=1}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",o)}return n}async function addProductToCartViaQueryParam(n,i){try{const s=i.getAttribute(zt.PRODUCT.PARAM),a=i.getAttribute(zt.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 c=new URLSearchParams(window.location.search),l=c.get(s);if(!l)return;let p=C.SHIPPING;if(a)if(startsWithLcePrefix(a)){const n=c.get(a);n!==C.ON_DEMAND&&n!==C.SHIPPING||(p=n)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+a+'" because it does not start with "lce_" prefix.');try{await n.actions.cart.addProduct([{identifier:l,fulfillmentType:p,quantity:1}],!![])}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",s)}}async function addPromoCodeToCartViaQueryParam(n,i){try{const s=i.getAttribute(zt.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 n.actions.cart.applyPromoCode(c)}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",s)}}async function setupCartButtonWithPosition(n,i,o,s){var a,c,l;try{const p=o.includes("mobile"),m=p?"mobile":"desktop",f=!p,g=i.getAttribute(o),v=i.getAttribute(s);if(!i.hasAttribute(o)&&!i.hasAttribute(s))return;if(f){if(i.hasAttribute(o)&&!g)return n.ui.floatingCartButton(![]),void 0;if(i.hasAttribute(s)&&!v)return n.ui.floatingCartButton(!![]),void 0}const y=g||v,b=!!v;if(!y)return f&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),n.ui.floatingCartButton(b)),void 0;const w=["above","below","replace","inside"],C=y.match(/^(\w+):(.+)$/),k=C&&w.includes(C[1])?C[1]:"inside";let S=C?C[2]:y;/^[#.]/.test(S)||/\s/.test(S)||(S="#"+S);const I=document.querySelector(S);if(!I)return f&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+S+'" not found. Using floating button.'),n.ui.floatingCartButton(b)),void 0;const T=document.createElement("div");switch(T.classList.add("lce-cart-"+m+"-button-container"),T.id=generateElementId({prefix:"lce-cart-"+m+"-btn"}),k){case"above":null===(a=I.parentNode)||void 0===a?void 0:a.insertBefore(T,I);break;case"below":null===(c=I.parentNode)||void 0===c?void 0:c.insertBefore(T,I.nextSibling);break;case"replace":null===(l=I.parentNode)||void 0===l?void 0:l.replaceChild(T,I);break;default:I.appendChild(T)}n.ui.cartButton(T.id,b)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",p)}}async function setupCartButtons(n,i){i.hasAttribute(zt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(n,i,zt.CART.BUTTON,zt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(n,i,zt.CART.MOBILE_BUTTON,zt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(n){try{const i=document.querySelector("div["+zt.PRODUCT_LIST.LIST+"]");if(!i)return;const o="lce-products-list-container";i.className="lce-products-list-container",i.id=o;const s=i.getAttribute(zt.PRODUCT_LIST.CARD)||"standard",a=i.hasAttribute(zt.PRODUCT_LIST.CARD_FILL),c=Number.parseInt(i.getAttribute(zt.PRODUCT_LIST.ROWS)||"3",10)||3,l=Number.parseInt(i.getAttribute(zt.PRODUCT_LIST.COLUMNS)||"4",10)||4,p=i.getAttribute(zt.PRODUCT_LIST.FILTERS),m=i.getAttribute(zt.PRODUCT_LIST.PRODUCT_URL)||void 0;let f=[];p&&(f=p.split(",").map(n=>n.trim()).filter(n=>n.length>0)),await n.injectProductList({containerId:o,rows:c,columns:l,cardVariant:s,fillCard:a,filters:f,productUrl:m})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",i)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async n=>{const i=n.detail;if(!i.data.isReady)return;const o=window.elements,s=document.querySelectorAll("["+zt.CART.TOGGLE_BUTTON+"]");if(s.length>0)for(const c of s)c.addEventListener("click",async n=>{n.stopPropagation(),n.preventDefault(),o.actions.cart.toggleCart()});const a=document.querySelectorAll("["+zt.CART.ITEMS_COUNT+"]");if(a.length>0){let n=0;for(const i of a){const s=i.getAttribute(zt.CART.ITEMS_COUNT),a=!(s&&"keep-zero"===s),c=Boolean(null==i?void 0:i.id);let l;c?l=i.id:(l=generateElementId({prefix:"lce-cart-items-count",index:n}),i.id=l),o.ui.cartItemsCount(l,{hideZero:a}),n+=1}}})}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",ht)}}function getDevelopmentConfigs(){const n=document.querySelector("script["+zt.DEVELOPMENT+"]");if(n)try{return JSON.parse(n.textContent||"{}")}catch(i){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",i),void 0}}async function ElementsAutoInitialize(){var n,i,o,s,a,c;try{const c=document.querySelector("script["+zt.CORE.MAIN_SCRIPT+"]");if(!c)return;const l=c.getAttribute(zt.CORE.TOKEN),p=c.getAttribute(zt.CORE.ENV)||v.PRODUCTION,m=c.getAttribute(zt.CORE.DEBUG_MODE);if(!l)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const f=c.getAttribute(zt.PROMO_TICKER.CODE),g=c.getAttribute(zt.PROMO_TICKER.TEXT),y=null!==(n=c.getAttribute(zt.PROMO_TICKER.SEPARATOR))&&void 0!==n?n:"•",b=null!==(i=c.getAttribute(zt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==i?i:void 0,w=null!==(o=c.getAttribute(zt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==o?o:void 0,C=pairsFromMainScript(c),S=pairsFromProductsScript(),I=pairsFromAttributedElements(),T=[...C,...S,...I],D=f&&g&&b&&w?{promoCode:f,text:g.split("|").map(n=>n.trim()).filter(n=>n.length>0),separator:y,activeFrom:null===(s=new Date(b))||void 0===s?void 0:s.toISOString(),activeUntil:null===(a=new Date(w))||void 0===a?void 0:a.toISOString()}:void 0;let A=k.NONE;m&&p!==v.PRODUCTION&&(A=m),setupEventListeners();const P=await Elements(l,{env:p,debugMode:A,promoTicker:D?[D]:void 0,development:getDevelopmentConfigs()});if(!P)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(P,c),0!==T.length&&P.injectProductElement(T).catch(n=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",n)}),initializeProductsList(P),addProductToCartViaQueryParam(P,c),addPromoCodeToCartViaQueryParam(P,c)}catch(l){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(c=null==l?void 0:l.message)&&void 0!==c?c:String(l))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ht)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ht)}},50)}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",ht)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(n){try{if(!n)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(n),n.layout&&Object.keys(n.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("global.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(i){throw this.logger.error("❌ Failed to update global theme configuration",i),new SDKError("Failed to update global configuration: "+i.message,!![])}}async updateProductComponent(n){try{if(!n)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(n),n.layout&&Object.keys(n.layout).length>0){await this.commands.product.rerenderAllProducts();for(const i of getComponentTypesForLayoutFields("product.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(i){throw this.logger.error("❌ Failed to update product component theme",i),new SDKError("Failed to update product configuration: "+i.message,!![])}}updateCartComponent(n){try{if(!n)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(n),n.layout&&Object.keys(n.layout).length>0){this.commands.cart.rerenderCart();for(const i of getComponentTypesForLayoutFields("cart.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(i){throw this.logger.error("❌ Failed to update cart component theme",i),new SDKError("Failed to update cart configuration: "+i.message,!![])}}updateCheckoutComponent(n){try{if(!n)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(n),n.layout&&Object.keys(n.layout).length>0){this.commands.checkout.rerenderCheckout();for(const i of getComponentTypesForLayoutFields("checkout.layout",n.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(i){throw this.logger.error("❌ Failed to update checkout component theme",i),new SDKError("Failed to update checkout configuration: "+i.message,!![])}}updateAddressComponent(n){try{if(!n)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(n),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(i){throw this.logger.error("❌ Failed to update address component theme",i),new SDKError("Failed to update address configuration: "+i.message,!![])}}async injectElement(n){if(!n)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!n.containerId||"string"!=typeof n.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n.containerId?'"'+n.containerId+'"':n.containerId),!![]);if(!n.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(n)}async injectProductElement(n){if(!Array.isArray(n))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof n,!![]);return await this.processInjectProduct(n)}async injectAddressElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return await this.processInjectElement({type:w.ADDRESS,containerId:n,options:i})}async injectCartElement(n){if(!n||"string"!=typeof n)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);return await this.processInjectElement({type:w.CART,containerId:n})}async injectCheckoutElement(n,i){if(!n||"string"!=typeof n)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);const o=await this.processInjectElement({type:w.CHECKOUT,containerId:n});if(null==i?void 0:i.simulatePresale){const n=i.presaleExpiresInMinutes||15,o=new Date;o.setMinutes(o.getMinutes()+n),this.store.set("checkout.presale",{isLocked:!![],expiresAt:o.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+n+" minutes")}return o}}async function ElementsBuilder(n,i){try{SingletonManager.setContext({isBuilder:!![]});const o=ClientConfigService.getInstance();o.initialize(n,{env:i.env,isBuilder:!![],debugMode:i.debugMode,customTheme:i.customTheme,promoTicker:i.promoTicker,proxy:void 0,development:void 0});const s=o.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const c={updateComponentGlobalConfigs:a.updateComponentGlobalConfigs.bind(a),updateProductComponent:a.updateProductComponent.bind(a),updateAddressComponent:a.updateAddressComponent.bind(a),updateCartComponent:a.updateCartComponent.bind(a),updateCheckoutComponent:a.updateCheckoutComponent.bind(a),injectElement:a.injectElement.bind(a),injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),injectProductList:a.injectProductList.bind(a),actions:a.actions};window.elementsBuilder=c;const l=PubSubService.getInstance();return l.publishAction(y.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const n=LoggerFactory.get("ElementsBuilderClientInit");n.error("Elements Builder Client Initialization failed",o)}catch(s){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==o?void 0:o.message)}try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(y.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const n=window.onerror;window.onerror=(i,o,s,a,c)=>isSDKError(c,o)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:i,source:o,lineno:s,colno:a,error:c}),!![]):n?n(i,o,s,a,c):![];const i=window.onunhandledrejection;window.onunhandledrejection=n=>{if(n.reason&&isSDKError(n.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",n.reason),n.preventDefault(),void 0;i&&i.call(window,n)};try{initializeDOMPolyfills()}catch(Mt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Mt)}try{triggerElementsAutoInit()}catch(Bt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Bt)}}catch(Wt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Wt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|