{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/VeDQFb9XcktzPuJyjY4y/zdkFHbKZMuSihtK8svWw/TextHighlighter.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * TextEditor\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-auto\n * @framerSupportedLayoutHeight any-prefer-auto\n */export default function TextEditor(props){const{text,font,fontColor,highlightColor,variableFont,style,tag}=props;const regex=/\\{([^}]+)\\}/g;const parts=useMemo(()=>{const parts=[];let lastIndex=0;let match;while((match=regex.exec(text))!==null){if(match.index>lastIndex){parts.push({text:text.slice(lastIndex,match.index),highlight:false});}parts.push({text:match[1],highlight:true});lastIndex=regex.lastIndex;}if(lastIndex<text.length){parts.push({text:text.slice(lastIndex),highlight:false});}return parts;},[text]);const variableFontStyle=useMemo(()=>({fontVariationSettings:`'opsz' ${variableFont.opticalSize}, 'wght' ${variableFont.weight}`}),[variableFont.opticalSize,variableFont.weight]);const Tag=tag;return /*#__PURE__*/_jsx(Tag,{style:{...style,color:fontColor,...font,...variableFontStyle,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",margin:0,padding:0,display:\"block\",lineHeight:font.lineHeight||\"normal\",minWidth:style?.width?undefined:\"max-content\"},children:parts.map((part,i)=>part.highlight?/*#__PURE__*/_jsx(\"span\",{style:{color:highlightColor},children:part.text},i):/*#__PURE__*/_jsx(\"span\",{children:part.text},i))});}addPropertyControls(TextEditor,{tag:{type:ControlType.Enum,title:\"Tag\",options:[\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],defaultValue:\"p\"},text:{type:ControlType.String,title:\"Text\",description:\"Text put within {brackets} will be highlighted.\",displayTextArea:true,defaultValue:\"This is {highlighted} text.\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:22,variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},variableFont:{type:ControlType.Object,title:\"Variable\",controls:{opticalSize:{type:ControlType.Number,title:\"Optical\",min:14,max:32,defaultValue:14,step:1},weight:{type:ControlType.Number,title:\"Weight\",min:100,max:900,defaultValue:400,step:1}},defaultValue:{opticalSize:14,weight:400}},fontColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},highlightColor:{type:ControlType.Color,title:\"Highlight\",defaultValue:\"#FFFB8F\"}});TextEditor.displayName=\"Text Highlighter\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextEditor\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-auto\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextHighlighter.map"],
  "mappings": "gGAOkB,SAARA,EAA4BC,EAAM,CAAC,GAAK,CAAC,KAAAC,EAAK,KAAAC,EAAK,UAAAC,EAAU,eAAAC,EAAe,aAAAC,EAAa,MAAAC,EAAM,IAAAC,CAAG,EAAEP,EAAYQ,EAAM,eAAqBC,EAAMC,EAAQ,IAAI,CAAC,IAAMD,EAAM,CAAC,EAAME,EAAU,EAAMC,EAAM,MAAOA,EAAMJ,EAAM,KAAKP,CAAI,KAAK,MAASW,EAAM,MAAMD,GAAWF,EAAM,KAAK,CAAC,KAAKR,EAAK,MAAMU,EAAUC,EAAM,KAAK,EAAE,UAAU,EAAK,CAAC,EAAGH,EAAM,KAAK,CAAC,KAAKG,EAAM,CAAC,EAAE,UAAU,EAAI,CAAC,EAAED,EAAUH,EAAM,UAAW,OAAGG,EAAUV,EAAK,QAAQQ,EAAM,KAAK,CAAC,KAAKR,EAAK,MAAMU,CAAS,EAAE,U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AAC,KAAKA,EAAY,OAAO,MAAM,SAAS,IAAI,IAAI,IAAI,IAAI,aAAa,IAAI,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,GAAG,OAAO,GAAG,CAAC,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,MAAM,QAAQ,aAAa,SAAS,EAAE,eAAe,CAAC,KAAKA,EAAY,MAAM,MAAM,YAAY,aAAa,SAAS,CAAC,CAAC,EAAElB,EAAW,YAAY",
  "names": ["TextEditor", "props", "text", "font", "fontColor", "highlightColor", "variableFont", "style", "tag", "regex", "parts", "se", "lastIndex", "match", "variableFontStyle", "p", "part", "addPropertyControls", "ControlType"]
}
