{"version":3,"file":"TextWrapperLocale.JCcJFc1X.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/BzRJflyx62eWc5JuXI9K/uui7YBn07Xt2KGcIHRqt/TextWrapperLocale.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth fill\n * @framerSupportedLayoutHeight any\n */export default function TextWrapperLocale(props){const[locale,setLocale]=useState(\"es\");const[textToDisplay,setTextToDisplay]=useState(props.content);useEffect(()=>{// Función para actualizar según el locale\nconst updateLocale=()=>{const getLocale=localStorage.getItem(\"mainLocale\");const newLocale=getLocale===\"en\"?\"en\":\"es\";setLocale(newLocale);// Actualiza el texto basado en el locale\nif(newLocale===\"en\"){setTextToDisplay(props.content_EN);}else{setTextToDisplay(props.content);}};// Ejecuta la actualización inicial\nupdateLocale();// Agrega el listener para cambios en otras pestañas/frames\nwindow.addEventListener(\"storage\",updateLocale);// Para detectar cambios desde el mismo documento\nconst originalSetItem=localStorage.setItem;localStorage.setItem=function(key,value){// Llama al método original\noriginalSetItem.apply(this,arguments);// Si es el key que nos interesa, actualizamos\nif(key===\"mainLocale\"){updateLocale();}};// Limpieza al desmontar\nreturn()=>{window.removeEventListener(\"storage\",updateLocale);localStorage.setItem=originalSetItem;};},[props.content,props.content_EN]);const styles={fontFamily:\"Satoshi\",fontWeight:props.weight,fontSize:props.font_size,color:props.font_color,lineHeight:props.line+\"%\",textTransform:props.text_transform,textDecorationLine:props.text_decoration,fontStyle:props.fontItalic?\"italic\":\"normal\",textAlign:props.text_align,width:props.widthMaxContent?\"max-content\":\"\",margin:0,padding:0};// Función para parsear Markdown básico\nconst parseMarkdown=text=>{if(!text||typeof text!==\"string\")return text;// Array para almacenar los elementos resultantes\nconst result=[];// Dividir el texto en líneas\nconst lines=text.split(\"\\n\");// Procesar cada línea\nlines.forEach((line,index)=>{// Encabezados\nif(line.match(/^# /)){result.push(/*#__PURE__*/_jsx(\"h1\",{style:{...styles,fontSize:\"48px\",fontWeight:700},children:line.substring(2)},index));}else if(line.match(/^## /)){result.push(/*#__PURE__*/_jsx(\"h2\",{style:{...styles,fontSize:\"36px\",fontWeight:700},children:line.substring(3)},index));}else if(line.match(/^### /)){result.push(/*#__PURE__*/_jsx(\"h3\",{style:{...styles,fontSize:\"28px\",fontWeight:700},children:line.substring(4)},index));}else if(line.match(/^#### /)){result.push(/*#__PURE__*/_jsx(\"h4\",{style:{...styles,fontSize:\"24px\",fontWeight:500},children:line.substring(5)},index));}else if(line.includes(\"**\")||line.includes(\"__\")){// Dividir por marcadores de negrita\nconst parts=[];let currentText=line;let boldMatch;// Usar expresión regular para encontrar texto en negrita\nconst boldRegex=/(\\*\\*|__)(.*?)\\1/g;let lastIndex=0;while((boldMatch=boldRegex.exec(line))!==null){// Texto antes del marcador de negrita\nif(boldMatch.index>lastIndex){parts.push(line.substring(lastIndex,boldMatch.index));}// Texto en negrita\nparts.push(/*#__PURE__*/_jsx(\"strong\",{children:boldMatch[2]},`bold-${boldMatch.index}`));lastIndex=boldMatch.index+boldMatch[0].length;}// Texto después del último marcador de negrita\nif(lastIndex<line.length){parts.push(line.substring(lastIndex));}result.push(/*#__PURE__*/_jsx(\"p\",{style:styles,children:parts},index));}else if(line.includes(\"*\")||line.includes(\"_\")){// Similar al procesamiento de negrita pero para cursiva\nconst parts=[];let currentText=line;let italicMatch;// Usar expresión regular para encontrar texto en cursiva\nconst italicRegex=/(\\*|_)(.*?)\\1/g;let lastIndex=0;while((italicMatch=italicRegex.exec(line))!==null){// Texto antes del marcador de cursiva\nif(italicMatch.index>lastIndex){parts.push(line.substring(lastIndex,italicMatch.index));}// Texto en cursiva\nparts.push(/*#__PURE__*/_jsx(\"em\",{children:italicMatch[2]},`italic-${italicMatch.index}`));lastIndex=italicMatch.index+italicMatch[0].length;}// Texto después del último marcador de cursiva\nif(lastIndex<line.length){parts.push(line.substring(lastIndex));}result.push(/*#__PURE__*/_jsx(\"p\",{style:styles,children:parts},index));}else if(line.match(/^---+$/)){result.push(/*#__PURE__*/_jsx(\"hr\",{},index));}else if(line.trim()===\"\"){result.push(/*#__PURE__*/_jsx(\"br\",{},index));}else{result.push(/*#__PURE__*/_jsx(\"p\",{style:styles,children:line},index));}});return result;};// Aplicar el parser de Markdown\nconst renderedContent=parseMarkdown(textToDisplay);switch(props.tag){case\"h1\":return /*#__PURE__*/_jsx(\"h1\",{style:styles,children:textToDisplay});case\"md\":return Array.isArray(renderedContent)?/*#__PURE__*/_jsx(\"div\",{children:renderedContent}):/*#__PURE__*/_jsx(\"p\",{style:styles,children:renderedContent});default:return /*#__PURE__*/_jsx(\"p\",{style:styles,children:textToDisplay});}}TextWrapperLocale.defaultProps={font_size:16,fontItalic:false,widthMaxContent:false,line:120,tag:\"p\"};addPropertyControls(TextWrapperLocale,{// CONTENIDO EN INGLES Y EN ESPAÑOL\ncontent:{type:ControlType.String,title:\"Content\"},content_EN:{type:ControlType.String,title:\"EN Content\"},// FUENTE\nweight:{type:ControlType.Enum,title:\"Weight\",defaultValue:\"200\",options:[\"300\",\"400\",\"500\",\"700\"],optionTitles:[\"Light\",\"Regular\",\"Medium\",\"Bold\"]},font_color:{type:ControlType.Color,title:\"Color\"},font_size:{type:ControlType.Number,title:\"Size\",displayStepper:false},text_transform:{type:ControlType.Enum,title:\"Transform\",defaultValue:\"none\",options:[\"none\",\"capitalize\",\"uppercase\",\"lowercase\"],optionTitles:[\"None\",\"Capitalize\",\"Uppercase\",\"Lowercase\"]},text_decoration:{type:ControlType.Enum,title:\"Decoration\",defaultValue:\"none\",options:[\"none\",\"underline\",\"overline\",\"line-through\"],optionTitles:[\"None\",\"Underline\",\"Overline\",\"Line Through\"]},fontItalic:{type:ControlType.Boolean,title:\"Italic\"},widthMaxContent:{type:ControlType.Boolean,title:\"Max Content\"},text_align:{type:ControlType.Enum,title:\"Align\",defaultValue:\"left\",options:[\"left\",\"center\",\"right\",\"justify\"],optionTitles:[\"Left\",\"Center\",\"Right\",\"Justify\"]},line:{type:ControlType.Number,title:\"Line\",unit:\"%\",displayStepper:false},tag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"p\",options:[\"p\",\"span\",\"md\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"Paragraph\",\"Span\",\"Markdown\",\"Heading 1\",\"Heading 2\",\"Heading 3\",\"Heading 4\",\"Heading 5\",\"Heading 6\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextWrapperLocale\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fill\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextWrapperLocale.map"],"mappings":"+LAGG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,EAAO,GAAWA,EAAS,KAAK,CAAM,CAAC,EAAc,GAAkBA,EAAS,EAAM,QAAQ,CAAC,MAAc,CACvK,IAAM,MAAiB,CAAoD,IAAM,EAAzC,aAAa,QAAQ,aAAa,GAA6B,KAAK,KAAK,KAAK,EAAU,EAAU,CACrH,EAAlB,IAAY,KAAuB,EAAM,WAAmC,EAAM,QAAQ,EAC7F,GAAc,CACd,EAAO,iBAAiB,UAAU,EAAa,CAC/C,IAAM,EAAgB,aAAa,QAGnC,MAH2C,cAAa,QAAQ,SAAS,EAAI,EAAM,CACnF,EAAgB,MAAM,KAAK,UAAU,CAClC,IAAM,cAAc,GAAc,MAC3B,CAAC,EAAO,oBAAoB,UAAU,EAAa,CAAC,aAAa,QAAQ,IAAoB,CAAC,EAAM,QAAQ,EAAM,WAAW,CAAC,CAAC,IAAM,EAAO,CAAC,WAAW,UAAU,WAAW,EAAM,OAAO,SAAS,EAAM,UAAU,MAAM,EAAM,WAAW,WAAW,EAAM,KAAK,IAAI,cAAc,EAAM,eAAe,mBAAmB,EAAM,gBA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