{"version":3,"file":"CurrencyComponents.CwtrbAw9.mjs","names":["useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/KxITTjZUaFWcA0wUnxlx/Eqr0zH1kP7PHBbGCTf0S/CurrencyComponents.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const STORAGE_KEY=\"quicazaque:currency\";const EVENT_NAME=\"quicazaque:currency-change\";function normalizeCurrency(value){return value===\"USD\"?\"USD\":\"COP\";}function readCurrency(){if(typeof window===\"undefined\")return\"COP\";return normalizeCurrency(window.localStorage.getItem(STORAGE_KEY));}function persistAndBroadcast(currency){if(typeof window===\"undefined\")return;window.localStorage.setItem(STORAGE_KEY,currency);window.dispatchEvent(new CustomEvent(EVENT_NAME,{detail:{currency}}));}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CurrencySelector(props){const{surfaceColor,textColor,activeColor,borderColor,cornerRadius,fontSize,padding}=props;const[currency,setCurrency]=useState(\"COP\");useEffect(()=>{setCurrency(readCurrency());if(typeof window===\"undefined\")return;const onCustom=event=>{const next=normalizeCurrency(event.detail?.currency);setCurrency(next);};const onStorage=event=>{if(event.key!==STORAGE_KEY)return;setCurrency(normalizeCurrency(event.newValue));};window.addEventListener(EVENT_NAME,onCustom);window.addEventListener(\"storage\",onStorage);return()=>{window.removeEventListener(EVENT_NAME,onCustom);window.removeEventListener(\"storage\",onStorage);};},[]);const selectCurrency=useCallback(next=>{setCurrency(next);persistAndBroadcast(next);},[]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"inline-flex\",alignItems:\"center\",gap:6,padding,border:`1px solid ${borderColor}`,borderRadius:cornerRadius,background:surfaceColor,fontSize},role:\"group\",\"aria-label\":\"Selector de moneda\",children:[\"COP\",\"USD\"].map(item=>{const active=currency===item;return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":`Cambiar moneda a ${item}`,\"aria-pressed\":active,onClick:()=>selectCurrency(item),style:{border:`1px solid ${active?activeColor:borderColor}`,background:active?activeColor:\"transparent\",color:active?surfaceColor:textColor,borderRadius:Math.max(6,cornerRadius-4),padding:\"4px 10px\",cursor:\"pointer\",fontSize,lineHeight:1.1},children:item},item);})});}addPropertyControls(CurrencySelector,{surfaceColor:{type:ControlType.Color,defaultValue:\"rgba(255, 248, 235, 0.35)\"},textColor:{type:ControlType.Color,defaultValue:\"#6D5A33\"},activeColor:{type:ControlType.Color,defaultValue:\"#8B6A2B\"},borderColor:{type:ControlType.Color,defaultValue:\"rgba(139,106,43,0.35)\"},cornerRadius:{type:ControlType.Number,defaultValue:12,min:0,max:40,step:1},fontSize:{type:ControlType.Number,defaultValue:12,min:10,max:24,step:1},padding:{type:ControlType.Padding,defaultValue:\"4px\"}});/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export function CurrencyPrice(props){const{priceCop,priceUsd,fallbackText,textColor,fontSize,fontWeight,letterSpacing,lineHeight,textAlignment}=props;const[currency,setCurrency]=useState(\"COP\");useEffect(()=>{setCurrency(readCurrency());if(typeof window===\"undefined\")return;const onCustom=event=>{setCurrency(normalizeCurrency(event.detail?.currency));};const onStorage=event=>{if(event.key!==STORAGE_KEY)return;setCurrency(normalizeCurrency(event.newValue));};window.addEventListener(EVENT_NAME,onCustom);window.addEventListener(\"storage\",onStorage);return()=>{window.removeEventListener(EVENT_NAME,onCustom);window.removeEventListener(\"storage\",onStorage);};},[]);const label=useMemo(()=>{if(currency===\"USD\"){if(!Number.isFinite(priceUsd)||priceUsd<=0)return fallbackText;return new Intl.NumberFormat(\"en-US\",{style:\"currency\",currency:\"USD\",currencyDisplay:\"code\",maximumFractionDigits:0,minimumFractionDigits:0}).format(priceUsd);}if(!Number.isFinite(priceCop)||priceCop<=0)return fallbackText;return new Intl.NumberFormat(\"es-CO\",{style:\"currency\",currency:\"COP\",currencyDisplay:\"code\",maximumFractionDigits:0,minimumFractionDigits:0}).format(priceCop);},[currency,fallbackText,priceCop,priceUsd]);return /*#__PURE__*/_jsx(\"span\",{\"aria-label\":`Precio en ${currency}`,\"data-price-cop\":Number.isFinite(priceCop)&&priceCop>0?Math.round(priceCop):undefined,style:{position:\"relative\",display:\"inline-block\",color:textColor,fontSize,fontWeight,letterSpacing,lineHeight,textAlign:textAlignment,fontVariantNumeric:\"tabular-nums\",minWidth:\"max-content\"},children:label});}addPropertyControls(CurrencyPrice,{priceCop:{type:ControlType.Number,defaultValue:28e4,min:0,max:1e8,step:1e3},priceUsd:{type:ControlType.Number,defaultValue:70,min:0,max:1e6,step:1},fallbackText:{type:ControlType.String,defaultValue:\"Consultar precio\"},textColor:{type:ControlType.Color,defaultValue:\"#8B6A2B\"},fontSize:{type:ControlType.Number,defaultValue:14,min:10,max:48,step:1},fontWeight:{type:ControlType.Number,defaultValue:500,min:100,max:900,step:100},letterSpacing:{type:ControlType.String,defaultValue:\"0.01em\"},lineHeight:{type:ControlType.String,defaultValue:\"1.2em\"},textAlignment:{type:ControlType.Enum,options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CurrencySelector\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"CurrencyPrice\":{\"type\":\"reactComponent\",\"name\":\"CurrencyPrice\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CurrencyComponents.map"],"mappings":"6MAA+O,SAAS,EAAkB,EAAM,CAAC,OAAO,IAAQ,MAAM,MAAM,KAAM,CAAC,SAAS,GAAc,CAA4C,OAAjC,IAAS,OAA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