1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66854],{66854:function(e,t,r){r.d(t,{L:function(){return E},O:function(){return insertText}});var o=r(85893),l=r(38655),i=r(90195),a=r(83234),n=r(48641),s=r(37166),d=r(29609),c=r(9041);r(48521);var u=r(67294),g=r(92566),h=r(69171),p=r(88665),S=r(4662),y=r(6491),b=r(14493),f=r(47741),x=r(43393);let getCurrentlySelectedBlock=e=>{let t=e.getSelection(),r=t.getStartKey(),o=t.getEndKey(),l=e.getCurrentContent(),i=t;if(r!==o&&0===t.getEndOffset()){let e=l.getBlockBefore(o);if(!e)throw Error("Got unexpected null or undefined");o=e.getKey(),i=i.merge({anchorKey:r,anchorOffset:t.getStartOffset(),focusKey:o,focusOffset:e.getLength(),isBackward:!1})}let a=l.getBlockMap().skipWhile((e,t)=>t!==r).takeWhile((e,t)=>t!==o).some(e=>!!e&&"atomic"===e.getType()),n=l.getBlockForKey(r);return{content:l,currentBlock:n,hasAtomicBlock:a,target:i}},toggleAlignment=(e,t)=>{let{content:r,currentBlock:o,hasAtomicBlock:l,target:i}=getCurrentlySelectedBlock(e);if(l)return e;let a=o.getData();return c.EditorState.push(e,c.Modifier.mergeBlockData(r,i,x.Map({textAlign:a&&a.get("textAlign")===t?void 0:t})),"change-block-data")},insertText=(e,t)=>{let r=e.getSelection(),o=e.getCurrentContent(),l=e.getCurrentInlineStyle(),i=r.isCollapsed()?c.Modifier.insertText(o,r,t,l):c.Modifier.replaceText(o,r,t,l),a=c.EditorState.push(e,i,"insert-characters");return c.EditorState.forceSelection(a,i.getSelectionAfter())},splitBlock=e=>{let t=c.Modifier.splitBlock(e.getCurrentContent(),e.getSelection()),r=c.EditorState.push(e,t,"split-block"),{currentBlock:o}=getCurrentlySelectedBlock(e),l=o.getData().get("textAlign");return l?toggleAlignment(r,l):r},BlockTypeButton=e=>{let{editorState:t,setEditorState:r,blockType:l,...i}=e,a=getCurrentlySelectedBlock(t).currentBlock.getType();return(0,o.jsx)(n.xu,{onMouseDown:e=>e.preventDefault(),children:(0,o.jsx)(f.hU,{size:"sm",variant:"outline",colorScheme:"gray",isActive:a===l,onClick:e=>{e.preventDefault(),r(c.RichUtils.toggleBlockType(t,l))},...i})})};var m=r(99052),D=r(82475);let k={unstyled:"Paragraph","header-one":"Heading 1","header-two":"Heading 2","header-three":"Heading 3",blockquote:"Block Quote"},BlockTypeOption=e=>{let{blockType:t,editorState:r,setEditorState:l,onClose:i,...a}=e,n=getCurrentlySelectedBlock(r).currentBlock.getType();return(0,o.jsx)(f.zx,{justifyContent:"flex-start",variant:"ghost",colorScheme:"gray",leftIcon:n===t?(0,o.jsx)(y.nQG,{}):void 0,onMouseOver:e=>e.preventDefault(),onMouseDown:e=>{e.preventDefault,l(c.RichUtils.toggleBlockType(r,t)),i()},...a,children:k[t]})},BlockTypeSelect=e=>{let{editorState:t,setEditorState:r,blockTypes:l=["unstyled","header-one","header-two","header-three","blockquote"],isDisabled:a,newView:s=!1}=e,d=u.useRef(null),c=(0,i.qY)();(0,i.O3)({ref:d,handler:c.onClose});let g=t.getCurrentContent().getBlockForKey(t.getSelection().getStartKey()).getType();return(0,o.jsx)(n.xu,{ref:d,children:(0,o.jsxs)(m.v2,{isOpen:c.isOpen,autoSelect:!1,placement:"bottom",children:[(0,o.jsx)(m.j2,{as:D.U,onMouseDown:e=>{e.preventDefault(),c.onToggle()},size:"sm",isDisabled:a,variant:s?"menu":"outline",children:k[g]}),(0,o.jsx)(m.qy,{display:"flex",flexDirection:"column",onMouseDown:e=>e.preventDefault(),children:l.map(e=>(0,o.jsx)(BlockTypeOption,{editorState:t,setEditorState:r,blockType:e,onClose:c.onClose},e))})]})})},InlineStyleButton=e=>{let{editorState:t,setEditorState:r,inlineStyle:l,...i}=e;return(0,o.jsx)(n.xu,{onMouseDown:e=>e.preventDefault(),children:(0,o.jsx)(f.hU,{size:"sm",variant:"outline",colorScheme:"gray",isActive:t.getCurrentInlineStyle().has(l),onClick:e=>{e.preventDefault(),r(c.RichUtils.toggleInlineStyle(t,l))},...i})})},TextAlignmentButton=e=>{let{editorState:t,setEditorState:r,textAlign:l,...i}=e,{currentBlock:a}=getCurrentlySelectedBlock(t),s=a.getData().get("textAlign"),d=a.getType(),c=["unstyled","header-one","header-two","header-three"].includes(d);return(0,o.jsx)(n.xu,{onMouseDown:e=>e.preventDefault(),children:(0,o.jsx)(f.hU,{size:"sm",variant:"outline",colorScheme:"gray",isDisabled:!c,isActive:c&&(s?s===l:"left"===l),onClick:()=>r(toggleAlignment(t,l)),...i})})},Toolbar=e=>{var t;let{newView:r=!1}=e;return(0,o.jsx)(n.Kq,{children:(0,o.jsxs)(n.Eq,{shouldWrapChildren:!0,children:[(0,o.jsx)(BlockTypeSelect,{editorState:e.editorState,setEditorState:e.setEditorState,isDisabled:e.isDisabled,newView:r}
1),(0,o.jsx)(InlineStyleButton,{editorState:e.editorState,setEditorState:e.setEditorState,inlineStyle:"BOLD",icon:(0,o.jsx)(y.mY4,{}),"aria-label":"bold text",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(InlineStyleButton,{editorState:e.editorState,setEditorState:e.setEditorState,inlineStyle:"ITALIC",icon:(0,o.jsx)(y.h32,{}),"aria-label":"italic text",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(InlineStyleButton,{editorState:e.editorState,setEditorState:e.setEditorState,inlineStyle:"UNDERLINE",icon:(0,o.jsx)(y.Adg,{}),"aria-label":"underline text",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(BlockTypeButton,{editorState:e.editorState,setEditorState:e.setEditorState,blockType:"ordered-list-item",icon:(0,o.jsx)(b.k,{}),"aria-label":"ordered list",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(BlockTypeButton,{editorState:e.editorState,setEditorState:e.setEditorState,blockType:"unordered-list-item",icon:(0,o.jsx)(y.DE2,{}),"aria-label":"unordered list",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(TextAlignmentButton,{editorState:e.editorState,setEditorState:e.setEditorState,textAlign:"left",icon:(0,o.jsx)(y.xsH,{}),"aria-label":"align left",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(TextAlignmentButton,{editorState:e.editorState,setEditorState:e.setEditorState,textAlign:"center",icon:(0,o.jsx)(y.UPo,{}),"aria-label":"align center",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(TextAlignmentButton,{editorState:e.editorState,setEditorState:e.setEditorState,textAlign:"right",icon:(0,o.jsx)(y.mhm,{}),"aria-label":"align right",isDisabled:e.isDisabled,color:r?"primary.500":"",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit"}),(0,o.jsx)(S.Sw,{editorState:e.editorState,setEditorState:e.setEditorState,"aria-label":"link",variant:"outline",colorScheme:r?"primary":"gray",borderColor:r?"primary.500":"inherit",size:"sm",submitButtonColorScheme:"purple",isDisabled:e.isDisabled,color:r?"primary.500":""}),null===(t=e.toolbarExtras)||void 0===t?void 0:t.call(e,{editorState:e.editorState,setEditorState:e.setEditorState,isDisabled:e.isDisabled})]})})},v=(0,S.Tv)(),C=(0,d.Z)(),E=u.forwardRef((e,t)=>{let{newView:r=!1}=e,[d]=(0,l.dQ)("colors",["blue.500"]),{getUrlsFromFiles:S,isUploading:y}=(0,g.M)(),b=u.useRef(null),[f,x]=(0,i.kt)(),m=(0,a.NJ)(),[D,k]=(0,i.kt)(!1),E=D||y,B=e.isDisabled||(null==m?void 0:m.isDisabled)||E,[j,w]=u.useState(e.value?c.EditorState.createWithContent((0,c.convertFromRaw)(e.value)):c.EditorState.createEmpty()),onChange=t=>{var r,o;let l=(0,c.convertToRaw)(t.getCurrentContent()),i=null!==(o=null===(r=e.contentTransform)||void 0===r?void 0:r.call(e,{raw:l,editorState:t}))&&void 0!==o?o:t;w(i),e.onChange&&e.onChange((0,c.convertToRaw)(i.getCurrentContent()))};return u.useImperativeHandle(t,()=>b.current),(0,o.jsxs)(n.Kq,{h:"full",children:[(0,o.jsxs)(n.xu,{position:"relative",overflowY:"auto",borderRadius:"md",border:"1px",borderColor:f?"blue.500":"inherit",boxShadow:f?"0 0 0 1px ".concat(d):void 0,flex:"1",...e.minH?{minH:e.minH}:{},bg:"white",sx:{".DraftEditor-root":{h:"full"},".DraftEditor-editorContainer":{h:"full"},".public-DraftEditor-content":{p:4,h:"full",overflowY:"auto"},".public-DraftStyleDefault-block":{opacity:B?.4:void 0},".public-DraftEditorPlaceholder-root":{color:"gray.500",p:4},".text-right .public-DraftStyleDefault-block":{textAlign:"right"},".text-center .public-DraftStyleDefault-block":{textAlign:"center"},".text-left .public-DraftStyleDefault-block":{textAlign:"left"},".public-DraftStyleDefault-unorderedListItem, .public-DraftStyleDefault-orderedListItem":{marginLeft:0},...p.y},children:[(0,o.jsx)(s.ZP,{placeholder:e.placeholder,blockStyleFn:e=>{let t=e.getData().get("textAlign");return t?"text-".concat(t):"text-left"},handleReturn:()=>(w(splitBlock(j)),"handled"),ref:b,onFocus:()=>{x.on()},onBlur:()=>{x.off(),e.onBlur&&e.onBlur()},editorState:j,onChange:e=>onChange(e),readOnly:B,spellCheck:!0,handlePastedFiles:e=>(k.on(),S(e).then(e=>
1e.forEach(e=>{w(C.addImage(j,e,{}))})).finally(()=>k.off()),"handled"),plugins:[v,C]}),E&&(0,o.jsx)(h.g,{position:"absolute",top:"0",left:"0",right:"0",bottom:"0",bg:"whiteAlpha.700",zIndex:"docked"})]}),(0,o.jsx)(Toolbar,{editorState:j,setEditorState:onChange,isDisabled:B,newView:r,toolbarExtras:e.toolbarExtras})]})});E.displayName="RichTextEditor"},82475:function(e,t,r){r.d(t,{U:function(){return d}});var o=r(85893),l=r(83234),i=r(47741),a=r(38655),n=r(67294),s=r(6491);let d=n.forwardRef((e,t)=>{let{children:r,...n}=e,d=(0,l.NJ)(),c=(null==d?void 0:d.isDisabled)||n.isDisabled;return(0,o.jsx)(i.zx,{variant:"outline",colorScheme:"gray",backgroundColor:"white",fontWeight:"normal",rightIcon:(0,o.jsx)(s.v4q,{}),justifyContent:"space-between",borderColor:(null==d?void 0:d.isInvalid)?"red.500":void 0,border:(null==d?void 0:d.isInvalid)?"2px":void 0,_hover:{backgroundColor:"white"},w:"full",isDisabled:c,_expanded:{bg:"gray.200"},...n,ref:t,whiteSpace:"normal",textAlign:"left",children:(0,o.jsx)(a.m$.span,{noOfLines:1,wordBreak:"break-all",flex:"1",children:r})})});d.displayName="SelectMenuButton"}}]); 2//# sourceMappingURL=66854-63aa094d54c7be44.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.