{"version":3,"file":"HighlightText.DBJFT1t8.mjs","names":[],"sources":["https:/framerusercontent.com/modules/jXi7aOFKqK2UpDWQe4Ec/IsjfwypXR3tkuwKbt9Ba/HighlightText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";function getRanges(source,phrases,caseSensitive,allOccurrences){if(!source||phrases.length===0)return[];const haystack=caseSensitive?source:source.toLowerCase();const ranges=[];for(const phrase of phrases){const needle=caseSensitive?phrase:phrase.toLowerCase();if(!needle)continue;let fromIndex=0;while(fromIndex<haystack.length){const index=haystack.indexOf(needle,fromIndex);if(index===-1)break;ranges.push({start:index,end:index+needle.length});if(!allOccurrences)break;fromIndex=index+Math.max(1,needle.length);}}const sorted=ranges.sort((a,b)=>{if(a.start!==b.start)return a.start-b.start;return b.end-a.end;});const merged=[];for(const range of sorted){const prev=merged[merged.length-1];if(!prev||range.start>=prev.end){merged.push(range);}}return merged;}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function HighlightText(props){const{text=\"Crea una landing que convierte con highlights editables\",highlights=\"highlights editables\",highlightMode=\"background\",highlightBackground=\"#FFE55C\",highlightTextColor=\"#111111\",textColor=\"#FFFFFF\",font={},radius=\"6px\",paddingX=4,paddingY=1,underlineThickness=3,underlineOffset=3,caseSensitive=false,allOccurrences=true,textAlign=\"left\",maxWidth=\"560px\",style}=props;const phrases=highlights.split(\",\").map(item=>item.trim()).filter(Boolean);const ranges=getRanges(text,phrases,caseSensitive,allOccurrences);const pieces=[];let cursor=0;for(let i=0;i<ranges.length;i++){const range=ranges[i];if(range.start>cursor){pieces.push({content:text.slice(cursor,range.start),highlighted:false,key:`plain-${cursor}-${range.start}`});}pieces.push({content:text.slice(range.start,range.end),highlighted:true,key:`highlight-${range.start}-${range.end}-${i}`});cursor=range.end;}if(cursor<text.length||pieces.length===0){pieces.push({content:text.slice(cursor),highlighted:false,key:`tail-${cursor}-${text.length}`});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"inline-block\",width:\"auto\",maxWidth,color:textColor,textAlign,whiteSpace:\"normal\",wordBreak:\"break-word\",fontFamily:font.fontFamily,fontSize:font.fontSize,fontWeight:font.fontWeight,fontStyle:font.fontStyle,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,...style},children:pieces.map(piece=>{if(!piece.highlighted)return /*#__PURE__*/_jsx(\"span\",{children:piece.content},piece.key);const highlightStyle=highlightMode===\"background\"?{background:highlightBackground,color:highlightTextColor,borderRadius:radius,padding:`${Math.max(0,paddingY)}px ${Math.max(0,paddingX)}px`}:highlightMode===\"underline\"?{color:highlightTextColor,textDecorationLine:\"underline\",textDecorationColor:highlightBackground,textDecorationThickness:`${Math.max(0,underlineThickness)}px`,textUnderlineOffset:`${Math.max(0,underlineOffset)}px`,textDecorationSkipInk:\"none\"}:{color:highlightTextColor};return /*#__PURE__*/_jsx(\"span\",{style:highlightStyle,children:piece.content},piece.key);})});}addPropertyControls(HighlightText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Crea una landing que convierte con highlights editables\",displayTextArea:true},highlights:{type:ControlType.String,title:\"Highlights\",defaultValue:\"highlights editables\"},highlightMode:{type:ControlType.Enum,title:\"Mode\",defaultValue:\"background\",options:[\"background\",\"underline\",\"text\"],optionTitles:[\"Background\",\"Underline\",\"Text\"],displaySegmentedControl:true},highlightBackground:{type:ControlType.Color,title:\"HL BG\",defaultValue:\"#FFE55C\"},highlightTextColor:{type:ControlType.Color,title:\"HL Text\",defaultValue:\"#111111\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"28px\",variant:\"Semibold\",lineHeight:\"1.2em\",letterSpacing:\"-0.01em\"}},radius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"6px\"},paddingX:{type:ControlType.Number,title:\"Pad X\",defaultValue:4,min:0,max:24,step:1},paddingY:{type:ControlType.Number,title:\"Pad Y\",defaultValue:1,min:0,max:24,step:1},underlineThickness:{type:ControlType.Number,title:\"U Thick\",defaultValue:3,min:0,max:16,step:.5},underlineOffset:{type:ControlType.Number,title:\"U Offset\",defaultValue:3,min:0,max:20,step:.5},caseSensitive:{type:ControlType.Boolean,title:\"Case\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},allOccurrences:{type:ControlType.Boolean,title:\"All\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},textAlign:{type:ControlType.Enum,title:\"Align\",defaultValue:\"left\",options:[\"left\",\"center\",\"right\"],displaySegmentedControl:true},maxWidth:{type:ControlType.String,title:\"Max Width\",defaultValue:\"560px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HighlightText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighlightText.map"],"mappings":"4JAA+F,SAAS,EAAU,EAAO,EAAQ,EAAc,EAAe,CAAC,GAAG,CAAC,GAAQ,EAAQ,SAAS,EAAE,MAAM,CAAC,EAAE,IAAM,EAAS,EAAc,EAAO,EAAO,YAAY,EAAQ,EAAO,CAAC,EAAE,IAAI,IAAM,KAAU,EAAQ,CAAC,IAAM,EAAO,EAAc,EAAO,EAAO,YAAY,EAAE,GAAG,CAAC,EAAO,SAAS,IAAI,EAAU,EAAE,KAAM,EAAU,EAAS,QAAO,CAAC,IAAM,EAAM,EAAS,QAAQ,EAAO,CAAS,EAAyE,GAApE,IAAQ,KAAS,EAAO,KAAK,CAAC,MAAM,EAAM,IAAI,EAAM,EAAO,MAAM,CAAC,EAAK,CAAC,GAAe,MAAM,EAAU,EAAM,KAAK,IAAI,EAAE,EAAO,MAAM,CAAE,CAAC,CAAC,IAAM,EAA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