{"version":3,"sources":["../src/components/base-ai-textarea/render-element.tsx"],"sourcesContent":["import { RenderElementProps } from \"slate-react\";\n\nexport type RenderElementFunction = (props: RenderElementProps) => JSX.Element;\n\nexport function makeRenderElementFunction(\n  suggestionsStyle: React.CSSProperties,\n): RenderElementFunction {\n  return (props: RenderElementProps) => {\n    switch (props.element.type) {\n      case \"paragraph\":\n        return <DefaultElement {...props} />;\n      case \"suggestion\":\n        return <SuggestionElement {...props} suggestionsStyle={suggestionsStyle} />;\n    }\n  };\n}\n\nconst DefaultElement = (props: RenderElementProps) => {\n  return <div {...props.attributes}>{props.children}</div>;\n};\nconst SuggestionElement = (\n  props: RenderElementProps & {\n    suggestionsStyle: React.CSSProperties;\n  },\n) => {\n  return (\n    <span\n      {...props.attributes}\n      style={{\n        ...props.suggestionsStyle,\n      }}\n      data-testid=\"suggestion\"\n      contentEditable={false}\n    >\n      {props.children /* https://github.com/ianstormtaylor/slate/issues/3930 */}\n      {props.element.type === \"suggestion\" && props.element.content}\n    </span>\n  );\n};\n"],"mappings":";;;;;;AAUe,cAgBX,YAhBW;AANR,SAAS,0BACd,kBACuB;AACvB,SAAO,CAAC,UAA8B;AACpC,YAAQ,MAAM,QAAQ,MAAM;AAAA,MAC1B,KAAK;AACH,eAAO,oBAAC,mCAAmB,MAAO;AAAA,MACpC,KAAK;AACH,eAAO,oBAAC,oDAAsB,QAAtB,EAA6B,mBAAoC;AAAA,IAC7E;AAAA,EACF;AACF;AAEA,IAAM,iBAAiB,CAAC,UAA8B;AACpD,SAAO,oBAAC,wCAAQ,MAAM,aAAd,EAA2B,gBAAM,WAAS;AACpD;AACA,IAAM,oBAAoB,CACxB,UAGG;AACH,SACE;AAAA,IAAC;AAAA,qCACK,MAAM,aADX;AAAA,MAEC,OAAO,mBACF,MAAM;AAAA,MAEX,eAAY;AAAA,MACZ,iBAAiB;AAAA,MAEhB;AAAA,cAAM;AAAA,QACN,MAAM,QAAQ,SAAS,gBAAgB,MAAM,QAAQ;AAAA;AAAA;AAAA,EACxD;AAEJ;","names":[]}