{"version":3,"file":"Store.BENbe67h.mjs","names":[],"sources":["https:/framerusercontent.com/modules/p12pUA3qWoexEzDLFD9n/LFqlukfFvMPFGJ4XPBnK/Store.js"],"sourcesContent":["import{createStore,createStorePersist}from\"https://framerusercontent.com/modules/ecmnSddXBJpQsAujxCSQ/2zMFA9EQryEKkWl3wsPK/State.js\";export const useCart=createStorePersist({items:[],subTotal:0,total:0},\"cart\");export const useAddress=createStorePersist({billingFirstName:\"\",billingLastName:\"\",billingEmail:\"\",billingPhone:\"\",billingAddress1:\"\",billingAddress2:\"\",billingCity:\"\",billingState:\"\",billingPostalCode:\"\",billingCountry:\"\",billingCompany:\"\",shippingFirstName:\"\",shippingLastName:\"\",shippingEmail:\"\",shippingPhone:\"\",shippingAddress1:\"\",shippingAddress2:\"\",shippingCity:\"\",shippingState:\"\",shippingPostalCode:\"\",shippingCountry:\"\",shippingCompany:\"\",notes:\"\",sameShippingInfo:false},\"adress\");export const useLoading=createStore({isLoadingCart:false,isLoadingCheckout:false});export const addProductFromCart=(product,products)=>{// Verifica si ya existe el mismo producto con la misma variante (o sin variante)\nconst existingProduct=products.find(item=>{const sameProduct=item.id===product.id;const sameVariant=item.variantIndex!==undefined&&product.variantIndex!==undefined&&item.variantIndex===product.variantIndex;const noVariant=item.variantIndex===undefined&&product.variantIndex===undefined;return sameProduct&&(sameVariant||noVariant);});if(existingProduct){// Sumar cantidad al producto existente\nreturn products.map(item=>item===existingProduct?{...item,quantity:item.quantity+product.quantity}:item);}// Si no existe ese producto (o variante), agregarlo como nuevo\nreturn[...products,product];};export const removeProductFromCart=(index,products)=>{return products.filter((_,i)=>i!==index);};\nexport const __FramerMetadata__ = {\"exports\":{\"removeProductFromCart\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useAddress\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCart\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useLoading\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"addProductFromCart\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Store.map"],"mappings":"iLAAqI,CAAa,EAAQ,EAAmB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,OAAO,CAAc,EAAW,EAAmB,CAAC,iBAAiB,GAAG,gBAAgB,GAAG,aAAa,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,YAAY,GAAG,aAAa,GAAG,kBAAkB,GAAG,eAAe,GAAG,eAAe,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,cAAc,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,aAAa,GAAG,cAAc,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAM,CAAC,SAAS,CAAc,EAAW,EAAY,CAAC,cAAc,GAAM,kBAAkB,GAAM,CAAC,CAAc,GAAoB,EAAQ,IAAW,CACt0B,IAAM,EAAgB,EAAS,KAAK,GAAM,CAAC,IAAM,EAAY,EAAK,KAAK,EAAQ,GAAS,EAAY,EAAK,eAAe,IAAA,IAAW,EAAQ,eAAe,IAAA,IAAW,EAAK,eAAe,EAAQ,aAAmB,EAAU,EAAK,eAAe,IAAA,IAAW,EAAQ,eAAe,IAAA,GAAU,OAAO,IAAc,GAAa,IAAa,CAE7U,OAFiV,EAC1U,EAAS,IAAI,GAAM,IAAO,EAAgB,CAAC,GAAG,EAAK,SAAS,EAAK,SAAS,EAAQ,SAAS,CAAC,EAAK,CAClG,CAAC,GAAG,EAAS,EAAQ,EAAgB,GAAuB,EAAM,IAAmB,EAAS,QAAQ,EAAE,IAAI,IAAI,EAAM"}