{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Be5mN5EUhdOwl54qCG8y/Icj1ZU450uFtWcyrdGTm/CartItemContext.js", "ssg:https://framerusercontent.com/modules/LrldJJ60fjHs91m6XdHT/2FUoEFQ8UfRjbsZiejBU/SharedStore.js", "ssg:https://framerusercontent.com/modules/ajKYBgRXgNyNgL1GkpqG/prknJU66nI5iRE43ff6z/ProductState.js"],
  "sourcesContent": ["import{createContext,useContext}from\"react\";export const CartItemContext=/*#__PURE__*/createContext({inCart:false,cartItemId:null,shopifyId:null,variantId:null,quantity:1,price:null,compareAtPrice:null,sku:null,barcode:null,variant:null});export const useCartItem=()=>useContext(CartItemContext);\nexport const __FramerMetadata__ = {\"exports\":{\"useCartItem\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CartItemContext\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CartItemContext.map", "import create from\"zustand\";const WINDOW_STORES_KEY=\"__frameship_stores__\";// Initialize the shared stores object if it doesn't exist\nconst initializeStores=()=>{if(typeof window!==\"undefined\"&&!window[WINDOW_STORES_KEY]){window[WINDOW_STORES_KEY]={};}};// Call initialization on client side\nif(typeof window!==\"undefined\"){initializeStores();}/**\n * Creates a shared Zustand store that can be accessed across different instances\n * @param id - Unique identifier for the store\n * @param config - Configuration object containing version, state creator, and optional migrator\n * @returns A Zustand store that is shared across instances with the same id\n */export function createSharedStore(id,config){const{version,createState,migrateState}=config;// Return a dummy store during SSR\nif(typeof window===\"undefined\"){return create(createState);}// Ensure stores are initialized\ninitializeStores();const existingStore=window[WINDOW_STORES_KEY][id];// If the store exists and has a higher or equal version, return it\nif(existingStore&&existingStore.version>=version){return existingStore.store;}// Create a new store\nconst store=create(createState);// If there's an existing store, migrate the state using either the provided migrator or the default one\nif(existingStore){const currentState=existingStore.store.getState();const migratedState=migrateState?migrateState(currentState):defaultMigrateState(currentState);store.setState(migratedState);}// Store the new version and store\nwindow[WINDOW_STORES_KEY][id]={store,version};return store;}/**\n * Gets an existing shared store by its ID\n * @param id - The ID of the store to retrieve\n * @returns The store if it exists, undefined otherwise\n */export function getSharedStore(id){if(typeof window===\"undefined\")return undefined;// Ensure stores are initialized\ninitializeStores();return window[WINDOW_STORES_KEY][id]?.store;}/**\n * Gets the version of a shared store by its ID\n * @param id - The ID of the store to check\n * @returns The version number if the store exists, undefined otherwise\n */export function getSharedStoreVersion(id){if(typeof window===\"undefined\")return undefined;// Ensure stores are initialized\ninitializeStores();return window[WINDOW_STORES_KEY][id]?.version;}/**\n * Default migration function that copies all non-function properties from the old state\n */function defaultMigrateState(oldState){const newState={};for(const key in oldState){if(typeof oldState[key]!==\"function\"){newState[key]=oldState[key];}}return newState;}\nexport const __FramerMetadata__ = {\"exports\":{\"getSharedStoreVersion\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createSharedStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getSharedStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SharedStore.map", "import{useMemo}from\"react\";import{createSharedStore}from\"https://framerusercontent.com/modules/LrldJJ60fjHs91m6XdHT/2FUoEFQ8UfRjbsZiejBU/SharedStore.js\";import{parseShopifyData}from\"https://framerusercontent.com/modules/gd3dcT3w5rYoRy7ZcKte/sH6FZizM8jJ11j2dQOhQ/Shared.js\";export const useProductStore=createSharedStore(\"product-store\",{version:1,createState:set=>({products:{},setSelectedVariantOption:(productId,variantOption,option)=>set(state=>({products:{...state.products,[productId]:{...state.products[productId],selectedVariantOptions:{...state.products[productId]?.selectedVariantOptions,[variantOption]:option}}}})),setQuantity:(productId,quantity)=>{set(state=>({products:{...state.products,[productId]:{...state.products?.[productId],quantity:Math.max(quantity,1)}}}));}}),migrateState:oldState=>{return{products:oldState.products};}});export function useSelectedVariant(shopifyData){const parsedData=useMemo(()=>parseShopifyData(shopifyData),[shopifyData]);const{shopifyId,variants}=parsedData;const selectedVariantOptions=useProductStore(state=>state.products[shopifyId]?.selectedVariantOptions);const selectedVariant=useMemo(()=>{if(!Array.isArray(variants)||!selectedVariantOptions){return variants[0];}for(const variant of variants){if(variant.selectedOptions.every(option=>selectedVariantOptions[option.name]===option.value)){return variant;}}return variants[0];},[variants,selectedVariantOptions]);return selectedVariant;}\nexport const __FramerMetadata__ = {\"exports\":{\"useSelectedVariant\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useProductStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],
  "mappings": "gJAAmD,IAAMA,EAA6BC,EAAc,CAAC,OAAO,GAAM,WAAW,KAAK,UAAU,KAAK,UAAU,KAAK,SAAS,EAAE,MAAM,KAAK,eAAe,KAAK,IAAI,KAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC,EAAeC,EAAY,IAAIC,EAAWH,CAAe,ECA1Q,IAAMI,EAAkB,uBAC9CC,EAAiB,IAAI,CAAI,OAAOC,EAAS,KAAa,CAACA,EAAOF,CAAiB,IAAGE,EAAOF,CAAiB,EAAE,CAAC,EAAG,EACnH,OAAOE,EAAS,KAAaD,EAAiB,EAKvC,SAASE,EAAkBC,EAAGC,EAAO,CAAC,GAAK,CAAC,QAAAC,EAAQ,YAAAC,EAAY,aAAAC,CAAY,EAAEH,EACxF,GAAG,OAAOH,EAAS,IAAa,OAAOO,EAAOF,CAAW,EACzDN,EAAiB,EAAE,IAAMS,EAAcR,EAAOF,CAAiB,EAAEI,CAAE,EACnE,GAAGM,GAAeA,EAAc,SAASJ,EAAS,OAAOI,EAAc,MACvE,IAAMC,EAAMF,EAAOF,CAAW,EAC9B,GAAGG,EAAc,CAAC,IAAME,EAAaF,EAAc,MAAM,SAAS,EAAQG,EAAcL,EAA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OAAOD,EAAS,CAAC,EAAG,QAAUE,KAAWF,EAAU,GAAGE,EAAQ,gBAAgB,MAAMZ,GAAQW,EAAuBX,EAAO,IAAI,IAAIA,EAAO,KAAK,EAAG,OAAOY,EAAU,OAAOF,EAAS,CAAC,CAAE,EAAE,CAACA,EAASC,CAAsB,CAAC,CAAyB",
  "names": ["CartItemContext", "z", "useCartItem", "re", "WINDOW_STORES_KEY", "initializeStores", "window", "createSharedStore", "id", "config", "version", "createState", "migrateState", "create", "existingStore", "store", "currentState", "migratedState", "defaultMigrateState", "defaultMigrateState", "oldState", "newState", "key", "useProductStore", "createSharedStore", "set", "productId", "variantOption", "option", "state", "quantity", "oldState", "useSelectedVariant", "shopifyData", "parsedData", "se", "parseShopifyData", "shopifyId", "variants", "selectedVariantOptions", "variant"]
}
