4 lines
42 KiB
JavaScript
4 lines
42 KiB
JavaScript
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="9a4da490-a497-2264-52d1-3febbf9a9c58")}catch(e){}}();
|
|
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,206093,e=>{"use strict";var t=e.i(178249),r=e.i(268576),n=e.i(452797),o=e.i(638857),i=e.i(55686),l=e.i(226150),a=e.i(359394),s=e.i(907358),d=s;let u=(0,d.createContext)(null),c={didCatch:!1,error:null};class f extends d.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=c}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];null==(t=(r=this.props).onReset)||t.call(r,{args:o,reason:"imperative-api"}),this.setState(c)}}componentDidCatch(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var o,i;null==(o=(i=this.props).onReset)||o.call(i,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(c)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:o,error:i}=this.state,l=e;if(o){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)l=t(e);else if(r)l=(0,d.createElement)(r,e);else if(void 0!==n)l=n;else throw i}return(0,d.createElement)(u.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},l)}}var m=e.i(600745),p=e.i(703057);let g="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,h=g?s.useLayoutEffect:s.useEffect,y={tag:p.HISTORY_MERGE_TAG};function E({initialConfig:e,children:t}){let r=(0,s.useMemo)(()=>{let{theme:t,namespace:r,nodes:n,onError:o,editorState:i,html:l}=e,a=(0,m.createLexicalComposerContext)(null,t),s=(0,p.createEditor)({editable:e.editable,html:l,namespace:r,nodes:n,onError:e=>o(e,s),theme:t});return function(e,t){if(null!==t){if(void 0===t)e.update(()=>{let t=(0,p.$getRoot)();if(t.isEmpty()){let r=(0,p.$createParagraphNode)();t.append(r);let n=g?document.activeElement:null;(null!==(0,p.$getSelection)()||null!==n&&n===e.getRootElement())&&r.select()}},y);else if(null!==t)switch(typeof t){case"string":{let r=e.parseEditorState(t);e.setEditorState(r,y);break}case"object":e.setEditorState(t,y);break;case"function":e.update(()=>{(0,p.$getRoot)().isEmpty()&&t(e)},y)}}}(s,i),[s,a]},[]);return h(()=>{let t=e.editable,[n]=r;n.setEditable(void 0===t||t)},[]),(0,n.jsx)(m.LexicalComposerContext.Provider,{value:r,children:t})}var x=e.i(785316),C=s;let b=(0,C.createContext)(null),v={didCatch:!1,error:null};class N extends C.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=v}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(v))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;r&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(this.props.onReset?.({next:n,prev:e.resetKeys,reason:"keys"}),this.setState(v))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:o,error:i}=this.state,l=e;if(o){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)l=t(e);else if(r)l=(0,C.createElement)(r,e);else if(void 0!==n)l=n;else throw i}return(0,C.createElement)(b.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},l)}}function S({children:e,onError:t}){return(0,n.jsx)(N,{fallback:(0,n.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var _=e.i(501522);function O(e){e.undoStack=[],e.redoStack=[],e.current=null}function R(e,t,r){let n,o,i,l,a,s=(n=Date.now(),o=0,i=Date.now(),l=0,a=null,(t,s,d,u,c,f)=>{let m=Date.now();if(f.has(p.COMPOSITION_START_TAG)&&(i=n,l=o,a=t),f.has(p.HISTORIC_TAG))return o=0,n=m,2;f.has(p.COMPOSITION_END_TAG)&&a&&(n=i,o=l,t=a);let g=function(e,t,r,n,o){if(null===e||0===r.size&&0===n.size&&!o)return 0;let i=t._selection,l=e._selection;if(o)return 1;if(!((0,p.$isRangeSelection)(i)&&(0,p.$isRangeSelection)(l)&&l.isCollapsed()&&i.isCollapsed()))return 0;let a=function(e,t,r){let n=e._nodeMap,o=[];for(let e of t){let t=n.get(e);void 0!==t&&o.push(t)}for(let[e,t]of r){if(!t)continue;let r=n.get(e);void 0===r||(0,p.$isRootNode)(r)||o.push(r)}return o}(t,r,n);if(0===a.length)return 0;if(a.length>1){let r=t._nodeMap,n=r.get(i.anchor.key),o=r.get(l.anchor.key);return n&&o&&!e._nodeMap.has(n.__key)&&(0,p.$isTextNode)(n)&&1===n.__text.length&&1===i.anchor.offset?2:0}let s=a[0],d=e._nodeMap.get(s.__key);if(!(0,p.$isTextNode)(d)||!(0,p.$isTextNode)(s)||d.__mode!==s.__mode)return 0;let u=d.__text,c=s.__text;if(u===c)return 0;let f=i.anchor,m=l.anchor;if(f.key!==m.key||"text"!==f.type)return 0;let g=f.offset,h=m.offset,y=c.length-u.length;return 1===y&&h===g-1?2:-1===y&&h===g+1?3:4*(-1===y&&h===g)}(t,s,u,c,e.isComposing()),h=(()=>{var i,l;let a,h,y,E,x=null===d||d.editor===e,C=f.has(p.HISTORY_PUSH_TAG);if(!C&&x&&f.has(p.HISTORY_MERGE_TAG))return 0;if(1===g)return 2;if(null===t)return 1;let b=s._selection;if(!(u.size>0||c.size>0))return 2*(null===b);let v="number"==typeof r?r:r.peek();return!1===C&&0!==g&&g===o&&m<n+v&&x?0:1!==u.size||(i=Array.from(u)[0],a=(l=t)._nodeMap.get(i),h=s._nodeMap.get(i),y=l._selection,E=s._selection,(0,p.$isRangeSelection)(y)&&(0,p.$isRangeSelection)(E)&&"element"===y.anchor.type&&"element"===y.focus.type&&"text"===E.anchor.type&&"text"===E.focus.type||!(0,p.$isTextNode)(a)||!(0,p.$isTextNode)(h)||a.__parent!==h.__parent||JSON.stringify(l.read(()=>a.exportJSON()))!==JSON.stringify(s.read(()=>h.exportJSON())))?1:0})();return n=m,o=g,h});return(0,p.mergeRegister)(e.registerCommand(p.UNDO_COMMAND,()=>((function(e,t){let r=t.redoStack,n=t.undoStack;if(0!==n.length){let o=t.current,i=n.pop();null!==o&&(r.push(o),e.dispatchCommand(p.CAN_REDO_COMMAND,!0)),0===n.length&&e.dispatchCommand(p.CAN_UNDO_COMMAND,!1),t.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:p.HISTORIC_TAG})}})(e,t),!0),p.COMMAND_PRIORITY_EDITOR),e.registerCommand(p.REDO_COMMAND,()=>((function(e,t){let r=t.redoStack,n=t.undoStack;if(0!==r.length){let o=t.current;null!==o&&(n.push(o),e.dispatchCommand(p.CAN_UNDO_COMMAND,!0));let i=r.pop();0===r.length&&e.dispatchCommand(p.CAN_REDO_COMMAND,!1),t.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:p.HISTORIC_TAG})}})(e,t),!0),p.COMMAND_PRIORITY_EDITOR),e.registerCommand(p.CLEAR_EDITOR_COMMAND,()=>(O(t),!1),p.COMMAND_PRIORITY_EDITOR),e.registerCommand(p.CLEAR_HISTORY_COMMAND,()=>(O(t),e.dispatchCommand(p.CAN_REDO_COMMAND,!1),e.dispatchCommand(p.CAN_UNDO_COMMAND,!1),!0),p.COMMAND_PRIORITY_EDITOR),e.registerUpdateListener(({editorState:r,prevEditorState:n,dirtyLeaves:o,dirtyElements:i,tags:l})=>{let a=t.current,d=t.redoStack,u=t.undoStack,c=null===a?null:a.editorState;if(null!==a&&r===c)return;let f=s(n,r,a,o,i,l);if(1===f)0!==d.length&&(t.redoStack=[],e.dispatchCommand(p.CAN_REDO_COMMAND,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(p.CAN_UNDO_COMMAND,!0));else if(2===f)return;t.current={editor:e,editorState:r}}))}function w(){return{current:null,redoStack:[],undoStack:[]}}let M=(0,p.defineExtension)({build:(e,{delay:t,createInitialHistoryState:r,disabled:n})=>(0,_.namedSignals)({delay:t,disabled:n,historyState:r(e)}),config:(0,p.safeCast)({createInitialHistoryState:w,delay:300,disabled:"u"<typeof window}),name:"@lexical/history/History",register:(e,t,r)=>{let n=r.getOutput();return(0,_.effect)(()=>n.disabled.value?void 0:R(e,n.historyState.value,n.delay))}});function k({delay:e,externalHistoryState:t}){let[r]=(0,m.useLexicalComposerContext)();return function(e,t,r=1e3){let n=(0,s.useMemo)(()=>t||w(),[t]);(0,s.useEffect)(()=>R(e,n,r),[r,e,n])}(r,t,e),null}(0,p.defineExtension)({dependencies:[(0,p.configExtension)(M,{createInitialHistoryState:()=>{throw Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,r){var n;let{output:o}=r.getDependency(M),i=(n=e._parentEditor)?(0,_.getPeerDependencyFromEditor)(n,M.name):null;if(!i)return()=>{};let l=i.output;return(0,_.effect)(()=>(0,_.batch)(()=>{o.delay.value=l.delay.value,o.historyState.value=l.historyState.value,o.disabled.value=l.disabled.value}))}});let D="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?s.useLayoutEffect:s.useEffect;function T({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:r}){let[n]=(0,m.useLexicalComposerContext)();return D(()=>{if(r)return n.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:l,prevEditorState:a,tags:s})=>{t&&0===i.size&&0===l.size||e&&s.has(p.HISTORY_MERGE_TAG)||a.isEmpty()||r(o,n,s)})},[n,e,t,r]),null}var A=e.i(678457);let L=(0,p.defineExtension)({name:"@lexical/react/ReactProvider"});var j=e.i(910353);function $(e){return()=>(function(e){if(!function(e,t=!0){if(e)return!1;let r=(0,p.$getRoot)().getTextContent();return t&&(r=r.trim()),""===r}(e,!1))return!1;let t=(0,p.$getRoot)().getChildren(),r=t.length;if(r>1)return!1;for(let e=0;e<r;e++){let r=t[e];if((0,p.$isDecoratorNode)(r))return!1;if((0,p.$isElementNode)(r)){if(!(0,p.$isParagraphNode)(r)||0!==r.__indent)return!1;let t=r.getChildren(),n=t.length;for(let r=0;r<n;r++){let r=t[e];if(!(0,p.$isTextNode)(r))return!1}}}return!0})(e)}var I=e.i(35500),P=e.i(20207);let B="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?s.useLayoutEffect:s.useEffect;function F({editor:e,ErrorBoundary:t}){return function(e,t){let[r,o]=(0,s.useState)(()=>e.getDecorators());return B(()=>e.registerDecoratorListener(e=>{(0,j.flushSync)(()=>{o(e)})}),[e]),(0,s.useEffect)(()=>{o(e.getDecorators())},[e]),(0,s.useMemo)(()=>{let o=[],i=Object.keys(r);for(let l=0;l<i.length;l++){let a=i[l],d=(0,n.jsx)(t,{onError:t=>e._onError(t),children:(0,n.jsx)(s.Suspense,{fallback:null,children:r[a]})}),u=e.getElementByKey(a);null!==u&&o.push((0,j.createPortal)(d,u,a))}return o},[t,r,e])}(e,t)}function K({editor:e,ErrorBoundary:t}){return!function(e){let t=_.LexicalBuilder.maybeFromEditor(e);if(t&&t.hasExtensionByName(L.name)){for(let e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&function(e,...t){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let e of(n.append("code",320),t))n.append("v",e);throw r.search=n.toString(),Error(`Minified Lexical error #320; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(0,e);return!0}return!1}(e)?(0,n.jsx)(F,{editor:e,ErrorBoundary:t}):null}function Y(e){return e.getEditorState().read($(e.isComposing()))}function z({contentEditable:e,placeholder:t=null,ErrorBoundary:r}){var o;let[i]=(0,m.useLexicalComposerContext)();return B(()=>(0,p.mergeRegister)((0,P.registerRichText)(o),(0,I.registerDragonSupport)(o)),[o=i]),(0,n.jsxs)(n.Fragment,{children:[e,(0,n.jsx)(H,{content:t}),(0,n.jsx)(K,{editor:i,ErrorBoundary:r})]})}function H({content:e}){let[t]=(0,m.useLexicalComposerContext)(),r=function(e){let[t,r]=(0,s.useState)(()=>Y(e));return B(()=>{function t(){r(Y(e))}return t(),(0,p.mergeRegister)(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),n=(0,A.useLexicalEditable)();return r?"function"==typeof e?e(n):e:null}var U=e.i(704338),G=e.i(410911),W=e.i(756961),J=e.i(138452);let q="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?s.useLayoutEffect:s.useEffect,V=(0,s.forwardRef)(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:r,ariaControls:o,ariaDescribedBy:i,ariaErrorMessage:l,ariaExpanded:a,ariaInvalid:d,ariaLabel:u,ariaLabelledBy:c,ariaMultiline:f,ariaOwns:m,ariaRequired:p,autoCapitalize:g,className:h,id:y,role:E="textbox",spellCheck:x=!0,style:C,tabIndex:b,"data-testid":v,...N},S){let[_,O]=(0,s.useState)(e.isEditable()),R=(0,s.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),w=(0,s.useMemo)(()=>(function(...e){return t=>{for(let r of e)"function"==typeof r?r(t):null!=r&&(r.current=t)}})(S,R),[R,S]);return q(()=>(O(e.isEditable()),e.registerEditableListener(e=>{O(e)})),[e]),(0,n.jsx)("div",{"aria-activedescendant":_?t:void 0,"aria-autocomplete":_?r:"none","aria-controls":_?o:void 0,"aria-describedby":i,...null!=l?{"aria-errormessage":l}:{},"aria-expanded":_&&"combobox"===E?!!a:void 0,...null!=d?{"aria-invalid":d}:{},"aria-label":u,"aria-labelledby":c,"aria-multiline":f,"aria-owns":_?m:void 0,"aria-readonly":!_||void 0,"aria-required":p,autoCapitalize:g,className:h,contentEditable:_,"data-testid":v,id:y,ref:w,role:E,spellCheck:x,style:C,tabIndex:b,...N})});function X(e){return e.getEditorState().read($(e.isComposing()))}let Q=(0,s.forwardRef)(function(e,t){let{placeholder:r,...o}=e,[i]=(0,m.useLexicalComposerContext)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V,{editor:i,...o,ref:t}),null!=r&&(0,n.jsx)(Z,{editor:i,content:r})]})});function Z({content:e,editor:t}){let r=function(e){let[t,r]=(0,s.useState)(()=>X(e));return q(()=>{function t(){r(X(e))}return t(),(0,p.mergeRegister)(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[o,i]=(0,s.useState)(t.isEditable());if((0,s.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!r)return null;let l=null;return"function"==typeof e?l=e(o):null!==e&&(l=e),null===l?null:(0,n.jsx)("div",{"aria-hidden":!0,children:l})}var ee=({anchorElem:e,clientProps:t,plugin:r})=>"floatingAnchorElem"===r.position&&e?r.Component&&(0,n.jsx)(r.Component,{anchorElem:e,clientProps:t}):r.Component&&(0,n.jsx)(r.Component,{clientProps:t}),et=e=>{if("fields"in e&&"object"==typeof e.fields&&null!==e.fields&&"id"in e.fields?e.fields.id=new W.default.default().toHexString():"id"in e&&(e.id=new W.default.default().toHexString()),e.children)for(let t of e.children)et(t)};function er(){let e=(0,x.c)(3),[t]=(0,m.useLexicalComposerContext)(),r,n;return e[0]!==t?(r=()=>t.registerCommand(p.COPY_COMMAND,e=>{let r=(0,p.$getSelection)();if((0,p.$isNodeSelection)(r)){let e=JSON.parse(JSON.stringify(r.getNodes()[0]?.exportJSON()));et(e);let n=JSON.stringify({namespace:t._config.namespace,nodes:[e]});return(0,U.copyToClipboard)(t,null,{"application/x-lexical-editor":n,"text/plain":""}).catch(en),!0}return(0,U.copyToClipboard)(t,(0,G.objectKlassEquals)(e,ClipboardEvent)?e:null).then(()=>{if(!(e instanceof ClipboardEvent)||!e.clipboardData)throw Error("No clipboard event");let t=e.clipboardData.getData("application/x-lexical-editor");if(!t)return!0;let r=JSON.parse(t);for(let e of r.nodes)et(e);let n=JSON.stringify(r);e.clipboardData.setData("application/x-lexical-editor",n)}).catch(t=>{throw e instanceof ClipboardEvent&&e.clipboardData?.setData("application/x-lexical-editor",""),t}),!0},p.COMMAND_PRIORITY_LOW),n=[t],e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]),(0,s.useEffect)(r,n),null}function en(e){throw e}function eo(){let e=(0,x.c)(3),[t]=(0,m.useLexicalComposerContext)(),r,n;return e[0]!==t?(r=()=>(0,p.mergeRegister)(t.registerCommand(p.CLICK_COMMAND,eu,p.COMMAND_PRIORITY_LOW),t.registerCommand(p.KEY_DELETE_COMMAND,ec,p.COMMAND_PRIORITY_LOW),t.registerCommand(p.KEY_BACKSPACE_COMMAND,ec,p.COMMAND_PRIORITY_LOW),t.registerCommand(p.SELECTION_CHANGE_COMMAND,ed,p.COMMAND_PRIORITY_LOW),t.registerCommand(p.KEY_ARROW_UP_COMMAND,ea,p.COMMAND_PRIORITY_LOW),t.registerCommand(p.KEY_ARROW_DOWN_COMMAND,ei,p.COMMAND_PRIORITY_LOW)),n=[t],e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]),(0,s.useEffect)(r,n),null}function ei(e){let t=(0,p.$getSelection)();if((0,p.$isNodeSelection)(t)){e.preventDefault();let r=t.getNodes()[0]?.getNextSibling();if((0,p.$isDecoratorNode)(r)){let e=(0,p.$getEditor)().getElementByKey(r.getKey());return e&&em({element:e,node:r}),!0}if(!(0,p.$isElementNode)(r))return!0;let n=r.getFirstDescendant()??r;return n&&((0,p.$findMatchingParent)(n,ep)?.selectEnd(),e.preventDefault()),!0}if(!(0,p.$isRangeSelection)(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=(0,p.$findMatchingParent)(r,el),o=n?.getNextSibling();if(!n||o!==eg(n))return!1;if((0,p.$isDecoratorNode)(o)){let t=(0,p.$getEditor)().getElementByKey(o.getKey());if(t)return em({element:t,node:o}),e.preventDefault(),!0}return!1}function el(e){return null!==eg(e)}function ea(e){let t=(0,p.$getSelection)();if((0,p.$isNodeSelection)(t)){let r=t.getNodes()[0]?.getPreviousSibling();if((0,p.$isDecoratorNode)(r)){let t=(0,p.$getEditor)().getElementByKey(r.getKey());return!!t&&(em({element:t,node:r}),e.preventDefault(),!0)}if(!(0,p.$isElementNode)(r))return!1;let n=r.getLastDescendant()??r;return!!n&&((0,p.$findMatchingParent)(n,ep)?.selectStart(),e.preventDefault(),!0)}if(!(0,p.$isRangeSelection)(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=(0,p.$findMatchingParent)(r,es),o=n?.getPreviousSibling();if(!n||o!==eh(n))return!1;if((0,p.$isDecoratorNode)(o)){let t=(0,p.$getEditor)().getElementByKey(o.getKey());if(t)return em({element:t,node:o}),e.preventDefault(),!0}return!1}function es(e){return null!==eh(e)}function ed(){let e=function(){let e=(0,p.$getSelection)();if(!(0,p.$isNodeSelection)(e))return;let t=e.getNodes();if(1!==t.length)return;let r=t[0];return(0,p.$isDecoratorNode)(r)?{decorator:r,element:(0,p.$getEditor)().getElementByKey(r.getKey())}:void 0}();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),!!e&&(e.element?.classList.add("decorator-selected"),!0)}function eu(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=function(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let r=(0,p.$getNearestNodeFromDOMNode)(t);return(0,p.$isDecoratorNode)(r)?{element:t,node:r}:void 0}(e);if(!t)return!0;let{target:r}=e;return!(r instanceof HTMLElement)||r.isContentEditable||r.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?(0,p.$setSelection)(null):em(t),!0}function ec(e){let t=(0,p.$getSelection)();return!!(0,p.$isNodeSelection)(t)&&(e.preventDefault(),t.getNodes().forEach(ef),!0)}function ef(e){e.remove()}function em({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let r=(0,p.$createNodeSelection)();r.add(t.getKey()),(0,p.$setSelection)(r),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ep(e){if((0,p.$isDecoratorNode)(e)&&!e.isInline())return!0;if(!(0,p.$isElementNode)(e)||(0,p.$isRootOrShadowRoot)(e))return!1;let t=e.getFirstChild(),r=null===t||(0,p.$isLineBreakNode)(t)||(0,p.$isTextNode)(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&r}function eg(e){let t=e.getNextSibling();for(;null!==t;){if(ep(t))return t;t=t.getNextSibling()}return null}function eh(e){let t=e.getPreviousSibling();for(;null!==t;){if(ep(t))return t;t=t.getPreviousSibling()}return null}var ey=(e,t,r,n,o=50,i=25)=>{let l=0;if(e&&!e.contains(n)){let{bottom:n,left:a,right:s,top:d}=e.getBoundingClientRect(),u=d+window.scrollY,c=n+window.scrollY;if(r<u-i||r>c+i||t<a-o||t>s+o)return -1;(t<a||t>s)&&(l=t<a?t-a:t-s)}return l};function eE(e){let t=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue("transform");if(!r||"none"===r)return t;let n=r.split(",").pop();return t.y=t.y-Number(n?.replace(")","")),t}function ex(e){let t=(e,t)=>e?parseFloat(window.getComputedStyle(e)[t]):0,{marginBottom:r,marginTop:n}=window.getComputedStyle(e),o=t(e.previousElementSibling,"marginBottom"),i=t(e.nextElementSibling,"marginTop"),l=Math.max(parseFloat(n),o);return{marginBottom:Math.max(parseFloat(r),i),marginTop:l}}function eC(e){return e.getEditorState().read(()=>(0,p.$getRoot)().getChildrenKeys())}var eb={props:null,result:null};function ev(e){let{anchorElem:r,cache_threshold:n=20,editor:o,fuzzy:i=!1,horizontalOffset:l=0,point:{x:a,y:s},startIndex:d=0,useEdgeAsDefault:u=!1}=e;if(n>0&&eb.props&&eb.result&&eb.props.fuzzy===e.fuzzy&&eb.props.horizontalOffset===e.horizontalOffset&&eb.props.useEdgeAsDefault===e.useEdgeAsDefault&&function(e,t,r=20){let n=e.x-t.x,o=e.y-t.y;return n*n+o*o<=r*r}(eb.props.point,e.point,n))return eb.result;let c=r.getBoundingClientRect(),f=eC(o),m={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return o.getEditorState().read(()=>{if(u){let e=o.getElementByKey(f[0]),t=o.getElementByKey(f[f.length-1]);if(e&&t){let[r,n]=[eE(e),eE(t)];if(s<r.top?(m.blockElem=e,m.distance=r.top-s,m.blockNode=(0,p.$getNodeByKey)(f[0]),m.foundAtIndex=0):s>n.bottom&&(m.distance=s-n.bottom,m.blockNode=(0,p.$getNodeByKey)(f[f.length-1]),m.blockElem=t,m.foundAtIndex=f.length-1),m?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let r=d,n=0;for(;r>=0&&r<f.length;){let d=f[r],u=o.getElementByKey(d);if(null===u)break;let g=new t.f(a+l,s),h=t.k.fromDOMRect(eE(u)),{marginBottom:y,marginTop:E}=ex(u),{distance:x,isOnBottomSide:C,isOnTopSide:b}=h.generateNewRect({bottom:h.bottom+y,left:c.left,right:c.right,top:h.top-E}).distanceFromPoint(g);if(0===x){m.blockElem=u,m.blockNode=(0,p.$getNodeByKey)(d),m.foundAtIndex=r,m.distance=x,m.blockNode&&"paragraph"===m.blockNode.getType()&&""===m.blockNode.getTextContent()&&(i||e.returnEmptyParagraphs||(m.blockElem=null,m.blockNode=null),m.isFoundNodeEmptyParagraph=!0);break}i&&x<m.distance&&(m.blockElem=u,m.blockNode=(0,p.$getNodeByKey)(d),m.distance=x,m.foundAtIndex=r),0===n&&(n=b?-1:C?1:1/0),r+=n}}),eb.props=e,eb.result={blockElem:m.blockElem,blockNode:m.blockNode,foundAtIndex:m.foundAtIndex,isFoundNodeEmptyParagraph:m.isFoundNodeEmptyParagraph},{blockElem:m.blockElem,blockNode:m.blockNode,foundAtIndex:m.foundAtIndex,isFoundNodeEmptyParagraph:m.isFoundNodeEmptyParagraph}}function eN(e,t){return!!e.closest(`.${t}`)}var eS=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function e_(e,t,r,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let o=e.getBoundingClientRect(),i=window.getComputedStyle(e),l=t.getBoundingClientRect(),a=r.getBoundingClientRect(),s;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(t=>e.classList.contains(t)||e.firstElementChild?.classList.contains(t)))s=o.top+8-a.top;else{let t=!function(e){if(!e||eS.includes(e.tagName)||0===e.offsetHeight||0===e.offsetWidth)return!1;let t=window.getComputedStyle(e);return"table-cell"!==t.display&&"absolute"!==t.position&&"hidden"!==t.visibility&&"0"!==t.opacity}(e)?0:parseInt(i.lineHeight,10);s=o.top+(t-l.height)/2-a.top}t.style.opacity="1",t.style.transform=`translate(${n}px, ${s}px)`}var eO=1/0;function eR(e){let{anchorElem:o}=e,i=void 0===o?document.body:o,[l]=(0,m.useLexicalComposerContext)();return function(e,o,i){let l=o.parentElement,{editorConfig:a}=(0,r.b)(),d=a?.admin?.hideGutter?-24:12,u=(0,s.useRef)(null),[c,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{function r(r){var n;let i=r.target;if(!(0,p.isHTMLElement)(i))return;let a=ey(l,r.pageX,r.pageY,i);if(-1===a)return void f(null);if(eN(i,"add-block-menu"))return;let s=eC(e),{blockElem:d,blockNode:u,foundAtIndex:m}=ev({anchorElem:o,cache_threshold:0,editor:e,horizontalOffset:-a,point:new t.f(r.x,r.y),returnEmptyParagraphs:!0,startIndex:0===(n=s.length)?1/0:eO>=0&&eO<n?eO:Math.floor(n/2),useEdgeAsDefault:!1});eO=m,d&&u&&(c?.node!==u||c?.elem!==d)&&f({elem:d,node:u})}return document?.addEventListener("mousemove",r),()=>{document?.removeEventListener("mousemove",r)}},[l,o,e,c]),(0,s.useEffect)(()=>{u.current&&c?.node&&e_(c?.elem,u.current,o,d)},[o,c,d]);let m=(0,s.useCallback)(r=>{let n=c;n?.node&&(e.update(()=>{let t=!0;if((n?.node.getType()!=="paragraph"||""!==n.node.getTextContent())&&(t=!1),!t){let t=(0,p.$createParagraphNode)();n?.node.insertAfter(t),setTimeout(()=>{f(n={elem:e.getElementByKey(t.getKey()),node:t})},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),n?.node&&"select"in n.node&&"function"==typeof n.node.select&&n.node.select()})},1),setTimeout(()=>{e.dispatchCommand(t.i,{node:n?.node})},2),r.stopPropagation(),r.preventDefault())},[e,c]);return(0,j.createPortal)((0,n.jsx)(s.Fragment,{children:(0,n.jsx)("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:e=>{m(e)},ref:u,type:"button",children:(0,n.jsx)("div",{className:i?"icon":""})})}),o)}(l,i,l._editable)}var ew=0,eM="application/x-lexical-drag-block",ek=1/0;function eD(e){return 0===e?1/0:ek>=0&&ek<e?ek:Math.floor(e/2)}function eT(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function eA(e){let{anchorElem:o}=e,i=void 0===o?document.body:o,[l]=(0,m.useLexicalComposerContext)();return function(e,o,i){let l=o.parentElement,a=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useRef)(null),c=(0,s.useRef)(!1),[f,m]=(0,s.useState)(null),[g,h]=(0,s.useState)(null),{editorConfig:y}=(0,r.b)(),E=y?.admin?.hideGutter?-44:-8;return(0,s.useEffect)(()=>{function r(r){let n=r.target;if(!(0,p.isHTMLElement)(n))return;let i=ey(l,r.pageX,r.pageY,n);if(-1===i)return void m(null);if(eN(n,"draggable-block-menu"))return;let a=eC(e),{blockElem:s,foundAtIndex:d,isFoundNodeEmptyParagraph:u}=ev({anchorElem:o,cache_threshold:0,editor:e,horizontalOffset:-i,point:new t.f(r.x,r.y),startIndex:eD(a.length),useEdgeAsDefault:!1,verbose:!1});ek=d,(s||u)&&f!==s&&m(s)}return document?.addEventListener("mousemove",r),()=>{document?.removeEventListener("mousemove",r)}},[l,o,e,f]),(0,s.useEffect)(()=>{a.current&&e_(f,a.current,o,E)},[o,f,E]),(0,s.useEffect)(()=>{function r(r){if(!c.current)return!1;let[n]=(0,P.eventFiles)(r);if(n)return!1;let{pageY:i,target:s}=r;if(!(0,p.isHTMLElement)(s))return!1;let u=ey(l,r.pageX,r.pageY,s,100,50),m=eC(e),{blockElem:x,foundAtIndex:C,isFoundNodeEmptyParagraph:b}=ev({anchorElem:o,editor:e,fuzzy:!0,horizontalOffset:-u,point:new t.f(r.x,r.y),startIndex:eD(m.length),useEdgeAsDefault:!0,verbose:!0});ek=C;let v=d.current;if(null===x||null===v)return!1;if(f!==x){let{isBelow:e,willStayInSamePosition:t}=function(e,t,r,n,o,i,l,a,s,d=!1){let{height:u,top:c}=n.getBoundingClientRect(),{top:f,width:m}=l.getBoundingClientRect(),{marginBottom:p,marginTop:g}=ex(n),h=c,y=i>=c+u/2+window.scrollY,E=!1;if(o?.elem)if(n!==o?.elem)(y&&o?.elem&&o?.elem===n.nextElementSibling||!y&&o?.elem&&o?.elem===n.previousElementSibling)&&++ew<200&&(E=!0);else{ew++;let e=o?.boundingBox?.y,t=n.getBoundingClientRect().y;(y===o?.isBelow&&e===t||ew<200)&&(E=!1)}if(E)return{isBelow:y,willStayInSamePosition:E};d?h+=u/2:y?h+=u+p/2:h-=g/2;let x=0;d||(x=y?-0:0);let C=h-f+x;return r.style.width=`calc(${m}px - ${e})`,r.style.opacity=".8",r.style.transform=`translate(${-24-t}px, calc(${C}px - 2px))`,o?.elem&&(o.elem.style.opacity="",o?.elem===n?y?o.elem.style.marginTop="":o.elem.style.marginBottom="":(o.elem.style.marginBottom="",o.elem.style.marginTop="")),ew=0,{isBelow:y,willStayInSamePosition:E}}(y?.admin?.hideGutter?"0px":"3rem",E+(y?.admin?.hideGutter?a?.current?.getBoundingClientRect()?.width??0:-(a?.current?.getBoundingClientRect()?.width??0)),v,x,g,i,o,0,0,b);r.preventDefault(),t||h({boundingBox:x.getBoundingClientRect(),elem:x,isBelow:e})}else g?.elem&&(eT(v,g.elem),h({boundingBox:x.getBoundingClientRect(),elem:x,isBelow:!1}));return!0}function n(r){if(!c.current)return!1;let[n]=(0,P.eventFiles)(r);if(n)return!1;let{dataTransfer:i,pageY:a,target:s}=r,d=i?.getData(eM)||"";return e.update(()=>{let n=(0,p.$getNodeByKey)(d);if(!n||!(0,p.isHTMLElement)(s))return!1;let{blockElem:i,isFoundNodeEmptyParagraph:u}=ev({anchorElem:o,editor:e,fuzzy:!0,horizontalOffset:-ey(l,r.pageX,r.pageY,s,100,50),point:new t.f(r.x,r.y),useEdgeAsDefault:!0});if(!i)return!1;let c=(0,p.$getNearestNodeFromDOMNode)(i);if(!c)return!1;if(c===n)return!0;let{height:g,top:h}=eE(i),y=a>=h+g/2+window.scrollY;u?(c.insertBefore(n),c.remove()):y?c.insertAfter(n):c.insertBefore(n),null!==f&&m(null),document.querySelectorAll(".lexical-block-highlighter").forEach(e=>{e.remove()});let E=e.getElementByKey(n.getKey());setTimeout(()=>{let e=E?.getBoundingClientRect();if(!e)return;let t=document.createElement("div");t.className="lexical-block-highlighter",t.style.backgroundColor="var(--theme-elevation-1000",t.style.transition="opacity 0.5s ease-in-out",t.style.zIndex="1",t.style.pointerEvents="none",t.style.boxSizing="border-box",t.style.borderRadius="4px",t.style.position="absolute",document.body.appendChild(t),t.style.opacity="0.1",t.style.height=`${e.height+8}px`,t.style.width=`${e.width+8}px`,t.style.top=`${e.top+window.scrollY-4}px`,t.style.left=`${e.left-4}px`,setTimeout(()=>{t.style.opacity="0",setTimeout(()=>{t.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",r),document.addEventListener("drop",n),()=>{document.removeEventListener("dragover",r),document.removeEventListener("drop",n)}},[l,E,o,e,g,f,y?.admin?.hideGutter]),(0,j.createPortal)((0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:function(){c.current=!1,g?.elem&&eT(d.current,g?.elem)},onDragStart:function(t){let r=t.dataTransfer;if(!r||!f)return;!function(e,t){let{transform:r}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=r})}(r,f);let n="";e.update(()=>{let e=(0,p.$getNearestNodeFromDOMNode)(f);e&&(n=e.getKey())}),c.current=!0,r.setData(eM,n)},ref:a,type:"button",children:(0,n.jsx)("div",{className:i?"icon":""})}),(0,n.jsx)("div",{className:"draggable-block-target-line",ref:d}),(0,n.jsx)("div",{className:"debug-highlight",ref:u})]}),o)}(l,i,l._editable)}var eL="insert-paragraph-at-end",ej=()=>{let e,t=(0,x.c)(2),[o]=(0,m.useLexicalComposerContext)(),{editorConfig:i}=(0,r.b)();return i?.admin?.hideInsertParagraphAtEnd?null:(t[0]!==o?(e=(0,n.jsx)("div",{"aria-label":"Insert Paragraph",className:eL,onClick:()=>{o.update(e$)},role:"button",tabIndex:0,children:(0,n.jsx)("div",{className:`${eL}-inside`,children:(0,n.jsx)("span",{children:"+"})})}),t[0]=o,t[1]=e):e=t[1],e)};function e$(){let e=(0,p.$createParagraphNode)();(0,p.$getRoot)().append(e),e.select()}var eI=()=>{let e=(0,x.c)(4),{editorConfig:n}=(0,r.b)(),[o]=(0,m.useLexicalComposerContext)(),i,l;return e[0]!==o||e[1]!==n.features.markdownTransformers?(i=()=>(0,t.a)(o,n.features.markdownTransformers??[]),l=[o,n.features.markdownTransformers],e[0]=o,e[1]=n.features.markdownTransformers,e[2]=i,e[3]=l):(i=e[2],l=e[3]),s.useEffect(i,l),null};function eP(){let[e]=(0,m.useLexicalComposerContext)();return(0,s.useEffect)(()=>e.registerNodeTransform(p.RootNode,e=>{let t=(0,p.$getSelection)();if((0,p.$isRangeSelection)(t)){let r=t.anchor.getNode(),n=t.focus.getNode();r.isAttached()&&n.isAttached()||(e.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}function eB(){let[e]=(0,m.useLexicalComposerContext)();return(0,s.useEffect)(()=>e.registerCommand(p.SELECT_ALL_COMMAND,()=>{if((0,p.$getSelection)())return!1;let e=document.activeElement;return e instanceof HTMLInputElement&&e.select(),!0},p.COMMAND_PRIORITY_LOW),[e]),null}var eF="slash-menu-popup";function eK({isSelected:e,item:t,onClick:o,onMouseEnter:i,ref:l}){let{fieldProps:{featureClientSchemaMap:a,schemaPath:s}}=(0,r.b)(),{i18n:d}=(0,J.useTranslation)(),u=`${eF}__item ${eF}__item-${t.key}`;e&&(u+=` ${eF}__item--selected`);let c=t.key;return t.label&&(c="function"==typeof t.label?t.label({featureClientSchemaMap:a,i18n:d,schemaPath:s}):t.label),c.length>25&&(c=c.substring(0,25)+"..."),(0,n.jsxs)("button",{"aria-selected":e,className:u,id:eF+"__item-"+t.key,onClick:o,onMouseEnter:i,ref:l,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&(0,n.jsx)(t.Icon,{}),(0,n.jsx)("span",{className:`${eF}__item-text`,children:c})]},t.key)}function eY({anchorElem:e=document.body}){let[o]=(0,m.useLexicalComposerContext)(),[i,l]=(0,s.useState)(null),{editorConfig:a}=(0,r.b)(),{i18n:d}=(0,J.useTranslation)(),{fieldProps:{featureClientSchemaMap:u,schemaPath:c}}=(0,r.b)(),f=function(e,r){let n=(0,x.c)(4),{maxLength:o,minLength:i}=r,l=void 0===o?75:o,a=void 0===i?1:i,s;return n[0]!==l||n[1]!==a||"/"!==n[2]?(s=e=>{let{query:r}=e,n=RegExp("(^|\\s|\\()([/]((?:"+("[^/"+t.h+"\\s]")+"){0,"+l+"}))$").exec(r);if(null!==n){let e=n[1],t=n[3];if(t.length>=a)return{leadOffset:n.index+e.length,matchingString:t,replaceableString:n[2]}}return null},n[0]=l,n[1]=a,n[2]="/",n[3]=s):s=n[3],s}(0,{minLength:0}),p=(0,s.useCallback)(()=>{let e=[];for(let t of a.features.slashMenu.dynamicGroups)if(i){let r=t({editor:o,queryString:i});e=e.concat(r)}return e},[o,i,a?.features]),g=(0,s.useMemo)(()=>{let e=[];for(let t of a?.features.slashMenu.groups??[])e.push(t);if(i)for(let t of(e=(e=e.map(e=>{let t=e.items.filter(e=>{let t=e.key;return e.label&&(t="function"==typeof e.label?e.label({featureClientSchemaMap:u,i18n:d,schemaPath:c}):e.label),!!RegExp(i,"gi").exec(t)||null!=e.keywords&&e.keywords.some(e=>RegExp(i,"gi").exec(e))});return t.length?{...e,items:t}:null})).filter(e=>null!=e),p())){let r=e.find(e=>e.key===t.key);r?e=e.filter(e=>e.key!==t.key):r={...t,items:[]},r?.items?.length&&(r.items=r.items.concat(r.items)),e.push(r)}return e},[i,a?.features.slashMenu.groups,p,u,d,c]);return(0,n.jsx)(t.j,{anchorElem:e,groups:g,menuRenderFn:(e,{selectedItemKey:t,selectItemAndCleanUp:r,setSelectedItemKey:o})=>e.current&&g.length?j.createPortal((0,n.jsx)("div",{className:eF,children:g.map(e=>{let i=e.key;return e.label&&u&&(i="function"==typeof e.label?e.label({featureClientSchemaMap:u,i18n:d,schemaPath:c}):e.label),(0,n.jsxs)("div",{className:`${eF}__group ${eF}__group-${e.key}`,children:[(0,n.jsx)("div",{className:`${eF}__group-title`,children:i}),e.items.map((e,i)=>(0,n.jsx)(eK,{index:i,isSelected:t===e.key,item:e,onClick:()=>{o(e.key),r(e)},onMouseEnter:()=>{o(e.key)},ref:t=>{e.ref={current:t}}},e.key))]},e.key)})}),e.current):null,onQueryChange:l,triggerFn:f})}function ez(e){let t,r=(0,x.c)(6),{features:n}=e,[o]=(0,m.useLexicalComposerContext)(),i;return r[0]!==o||r[1]!==n.enabledFormats?(i=()=>{var e;let t,r,i=(e=n.enabledFormats,t=Object.keys(p.TEXT_TYPE_TO_FORMAT),r=new Set(e),t.filter(e=>!r.has(e)));if(0!==i.length)return o.registerNodeTransform(p.TextNode,e=>{i.forEach(t=>{e.hasFormat(t)&&e.toggleFormat(t)})})},r[0]=o,r[1]=n.enabledFormats,r[2]=i):i=r[2],r[3]!==o||r[4]!==n?(t=[o,n],r[3]=o,r[4]=n,r[5]=t):t=r[5],(0,s.useEffect)(i,t),null}function eH(e){let t=(0,x.c)(5),{className:r,editorConfig:o}=e,{t:i}=(0,J.useTranslation)(),[,l]=(0,m.useLexicalComposerContext)(),{getTheme:a}=l,s;if(t[0]!==r||t[1]!==o?.admin?.placeholder||t[2]!==a||t[3]!==i){let e=a();s=(0,n.jsx)(Q,{"aria-placeholder":i("lexical:general:placeholder"),className:r??"ContentEditable__root",placeholder:(0,n.jsx)("p",{className:e?.placeholder,children:o?.admin?.placeholder??i("lexical:general:placeholder")})}),t[0]=r,t[1]=o?.admin?.placeholder,t[2]=a,t[3]=i,t[4]=s}else s=t[4];return s}var eU=e=>{let t,o=(0,x.c)(13),{editorConfig:i,editorContainerRef:l,isSmallWidthViewport:a,onChange:d,rtl:u}=e,c=(0,r.b)(),[f]=(0,m.useLexicalComposerContext)(),g=(0,A.useLexicalEditable)(),[h,y]=(0,s.useState)(null),E;o[0]===Symbol.for("react.memo_cache_sentinel")?(E=e=>{null!==e&&y(e)},o[0]=E):E=o[0];let C=E,b,v;return o[1]!==f||o[2]!==c?(b=()=>{if(!c?.uuid)return void console.error("Lexical Editor must be used within an EditorConfigProvider");c?.parentEditor?.uuid&&c.parentEditor?.registerChild(c.uuid,c);let e=f.registerCommand(p.FOCUS_COMMAND,()=>(c.focusEditor(c),!0),p.COMMAND_PRIORITY_LOW),t=f.registerCommand(p.BLUR_COMMAND,()=>(c.blurEditor(c),!0),p.COMMAND_PRIORITY_LOW);return()=>{e(),t(),c.parentEditor?.unregisterChild?.(c.uuid)}},v=[f,c],o[1]=f,o[2]=c,o[3]=b,o[4]=v):(b=o[3],v=o[4]),(0,s.useEffect)(b,v),o[5]!==i||o[6]!==l||o[7]!==h||o[8]!==g||o[9]!==a||o[10]!==d||o[11]!==u?(t=(0,n.jsxs)(s.Fragment,{children:[i.features.plugins?.map(eG),(0,n.jsxs)("div",{className:"editor-container",dir:u?"rtl":void 0,ref:l,children:[i.features.plugins?.map(eW),(0,n.jsx)(z,{contentEditable:(0,n.jsx)("div",{className:"editor-scroller",children:(0,n.jsx)("div",{className:"editor",ref:C,children:(0,n.jsx)(eH,{editorConfig:i})})}),ErrorBoundary:S}),(0,n.jsx)(eP,{}),g&&(0,n.jsx)(ej,{}),(0,n.jsx)(eo,{}),(0,n.jsx)(er,{}),(0,n.jsx)(ez,{features:i.features}),(0,n.jsx)(eB,{}),g&&(0,n.jsx)(T,{ignoreSelectionChange:!0,onChange:(e,t,r)=>{(!r.has("focus")||r.size>1)&&d?.(e,t,r)}}),h&&(0,n.jsxs)(s.Fragment,{children:[!a&&g&&(0,n.jsxs)(s.Fragment,{children:[i.admin?.hideDraggableBlockElement?null:(0,n.jsx)(eA,{anchorElem:h}),i.admin?.hideAddBlockButton?null:(0,n.jsx)(eR,{anchorElem:h})]}),i.features.plugins?.map(e=>{if("floatingAnchorElem"===e.position&&!(!0===e.desktopOnly&&a))return(0,n.jsx)(ee,{anchorElem:h,clientProps:e.clientProps,plugin:e},e.key)}),g&&(0,n.jsx)(s.Fragment,{children:(0,n.jsx)(eY,{anchorElem:h})})]}),g&&(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)(k,{}),i?.features?.markdownTransformers?.length>0&&(0,n.jsx)(eI,{})]}),i.features.plugins?.map(eJ),i.features.plugins?.map(eq)]}),i.features.plugins?.map(eV)]}),o[5]=i,o[6]=l,o[7]=h,o[8]=g,o[9]=a,o[10]=d,o[11]=u,o[12]=t):t=o[12],t};function eG(e){if("aboveContainer"===e.position)return(0,n.jsx)(ee,{clientProps:e.clientProps,plugin:e},e.key)}function eW(e){if("top"===e.position)return(0,n.jsx)(ee,{clientProps:e.clientProps,plugin:e},e.key)}function eJ(e){if("normal"===e.position)return(0,n.jsx)(ee,{clientProps:e.clientProps,plugin:e},e.key)}function eq(e){if("bottom"===e.position)return(0,n.jsx)(ee,{clientProps:e.clientProps,plugin:e},e.key)}function eV(e){if("belowContainer"===e.position)return(0,n.jsx)(ee,{clientProps:e.clientProps,plugin:e},e.key)}var eX=({children:e,providers:t})=>{if(!t?.length)return e;let r=t[0];return t.length>1?(0,n.jsx)(r,{children:(0,n.jsx)(eX,{providers:t.slice(1),children:e})}):(0,n.jsx)(r,{children:e})},eQ=e=>{let{composerKey:i,editorConfig:l,fieldProps:a,isSmallWidthViewport:d,onChange:u,readOnly:c,rtl:f,value:m}=e,p=(0,r.b)(),g=(0,o.useEditDepth)(),h=s.useRef(null),y=(0,s.useMemo)(()=>{if(m&&"object"!=typeof m)throw Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(m));if(m&&Array.isArray(m)&&!("root"in m))throw Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(m&&"jsonContent"in m)throw Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:!0!==c,editorState:null!=m?JSON.stringify(m):void 0,namespace:l.lexical.namespace,nodes:(0,t.l)({editorConfig:l}),onError:e=>{throw e},theme:l.lexical.theme}},[l]);return y?(0,n.jsx)(E,{initialConfig:y,children:(0,n.jsx)(r.a,{editorConfig:l,editorContainerRef:h,fieldProps:a,parentContext:p?.editDepth===g?p:void 0,children:(0,n.jsx)(eX,{providers:l.features.providers,children:(0,n.jsx)(eU,{editorConfig:l,editorContainerRef:h,isSmallWidthViewport:d,onChange:u,rtl:f})})})},i+y.editable):(0,n.jsx)("p",{children:"Loading..."})},eZ="rich-text-lexical";function e0({error:e}){return(0,n.jsxs)("div",{className:"errorBoundary",role:"alert",children:[(0,n.jsx)("p",{children:"Something went wrong:"}),(0,n.jsx)("pre",{style:{color:"red"},children:e.message})]})}var e1=e=>{let{editorConfig:r,field:d,field:{admin:{className:u,description:c,readOnly:m}={},label:p,localized:g,required:h},path:y,readOnly:E,validate:x}=e,C=(0,o.useLocale)(),{config:{localization:b}}=(0,i.useConfig)(),v=(0,o.isFieldRTL)({fieldLocalized:g,locale:C,localizationConfig:b||void 0}),N=(0,o.useEditDepth)(),S=(0,s.useCallback)((e,t)=>"function"!=typeof x||x(e,{...t,required:h}),[x,h]),{customComponents:{AfterInput:_,BeforeInput:O,Description:R,Error:w,Label:M}={},disabled:k,initialValue:D,path:T,setValue:A,showError:L,value:j}=(0,o.useField)({potentiallyStalePath:y,validate:S}),$=E||m||k,[I,P]=(0,s.useState)(!1),[B,F]=(0,s.useState)(),K=s.default.useRef(D),Y=s.default.useRef(j);(0,s.useEffect)(()=>{let e=()=>{let e=window.matchMedia("(max-width: 768px)").matches;e!==I&&P(e)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[I]);let z=[eZ,"field-type",u,L&&"error",$&&`${eZ}--read-only`,r?.admin?.hideGutter!==!0&&!I?`${eZ}--show-gutter`:null].filter(Boolean).join(" "),H=`${T}.${N}`,U=(0,t.e)(),G=(0,s.useCallback)(e=>{U(()=>{let t=e.toJSON();Y.current=t,A(t)})},[A,U]),W=(0,s.useMemo)(()=>(0,l.mergeFieldStyles)(d),[d]),J=(0,o.useEffectEvent)(e=>{Y.current===j||(0,a.dequal)(null!=Y.current?JSON.parse(JSON.stringify(Y.current)):Y.current,j)||(K.current=e,Y.current=j,F(new Date))});return(0,s.useEffect)(()=>{Object.is(D,K.current)||J(D)},[D]),(0,n.jsxs)("div",{className:z,style:W,children:[(0,n.jsx)(o.RenderCustomComponent,{CustomComponent:w,Fallback:(0,n.jsx)(o.FieldError,{path:T,showError:L})}),M||(0,n.jsx)(o.FieldLabel,{label:p,localized:g,path:T,required:h}),(0,n.jsxs)("div",{className:`${eZ}__wrap`,children:[(0,n.jsxs)(f,{fallbackRender:e0,onReset:()=>{},children:[O,(0,n.jsx)(o.BulkUploadProvider,{drawerSlugPrefix:T,children:(0,n.jsx)(eQ,{composerKey:H,editorConfig:r,fieldProps:e,isSmallWidthViewport:I,onChange:G,readOnly:$,rtl:v,value:j},JSON.stringify({path:T,rerenderProviderKey:B}))}),_]}),(0,n.jsx)(o.RenderCustomComponent,{CustomComponent:R,Fallback:(0,n.jsx)(o.FieldDescription,{description:c,path:T})})]})]},H)};e.s(["RichText",()=>e1],206093)}]);
|
|
|
|
//# debugId=9a4da490-a497-2264-52d1-3febbf9a9c58
|