mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-09 10:25:40 +00:00
21 lines
274 KiB
JavaScript
21 lines
274 KiB
JavaScript
// See the "/licenses" URI for full package license details
|
|
function I(o){return __DEV__?{type:o}:{}}var ve=I("SELECTION_CHANGE_COMMAND"),jn=I("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Jn=I("CLICK_COMMAND"),Ze=I("DELETE_CHARACTER_COMMAND"),It=I("INSERT_LINE_BREAK_COMMAND"),$t=I("INSERT_PARAGRAPH_COMMAND"),rt=I("CONTROLLED_TEXT_INSERTION_COMMAND"),oo=I("PASTE_COMMAND"),ln=I("REMOVE_TEXT_COMMAND"),Tt=I("DELETE_WORD_COMMAND"),it=I("DELETE_LINE_COMMAND"),Ne=I("FORMAT_TEXT_COMMAND"),no=I("UNDO_COMMAND"),ro=I("REDO_COMMAND"),Ms=I("KEYDOWN_COMMAND"),So=I("KEY_ARROW_RIGHT_COMMAND"),vs=I("MOVE_TO_END"),Lo=I("KEY_ARROW_LEFT_COMMAND"),ws=I("MOVE_TO_START"),Mo=I("KEY_ARROW_UP_COMMAND"),Pt=I("KEY_ARROW_DOWN_COMMAND"),Fe=I("KEY_ENTER_COMMAND"),Qn=I("KEY_SPACE_COMMAND"),Bt=I("KEY_BACKSPACE_COMMAND"),vo=I("KEY_ESCAPE_COMMAND"),Ft=I("KEY_DELETE_COMMAND"),wo=I("KEY_TAB_COMMAND"),Ds=I("INSERT_TAB_COMMAND"),eh=I("INDENT_CONTENT_COMMAND"),th=I("OUTDENT_CONTENT_COMMAND"),Do=I("DROP_COMMAND"),Os=I("FORMAT_ELEMENT_COMMAND"),er=I("DRAGSTART_COMMAND"),tr=I("DRAGOVER_COMMAND"),As=I("DRAGEND_COMMAND"),io=I("COPY_COMMAND"),so=I("CUT_COMMAND"),an=I("SELECT_ALL_COMMAND"),Rs=I("CLEAR_EDITOR_COMMAND"),ks=I("CLEAR_HISTORY_COMMAND"),lo=I("CAN_REDO_COMMAND"),ao=I("CAN_UNDO_COMMAND"),or=I("FOCUS_COMMAND"),Is=I("BLUR_COMMAND"),$s=I("KEY_MODIFIER_COMMAND");var fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var oh=fe&&"documentMode"in document?document.documentMode:null,He=fe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ke=fe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),co=fe&&"InputEvent"in window&&!oh?"getTargetRanges"in new window.InputEvent("input"):!1,Ht=fe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),_t=fe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qa=fe&&/Android/.test(navigator.userAgent),Ps=fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Bs=fe&&Qa&&Ps,Kt=fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ps;var uo=1,Ue=3,Ct=0,Fs=1,Ut=2,ec=0,jr=1,Jr=2,nr=1,rr=2,cn=4,dn=8,ir=16,sr=32,lr=64,ar=128,Hs=nr|rr|cn|dn|ir|sr|lr|ar,Qr=1,un=2,nh=1,rh=2,ih=3,sh=4,lh=5,ah=6,tc="\xA0",ch="\u200B",fn=Ht||_t||Kt?tc:ch,Ve=`
|
|
|
|
`,oc=Ke?tc:fn,nc="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",rc="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",dh=new RegExp("^[^"+rc+"]*["+nc+"]"),uh=new RegExp("^[^"+nc+"]*["+rc+"]"),Xe={bold:nr,code:ir,highlight:ar,italic:rr,strikethrough:cn,subscript:sr,superscript:lr,underline:dn},ic={directionless:Qr,unmergeable:un};var aT={[rh]:"center",[ah]:"end",[sh]:"justify",[nh]:"left",[ih]:"right",[lh]:"start"},sc={normal:ec,segmented:Jr,token:jr},lc={[ec]:"normal",[Jr]:"segmented",[jr]:"token"};function x(o,e,...t){if(!o)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+e)}function yt(...o){let e=[];for(let t of o)if(t&&typeof t=="string")for(let[n]of t.matchAll(/\S+/g))e.push(n);return e}var fh=100,Us=!1,zs=0;function ac(){return Us}function mh(o){zs=o.timeStamp}function ph(o){zs===0&&mn(o).addEventListener("textInput",mh,!0)}function Ks(o,e,t){return e.__lexicalLineBreak===o||o[`__lexicalKey_${t._key}`]!==void 0}function gh(o){return o.getEditorState().read(()=>{let e=T();return e!==null?e.clone():null})}function hh(o,e,t){let n=ye(t._window),r=null,i=null;n!==null&&n.anchorNode===o&&(r=n.anchorOffset,i=n.focusOffset);let s=o.nodeValue;s!==null&&cr(e,s,r,i,!1)}function Nh(o,e,t){return e.nodeType===Ue&&t.isAttached()}function cc(o,e,t){Us=!0;let n=performance.now()-zs>fh;try{xe(o,()=>{let r=T()||gh(o),i=new Map,s=o.getRootElement(),l=o._editorState,a=o._blockCursorElement,c=!1,m="";for(let d=0;d<e.length;d++){let u=e[d],p=u.type,g=u.target,h=ee(g,l);if(!(h===null&&g!==s||B(h))){if(p==="characterData")n&&b(h)&&Nh(r,g,h)&&hh(g,h,o);else if(p==="childList"){c=!0;let _=u.addedNodes;for(let M=0;M<_.length;M++){let S=_[M],A=Ws(S),O=S.parentNode;if(O!=null&&S!==a&&A===null&&(S.nodeName!=="BR"||!Ks(S,O,o))){if(Ke){let R=S.innerText||S.nodeValue;R&&(m+=R)}O.removeChild(S)}}let N=u.removedNodes,L=N.length;if(L>0){let M=0;for(let S=0;S<L;S++){let A=N[S];(A.nodeName==="BR"&&Ks(A,g,o)||a===A)&&(g.appendChild(A),M++)}L!==M&&(g===s&&(h=qs(l)),i.set(g,h))}}}}if(i.size>0)for(let[d,u]of i)if(E(u)){let p=u.getChildrenKeys(),g=d.firstChild;for(let h=0;h<p.length;h++){let _=p[h],N=o.getElementByKey(_);N!==null&&(g==null?(d.appendChild(N),g=N):g!==N&&d.replaceChild(N,g),g=g.nextSibling)}}else b(u)&&u.markDirty();let f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){let u=f[d],p=u.addedNodes,g=u.target;for(let h=0;h<p.length;h++){let _=p[h],N=_.parentNode;N!=null&&_.nodeName==="BR"&&!Ks(_,g,o)&&N.removeChild(_)}}t.takeRecords()}r!==null&&(c&&(r.dirty=!0,q(r)),Ke&&oi(o)&&r.insertRawText(m))})}finally{Us=!1}}function ei(o){let e=o._observer;if(e!==null){let t=e.takeRecords();cc(o,t,e)}}function ti(o){ph(o),o._observer=new MutationObserver((e,t)=>{cc(o,e,t)})}function dc(o,e){let t=o.__mode,n=o.__format,r=o.__style,i=e.__mode,s=e.__format,l=e.__style;return(t===null||t===i)&&(n===null||n===s)&&(r===null||r===l)}function uc(o,e){let t=o.mergeWithSibling(e),n=G()._normalizedNodes;return n.add(o.__key),n.add(e.__key),t}function Ys(o){let e=o;if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable()){e.remove();return}let t;for(;(t=e.getPreviousSibling())!==null&&b(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else if(dc(t,e)){e=uc(t,e);break}else break;let n;for(;(n=e.getNextSibling())!==null&&b(n)&&n.isSimpleText()&&!n.isUnmergeable();)if(n.__text==="")n.remove();else if(dc(e,n)){e=uc(e,n);break}else break}function Oo(o){return fc(o.anchor),fc(o.focus),o}function fc(o){for(;o.type==="element";){let e=o.getNode(),t=o.offset,n,r;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),r=!0):(n=e.getChildAtIndex(t),r=!1),b(n)){o.set(n.__key,r?n.getTextContentSize():0,"text");break}else if(!E(n))break;o.set(n.__key,r?n.getChildrenSize():0,"element")}}var xh=1;function Eh(){return""+xh++}function gc(o,e){let t=o._nodes.get(e);return t===void 0&&x(!1,"registeredNode: Type %s not found",e),t}var kT=Array.isArray,hc=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)};function Nc(o){return B(ee(o))}function Nn(o){let e=document.activeElement;if(e===null)return!1;let t=e.nodeName;return B(ee(o))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Ao(e)==null)}function zt(o,e,t){let n=o.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Nn(e)&&ni(e)===o}catch{return!1}}function xn(o){return o instanceof po}function ni(o){let e=o;for(;e!=null;){let t=Ao(e);if(xn(t))return t;e=ai(e)}return null}function Ao(o){return o?o.__lexicalEditor:null}function ze(o){return o.isToken()||o.isSegmented()}function Th(o){return o.nodeType===Ue}function En(o){let e=o;for(;e!=null;){if(Th(e))return e;e=e.firstChild}return null}function ur(o,e,t){let n=Xe[e];if(t!==null&&(o&n)===(t&n))return o;let r=o^n;return e==="subscript"?r&=~Xe.superscript:e==="superscript"&&(r&=~Xe.subscript),r}function fr(o){return b(o)||we(o)||B(o)}function xc(o,e){if(e!=null){__DEV__&&_h(o,e),o.__key=e;return}ce(),ol();let t=G(),n=je(),r=Eh();n._nodeMap.set(r,o),E(o)?t._dirtyElements.set(r,!0):t._dirtyLeaves.add(r),t._cloneNotNeeded.add(r),t._dirtyType=Fs,o.__key=r}function _h(o,e){let t=nd();if(!t)return;let n=t._nodeMap.get(e);n&&n.constructor!==o.constructor&&(o.constructor.name!==n.constructor.name?x(!1,"Lexical node with constructor %s attempted to re-use key from node in active editor state with constructor %s. Keys must not be re-used when the type is changed.",o.constructor.name,n.constructor.name):x(!1,"Lexical node with constructor %s attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.",o.constructor.name))}function Ch(o,e,t){let n=o;for(;n!==null;){if(t.has(n))return;let r=e.get(n);if(r===void 0)break;t.set(n,!1),n=r.__parent}}function Wt(o){let e=o.getParent();if(e!==null){let t=o.getWritable(),n=e.getWritable(),r=o.getPreviousSibling(),i=o.getNextSibling();if(r===null)if(i!==null){let s=i.getWritable();n.__first=i.__key,s.__prev=null}else n.__first=null;else{let s=r.getWritable();if(i!==null){let l=i.getWritable();l.__prev=s.__key,s.__next=l.__key}else s.__next=null;t.__prev=null}if(i===null)if(r!==null){let s=r.getWritable();n.__last=r.__key,s.__next=null}else n.__last=null;else{let s=i.getWritable();if(r!==null){let l=r.getWritable();l.__next=s.__key,s.__prev=l.__key}else s.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function dr(o){ol();let e=o.getLatest(),t=e.__parent,n=je(),r=G(),i=n._nodeMap,s=r._dirtyElements;t!==null&&Ch(t,i,s);let l=e.__key;r._dirtyType=Fs,E(o)?s.set(l,!0):r._dirtyLeaves.add(l)}function Ec(o){let e=o.getPreviousSibling(),t=o.getNextSibling();e!==null&&dr(e),t!==null&&dr(t)}function se(o){ce();let e=G(),t=e._compositionKey;if(o!==t){if(e._compositionKey=o,t!==null){let n=j(t);n!==null&&n.getWritable()}if(o!==null){let n=j(o);n!==null&&n.getWritable()}}}function Ge(){return st()?null:G()._compositionKey}function j(o,e){let n=(e||je())._nodeMap.get(o);return n===void 0?null:n}function Ws(o,e){let t=G(),n=o[`__lexicalKey_${t._key}`];return n!==void 0?j(n,e):null}function ee(o,e){let t=o;for(;t!=null;){let n=Ws(t,e);if(n!==null)return n;t=ai(t)}return null}function ri(o){let e=o._decorators,t=Object.assign({},e);return o._pendingDecorators=t,t}function Vs(o){return o.read(()=>F().getTextContent())}function Tc(o,e){xe(o,()=>{let t=je();if(t.isEmpty())return;if(e==="root"){F().markDirty();return}let n=t._nodeMap;for(let[,r]of n)r.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0)}function F(){return qs(je())}function qs(o){return o._nodeMap.get("root")}function q(o){ce();let e=je();o!==null&&(__DEV__&&Object.isFrozen(o)&&x(!1,"$setSelection called on frozen selection object. Ensure selection is cloned before passing in."),o.dirty=!0,o.setCachedNodes(null)),e._selection=o}function _c(){ce();let o=G();ei(o)}function Ro(o){let e=G(),t=yh(o,e);if(t===null){let n=e.getRootElement();return o===n?j("root"):null}return j(t)}function Xs(o,e){return e?o.getTextContentSize():0}function yh(o,e){let t=o;for(;t!=null;){let n=t[`__lexicalKey_${e._key}`];if(n!==void 0)return n;t=ai(t)}return null}function ii(o){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(o)}function mr(o){let e=[],t=o;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Gs(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function js(o){return o.nodeType===Ue?o.nodeValue:null}function si(o,e,t){let n=ye(e._window);if(n===null)return;let r=n.anchorNode,{anchorOffset:i,focusOffset:s}=n;if(r!==null){let l=js(r),a=ee(r);if(l!==null&&b(a)){if(l===fn&&t){let c=t.length;l=t,i=c,s=c}l!==null&&cr(a,l,i,s,o)}}}function cr(o,e,t,n,r){let i=o;if(i.isAttached()&&(r||!i.isDirty())){let s=i.isComposing(),l=e;(s||r)&&e[e.length-1]===fn&&(l=e.slice(0,-1));let a=i.getTextContent();if(r||l!==a){if(l===""){if(se(null),!Ht&&!_t&&!Kt){let g=G();setTimeout(()=>{g.update(()=>{i.isAttached()&&i.remove()})},20)}else i.remove();return}let c=i.getParent(),m=We(),f=i.getTextContentSize(),d=Ge(),u=i.getKey();if(i.isToken()||d!==null&&u===d&&!s||C(m)&&(c!==null&&!c.canInsertTextBefore()&&m.anchor.offset===0||m.anchor.key===o.__key&&m.anchor.offset===0&&!i.canInsertTextBefore()&&!s||m.focus.key===o.__key&&m.focus.offset===f&&!i.canInsertTextAfter()&&!s)){i.markDirty();return}let p=T();if(!C(p)||t===null||n===null){i.setTextContent(l);return}if(p.setTextNodeRange(i,t,i,n),i.isSegmented()){let g=i.getTextContent(),h=Y(g);i.replace(h),i=h}i.setTextContent(l)}}}function bh(o){let e=o.getPreviousSibling();return(b(e)||E(e)&&e.isInline())&&!e.canInsertTextAfter()}function Cc(o,e){if(e.isSegmented())return!0;if(!o.isCollapsed())return!1;let t=o.anchor.offset,n=e.getParentOrThrow(),r=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||r||bh(e):t===e.getTextContentSize()?!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||r:!1}function yc(o,e,t,n){return o==="Tab"&&!e&&!t&&!n}function bc(o,e,t,n){return o.toLowerCase()==="b"&&!e&&pr(t,n)}function Sc(o,e,t,n){return o.toLowerCase()==="i"&&!e&&pr(t,n)}function Lc(o,e,t,n){return o.toLowerCase()==="u"&&!e&&pr(t,n)}function Mc(o,e){return Gc(o)&&!e}function vc(o,e){return Gc(o)&&e}function wc(o,e){return He&&e&&o.toLowerCase()==="o"}function Dc(o,e,t){return pn(o)&&(He?e:t)}function Oc(o,e,t){return gn(o)&&(He?e:t)}function Ac(o,e){return He&&e&&pn(o)}function Rc(o,e){return He&&e&&gn(o)}function kc(o,e,t,n){return He?e||t?!1:pn(o)||o.toLowerCase()==="h"&&n:n||e||t?!1:pn(o)}function Ic(o,e,t,n,r){return He?t||n||r?!1:gn(o)||o.toLowerCase()==="d"&&e:e||n||r?!1:gn(o)}function $c(o,e,t,n){return o.toLowerCase()==="z"&&!e&&pr(t,n)}function Pc(o,e,t,n){return He?o.toLowerCase()==="z"&&t&&e:o.toLowerCase()==="y"&&n||o.toLowerCase()==="z"&&n&&e}function Bc(o,e,t,n){return e?!1:o.toLowerCase()==="c"?He?t:n:!1}function Fc(o,e,t,n){return e?!1:o.toLowerCase()==="x"?He?t:n:!1}function Hc(o){return o==="ArrowLeft"}function Kc(o){return o==="ArrowRight"}function Sh(o){return o==="ArrowUp"}function Lh(o){return o==="ArrowDown"}function Uc(o,e,t,n){return Hc(o)&&!e&&!n&&!t}function zc(o,e,t,n,r){return Hc(o)&&!n&&!t&&(e||r)}function Wc(o,e,t,n){return Kc(o)&&!e&&!n&&!t}function qc(o,e,t,n,r){return Kc(o)&&!n&&!t&&(e||r)}function Yc(o,e,t){return Sh(o)&&!e&&!t}function Zc(o,e,t){return Lh(o)&&!e&&!t}function Vc(o,e,t,n){return o||e||t||n}function Xc(o){return o===" "}function pr(o,e){return He?o:e}function Gc(o){return o==="Enter"}function pn(o){return o==="Backspace"}function jc(o){return o==="Escape"}function gn(o){return o==="Delete"}function Js(o,e,t){return o.toLowerCase()==="a"&&pr(e,t)}function Qs(){let o=F(),e=o.select(0,o.getChildrenSize());q(Oo(e))}function fo(o,e){o.__lexicalClassNameCache===void 0&&(o.__lexicalClassNameCache={});let t=o.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;let r=o[e];if(typeof r=="string"){let i=yt(r);return t[e]=i,i}return r}function li(o,e,t,n,r){if(t.size===0)return;let i=n.__type,s=n.__key,l=e.get(i);l===void 0&&x(!1,"Type %s not in registeredNodes",i);let a=l.klass,c=o.get(a);c===void 0&&(c=new Map,o.set(a,c));let m=c.get(s),f=m==="destroyed"&&r==="created";(m===void 0||f)&&c.set(s,f?"updated":r)}function mc(o,e,t){let n=o.getParent(),r=t,i=o;return n!==null&&(e&&t===0?(r=i.getIndexWithinParent(),i=n):!e&&t===i.getChildrenSize()&&(r=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?r-1:r)}function qt(o,e){let t=o.offset;if(o.type==="element"){let n=o.getNode();return mc(n,e,t)}else{let n=o.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){let r=e?n.getPreviousSibling():n.getNextSibling();return r===null?mc(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):r}}return null}function oi(o){let e=mn(o).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function D(o,e,t){return nl(o,e,t)}function gr(o){return!te(o)&&!o.isLastChild()&&!o.isInline()}function Tn(o,e){let t=o._keyToDOMMap.get(e);return t===void 0&&x(!1,"Reconciliation: could not find DOM element for node key %s",e),t}function ai(o){let e=o.assignedSlot||o.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Jc(o,e,t){let n=t.ownerDocument,r=n.defaultView;if(r===null)return;let{top:i,bottom:s}=e,l=0,a=0,c=t;for(;c!==null;){let m=c===n.body;if(m)l=0,a=mn(o).innerHeight;else{let d=c.getBoundingClientRect();l=d.top,a=d.bottom}let f=0;if(i<l?f=-(l-i):s>a&&(f=s-a),f!==0)if(m)r.scrollBy(0,f);else{let d=c.scrollTop;c.scrollTop+=f;let u=c.scrollTop-d;i-=u,s-=u}if(m)break;c=ai(c)}}function Qc(o){let e=T();if(!C(e)||!E(o))return e;let{anchor:t,focus:n}=e,r=t.getNode(),i=n.getNode();return hn(r,o)&&t.set(o.__key,0,"element"),hn(i,o)&&n.set(o.__key,0,"element"),e}function hn(o,e){let t=o.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ed(o){let e=o.ownerDocument;return e&&e.defaultView||null}function mn(o){let e=o._window;return e===null&&x(!1,"window object not found"),e}function el(o){let e=o.getParentOrThrow();for(;e!==null;){if(me(e))return e;e=e.getParentOrThrow()}return e}var IT=Symbol.for("@lexical/ShadowRootNodeBrand");function me(o){return te(o)||E(o)&&o.isShadowRoot()}function oe(o){let e=G(),t=o.constructor.getType(),n=e._nodes.get(t);n===void 0&&x(!1,'$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.');let r=n.replace;if(r!==null){let i=r(o);return i instanceof o.constructor||x(!1,"$initializeNode failed. Ensure replacement node is a subclass of the original node."),i}return o}function ci(o,e){let t=o.getParent();te(t)&&!E(e)&&!B(e)&&x(!1,"Only element or decorator nodes can be inserted in to the root node")}function Mh(o){let e=o.theme,t=document.createElement("div");t.contentEditable="false",t.setAttribute("data-lexical-cursor","true");let n=e.blockCursor;if(n!==void 0){if(typeof n=="string"){let r=yt(n);n=e.blockCursor=r}n!==void 0&&t.classList.add(...n)}return t}function Zs(o){return(B(o)||E(o)&&!o.canBeEmpty())&&!o.isInline()}function hr(o,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;let n=o.parentElement;n!==null&&n.removeChild(o)}function td(o,e,t){let n=o._blockCursorElement;if(C(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){let r=t.anchor,i=r.getNode(),s=r.offset,l=i.getChildrenSize(),a=!1,c=null;if(s===l){let m=i.getChildAtIndex(s-1);Zs(m)&&(a=!0)}else{let m=i.getChildAtIndex(s);if(Zs(m)){let f=m.getPreviousSibling();(f===null||Zs(f))&&(a=!0,c=o.getElementByKey(m.__key))}}if(a){let m=o.getElementByKey(i.__key);n===null&&(o._blockCursorElement=n=Mh(o._config)),e.style.caretColor="transparent",c===null?m.appendChild(n):m.insertBefore(n,c);return}}n!==null&&hr(n,o,e)}function ye(o){return fe?(o||window).getSelection():null}function di(o){return pe(o)&&o.tagName==="A"}function pe(o){return o.nodeType===1}function ko(o){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return o.nodeName.match(e)!==null}function mo(o){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return o.nodeName.match(e)!==null}function Io(o){if(te(o)||B(o)&&!o.isInline())return!0;if(!E(o)||me(o))return!1;let e=o.getFirstChild(),t=e===null||we(e)||b(e)||e.isInline();return!o.isInline()&&o.canBeEmpty()!==!1&&t}function ui(o,e){let t=o;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function tl(){return G()}var pc=new WeakMap,vh=new Map;function od(o){if(!o._readOnly&&o.isEmpty())return vh;x(o._readOnly,"getCachedTypeToNodeMap called with a writable EditorState");let e=pc.get(o);if(!e){e=new Map,pc.set(o,e);for(let[t,n]of o._nodeMap){let r=n.__type,i=e.get(r);i||(i=new Map,e.set(r,i)),i.set(t,n)}}return e}function Yt(o){let e=o.constructor,t=e.clone(o);return t.afterCloneFrom(o),__DEV__&&(x(t.__key===o.__key,"$cloneWithProperties: %s.clone(node) (with type '%s') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor",e.name,e.getType()),x(t.__parent===o.__parent&&t.__next===o.__next&&t.__prev===o.__prev,"$cloneWithProperties: %s.clone(node) (with type '%s') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)",e.name,e.getType())),t}function rd(o,e){let t=o._decorators,r=o._pendingDecorators||t,i=e._nodeMap,s;for(s in r)i.has(s)||(r===t&&(r=ri(o)),delete r[s])}function id(o,e,t,n,r,i){let s=o.getFirstChild();for(;s!==null;){let l=s.__key;s.__parent===e&&(E(s)&&id(s,l,t,n,r,i),t.has(l)||i.delete(l),r.push(l)),s=s.getNextSibling()}}function sd(o,e,t,n){let r=o._nodeMap,i=e._nodeMap,s=[];for(let[l]of n){let a=i.get(l);a!==void 0&&(a.isAttached()||(E(a)&&id(a,l,r,i,s,n),r.has(l)||n.delete(l),s.push(l)))}for(let l of s)i.delete(l);for(let l of t){let a=i.get(l);a!==void 0&&!a.isAttached()&&(r.has(l)||t.delete(l),i.delete(l))}}var de="",go=null,lt="",Zt="",_n,be,xr,ad=!1,mi=!1,pi,il,sl,$o,at,ll,Er;function gi(o,e){let t=$o.get(o);if(e!==null){let n=dl(o);n.parentNode===e&&e.removeChild(n)}if(at.has(o)||be._keyToDOMMap.delete(o),E(t)){let n=fi(t,$o);al(n,0,n.length-1,null)}t!==void 0&&li(Er,xr,pi,t,"destroyed")}function al(o,e,t,n){let r=e;for(;r<=t;++r){let i=o[r];i!==void 0&&gi(i,n)}}function hi(o,e,t){let n=at.get(o);n===void 0&&x(!1,"createNode: node does not exist in nodeMap");let r=n.createDOM(_n,be);if(Ih(o,r,be),b(n)?r.setAttribute("data-lexical-text","true"):B(n)&&r.setAttribute("data-lexical-decorator","true"),E(n)){let i=n.__size;if(i!==0){let s=i-1,l=fi(n,at);cl(l,n,0,s,r,null)}n.isInline()||cd(null,n,r),gr(n)&&(de+=Ve,Zt+=Ve)}else{let i=n.getTextContent();if(B(n)){let s=n.decorate(be,_n);s!==null&&dd(o,s),r.contentEditable="false"}de+=i,Zt+=i}if(e!==null)if(t!=null)e.insertBefore(r,t);else{let i=e.__lexicalLineBreak;i!=null?e.insertBefore(r,i):e.appendChild(r)}return __DEV__&&Object.freeze(n),li(Er,xr,pi,n,"created"),r}function cl(o,e,t,n,r,i){let s=de;de="";let l=t;for(;l<=n;++l){hi(o[l],r,i);let a=at.get(o[l]);a!==null&&b(a)&&(go===null&&(go=a.getFormat()),lt===""&&(lt=a.getStyle()))}gr(e)&&(de+=Ve),r.__lexicalTextContent=de,de=s+de}function ld(o,e){let t=e.get(o);return we(t)||B(t)&&t.isInline()}function cd(o,e,t){let n=o!==null&&(o.__size===0||ld(o.__last,$o)),r=e.__size===0||ld(e.__last,at);if(n){if(!r){let i=t.__lexicalLineBreak;if(i!=null)try{t.removeChild(i)}catch(s){if(typeof s=="object"&&s!=null){let l=`${s.toString()} Parent: ${t.tagName}, child: ${i.tagName}.`;throw new Error(l)}else throw s}t.__lexicalLineBreak=null}}else if(r){let i=document.createElement("br");t.__lexicalLineBreak=i,t.appendChild(i)}}function wh(o){ct(o)&&go!=null&&!mi&&o.setTextStyle(lt)}function Dh(o){ct(o)&<!==""&<!==o.__textStyle&&!mi&&o.setTextStyle(lt)}function Oh(o,e,t){go=null,lt="",Ah(o,e,t),wh(e),Dh(e)}function fi(o,e){let t=[],n=o.__first;for(;n!==null;){let r=e.get(n);r===void 0&&x(!1,"createChildrenArray: node does not exist in nodeMap"),t.push(n),n=r.__next}return t}function Ah(o,e,t){let n=de,r=o.__size,i=e.__size;if(de="",r===1&&i===1){let s=o.__first,l=e.__first;if(s===l)Nr(s,t);else{let c=dl(s),m=hi(l,null,null);try{t.replaceChild(m,c)}catch(f){if(typeof f=="object"&&f!=null){let d=`${f.toString()} Parent: ${t.tagName}, new child: {tag: ${m.tagName} key: ${l}}, old child: {tag: ${c.tagName}, key: ${s}}.`;throw new Error(d)}else throw f}gi(s,null)}let a=at.get(l);b(a)&&(go===null&&(go=a.getFormat()),lt===""&&(lt=a.getStyle()))}else{let s=fi(o,$o),l=fi(e,at);if(r===0)i!==0&&cl(l,e,0,i-1,t,null);else if(i===0){if(r!==0){let c=t.__lexicalLineBreak==null;al(s,0,r-1,c?null:t),c&&(t.textContent="")}}else kh(e,s,l,r,i,t)}gr(e)&&(de+=Ve),t.__lexicalTextContent=de,de=n+de}function Nr(o,e){let t=$o.get(o),n=at.get(o);(t===void 0||n===void 0)&&x(!1,"reconcileNode: prevNode or nextNode does not exist in nodeMap");let r=ad||sl.has(o)||il.has(o),i=Tn(be,o);if(t===n&&!r){if(E(t)){let s=i.__lexicalTextContent;s!==void 0&&(de+=s,Zt+=s)}else{let s=t.getTextContent();Zt+=s,de+=s}return i}if(t!==n&&r&&li(Er,xr,pi,n,"updated"),n.updateDOM(t,i,_n)){let s=hi(o,null,null);return e===null&&x(!1,"reconcileNode: parentDOM is null"),e.replaceChild(s,i),gi(o,null),s}if(E(t)&&E(n))r&&(Oh(t,n,i),!te(n)&&!n.isInline()&&cd(t,n,i)),gr(n)&&(de+=Ve,Zt+=Ve);else{let s=n.getTextContent();if(B(n)){let l=n.decorate(be,_n);l!==null&&dd(o,l)}de+=s,Zt+=s}if(!mi&&te(n)&&n.__cachedText!==Zt){let s=n.getWritable();s.__cachedText=Zt,n=s}return __DEV__&&Object.freeze(n),i}function dd(o,e){let t=be._pendingDecorators,n=be._decorators;if(t===null){if(n[o]===e)return;t=ri(be)}t[o]=e}function Rh(o){return o.firstChild}function rl(o){let e=o.nextSibling;return e!==null&&e===be._blockCursorElement&&(e=e.nextSibling),e}function kh(o,e,t,n,r,i){let s=n-1,l=r-1,a,c,m=Rh(i),f=0,d=0;for(;f<=s&&d<=l;){let g=e[f],h=t[d];if(g===h)m=rl(Nr(h,i)),f++,d++;else{a===void 0&&(a=new Set(e)),c===void 0&&(c=new Set(t));let N=c.has(g),L=a.has(h);if(!N)m=rl(dl(g)),gi(g,i),f++;else if(!L)hi(h,i,m),d++;else{let M=Tn(be,h);M===m?m=rl(Nr(h,i)):(m!=null?i.insertBefore(M,m):i.appendChild(M),Nr(h,i)),f++,d++}}let _=at.get(h);_!==null&&b(_)&&(go===null&&(go=_.getFormat()),lt===""&&(lt=_.getStyle()))}let u=f>s,p=d>l;if(u&&!p){let g=t[l+1],h=g===void 0?null:be.getElementByKey(g);cl(t,o,d,l,i,h)}else p&&!u&&al(e,f,s,i)}function ud(o,e,t,n,r,i){de="",Zt="",ad=n===Ut,be=t,_n=t._config,xr=t._nodes,pi=be._listeners.mutation,il=r,sl=i,$o=o._nodeMap,at=e._nodeMap,mi=e._readOnly,ll=new Map(t._keyToDOMMap);let s=new Map;return Er=s,Nr("root",null),be=void 0,xr=void 0,il=void 0,sl=void 0,$o=void 0,at=void 0,_n=void 0,ll=void 0,Er=void 0,s}function Ih(o,e,t){let n=t._keyToDOMMap;e["__lexicalKey_"+t._key]=o,n.set(o,e)}function dl(o){let e=ll.get(o);return e===void 0&&x(!1,"Reconciliation: could not find DOM element for node key %s",o),e}var Vt=Object.freeze({}),gl=30,ul=[["keydown",Wh],["pointerdown",Ph],["compositionstart",Uh],["compositionend",zh],["input",Kh],["click",$h],["cut",Vt],["copy",Vt],["dragstart",Vt],["dragover",Vt],["dragend",Vt],["paste",Vt],["focus",Vt],["blur",Vt],["drop",Vt]];co&&ul.push(["beforeinput",(o,e)=>Hh(o,e)]);var Cr=0,hd=null,Nd=0,Cn=null,Ni=new WeakMap,fl=!1,ml=!1,_r=!1,Tr=!1,xd=[0,"",0,"root",0];function Ed(o,e,t,n,r){let i=o.anchor,s=o.focus,l=i.getNode(),a=G(),c=ye(a._window),m=c!==null?c.anchorNode:null,f=i.key,d=a.getElementByKey(f),u=t.length;return f!==s.key||!b(l)||(!r&&(!co||Nd<n+50)||l.isDirty()&&u<2||ii(t))&&i.offset!==s.offset&&!l.isComposing()||ze(l)||l.isDirty()&&u>1||(r||!co)&&d!==null&&!l.isComposing()&&m!==En(d)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||l.getFormat()!==o.format||l.getStyle()!==o.style||Cc(o,l)}function fd(o,e){return o!==null&&o.nodeValue!==null&&o.nodeType===Ue&&e!==0&&e!==o.nodeValue.length}function md(o,e,t){let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=o;fl&&(fl=!1,fd(n,r)&&fd(i,s))||xe(e,()=>{if(!t){q(null);return}if(!zt(e,n,i))return;let l=T();if(C(l)){let a=l.anchor,c=a.getNode();if(l.isCollapsed()){o.type==="Range"&&o.anchorNode===o.focusNode&&(l.dirty=!0);let m=mn(e).event,f=m?m.timeStamp:performance.now(),[d,u,p,g,h]=xd,_=F(),N=e.isComposing()===!1&&_.getTextContent()==="";if(f<h+200&&a.offset===p&&a.key===g)l.format=d,l.style=u;else if(a.type==="text")x(b(c),"Point.getNode() must return TextNode when type is text"),l.format=c.getFormat(),l.style=c.getStyle();else if(a.type==="element"&&!N){let L=a.getNode();l.style="",L instanceof dt&&L.getChildrenSize()===0?l.style=L.getTextStyle():l.format=0}}else{let m=a.key,d=l.focus.key,u=l.getNodes(),p=u.length,g=l.isBackward(),h=g?s:r,_=g?r:s,N=g?d:m,L=g?m:d,M=Hs,S=!1;for(let A=0;A<p;A++){let O=u[A],R=O.getTextContentSize();if(b(O)&&R!==0&&!(A===0&&O.__key===N&&h===R||A===p-1&&O.__key===L&&_===0)&&(S=!0,M&=O.getFormat(),M===0))break}l.format=S?M:0}}D(e,ve,void 0)})}function $h(o,e){xe(e,()=>{let t=T(),n=ye(e._window),r=We();if(n){if(C(t)){let i=t.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&t.isCollapsed()&&!te(s)&&F().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&t.is(r))n.removeAllRanges(),t.dirty=!0;else if(o.detail===3&&!t.isCollapsed()){let a=t.focus.getNode();s!==a&&(E(s)?s.select(0):s.getParentOrThrow().select(0))}}else if(o.pointerType==="touch"){let i=n.anchorNode;if(i!==null){let s=i.nodeType;if(s===uo||s===Ue){let l=yr(r,n,e,o);q(l)}}}}D(e,Jn,o)})}function Ph(o,e){let t=o.target,n=o.pointerType;t instanceof Node&&n!=="touch"&&xe(e,()=>{Nc(t)||(ml=!0)})}function Td(o){if(!o.getTargetRanges)return null;let e=o.getTargetRanges();return e.length===0?null:e[0]}function Bh(o,e){return o!==e||E(o)||E(e)||!o.isToken()||!e.isToken()}function Fh(o){return hd==="MediaLast"&&o<Cr+gl}function Hh(o,e){let t=o.inputType,n=Td(o);t==="deleteCompositionText"||Ke&&oi(e)||t!=="insertCompositionText"&&xe(e,()=>{let r=T();if(t==="deleteContentBackward"){if(r===null){let m=We();if(!C(m))return;q(m.clone())}if(C(r)){let m=r.anchor.key===r.focus.key;if(Fh(o.timeStamp)&&e.isComposing()&&m){if(se(null),Cr=0,setTimeout(()=>{xe(e,()=>{se(null)})},gl),C(r)){let f=r.anchor.getNode();f.markDirty(),x(b(f),"Anchor node must be a TextNode"),r.style=f.getStyle()}}else{se(null),o.preventDefault();let f=r.anchor.getNode().getTextContent(),d=r.anchor.offset===0&&r.focus.offset===f.length;Bs&&m&&!d||D(e,Ze,!0)}return}}if(!C(r))return;let i=o.data;Cn!==null&&si(!1,e,Cn),(!r.dirty||Cn!==null)&&r.isCollapsed()&&!te(r.anchor.getNode())&&n!==null&&r.applyDOMRange(n),Cn=null;let s=r.anchor,l=r.focus,a=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
|
|
`)o.preventDefault(),D(e,It,!1);else if(i===Ve)o.preventDefault(),D(e,$t,void 0);else if(i==null&&o.dataTransfer){let m=o.dataTransfer.getData("text/plain");o.preventDefault(),r.insertRawText(m)}else i!=null&&Ed(r,n,i,o.timeStamp,!0)?(o.preventDefault(),D(e,rt,i)):Cn=i;Nd=o.timeStamp;return}switch(o.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":{D(e,rt,o);break}case"insertFromComposition":{se(null),D(e,rt,o);break}case"insertLineBreak":{se(null),D(e,It,!1);break}case"insertParagraph":{se(null),_r&&!_t?(_r=!1,D(e,It,!1)):D(e,$t,void 0);break}case"insertFromPaste":case"insertFromPasteAsQuotation":{D(e,oo,o);break}case"deleteByComposition":{Bh(a,c)&&D(e,ln,o);break}case"deleteByDrag":case"deleteByCut":{D(e,ln,o);break}case"deleteContent":{D(e,Ze,!1);break}case"deleteWordBackward":{D(e,Tt,!0);break}case"deleteWordForward":{D(e,Tt,!1);break}case"deleteHardLineBackward":case"deleteSoftLineBackward":{D(e,it,!0);break}case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":{D(e,it,!1);break}case"formatStrikeThrough":{D(e,Ne,"strikethrough");break}case"formatBold":{D(e,Ne,"bold");break}case"formatItalic":{D(e,Ne,"italic");break}case"formatUnderline":{D(e,Ne,"underline");break}case"historyUndo":{D(e,no,void 0);break}case"historyRedo":{D(e,ro,void 0);break}default:}})}function Kh(o,e){o.stopPropagation(),xe(e,()=>{let t=T(),n=o.data,r=Td(o);if(n!=null&&C(t)&&Ed(t,r,n,o.timeStamp,!1)){Tr&&(pl(e,n),Tr=!1);let s=t.anchor.getNode(),l=ye(e._window);if(l===null)return;let a=t.isBackward(),c=a?t.anchor.offset:t.focus.offset,m=a?t.focus.offset:t.anchor.offset;(!co||t.isCollapsed()||!b(s)||l.anchorNode===null||s.getTextContent().slice(0,c)+n+s.getTextContent().slice(c+m)!==js(l.anchorNode))&&D(e,rt,n);let f=n.length;Ke&&f>1&&o.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),!Ht&&!_t&&!Kt&&e.isComposing()&&(Cr=0,se(null))}else si(!1,e,n!==null?n:void 0),Tr&&(pl(e,n||void 0),Tr=!1);_c()}),Cn=null}function Uh(o,e){xe(e,()=>{let t=T();if(C(t)&&!e.isComposing()){let n=t.anchor,r=t.anchor.getNode();se(n.key),(o.timeStamp<Cr+gl||n.type==="element"||!t.isCollapsed()||b(r)&&r.getStyle()!==t.style)&&D(e,rt,oc)}})}function pl(o,e){let t=o._compositionKey;if(se(null),t!==null&&e!=null){if(e===""){let n=j(t),r=En(o.getElementByKey(t));r!==null&&r.nodeValue!==null&&b(n)&&cr(n,r.nodeValue,null,null,!0);return}if(e[e.length-1]===`
|
|
`){let n=T();if(C(n)){let r=n.focus;n.anchor.set(r.key,r.offset,r.type),D(o,Fe,null);return}}}si(!0,o,e)}function zh(o,e){Ke?Tr=!0:xe(e,()=>{pl(e,o.data)})}function Wh(o,e){if(Cr=o.timeStamp,hd=o.key,e.isComposing())return;let{key:t,shiftKey:n,ctrlKey:r,metaKey:i,altKey:s}=o;if(!D(e,Ms,o)&&t!=null){if(Wc(t,r,s,i))D(e,So,o);else if(qc(t,r,n,s,i))D(e,vs,o);else if(Uc(t,r,s,i))D(e,Lo,o);else if(zc(t,r,n,s,i))D(e,ws,o);else if(Yc(t,r,i))D(e,Mo,o);else if(Zc(t,r,i))D(e,Pt,o);else if(vc(t,n))_r=!0,D(e,Fe,o);else if(Xc(t))D(e,Qn,o);else if(wc(t,r))o.preventDefault(),_r=!0,D(e,It,!0);else if(Mc(t,n))_r=!1,D(e,Fe,o);else if(kc(t,s,i,r))pn(t)?D(e,Bt,o):(o.preventDefault(),D(e,Ze,!0));else if(jc(t))D(e,vo,o);else if(Ic(t,r,n,s,i))gn(t)?D(e,Ft,o):(o.preventDefault(),D(e,Ze,!1));else if(Dc(t,s,r))o.preventDefault(),D(e,Tt,!0);else if(Oc(t,s,r))o.preventDefault(),D(e,Tt,!1);else if(Ac(t,i))o.preventDefault(),D(e,it,!0);else if(Rc(t,i))o.preventDefault(),D(e,it,!1);else if(bc(t,s,i,r))o.preventDefault(),D(e,Ne,"bold");else if(Lc(t,s,i,r))o.preventDefault(),D(e,Ne,"underline");else if(Sc(t,s,i,r))o.preventDefault(),D(e,Ne,"italic");else if(yc(t,s,r,i))D(e,wo,o);else if($c(t,n,i,r))o.preventDefault(),D(e,no,void 0);else if(Pc(t,n,i,r))o.preventDefault(),D(e,ro,void 0);else{let l=e._editorState._selection;Ee(l)?Bc(t,n,i,r)?(o.preventDefault(),D(e,io,o)):Fc(t,n,i,r)?(o.preventDefault(),D(e,so,o)):Js(t,i,r)&&(o.preventDefault(),D(e,an,o)):!Ke&&Js(t,i,r)&&(o.preventDefault(),D(e,an,o))}Vc(r,n,s,i)&&D(e,$s,o)}}function _d(o){let e=o.__lexicalEventHandles;return e===void 0&&(e=[],o.__lexicalEventHandles=e),e}var yn=new Map;function Cd(o){let e=o.target,t=e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView,n=ye(t);if(n===null)return;let r=ni(n.anchorNode);if(r===null)return;ml&&(ml=!1,xe(r,()=>{let m=We(),f=n.anchorNode;if(f===null)return;let d=f.nodeType;if(d!==uo&&d!==Ue)return;let u=yr(m,n,r,o);q(u)}));let i=mr(r),s=i[i.length-1],l=s._key,a=yn.get(l),c=a||s;c!==r&&md(n,c,!1),md(n,r,!0),r!==s?yn.set(l,r):a&&yn.delete(l)}function pd(o){o._lexicalHandled=!0}function gd(o){return o._lexicalHandled===!0}function yd(o,e){let t=o.ownerDocument,n=Ni.get(t);(n===void 0||n<1)&&t.addEventListener("selectionchange",Cd),Ni.set(t,(n||0)+1),o.__lexicalEditor=e;let r=_d(o);for(let i=0;i<ul.length;i++){let[s,l]=ul[i],a=typeof l=="function"?c=>{gd(c)||(pd(c),(e.isEditable()||s==="click")&&l(c,e))}:c=>{if(gd(c))return;pd(c);let m=e.isEditable();switch(s){case"cut":return m&&D(e,so,c);case"copy":return D(e,io,c);case"paste":return m&&D(e,oo,c);case"dragstart":return m&&D(e,er,c);case"dragover":return m&&D(e,tr,c);case"dragend":return m&&D(e,As,c);case"focus":return m&&D(e,or,c);case"blur":return m&&D(e,Is,c);case"drop":return m&&D(e,Do,c)}};o.addEventListener(s,a),r.push(()=>{o.removeEventListener(s,a)})}}function bd(o){let e=o.ownerDocument,t=Ni.get(e);x(t!==void 0,"Root element not registered");let n=t-1;x(n>=0,"Root element count less than 0"),Ni.set(e,n),n===0&&e.removeEventListener("selectionchange",Cd);let r=Ao(o);xn(r)?(qh(r),o.__lexicalEditor=null):r&&x(!1,"Attempted to remove event handlers from a node that does not belong to this build of Lexical");let i=_d(o);for(let s=0;s<i.length;s++)i[s]();o.__lexicalEventHandles=[]}function qh(o){if(o._parentEditor!==null){let e=mr(o),n=e[e.length-1]._key;yn.get(n)===o&&yn.delete(n)}else yn.delete(o._key)}function Sd(){fl=!0}function Ld(o,e,t,n,r){xd=[o,e,t,n,r]}function hl(o,e,t){ce();let n=o.__key,r=o.getParent();if(r===null)return;let i=Qc(o),s=!1;if(C(i)&&e){let l=i.anchor,a=i.focus;l.key===n&&(Sn(l,o,r,o.getPreviousSibling(),o.getNextSibling()),s=!0),a.key===n&&(Sn(a,o,r,o.getPreviousSibling(),o.getNextSibling()),s=!0)}else Ee(i)&&e&&o.isSelected()&&o.selectPrevious();if(C(i)&&e&&!s){let l=o.getIndexWithinParent();Wt(o),bn(i,r,l,-1)}else Wt(o);!t&&!me(r)&&!r.canBeEmpty()&&r.isEmpty()&&hl(r,e),e&&te(r)&&r.isEmpty()&&r.selectEnd()}var bt=class{static getType(){x(!1,"LexicalNode: Node %s does not implement .getType().",this.name)}static clone(e){x(!1,"LexicalNode: Node %s does not implement .clone().",this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,xc(this,e),__DEV__&&this.__type!=="root"&&(ce(),Yh(this.__type,this.constructor))}getType(){return this.__type}isInline(){x(!1,"LexicalNode: Node %s does not implement .isInline().",this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let t=j(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||T();if(t==null)return!1;let n=t.getNodes().some(i=>i.__key===this.__key);if(b(this))return n;if(C(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;let i=this.getParent();if(B(this)&&this.isInline()&&i){let s=t.isBackward()?t.focus:t.anchor,l=s.getNode();if(s.offset===l.getChildrenSize()&&l.is(i)&&l.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:j(e)}getParentOrThrow(){let e=this.getParent();return e===null&&x(!1,"Expected node %s to have a parent.",this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(me(t))return x(E(e)||e===this&&B(e),"Children of root nodes must be elements or decorators"),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&x(!1,"Expected node %s to have a top parent element.",this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:j(t)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let t=this.getLatest().__next;return t===null?null:j(t)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=this.getParents(),n=e.getParents();E(this)&&t.unshift(this),E(e)&&n.unshift(e);let r=t.length,i=n.length;if(r===0||i===0||t[r-1]!==n[i-1])return null;let s=new Set(n);for(let l=0;l<r;l++){let a=t[l];if(s.has(a))return a}return null}is(e){return e==null?!1:this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;let t=this.getCommonAncestor(e),n=0,r=0,i=this;for(;;){let s=i.getParentOrThrow();if(s===t){n=i.getIndexWithinParent();break}i=s}for(i=e;;){let s=i.getParentOrThrow();if(s===t){r=i.getIndexWithinParent();break}i=s}return n<r}isParentOf(e){let t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;let l=E(i)?t?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}let a=t?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let m=null,f=c;do if(f===null&&x(!1,"getNodesBetween: ancestor is null"),m=t?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f!==null)m===null&&!r.has(f.__key)&&n.push(f);else break;while(m===null);i=m}return t||n.reverse(),n}isDirty(){let t=G()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){let e=j(this.__key);return e===null&&x(!1,"Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editorState.read/editor.update."),e}getWritable(){ce();let e=je(),t=G(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,l=T();if(l!==null&&l.setCachedNodes(null),s.has(r))return dr(i),i;let a=Yt(i);return s.add(r),dr(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){x(!1,"createDOM: base method not extended")}updateDOM(e,t,n){x(!1,"updateDOM: base method not extended")}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){x(!1,"exportJSON: base method not extended")}static importJSON(e){x(!1,"LexicalNode: Node %s does not implement .importJSON().",this.name)}static transform(){return null}remove(e){hl(this,!0,e)}replace(e,t){ce();let n=T();n!==null&&(n=n.clone()),ci(this,e);let r=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;Wt(l);let m=r.getPreviousSibling(),f=r.getNextSibling(),d=r.__prev,u=r.__next,p=r.__parent;if(hl(r,!1,!0),m===null)a.__first=s;else{let g=m.getWritable();g.__next=s}if(l.__prev=d,f===null)a.__last=s;else{let g=f.getWritable();g.__prev=s}if(l.__next=u,l.__parent=p,a.__size=c,t&&(x(E(this)&&E(l),"includeChildren should only be true for ElementNodes"),this.getChildren().forEach(g=>{l.append(g)})),C(n)){q(n);let g=n.anchor,h=n.focus;g.key===i&&Nl(g,l),h.key===i&&Nl(h,l)}return Ge()===i&&se(s),l}insertAfter(e,t=!0){ce(),ci(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=T(),l=!1,a=!1;if(i!==null){let u=e.getIndexWithinParent();if(Wt(r),C(s)){let p=i.__key,g=s.anchor,h=s.focus;l=g.type==="element"&&g.key===p&&g.offset===u+1,a=h.type==="element"&&h.key===p&&h.offset===u+1}}let c=this.getNextSibling(),m=this.getParentOrThrow().getWritable(),f=r.__key,d=n.__next;if(c===null)m.__last=f;else{let u=c.getWritable();u.__prev=f}if(m.__size++,n.__next=f,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&C(s)){let u=this.getIndexWithinParent();bn(s,m,u+1);let p=m.__key;l&&s.anchor.set(p,u+2,"element"),a&&s.focus.set(p,u+2,"element")}return e}insertBefore(e,t=!0){ce(),ci(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;Wt(r);let s=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=n.__prev,c=this.getIndexWithinParent();if(s===null)l.__first=i;else{let f=s.getWritable();f.__next=i}l.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;let m=T();if(t&&C(m)){let f=this.getParentOrThrow();bn(m,f,c)}return e}isParentRequired(){return!1}createParentElementNode(){return $()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){ce();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(E(n))return n.select();if(!b(n)){let i=n.getIndexWithinParent()+1;return r.select(i,i)}return n.select(e,t)}selectNext(e,t){ce();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(E(n))return n.select(0,0);if(!b(n)){let i=n.getIndexWithinParent();return r.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}};function Yh(o,e){let t=G()._nodes.get(o);t===void 0&&x(!1,"Create node: Attempted to create node %s that was not configured to be used on the editor.",e.name);let n=t.klass;n!==e&&x(!1,"Create node: Type %s in node %s does not match registered node %s with the same type",o,e.name,n.name)}function Md(o,e,t){let n=t||e.getParentOrThrow().getLastChild(),r=e,i=[e];for(;r!==n;)r.getNextSibling()||x(!1,"insertRangeAfter: lastToInsert must be a later sibling of firstToInsert"),r=r.getNextSibling(),i.push(r);let s=o;for(let l of i)s=s.insertAfter(l)}var Po=class o extends bt{static getType(){return"linebreak"}static clone(e){return new o(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>Vh(e)||Xh(e)?null:{conversion:Zh,priority:0}}}static importJSON(e){return ut()}exportJSON(){return{type:"linebreak",version:1}}};function Zh(o){return{node:ut()}}function ut(){return oe(new Po)}function we(o){return o instanceof Po}function Vh(o){let e=o.parentElement;if(e!==null&&mo(e)){let t=e.firstChild;if(t===o||t.nextSibling===o&&xi(t)){let n=e.lastChild;if(n===o||n.previousSibling===o&&xi(n))return!0}}return!1}function Xh(o){let e=o.parentElement;if(e!==null&&mo(e)){let t=e.firstChild;if(t===o||t.nextSibling===o&&xi(t))return!1;let n=e.lastChild;if(n===o||n.previousSibling===o&&xi(n))return!0}return!1}function xi(o){return o.nodeType===Ue&&/^( |\t|\r?\n)+$/.test(o.textContent||"")}function xl(o,e){return e&ir?"code":e&ar?"mark":e&sr?"sub":e&lr?"sup":null}function El(o,e){return e&nr?"strong":e&rr?"em":"span"}function Od(o,e,t,n,r){let i=n.classList,s=fo(r,"base");s!==void 0&&i.add(...s),s=fo(r,"underlineStrikethrough");let l=!1,a=e&dn&&e&cn,c=t&dn&&t&cn;s!==void 0&&(c?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(let m in Xe){let d=Xe[m];if(s=fo(r,m),s!==void 0)if(t&d){if(l&&(m==="underline"||m==="strikethrough")){e&d&&i.remove(...s);continue}(!(e&d)||a&&m==="underline"||m==="strikethrough")&&i.add(...s)}else e&d&&i.remove(...s)}}function Gh(o,e){let t=o.length,n=e.length,r=0,i=0;for(;r<t&&r<n&&o[r]===e[r];)r++;for(;i+r<t&&i+r<n&&o[t-i-1]===e[n-i-1];)i++;return[r,t-r-i,e.slice(r,n-i)]}function Ad(o,e,t){let n=e.firstChild,r=t.isComposing(),s=o+(r?fn:"");if(n==null)e.textContent=s;else{let l=n.nodeValue;if(l!==s)if(r||Ke){let[a,c,m]=Gh(l,s);c!==0&&n.deleteData(a,c),n.insertData(a,m)}else n.nodeValue=s}}function vd(o,e,t,n,r,i){Ad(r,o,e);let l=i.theme.text;l!==void 0&&Od(t,0,n,o,l)}function Ei(o,e){let t=document.createElement(e);return t.appendChild(o),t}var Je=class o extends bt{static getType(){return"text"}static clone(e){return new o(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return lc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===jr}isComposing(){return this.__key===Ge()}isSegmented(){return this.getLatest().__mode===Jr}isDirectionless(){return(this.getLatest().__detail&Qr)!==0}isUnmergeable(){return(this.getLatest().__detail&un)!==0}hasFormat(e){let t=Xe[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){let r=this.getLatest().__format;return ur(r,e,t)}canHaveFormat(){return!0}createDOM(e,t){let n=this.__format,r=xl(this,n),i=El(this,n),s=r===null?i:r,l=document.createElement(s),a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),r!==null&&(a=document.createElement(i),l.appendChild(a));let c=this.__text;vd(a,this,i,n,c,e);let m=this.__style;return m!==""&&(l.style.cssText=m),l}updateDOM(e,t,n){let r=this.__text,i=e.__format,s=this.__format,l=xl(this,i),a=xl(this,s),c=El(this,i),m=El(this,s);if((l===null?c:l)!==(a===null?m:a))return!0;if(l===a&&c!==m){let N=t.firstChild;N==null&&x(!1,"updateDOM: prevInnerDOM is null or undefined");let L=document.createElement(m);return vd(L,this,m,s,r,n),t.replaceChild(L,N),!1}let u=t;a!==null&&l!==null&&(u=t.firstChild,u==null&&x(!1,"updateDOM: innerDOM is null or undefined")),Ad(r,u,this);let g=n.theme.text;g!==void 0&&i!==s&&Od(m,i,s,u,g);let h=e.__style,_=this.__style;return h!==_&&(t.style.cssText=_),!1}static importDOM(){return{"#text":()=>({conversion:tN,priority:0}),b:()=>({conversion:Jh,priority:0}),code:()=>({conversion:ho,priority:0}),em:()=>({conversion:ho,priority:0}),i:()=>({conversion:ho,priority:0}),s:()=>({conversion:ho,priority:0}),span:()=>({conversion:jh,priority:0}),strong:()=>({conversion:ho,priority:0}),sub:()=>({conversion:ho,priority:0}),sup:()=>({conversion:ho,priority:0}),u:()=>({conversion:ho,priority:0})}}static importJSON(e){let t=Y(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);x(t!==null&&pe(t),"Expected TextNode createDOM to always return a HTMLElement");let n=this.getTextContent();/^\s|\s$/.test(n)&&(t.style.whiteSpace="pre-wrap");for(let r of Array.from(t.classList.values()))r.startsWith("editor-theme-")&&t.classList.remove(r);return t.classList.length===0&&t.removeAttribute("class"),t.nodeName==="SPAN"&&!t.getAttribute("style")&&(t=document.createTextNode(n)),this.hasFormat("bold")&&(t=Ei(t,"b")),this.hasFormat("italic")&&(t=Ei(t,"em")),this.hasFormat("strikethrough")&&(t=Ei(t,"s")),this.hasFormat("underline")&&(t=Ei(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e=="string"?Xe[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e=="string"?ic[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=this.getFormat(),n=ur(t,e,null);return this.setFormat(n)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=Qr,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=un,e}setMode(e){let t=sc[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){ce();let n=e,r=t,i=T(),s=this.getTextContent(),l=this.__key;if(typeof s=="string"){let a=s.length;n===void 0&&(n=a),r===void 0&&(r=a)}else n=0,r=0;if(C(i)){let a=Ge();(a===i.anchor.key||a===i.focus.key)&&se(l),i.setTextNodeRange(this,n,this,r)}else return Ti(l,n,l,r,"text","text");return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),s=i.__text,l=n.length,a=e;a<0&&(a=l+a,a<0&&(a=0));let c=T();if(r&&C(c)){let f=e+l;c.setTextNodeRange(i,f,i,f)}let m=s.slice(0,a)+n+s.slice(a+t);return i.__text=m,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ce();let t=this.getLatest(),n=t.getTextContent(),r=t.__key,i=Ge(),s=new Set(e),l=[],a=n.length,c="";for(let S=0;S<a;S++)c!==""&&s.has(S)&&(l.push(c),c=""),c+=n[S];c!==""&&l.push(c);let m=l.length;if(m===0)return[];if(l[0]===n)return[t];let f=l[0],d=t.getParent(),u,p=t.getFormat(),g=t.getStyle(),h=t.__detail,_=!1;t.isSegmented()?(u=Y(f),u.__format=p,u.__style=g,u.__detail=h,_=!0):(u=t.getWritable(),u.__text=f);let N=T(),L=[u],M=f.length;for(let S=1;S<m;S++){let A=l[S],O=A.length,R=Y(A).getWritable();R.__format=p,R.__style=g,R.__detail=h;let P=R.__key,k=M+O;if(C(N)){let W=N.anchor,ie=N.focus;W.key===r&&W.type==="text"&&W.offset>M&&W.offset<=k&&(W.key=P,W.offset-=M,N.dirty=!0),ie.key===r&&ie.type==="text"&&ie.offset>M&&ie.offset<=k&&(ie.key=P,ie.offset-=M,N.dirty=!0)}i===r&&se(P),M=k,L.push(R)}if(d!==null){Ec(this);let S=d.getWritable(),A=this.getIndexWithinParent();_?(S.splice(A,0,L),this.remove()):S.splice(A,1,L),C(N)&&bn(N,d,A,m-1)}return L}mergeWithSibling(e){let t=e===this.getPreviousSibling();!t&&e!==this.getNextSibling()&&x(!1,"mergeWithSibling: sibling must be a previous or next sibling");let n=this.__key,r=e.__key,i=this.__text,s=i.length;Ge()===r&&se(n);let a=T();if(C(a)){let d=a.anchor,u=a.focus;d!==null&&d.key===r&&(Tl(d,t,n,e,s),a.dirty=!0),u!==null&&u.key===r&&(Tl(u,t,n,e,s),a.dirty=!0)}let c=e.__text,m=t?c+i:i+c;this.setTextContent(m);let f=this.getWritable();return e.remove(),f}isTextEntity(){return!1}};function jh(o){let t=o.style;return{forChild:_l(t),node:null}}function Jh(o){let e=o,t=e.style.fontWeight==="normal";return{forChild:_l(e.style,t?void 0:"bold"),node:null}}var wd=new WeakMap;function Qh(o){return o.nodeName==="PRE"||o.nodeType===uo&&o.style!==void 0&&o.style.whiteSpace!==void 0&&o.style.whiteSpace.startsWith("pre")}function eN(o){let e,t=o.parentNode,n=[o];for(;t!==null&&(e=wd.get(t))===void 0&&!Qh(t);)n.push(t),t=t.parentNode;let r=e===void 0?t:e;for(let i=0;i<n.length;i++)wd.set(n[i],r);return r}function tN(o){let e=o,t=o.parentElement;x(t!==null,"Expected parentElement of Text not to be null");let n=e.textContent||"";if(eN(e)!==null){let r=n.split(/(\r?\n|\t)/),i=[],s=r.length;for(let l=0;l<s;l++){let a=r[l];a===`
|
|
`||a===`\r
|
|
`?i.push(ut()):a===" "?i.push(St()):a!==""&&i.push(Y(a))}return{node:i}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let r=e,i=!0;for(;r!==null&&(r=Dd(r,!1))!==null;){let s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(n=n.slice(1)),i=!1;break}}i&&(n=n.slice(1))}if(n[n.length-1]===" "){let r=e,i=!0;for(;r!==null&&(r=Dd(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){i=!1;break}i&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Y(n)}}function Dd(o,e){let t=o;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){let i=t.parentElement;if(i===null)return null;t=i}if(t=n,t.nodeType===uo){let i=t.style.display;if(i===""&&!ko(t)||i!==""&&!i.startsWith("inline"))return null}let r=t;for(;(r=e?t.firstChild:t.lastChild)!==null;)t=r;if(t.nodeType===Ue)return t;if(t.nodeName==="BR")return null}}var oN={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ho(o){let e=oN[o.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:_l(o.style,e),node:null}}function Y(o=""){return oe(new Je(o))}function b(o){return o instanceof Je}function _l(o,e){let t=o.fontWeight,n=o.textDecoration.split(" "),r=t==="700"||t==="bold",i=n.includes("line-through"),s=o.fontStyle==="italic",l=n.includes("underline"),a=o.verticalAlign,c=o.color,m=o.backgroundColor;return f=>{if(!b(f))return f;r&&!f.hasFormat("bold")&&f.toggleFormat("bold"),i&&!f.hasFormat("strikethrough")&&f.toggleFormat("strikethrough"),s&&!f.hasFormat("italic")&&f.toggleFormat("italic"),l&&!f.hasFormat("underline")&&f.toggleFormat("underline"),a==="sub"&&!f.hasFormat("subscript")&&f.toggleFormat("subscript"),a==="super"&&!f.hasFormat("superscript")&&f.toggleFormat("superscript");let d=f.getStyle();return c&&(d+=`color: ${c};`),m&&m!=="transparent"&&(d+=`background-color: ${m};`),d&&f.setStyle(d),e&&!f.hasFormat(e)&&f.toggleFormat(e),f}}var Bo=class o extends Je{static getType(){return"tab"}static clone(e){return new o(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=un}static importDOM(){return null}static importJSON(e){let t=St();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){x(!1,"TabNode does not support setTextContent")}setDetail(e){x(!1,"TabNode does not support setDetail")}setMode(e){x(!1,"TabNode does not support setMode")}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function St(){return oe(new Bo)}function Cl(o){return o instanceof Bo}var Sl=class{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode(),r=this.offset,i=e.offset;if(E(t)){let s=t.getDescendantByIndex(r);t=s??t}if(E(n)){let s=n.getDescendantByIndex(i);n=s??n}return t===n?r<i:t.isBefore(n)}getNode(){let e=this.key,t=j(e);return t===null&&x(!1,"Point.getNode: node not found"),t}set(e,t,n){let r=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,st()||(Ge()===i&&se(e),r!==null&&(r.setCachedNodes(null),r.dirty=!0))}};function De(o,e,t){return new Sl(o,e,t)}function yl(o,e){let t=e.__key,n=o.offset,r="element";if(b(e)){r="text";let i=e.getTextContentSize();n>i&&(n=i)}else if(!E(e)){let i=e.getNextSibling();if(b(i))t=i.__key,n=0,r="text";else{let s=e.getParent();s&&(t=s.__key,n=e.getIndexWithinParent()+1)}}o.set(t,n,r)}function Nl(o,e){if(E(e)){let t=e.getLastDescendant();E(t)||b(t)?yl(o,t):yl(o,e)}else yl(o,e)}function nN(o,e,t,n){let r=o.getNode(),i=r.getChildAtIndex(o.offset),s=Y(),l=te(r)?$().append(s):s;s.setFormat(t),s.setStyle(n),i===null?r.append(l):i.insertBefore(l),o.is(e)&&e.set(s.__key,0,"text"),o.set(s.__key,0,"text")}function No(o,e,t,n){o.key=e,o.offset=t,o.type=n}var _i=class o{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ee(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(r=>n.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new o(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes(),n=t.length,r=t[n-1],i;if(b(r))i=r.select();else{let s=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<n;s++)t[s].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let r of t){let i=j(r);i!==null&&n.push(i)}return st()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}};function C(o){return o instanceof xo}var xo=class o{constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return C(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this.anchor,n=this.focus,r=t.isBefore(n),i=r?t:n,s=r?n:t,l=i.getNode(),a=s.getNode(),c=i.offset,m=s.offset;if(E(l)){let d=l.getDescendantByIndex(c);l=d??l}if(E(a)){let d=a.getDescendantByIndex(m);d!==null&&d!==l&&a.getChildAtIndex(m)===d&&(d=d.getPreviousSibling()),a=d??a}let f;return l.is(a)?E(l)&&l.getChildrenSize()>0?f=[]:f=[l]:f=l.getNodesBetween(a),st()||(this._cachedNodes=f),f}setTextNodeRange(e,t,n,r){No(this.anchor,e.__key,t,"text"),No(this.focus,n.__key,r,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[l,a]=br(this),c="",m=!0;for(let f=0;f<e.length;f++){let d=e[f];if(E(d)&&!d.isInline())m||(c+=`
|
|
`),d.isEmpty()?m=!1:m=!0;else if(m=!1,b(d)){let u=d.getTextContent();d===t?d===n?(r.type!=="element"||i.type!=="element"||i.offset===r.offset)&&(u=l<a?u.slice(l,a):u.slice(a,l)):u=s?u.slice(l):u.slice(a):d===n&&(u=s?u.slice(0,a):u.slice(0,l)),c+=u}else(B(d)||we(d))&&(d!==n||!this.isCollapsed())&&(c+=d.getTextContent())}return c}applyDOMRange(e){let t=G(),r=t.getEditorState()._selection,i=Fd(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(i===null)return;let[s,l]=i;No(this.anchor,s.key,s.offset,s.type),No(this.focus,l.key,l.offset,l.type),this._cachedNodes=null}clone(){let e=this.anchor,t=this.focus;return new o(De(e.key,e.offset,e.type),De(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=ur(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Xe[e];return(this.format&t)!==0}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let i=0;i<r;i++){let s=t[i];s===`
|
|
`||s===`\r
|
|
`?n.push(ut()):s===" "?n.push(St()):n.push(Y(s))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,s=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(s=n,l=t),s.type==="element"&&nN(s,l,r,i);let a=s.offset,c=l.offset,m=this.getNodes(),f=m.length,d=m[0];b(d)||x(!1,"insertText: first node is not a text node");let p=d.getTextContent().length,g=d.getParentOrThrow(),h=f-1,_=m[h];if(f===1&&l.type==="element"&&(c=p,l.set(s.key,c,"text")),this.isCollapsed()&&a===p&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&d.getNextSibling()===null)){let N=d.getNextSibling();if((!b(N)||!N.canInsertTextBefore()||ze(N))&&(N=Y(),N.setFormat(r),N.setStyle(i),g.canInsertTextAfter()?d.insertAfter(N):g.insertAfter(N)),N.select(0,0),d=N,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&a===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&d.getPreviousSibling()===null)){let N=d.getPreviousSibling();if((!b(N)||ze(N))&&(N=Y(),N.setFormat(r),g.canInsertTextBefore()?d.insertBefore(N):g.insertBefore(N)),N.select(),d=N,e!==""){this.insertText(e);return}}else if(d.isSegmented()&&a!==p){let N=Y(d.getTextContent());N.setFormat(r),d.replace(N),d=N}else if(!this.isCollapsed()&&e!==""){let N=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||E(N)&&(!N.canInsertTextBefore()||!N.canInsertTextAfter())){this.insertText(""),Bd(this.anchor,this.focus,null),this.insertText(e);return}}if(f===1){if(d.isToken()){let S=Y(e);S.select(),d.replace(S);return}let N=d.getFormat(),L=d.getStyle();if(a===c&&(N!==r||L!==i))if(d.getTextContent()==="")d.setFormat(r),d.setStyle(i);else{let S=Y(e);if(S.setFormat(r),S.setStyle(i),S.select(),a===0)d.insertBefore(S,!1);else{let[A]=d.splitText(a);A.insertAfter(S,!1)}S.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}else if(Cl(d)){let S=Y(e);S.setFormat(r),S.setStyle(i),S.select(),d.replace(S);return}let M=c-a;d=d.spliceText(a,M,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=N,this.style=L))}else{let N=new Set([...d.getParentKeys(),..._.getParentKeys()]),L=E(d)?d:d.getParentOrThrow(),M=E(_)?_:_.getParentOrThrow(),S=_;if(!L.is(M)&&M.isInline())do S=M,M=M.getParentOrThrow();while(M.isInline());if(l.type==="text"&&(c!==0||_.getTextContent()==="")||l.type==="element"&&_.getIndexWithinParent()<c)if(b(_)&&!_.isToken()&&c!==_.getTextContentSize()){if(_.isSegmented()){let k=Y(_.getTextContent());_.replace(k),_=k}!te(l.getNode())&&l.type==="text"&&(_=_.spliceText(0,c,"")),N.add(_.__key)}else{let k=_.getParentOrThrow();!k.canBeEmpty()&&k.getChildrenSize()===1?k.remove():_.remove()}else N.add(_.__key);let A=M.getChildren(),O=new Set(m),R=L.is(M),P=L.isInline()&&d.getNextSibling()===null?L:d;for(let k=A.length-1;k>=0;k--){let W=A[k];if(W.is(d)||E(W)&&W.isParentOf(d))break;W.isAttached()&&(!O.has(W)||W.is(S)?R||P.insertAfter(W,!1):W.remove())}if(!R){let k=M,W=null;for(;k!==null;){let ie=k.getChildren(),rn=ie.length;(rn===0||ie[rn-1].is(W))&&(N.delete(k.__key),W=k),k=k.getParent()}}if(!d.isToken())d=d.spliceText(a,p-a,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);else if(a===p)d.select();else{let k=Y(e);k.select(),d.replace(k)}for(let k=1;k<f;k++){let W=m[k],ie=W.__key;N.has(ie)||W.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed()){this.toggleFormat(e),se(null);return}let t=this.getNodes(),n=[];for(let N of t)b(N)&&n.push(N);let r=n.length;if(r===0){this.toggleFormat(e),se(null);return}let i=this.anchor,s=this.focus,l=this.isBackward(),a=l?s:i,c=l?i:s,m=0,f=n[0],d=a.type==="element"?0:a.offset;if(a.type==="text"&&d===f.getTextContentSize()&&(m=1,f=n[1],d=0),f==null)return;let u=f.getFormatFlags(e,null),p=r-1,g=n[p],h=c.type==="text"?c.offset:g.getTextContentSize();if(f.is(g)){if(d===h)return;if(ze(f)||d===0&&h===f.getTextContentSize())f.setFormat(u);else{let N=f.splitText(d,h),L=d===0?N[0]:N[1];L.setFormat(u),a.type==="text"&&a.set(L.__key,0,"text"),c.type==="text"&&c.set(L.__key,h-d,"text")}this.format=u;return}d!==0&&!ze(f)&&([,f]=f.splitText(d),d=0),f.setFormat(u);let _=g.getFormatFlags(e,u);h>0&&(h!==g.getTextContentSize()&&!ze(g)&&([g]=g.splitText(h)),g.setFormat(_));for(let N=m+1;N<p;N++){let L=n[N],M=L.getFormatFlags(e,_);L.setFormat(M)}a.type==="text"&&a.set(f.__key,d,"text"),c.type==="text"&&c.set(g.__key,h,"text"),this.format=u|_}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();let h=T();return x(C(h),"Expected RangeSelection after insertParagraph"),h.insertNodes(e)}let t=this.isBackward()?this.focus:this.anchor,n=ui(t.getNode(),Io),r=e[e.length-1];if("__language"in n&&E(n)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let h=bl(this);n.splice(h,0,e),r.selectEnd()}return}let i=h=>(E(h)||B(h))&&!h.isInline();if(!e.some(i)){x(E(n),"Expected 'firstBlock' to be an ElementNode");let h=bl(this);n.splice(h,0,e),r.selectEnd();return}let s=cN(e),l=s.getLastDescendant(),a=s.getChildren(),c=h=>E(h)&&Io(h)&&!h.isEmpty()&&E(n)&&(!n.isEmpty()||n.canMergeWhenEmpty()),f=!E(n)||!n.isEmpty()?this.insertParagraph():null,d=a[a.length-1],u=a[0];c(u)&&(x(E(n),"Expected 'firstBlock' to be an ElementNode"),n.append(...u.getChildren()),u=a[1]),u&&Md(n,u);let p=ui(l,Io);f&&E(p)&&(f.canMergeWhenEmpty()||Io(d))&&(p.append(...f.getChildren()),f.remove()),E(n)&&n.isEmpty()&&n.remove(),l.selectEnd();let g=E(n)?n.getLastChild():null;we(g)&&p!==n&&g.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=$();return F().splice(this.anchor.offset,0,[s]),s.select(),s}let e=bl(this),t=ui(this.anchor.getNode(),Io);x(E(t),"Expected ancestor to be an ElementNode");let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=ut();if(this.insertNodes([t]),e){let n=t.getParentOrThrow(),r=t.getIndexWithinParent();n.select(r,r)}}extract(){let e=this.getNodes(),t=e.length,n=t-1,r=this.anchor,i=this.focus,s=e[0],l=e[n],[a,c]=br(this);if(t===0)return[];if(t===1){if(b(s)&&!this.isCollapsed()){let f=a>c?c:a,d=a>c?a:c,u=s.splitText(f,d),p=f===0?u[0]:u[1];return p!=null?[p]:[]}return[s]}let m=r.isBefore(i);if(b(s)){let f=m?a:c;f===s.getTextContentSize()?e.shift():f!==0&&([,s]=s.splitText(f),e[0]=s)}if(b(l)){let d=l.getTextContent().length,u=m?c:a;u===0?e.pop():u!==d&&([l]=l.splitText(u),e[n]=l)}return e}modify(e,t,n){let r=this.focus,i=this.anchor,s=e==="move",l=qt(r,t);if(B(l)&&!l.isIsolated()){if(s&&l.isKeyboardSelectable()){let u=Fo();u.add(l.__key),q(u);return}let d=t?l.getPreviousSibling():l.getNextSibling();if(b(d)){let u=d.__key,p=t?d.getTextContent().length:0;r.set(u,p,"text"),s&&i.set(u,p,"text");return}else{let u=l.getParentOrThrow(),p,g;E(d)?(g=d.__key,p=t?d.getChildrenSize():0):(p=l.getIndexWithinParent(),g=u.__key,t||p++),r.set(g,p,"element"),s&&i.set(g,p,"element");return}}let a=G(),c=ye(a._window);if(!c)return;let m=a._blockCursorElement,f=a._rootElement;if(f!==null&&m!==null&&E(l)&&!l.isInline()&&!l.canBeEmpty()&&hr(m,a,f),iN(c,e,t?"backward":"forward",n),c.rangeCount>0){let d=c.getRangeAt(0),u=this.anchor.getNode(),p=te(u)?u:el(u);if(this.applyDOMRange(d),this.dirty=!0,!s){let g=this.getNodes(),h=[],_=!1;for(let N=0;N<g.length;N++){let L=g[N];hn(L,p)?h.push(L):_=!0}if(_&&h.length>0)if(t){let N=h[0];E(N)?N.selectStart():N.getParentOrThrow().selectStart()}else{let N=h[h.length-1];E(N)?N.selectEnd():N.getParentOrThrow().selectEnd()}(c.anchorNode!==d.startContainer||c.anchorOffset!==d.startOffset)&&rN(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&E(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){let r=t.getParent(),i=t.getNextSibling()||(r===null?null:r.getNextSibling());if(E(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,e))return;let i=this.focus,s=qt(i,e);if(B(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&E(r)&&r.getChildrenSize()===0){r.remove();let l=Fo();l.add(s.__key),q(l)}else s.remove(),G().dispatchCommand(ve,void 0);return}else if(!e&&E(s)&&E(r)&&r.isEmpty()){r.remove(),s.selectStart();return}if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{let l=i.type==="text"?i.getNode():null;if(r=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){let a=i.offset,c=l.getTextContentSize();if(l.is(r)||e&&a!==c||!e&&a!==0){kd(l,e,a);return}}else if(r!==null&&r.isSegmented()){let a=n.offset,c=r.getTextContentSize();if(r.is(l)||e&&a!==0||!e&&a!==c){kd(r,e,a);return}}sN(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&te(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){let t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){let r=e?this.anchor:this.focus;r.set(r.key,r.offset+1,r.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Ee(o){return o instanceof _i}function Rd(o){let e=o.offset;if(o.type==="text")return e;let t=o.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function br(o){let e=o.getStartEndPoints();if(e===null)return[0,0];let[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[Rd(t),Rd(n)]}function rN(o){let e=o.focus,t=o.anchor,n=t.key,r=t.offset,i=t.type;No(t,e.key,e.offset,e.type),No(e,n,r,i),o._cachedNodes=null}function iN(o,e,t,n){o.modify(e,t,n)}function sN(o,e){let t=o.anchor,n=o.focus,r=t.getNode(),i=n.getNode();if(r===i&&t.type==="text"&&n.type==="text"){let s=t.offset,l=n.offset,a=s<l,c=a?s:l,m=a?l:s,f=m-1;if(c!==f){let d=r.getTextContent().slice(c,m);ii(d)||(e?n.offset=f:t.offset=f)}}}function kd(o,e,t){let n=o,i=n.getTextContent().split(/(?=\s)/g),s=i.length,l=0,a=0;for(let m=0;m<s;m++){let f=i[m],d=m===s-1;if(a=l,l+=f.length,e&&l===t||l>t||d){i.splice(m,1),d&&(a=void 0);break}}let c=i.join("").trim();c===""?n.remove():(n.setTextContent(c),n.select(a,a))}function lN(o,e,t){let n=o.getParent();return t===null||n===null||!n.canBeEmpty()||n!==t.getNode()}function Id(o,e,t,n){let r=e,i;if(o.nodeType===uo){let s=!1,l=o.childNodes,a=l.length,c=n._blockCursorElement;r===a&&(s=!0,r=a-1);let m=l[r],f=!1;if(m===c)m=l[r+1],f=!0;else if(c!==null){let d=c.parentNode;if(o===d){let u=Array.prototype.indexOf.call(d.children,c);e>u&&r--}}if(i=Ro(m),b(i))r=Xs(i,s);else{let d=Ro(o);if(d===null)return null;if(E(d)){r=Math.min(d.getChildrenSize(),r);let u=d.getChildAtIndex(r);if(E(u)&&lN(u,r,t)){let p=s?u.getLastDescendant():u.getFirstDescendant();p===null?d=u:(u=p,d=E(u)?u:u.getParentOrThrow()),r=0}b(u)?(i=u,d=null,r=Xs(u,s)):u!==d&&s&&!f&&r++}else{let u=d.getIndexWithinParent();e===0&&B(d)&&Ro(o)===d?r=u:r=u+1,d=d.getParentOrThrow()}if(E(d))return De(d.__key,r,"element")}}else i=Ro(o);return b(i)?De(i.__key,r,"text"):null}function $d(o,e,t){let n=o.offset,r=o.getNode();if(n===0){let i=r.getPreviousSibling(),s=r.getParent();if(!e)E(i)&&!t&&i.isInline()?(o.key=i.__key,o.offset=i.getChildrenSize(),o.type="element"):b(i)&&(o.key=i.__key,o.offset=i.getTextContent().length);else if((t||!e)&&i===null&&E(s)&&s.isInline()){let l=s.getPreviousSibling();b(l)&&(o.key=l.__key,o.offset=l.getTextContent().length)}}else if(n===r.getTextContent().length){let i=r.getNextSibling(),s=r.getParent();if(e&&E(i)&&i.isInline())o.key=i.__key,o.offset=0,o.type="element";else if((t||e)&&i===null&&E(s)&&s.isInline()&&!s.canInsertTextAfter()){let l=s.getNextSibling();b(l)&&(o.key=l.__key,o.offset=0)}}}function Bd(o,e,t){if(o.type==="text"&&e.type==="text"){let n=o.isBefore(e),r=o.is(e);$d(o,n,r),$d(e,!n,r),r&&(e.key=o.key,e.offset=o.offset,e.type=o.type);let i=G();if(i.isComposing()&&i._compositionKey!==o.key&&C(t)){let s=t.anchor,l=t.focus;No(o,s.key,s.offset,s.type),No(e,l.key,l.offset,l.type)}}}function Fd(o,e,t,n,r,i){if(o===null||t===null||!zt(r,o,t))return null;let s=Id(o,e,C(i)?i.anchor:null,r);if(s===null)return null;let l=Id(t,n,C(i)?i.focus:null,r);if(l===null)return null;if(s.type==="element"&&l.type==="element"){let a=Ro(o),c=Ro(t);if(B(a)&&B(c))return null}return Bd(s,l,i),[s,l]}function Ho(o){return E(o)&&!o.isInline()}function Ti(o,e,t,n,r,i){let s=je(),l=new xo(De(o,e,r),De(t,n,i),0,"");return l.dirty=!0,s._selection=l,l}function Ko(){let o=De("root",0,"element"),e=De("root",0,"element");return new xo(o,e,0,"")}function Fo(){return new _i(new Set)}function Hd(o){let t=o.getEditorState()._selection,n=ye(o._window);return C(t)||t==null?yr(t,n,o,null):t.clone()}function Ll(o,e){return yr(null,o,e,null)}function yr(o,e,t,n){let r=t._window;if(r===null)return null;let i=n||r.event,s=i?i.type:void 0,l=s==="selectionchange",a=!ac()&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0),c,m,f,d;if(!C(o)||a){if(e===null)return null;if(c=e.anchorNode,m=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&C(o)&&!zt(t,c,m))return o.clone()}else return o.clone();let u=Fd(c,f,m,d,t,o);if(u===null)return null;let[p,g]=u;return new xo(p,g,C(o)?o.format:0,C(o)?o.style:"")}function T(){return je()._selection}function We(){return G()._editorState._selection}function bn(o,e,t,n=1){let r=o.anchor,i=o.focus,s=r.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;let a=e.__key;if(o.isCollapsed()){let c=r.offset;if(t<=c&&n>0||t<c&&n<0){let m=Math.max(0,c+n);r.set(a,m,"element"),i.set(a,m,"element"),Pd(o)}}else{let c=o.isBackward(),m=c?i:r,f=m.getNode(),d=c?r:i,u=d.getNode();if(e.is(f)){let p=m.offset;(t<=p&&n>0||t<p&&n<0)&&m.set(a,Math.max(0,p+n),"element")}if(e.is(u)){let p=d.offset;(t<=p&&n>0||t<p&&n<0)&&d.set(a,Math.max(0,p+n),"element")}}Pd(o)}function Pd(o){let e=o.anchor,t=e.offset,n=o.focus,r=n.offset,i=e.getNode(),s=n.getNode();if(o.isCollapsed()){if(!E(i))return;let l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(b(c)){let m=0;a&&(m=c.getTextContentSize()),e.set(c.__key,m,"text"),n.set(c.__key,m,"text")}return}if(E(i)){let l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(b(c)){let m=0;a&&(m=c.getTextContentSize()),e.set(c.__key,m,"text")}}if(E(s)){let l=s.getChildrenSize(),a=r>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(r);if(b(c)){let m=0;a&&(m=c.getTextContentSize()),n.set(c.__key,m,"text")}}}function Kd(o,e){let n=e.getEditorState()._selection,r=o._selection;if(C(r)){let i=r.anchor,s=r.focus,l;if(i.type==="text"&&(l=i.getNode(),l.selectionTransform(n,r)),s.type==="text"){let a=s.getNode();l!==a&&a.selectionTransform(n,r)}}}function Sn(o,e,t,n,r){let i=null,s=0,l=null;n!==null?(i=n.__key,b(n)?(s=n.getTextContentSize(),l="text"):E(n)&&(s=n.getChildrenSize(),l="element")):r!==null&&(i=r.__key,b(r)?l="text":E(r)&&(l="element")),i!==null&&l!==null?o.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=t.getChildrenSize()),o.set(t.__key,s,"element"))}function Tl(o,e,t,n,r){o.type==="text"?(o.key=t,e||(o.offset+=r)):o.offset>n.getIndexWithinParent()&&(o.offset-=1)}function Ud(o,e,t,n,r,i,s){let l=n.anchorNode,a=n.focusNode,c=n.anchorOffset,m=n.focusOffset,f=document.activeElement;if(r.has("collaboration")&&f!==i||f!==null&&Nn(f))return;if(!C(e)){o!==null&&zt(t,l,a)&&n.removeAllRanges();return}let d=e.anchor,u=e.focus,p=d.key,g=u.key,h=Tn(t,p),_=Tn(t,g),N=d.offset,L=u.offset,M=e.format,S=e.style,A=e.isCollapsed(),O=h,R=_,P=!1;if(d.type==="text"){O=En(h);let k=d.getNode();P=k.getFormat()!==M||k.getStyle()!==S}else C(o)&&o.anchor.type==="text"&&(P=!0);if(u.type==="text"&&(R=En(_)),!(O===null||R===null)&&(A&&(o===null||P||C(o)&&(o.format!==M||o.style!==S))&&Ld(M,S,N,p,performance.now()),!(c===N&&m===L&&l===O&&a===R&&!(n.type==="Range"&&A)&&((f===null||!i.contains(f))&&i.focus({preventScroll:!0}),d.type!=="element")))){try{n.setBaseAndExtent(O,N,R,L)}catch(k){__DEV__&&console.warn(k)}if(!r.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){let k=e instanceof xo&&e.anchor.type==="element"?O.childNodes[N]||null:n.rangeCount>0?n.getRangeAt(0):null;if(k!==null){let W;if(k instanceof Text){let ie=document.createRange();ie.selectNode(k),W=ie.getBoundingClientRect()}else W=k.getBoundingClientRect();Jc(t,W,i)}}Sd()}}function Oe(o){let e=T()||We();e===null&&(e=F().selectEnd()),e.insertNodes(o)}function bl(o){let e=o;o.isCollapsed()||e.removeText();let t=T();C(t)&&(e=t),x(C(e),"Unexpected dirty selection to be null");let n=e.anchor,r=n.getNode(),i=n.offset;for(;!Io(r);)[r,i]=aN(r,i);return i}function aN(o,e){let t=o.getParent();if(!t){let r=$();return F().append(r),r.select(),[F(),0]}if(b(o)){let r=o.splitText(e);if(r.length===0)return[t,o.getIndexWithinParent()];let i=e===0?0:1,s=r[0].getIndexWithinParent()+i;return[t,s]}if(!E(o)||e===0)return[t,o.getIndexWithinParent()];let n=o.getChildAtIndex(e);if(n){let r=new xo(De(o.__key,e,"element"),De(o.__key,e,"element"),0,""),i=o.insertNewAfter(r);i&&i.append(n,...n.getNextSiblings())}return[t,o.getIndexWithinParent()+1]}function cN(o){let e=$(),t=null;for(let n=0;n<o.length;n++){let r=o[n],i=we(r);if(i||B(r)&&r.isInline()||E(r)&&r.isInline()||b(r)||r.isParentRequired()){if(t===null&&(t=r.createParentElementNode(),e.append(t),i))continue;t!==null&&t.append(r)}else e.append(r),t=null}return e}var ue=null,ge=null,Ae=!1,Ml=!1,Ci=0,zd={characterData:!0,childList:!0,subtree:!0};function st(){return Ae||ue!==null&&ue._readOnly}function ce(){Ae&&x(!1,"Cannot use method in read-only mode.")}function ol(){Ci>99&&x(!1,"One or more transforms are endlessly triggering additional transforms. May have encountered infinite recursion caused by transforms that have their preconditions too lose and/or conflict with each other.")}function je(){return ue===null&&x(!1,"Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().%s",Zd()),ue}function G(){return ge===null&&x(!1,"Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().%s",Zd()),ge}function Zd(){let o=0,e=new Set,t=po.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let i=Ao(r);if(xn(i))o++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===t&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let n=` Detected on the page: ${o} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function Vd(){return ge}function nd(){return ue}function Wd(o,e,t){let n=e.__type,r=gc(o,n),i=t.get(n);i===void 0&&(i=Array.from(r.transforms),t.set(n,i));let s=i.length;for(let l=0;l<s&&(i[l](e),!!e.isAttached());l++);}function qd(o,e){return o!==void 0&&o.__key!==e&&o.isAttached()}function dN(o,e){let t=e._dirtyLeaves,n=o._nodeMap;for(let r of t){let i=n.get(r);b(i)&&i.isAttached()&&i.isSimpleText()&&!i.isUnmergeable()&&Ys(i)}}function uN(o,e){let t=e._dirtyLeaves,n=e._dirtyElements,r=o._nodeMap,i=Ge(),s=new Map,l=t,a=l.size,c=n,m=c.size;for(;a>0||m>0;){if(a>0){e._dirtyLeaves=new Set;for(let f of l){let d=r.get(f);b(d)&&d.isAttached()&&d.isSimpleText()&&!d.isUnmergeable()&&Ys(d),d!==void 0&&qd(d,i)&&Wd(e,d,s),t.add(f)}if(l=e._dirtyLeaves,a=l.size,a>0){Ci++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(let f of c){let d=f[0],u=f[1];if(d!=="root"&&!u)continue;let p=r.get(d);p!==void 0&&qd(p,i)&&Wd(e,p,s),n.set(d,u)}l=e._dirtyLeaves,a=l.size,c=e._dirtyElements,m=c.size,Ci++}e._dirtyLeaves=t,e._dirtyElements=n}function vl(o){return wl(o,G()._nodes)}function wl(o,e){let t=o.type,n=e.get(t);n===void 0&&x(!1,'parseEditorState: type "%s" + not found',t);let r=n.klass;o.type!==r.getType()&&x(!1,"LexicalNode: Node %s does not implement .importJSON().",r.name);let i=r.importJSON(o),s=o.children;if(E(i)&&Array.isArray(s))for(let l=0;l<s.length;l++){let a=s[l],c=wl(a,e);i.append(c)}return i}function Xd(o,e,t){let n=Sr(),r=ue,i=Ae,s=ge,l=e._dirtyElements,a=e._dirtyLeaves,c=e._cloneNotNeeded,m=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,ue=n,Ae=!1,ge=e;try{let f=e._nodes,d=o.root;wl(d,f),t&&t(),n._readOnly=!0,__DEV__&&Gd(n)}catch(f){f instanceof Error&&e._onError(f)}finally{e._dirtyElements=l,e._dirtyLeaves=a,e._cloneNotNeeded=c,e._dirtyType=m,ue=r,Ae=i,ge=s}return n}function Dl(o,e,t){let n=ue,r=Ae,i=ge;ue=e,Ae=!0,ge=o;try{return t()}finally{ue=n,Ae=r,ge=i}}function Gd(o){let e=o._nodeMap;e.set=()=>{throw new Error("Cannot call set() on a frozen Lexical node map")},e.clear=()=>{throw new Error("Cannot call clear() on a frozen Lexical node map")},e.delete=()=>{throw new Error("Cannot call delete() on a frozen Lexical node map")}}function Lt(o,e){let t=o._pendingEditorState,n=o._rootElement,r=o._headless||n===null;if(t===null)return;let i=o._editorState,s=i._selection,l=t._selection,a=o._dirtyType!==Ct,c=ue,m=Ae,f=ge,d=o._updating,u=o._observer,p=null;if(o._pendingEditorState=null,o._editorState=t,!r&&a&&u!==null){ge=o,ue=t,Ae=!1,o._updating=!0;try{let O=o._dirtyType,R=o._dirtyElements,P=o._dirtyLeaves;u.disconnect(),p=ud(i,t,o,O,R,P)}catch(O){if(O instanceof Error&&o._onError(O),!Ml)Ol(o,null,n,t),ti(o),o._dirtyType=Ut,Ml=!0,Lt(o,i),Ml=!1;else throw O;return}finally{u.observe(n,zd),o._updating=d,ue=c,Ae=m,ge=f}}t._readOnly||(t._readOnly=!0,__DEV__&&(Gd(t),C(l)&&(Object.freeze(l.anchor),Object.freeze(l.focus)),Object.freeze(l)));let g=o._dirtyLeaves,h=o._dirtyElements,_=o._normalizedNodes,N=o._updateTags,L=o._deferred,M=t._nodeMap.size;a&&(o._dirtyType=Ct,o._cloneNotNeeded.clear(),o._dirtyLeaves=new Set,o._dirtyElements=new Map,o._normalizedNodes=new Set,o._updateTags=new Set),rd(o,t);let S=r?null:ye(o._window);if(o._editable&&S!==null&&(a||l===null||l.dirty)){ge=o,ue=t;try{if(u!==null&&u.disconnect(),a||l===null||l.dirty){let O=o._blockCursorElement;O!==null&&hr(O,o,n),Ud(s,l,o,S,N,n,M)}td(o,n,l),u!==null&&u.observe(n,zd)}finally{ge=f,ue=c}}p!==null&&mN(o,p,N,g,i),!C(l)&&l!==null&&(s===null||!s.is(l))&&o.dispatchCommand(ve,void 0);let A=o._pendingDecorators;A!==null&&(o._decorators=A,o._pendingDecorators=null,Ln("decorator",o,!0,A)),fN(o,e||i,t),Ln("update",o,!0,{dirtyElements:h,dirtyLeaves:g,editorState:t,normalizedNodes:_,prevEditorState:e||i,tags:N}),gN(o,L),pN(o)}function fN(o,e,t){let n=Vs(e),r=Vs(t);n!==r&&Ln("textcontent",o,!0,r)}function mN(o,e,t,n,r){let i=Array.from(o._listeners.mutation),s=i.length;for(let l=0;l<s;l++){let[a,c]=i[l],m=e.get(c);m!==void 0&&a(m,{dirtyLeaves:n,prevEditorState:r,updateTags:t})}}function Ln(o,e,t,...n){let r=e._updating;e._updating=t;try{let i=Array.from(e._listeners[o]);for(let s=0;s<i.length;s++)i[s].apply(null,n)}finally{e._updating=r}}function nl(o,e,t){if(o._updating===!1||ge!==o){let r=!1;return o.update(()=>{r=nl(o,e,t)}),r}let n=mr(o);for(let r=4;r>=0;r--)for(let i=0;i<n.length;i++){let a=n[i]._commands.get(e);if(a!==void 0){let c=a[r];if(c!==void 0){let m=Array.from(c),f=m.length;for(let d=0;d<f;d++)if(m[d](t,o)===!0)return!0}}}return!1}function pN(o){let e=o._updates;if(e.length!==0){let t=e.shift();if(t){let[n,r]=t;jd(o,n,r)}}}function gN(o,e){if(o._deferred=[],e.length!==0){let t=o._updating;o._updating=!0;try{for(let n=0;n<e.length;n++)e[n]()}finally{o._updating=t}}}function Yd(o,e){let t=o._updates,n=e||!1;for(;t.length!==0;){let r=t.shift();if(r){let[i,s]=r,l,a;if(s!==void 0){if(l=s.onUpdate,a=s.tag,s.skipTransforms&&(n=!0),s.discrete){let c=o._pendingEditorState;x(c!==null,"Unexpected empty pending editor state on discrete nested update"),c._flushSync=!0}l&&o._deferred.push(l),a&&o._updateTags.add(a)}i()}}return n}function jd(o,e,t){let n=o._updateTags,r,i,s=!1,l=!1;t!==void 0&&(r=t.onUpdate,i=t.tag,i!=null&&n.add(i),s=t.skipTransforms||!1,l=t.discrete||!1),r&&o._deferred.push(r);let a=o._editorState,c=o._pendingEditorState,m=!1;(c===null||c._readOnly)&&(c=o._pendingEditorState=Qd(c||a),m=!0),c._flushSync=l;let f=ue,d=Ae,u=ge,p=o._updating;ue=c,Ae=!1,o._updating=!0,ge=o;try{m&&(o._headless?a._selection!==null&&(c._selection=a._selection.clone()):c._selection=Hd(o));let h=o._compositionKey;e(),s=Yd(o,s),Kd(c,o),o._dirtyType!==Ct&&(s?dN(c,o):uN(c,o),Yd(o),sd(a,c,o._dirtyLeaves,o._dirtyElements));let _=o._compositionKey;h!==_&&(c._flushSync=!0);let N=c._selection;if(C(N)){let L=c._nodeMap,M=N.anchor.key,S=N.focus.key;(L.get(M)===void 0||L.get(S)===void 0)&&x(!1,"updateEditor: selection has been lost 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.")}else Ee(N)&&N._nodes.size===0&&(c._selection=null)}catch(h){h instanceof Error&&o._onError(h),o._pendingEditorState=a,o._dirtyType=Ut,o._cloneNotNeeded.clear(),o._dirtyLeaves=new Set,o._dirtyElements.clear(),Lt(o);return}finally{ue=f,Ae=d,ge=u,o._updating=p,Ci=0}o._dirtyType!==Ct||Jd(c,o)?c._flushSync?(c._flushSync=!1,Lt(o)):m&&hc(()=>{Lt(o)}):(c._flushSync=!1,m&&(n.clear(),o._deferred=[],o._pendingEditorState=null))}function xe(o,e,t){o._updating?o._updates.push([e,t]):jd(o,e,t)}var J=class extends bt{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__style="",this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__style=e.__style,this.__dir=e.__dir}getStyle(){return this.getLatest().__style}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=G()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;t!==null;){if(b(t)&&e.push(t),E(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;E(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;E(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let i=t[n-1];return E(i)&&i.getLastDescendant()||i||null}let r=t[e];return E(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:j(t)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&x(!1,"Expected node %s to have a first child.",this.__key),e}getLastChild(){let t=this.getLatest().__last;return t===null?null:j(t)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&x(!1,"Expected node %s to have a last child.",this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="",t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),E(i)&&r!==n-1&&!i.isInline()&&(e+=Ve)}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),E(i)&&r!==n-1&&!i.isInline()&&(e+=Ve.length)}return e}getDirection(){return this.getLatest().__dir}select(e,t){ce();let n=T(),r=e,i=t,s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let a=this.getFirstChild();if(b(a)||E(a))return a.select(0,0)}else if((e===void 0||e===s)&&(t===void 0||t===s)){let a=this.getLastChild();if(b(a)||E(a))return a.select()}}r===void 0&&(r=s),i===void 0&&(i=s);let l=this.__key;if(C(n))n.anchor.set(l,r,"element"),n.focus.set(l,i,"element"),n.dirty=!0;else return Ti(l,r,l,i,"element","element");return n}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(n=>n.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setStyle(e){let t=this.getWritable();return t.__style=e||"",this}splice(e,t,n){let r=n.length,i=this.getChildrenSize(),s=this.getWritable(),l=s.__key,a=[],c=[],m=this.getChildAtIndex(e+t),f=null,d=i-t+r;if(e!==0)if(e===i)f=this.getLastChild();else{let p=this.getChildAtIndex(e);p!==null&&(f=p.getPreviousSibling())}if(t>0){let p=f===null?this.getFirstChild():f.getNextSibling();for(let g=0;g<t;g++){p===null&&x(!1,"splice: sibling not found");let h=p.getNextSibling(),_=p.__key,N=p.getWritable();Wt(N),c.push(_),p=h}}let u=f;for(let p=0;p<r;p++){let g=n[p];u!==null&&g.is(u)&&(f=u=u.getPreviousSibling());let h=g.getWritable();h.__parent===l&&d--,Wt(h);let _=g.__key;if(u===null)s.__first=_,h.__prev=null;else{let N=u.getWritable();N.__next=_,h.__prev=N.__key}g.__key===l&&x(!1,"append: attempting to append self"),h.__parent=l,a.push(_),u=g}if(e+t===i){if(u!==null){let p=u.getWritable();p.__next=null,s.__last=u.__key}}else if(m!==null){let p=m.getWritable();if(u!==null){let g=u.getWritable();p.__prev=u.__key,g.__next=m.__key}else p.__prev=null}if(s.__size=d,c.length){let p=T();if(C(p)){let g=new Set(c),h=new Set(a),{anchor:_,focus:N}=p;eu(_,g,h)&&Sn(_,_.getNode(),this,f,m),eu(N,g,h)&&Sn(N,N.getNode(),this,f,m),d===0&&!this.canBeEmpty()&&!me(this)&&this.remove()}}return s}exportJSON(){return{children:[],direction:this.getDirection(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}};function E(o){return o instanceof J}function eu(o,e,t){let n=o.getNode();for(;n;){let r=n.__key;if(e.has(r)&&!t.has(r))return!0;n=n.getParent()}return!1}var Mt=class extends bt{constructor(e){super(e)}decorate(e,t){x(!1,"decorate: base method not extended")}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function B(o){return o instanceof Mt}var Uo=class o extends J{static getType(){return"root"}static clone(){return new o}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){x(!1,"getTopLevelElementOrThrow: root nodes are not top level elements")}getTextContent(){let e=this.__cachedText;return(st()||G()._dirtyType===Ct)&&e!==null?e:super.getTextContent()}remove(){x(!1,"remove: cannot be called on root nodes")}replace(e){x(!1,"replace: cannot be called on root nodes")}insertBefore(e){x(!1,"insertBefore: cannot be called on root nodes")}insertAfter(e){x(!1,"insertAfter: cannot be called on root nodes")}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){let n=e[t];!E(n)&&!B(n)&&x(!1,"rootNode.append: Only element or decorator nodes can be appended to the root node")}return super.append(...e)}static importJSON(e){let t=F();return t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),type:"root",version:1}}collapseAtStart(){return!0}};function tu(){return new Uo}function te(o){return o instanceof Uo}function Jd(o,e){let t=e.getEditorState()._selection,n=o._selection;if(n!==null){if(n.dirty||!n.is(t))return!0}else if(t!==null)return!0;return!1}function Qd(o){return new yi(new Map(o._nodeMap))}function Sr(){return new yi(new Map([["root",tu()]]))}function ou(o){let e=o.exportJSON(),t=o.constructor;if(e.type!==t.getType()&&x(!1,"LexicalNode: Node %s does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.",t.name),E(o)){let n=e.children;Array.isArray(n)||x(!1,"LexicalNode: Node %s is an element but .exportJSON() does not have a children array.",t.name);let r=o.getChildren();for(let i=0;i<r.length;i++){let s=r[i],l=ou(s);n.push(l)}}return e}var yi=class o{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Dl(t&&t.editor||null,this,e)}clone(e){let t=new o(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Dl(null,this,()=>({root:ou(F())}))}};var Eo=class extends J{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}};function y(o,e={},t=[]){let n=document.createElement(o),r=Object.keys(e);for(let i of r)e[i]!==null&&n.setAttribute(i,e[i]);for(let i of t)typeof i=="string"?n.append(document.createTextNode(i)):n.append(i);return n}function nu(o){return new DOMParser().parseFromString(o,"text/html")}function ft(o,e="px"){return typeof o=="number"||/^-?\d+$/.test(o)?`${o}${e}`:o}function zo(o){return/^-?\d+$/.test(o)?Number(o):/^-?\d+\.\d+$/.test(o)?Math.round(Number(o)):/^-?\d+px\s*$/.test(o)?Number(o.trim().replace("px","")):0}function Mn(o){let e=new Map,n=(o.getAttribute("style")||"").split(";");for(let r of n){let[i,s]=r.split(":");!i||!s||e.set(i.trim().toLowerCase(),s.trim())}return e}function ru(o,e,t){t?o.setAttribute(e,t):o.removeAttribute(e)}var hN=["left","right","center","justify"];function Lr(o){let e=o.style.textAlign||"";return hN.includes(e)?e:o.classList.contains("align-left")?"left":o.classList.contains("align-right")?"right":o.classList.contains("align-center")?"center":o.classList.contains("align-justify")?"justify":""}function NN(o){let e=o.style.paddingLeft||"0";return zo(e)}function Mr(o){let e=(o.dir||"").toLowerCase();return e==="rtl"||e==="ltr"?e:null}function Qe(o,e){o.id&&e.setId(o.id),e.setAlignment(Lr(o)),e.setInset(NN(o)),e.setDirection(Mr(o))}function vt(o,e){return o.__id!==e.__id||o.__alignment!==e.__alignment||o.__inset!==e.__inset||o.__dir!==e.__dir}function et(o,e){e.__id&&o.setAttribute("id",e.__id),e.__alignment&&o.classList.add("align-"+e.__alignment),e.__inset&&(o.style.paddingLeft=`${e.__inset}px`),e.__dir&&(o.dir=e.__dir)}function tt(o,e){e.setId(o.id),e.setAlignment(o.alignment),e.setInset(o.inset),e.setDirection(o.direction)}var wt=class extends J{constructor(){super(...arguments);this.__id="";this.__alignment="";this.__inset=0}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}setAlignment(t){let n=this.getWritable();n.__alignment=t}getAlignment(){return this.getLatest().__alignment}setInset(t){let n=this.getWritable();n.__inset=t}getInset(){return this.getLatest().__inset}exportJSON(){return{...super.exportJSON(),id:this.__id,alignment:this.__alignment,inset:this.__inset}}};function To(o,e){e.__alignment=o.__alignment,e.__inset=o.__inset}var dt=class o extends wt{constructor(e){super(e),this.__textStyle=""}static getType(){return"paragraph"}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new o(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textStyle=e.__textStyle,To(e,this)}createDOM(e){let t=document.createElement("p"),n=fo(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),et(t,this),t}updateDOM(e,t,n){return vt(e,this)}static importDOM(){return{p:e=>({conversion:xN,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);return t&&pe(t)&&this.isEmpty()&&t.append(document.createElement("br")),{element:t}}static importJSON(e){let t=$();return tt(e,t),t}exportJSON(){return{...super.exportJSON(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){let n=$();n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||b(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function xN(o){let e=$();return Qe(o,e),{node:e}}function $(){return oe(new dt)}function ct(o){return o instanceof dt}var EN=!0,Z=0,Dt=1,bi=2,qe=3,Re=4;function Ol(o,e,t,n){let r=o._keyToDOMMap;r.clear(),o._editorState=Sr(),o._pendingEditorState=n,o._compositionKey=null,o._dirtyType=Ct,o._cloneNotNeeded.clear(),o._dirtyLeaves=new Set,o._dirtyElements.clear(),o._normalizedNodes=new Set,o._updateTags=new Set,o._updates=[],o._blockCursorElement=null;let i=o._observer;i!==null&&(i.disconnect(),o._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",r.set("root",t))}function TN(o,e){let t=new Map,n=new Set,r=i=>{Object.keys(i).forEach(s=>{let l=t.get(s);l===void 0&&(l=[],t.set(s,l)),l.push(i[s])})};return o.forEach(i=>{let s=i.klass.importDOM;if(s==null||n.has(s))return;n.add(s);let l=s.call(i.klass);l!==null&&r(l)}),e&&r(e),t}function Al(o){let e=o||{},t=Vd(),n=e.theme||{},r=o===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,s=Sr(),l=e.namespace||(r!==null?r._config.namespace:Gs()),a=e.editorState,c=[Uo,Je,Po,Bo,dt,Eo,...e.nodes||[]],{onError:m,html:f}=e,d=e.editable!==void 0?e.editable:!0,u;if(o===void 0&&t!==null)u=t._nodes;else{u=new Map;for(let g=0;g<c.length;g++){let h=c[g],_=null,N=null;if(typeof h!="function"){let A=h;h=A.replace,_=A.with,N=A.withKlass||null}if(__DEV__){let A=Object.prototype.hasOwnProperty.call(h,"getType")&&h.getType(),O=h.name;if(N&&x(N.prototype instanceof h,"%s doesn't extend the %s",N.name,O),O!=="RootNode"&&A!=="root"&&A!=="artificial"){let R=h.prototype;["getType","clone"].forEach(P=>{h.hasOwnProperty(P)||console.warn(`${O} must implement static "${P}" method`)}),!h.hasOwnProperty("importDOM")&&h.hasOwnProperty("exportDOM")&&console.warn(`${O} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`),R instanceof Mt&&(R.hasOwnProperty("decorate")||console.warn(`${R.constructor.name} must implement "decorate" method`)),h.hasOwnProperty("importJSON")||console.warn(`${O} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`),R.hasOwnProperty("exportJSON")||console.warn(`${O} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`)}}let L=h.getType(),M=h.transform(),S=new Set;M!==null&&S.add(M),u.set(L,{exportDOM:f&&f.export?f.export.get(h):void 0,klass:h,replace:_,replaceWithKlass:N,transforms:S})}}let p=new po(s,r,u,{disableEvents:i,namespace:l,theme:n},m||console.error,TN(u,f?f.import:void 0),d);return a!==void 0&&(p._pendingEditorState=a,p._dirtyType=Ut),p}var po=class{constructor(e,t,n,r,i,s,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=Ct,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Gs(),this._onError=i,this._htmlConversions=s,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){let t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){let t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){let t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){let t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&x(!1,'Listener for type "command" requires a "priority".');let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&x(!1,"registerCommand: Command %s not found in command map",String(e));let s=i[n];return s.add(t),()=>{s.delete(t),i.every(l=>l.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,r);let s=n&&n.skipInitialization;return(s===void 0?EN:s)||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&x(!1,"Node %s has not been registered. Ensure node has been passed to createEditor.",e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=od(n).get(t.getType());if(!r)return;let i=new Map;for(let s of r.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let s=this.registerNodeTransformToKlass(i,t);r.push(s)}return Tc(this,e.getType()),()=>{r.forEach(s=>s.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return D(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=fo(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Ol(this,t,e,r),t!==null&&(this._config.disableEvents||bd(t),n!=null&&t.classList.remove(...n)),e!==null){let i=ed(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Ut,ti(this),this._updateTags.add("history-merge"),Lt(this),this._config.disableEvents||yd(e,this),n!=null&&e.classList.add(...n)}else this._editorState=r,this._pendingEditorState=null,this._window=null;Ln("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&x(!1,"setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty."),ei(this);let n=this._pendingEditorState,r=this._updateTags,i=t!==void 0?t.tag:null;n!==null&&!n.isEmpty()&&(i!=null&&r.add(i),Lt(this)),this._pendingEditorState=e,this._dirtyType=Ut,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&r.add(i),Lt(this)}parseEditorState(e,t){let n=typeof e=="string"?JSON.parse(e):e;return Xd(n,this,t)}read(e){return Lt(this),this.getEditorState().read(e,{editor:this})}update(e,t){xe(this,e,t)}updateAndCommit(e,t){this.update(e,t),this.commitUpdates()}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),xe(this,()=>{let r=T(),i=F();r!==null?r.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}commitUpdates(){Lt(this)}blur(){let e=this._rootElement;e!==null&&e.blur();let t=ye(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ln("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};po.version="0.17.1";function Xt(...o){return()=>{for(let e=o.length-1;e>=0;e--)o[e]();o.length=0}}var vn=new Map;function Rl(o){let e={},t=o.split(";");for(let n of t)if(n!==""){let[r,i]=n.split(/:([^]+)/);r&&i&&(e[r.trim()]=i.trim())}return e}function wn(o){let e=vn.get(o);return e===void 0&&(e=Rl(o),vn.set(o,e)),__DEV__&&Object.freeze(e),e}function su(o){let e="";for(let t in o)t&&(e+=`${t}: ${o[t]};`);return e}function vr(o,e){let t=o.getStartEndPoints();if(e.isSelected(o)&&!e.isSegmented()&&!e.isToken()&&t!==null){let[n,r]=t,i=o.isBackward(),s=n.getNode(),l=r.getNode(),a=e.is(s),c=e.is(l);if(a||c){let[m,f]=br(o),d=s.is(l),u=e.is(i?l:s),p=e.is(i?s:l),g=0,h;if(d)g=m>f?f:m,h=m>f?m:f;else if(u)g=i?f:m,h=void 0;else if(p){let _=i?m:f;g=0,h=_}return e.__text=e.__text.slice(g,h),e}}return e}function kl(o){let e=o.getStyle(),t=Rl(e);vn.set(e,t)}function Dn(o,e){let t=wn("getStyle"in o?o.getStyle():o.style),n=Object.entries(e).reduce((i,[s,l])=>(typeof l=="function"?i[s]=l(t[s],o):l===null?delete i[s]:i[s]=l,i),{...t}),r=su(n);o.setStyle(r),vn.set(r,n)}function Il(o,e){let t=o.getNodes(),n=t.length,r=o.getStartEndPoints();if(r===null)return;let[i,s]=r,l=n-1,a=t[0],c=t[l];if(o.isCollapsed()&&C(o)){Dn(o,e);return}let f=a.getTextContent().length,d=s.offset,u=i.offset,p=i.isBefore(s),g=p?u:d,h=p?d:u,_=p?i.type:s.type,N=p?s.type:i.type,L=p?s.key:i.key;if(b(a)&&g===f){let M=a.getNextSibling();b(M)&&(u=0,g=0,a=M)}if(t.length===1){if(b(a)&&a.canHaveFormat()){if(g=_==="element"?0:u>d?d:u,h=N==="element"?f:u>d?u:d,g===h)return;if(ze(a)||g===0&&h===f)Dn(a,e),a.select(g,h);else{let M=a.splitText(g,h),S=g===0?M[0]:M[1];Dn(S,e),S.select(0,h-g)}}}else{if(b(a)&&g<a.getTextContentSize()&&a.canHaveFormat()&&(g!==0&&!ze(a)&&(a=a.splitText(g)[1],g=0,p?i.set(a.getKey(),g,"text"):s.set(a.getKey(),g,"text")),Dn(a,e)),b(c)&&c.canHaveFormat()){let S=c.getTextContent().length;c.__key!==L&&h!==0&&(h=S),h!==S&&!ze(c)&&([c]=c.splitText(h)),(h!==0||N==="element")&&Dn(c,e)}for(let M=1;M<l;M++){let S=t[M],A=S.getKey();b(S)&&S.canHaveFormat()&&A!==a.getKey()&&A!==c.getKey()&&!S.isToken()&&Dn(S,e)}}}function Si(o,e){if(o===null)return;let t=o.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){let s=e(),l=F(),a=l.getFirstChild();a?a.replace(s,!0):l.append(s);return}let r=o.getNodes(),i=n!==null?CN(n.getNode(),lu):!1;i&&r.indexOf(i)===-1&&r.push(i);for(let s=0;s<r.length;s++){let l=r[s];if(!lu(l))continue;x(E(l),"Expected block node to be an ElementNode");let a=e();l.replace(a,!0)}}function Li(o,e){let t=qt(o.focus,e);return B(t)&&!t.isIsolated()||E(t)&&!t.isInline()&&!t.canBeEmpty()}function au(o,e,t,n){o.modify(e?"extend":"move",t,n)}function cu(o){let e=o.anchor.getNode();return(te(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Mi(o,e,t){let n=cu(o);au(o,e,t?!n:n,"character")}function _N(o,e,t){let n=o.getStyle(),r=wn(n);return r!==null&&r[e]||t}function $l(o,e,t=""){let n=null,r=o.getNodes(),i=o.anchor,s=o.focus,l=o.isBackward(),a=l?s.offset:i.offset,c=l?s.getNode():i.getNode();if(C(o)&&o.isCollapsed()&&o.style!==""){let m=o.style,f=wn(m);if(f!==null&&e in f)return f[e]}for(let m=0;m<r.length;m++){let f=r[m];if(!(m!==0&&a===0&&f.is(c))&&b(f)){let d=_N(f,e,t);if(n===null)n=d;else if(n!==d){n="";break}}}return n===null?t:n}function lu(o){if(B(o)||!E(o)||me(o))return!1;let e=o.getFirstChild(),t=e===null||we(e)||b(e)||e.isInline();return!o.isInline()&&o.canBeEmpty()!==!1&&t}function CN(o,e){let t=o;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Te(o,...e){let t=yt(...e);t.length>0&&o.classList.add(...t)}function vi(o,...e){let t=yt(...e);t.length>0&&o.classList.remove(...t)}function du(o,e){let t=o;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function uu(o){let e=H(o,t=>E(t)&&!t.isInline());return E(e)||x(!1,"Expected node %s to have closest block element node.",o.__key),e}var H=(o,e)=>{let t=o;for(;t!==F()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function mt(o,e){return o!==null?Object.getPrototypeOf(o).constructor.name===e.name:!1}var wi=0,Pl=1,Bl=2,pt=0,LN=1,fu=2,MN=3,vN=4;function wN(o,e,t){let n=o._nodeMap,r=[];for(let i of e){let s=n.get(i);s!==void 0&&r.push(s)}for(let[i,s]of t){if(!s)continue;let l=n.get(i);l!==void 0&&!te(l)&&r.push(l)}return r}function DN(o,e,t,n,r){if(o===null||t.size===0&&n.size===0&&!r)return pt;let i=e._selection,s=o._selection;if(r)return LN;if(!C(i)||!C(s)||!s.isCollapsed()||!i.isCollapsed())return pt;let l=wN(e,t,n);if(l.length===0)return pt;if(l.length>1){let _=e._nodeMap,N=_.get(i.anchor.key),L=_.get(s.anchor.key);return N&&L&&!o._nodeMap.has(N.__key)&&b(N)&&N.__text.length===1&&i.anchor.offset===1?fu:pt}let a=l[0],c=o._nodeMap.get(a.__key);if(!b(c)||!b(a)||c.__mode!==a.__mode)return pt;let m=c.__text,f=a.__text;if(m===f)return pt;let d=i.anchor,u=s.anchor;if(d.key!==u.key||d.type!=="text")return pt;let p=d.offset,g=u.offset,h=f.length-m.length;return h===1&&g===p-1?fu:h===-1&&g===p+1?MN:h===-1&&g===p?vN:pt}function ON(o,e,t){let n=e._nodeMap.get(o),r=t._nodeMap.get(o),i=e._selection,s=t._selection;return!(C(i)&&C(s)&&i.anchor.type==="element"&&i.focus.type==="element"&&s.anchor.type==="text"&&s.focus.type==="text")&&b(n)&&b(r)&&n.__parent===r.__parent?JSON.stringify(e.read(()=>n.exportJSON()))===JSON.stringify(t.read(()=>r.exportJSON())):!1}function AN(o,e){let t=Date.now(),n=pt;return(r,i,s,l,a,c)=>{let m=Date.now();if(c.has("historic"))return n=pt,t=m,Bl;let f=DN(r,i,l,a,o.isComposing()),d=(()=>{let u=s===null||s.editor===o,p=c.has("history-push");if(!p&&u&&c.has("history-merge"))return wi;if(r===null)return Pl;let h=i._selection;if(!(l.size>0||a.size>0))return h!==null?wi:Bl;if(p===!1&&f!==pt&&f===n&&m<t+e&&u)return wi;if(l.size===1){let N=Array.from(l)[0];if(ON(N,r,i))return wi}return Pl})();return t=m,n=f,d}}function RN(o,e){let t=e.redoStack,n=e.undoStack;if(t.length!==0){let r=e.current;r!==null&&(n.push(r),o.dispatchCommand(ao,!0));let i=t.pop();t.length===0&&o.dispatchCommand(lo,!1),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:"historic"})}}function kN(o,e){let t=e.redoStack,n=e.undoStack;if(n.length!==0){let i=e.current,s=n.pop();i!==null&&(t.push(i),o.dispatchCommand(lo,!0)),n.length===0&&o.dispatchCommand(ao,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}}function mu(o){o.undoStack=[],o.redoStack=[],o.current=null}function pu(o,e,t){let n=AN(o,t),r=({editorState:s,prevEditorState:l,dirtyLeaves:a,dirtyElements:c,tags:m})=>{let f=e.current,d=e.redoStack,u=e.undoStack,p=f===null?null:f.editorState;if(f!==null&&s===p)return;let g=n(l,s,f,a,c,m);if(g===Pl)d.length!==0&&(e.redoStack=[],o.dispatchCommand(lo,!1)),f!==null&&(u.push({...f}),o.dispatchCommand(ao,!0));else if(g===Bl)return;e.current={editor:o,editorState:s}};return Xt(o.registerCommand(no,()=>(kN(o,e),!0),Z),o.registerCommand(ro,()=>(RN(o,e),!0),Z),o.registerCommand(Rs,()=>(mu(e),!1),Z),o.registerCommand(ks,()=>(mu(e),o.dispatchCommand(lo,!1),o.dispatchCommand(ao,!1),!0),Z),o.registerUpdateListener(r))}function gu(){return{current:null,redoStack:[],undoStack:[]}}function Di(o,e){let t=e.body?e.body.childNodes:[],n=[],r=[];for(let i=0;i<t.length;i++){let s=t[i];if(!xu.has(s.nodeName)){let l=Eu(s,o,r,!1);l!==null&&(n=n.concat(l))}}return $N(r),n}function Oi(o,e){if(typeof document>"u"||typeof window>"u"&&typeof global.window>"u")throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let t=document.createElement("div"),r=F().getChildren();for(let i=0;i<r.length;i++){let s=r[i];Nu(o,s,t,e)}return t.innerHTML}function Nu(o,e,t,n=null){let r=n!==null?e.isSelected(n):!0,i=E(e)&&e.excludeFromCopy("html"),s=e;if(n!==null){let u=Yt(e);u=b(u)&&n!==null?vr(n,u):u,s=u}let l=E(s)?s.getChildren():[],a=o._nodes.get(s.getType()),c;a&&a.exportDOM!==void 0?c=a.exportDOM(o,s):c=s.exportDOM(o);let{element:m,after:f}=c;if(!m)return!1;let d=document.createDocumentFragment();for(let u=0;u<l.length;u++){let p=l[u],g=Nu(o,p,d,n);!r&&E(e)&&g&&e.extractWithChild(p,n,"html")&&(r=!0)}if(r&&!i){if(pe(m)&&m.append(d),t.append(m),f){let u=f.call(s,m);u&&m.replaceWith(u)}}else t.append(d);return r}function IN(o,e){let{nodeName:t}=o,n=e._htmlConversions.get(t.toLowerCase()),r=null;if(n!==void 0)for(let i of n){let s=i(o);s!==null&&(r===null||(r.priority||0)<(s.priority||0))&&(r=s)}return r!==null?r.conversion:null}var xu=new Set(["STYLE","SCRIPT"]);function Eu(o,e,t,n,r=new Map,i){let s=[];if(xu.has(o.nodeName))return s;let l=null,a=IN(o,e),c=a?a(o):null,m=null;if(c!==null){m=c.after;let p=c.node;if(p==="ignore")return s;if(l=Array.isArray(p)?p[p.length-1]:p,l!==null){for(let[,g]of r)if(l=g(l,i),!l)break;l&&s.push(...Array.isArray(p)?p:[l])}c.forChild!=null&&r.set(o.nodeName,c.forChild)}let f=o.childNodes,d=[],u=l!=null&&me(l)?!1:l!=null&&Ho(l)||n;for(let p=0;p<f.length;p++)d.push(...Eu(f[p],e,t,u,new Map(r),l));return m!=null&&(d=m(d)),mo(o)&&(u?d=hu(o,d,()=>{let p=new Eo;return t.push(p),p}):d=hu(o,d,$)),l==null?d.length>0?s=s.concat(d):mo(o)&&PN(o)&&(s=s.concat(ut())):E(l)&&l.append(...d),s}function hu(o,e,t){let n=o.style.textAlign,r=[],i=[];for(let s=0;s<e.length;s++){let l=e[s];if(Ho(l))r.push(l);else if(i.push(l),s===e.length-1||s<e.length-1&&Ho(e[s+1])){let a=t();a.append(...i),r.push(a),i=[]}}return r}function $N(o){for(let e of o)e.getNextSibling()instanceof Eo&&e.insertAfter(ut());for(let e of o){let t=e.getChildren();for(let n of t)e.insertBefore(n);e.remove()}}function PN(o){return o.nextSibling==null||o.previousSibling==null?!1:ko(o.nextSibling)&&ko(o.previousSibling)}var _u=o=>fe?(o||window).getSelection():null;function Cu(o,e=T()){return e==null&&x(!1,"Expected valid LexicalSelection"),C(e)&&e.isCollapsed()||e.getNodes().length===0?"":Oi(o,e)}function yu(o,e=T()){return e==null&&x(!1,"Expected valid LexicalSelection"),C(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Su(o,e))}function Ai(o,e,t){let n=o.getData("application/x-lexical-editor");if(n)try{let s=JSON.parse(n);if(s.namespace===t._config.namespace&&Array.isArray(s.nodes)){let l=Lu(s.nodes);return Fl(t,l,e)}}catch{}let r=o.getData("text/html");if(r)try{let l=new DOMParser().parseFromString(r,"text/html"),a=Di(t,l);return Fl(t,a,e)}catch{}let i=o.getData("text/plain")||o.getData("text/uri-list");if(i!=null)if(C(e)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let a=T();if(C(a)){let c=s[l];c===`
|
|
`||c===`\r
|
|
`?a.insertParagraph():c===" "?a.insertNodes([St()]):a.insertText(c)}}}else e.insertRawText(i)}function Fl(o,e,t){o.dispatchCommand(jn,{nodes:e,selection:t})||t.insertNodes(e)}function BN(o){let e=o.exportJSON(),t=o.constructor;if(e.type!==t.getType()&&x(!1,"LexicalNode: Node %s does not implement .exportJSON().",t.name),E(o)){let n=e.children;Array.isArray(n)||x(!1,"LexicalNode: Node %s is an element but .exportJSON() does not have a children array.",t.name)}return e}function bu(o,e,t,n=[]){let r=e!==null?t.isSelected(e):!0,i=E(t)&&t.excludeFromCopy("html"),s=t;if(e!==null){let c=Yt(t);c=b(c)&&e!==null?vr(e,c):c,s=c}let l=E(s)?s.getChildren():[],a=BN(s);if(b(s)){let c=s.__text;c.length>0?a.text=c:r=!1}for(let c=0;c<l.length;c++){let m=l[c],f=bu(o,e,m,a.children);!r&&E(t)&&f&&t.extractWithChild(m,e,"clone")&&(r=!0)}if(r&&!i)n.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){let m=a.children[c];n.push(m)}return r}function Su(o,e){let t=[],r=F().getChildren();for(let i=0;i<r.length;i++){let s=r[i];bu(o,e,s,t)}return{namespace:o._config.namespace,nodes:t}}function Lu(o){let e=[];for(let t=0;t<o.length;t++){let n=o[t],r=vl(n);b(r)&&kl(r),e.push(r)}return e}var FN=50,On=null;async function An(o,e,t){if(On!==null)return!1;if(e!==null)return new Promise((a,c)=>{o.update(()=>{a(Tu(o,e,t))})});let n=o.getRootElement(),r=o._window==null?window.document:o._window.document,i=_u(o._window);if(n===null||i===null)return!1;let s=r.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(r.createTextNode("#")),n.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((a,c)=>{let m=o.registerCommand(io,f=>(mt(f,ClipboardEvent)&&(m(),On!==null&&(window.clearTimeout(On),On=null),a(Tu(o,f,t))),!0),Re);On=window.setTimeout(()=>{m(),On=null,a(!1)},FN),r.execCommand("copy"),s.remove()})}function Tu(o,e,t){if(t===void 0){let r=_u(o._window);if(!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!zt(o,i,s))return!1;let l=T();if(l===null)return!1;t=Ri(l)}e.preventDefault();let n=e.clipboardData;return n===null?!1:(Mu(n,t),!0)}var HN=[["text/html",Cu],["application/x-lexical-editor",yu]];function Ri(o=T()){let e={"text/plain":o?o.getTextContent():""};if(o){let t=tl();for(let[n,r]of HN){let i=r(t,o);i!==null&&(e[n]=i)}}return e}function Mu(o,e){for(let t in e){let n=e[t];n!==void 0&&o.setData(t,n)}}function ki(o,e){if(typeof document.caretRangeFromPoint<"u"){let t=document.caretRangeFromPoint(o,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}else if(document.caretPositionFromPoint!=="undefined"){let t=document.caretPositionFromPoint(o,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}else return null}var vu=I("DRAG_DROP_PASTE_FILE");function KN(o,e){o.preventDefault(),e.update(()=>{let t=T(),n=mt(o,InputEvent)||mt(o,KeyboardEvent)?null:o.clipboardData;n!=null&&t!==null&&Ai(n,t,e)},{tag:"paste"})}async function UN(o,e){await An(e,mt(o,ClipboardEvent)?o:null),e.update(()=>{let t=T();C(t)?t.removeText():Ee(t)&&t.getNodes().forEach(n=>n.remove())})}function Ii(o){let e=null;if(mt(o,DragEvent)?e=o.dataTransfer:mt(o,ClipboardEvent)&&(e=o.clipboardData),e===null)return[!1,[],!1];let t=e.types,n=t.includes("Files"),r=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),r]}function $i(o){let e=ee(o);return B(e)}function zN(o){let e=o.focus;return e.key==="root"&&e.offset===F().getChildrenSize()}function wu(o){return Xt(o.registerCommand(Jn,t=>{let n=T();return Ee(n)?(n.clear(),!0):!1},0),o.registerCommand(Ze,t=>{let n=T();return C(n)?(n.deleteCharacter(t),!0):!1},Z),o.registerCommand(Tt,t=>{let n=T();return C(n)?(n.deleteWord(t),!0):!1},Z),o.registerCommand(it,t=>{let n=T();return C(n)?(n.deleteLine(t),!0):!1},Z),o.registerCommand(rt,t=>{let n=T();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)Ai(r,n,o);else if(C(n)){let i=t.data;return i&&n.insertText(i),!0}}return!0},Z),o.registerCommand(ln,()=>{let t=T();return C(t)?(t.removeText(),!0):!1},Z),o.registerCommand(Ne,t=>{let n=T();return C(n)?(n.formatText(t),!0):!1},Z),o.registerCommand(Os,t=>{let n=T();if(!C(n)&&!Ee(n))return!1;let r=n.getNodes();for(let i of r){let s=H(i,l=>E(l)&&!l.isInline())}return!0},Z),o.registerCommand(It,t=>{let n=T();return C(n)?(n.insertLineBreak(t),!0):!1},Z),o.registerCommand($t,()=>{let t=T();return C(t)?(t.insertParagraph(),!0):!1},Z),o.registerCommand(Ds,()=>(Oe([St()]),!0),Z),o.registerCommand(Mo,t=>{let n=T();if(Ee(n)&&!$i(t.target)){let r=n.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(C(n)){let r=qt(n.focus,!0);if(!t.shiftKey&&B(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),t.preventDefault(),!0}return!1},Z),o.registerCommand(Pt,t=>{let n=T();if(Ee(n)){let r=n.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(C(n)){if(zN(n))return t.preventDefault(),!0;let r=qt(n.focus,!1);if(!t.shiftKey&&B(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),t.preventDefault(),!0}return!1},Z),o.registerCommand(Lo,t=>{let n=T();if(Ee(n)){let r=n.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectPrevious(),!0}if(!C(n))return!1;if(Li(n,!0)){let r=t.shiftKey;return t.preventDefault(),Mi(n,r,!0),!0}return!1},Z),o.registerCommand(So,t=>{let n=T();if(Ee(n)&&!$i(t.target)){let i=n.getNodes();if(i.length>0)return t.preventDefault(),i[0].selectNext(0,0),!0}if(!C(n))return!1;let r=t.shiftKey;return Li(n,!1)?(t.preventDefault(),Mi(n,r,!1),!0):!1},Z),o.registerCommand(Bt,t=>{if($i(t.target))return!1;let n=T();return C(n)?(t.preventDefault(),o.dispatchCommand(Ze,!0)):!1},Z),o.registerCommand(Ft,t=>{if($i(t.target))return!1;let n=T();return C(n)?(t.preventDefault(),o.dispatchCommand(Ze,!1)):!1},Z),o.registerCommand(Fe,t=>{let n=T();if(!C(n))return!1;if(t!==null){if((_t||Ht||Kt)&&co)return!1;if(t.preventDefault(),t.shiftKey)return o.dispatchCommand(It,!1)}return o.dispatchCommand($t,void 0)},Z),o.registerCommand(vo,()=>{let t=T();return C(t)?(o.blur(),!0):!1},Z),o.registerCommand(Do,t=>{let[,n]=Ii(t);if(n.length>0){let i=t.clientX,s=t.clientY,l=ki(i,s);if(l!==null){let{offset:a,node:c}=l,m=ee(c);if(m!==null){let f=Ko();if(b(m))f.anchor.set(m.getKey(),a,"text"),f.focus.set(m.getKey(),a,"text");else{let u=m.getParentOrThrow().getKey(),p=m.getIndexWithinParent()+1;f.anchor.set(u,p,"element"),f.focus.set(u,p,"element")}let d=Oo(f);q(d)}o.dispatchCommand(vu,n)}return t.preventDefault(),!0}let r=T();return!!C(r)},Z),o.registerCommand(er,t=>{let[n]=Ii(t),r=T();return!(n&&!C(r))},Z),o.registerCommand(tr,t=>{let[n]=Ii(t),r=T();if(n&&!C(r))return!1;let i=t.clientX,s=t.clientY,l=ki(i,s);if(l!==null){let a=ee(l.node);B(a)&&t.preventDefault()}return!0},Z),o.registerCommand(an,()=>(Qs(),!0),Z),o.registerCommand(io,t=>(An(o,mt(t,ClipboardEvent)?t:null),!0),Z),o.registerCommand(so,t=>(UN(t,o),!0),Z),o.registerCommand(oo,t=>{let[,n,r]=Ii(t);return n.length>0&&!r?(o.dispatchCommand(vu,n),!0):Nn(t.target)?!1:T()!==null?(KN(t,o),!0):!1},Z))}var Wo=class o extends J{constructor(t,n){super(n);this.__id="";this.__category="info";this.__alignment="";this.__inset=0;this.__category=t}static getType(){return"callout"}static clone(t){let n=new o(t.__category,t.__key);return n.__id=t.__id,n.__alignment=t.__alignment,n.__inset=t.__inset,n}setCategory(t){let n=this.getWritable();n.__category=t}getCategory(){return this.getLatest().__category}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}setAlignment(t){let n=this.getWritable();n.__alignment=t}getAlignment(){return this.getLatest().__alignment}setInset(t){let n=this.getWritable();n.__inset=t}getInset(){return this.getLatest().__inset}createDOM(t,n){let r=document.createElement("p");return r.classList.add("callout",this.__category||""),et(r,this),r}updateDOM(t){return t.__category!==this.__category||vt(t,this)}insertNewAfter(t,n){let r=t?t.anchor.offset:0,i=r===this.getTextContentSize()||!t?$():Rn(this.__category);if(i.setDirection(this.getDirection()),this.insertAfter(i,n),r===0&&!this.isEmpty()&&t){let s=$();s.select(),this.replace(s,!0)}return i}static importDOM(){return{p(t){return t.classList.contains("callout")?{conversion:n=>{let r="info",i=["info","success","warning","danger"];for(let l of i)if(n.classList.contains(l)){r=l;break}let s=new o(r);return Qe(n,s),{node:s}},priority:3}:null}}}exportJSON(){return{...super.exportJSON(),type:"callout",version:1,category:this.__category,id:this.__id,alignment:this.__alignment,inset:this.__inset}}static importJSON(t){let n=Rn(t.category);return tt(t,n),n}};function Rn(o="info"){return new Wo(o)}function Hl(o){return o instanceof Wo}function Kl(o,e="info"){return o instanceof Wo&&o.getCategory()===e}var WN=new Set(["http:","https:","mailto:","sms:","tel:"]),kn=class o extends J{static getType(){return"link"}static clone(e){return new o(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);let{target:r=null,rel:i=null,title:s=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){let t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Te(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){let r=this.__url,i=this.__target,s=this.__rel,l=this.__title;r!==e.__url&&(t.href=r),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),s!==e.__rel&&(s?t.rel=s:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:qN,priority:1})}}static importJSON(e){let t=gt(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setDirection(e.direction),t}sanitizeUrl(e){try{let t=new URL(e);if(!WN.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();t.__url=e}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();t.__target=e}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();t.__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();t.__title=e}insertNewAfter(e,t=!0){let n=gt(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!C(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function qN(o){let e=null;if(di(o)){let t=o.textContent;(t!==null&&t!==""||o.children.length>0)&&(e=gt(o.getAttribute("href")||"",{rel:o.getAttribute("rel"),target:o.getAttribute("target"),title:o.getAttribute("title")}))}return{node:e}}function gt(o,e){return oe(new kn(o,e))}function Ot(o){return o instanceof kn}var MS=I("TOGGLE_LINK_COMMAND");function YN(o){return o.map(e=>{if(b(e)){let t=$();return t.append(e),t}return e})}function _o(o,e){let t=nu(e),n=Di(o,t);return YN(n)}function At(o,e){for(let t of o.getParents())if(e(t))return t;return null}function Ul(o,e){e||(e=F());let t=[];for(let n of e.getChildren())o(n)&&t.push(n),E(n)&&t.push(...Ul(o,n));return t}function Du(o,e,t){let n=F().getChildren();for(let r of n){let i=o.getElementByKey(r.__key);if(!i)continue;let s=i.getBoundingClientRect();if(t<=s.bottom)return r}return null}function In(o){let e=t=>(E(t)||B(t))&&!t.isInline()&&!te(t);return e(o)?o:H(o,e)}function wr(o){return"__alignment"in o}function Ou(o){return"__inset"in o}var Au=new WeakMap;function le(o){return Au.get(o)||null}function Ru(o,e){Au.set(o,e)}function ae(o,e){return V(o,e)!==null}function V(o,e){if(!o)return null;for(let t of o.getNodes()){if(e(t))return t;let n=At(t,e);if(n)return n}return null}function ku(o){return V(o,b)}function Iu(o,e){if(!o)return!1;for(let t of o.getNodes())if(b(t)&&t.hasFormat(e))return!0;return!1}function $n(o,e){let t=T(),n=t?uu(t.getNodes()[0]):null;t&&o(n)?Si(t,$):Si(t,e)}function qo(o,e=!0){zl([o],e)}function zl(o,e=!0){let t=T()?.getNodes()||[],n=t.length>0?In(t[0]):null;if(n)if(e)for(let r=o.length-1;r>=0;r--)n.insertAfter(o[r]);else for(let r of o)n.insertBefore(r);else F().append(...o)}function ke(o){let e=Fo();e.add(o.getKey()),q(e)}function $u(o){for(let e of o){if(b(e))return e;if(E(e)){let t=e.getChildren(),n=$u(t);if(n!==null)return n}}return null}function Pu(o){let e=[...o].reverse();for(let t of e){if(b(t))return t;if(E(t)){let n=[...t.getChildren()].reverse(),r=Pu(n);if(r!==null)return r}}return null}function Bu(o){if(o.length===0)return;let e=Ko(),t=$u(o),n=Pu(o);t&&n&&(e.setTextNodeRange(t,0,n,n.getTextContentSize()||0),q(e))}function Fu(o){let e=le(o);e&&window.requestAnimationFrame(()=>{o.update(()=>{q(e.clone())})})}function Pi(o,e){if(!o)return!1;let t=e.getKey();for(let n of o.getNodes())if(n.getKey()===t)return!0;return!1}function Dr(o,e){let t=[...o?.getNodes()||[],...Rt(o)];for(let n of t)if(wr(n)&&n.getAlignment()===e)return!0;return!1}function Wl(o,e){let t=[...o?.getNodes()||[],...Rt(o)];for(let n of t)if(Ho(n)&&n.getDirection()===e)return!0;return!1}function Rt(o){if(!o)return[];let e=new Map;for(let t of o.getNodes()){let n=In(t);E(n)&&e.set(n.getKey(),n)}return Array.from(e.values())}var Yo=class o extends J{constructor(t,n,r){super(r);this.__src="";this.__alt="";this.__width=0;this.__height=0;this.__alignment="";this.__src=t,n.alt&&(this.__alt=n.alt),n.width&&(this.__width=n.width),n.height&&(this.__height=n.height)}static getType(){return"image"}static clone(t){let n=new o(t.__src,{alt:t.__alt,width:t.__width,height:t.__height},t.__key);return n.__alignment=t.__alignment,n}setSrc(t){let n=this.getWritable();n.__src=t}getSrc(){return this.getLatest().__src}setAltText(t){let n=this.getWritable();n.__alt=t}getAltText(){return this.getLatest().__alt}setHeight(t){let n=this.getWritable();n.__height=t}getHeight(){return this.getLatest().__height}setWidth(t){let n=this.getWritable();n.__width=t}getWidth(){return this.getLatest().__width}setAlignment(t){let n=this.getWritable();n.__alignment=t}getAlignment(){return this.getLatest().__alignment}isInline(){return!0}createDOM(t,n){let r=document.createElement("img");return r.setAttribute("src",this.__src),this.__width&&r.setAttribute("width",String(this.__width)),this.__height&&r.setAttribute("height",String(this.__height)),this.__alt&&r.setAttribute("alt",this.__alt),this.__alignment&&r.classList.add("align-"+this.__alignment),r.addEventListener("click",i=>{n.update(()=>{ke(this)})}),r}updateDOM(t,n){return t.__src!==this.__src&&n.setAttribute("src",this.__src),t.__width!==this.__width&&(this.__width?n.setAttribute("width",String(this.__width)):n.removeAttribute("width")),t.__height!==this.__height&&(this.__height?n.setAttribute("height",String(this.__height)):n.removeAttribute("height")),t.__alt!==this.__alt&&(this.__alt?n.setAttribute("alt",String(this.__alt)):n.removeAttribute("alt")),t.__alignment!==this.__alignment&&(t.__alignment&&n.classList.remove("align-"+t.__alignment),this.__alignment&&n.classList.add("align-"+this.__alignment)),!1}static importDOM(){return{img(t){return{conversion:n=>{let r=n.getAttribute("src")||"",i={alt:n.getAttribute("alt")||"",height:Number.parseInt(n.getAttribute("height")||"0"),width:Number.parseInt(n.getAttribute("width")||"0")},s=new o(r,i);return s.setAlignment(Lr(n)),{node:s}},priority:3}}}}exportJSON(){return{...super.exportJSON(),type:"image",version:1,src:this.__src,alt:this.__alt,height:this.__height,width:this.__width,alignment:this.__alignment}}static importJSON(t){let n=Pn(t.src,{alt:t.alt,width:t.width,height:t.height});return n.setAlignment(t.alignment),n}};function Pn(o,e={}){return new Yo(o,e)}function ht(o){return o instanceof Yo}var Bn=class o extends J{constructor(){super(...arguments);this.__id="";this.__summary="";this.__open=!1}static getType(){return"details"}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}setSummary(t){let n=this.getWritable();n.__summary=t}getSummary(){return this.getLatest().__summary}setOpen(t){let n=this.getWritable();n.__open=t}getOpen(){return this.getLatest().__open}static clone(t){let n=new o(t.__key);return n.__id=t.__id,n.__dir=t.__dir,n.__summary=t.__summary,n.__open=t.__open,n}createDOM(t,n){let r=document.createElement("details");this.__id&&r.setAttribute("id",this.__id),this.__dir&&r.setAttribute("dir",this.__dir),this.__open&&r.setAttribute("open","true");let i=document.createElement("summary");return i.textContent=this.__summary,i.setAttribute("contenteditable","false"),i.addEventListener("click",s=>{s.preventDefault(),n.update(()=>{this.select()})}),r.append(i),r}updateDOM(t,n){return t.__open!==this.__open&&n.toggleAttribute("open",this.__open),t.__id!==this.__id||t.__dir!==this.__dir||t.__summary!==this.__summary}static importDOM(){return{details(t){return{conversion:n=>{let r=new o;n.id&&r.setId(n.id),n.dir&&r.setDirection(Mr(n));let i=Array.from(n.children).find(s=>s.nodeName==="SUMMARY");return r.setSummary(i?.textContent||""),{node:r}},priority:3}},summary(t){return{conversion:n=>({node:"ignore"}),priority:3}}}}exportDOM(t){let n=this.createDOM(t._config,t),r=n.querySelectorAll("[contenteditable]");for(let i of r)i.removeAttribute("contenteditable");return n.removeAttribute("open"),{element:n}}exportJSON(){return{...super.exportJSON(),type:"details",version:1,id:this.__id,summary:this.__summary}}static importJSON(t){let n=ql();return n.setId(t.id),n.setDirection(t.direction),n}};function ql(){return new Bn}function Ie(o){return o instanceof Bn}function Yl(o){let e=1,t=o.getParent();for(;t!=null;){if(X(t)){let n=t.getParent();if(U(n)){e++,t=n.getParent();continue}x(!1,"A ListItemNode must have a ListNode for a parent.")}return e}return e}function Zl(o){let e=o.getParent();U(e)||x(!1,"A ListItemNode must have a ListNode for a parent.");let t=e;for(;t!==null;)t=t.getParent(),U(t)&&(e=t);return e}function Vl(o){let e=[],t=o.getChildren().filter(X);for(let n=0;n<t.length;n++){let r=t[n],i=r.getFirstChild();U(i)?e=e.concat(Vl(i)):e.push(r)}return e}var y0=Symbol.for("@lexical/NestedListNodeBrand");function Fn(o){return X(o)&&U(o.getFirstChild())}function Hu(o){return $e().append(o)}function Uu(o,e){return X(o)&&(e.length===0||e.length===1&&o.is(e[0])&&o.getChildrenSize()===0)}function Xl(o,e){o.update(()=>{let t=T();if(t!==null){let n=t.getNodes();if(C(t)){let i=t.getStartEndPoints();x(i!==null,"insertList: anchor should be defined");let[s]=i,l=s.getNode(),a=l.getParent();if(Uu(l,n)){let c=_e(e);if(me(a)){l.replace(c);let m=$e();c.append(m)}else if(X(l)){let m=l.getParentOrThrow();Or(c,m.getChildren()),m.replace(c)}return}}let r=new Set;for(let i=0;i<n.length;i++){let s=n[i];if(E(s)&&s.isEmpty()&&!X(s)&&!r.has(s.getKey())){Ku(s,e);continue}if(fr(s)){let l=s.getParent();for(;l!=null;){let a=l.getKey();if(U(l)){if(!r.has(a)){let c=_e(e);Or(c,l.getChildren()),l.replace(c),r.add(a)}break}else{let c=l.getParent();if(me(c)&&!r.has(a)){r.add(a),Ku(l,e);break}l=c}}}}}})}function Or(o,e){o.splice(o.getChildrenSize(),0,e)}function Ku(o,e){if(U(o))return o;let t=o.getPreviousSibling(),n=o.getNextSibling(),r=$e();if(Or(r,o.getChildren()),U(t)&&e===t.getListType())return t.append(r),o.remove(),U(n)&&e===n.getListType()&&(Or(t,n.getChildren()),n.remove()),t;if(U(n)&&e===n.getListType())return n.getFirstChildOrThrow().insertBefore(r),o.remove(),n;{let i=_e(e);return i.append(r),o.replace(i),i}}function Bi(o,e){let t=o.getLastChild(),n=e.getFirstChild();t&&n&&Fn(t)&&Fn(n)&&(Bi(t.getFirstChild(),n.getFirstChild()),n.remove());let r=e.getChildren();r.length>0&&o.append(...r),e.remove()}function Gl(o){o.update(()=>{let e=T();if(C(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Uu(r,n))t.add(Zl(r));else for(let i=0;i<n.length;i++){let s=n[i];if(fr(s)){let l=du(s,Gt);l!=null&&t.add(Zl(l))}}for(let i of t){let s=i,l=Vl(i);for(let a of l){let c=$();Or(c,a.getChildren()),s.insertAfter(c),s=c,a.__key===e.anchor.key&&e.anchor.set(c.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(c.getKey(),0,"element"),a.remove()}i.remove()}}})}function zu(o){let e=o.getListType()!=="check",t=o.getStart();for(let n of o.getChildren())X(n)&&(n.getValue()!==t&&n.setValue(t),e&&n.getLatest().__checked!=null&&n.setChecked(void 0),U(n.getFirstChild())||t++)}function Wu(o){let e=o.getNextSibling();U(e)&&o.getListType()===e.getListType()&&Bi(o,e)}var Gt=class o extends J{static getType(){return"listitem"}static clone(e){return new o(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){let t=document.createElement("li"),n=this.getParent();return U(n)&&n.getListType()==="check"&&Yu(t,this),t.value=this.__value,qu(this)&&(t.style.listStyle="none"),t}updateDOM(e,t,n){let r=this.getParent();return U(r)&&r.getListType()==="check"&&Yu(t,this),t.style.listStyle=qu(this)?"none":"",t.value=this.__value,!1}static transform(){return e=>{if(x(X(e),"node is not a ListItemNode"),e.__checked==null)return;let t=e.getParent();U(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:ZN,priority:0})}}static importJSON(e){let t=$e();return t.setChecked(e.checked),t.setValue(e.value),t.setDirection(e.direction),t}exportDOM(e){let t=this.createDOM(e._config);if(t.classList.contains("task-list-item")){let n=y("input",{type:"checkbox",disabled:"disabled"});t.hasAttribute("checked")&&(n.setAttribute("checked","checked"),t.removeAttribute("checked")),t.prepend(n)}return{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(E(n)&&this.canMergeWith(n)){let r=n.getChildren();this.append(...r),n.remove()}else super.append(n)}return this}replace(e,t){if(X(e))return super.replace(e);let n=this.getParentOrThrow();if(!U(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let r=_e(n.getListType()),i=this.getNextSibling();for(;i;){let s=i;i=i.getNextSibling(),r.append(s)}n.insertAfter(e),e.insertAfter(r)}return t&&(x(E(e),"includeChildren should only be true for ElementNodes"),this.getChildren().forEach(r=>{e.append(r)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(U(n)||x(!1,"insertAfter: list node is not parent of list item node"),X(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=_e(n.getListType());r.forEach(s=>i.append(s)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Fn(t)&&Fn(n)&&(Bi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){if(this.getTextContent().trim()===""&&this.isLastChild()){let r=this.getParentOrThrow(),i=r.getParent();if(X(i))return i.insertAfter(this),this.selectStart(),null;{let s=$();return r.insertAfter(s,t),this.remove(),s}}let n=$e(this.__checked==null?void 0:!1);return this.insertAfter(n,t),n}collapseAtStart(e){let t=$();this.getChildren().forEach(l=>t.append(l));let r=this.getParentOrThrow(),i=r.getParentOrThrow(),s=X(i);if(r.getChildrenSize()===1)if(s)r.remove(),i.select();else{r.insertBefore(t),r.remove();let l=e.anchor,a=e.focus,c=t.getKey();l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element")}else r.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();t.__value=e}getChecked(){let e=this.getLatest(),t,n=this.getParent();return U(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();t.__checked=e}toggleChecked(){this.setChecked(!this.__checked)}canInsertAfter(e){return X(e)}canReplaceWith(e){return X(e)}canMergeWith(e){return ct(e)||X(e)}extractWithChild(e,t){if(!C(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return _e("bullet")}canMergeWhenEmpty(){return!0}};function qu(o){let e=o.getChildren(),t=!1,n=!1;for(let r of e)U(r)?n=!0:r.getTextContent().trim().length>0&&(t=!0);return n&&!t}function Yu(o,e){let t=!U(e.getFirstChild());o.classList.toggle("task-list-item",t),e.__checked?o.setAttribute("checked","checked"):o.removeAttribute("checked")}function ZN(o){if(o.classList.contains("task-list-item")){for(let r of o.children)if(r.tagName==="INPUT")return VN(r)}let t=o.getAttribute("aria-checked");return{node:$e(t==="true"?!0:t==="false"?!1:void 0)}}function VN(o){if(!(o.getAttribute("type")==="checkbox"))return{node:null};let t=o.hasAttribute("checked");return{node:$e(t)}}function $e(o){return oe(new Gt(void 0,o))}function X(o){return o instanceof Gt}var Zo=class o extends J{constructor(t,n,r){super(r);this.__id="";let i=jN[t]||t;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=n}static getType(){return"list"}static clone(t){let n=new o(t.__listType,t.__start,t.__key);return n.__id=t.__id,n.__dir=t.__dir,n}getTag(){return this.__tag}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}setListType(t){let n=this.getWritable();n.__listType=t,n.__tag=t==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(t,n){let r=this.__tag,i=document.createElement(r);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Zu(i,t.theme,this),this.__id&&i.setAttribute("id",this.__id),this.__dir&&i.setAttribute("dir",this.__dir),i}updateDOM(t,n,r){return t.__tag!==this.__tag||t.__dir!==this.__dir||t.__id!==this.__id?!0:(Zu(n,r.theme,this),!1)}static transform(){return t=>{x(U(t),"node is not a ListNode"),Wu(t),zu(t)}}static importDOM(){return{ol:()=>({conversion:Vu,priority:0}),ul:()=>({conversion:Vu,priority:0})}}static importJSON(t){let n=_e(t.listType,t.start);return n.setId(t.id),n.setDirection(t.direction),n}exportDOM(t){let{element:n}=super.exportDOM(t);return n&&pe(n)&&(this.__start!==1&&n.setAttribute("start",String(this.__start)),this.__listType==="check"&&n.setAttribute("__lexicalListType","check")),{element:n}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1,id:this.__id}}canBeEmpty(){return!1}canIndent(){return!1}append(...t){for(let n=0;n<t.length;n++){let r=t[n];if(X(r))super.append(r);else{let i=$e();if(U(r))i.append(r);else if(E(r)){let s=Y(r.getTextContent());i.append(s)}else i.append(r);super.append(i)}}return this}extractWithChild(t){return X(t)}};function Zu(o,e,t){let n=[],r=[],i=e.list;if(i!==void 0){let s=i[`${t.__tag}Depth`]||[],l=Yl(t)-1,a=l%s.length,c=s[a],m=i[t.__tag],f,d=i.nested,u=i.checklist;if(d!==void 0&&d.list&&(f=d.list),m!==void 0&&n.push(m),u!==void 0&&t.__listType==="check"&&n.push(u),c!==void 0){n.push(...yt(c));for(let p=0;p<s.length;p++)p!==a&&r.push(t.__tag+p)}if(f!==void 0){let p=yt(f);l>1?n.push(...p):r.push(...p)}}r.length>0&&vi(o,...r),n.length>0&&Te(o,...n)}function XN(o){let e=[];for(let t of o)X(t)?e.push(t):e.push(Hu(t));return e}function GN(o){if(o.getAttribute("__lexicallisttype")==="check"||o.classList.contains("contains-task-list"))return!0;for(let e of o.childNodes)if(pe(e)&&e.hasAttribute("aria-checked"))return!0;return!1}function Vu(o){let e=o.nodeName.toLowerCase(),t=null;if(e==="ol"){let n=o.start;t=_e("number",n)}else e==="ul"&&(GN(o)?t=_e("check"):t=_e("bullet"));return o.id&&t&&t.setId(o.id),o.dir&&t&&t.setDirection(Mr(o)),{after:XN,node:t}}var jN={ol:"number",ul:"bullet"};function _e(o,e=1){return oe(new Zo(o,e))}function U(o){return o instanceof Zo}var xL=I("INSERT_UNORDERED_LIST_COMMAND"),EL=I("INSERT_ORDERED_LIST_COMMAND"),TL=I("INSERT_CHECK_LIST_COMMAND"),_L=I("REMOVE_LIST_COMMAND");var re={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},jt=class o extends J{constructor(t=re.NO_STATUS,n=1,r,i){super(i);this.__styles=new Map;this.__alignment="";this.__colSpan=n,this.__rowSpan=1,this.__headerState=t,this.__width=r,this.__backgroundColor=null}static getType(){return"tablecell"}static clone(t){let n=new o(t.__headerState,t.__colSpan,t.__width,t.__key);return n.__rowSpan=t.__rowSpan,n.__backgroundColor=t.__backgroundColor,n.__styles=new Map(t.__styles),n.__alignment=t.__alignment,n}static importDOM(){return{td:t=>({conversion:Xu,priority:0}),th:t=>({conversion:Xu,priority:0})}}static importJSON(t){let n=Pe(t.headerState,t.colSpan,t.width);return t.rowSpan&&n.setRowSpan(t.rowSpan),n.setStyles(new Map(Object.entries(t.styles))),n.setAlignment(t.alignment),n}createDOM(t){let n=document.createElement(this.getTag());this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),Te(n,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader);for(let[r,i]of this.__styles.entries())n.style.setProperty(r,i);return this.__alignment&&n.classList.add("align-"+this.__alignment),n}exportDOM(t){let{element:n}=super.exportDOM(t);return{element:n}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth(),styles:Object.fromEntries(this.__styles),alignment:this.__alignment}}getColSpan(){return this.__colSpan}setColSpan(t){return this.getWritable().__colSpan=t,this}getRowSpan(){return this.__rowSpan}setRowSpan(t){return this.getWritable().__rowSpan=t,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(t){let n=this.getWritable();return n.__headerState=t,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(t){let n=this.getWritable();return n.__width=t,this.__width}getWidth(){return this.getLatest().__width}clearWidth(){let t=this.getWritable();t.__width=void 0}getStyles(){let t=this.getLatest();return new Map(t.__styles)}setStyles(t){let n=this.getWritable();n.__styles=new Map(t)}setAlignment(t){let n=this.getWritable();n.__alignment=t}getAlignment(){return this.getLatest().__alignment}updateTag(t){let r=t.toLowerCase()==="th"?re.ROW:re.NO_STATUS,i=this.getWritable();i.__headerState=r}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(t){this.getWritable().__backgroundColor=t}toggleHeaderStyle(t){let n=this.getWritable();return(n.__headerState&t)===t?n.__headerState-=t:n.__headerState+=t,n}hasHeaderState(t){return(this.getHeaderStyles()&t)===t}hasHeader(){return this.getLatest().__headerState!==re.NO_STATUS}updateDOM(t){return t.__headerState!==this.__headerState||t.__width!==this.__width||t.__colSpan!==this.__colSpan||t.__rowSpan!==this.__rowSpan||t.__backgroundColor!==this.__backgroundColor||t.__styles!==this.__styles||t.__alignment!==this.__alignment}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function Xu(o){let e=o,t=o.nodeName.toLowerCase(),n;/^(\d+(?:\.\d+)?)px$/.test(e.style.width)&&(n=parseFloat(e.style.width));let i=Pe(t==="th"?re.ROW:re.NO_STATUS,e.colSpan,n);i.__rowSpan=e.rowSpan;let s=e.style,l=s.textDecoration.split(" "),a=s.fontWeight==="700"||s.fontWeight==="bold",c=l.includes("line-through"),m=s.fontStyle==="italic",f=l.includes("underline");return o instanceof HTMLElement&&(i.setStyles(Mn(o)),i.setAlignment(Lr(o))),{after:d=>(d.length===0&&d.push($()),d),forChild:(d,u)=>{if(w(u)&&!E(d)){let p=$();return we(d)&&d.getTextContent()===`
|
|
`?null:(b(d)&&(a&&d.toggleFormat("bold"),c&&d.toggleFormat("strikethrough"),m&&d.toggleFormat("italic"),f&&d.toggleFormat("underline")),p.append(d),p)}return d},node:i}}function Pe(o=re.NO_STATUS,e=1,t){return oe(new jt(o,e,t))}function w(o){return o instanceof jt}var JN=I("INSERT_TABLE_COMMAND");var Jt=class o extends J{constructor(t){super(t);this.__styles=new Map}static getType(){return"tablerow"}static clone(t){let n=new o(t.__key);return n.__styles=new Map(t.__styles),n}static importDOM(){return{tr:t=>({conversion:QN,priority:0})}}static importJSON(t){let n=Vo();return n.setStyles(new Map(Object.entries(t.styles))),n}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1,styles:Object.fromEntries(this.__styles),height:this.__height||0}}createDOM(t){let n=document.createElement("tr");this.__height&&(n.style.height=`${this.__height}px`);for(let[r,i]of this.__styles.entries())n.style.setProperty(r,i);return Te(n,t.theme.tableRow),n}isShadowRoot(){return!0}getStyles(){let t=this.getLatest();return new Map(t.__styles)}setStyles(t){let n=this.getWritable();n.__styles=new Map(t)}setHeight(t){let n=this.getWritable();return n.__height=t,this.__height}getHeight(){return this.getLatest().__height}updateDOM(t){return t.__height!==this.__height||t.__styles!==this.__styles}canBeEmpty(){return!1}canIndent(){return!1}};function QN(o){let e=Vo(),n=zo(o.style.height);return e.setHeight(n),o instanceof HTMLElement&&e.setStyles(Mn(o)),{node:e}}function Vo(){return oe(new Jt)}function Q(o){return o instanceof Jt}function Jl(o,e,t=!0){let n=Rr();for(let r=0;r<o;r++){let i=Vo();for(let s=0;s<e;s++){let l=re.NO_STATUS;typeof t=="object"?(r===0&&t.rows&&(l|=re.ROW),s===0&&t.columns&&(l|=re.COLUMN)):t&&(r===0&&(l|=re.ROW),s===0&&(l|=re.COLUMN));let a=Pe(l),c=$();c.append(Y()),a.append(c),i.append(a)}n.append(i)}return n}var jl=(o,e)=>o===re.BOTH||o===e?e:re.NO_STATUS;function Fi(o=!0){let e=T();x(C(e)||z(e),"Expected a RangeSelection or TableSelection");let t=e.focus.getNode(),[n,,r]=Se(t),[i,s]=ot(r,n,n),l=i[0].length,{startRow:a}=s;if(o){let c=a+n.__rowSpan-1,m=i[c],f=Vo();for(let u=0;u<l;u++){let{cell:p,startRow:g}=m[u];if(g+p.__rowSpan-1<=c){let _=m[u].cell.__headerState,N=jl(_,re.COLUMN);f.append(Pe(N).append($()))}else p.setRowSpan(p.__rowSpan+1)}let d=r.getChildAtIndex(c);x(Q(d),"focusEndRow is not a TableRowNode"),d.insertAfter(f)}else{let c=i[a],m=Vo();for(let d=0;d<l;d++){let{cell:u,startRow:p}=c[d];if(p===a){let h=c[d].cell.__headerState,_=jl(h,re.COLUMN);m.append(Pe(_).append($()))}else u.setRowSpan(u.__rowSpan+1)}let f=r.getChildAtIndex(a);x(Q(f),"focusEndRow is not a TableRowNode"),f.insertBefore(m)}}function Hi(o=!0){let e=T();x(C(e)||z(e),"Expected a RangeSelection or TableSelection");let t=e.anchor.getNode(),n=e.focus.getNode(),[r]=Se(t),[i,,s]=Se(n),[l,a,c]=ot(s,i,r),m=l.length,f=o?Math.max(a.startColumn,c.startColumn):Math.min(a.startColumn,c.startColumn),d=o?f+i.__colSpan-1:f-1,u=s.getFirstChild();x(Q(u),"Expected firstTable child to be a row");let p=null;function g(_=re.NO_STATUS){let N=Pe(_).append($());return p===null&&(p=N),N}let h=u;e:for(let _=0;_<m;_++){if(_!==0){let R=h.getNextSibling();x(Q(R),"Expected row nextSibling to be a row"),h=R}let N=l[_],L=N[d<0?0:d].cell.__headerState,M=jl(L,re.ROW);if(d<0){ta(h,g(M));continue}let{cell:S,startColumn:A,startRow:O}=N[d];if(A+S.__colSpan-1<=d){let R=S,P=O,k=d;for(;P!==_&&R.__rowSpan>1;)if(k-=S.__colSpan,k>=0){let{cell:W,startRow:ie}=N[k];R=W,P=ie}else{h.append(g(M));continue e}R.insertAfter(g(M))}else S.setColSpan(S.__colSpan+1)}p!==null&&Ar(p)}function Ql(){let o=T();x(C(o)||z(o),"Expected a RangeSelection or TableSelection");let e=o.anchor.getNode(),t=o.focus.getNode(),[n,,r]=Se(e),[i]=Se(t),[s,l,a]=ot(r,n,i),{startRow:c}=l,{startRow:m}=a,f=m+i.__rowSpan-1;if(s.length===f-c+1){r.remove();return}let d=s[0].length,u=s[f+1],p=r.getChildAtIndex(f+1);for(let g=f;g>=c;g--){for(let _=d-1;_>=0;_--){let{cell:N,startRow:L,startColumn:M}=s[g][_];if(M===_&&(g===c&&L<c&&N.setRowSpan(N.__rowSpan-(L-c)),L>=c&&L+N.__rowSpan-1>f))if(N.setRowSpan(N.__rowSpan-(f-L+1)),x(p!==null,"Expected nextRowNode not to be null"),_===0)ta(p,N);else{let{cell:S}=u[_-1];S.insertAfter(N)}}let h=r.getChildAtIndex(g);x(Q(h),"Expected GridNode childAtIndex(%s) to be RowNode",String(g)),h.remove()}if(u!==void 0){let{cell:g}=u[0];Ar(g)}else{let g=s[c-1],{cell:h}=g[0];Ar(h)}}function ea(){let o=T();x(C(o)||z(o),"Expected a RangeSelection or TableSelection");let e=o.anchor.getNode(),t=o.focus.getNode(),[n,,r]=Se(e),[i]=Se(t),[s,l,a]=ot(r,n,i),{startColumn:c}=l,{startRow:m,startColumn:f}=a,d=Math.min(c,f),u=Math.max(c+n.__colSpan-1,f+i.__colSpan-1),p=u-d+1;if(s[0].length===u-d+1){r.selectPrevious(),r.remove();return}let h=s.length;for(let L=0;L<h;L++)for(let M=d;M<=u;M++){let{cell:S,startColumn:A}=s[L][M];if(A<d){if(M===d){let O=d-A;S.setColSpan(S.__colSpan-Math.min(p,S.__colSpan-O))}}else if(A+S.__colSpan-1>u){if(M===u){let O=u-A+1;S.setColSpan(S.__colSpan-O)}}else S.remove()}let _=s[m],N=c>f?_[c+n.__colSpan]:_[f+i.__colSpan];if(N!==void 0){let{cell:L}=N;Ar(L)}else{let L=f<c?_[f-1]:_[c-1],{cell:M}=L;Ar(M)}}function Ar(o){let e=o.getFirstDescendant();e==null?o.selectStart():e.getParentOrThrow().selectStart()}function ta(o,e){let t=o.getFirstChild();t!==null?t.insertBefore(e):o.append(e)}function oa(){let o=T();x(C(o)||z(o),"Expected a RangeSelection or TableSelection");let e=o.anchor.getNode(),[t,n,r]=Se(e),i=t.__colSpan,s=t.__rowSpan;if(i>1){for(let l=1;l<i;l++)t.insertAfter(Pe(re.NO_STATUS).append($()));t.setColSpan(1)}if(s>1){let[l,a]=ot(r,t,t),{startColumn:c,startRow:m}=a,f;for(let d=1;d<s;d++){let u=m+d,p=l[u];f=(f||n).getNextSibling(),x(Q(f),"Expected row next sibling to be a row");let g=null;for(let h=0;h<c;h++){let _=p[h],N=_.cell;_.startRow===u&&(g=N),N.__colSpan>1&&(h+=N.__colSpan-1)}if(g===null)for(let h=0;h<i;h++)ta(f,Pe(re.NO_STATUS).append($()));else for(let h=0;h<i;h++)g.insertAfter(Pe(re.NO_STATUS).append($()))}t.setRowSpan(1)}}function ot(o,e,t){let[n,r,i]=Gu(o,e,t);return x(r!==null,"Anchor not found in Grid"),x(i!==null,"Focus not found in Grid"),[n,r,i]}function Gu(o,e,t){let n=[],r=null,i=null;function s(c,m,f){let d={cell:f,startColumn:m,startRow:c},u=f.__rowSpan,p=f.__colSpan;for(let g=0;g<u;g++){n[c+g]===void 0&&(n[c+g]=[]);for(let h=0;h<p;h++)n[c+g][m+h]=d}e!==null&&e.is(f)&&(r=d),t!==null&&t.is(f)&&(i=d)}function l(c,m){return n[c]===void 0||n[c][m]===void 0}let a=o.getChildren();for(let c=0;c<a.length;c++){let m=a[c];x(Q(m),"Expected GridNode children to be TableRowNode");let f=m.getChildren(),d=0;for(let u of f){for(x(w(u),"Expected TableRowNode children to be TableCellNode");!l(c,d);)d++;s(c,d,u),d+=u.__colSpan}}return[n,r,i]}function Se(o){let e;if(o instanceof jt)e=o;else if("__type"in o){let r=H(o,w);x(w(r),"Expected to find a parent TableCellNode"),e=r}else{let r=H(o.getNode(),w);x(w(r),"Expected to find a parent TableCellNode"),e=r}let t=e.getParent();x(Q(t),"Expected TableCellNode to have a parent TableRowNode");let n=t.getParent();return x(K(n),"Expected TableRowNode to have a parent GridNode"),[e,t,n]}function Ki(o){let[e,,t]=Se(o),n=t.getChildren(),r=n.length,i=n[0].getChildren().length,s=new Array(r);for(let l=0;l<r;l++)s[l]=new Array(i);for(let l=0;l<r;l++){let c=n[l].getChildren(),m=0;for(let f=0;f<c.length;f++){for(;s[l][m];)m++;let d=c[f],u=d.__rowSpan||1,p=d.__colSpan||1;for(let g=0;g<u;g++)for(let h=0;h<p;h++)s[l+g][m+h]=d;if(e===d)return{colSpan:p,columnIndex:m,rowIndex:l,rowSpan:u};m+=p}}return null}var Ui=class o{constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return z(e)?this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus):!1}set(e,t,n){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new o(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.focus.getNode();x(E(t),"Expected TableSelection focus to be an ElementNode"),Oo(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){let e=j(this.anchor.key);x(w(e),"Expected TableSelection anchor to be (or a child of) TableCellNode");let t=Ki(e);x(t!==null,"getCellRect: expected to find AnchorNode");let n=j(this.focus.key);x(w(n),"Expected TableSelection focus to be (or a child of) TableCellNode");let r=Ki(n);x(r!==null,"getCellRect: expected to find focusCellNode");let i=Math.min(t.columnIndex,r.columnIndex),s=Math.max(t.columnIndex,r.columnIndex),l=Math.min(t.rowIndex,r.rowIndex),a=Math.max(t.rowIndex,r.rowIndex);return{fromX:Math.min(i,s),fromY:Math.min(l,a),toX:Math.max(i,s),toY:Math.max(l,a)}}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this.anchor.getNode(),n=this.focus.getNode(),r=H(t,w),i=H(n,w);x(w(r),"Expected TableSelection anchor to be (or a child of) TableCellNode"),x(w(i),"Expected TableSelection focus to be (or a child of) TableCellNode");let s=r.getParent();x(Q(s),"Expected anchorCell to have a parent TableRowNode");let l=s.getParent();x(K(l),"Expected tableNode to have a parent TableNode");let a=i.getParents()[1];if(a!==l){if(l.isParentOf(i)){let O=a.getParent();x(O!=null,"Expected focusCellParent to have a parent"),this.set(this.tableKey,i.getKey(),O.getKey())}else{let O=l.getParent();x(O!=null,"Expected gridParent to have a parent"),this.set(this.tableKey,O.getKey(),i.getKey())}return this.getNodes()}let[c,m,f]=ot(l,r,i),d=Math.min(m.startColumn,f.startColumn),u=Math.min(m.startRow,f.startRow),p=Math.max(m.startColumn+m.cell.__colSpan-1,f.startColumn+f.cell.__colSpan-1),g=Math.max(m.startRow+m.cell.__rowSpan-1,f.startRow+f.cell.__rowSpan-1),h=d,_=u,N=d,L=u;function M(O){let{cell:R,startColumn:P,startRow:k}=O;d=Math.min(d,P),u=Math.min(u,k),p=Math.max(p,P+R.__colSpan-1),g=Math.max(g,k+R.__rowSpan-1)}for(;d<h||u<_||p>N||g>L;){if(d<h){let O=L-_,R=h-1;for(let P=0;P<=O;P++)M(c[_+P][R]);h=R}if(u<_){let O=N-h,R=_-1;for(let P=0;P<=O;P++)M(c[R][h+P]);_=R}if(p>N){let O=L-_,R=N+1;for(let P=0;P<=O;P++)M(c[_+P][R]);N=R}if(g>L){let O=N-h,R=L+1;for(let P=0;P<=O;P++)M(c[R][h+P]);L=R}}let S=[l],A=null;for(let O=u;O<=g;O++)for(let R=d;R<=p;R++){let{cell:P}=c[O][R],k=P.getParent();x(Q(k),"Expected TableCellNode parent to be a TableRowNode"),k!==A&&S.push(k),S.push(P,...ex(P)),A=k}return st()||(this._cachedNodes=S),S}getTextContent(){let e=this.getNodes().filter(n=>w(n)),t="";for(let n=0;n<e.length;n++){let r=e[n],i=r.__parent,s=(e[n+1]||{}).__parent;t+=r.getTextContent()+(s!==i?`
|
|
`:" ")}return t}};function z(o){return o instanceof Ui}function zi(){let o=De("root",0,"element"),e=De("root",0,"element");return new Ui("root",o,e)}function ex(o){let e=[],t=[o];for(;t.length>0;){let n=t.pop();x(n!==void 0,"Stack.length > 0; can't be undefined"),E(n)&&t.unshift(...n.getChildren()),n!==o&&e.push(n)}return e}var Ir=class{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){let e=new MutationObserver(t=>{this.editor.update(()=>{let n=!1;for(let i=0;i<t.length;i++){let a=t[i].target.nodeName;if(a==="TABLE"||a==="TBODY"||a==="THEAD"||a==="TR"){n=!0;break}}if(!n)return;let r=this.editor.getElementByKey(this.tableNodeKey);if(!r)throw new Error("Expected to find TableElement in DOM");this.table=Xo(r)})});this.editor.update(()=>{let t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=Xo(t),e.observe(t,{attributes:!0,childList:!0,subtree:!0})})}clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{let t=j(this.tableNodeKey);if(!K(t))throw new Error("Expected TableNode.");let n=e.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");let r=Xo(n);kr(e,r,null),q(null),e.dispatchCommand(ve,void 0)})}enableHighlightStyle(){let e=this.editor;e.update(()=>{let t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");vi(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){let e=this.editor;e.update(()=>{let t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Te(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){let t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),kr(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){let n=this.editor;n.update(()=>{let r=j(this.tableNodeKey);if(!K(r))throw new Error("Expected TableNode.");if(!n.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");let s=e.x,l=e.y;if(this.focusCell=e,this.anchorCell!==null){let a=na(n._window);a&&a.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==s||this.anchorY!==l||t))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(s===this.focusX&&l===this.focusY)return;if(this.focusX=s,this.focusY=l,this.isHighlightingCells){let a=ee(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&w(a)&&r.is(Co(a))){let c=a.getKey();this.tableSelection=this.tableSelection.clone()||zi(),this.focusCellNodeKey=c,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),q(this.tableSelection),n.dispatchCommand(ve,void 0),kr(n,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{let t=ee(e.elem);if(w(t)){let n=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():zi(),this.anchorCellNodeKey=n}})}formatCells(e){this.editor.update(()=>{let t=T();z(t)||x(!1,"Expected grid selection");let n=Ko(),r=n.anchor,i=n.focus;t.getNodes().forEach(s=>{w(s)&&s.getTextContentSize()!==0&&(r.set(s.getKey(),0,"element"),i.set(s.getKey(),s.getChildrenSize(),"element"),n.formatText(e))}),q(t),this.editor.dispatchCommand(ve,void 0)})}clearText(){let e=this.editor;e.update(()=>{let t=j(this.tableNodeKey);if(!K(t))throw new Error("Expected TableNode.");let n=T();z(n)||x(!1,"Expected grid selection");let r=n.getNodes().filter(w);if(r.length===this.table.columns*this.table.rows){t.selectPrevious(),t.remove(),F().selectStart();return}r.forEach(i=>{if(E(i)){let s=$(),l=Y();s.append(l),i.append(s),i.getChildren().forEach(a=>{a!==s&&a.remove()})}}),kr(e,this.table,null),q(null),e.dispatchCommand(ve,void 0)})}};var tx="__lexicalTableSelection",na=o=>fe?(o||window).getSelection():null,ox=o=>(o.buttons&1)===1;function sa(o,e,t,n){let r=t.getRootElement();if(r===null)throw new Error("No root element.");let i=new Ir(t,o.getKey()),s=t._window||window;nx(e,i);let l=()=>{let d=()=>{i.isSelecting=!1,s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u)},u=p=>{setTimeout(()=>{if(!ox(p)&&i.isSelecting){i.isSelecting=!1,s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);return}let g=ia(p.target);g!==null&&(i.anchorX!==g.x||i.anchorY!==g.y)&&(p.preventDefault(),i.setFocusCellForSelection(g))},0)};return{onMouseMove:u,onMouseUp:d}};e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!s)return;let u=ia(d.target);u!==null&&(jo(d),i.setAnchorCellForSelection(u));let{onMouseUp:p,onMouseMove:g}=l();i.isSelecting=!0,s.addEventListener("mouseup",p),s.addEventListener("mousemove",g)},0)});let a=d=>{d.button===0&&t.update(()=>{let u=T(),p=d.target;z(u)&&u.tableKey===i.tableNodeKey&&r.contains(p)&&i.clearHighlight()})};s.addEventListener("mousedown",a),i.listenersToRemove.add(()=>s.removeEventListener("mousedown",a)),i.listenersToRemove.add(t.registerCommand(Pt,d=>$r(t,d,"down",o,i),qe)),i.listenersToRemove.add(t.registerCommand(Mo,d=>$r(t,d,"up",o,i),qe)),i.listenersToRemove.add(t.registerCommand(Lo,d=>$r(t,d,"backward",o,i),qe)),i.listenersToRemove.add(t.registerCommand(So,d=>$r(t,d,"forward",o,i),qe)),i.listenersToRemove.add(t.registerCommand(vo,d=>{let u=T();if(z(u)){let p=H(u.focus.getNode(),w);if(w(p))return jo(d),p.selectEnd(),!0}return!1},qe));let c=d=>()=>{let u=T();if(!Go(u,o))return!1;if(z(u))return i.clearText(),!0;if(C(u)){let p=H(u.anchor.getNode(),A=>w(A));if(!w(p))return!1;let g=u.anchor.getNode(),h=u.focus.getNode(),_=o.isParentOf(g),N=o.isParentOf(h);if(_&&!N||N&&!_)return i.clearText(),!0;let M=H(u.anchor.getNode(),A=>E(A)),S=M&&H(M,A=>E(A)&&w(A.getParent()));if(!E(S)||!E(M))return!1;if(d===it&&S.getPreviousSibling()===null)return!0}return!1};[Tt,it,Ze].forEach(d=>{i.listenersToRemove.add(t.registerCommand(d,c(d),Re))});let m=d=>{let u=T();if(!Go(u,o)){let p=u?u.getNodes():null;if(p){let g=p.find(h=>K(h)&&h.getKey()===i.tableNodeKey);if(K(g)){if(!g.getParent())return!1;g.remove()}}return!1}if(z(u))return d&&(d.preventDefault(),d.stopPropagation()),i.clearText(),!0;if(C(u)){let p=H(u.anchor.getNode(),g=>w(g));if(!w(p))return!1}return!1};i.listenersToRemove.add(t.registerCommand(Bt,m,Re)),i.listenersToRemove.add(t.registerCommand(Ft,m,Re)),i.listenersToRemove.add(t.registerCommand(so,d=>{let u=T();if(u){if(!(z(u)||C(u)))return!1;An(t,mt(d,ClipboardEvent)?d:null,Ri(u));let p=m(d);return C(u)&&u.removeText(),p}return!1},Re)),i.listenersToRemove.add(t.registerCommand(Ne,d=>{let u=T();if(!Go(u,o))return!1;if(z(u))return i.formatCells(d),!0;if(C(u)){let p=H(u.anchor.getNode(),g=>w(g));if(!w(p))return!1}return!1},Re)),i.listenersToRemove.add(t.registerCommand(rt,d=>{let u=T();if(!Go(u,o))return!1;if(z(u))return i.clearHighlight(),!1;if(C(u)){let p=H(u.anchor.getNode(),g=>w(g));if(!w(p))return!1;if(typeof d=="string"){let g=Qu(t,u,o);if(g)return Ju(g,o,[Y(d)]),!0}}return!1},Re)),n&&i.listenersToRemove.add(t.registerCommand(wo,d=>{let u=T();if(!C(u)||!u.isCollapsed()||!Go(u,o))return!1;let p=qi(u.anchor.getNode());if(p===null)return!1;jo(d);let g=o.getCordsFromCellNode(p,i.table);return ef(i,o,g.x,g.y,d.shiftKey?"backward":"forward"),!0},Re)),i.listenersToRemove.add(t.registerCommand(or,d=>o.isSelected(),qe));function f(d){let u=o.getCordsFromCellNode(d,i.table);return o.getDOMCellFromCordsOrThrow(u.x,u.y,i.table)}return i.listenersToRemove.add(t.registerCommand(jn,d=>{let{nodes:u,selection:p}=d,g=p.getStartEndPoints(),h=z(p),N=C(p)&&H(p.anchor.getNode(),Be=>w(Be))!==null&&H(p.focus.getNode(),Be=>w(Be))!==null||h;if(u.length!==1||!K(u[0])||!N||g===null)return!1;let[L]=g,M=u[0],S=M.getChildren(),A=M.getFirstChildOrThrow().getChildrenSize(),O=M.getChildrenSize(),R=H(L.getNode(),Be=>w(Be)),P=R&&H(R,Be=>Q(Be)),k=P&&H(P,Be=>K(Be));if(!w(R)||!Q(P)||!K(k))return!1;let W=P.getIndexWithinParent(),ie=Math.min(k.getChildrenSize()-1,W+O-1),rn=R.getIndexWithinParent(),Za=Math.min(P.getChildrenSize()-1,rn+A-1),Yg=Math.min(rn,Za),Zg=Math.min(W,ie),Vg=Math.max(rn,Za),Xg=Math.max(W,ie),Gg=k.getChildren(),Va=0;for(let Be=Zg;Be<=Xg;Be++){let Xa=Gg[Be];if(!Q(Xa))return!1;let Ga=S[Va];if(!Q(Ga))return!1;let jg=Xa.getChildren(),Jg=Ga.getChildren(),ja=0;for(let Ls=Yg;Ls<=Vg;Ls++){let Gr=jg[Ls];if(!w(Gr))return!1;let Ja=Jg[ja];if(!w(Ja))return!1;let Qg=Gr.getChildren();Ja.getChildren().forEach(sn=>{b(sn)&&$().append(sn),Gr.append(sn)}),Qg.forEach(sn=>sn.remove()),ja++}Va++}return!0},Re)),i.listenersToRemove.add(t.registerCommand(ve,()=>{let d=T(),u=We();if(C(d)){let{anchor:p,focus:g}=d,h=p.getNode(),_=g.getNode(),N=qi(h),L=qi(_),M=!!(N&&o.is(Co(N))),S=!!(L&&o.is(Co(L))),A=M!==S,O=M&&S,R=d.isBackward();if(A){let P=d.clone();if(S){let[k]=ot(o,L,L),W=k[0][0].cell,ie=k[k.length-1].at(-1).cell;P.focus.set(R?W.getKey():ie.getKey(),R?W.getChildrenSize():ie.getChildrenSize(),"element")}q(P),ju(t,i)}else O&&(N.is(L)||(i.setAnchorCellForSelection(f(N)),i.setFocusCellForSelection(f(L),!0),i.isSelecting||setTimeout(()=>{let{onMouseUp:P,onMouseMove:k}=l();i.isSelecting=!0,s.addEventListener("mouseup",P),s.addEventListener("mousemove",k)},0)))}else if(d&&z(d)&&d.is(u)&&d.tableKey===o.getKey()){let p=na(t._window);if(p&&p.anchorNode&&p.focusNode){let g=ee(p.focusNode),h=g&&!o.is(Co(g)),_=ee(p.anchorNode),N=_&&o.is(Co(_));if(h&&N&&p.rangeCount>0){let L=Ll(p,t);L&&(L.anchor.set(o.getKey(),d.isBackward()?o.getChildrenSize():0,"element"),p.removeAllRanges(),q(L))}}}return d&&!d.is(u)&&(z(d)||z(u))&&i.tableSelection&&!i.tableSelection.is(u)?(z(d)&&d.tableKey===i.tableNodeKey?i.updateTableTableSelection(d):!z(d)&&z(u)&&u.tableKey===i.tableNodeKey&&i.updateTableTableSelection(null),!1):(i.hasHijackedSelectionStyles&&!o.isSelected()?rx(t,i):!i.hasHijackedSelectionStyles&&o.isSelected()&&ju(t,i),!1)},Re)),i.listenersToRemove.add(t.registerCommand($t,()=>{let d=T();if(!C(d)||!d.isCollapsed()||!Go(d,o))return!1;let u=Qu(t,d,o);return u?(Ju(u,o),!0):!1},Re)),i}function nx(o,e){o[tx]=e}function ia(o){let e=o;for(;e!=null;){let t=e.nodeName;if(t==="TD"||t==="TH"){let n=e._cell;return n===void 0?null:n}e=e.parentNode}return null}function Xo(o){let e=[],t={columns:0,domRows:e,rows:0},n=o.firstChild,r=0,i=0;for(e.length=0;n!=null;){let s=n.nodeName;if(s==="TD"||s==="TH"){let c=n,m={elem:c,hasBackgroundColor:c.style.backgroundColor!=="",highlighted:!1,x:r,y:i};n._cell=m;let f=e[i];f===void 0&&(f=e[i]=[]),f[r]=m}else{let c=n.firstChild;if(c!=null){n=c;continue}}let l=n.nextSibling;if(l!=null){r++,n=l;continue}let a=n.parentNode;if(a!=null){let c=a.nextSibling;if(c==null)break;i++,r=0,n=c}}return t.columns=r+1,t.rows=i+1,t}function kr(o,e,t){let n=new Set(t?t.getNodes():[]);la(e,(r,i)=>{let s=r.elem;n.has(i)?(r.highlighted=!0,tf(o,r)):(r.highlighted=!1,of(o,r),s.getAttribute("style")||s.removeAttribute("style"))})}function la(o,e){let{domRows:t}=o;for(let n=0;n<t.length;n++){let r=t[n];if(r)for(let i=0;i<r.length;i++){let s=r[i];if(!s)continue;let l=ee(s.elem);l!==null&&e(s,l,{x:i,y:n})}}}function ju(o,e){e.disableHighlightStyle(),la(e.table,t=>{t.highlighted=!0,tf(o,t)})}function rx(o,e){e.enableHighlightStyle(),la(e.table,t=>{let n=t.elem;t.highlighted=!1,of(o,t),n.getAttribute("style")||n.removeAttribute("style")})}var ef=(o,e,t,n,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return t!==(i?o.table.columns-1:0)?Wi(e.getCellNodeFromCordsOrThrow(t+(i?1:-1),n,o.table),i):n!==(i?o.table.rows-1:0)?Wi(e.getCellNodeFromCordsOrThrow(i?0:o.table.columns-1,n+(i?1:-1),o.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return n!==0?Wi(e.getCellNodeFromCordsOrThrow(t,n-1,o.table),!1):e.selectPrevious(),!0;case"down":return n!==o.table.rows-1?Wi(e.getCellNodeFromCordsOrThrow(t,n+1,o.table),!0):e.selectNext(),!0;default:return!1}},ix=(o,e,t,n,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return t!==(i?o.table.columns-1:0)&&o.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(i?1:-1),n,o.table)),!0;case"up":return n!==0?(o.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,n-1,o.table)),!0):!1;case"down":return n!==o.table.rows-1?(o.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,n+1,o.table)),!0):!1;default:return!1}};function Go(o,e){if(C(o)||z(o)){let t=e.isParentOf(o.anchor.getNode()),n=e.isParentOf(o.focus.getNode());return t&&n}return!1}function Wi(o,e){e?o.selectStart():o.selectEnd()}var ra="172,206,247";function tf(o,e){let t=e.elem,n=ee(t);x(w(n),"Expected to find LexicalNode from Table Cell DOMNode"),n.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${ra})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${ra},0.85), rgba(${ra},0.85))`),t.style.setProperty("caret-color","transparent")}function of(o,e){let t=e.elem,n=ee(t);x(w(n),"Expected to find LexicalNode from Table Cell DOMNode"),n.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function qi(o){let e=H(o,w);return w(e)?e:null}function Co(o){let e=H(o,K);return K(e)?e:null}function $r(o,e,t,n,r){if((t==="up"||t==="down")&&sx(o))return!1;let i=T();if(!Go(i,n)){if(C(i)){if(i.isCollapsed()&&t==="backward"){let s=i.anchor.type,l=i.anchor.offset;if(s!=="element"&&!(s==="text"&&l===0))return!1;let a=i.anchor.getNode();if(!a)return!1;let c=H(a,f=>E(f)&&!f.isInline());if(!c)return!1;let m=c.getPreviousSibling();return!m||!K(m)?!1:(jo(e),m.selectEnd(),!0)}else if(e.shiftKey&&(t==="up"||t==="down")){let s=i.focus.getNode();if(me(s)){let l=i.getNodes()[0];if(l){let a=H(l,w);if(a&&n.isParentOf(a)){let c=n.getFirstDescendant(),m=n.getLastDescendant();if(!c||!m)return!1;let[f]=Se(c),[d]=Se(m),u=n.getCordsFromCellNode(f,r.table),p=n.getCordsFromCellNode(d,r.table),g=n.getDOMCellFromCordsOrThrow(u.x,u.y,r.table),h=n.getDOMCellFromCordsOrThrow(p.x,p.y,r.table);return r.setAnchorCellForSelection(g),r.setFocusCellForSelection(h,!0),!0}}return!1}else{let l=H(s,c=>E(c)&&!c.isInline());if(!l)return!1;let a=t==="down"?l.getNextSibling():l.getPreviousSibling();if(K(a)&&r.tableNodeKey===a.getKey()){let c=a.getFirstDescendant(),m=a.getLastDescendant();if(!c||!m)return!1;let[f]=Se(c),[d]=Se(m),u=i.clone();return u.focus.set((t==="up"?f:d).getKey(),t==="up"?0:d.getChildrenSize(),"element"),q(u),!0}}}}return!1}if(C(i)&&i.isCollapsed()){let{anchor:s,focus:l}=i,a=H(s.getNode(),w),c=H(l.getNode(),w);if(!w(a)||!a.is(c))return!1;let m=Co(a);if(m!==n&&m!=null){let N=o.getElementByKey(m.getKey());if(N!=null)return r.table=Xo(N),$r(o,e,t,m,r)}if(t==="backward"||t==="forward"){let N=s.type,L=s.offset,M=s.getNode();if(!M)return!1;let S=i.getNodes();return S.length===1&&B(S[0])?!1:lx(N,L,M,t)?dx(e,M,n,t):!1}let f=o.getElementByKey(a.__key),d=o.getElementByKey(s.key);if(d==null||f==null)return!1;let u;if(s.type==="element")u=d.getBoundingClientRect();else{let N=window.getSelection();if(N===null||N.rangeCount===0)return!1;u=N.getRangeAt(0).getBoundingClientRect()}let p=t==="up"?a.getFirstChild():a.getLastChild();if(p==null)return!1;let g=o.getElementByKey(p.__key);if(g==null)return!1;let h=g.getBoundingClientRect();if(t==="up"?h.top>u.top-u.height:u.bottom+u.height>h.bottom){jo(e);let N=n.getCordsFromCellNode(a,r.table);if(e.shiftKey){let L=n.getDOMCellFromCordsOrThrow(N.x,N.y,r.table);r.setAnchorCellForSelection(L),r.setFocusCellForSelection(L,!0)}else return ef(r,n,N.x,N.y,t);return!0}}else if(z(i)){let{anchor:s,focus:l}=i,a=H(s.getNode(),w),c=H(l.getNode(),w),[m]=i.getNodes(),f=o.getElementByKey(m.getKey());if(!w(a)||!w(c)||!K(m)||f==null)return!1;r.updateTableTableSelection(i);let d=Xo(f),u=n.getCordsFromCellNode(a,d),p=n.getDOMCellFromCordsOrThrow(u.x,u.y,d);if(r.setAnchorCellForSelection(p),jo(e),e.shiftKey){let g=n.getCordsFromCellNode(c,d);return ix(r,m,g.x,g.y,t)}else c.selectEnd();return!0}return!1}function jo(o){o.preventDefault(),o.stopImmediatePropagation(),o.stopPropagation()}function sx(o){let e=o.getRootElement();return e?e.hasAttribute("aria-controls")&&e.getAttribute("aria-controls")==="typeahead-menu":!1}function lx(o,e,t,n){return ax(o,t,n)||cx(o,e,t,n)}function ax(o,e,t){return o==="element"&&(t==="backward"?e.getPreviousSibling()===null:e.getNextSibling()===null)}function cx(o,e,t,n){let r=H(t,s=>E(s)&&!s.isInline());if(!r)return!1;let i=n==="backward"?e===0:e===t.getTextContentSize();return o==="text"&&i&&(n==="backward"?r.getPreviousSibling()===null:r.getNextSibling()===null)}function dx(o,e,t,n){let r=H(e,w);if(!w(r))return!1;let[i,s]=ot(t,r,r);if(!ux(i,s,n))return!1;let l=fx(e,n,t);return!l||K(l)?!1:(jo(o),n==="backward"?l.selectEnd():l.selectStart(),!0)}function ux(o,e,t){let n=o[0][0],r=o[o.length-1][o[0].length-1],{startColumn:i,startRow:s}=e;return t==="backward"?i===n.startColumn&&s===n.startRow:i===r.startColumn&&s===r.startRow}function fx(o,e,t){let n=H(o,i=>E(i)&&!i.isInline());if(!n)return;let r=e==="backward"?n.getPreviousSibling():n.getNextSibling();return r&&K(r)?r:e==="backward"?t.getPreviousSibling():t.getNextSibling()}function Ju(o,e,t){let n=$();o==="first"?e.insertBefore(n):e.insertAfter(n),n.append(...t||[]),n.selectEnd()}function Qu(o,e,t){let n=t.getParent();if(!n)return;let r=o.getElementByKey(n.getKey());if(!r)return;let i=window.getSelection();if(!i||i.anchorNode!==r)return;let s=H(e.anchor.getNode(),h=>w(h));if(!s)return;let l=H(s,h=>K(h));if(!K(l)||!l.is(t))return;let[a,c]=ot(t,s,s),m=a[0][0],f=a[a.length-1][a[0].length-1],{startRow:d,startColumn:u}=c,p=d===m.startRow&&u===m.startColumn,g=d===f.startRow&&u===f.startColumn;return p?"first":g?"last":void 0}var kt=class{constructor(e){this.rowCount=0;this.columnCount=0;this.cells=[];this.buildCellMap(e)}buildCellMap(e){let t=[],n=(a,c,m)=>{typeof t[c]>"u"&&(t[c]=[]),t[c][a]=m},r=(a,c)=>!!(t[c]&&t[c][a]),i=e.getChildren().filter(a=>Q(a));for(let a=0;a<i.length;a++){let m=i[a].getChildren().filter(d=>w(d)),f=0;for(let d=0;d<m.length;d++){let u=m[d],p=u.getColSpan()||1,g=u.getRowSpan()||1;for(let h=f;h<f+p;h++)for(let _=a;_<a+g;_++){for(;r(h,_);)f+=1,h+=1;n(h,_,u)}f+=p}}this.rowCount=t.length,this.columnCount=Math.max(...t.map(a=>a.length));let s=[],l=t[0][0];for(let a=0;a<this.rowCount;a++)for(let c=0;c<this.columnCount;c++)!t[a]||!t[a][c]?s.push(l):(s.push(t[a][c]),l=t[a][c]);this.cells=s}getCellAtPosition(e,t){let n=t*this.columnCount+e;if(n>=this.cells.length)throw new Error(`TableMap Error: Attempted to get cell ${n+1} of ${this.cells.length}`);return this.cells[n]}getCellsInRange(e){let t=Math.max(Math.min(e.fromX,e.toX),0),n=Math.min(Math.max(e.fromX,e.toX),this.columnCount-1),r=Math.max(Math.min(e.fromY,e.toY),0),i=Math.min(Math.max(e.fromY,e.toY),this.rowCount-1),s=new Set;for(let l=r;l<=i;l++)for(let a=t;a<=n;a++)s.add(this.getCellAtPosition(a,l));return[...s.values()]}getCellsInColumn(e){return this.getCellsInRange({fromX:e,toX:e,fromY:0,toY:this.rowCount-1})}getRangeForCell(e){let t=null,n=e.getKey();for(let r=0;r<this.rowCount;r++)for(let i=0;i<this.columnCount;i++){let s=r*this.columnCount+i;this.cells[s].getKey()===n&&(t===null?t={fromX:i,toX:i,fromY:r,toY:r}:(t.fromX=Math.min(t.fromX,i),t.toX=Math.max(t.toX,i),t.fromY=Math.min(t.fromY,r),t.toY=Math.max(t.toY,r)))}return t}};function aa(o){return At(o,K)}function rf(o){let e=sf(o),t=o.querySelector("colgroup"),n=[];return t&&(t.childElementCount===e?.childElementCount||!e)&&(n=nf(t)),n.filter(Boolean).length===0&&e&&(n=nf(e)),n}function sf(o){let e=o.querySelectorAll("tr"),t=0,n=null;for(let r of e)r.childElementCount>t&&(n=r,t=r.childElementCount);return n}function nf(o){return[...o.children].map(e=>mx(e))}function mx(o){let e=o.style.width||o.getAttribute("width");return e&&!Number.isNaN(Number(e))&&(e=e+"px"),e||""}function ca(o,e,t){let n=o.getChildren(),r=0;for(let s of n){let l=s.getChildren().length;l>r&&(r=l)}let i=o.getColWidths();(i.length===0||i.length<r)&&(i=Array(r).fill("")),e+1>i.length&&console.error(`Attempted to set table column width for column [${e}] but only ${i.length} columns found`),i[e]=ft(t),o.setColWidths(i)}function lf(o,e,t){let n=e.getColWidths();if(n.length>t&&n[t].endsWith("px"))return Number(n[t].replace("px",""));let r=o.getElementByKey(e.__key);if(r){let i=sf(r);if(i&&i.children.length>t)return i.children[t].clientWidth}return 0}function af(o){let e=o.getParent();if(!Q(e))return-1;let t=0,n=e.getChildren();for(let r of n){let i=r.getColSpan()||1;if(t+=i,r.getKey()===o.getKey())break}return t-1}function cf(o,e){let t=aa(o),n=af(o);t&&n>=0&&ca(t,n,e)}function df(o,e){let t=aa(e),n=af(e);if(!t)return"";let r=t.getColWidths();return r.length>n?r[n]:""}function Jo(o){if(z(o))return o.getNodes().filter(n=>w(n));let e=V(o,w);return e?[e]:[]}function uf(o){let e=o.getShape(),t=Jo(o);if(t.length===0)return;let n=aa(t[0]);if(!n)return;let r=new kt(n),i=r.getCellAtPosition(e.toX,e.toY);if(!i)return;let s=e.toX+((i.getColSpan()||1)-1),l=e.toY+((i.getRowSpan()||1)-1),a=r.getCellsInRange({fromX:e.fromX,fromY:e.fromY,toX:s,toY:l});if(a.length===0)return;let c=a[0],m=Math.abs(e.fromX-s)+1,f=Math.abs(e.fromY-l)+1;for(let d=1;d<a.length;d++){let u=a[d];c.append(...u.getChildren()),u.remove()}c.setColSpan(m),c.setRowSpan(f)}function Qt(o){let e=Jo(o),t={};for(let n of e){let r=n.getParent();Q(r)&&(t[r.getKey()]=r)}return Object.values(t)}function Nt(o){let e=Jo(o);if(e.length===0)return null;let t=At(e[0],K);return K(t)?t:null}function ff(o){o.setColWidths([]);for(let e of o.getChildren()){if(!Q(e))continue;let t=e.getStyles();t.delete("height"),t.delete("width"),e.setStyles(t);let n=e.getChildren().filter(r=>w(r));for(let r of n){let i=r.getStyles();i.delete("height"),i.delete("width"),r.setStyles(i),r.clearWidth()}}}function mf(o){o.setColWidths([]),o.setStyles(new Map);for(let e of o.getChildren()){if(!Q(e))continue;e.setStyles(new Map);let t=e.getChildren().filter(n=>w(n));for(let n of t)n.setStyles(new Map),n.clearWidth()}}function da(o,e){e:for(let t of o.getChildren()){if(!Q(t))continue;let n=t.getChildren();for(let r of n){if(!w(r))return;if(e(r)===!1)break e}}}function pf(o){let e=null;return da(o,t=>{let n=t.getStyles().get("padding")||"";if(e===null&&(e=n),n!==e)return e=null,!1}),e||""}var xt=class o extends wt{constructor(t){super(t);this.__colWidths=[];this.__styles=new Map}static getType(){return"table"}static clone(t){let n=new o(t.__key);return To(t,n),n.__colWidths=t.__colWidths,n.__styles=new Map(t.__styles),n}static importDOM(){return{table:t=>({conversion:px,priority:1})}}static importJSON(t){let n=Rr();return tt(t,n),n.setColWidths(t.colWidths),n.setStyles(new Map(Object.entries(t.styles))),n}exportJSON(){return{...super.exportJSON(),type:"table",version:1,colWidths:this.__colWidths,styles:Object.fromEntries(this.__styles)}}createDOM(t,n){let r=document.createElement("table");Te(r,t.theme.table),et(r,this);let i=this.getColWidths();if(i.length>0){let s=y("colgroup");for(let l of i){let a=y("col");l&&(a.style.width=l),s.append(a)}r.append(s)}for(let[s,l]of this.__styles.entries())r.style.setProperty(s,l);return r}updateDOM(t){return vt(t,this)||this.__colWidths.join(":")!==t.__colWidths.join(":")||this.__styles.size!==t.__styles.size||Array.from(this.__styles.values()).join(":")!==Array.from(t.__styles.values()).join(":")}exportDOM(t){return{...super.exportDOM(t),after:n=>{if(!n)return;let r=n.cloneNode(),i=document.createElement("tbody");if(pe(n))for(let s of Array.from(n.children))s.nodeName==="TR"?i.append(s):r.append(s);return r.append(i),r}}}canBeEmpty(){return!1}isShadowRoot(){return!0}setColWidths(t){let n=this.getWritable();n.__colWidths=t}getColWidths(){return this.getLatest().__colWidths}getStyles(){let t=this.getLatest();return new Map(t.__styles)}setStyles(t){let n=this.getWritable();n.__styles=new Map(t)}getCordsFromCellNode(t,n){let{rows:r,domRows:i}=n;for(let s=0;s<r;s++){let l=i[s];if(l==null)continue;let a=l.findIndex(c=>{if(!c)return;let{elem:m}=c;return ee(m)===t});if(a!==-1)return{x:a,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(t,n,r){let{domRows:i}=r,s=i[n];if(s==null)return null;let l=t<s.length?t:s.length-1,a=s[l];return a??null}getDOMCellFromCordsOrThrow(t,n,r){let i=this.getDOMCellFromCords(t,n,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(t,n,r){let i=this.getDOMCellFromCords(t,n,r);if(i==null)return null;let s=ee(i.elem);return w(s)?s:null}getCellNodeFromCordsOrThrow(t,n,r){let i=this.getCellNodeFromCords(t,n,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}canSelectBefore(){return!0}canIndent(){return!1}};function px(o){let e=Rr();Qe(o,e);let t=rf(o);return e.setColWidths(t),e.setStyles(Mn(o)),{node:e}}function Rr(){return oe(new xt)}function K(o){return o instanceof xt}var Hn=class o extends J{constructor(){super(...arguments);this.__id=""}static getType(){return"horizontal-rule"}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}static clone(t){let n=new o(t.__key);return n.__id=t.__id,n}createDOM(t,n){let r=document.createElement("hr");return this.__id&&r.setAttribute("id",this.__id),r}updateDOM(t,n){return t.__id!==this.__id}static importDOM(){return{hr(t){return{conversion:n=>{let r=new o;return n.id&&r.setId(n.id),{node:r}},priority:3}}}}exportJSON(){return{...super.exportJSON(),type:"horizontal-rule",version:1,id:this.__id}}static importJSON(t){let n=ua();return n.setId(t.id),n}};function ua(){return new Hn}function gf(o){return o instanceof Hn}var hf=o=>(o.split(" ").filter(t=>t.startsWith("language-"))[0]||"").replace("language-",""),Qo=class o extends Mt{constructor(t="",n="",r){super(r);this.__id="";this.__language="";this.__code="";this.__language=t,this.__code=n}static getType(){return"code-block"}static clone(t){let n=new o(t.__language,t.__code,t.__key);return n.__id=t.__id,n}setLanguage(t){let n=this.getWritable();n.__language=t}getLanguage(){return this.getLatest().__language}setCode(t){let n=this.getWritable();n.__code=t}getCode(){return this.getLatest().__code}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}decorate(t,n){return{type:"code",getNode:()=>this}}isInline(){return!1}isIsolated(){return!0}createDOM(t,n){let r=y("pre",{id:this.__id||null},[y("code",{class:this.__language?`language-${this.__language}`:null},[this.__code])]);return y("div",{class:"editor-code-block-wrap"},[r])}updateDOM(t,n){let r=n.querySelector("code");return r&&(t.__language!==this.__language&&(r.className=this.__language?`language-${this.__language}`:""),t.__id!==this.__id&&n.setAttribute("id",this.__id),t.__code!==this.__code&&(r.textContent=this.__code)),!1}exportDOM(t){return{element:this.createDOM(t._config,t).querySelector("pre")}}static importDOM(){return{pre(t){return{conversion:n=>{let r=n.querySelector("code"),i=hf(n.className)||r&&hf(r.className)||"",s=r?(r.textContent||"").trim():(n.textContent||"").trim(),l=Yi(i,s);return n.id&&l.setId(n.id),{node:l}},priority:3}}}}exportJSON(){return{type:"code-block",version:1,id:this.__id,language:this.__language,code:this.__code}}static importJSON(t){let n=Yi(t.language,t.code);return n.setId(t.id||""),n}};function Yi(o="",e=""){return new Qo(o,e)}function Zi(o){return o instanceof Qo}function Pr(o,e){let t=e.getCode(),n=e.getLanguage();window.$components.first("code-editor").open(t,n,"ltr",(i,s)=>{o.update(()=>{e.setCode(i),e.setLanguage(s)})},()=>{})}var yo=class o extends Mt{constructor(t,n,r){super(r);this.__id="";this.__drawingId="";this.__drawingUrl="";this.__drawingId=t,this.__drawingUrl=n}static getType(){return"diagram"}static clone(t){let n=new o(t.__drawingId,t.__drawingUrl);return n.__id=t.__id,n}setDrawingIdAndUrl(t,n){let r=this.getWritable();r.__drawingUrl=n,r.__drawingId=t}getDrawingIdAndUrl(){let t=this.getLatest();return{id:t.__drawingId,url:t.__drawingUrl}}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}decorate(t,n){return{type:"diagram",getNode:()=>this}}isInline(){return!1}isIsolated(){return!0}createDOM(t,n){return y("div",{id:this.__id||null,"drawio-diagram":this.__drawingId},[y("img",{src:this.__drawingUrl})])}updateDOM(t,n){let r=n.querySelector("img");return r&&(t.__id!==this.__id&&n.setAttribute("id",this.__id),t.__drawingUrl!==this.__drawingUrl&&r.setAttribute("src",this.__drawingUrl),t.__drawingId!==this.__drawingId&&n.setAttribute("drawio-diagram",this.__drawingId)),!1}static importDOM(){return{div(t){return t.hasAttribute("drawio-diagram")?{conversion:n=>{let i=n.querySelector("img")?.getAttribute("src")||"",s=n.getAttribute("drawio-diagram")||"",l=Kn(s,i);return n.id&&l.setId(n.id),{node:l}},priority:3}:null}}}exportJSON(){return{type:"diagram",version:1,id:this.__id,drawingId:this.__drawingId,drawingUrl:this.__drawingUrl}}static importJSON(t){let n=Kn(t.drawingId,t.drawingUrl);return n.setId(t.id||""),n}};function Kn(o="",e=""){return new yo(o,e)}var gx=["width","height","style","title","name","src","allow","allowfullscreen","loading","sandbox","type","data","controls","autoplay","controlslist","loop","muted","playsinline","poster","preload"];function hx(o){let e={};for(let t of Object.keys(o))gx.includes(t)&&(e[t]=o[t]);return e}function Nf(o,e){let t=xf(o),n={};for(let i of e.attributes)n[i.name]=i.value;t.setAttributes(n);let r=[];if(o==="video"||o==="audio"){for(let i of e.children)if(i.tagName==="SOURCE"){let s=i.getAttribute("src"),l=i.getAttribute("type");s&&l&&r.push({src:s,type:l})}t.setSources(r)}return Qe(e,t),t}var en=class o extends J{constructor(t,n){super(n);this.__id="";this.__alignment="";this.__attributes={};this.__sources=[];this.__inset=0;this.__tag=t}static getType(){return"media"}static clone(t){let n=new o(t.__tag,t.__key);return n.__attributes=Object.assign({},t.__attributes),n.__sources=t.__sources.map(r=>Object.assign({},r)),n.__id=t.__id,n.__alignment=t.__alignment,n.__inset=t.__inset,n}setTag(t){let n=this.getWritable();n.__tag=t}getTag(){return this.getLatest().__tag}setAttributes(t){let n=this.getWritable();n.__attributes=hx(t)}getAttributes(){return this.getLatest().__attributes}setSources(t){let n=this.getWritable();n.__sources=t}getSources(){return this.getLatest().__sources}setSrc(t){let n=Object.assign({},this.getAttributes());this.__tag==="object"?n.data=t:n.src=t,this.setAttributes(n)}setWidthAndHeight(t,n){let r=Object.assign({},this.getAttributes(),{width:t,height:n});this.setAttributes(r)}setId(t){let n=this.getWritable();n.__id=t}getId(){return this.getLatest().__id}setAlignment(t){let n=this.getWritable();n.__alignment=t}getAlignment(){return this.getLatest().__alignment}setInset(t){let n=this.getWritable();n.__inset=t}getInset(){return this.getLatest().__inset}setHeight(t){if(!t)return;let n=Object.assign({},this.getAttributes(),{height:t});this.setAttributes(n)}getHeight(){let t=this.getLatest();return zo(t.__attributes.height||"0")}setWidth(t){let n=Object.assign({},this.getAttributes(),{width:t});this.setAttributes(n)}getWidth(){let t=this.getLatest();return zo(t.__attributes.width||"0")}isInline(){return!0}isParentRequired(){return!0}createInnerDOM(){let n=(this.__tag==="video"||this.__tag==="audio"?this.__sources:[]).map(i=>y("source",i)),r=y(this.__tag,this.__attributes,n);return et(r,this),r}createDOM(t,n){let r=this.createInnerDOM(),i=y("span",{class:r.className+" editor-media-wrap"},[r]);return i.addEventListener("click",s=>{n.update(()=>ke(this))}),i}updateDOM(t,n){if(t.__tag!==this.__tag||JSON.stringify(t.__sources)!==JSON.stringify(this.__sources)||JSON.stringify(t.__attributes)!==JSON.stringify(this.__attributes))return!0;let r=n.firstElementChild;return t.__id!==this.__id&&ru(r,"id",this.__id),t.__alignment!==this.__alignment&&(t.__alignment&&(n.classList.remove(`align-${t.__alignment}`),r.classList.remove(`align-${t.__alignment}`)),this.__alignment&&(n.classList.add(`align-${this.__alignment}`),r.classList.add(`align-${this.__alignment}`))),t.__inset!==this.__inset&&(n.style.paddingLeft=`${this.__inset}px`),!1}static importDOM(){let t=n=>r=>({conversion:i=>({node:Nf(n,i)}),priority:3});return{iframe:t("iframe"),embed:t("embed"),object:t("object"),video:t("video"),audio:t("audio")}}exportDOM(t){return{element:this.createInnerDOM()}}exportJSON(){return{...super.exportJSON(),type:"media",version:1,id:this.__id,alignment:this.__alignment,inset:this.__inset,tag:this.__tag,attributes:this.__attributes,sources:this.__sources}}static importJSON(t){let n=xf(t.tag);return tt(t,n),n}};function xf(o){return new en(o)}function Ef(o){let n=new DOMParser().parseFromString(`<body>${o}</body>`,"text/html").body.children[0];if(!(n instanceof HTMLElement))return null;let r=n.tagName.toLowerCase();return["embed","iframe","video","audio","object"].includes(r)?Nf(r,n):null}var Nx=["mp4","mpeg","m4v","m4p","mov"],xx=["3gp","aac","flac","mp3","m4a","ogg","wav","webm"],Ex=["html","htm","php","asp","aspx",""];function Tf(o){let e="iframe",n=(o.split("?")[0].split("/").pop()||"").split("."),r=(n.length>1?n[n.length-1]:"").toLowerCase();return Nx.includes(r)?e="video":xx.includes(r)?e="audio":r&&!Ex.includes(r)&&(e="embed"),new en(e)}function eo(o){return o instanceof en}var Wn=class o extends wt{static getType(){return"heading"}static clone(e){let t=new o(e.__tag,e.__key);return To(e,t),t}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){let t=this.__tag,n=document.createElement(t),i=e.theme.heading;if(i!==void 0){let s=i[t];Te(n,s)}return et(n,this),n}updateDOM(e,t){return vt(e,this)}static importDOM(){return{h1:e=>({conversion:Un,priority:0}),h2:e=>({conversion:Un,priority:0}),h3:e=>({conversion:Un,priority:0}),h4:e=>({conversion:Un,priority:0}),h5:e=>({conversion:Un,priority:0}),h6:e=>({conversion:Un,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);return t&&pe(t)&&this.isEmpty()&&t.append(document.createElement("br")),{element:t}}static importJSON(e){let t=zn(e.tag);return tt(e,t),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){let n=e?e.anchor.offset:0,r=this.getLastDescendant(),s=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?$():zn(this.getTag()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,t),n===0&&!this.isEmpty()&&e){let a=$();a.select(),this.replace(a,!0)}return s}collapseAtStart(){let e=this.isEmpty()?$():zn(this.getTag());return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}extractWithChild(){return!0}};function Un(o){let e=o.nodeName.toLowerCase(),t=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(t=zn(e),Qe(o,t)),{node:t}}function zn(o){return oe(new Wn(o))}function qn(o){return o instanceof Wn}var Yn=class o extends wt{static getType(){return"quote"}static clone(e){let t=new o(e.__key);return To(e,t),t}constructor(e){super(e)}createDOM(e){let t=document.createElement("blockquote");return Te(t,e.theme.quote),et(t,this),t}updateDOM(e,t){return vt(e,this)}static importDOM(){return{blockquote:e=>({conversion:Tx,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);return t&&pe(t)&&this.isEmpty()&&t.append(document.createElement("br")),{element:t}}static importJSON(e){let t=Vi();return tt(e,t),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){let n=$(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){let e=$();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Vi(){return oe(new Yn)}function Xi(o){return o instanceof Yn}function Tx(o){let e=Vi();return Qe(o,e),{node:e}}function _f(){return[Wo,Wn,Yn,Zo,Gt,xt,Jt,jt,Yo,Hn,Bn,Qo,yo,en,dt,kn]}function Cf(o){let e=[Yo,Qo,yo],t=n=>{for(let[r,i]of n)if(i==="destroyed"){let s=o.manager.getDecoratorByNodeKey(r);s&&s.destroy(o)}};for(let n of e)o.editor.registerMutationListener(n,r=>t(r))}function yf(o){return"build"in o}var Le=class{constructor(){this.dom=null;this.context=null}setContext(e){this.context=e}getContext(){if(this.context===null)throw new Error("Attempted to use EditorUIContext before it has been set");return this.context}getDOMElement(){return this.dom||(this.dom=this.buildDOM()),this.dom}trans(e){return this.getContext().translate(e)}updateState(e){}},ne=class extends Le{constructor(t){super();this.children=[];this.children.push(...t)}buildDOM(){return y("div",{},this.getChildren().map(t=>t.getDOMElement()))}getChildren(){return this.children}addChildren(...t){this.children.push(...t)}removeChildren(...t){for(let n of t)this.removeChild(n)}removeChild(t){let n=this.children.indexOf(t);n!==-1&&this.children.splice(n,1)}updateState(t){for(let n of this.children)n.updateState(t)}setContext(t){super.setContext(t);for(let n of this.getChildren())n.setContext(t)}},Gi=class extends ne{constructor(e,t){super(t),this.className=e}buildDOM(){return y("div",{class:this.className},this.getChildren().map(e=>e.getDOMElement()))}};var v=class extends Le{constructor(t){super();this.active=!1;this.completedSetup=!1;this.disabled=!1;t.action!==void 0?this.definition=t:this.definition={...t,action(){return!1},isActive:()=>!1}}setContext(t){super.setContext(t),this.definition.setup&&!this.completedSetup&&(this.definition.setup(t,this),this.completedSetup=!0)}buildDOM(){let t=this.getLabel(),n=this.definition.format||"small",r=[];if(this.definition.icon||n==="long"){let s=y("div",{class:"editor-button-icon"});s.innerHTML=this.definition.icon||"",r.push(s)}if(!this.definition.icon||n==="long"){let s=y("div",{class:"editor-button-text"},[t]);r.push(s)}let i=y("button",{type:"button",class:`editor-button editor-button-${n}`,title:this.definition.icon?t:null,disabled:this.disabled?"true":null},r);return i.addEventListener("click",this.onClick.bind(this)),i}onClick(){this.definition.action(this.getContext(),this)}updateActiveState(t){let n=this.definition.isActive(t,this.getContext());this.setActiveState(n)}updateDisabledState(t){if(this.definition.isDisabled){let n=this.definition.isDisabled(t,this.getContext());this.toggleDisabled(n)}}setActiveState(t){this.active=t,this.dom?.classList.toggle("editor-button-active",this.active)}updateState(t){this.updateActiveState(t.selection),this.updateDisabledState(t.selection)}isActive(){return this.active}getLabel(){return this.trans(this.definition.label)}toggleDisabled(t){this.disabled=t,t?this.dom?.setAttribute("disabled","true"):this.dom?.removeAttribute("disabled")}};function _x(o,e,t){let n=e.getBoundingClientRect(),r=o.getBoundingClientRect();if(o.style.position="fixed",t){let i=n.right;n.right+r.width>window.innerWidth&&(i=Math.max(n.left-r.width,0)),o.style.top=n.top+"px",o.style.left=i+"px"}else{let i=n.left+r.width>window.innerWidth,s=n.left;i&&(s=Math.max(n.right-r.width,0)),o.style.top=n.bottom+"px",o.style.left=s+"px"}}function ji(o){let{menu:e,toggle:t,onClose:n,onOpen:r,showOnHover:i,showAside:s}=o,l=null,a=()=>{e.hidden=!0,e.style.removeProperty("position"),e.style.removeProperty("left"),e.style.removeProperty("top"),l&&window.removeEventListener("click",l),n&&n()},c=()=>{e.hidden=!1,_x(e,t,!!s),l=f=>{!t.contains(f.target)&&!e.contains(f.target)&&a()},window.addEventListener("click",l),r&&r()},m=f=>{e.hasAttribute("hidden")?c():a()};t.addEventListener("click",m),i&&t.addEventListener("mouseenter",m),e.parentElement?.addEventListener("mouseleave",f=>{let d=t.getBoundingClientRect(),u=f.clientX<=d.right&&f.clientX>=d.left,p=f.clientY<=d.bottom&&f.clientY>=d.top;u&&p||a()})}var Ji=class extends ne{buildDOM(){let e=this.getChildren().map(i=>i.getDOMElement()),t=y("div",{class:"editor-format-menu-dropdown editor-dropdown-menu editor-dropdown-menu-vertical",hidden:"true"},e),n=y("button",{class:"editor-format-menu-toggle editor-button",type:"button"},[this.trans("Formats")]),r=y("div",{class:"editor-format-menu editor-dropdown-menu-container"},[n,t]);return ji({toggle:n,menu:t}),r}updateState(e){super.updateState(e);for(let t of this.children){if(t instanceof v&&t.isActive()){this.updateToggleLabel(t.getLabel());return}if(t instanceof ne){for(let n of t.getChildren())if(n instanceof v&&n.isActive()){this.updateToggleLabel(n.getLabel());return}}}this.updateToggleLabel(this.trans("Formats"))}updateToggleLabel(e){let t=this.getDOMElement().querySelector("button");t&&(t.innerText=e)}};var Ye=class extends v{constructor(e,t){super(t),this.previewSampleElement=e}buildDOM(){let e=super.buildDOM();e.innerHTML="";let t=y("span",{class:"editor-button-format-preview"},[this.getLabel()]),n=this.getStylesFromPreview();for(let r of Object.keys(n))t.style.setProperty(r,n[r]);return e.append(t),e}getStylesFromPreview(){let e=y("div",{style:"display: none",hidden:"true",class:"page-content"}),t=this.previewSampleElement.cloneNode();t.textContent=this.getLabel(),e.append(t),document.body.append(e);let n=["color","font-size","background-color","border-inline-start"],r={},i=window.getComputedStyle(t);for(let s of n)r[s]=i.getPropertyValue(s);return e.remove(),r}};var bf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>';var Qi=class extends v{buildDOM(){let e=super.buildDOM(),t=y("div",{class:"editor-menu-button-icon"});return t.innerHTML=bf,e.append(t),e}};var yx={showOnHover:!1,direction:"horizontal",showAside:void 0,button:{label:"Menu"}},Me=class extends ne{constructor(t,n){super(n);this.open=!1;if(this.childItems=n,this.options=Object.assign({},yx,t),t.button instanceof v)this.button=t.button;else{let r=t.button.format==="long"?Qi:v;this.button=new r({...t.button,action(){return!1},isActive:()=>this.open})}this.addChildren(this.button)}insertItems(...t){this.addChildren(...t),this.childItems.push(...t)}buildDOM(){let t=this.button.getDOMElement(),n=this.childItems.map(s=>s.getDOMElement()),r=y("div",{class:`editor-dropdown-menu editor-dropdown-menu-${this.options.direction}`,hidden:"true"},n),i=y("div",{class:"editor-dropdown-menu-container"},[t,r]);return ji({toggle:t,menu:r,showOnHover:this.options.showOnHover,showAside:typeof this.options.showAside=="boolean"?this.options.showAside:this.options.direction==="vertical",onOpen:()=>{this.open=!0,this.getContext().manager.triggerStateUpdateForElement(this.button)},onClose:()=>{this.open=!1,this.getContext().manager.triggerStateUpdateForElement(this.button)}}),i}};var Sf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"/></svg>';var Sx=["#000000","#ffffff","#BFEDD2","#FBEEB8","#F8CAC6","#ECCAFA","#C2E0F4","#2DC26B","#F1C40F","#E03E2D","#B96AD9","#3598DB","#169179","#E67E23","#BA372A","#843FA1","#236FA1","#ECF0F1","#CED4D9","#95A5A6","#7E8C8D","#34495E"],Br=class extends Le{constructor(e){super(),this.styleProperty=e}buildDOM(){let e=Sx.map(i=>y("div",{class:"editor-color-select-option",style:`background-color: ${i}`,"data-color":i,"aria-label":i})),t=y("div",{class:"editor-color-select-option","data-color":"",title:"Clear color"},[]);t.innerHTML=Sf,e.push(t);let n=[];for(let i=0;i<e.length;i+=5){let s=e.slice(i,i+5);n.push(y("div",{class:"editor-color-select-row"},s))}let r=y("div",{class:"editor-color-select"},n);return r.addEventListener("click",this.onClick.bind(this)),r}onClick(e){let t=e.target.closest("[data-color]");if(!t)return;let n=t.dataset.color;this.getContext().editor.update(()=>{let r=T();r&&Il(r,{[this.styleProperty]:n||null})})}};var es=class extends Le{buildDOM(){let t=[],n=[];for(let s=1;s<11;s++){let l=[];for(let a=1;a<11;a++){let c=y("div",{class:"editor-table-creator-cell","data-rows":String(s),"data-columns":String(a)});l.push(c),n.push(c)}t.push(y("div",{class:"editor-table-creator-row"},l))}let r=y("div",{class:"editor-table-creator-display"},["0 x 0"]),i=y("div",{class:"editor-table-creator-grid"},t);return i.addEventListener("mousemove",s=>{let l=s.target.closest(".editor-table-creator-cell");if(l){let a=Number(l.dataset.rows||0),c=Number(l.dataset.columns||0);this.updateGridSelection(a,c,n,r)}}),i.addEventListener("click",s=>{let l=s.target.closest(".editor-table-creator-cell");l&&this.onCellClick(l)}),i.addEventListener("mouseleave",s=>{this.updateGridSelection(0,0,n,r)}),y("div",{class:"editor-table-creator"},[i,r])}updateGridSelection(e,t,n,r){for(let i of n){let s=Number(i.dataset.rows)<=e&&Number(i.dataset.columns)<=t;i.classList.toggle("active",s)}r.textContent=`${e} x ${t}`}onCellClick(e){let t=Number(e.dataset.rows||0),n=Number(e.dataset.columns||0);if(t<1||n<1)return;let r=Math.min(Math.round(840/n),240),i=Array(n).fill(r+"px");this.getContext().editor.update(()=>{let s=Jl(t,n,!1);s.setColWidths(i),qo(s)})}};var Fr=class extends v{constructor(e,t){super(e),this.style=t}getColorBar(){let e=this.getDOMElement().querySelector("svg .editor-icon-color-bar");if(!e)throw new Error(`Could not find expected color bar in the icon for this ${this.definition.label} button`);return e}updateState(e){if(super.updateState(e),C(e.selection)){let t=$l(e.selection,this.style);this.getColorBar().setAttribute("fill",t)}}};var Lf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"/></svg>';var nt=class extends ne{constructor(e,t){super(t),this.size=e,this.content=t,this.overflowButton=new Me({button:{label:"More",icon:Lf}},[]),this.addChildren(this.overflowButton)}buildDOM(){let e=this.content.length>this.size?this.size-1:this.size,t=this.content.slice(0,e),n=this.content.slice(e),r=t.map(i=>i.getDOMElement());return n.length>0&&(this.removeChildren(...n),this.overflowButton.insertItems(...n),r.push(this.overflowButton.getDOMElement())),y("div",{class:"editor-overflow-container"},r)}};var fa='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200Zm80-400h560v-160H200v160Zm213 200h134v-120H413v120Zm0 200h134v-120H413v120ZM200-400h133v-120H200v120Zm427 0h133v-120H627v120ZM200-200h133v-120H200v120Zm427 0h133v-120H627v120Z"/></svg>';var ts='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14c0 1.1-.9 2-2 2zm0-2h14V5H5v14z"/><path d="m13.711 15.423-1.71-1.712-1.712 1.712c-1.14 1.14-2.852-.57-1.71-1.712l1.71-1.71-1.71-1.712c-1.143-1.142.568-2.853 1.71-1.71L12 10.288l1.711-1.71c1.141-1.142 2.852.57 1.712 1.71L13.71 12l1.626 1.626c1.345 1.345-.76 2.663-1.626 1.797z" style="fill-rule:nonzero;stroke-width:1.20992"/></svg>';var Mf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14c1.1 0 2 .9 2 2zm-2 0V5h-4v2.2h-2V5h-2v2.2H9V5H5v14h4v-2.1h2V19h2v-2.1h2V19Z"/><path d="M14.829 10.585 13.415 12l1.414 1.414c.943.943-.472 2.357-1.414 1.414L12 13.414l-1.414 1.414c-.944.944-2.358-.47-1.414-1.414L10.586 12l-1.414-1.415c-.943-.942.471-2.357 1.414-1.414L12 10.585l1.344-1.343c1.111-1.112 2.2.627 1.485 1.343z" style="fill-rule:nonzero"/></svg>';var vf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14c0 1.1-.9 2-2 2zm0-2h14v-4h-2.2v-2H19v-2h-2.2V9H19V5H5v4h2.1v2H5v2h2.1v2H5Z"/><path d="M13.415 14.829 12 13.415l-1.414 1.414c-.943.943-2.357-.472-1.414-1.414L10.586 12l-1.414-1.414c-.944-.944.47-2.358 1.414-1.414L12 10.586l1.415-1.414c.942-.943 2.357.471 1.414 1.414L13.415 12l1.343 1.344c1.112 1.111-.627 2.2-1.343 1.485z" style="fill-rule:nonzero"/></svg>';var wf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16 5h-5v14h5c1.235 0 1.234 2 0 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11c1.229 0 1.236 2 0 2zm-7 6V5H5v6zm0 8v-6H5v6zm11.076-6h-2v2c0 1.333-2 1.333-2 0v-2h-2c-1.335 0-1.335-2 0-2h2V9c0-1.333 2-1.333 2 0v2h1.9c1.572 0 1.113 2 .1 2z"/></svg>';var Df='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 19h5V5H8C6.764 5 6.766 3 8 3h11a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H8c-1.229 0-1.236-2 0-2zm7-6v6h4v-6zm0-8v6h4V5ZM3.924 11h2V9c0-1.333 2-1.333 2 0v2h2c1.335 0 1.335 2 0 2h-2v2c0 1.333-2 1.333-2 0v-2h-1.9c-1.572 0-1.113-2-.1-2z"/></svg>';var Of='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 8v5h14V8c0-1.235 2-1.234 2 0v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8C3 6.77 5 6.764 5 8zm6 7H5v4h6zm8 0h-6v4h6zM13 3.924v2h2c1.333 0 1.333 2 0 2h-2v2c0 1.335-2 1.335-2 0v-2H9c-1.333 0-1.333-2 0-2h2v-1.9c0-1.572 2-1.113 2-.1z"/></svg>';var Af='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 16v-5H5v5c0 1.235-2 1.234-2 0V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v11c0 1.229-2 1.236-2 0zm-6-7h6V5h-6zM5 9h6V5H5Zm6 11.076v-2H9c-1.333 0-1.333-2 0-2h2v-2c0-1.335 2-1.335 2 0v2h2c1.333 0 1.333 2 0 2h-2v1.9c0 1.572-2 1.113-2 .1z"/></svg>';function Rf(){let o=()=>((1+Math.random())*65536|0).toString(16).substring(1);return`${o()+o()}-${o()}-${o()}-${o()}-${o()}${o()}${o()}`}function kf(){return((1+Math.random())*65536|0).toString(16).substring(1)}var bo=class extends Le{constructor(e){super(),this.definition=e}setValue(e){let t=this.getDOMElement().querySelector("input,select,textarea");t.value=e}getName(){return this.definition.name}buildDOM(){let e=`editor-form-field-${this.definition.name}-${Date.now()}`,t;if(this.definition.type==="select"){let n=this.definition.valuesByLabel,i=Object.keys(n).map(s=>y("option",{value:n[s]},[this.trans(s)]));t=y("select",{id:e,name:this.definition.name,class:"editor-form-field-input"},i)}else this.definition.type==="textarea"?t=y("textarea",{id:e,name:this.definition.name,class:"editor-form-field-input"}):t=y("input",{id:e,name:this.definition.name,class:"editor-form-field-input"});return y("div",{class:"editor-form-field-wrapper"},[y("label",{class:"editor-form-field-label",for:e},[this.trans(this.definition.label)]),t])}},os=class extends ne{constructor(t){let n=t.fields.map(r=>yf(r)?r.build():new bo(r));super(n);this.onCancel=null;this.onSuccessfulSubmit=null;this.definition=t}setValues(t){for(let n of Object.keys(t)){let r=this.getFieldByName(n);r&&r.setValue(t[n])}}setOnCancel(t){this.onCancel=t}setOnSuccessfulSubmit(t){this.onSuccessfulSubmit=t}getFieldByName(t){let n=r=>{for(let i of r){if(i instanceof bo&&i.getName()===t)return i;if(i instanceof ne){let s=n(i.getChildren());if(s)return s}}return null};return n(this.getChildren())}buildDOM(){let t=y("button",{type:"button",class:"editor-form-action-secondary"},[this.trans("Cancel")]),n=y("form",{},[...this.children.map(r=>r.getDOMElement()),y("div",{class:"editor-form-actions"},[t,y("button",{type:"submit",class:"editor-form-action-primary"},[this.trans(this.definition.submitText)])])]);return n.addEventListener("submit",async r=>{r.preventDefault();let i=new FormData(n);await this.definition.action(i,this.getContext())&&this.onSuccessfulSubmit&&this.onSuccessfulSubmit()}),t.addEventListener("click",r=>{this.onCancel&&this.onCancel()}),n}},ma=class extends ne{constructor(e){let t=e.contents.map(n=>new bo(n));super(t),this.definition=e,this.fields=t,this.id=Rf()}getLabel(){return this.getContext().translate(this.definition.label)}getId(){return this.id}buildDOM(){return y("div",{class:"editor-form-tab-content",role:"tabpanel",id:`editor-tabpanel-${this.id}`,"aria-labelledby":`editor-tab-${this.id}`},this.fields.map(e=>e.getDOMElement()))}},tn=class extends ne{constructor(t){let n=t.map(r=>new ma(r));super(n);this.definitions=[];this.tabs=[];this.definitions=t,this.tabs=n}buildDOM(){let t=[],n=[],r=i=>{for(let s=0;s<t.length;s++)t[s].setAttribute("aria-selected",s===i?"true":"false");for(let s=0;s<n.length;s++)n[s].hidden=s!==i};for(let i of this.tabs){let s=y("button",{class:"editor-form-tab-control",type:"button",role:"tab",id:`editor-tab-${i.getId()}`,"aria-controls":`editor-tabpanel-${i.getId()}`},[i.getLabel()]);n.push(i.getDOMElement()),t.push(s),s.addEventListener("click",l=>{r(t.indexOf(s))})}return r(0),y("div",{class:"editor-form-tab-container"},[y("div",{class:"editor-form-tab-controls"},t),y("div",{class:"editor-form-tab-contents"},n)])}};var pa={label:"Border style",name:"border_style",type:"select",valuesByLabel:{"Select...":"",Solid:"solid",Dotted:"dotted",Dashed:"dashed",Double:"double",Groove:"groove",Ridge:"ridge",Inset:"inset",Outset:"outset",None:"none",Hidden:"hidden"}},ga={label:"Border color",name:"border_color",type:"text"},ha={label:"Background color",name:"background_color",type:"text"},If={label:"Alignment",name:"align",type:"select",valuesByLabel:{None:"",Left:"left",Center:"center",Right:"right"}};function $f(o,e){let t=o.getStyles(),n=e.manager.createModal("cell_properties");return n.show({width:df(e.editor,o),height:t.get("height")||"",type:o.getTag(),h_align:o.getAlignment(),v_align:t.get("vertical-align")||"",border_width:t.get("border-width")||"",border_style:t.get("border-style")||"",border_color:t.get("border-color")||"",background_color:t.get("background-color")||""}),n}var Pf={submitText:"Save",async action(o,e){return e.editor.update(()=>{let t=Jo(T());for(let n of t){let r=o.get("width")?.toString()||"";cf(n,r),n.updateTag(o.get("type")?.toString()||""),n.setAlignment(o.get("h_align")?.toString()||"");let i=n.getStyles();i.set("height",ft(o.get("height")?.toString()||"")),i.set("vertical-align",o.get("v_align")?.toString()||""),i.set("border-width",ft(o.get("border_width")?.toString()||"")),i.set("border-style",o.get("border_style")?.toString()||""),i.set("border-color",o.get("border_color")?.toString()||""),i.set("background-color",o.get("background_color")?.toString()||""),n.setStyles(i)}}),!0},fields:[{build(){let o=[{label:"Width",name:"width",type:"text"},{label:"Height",name:"height",type:"text"},{label:"Cell type",name:"type",type:"select",valuesByLabel:{Cell:"td","Header cell":"th"}},{...If,label:"Horizontal align",name:"h_align"},{label:"Vertical align",name:"v_align",type:"select",valuesByLabel:{None:"",Top:"top",Middle:"middle",Bottom:"bottom"}}],e=[{label:"Border width",name:"border_width",type:"text"},pa,ga,ha];return new tn([{label:"General",contents:o},{label:"Advanced",contents:e}])}}]};function Bf(o,e){let t=o.getStyles(),n=e.manager.createModal("row_properties");return n.show({height:t.get("height")||"",border_style:t.get("border-style")||"",border_color:t.get("border-color")||"",background_color:t.get("background-color")||""}),n}var Ff={submitText:"Save",async action(o,e){return e.editor.update(()=>{let t=Qt(T());for(let n of t){let r=n.getStyles();r.set("height",ft(o.get("height")?.toString()||"")),r.set("border-style",o.get("border_style")?.toString()||""),r.set("border-color",o.get("border_color")?.toString()||""),r.set("background-color",o.get("background_color")?.toString()||""),n.setStyles(r)}}),!0},fields:[{label:"Height",name:"height",type:"text"},pa,ga,ha]};function Hf(o,e){let t=o.getStyles(),n=e.manager.createModal("table_properties");return n.show({width:t.get("width")||"",height:t.get("height")||"",cell_spacing:t.get("cell-spacing")||"",cell_padding:pf(o),border_width:t.get("border-width")||"",border_style:t.get("border-style")||"",border_color:t.get("border-color")||"",background_color:t.get("background-color")||"",align:o.getAlignment()}),n}var Kf={submitText:"Save",async action(o,e){return e.editor.update(()=>{let t=Nt(T());if(!t)return;let n=t.getStyles();n.set("width",ft(o.get("width")?.toString()||"")),n.set("height",ft(o.get("height")?.toString()||"")),n.set("cell-spacing",ft(o.get("cell_spacing")?.toString()||"")),n.set("border-width",ft(o.get("border_width")?.toString()||"")),n.set("border-style",o.get("border_style")?.toString()||""),n.set("border-color",o.get("border_color")?.toString()||""),n.set("background-color",o.get("background_color")?.toString()||""),t.setStyles(n),t.setAlignment(o.get("align"));let r=o.get("cell_padding")?.toString()||"";if(r){let i=ft(r);da(t,s=>{let l=s.getStyles();l.set("padding",i),s.setStyles(l)})}}),!0},fields:[{build(){let o=[{label:"Width",name:"width",type:"text"},{label:"Height",name:"height",type:"text"},{label:"Cell spacing",name:"cell_spacing",type:"text"},{label:"Cell padding",name:"cell_padding",type:"text"},{label:"Border width",name:"border_width",type:"text"},{label:"caption",name:"caption",type:"text"},If],e=[pa,ga,ha];return new tn([{label:"General",contents:o},{label:"Advanced",contents:e}])}}]};function Uf(o){let e=E(o)?o.getChildren():[];return{node:o.exportJSON(),children:e.map(t=>Uf(t))}}function zf(o,{node:e,children:t}){let n=o._nodes.get(e.type)?.klass.importJSON(e);if(!n)return null;let r=t.map(i=>zf(o,i));for(let i of r)i&&E(n)&&n.append(i);return n}var Hr=class{constructor(){this.store=[]}set(...e){this.store.splice(0,this.store.length);for(let t of e)this.store.push(Uf(t))}get(e){return this.store.map(t=>zf(e,t)).filter(t=>t!==null)}size(){return this.store.length}};var Kr=new Hr;function Na(){return Kr.size()===0}function Wf(o){let e=null;for(let t of o){let n=t.getChildren().filter(i=>w(i)),r=0;for(let i of n)if(r+=i.getColSpan()||1,i.getRowSpan()>1)throw Error("Cannot copy rows with merged cells");if(e===null)e=r;else if(e!==r)throw Error("Cannot copy rows with inconsistent sizes")}}function qf(o,e){let t=new kt(e).columnCount;for(let n of o){let r=n.getChildren().filter(s=>w(s)),i=0;for(let s of r)i+=s.getColSpan()||1;if(i>t)throw Error("Cannot paste rows that are wider than target table");for(;i<t;)n.append(Pe()),i++}}function Yf(){let o=Qt(T());Wf(o),Kr.set(...o);for(let e of o)e.remove()}function Zf(){let o=Qt(T());Wf(o),Kr.set(...o)}function Vf(o){let e=T(),t=Qt(e),n=Nt(e),r=t[t.length-1];if(r&&n){let i=Kr.get(o);qf(i,n);for(let s of i)r.insertBefore(s)}}function Xf(o){let e=T(),t=Qt(e),n=Nt(e),r=t[t.length-1];if(r&&n){let i=Kr.get(o).reverse();qf(i,n);for(let s of i)r.insertAfter(s)}}var ns=[];function Gf(o){let e=o.map(t=>{let n=new Hr;return n.set(...t),n});ns.splice(0,ns.length,...e)}function xa(){return ns.length===0}function jf(o){if(z(o)){let i=o.getShape();return{from:i.fromX,to:i.toX}}let e=V(o,w),t=Nt(o);if(!w(e)||!t)return null;let r=new kt(t).getRangeForCell(e);return r?{from:r.fromX,to:r.toX}:null}function Jf(o,e){let t=new kt(e),n=[];for(let r=o.from;r<=o.to;r++){let i=t.getCellsInColumn(r);n.push(i)}return n}function Qf(o){let e=null;for(let t of o){let n=0;for(let r of t)if(n+=r.getRowSpan()||1,r.getColSpan()>1)throw Error("Cannot copy columns with merged cells");if(e===null)e=n;else if(e!==n)throw Error("Cannot copy columns with inconsistent sizes")}}function em(){let o=T(),e=jf(o),t=Nt(o);if(!e||!t)return;let n=t.getColWidths(),r=Jf(e,t);Qf(r),Gf(r);for(let s of r)for(let l of s)l.remove();let i=[...n].splice(e.from,e.to-e.from+1);t.setColWidths(i)}function tm(){let o=T(),e=jf(o),t=Nt(o);if(!e||!t)return;let n=Jf(e,t);Qf(n),Gf(n)}function Ix(o,e){let t=new kt(e).rowCount;for(let n of o){let r=0;for(let i of n)r+=i.getRowSpan()||1;if(r>t)throw Error("Cannot paste columns that are taller than target table");for(;r<t;)n.push(Pe()),r++}}function om(o,e){let t=T(),n=Nt(t),r=Jo(t),i=r[e?0:r.length-1];if(!n||!i)return;let s=ns.map(u=>u.get(o));e||s.reverse(),Ix(s,n);let l=new kt(n),a=l.getRangeForCell(i);if(!a)return;let c=e?a.fromX:a.toX,m=n.getColWidths();for(let u=0;u<l.rowCount;u++){let p=l.getCellAtPosition(c,u);for(let g of s){let h=g[u];e?p.insertBefore(h):p.insertAfter(h)}}let f=m[c],d=s.map(u=>f);m.splice(e?c:c+1,0,...d)}function nm(o){om(o,!0)}function rm(o){om(o,!1)}var he=()=>!1,Ce=o=>!ae(o,w),im={label:"Table",icon:fa},Ea={label:"Table properties",icon:fa,action(o){o.editor.getEditorState().read(()=>{let e=Nt(T());K(e)&&Hf(e,o)})},isActive:he,isDisabled:Ce},sm={label:"Clear table formatting",format:"long",action(o){o.editor.update(()=>{let e=V(T(),w);if(!w(e))return;let t=At(e,K);K(t)&&mf(t)})},isActive:he,isDisabled:Ce},lm={label:"Resize to contents",format:"long",action(o){o.editor.update(()=>{let e=V(T(),w);if(!w(e))return;let t=At(e,K);K(t)&&ff(t)})},isActive:he,isDisabled:Ce},Ta={label:"Delete table",icon:ts,action(o){o.editor.update(()=>{let e=V(T(),K);e&&e.remove()})},isActive(){return!1}},am={...Ta,format:"long",isDisabled(o){return!ae(o,K)}},_a={label:"Insert row before",icon:Of,action(o){o.editor.update(()=>{Fi(!1)})},isActive:he,isDisabled:Ce},Ca={label:"Insert row after",icon:Af,action(o){o.editor.update(()=>{Fi(!0)})},isActive:he,isDisabled:Ce},ya={label:"Delete row",icon:vf,action(o){o.editor.update(()=>{Ql()})},isActive:he,isDisabled:Ce},cm={label:"Row properties",format:"long",action(o){o.editor.getEditorState().read(()=>{let e=Qt(T());Q(e[0])&&Bf(e[0],o)})},isActive:he,isDisabled:Ce},dm={label:"Cut row",format:"long",action(o){o.editor.update(()=>{try{Yf()}catch(e){o.error(e)}})},isActive:he,isDisabled:Ce},um={label:"Copy row",format:"long",action(o){o.editor.getEditorState().read(()=>{try{Zf()}catch(e){o.error(e)}})},isActive:he,isDisabled:Ce},fm={label:"Paste row before",format:"long",action(o){o.editor.update(()=>{try{Vf(o.editor)}catch(e){o.error(e)}})},isActive:he,isDisabled:o=>Ce(o)||Na()},mm={label:"Paste row after",format:"long",action(o){o.editor.update(()=>{try{Xf(o.editor)}catch(e){o.error(e)}})},isActive:he,isDisabled:o=>Ce(o)||Na()},pm={label:"Cut column",format:"long",action(o){o.editor.update(()=>{try{em()}catch(e){o.error(e)}})},isActive:he,isDisabled:Ce},gm={label:"Copy column",format:"long",action(o){o.editor.getEditorState().read(()=>{try{tm()}catch(e){o.error(e)}})},isActive:he,isDisabled:Ce},hm={label:"Paste column before",format:"long",action(o){o.editor.update(()=>{try{nm(o.editor)}catch(e){o.error(e)}})},isActive:he,isDisabled:o=>Ce(o)||xa()},Nm={label:"Paste column after",format:"long",action(o){o.editor.update(()=>{try{rm(o.editor)}catch(e){o.error(e)}})},isActive:he,isDisabled:o=>Ce(o)||xa()},ba={label:"Insert column before",icon:Df,action(o){o.editor.update(()=>{Hi(!1)})},isActive(){return!1}},Sa={label:"Insert column after",icon:wf,action(o){o.editor.update(()=>{Hi(!0)})},isActive(){return!1}},La={label:"Delete column",icon:Mf,action(o){o.editor.update(()=>{ea()})},isActive(){return!1}},xm={label:"Cell properties",format:"long",action(o){o.editor.getEditorState().read(()=>{let e=V(T(),w);w(e)&&$f(e,o)})},isActive:he,isDisabled:Ce},Em={label:"Merge cells",format:"long",action(o){o.editor.update(()=>{let e=T();z(e)&&uf(e)})},isActive:he,isDisabled(o){return!z(o)}},Tm={label:"Split cell",format:"long",action(o){o.editor.update(()=>{oa()})},isActive:he,isDisabled(o){let e=V(o,w);return e?!(e.getRowSpan()>1||e.getColSpan()>1):!0}};var _m='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"/></svg>';var Cm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"/></svg>';var ym='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m384-336 56-58-86-86 86-86-56-58-144 144 144 144Zm192 0 144-144-144-144-56 58 86 86-86 86 56 58ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm280-590q13 0 21.5-8.5T510-820q0-13-8.5-21.5T480-850q-13 0-21.5 8.5T450-820q0 13 8.5 21.5T480-790ZM200-200v-560 560Z"/></svg>';var bm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"/></svg>';var Sm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>';function Zn(o,e){o.update(()=>{let t=F();for(let r of t.getChildren())r.remove(!0);let n=_o(o,e);t.append(...n)})}function Lm(o,e){o.update(()=>{let t=F(),n=_o(o,e);t.append(...n)})}function Mm(o,e){o.update(()=>{let t=F(),n=_o(o,e),r=t.getChildren()[0];for(let i=n.length-1;i>=0;i--)r?r.insertBefore(n[i]):t.append(n[i]),r=n[i]})}function vm(o,e){o.update(()=>{let t=T(),n=_o(o,e),r=t?.getNodes()[0],i=r?.getParents()||[];if(i[i.length-1]&&r)for(let l=n.length-1;l>=0;l--)r.insertAfter(n[l])})}function rs(o){return new Promise((e,t)=>{o.getEditorState().read(()=>{let n=Oi(o);e(n)})})}function wm(o){o.focus(()=>{},{defaultSelection:"rootStart"})}var Dm={label:"Undo",icon:_m,action(o){o.editor.dispatchCommand(no,void 0),o.manager.triggerFutureStateRefresh()},isActive(o){return!1},setup(o,e){e.toggleDisabled(!0),o.editor.registerCommand(ao,t=>(e.toggleDisabled(!t),!1),Dt)}},Om={label:"Redo",icon:Cm,action(o){o.editor.dispatchCommand(ro,void 0),o.manager.triggerFutureStateRefresh()},isActive(o){return!1},setup(o,e){e.toggleDisabled(!0),o.editor.registerCommand(lo,t=>(e.toggleDisabled(!t),!1),Dt)}},Am={label:"Source",icon:ym,async action(o){let e=o.manager.createModal("source"),t=await rs(o.editor);e.show({source:t})},isActive(){return!1}},Rm={label:"Fullscreen",icon:bm,async action(o,e){let t=o.containerDOM.classList.contains("fullscreen");o.containerDOM.classList.toggle("fullscreen",!t),o.containerDOM.closest("body").classList.toggle("editor-is-fullscreen",!t),e.setActiveState(!t)},isActive(o,e){return e.containerDOM.classList.contains("fullscreen")}},km={label:"About the editor",icon:Sm,async action(o,e){o.manager.createModal("about").show({})},isActive(o,e){return!1}};var Kx=(o,e)=>qn(o)&&o.getTag()===e;function is(o,e){o.update(()=>{$n(t=>Kx(t,e),()=>zn(e))})}function Ur(o){o.update(()=>{$n(ct,$)})}function zr(o){o.update(()=>{$n(Xi,Vi)})}function Wr(o,e){o.getEditorState().read(()=>{let t=T();ae(t,r=>U(r)&&r.getListType()===e)?Gl(o):Xl(o,e)})}function qr(o){o.getEditorState().read(()=>{let e=T(),t=le(o),n=V(t,Zi);n===null?o.update(()=>{let r=Yi();r.setCode(e?.getTextContent()||"");let i=Rt(e),s=i[0],l=i.slice(1);s?(s.replace(r),l.forEach(a=>a.remove())):qo(r,!0),Pr(o,r),ke(r)}):Pr(o,n)})}function Im(o){o.update(()=>{let e=T(),t=Rt(e),n=!1;for(let i of t)Hl(i)||(i.replace(Rn("info"),!0),n=!0);if(n)return;let r=["info","warning","danger","success"];for(let i of t)if(Hl(i)){let s=i.getCategory(),a=(r.indexOf(s)+1)%r.length,c=r[a];i.setCategory(c)}})}function ss(o,e){o.update(()=>{let t=T(),n=V(t,Ot);if(Ot(n)?(n.setURL(e.url),n.setTarget(e.target),n.setTitle(e.title)):(n=gt(e.url,{title:e.title,target:e.target}),Oe([n])),Ot(n)){for(let r of n.getChildren())r.remove(!0);n.append(Y(e.text))}})}function ls(o,e){return{label:e,action(t){t.editor.update(()=>{$n(n=>Kl(n,o),()=>Rn(o))})},isActive(t){return ae(t,n=>Kl(n,o))}}}var $m=ls("info","Info"),Pm=ls("danger","Danger"),Bm=ls("warning","Warning"),Fm=ls("success","Success"),Ux=(o,e)=>qn(o)&&o.getTag()===e;function as(o,e){return{label:e,action(t){is(t.editor,o)},isActive(t){return ae(t,n=>Ux(n,o))}}}var Hm=as("h2","Large Header"),Km=as("h3","Medium Header"),Um=as("h4","Small Header"),zm=as("h5","Tiny Header"),Wm={label:"Blockquote",action(o){zr(o.editor)},isActive(o){return ae(o,Xi)}},qm={label:"Paragraph",action(o){Ur(o.editor)},isActive(o){return ae(o,ct)}};var Ym='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>';var Zm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>';var Vm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>';var Xm=`<svg version="1.1" viewBox="0 -960 960 960" xmlns="http://www.w3.org/2000/svg"><path class="editor-icon-color-bar" d="m80-3e-6v-160h800v160z"/><path d="m220-280 210-560h100l210 560h-96l-50-144h-226l-52 144zm176-224h168l-82-232h-4z"/></svg>
|
|
`;var Gm='<svg version="1.1" viewBox="0 -960 960 960" xmlns="http://www.w3.org/2000/svg"><path class="editor-icon-color-bar" d="m80-2e-6v-160h800v160z"/><path d="m584-480-104-104-160 160 103 104zm-47-160 103 103 160-159-104-104zm-84-29 216 216-189 190c-16 16-34.833 24-56.5 24s-40.5-8-56.5-24l-27 23h-200l126-125c-16-16-24.333-35.167-25-57.5s7-41.5 23-57.5zm0 0 187-187c16-16 34.833-24 56.5-24s40.5 8 56.5 24l104 103c16 16 24 34.833 24 56.5s-8 40.5-24 56.5l-188 187z"/></svg>';var jm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M80-400v-80h800v80H80Zm340-160v-120H200v-120h560v120H540v120H420Zm0 400v-160h120v160H420Z"/></svg>';var Jm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"/></svg>';var Qm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"/></svg>';var ep='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>';var tp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"/></svg>';function on(o,e,t){return{label:o,icon:t,action(n){n.editor.dispatchCommand(Ne,e)},isActive(n){return Iu(n,e)}}}var op=on("Bold","bold",Ym),np=on("Italic","italic",Zm),rp=on("Underline","underline",Vm),ip={label:"Text color",icon:Xm},sp={label:"Background color",icon:Gm},lp=on("Strikethrough","strikethrough",jm),ap=on("Superscript","superscript",Jm),cp=on("Subscript","subscript",Qm),dp=on("Inline code","code",ep),up={label:"Clear formatting",icon:tp,action(o){o.editor.update(()=>{let e=T();for(let t of e?.getNodes()||[])b(t)&&(t.setFormat(0),t.setStyle(""))})},isActive(){return!1}};var fp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"/></svg>';var mp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"/></svg>';var pp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"/></svg>';var gp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"/></svg>';var hp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-800v400q0 17-11.5 28.5T400-360q-17 0-28.5-11.5T360-400v-160q-66 0-113-47t-47-113q0-66 47-113t113-47h280q17 0 28.5 11.5T680-840q0 17-11.5 28.5T640-800h-40v400q0 17-11.5 28.5T560-360q-17 0-28.5-11.5T520-400v-400h-80Zm-80 160v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Zm328 520H160q-17 0-28.5-11.5T120-240q0-17 11.5-28.5T160-280h528l-36-36q-11-11-11-28t11-28q11-11 28-11t28 11l104 104q12 12 12 28t-12 28L708-108q-11 11-28 11t-28-11q-11-11-11-28t11-28l36-36Z"/></svg>';var Np='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-800v400q0 17-11.5 28.5T400-360q-17 0-28.5-11.5T360-400v-160q-66 0-113-47t-47-113q0-66 47-113t113-47h280q17 0 28.5 11.5T680-840q0 17-11.5 28.5T640-800h-40v400q0 17-11.5 28.5T560-360q-17 0-28.5-11.5T520-400v-400h-80ZM272-200l36 36q11 11 11 28t-11 28q-11 11-28 11t-28-11L148-212q-12-12-12-28t12-28l104-104q11-11 28-11t28 11q11 11 11 28t-11 28l-36 36h528q17 0 28.5 11.5T840-240q0 17-11.5 28.5T800-200H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"/></svg>';function cs(o,e){let t=le(o.editor),n=t?.getNodes()||[];if(n.length===1&&E(n[0])&&n[0].isInline()&&wr(n[0])){n[0].setAlignment(e),ke(n[0]),o.manager.triggerFutureStateRefresh();return}let i=Rt(t).filter(a=>wr(a)),l=i.every(a=>a.getAlignment()===e)?"":e;for(let a of i)a.setAlignment(l);o.manager.triggerFutureStateRefresh()}function xp(o,e){let t=le(o.editor),n=Rt(t);for(let r of n)r.setDirection(e);o.manager.triggerFutureStateRefresh()}var Ep={label:"Align left",icon:fp,action(o){o.editor.update(()=>cs(o,"left"))},isActive(o){return Dr(o,"left")}},Tp={label:"Align center",icon:mp,action(o){o.editor.update(()=>cs(o,"center"))},isActive(o){return Dr(o,"center")}},_p={label:"Align right",icon:pp,action(o){o.editor.update(()=>cs(o,"right"))},isActive(o){return Dr(o,"right")}},Cp={label:"Justify",icon:gp,action(o){o.editor.update(()=>cs(o,"justify"))},isActive(o){return Dr(o,"justify")}},yp={label:"Left to right",icon:hp,action(o){o.editor.update(()=>xp(o,"ltr"))},isActive(o){return Wl(o,"ltr")}},bp={label:"Right to left",icon:Np,action(o){o.editor.update(()=>xp(o,"rtl"))},isActive(o){return Wl(o,"rtl")}};var Sp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm0-240q-33 0-56.5-23.5T120-720q0-33 23.5-56.5T200-800q33 0 56.5 23.5T280-720q0 33-23.5 56.5T200-640Z"/></svg>';var Lp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"/></svg>';var Mp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M222-200 80-342l56-56 85 85 170-170 56 57-225 226Zm0-320L80-662l56-56 85 85 170-170 56 57-225 226Zm298 240v-80h360v80H520Zm0-320v-80h360v80H520Z"/></svg>';var vp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"/></svg>';var wp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"/></svg>';function dE(o){let e=o.getParent();if(!U(e))return o;let t=o.getChildren().filter(c=>U(c))[0]||null,n=t?.getChildren()||[],r=e.getChildren(),i=r.findIndex(c=>c.getKey()===o.getKey()),s=i===0,l=$e(),a=_e(e.getListType());if(a.append(l),l.append(...o.getChildren()),s?o.append(a):(r[i-1].append(a),o.remove()),t){for(let c of n)l.insertAfter(c);t.remove()}return l}function uE(o){let e=o.getParent(),t=e?.getParent(),n=t?.getParent();if(!U(e)||!U(n)||!X(t))return o;let r=o.getNextSiblings();if(t.insertAfter(o),e.getChildren().length===0&&e.remove(),t.getChildren().length===0&&t.remove(),r.length>0){let i=_e(e.getListType());i.append(...r),o.append(i)}return e.getChildrenSize()===0&&e.remove(),o}function fE(o){let e=o?.getNodes()||[],t=[];e:for(let n of e){if(X(n)){t.push(n);continue}let r=n.getParents();for(let i of r)if(X(i)){t.push(i);continue e}t.push(null)}return t}function mE(o){let e={};for(let t of o){if(t===null)continue;let n=t.getKey();typeof e[n]>"u"&&(e[n]=t)}return Object.values(e)}function Yr(o,e){let t=T(),n=t?.getStartEndPoints(),r=fE(t);if(r.length>0&&!r.includes(null)){let l=[],a=mE(r);if(e>0)for(let c of a)l.push(dE(c));else if(e<0){for(let c of[...a].reverse())l.push(uE(c));l.reverse()}if(l.length===1&&n){let c=l[0],m=c.getChildren()[0];m||(m=Y(""),c.append(m)),m.select(n[0].offset,n[1].offset)}else Bu(l);return}let s=Rt(t);for(let l of s)if(Ou(l)){let a=l.getInset(),c=Math.min(Math.max(a+e,0),500);l.setInset(c)}Fu(o)}function Ma(o,e,t){return{label:o,icon:t,action(n){Wr(n.editor,e)},isActive(n){return ae(n,r=>U(r)&&r.getListType()===e)}}}var Dp=Ma("Bullet list","bullet",Sp),Op=Ma("Numbered list","number",Lp),Ap=Ma("Task list","check",Mp),Rp={label:"Increase indent",icon:vp,action(o){o.editor.update(()=>{Yr(o.editor,40)})},isActive(){return!1}},kp={label:"Decrease indent",icon:wp,action(o){o.editor.update(()=>{Yr(o.editor,-40)})},isActive(){return!1}};var Ip='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-160v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm560-40h-80q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480Z"/></svg>';var $p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m770-302-60-62q40-11 65-42.5t25-73.5q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 57-29.5 105T770-302ZM634-440l-80-80h86v80h-6ZM792-56 56-792l56-56 736 736-56 56ZM440-280H280q-83 0-141.5-58.5T80-480q0-69 42-123t108-71l74 74h-24q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h65l79 80H320Z"/></svg>';var Pp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h360v80H200v560h560v-360h80v360q0 33-23.5 56.5T760-120H200Zm480-480v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM240-280h480L570-480 450-320l-90-120-120 160Zm-40-480v560-560Z"/></svg>';var Bp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-440v-80h640v80H160Z"/></svg>';var Fp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m384-336 56-57-87-87 87-87-56-57-144 144 144 144Zm192 0 144-144-144-144-56 57 87 87-87 87 56 57ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>';var Hp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"/><path fill="none" d="M0 0h24v24H0z"/></svg>';var Kp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-60q-63 0-106.5-43.5T330-210q0-52 31-91.5t79-53.5v-85H200v-160H100v-280h280v280H280v80h400v-85q-48-14-79-53.5T570-750q0-63 43.5-106.5T720-900q63 0 106.5 43.5T870-750q0 52-31 91.5T760-605v165H520v85q48 14 79 53.5t31 91.5q0 63-43.5 106.5T480-60Zm240-620q29 0 49.5-20.5T790-750q0-29-20.5-49.5T720-820q-29 0-49.5 20.5T650-750q0 29 20.5 49.5T720-680Zm-540 0h120v-120H180v120Zm300 540q29 0 49.5-20.5T550-210q0-29-20.5-49.5T480-280q-29 0-49.5 20.5T410-210q0 29 20.5 49.5T480-140ZM240-740Zm480-10ZM480-210Z"/></svg>';var Up='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm80-280v-80h400v80H280Zm0 160v-80h240v80H280Z"/></svg>';var zp=`<svg viewbox="0 0 24 24"><path d="M8.12 19.3c.39.39 1.02.39 1.41 0L12 16.83l2.47 2.47c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41l-3.17-3.17c-.39-.39-1.02-.39-1.41 0l-3.17 3.17c-.4.38-.4 1.02-.01 1.41zm7.76-14.6c-.39-.39-1.02-.39-1.41 0L12 7.17 9.53 4.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.03 0 1.42l3.17 3.17c.39.39 1.02.39 1.41 0l3.17-3.17c.4-.39.4-1.03.01-1.42z"/></svg>
|
|
`;var Wp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m21.41 11.41-8.83-8.83c-.37-.37-.88-.58-1.41-.58H4c-1.1 0-2 .9-2 2v7.17c0 .53.21 1.04.59 1.41l8.83 8.83c.78.78 2.05.78 2.83 0l7.17-7.17c.78-.78.78-2.04-.01-2.83M6.5 8C5.67 8 5 7.33 5 6.5S5.67 5 6.5 5 8 5.67 8 6.5 7.33 8 6.5 8"/></svg>';var qp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m380-300 280-180-280-180v360ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>';var Vn=class extends Error{constructor(e,t){super(e.statusText),this.data=t,this.headers=e.headers,this.redirected=e.redirected,this.status=e.status,this.statusText=e.statusText,this.url=e.url,this.original=e}};function ds(o){return new Promise((e,t)=>{o.oncomplete=o.onsuccess=()=>e(o.result),o.onabort=o.onerror=()=>t(o.error)})}function SE(o,e){let t=indexedDB.open(o);t.onupgradeneeded=()=>t.result.createObjectStore(e);let n=ds(t);return(r,i)=>n.then(s=>i(s.transaction(e,r).objectStore(e)))}var va;function wa(){return va||(va=SE("keyval-store","keyval")),va}function Da(o,e=wa()){return e("readonly",t=>ds(t.get(o)))}function Oa(o,e,t=wa()){return t("readwrite",n=>(n.put(e,o),ds(n.transaction)))}function Aa(o,e=wa()){return e("readwrite",t=>(t.delete(o),ds(t.transaction)))}var Et=null,Ia,us,Ra,ka="last-drawing-save";function $a(o){Et?.contentWindow?.postMessage(JSON.stringify(o),Ia)}function ME(o){Oa(ka,o.data),Ra&&Ra(o.data).then(()=>{Aa(ka)})}function vE(o){$a({action:"export",format:"xmlpng",xml:o.xml,spin:"Updating drawing"})}function wE(){us&&us().then(o=>{$a({action:"load",autosave:1,xml:o})})}function DE(){let o={};Et&&(window.$events.emitPublic(Et,"editor-drawio::configure",{config:o}),$a({action:"configure",config:o}))}function Yp(){window.removeEventListener("message",Zp),Et&&document.body.removeChild(Et)}function Zp(o){if(!o.data||o.data.length<1||o.origin!==Ia)return;let e=JSON.parse(o.data);e.event==="init"?wE():e.event==="exit"?Yp():e.event==="save"?vE(e):e.event==="export"?ME(e):e.event==="configure"&&DE()}async function OE(){let o=await Da(ka),e=document.getElementById("unsaved-drawing-dialog");e||console.error("Missing expected unsaved-drawing dialog"),o&&e&&await window.$components.firstOnElement(e,"confirm-dialog").show()&&(us=async()=>o)}async function Vp(o,e,t){us=e,Ra=t,await OE(),Et=document.createElement("iframe"),Et.setAttribute("frameborder","0"),window.addEventListener("message",Zp),Et.setAttribute("src",o),Et.setAttribute("class","fullscreen"),Et.style.backgroundColor="#FFFFFF",document.body.appendChild(Et),Ia=new URL(o).origin}async function Xp(o,e){let t={image:o,uploaded_to:e};return(await window.$http.post(window.baseUrl("/images/drawio"),t)).data}function Pa(){Yp()}async function Gp(o){try{return`data:image/png;base64,${(await window.$http.get(window.baseUrl(`/images/drawio/base64/${o}`))).data.content}`}catch(e){throw e instanceof Vn&&window.$events.showResponseError(e),Pa(),e}}function Zr(o){return o instanceof yo}function RE(o,e){o.status===413?window.$events.emit("error",e.options.translations.serverUploadLimitText||""):window.$events.emit("error",e.options.translations.imageUploadErrorText||""),console.error(o)}async function kE(o,e){return await new Promise((n,r)=>{o.getEditorState().read(()=>{let{id:i}=e.getDrawingIdAndUrl();n(i)})})||""}async function IE(o,e,t,n){if(Pa(),n){let r=window.baseUrl("/loading.gif");o.editor.update(()=>{e.setDrawingIdAndUrl("",r)})}try{let r=await Xp(t,o.options.pageId);o.editor.update(()=>{e.setDrawingIdAndUrl(String(r.id),r.url)})}catch(r){throw r instanceof Vn&&RE(r,o),n&&o.editor.update(()=>{e.remove()}),new Error(`Failed to save image with error: ${r}`)}}function Vr(o,e){let t=!1;Vp(o.options.drawioUrl,async()=>{let n=await kE(o.editor,e);return t=!n,t?"":Gp(n)},async n=>IE(o,e,n,t))}function $E(o){window.$components.first("image-manager").show(t=>{o(t)},"drawio")}function jp(o){let e=le(o.editor);$E(t=>{o.editor.update(()=>{let n=Kn(t.id,t.url),r=V(e,Zr);Zr(r)?r.replace(n):Oe([n])})})}function fs(o){window.$components.first("image-manager").show(t=>{o(t)},"gallery")}function Jp(o){let e=o.thumbs?.display||o.url,t=gt(e,{target:"_blank"}),n=Pn(e,{alt:o.name});return t.append(n),t}async function Qp(o,e){if(o===null||o.type.indexOf("image")!==0)throw new Error("Not an image file");let t=o.name||`image-${Date.now()}.png`,n=new FormData;return n.append("file",o,t),n.append("uploaded_to",e),(await window.$http.post("/images/gallery",n)).data}var Xr=class extends ne{constructor(e,t){super([e,t]),this.input=e,this.action=t}buildDOM(){return y("div",{class:"editor-action-input-container"},[this.input.getDOMElement(),this.action.getDOMElement()])}};var eg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h200v80H200v560h560v-214l80 80v134q0 33-23.5 56.5T760-120H200Zm40-160 120-160 90 120 120-160 150 200H240Zm622-144L738-548q-21 14-45 21t-51 7q-74 0-126-52.5T464-700q0-75 52.5-127.5T644-880q75 0 127.5 52.5T824-700q0 27-8 52t-20 46l122 122-56 56ZM644-600q42 0 71-29t29-71q0-42-29-71t-71-29q-42 0-71 29t-29 71q0 42 29 71t71 29Z"/></svg>';var tg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"/><path fill="none" d="M0 0h24v24H0z"/></svg>';function ms(o,e){window.$components.first("entity-selector-popup").show(n=>o(n),{initialValue:e,searchEndpoint:"/search/entity-selector",entityTypes:"page,book,chapter,bookshelf",entityPermission:"view"})}var ps=class extends ne{constructor(t){super([t]);this.headerMap=new Map;this.input=t}buildDOM(){let t="editor-form-datalist-"+this.input.getName()+"-"+Date.now(),n=this.input.getDOMElement(),r=n.querySelector("input");r?.setAttribute("list",t),r?.setAttribute("autocomplete","off");let i=y("datalist",{id:t}),s=y("div",{class:"editor-link-field-container"},[n,i]);return r?.addEventListener("focusin",()=>{this.updateDataList(i)}),r?.addEventListener("input",()=>{let l=r.value,a=this.headerMap.get(l);a&&this.updateFormFromHeader(a)}),s}updateFormFromHeader(t){this.getHeaderIdAndText(t).then(({id:n,text:r})=>{console.log("updating form",n,r);let i=this.getContext().manager.getActiveModal("link");i&&i.getForm().setValues({url:`#${n}`,text:r,title:r})})}getHeaderIdAndText(t){return new Promise(n=>{this.getContext().editor.update(()=>{let r=t.getId();console.log("header",r,t.__id),r||(r="header-"+kf(),t.setId(r));let i=t.getTextContent();n({id:r,text:i})})})}updateDataList(t){this.getContext().editor.getEditorState().read(()=>{let n=Ul(qn);this.headerMap.clear();let r=[];for(let i of n){let s="header-"+i.getKey();this.headerMap.set(s,i),r.push(y("option",{value:s,label:i.getTextContent().substring(0,54)}))}t.innerHTML="",t.append(...r)})}};function og(o,e){let t=e.manager.createModal("image"),n=o.getHeight(),r=o.getWidth(),i={src:o.getSrc(),alt:o.getAltText(),height:n===0?"":String(n),width:r===0?"":String(r)};t.show(i)}var ng={submitText:"Apply",async action(o,e){return e.editor.update(()=>{let t=le(e.editor),n=V(t,ht);ht(n)&&(n.setSrc(o.get("src")?.toString()||""),n.setAltText(o.get("alt")?.toString()||""),n.setWidth(Number(o.get("width")?.toString()||"0")),n.setHeight(Number(o.get("height")?.toString()||"0")))}),!0},fields:[{build(){return new Xr(new bo({label:"Source",name:"src",type:"text"}),new v({label:"Browse files",icon:eg,action(o){fs(e=>{let t=o.manager.getActiveModal("image");t&&t.getForm().setValues({src:e.thumbs?.display||e.url,alt:e.name})})}}))}},{label:"Alternative description",name:"alt",type:"text"},{label:"Width",name:"width",type:"text"},{label:"Height",name:"height",type:"text"}]};function gs(o,e){let t=e.manager.createModal("link");if(o){let n={url:o.getURL(),text:o.getTextContent(),title:o.getTitle()||"",target:o.getTarget()||""};e.editor.update(()=>{let r=Fo();r.add(o.getKey()),q(r)}),t.show(n)}else e.editor.getEditorState().read(()=>{let i={text:T()?.getTextContent()||""};t.show(i)})}var rg={submitText:"Apply",async action(o,e){return ss(e.editor,{url:o.get("url")?.toString()||"",title:o.get("title")?.toString()||"",target:o.get("target")?.toString()||"",text:o.get("text")?.toString()||""}),!0},fields:[{build(){return new Xr(new ps(new bo({label:"URL",name:"url",type:"text"})),new v({label:"Browse links",icon:tg,action(o){ms(e=>{let t=o.manager.getActiveModal("link");t&&t.getForm().setValues({url:e.link,text:e.name,title:e.name})})}}))}},{label:"Text to display",name:"text",type:"text"},{label:"Title",name:"title",type:"text"},{label:"Open link in...",name:"target",type:"select",valuesByLabel:{"Current window":"","New window":"_blank"}}]},ig={submitText:"Save",async action(o,e){let t=await new Promise((r,i)=>{e.editor.getEditorState().read(()=>{let s=V(T(),eo);r(s)})}),n=(o.get("embed")||"").toString().trim();return n?(e.editor.update(()=>{let r=Ef(n);t&&r?t.replace(r):r&&Oe([r])}),!0):(e.editor.update(()=>{let r=(o.get("src")||"").toString().trim(),i=(o.get("height")||"").toString().trim(),s=(o.get("width")||"").toString().trim(),l=t||Tf(r);l.setSrc(r),l.setWidthAndHeight(s,i),t||Oe([l])}),!0)},fields:[{build(){return new tn([{label:"General",contents:[{label:"Source",name:"src",type:"text"},{label:"Width",name:"width",type:"text"},{label:"Height",name:"height",type:"text"}]},{label:"Embed",contents:[{label:"Paste your embed code below:",name:"embed",type:"textarea"}]}])}}]};function sg(o,e){let t=e.manager.createModal("details");o&&t.show({summary:o.getSummary()})}var lg={submitText:"Save",async action(o,e){return e.editor.update(()=>{let t=V(T(),Ie),n=(o.get("summary")||"").toString().trim();Ie(t)&&t.setSummary(n)}),!0},fields:[{label:"Toggle label",name:"summary",type:"text"}]};var Ba={label:"Insert/edit link",icon:Ip,action(o){o.editor.getEditorState().read(()=>{let e=V(T(),Ot);gs(e,o)})},isActive(o){return ae(o,Ot)}},ag={label:"Remove link",icon:$p,action(o){o.editor.update(()=>{let e=le(o.editor),t=V(e,Ot);if(t){let n=t.getChildren().reverse();for(let r of n)t.insertAfter(r);t.remove(),n[n.length-1].selectStart(),o.manager.triggerFutureStateRefresh()}})},isActive(o){return!1}},Fa={label:"Insert/Edit Image",icon:Pp,action(o){o.editor.getEditorState().read(()=>{let e=le(o.editor),t=V(e,ht);if(t){og(t,o);return}fs(n=>{o.editor.update(()=>{let r=Jp(n);Oe([r])})})})},isActive(o){return ae(o,ht)}},cg={label:"Insert horizontal line",icon:Bp,action(o){o.editor.update(()=>{qo(ua(),!1)})},isActive(o){return ae(o,gf)}},Ha={label:"Insert code block",icon:Fp,action(o){qr(o.editor)},isActive(o){return ae(o,Zi)}},dg=Object.assign({},Ha,{label:"Edit code block",icon:Hp}),ug={label:"Insert/edit drawing",icon:Kp,action(o){o.editor.getEditorState().read(()=>{let e=le(o.editor),t=V(e,Zr);t===null?o.editor.update(()=>{let n=Kn();qo(n,!0),Vr(o,n),n.selectStart()}):Vr(o,t)})},isActive(o){return ae(o,Zr)}},fg={label:"Drawing manager",action(o){jp(o)},isActive(){return!1}},mg={label:"Insert/edit Media",icon:qp,action(o){let e=o.manager.createModal("media");o.editor.getEditorState().read(()=>{let t=T(),n=V(t,eo),r={};if(n){let i=n.getAttributes();r={src:i.src||i.data||"",width:i.width,height:i.height,embed:""}}e.show(r)})},isActive(o){return ae(o,eo)}},pg={label:"Insert collapsible block",icon:Up,action(o){o.editor.update(()=>{let e=T(),t=ql(),r=(e?.getNodes()||[]).map(s=>s.getTopLevelElement()).filter(s=>s!==null),i=[...new Set(r)];i.length>0?i[0].insertAfter(t):F().append(t);for(let s of i)t.append(s)})},isActive(o){return ae(o,Ie)}},gg={label:"Edit label",icon:Wp,action(o){o.editor.getEditorState().read(()=>{let e=V(T(),Ie);Ie(e)&&sg(e,o)})},isActive(o){return!1}},hg={label:"Toggle open/closed",icon:zp,action(o){o.editor.update(()=>{let e=V(T(),Ie);Ie(e)&&(e.setOpen(!e.getOpen()),o.manager.triggerLayoutUpdate())})},isActive(o){return!1}},Ng={label:"Unwrap",icon:ts,action(o){o.editor.update(()=>{let e=V(T(),Ie);if(Ie(e)){let t=e.getChildren();for(let n of t)e.insertBefore(n);e.remove(),o.manager.triggerLayoutUpdate()}})},isActive(o){return!1}};var xg=`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m2 6.9159 10 10.168 10-10.168z" stroke-width="2.0168"/></svg>
|
|
`;var hs=class extends ne{constructor(e,t){super([e]),this.button=e,this.dropdownButton=new Me({button:{label:"Menu",icon:xg},showOnHover:!1,direction:"vertical",showAside:!1},t),this.addChildren(this.dropdownButton)}buildDOM(){return y("div",{class:"editor-button-with-menu-container"},[this.button.getDOMElement(),this.dropdownButton.getDOMElement()])}};var nn=class extends Le{buildDOM(){return y("div",{class:"editor-separator"})}};function Eg(o){let e=o.manager.getDefaultDirection()==="rtl";return new Gi("editor-toolbar-main",[new nt(2,[new v(Dm),new v(Om)]),new Ji([new Ye(y("h2"),Hm),new Ye(y("h3"),Km),new Ye(y("h4"),Um),new Ye(y("h5"),zm),new Ye(y("blockquote"),Wm),new Ye(y("p"),qm),new Me({button:{label:"Callouts",format:"long"},showOnHover:!0,direction:"vertical"},[new Ye(y("p",{class:"callout info"}),$m),new Ye(y("p",{class:"callout success"}),Fm),new Ye(y("p",{class:"callout warning"}),Bm),new Ye(y("p",{class:"callout danger"}),Pm)])]),new nt(6,[new v(op),new v(np),new v(rp),new Me({button:new Fr(ip,"color")},[new Br("color")]),new Me({button:new Fr(sp,"background-color")},[new Br("background-color")]),new v(lp),new v(ap),new v(cp),new v(dp),new v(up)]),new nt(6,[new v(Ep),new v(Tp),new v(_p),new v(Cp),e?new v(yp):null,e?new v(bp):null].filter(t=>t!==null)),new nt(3,[new v(Dp),new v(Op),new v(Ap),new v(kp),new v(Rp)]),new nt(4,[new v(Ba),new Me({button:im,direction:"vertical",showAside:!1},[new Me({button:{label:"Insert",format:"long"},showOnHover:!0,showAside:!0},[new es]),new nn,new Me({button:{label:"Cell",format:"long"},direction:"vertical",showOnHover:!0},[new v(xm),new v(Em),new v(Tm)]),new Me({button:{label:"Row",format:"long"},direction:"vertical",showOnHover:!0},[new v({..._a,format:"long"}),new v({...Ca,format:"long"}),new v({...ya,format:"long"}),new v(cm),new nn,new v(dm),new v(um),new v(fm),new v(mm)]),new Me({button:{label:"Column",format:"long"},direction:"vertical",showOnHover:!0},[new v({...ba,format:"long"}),new v({...Sa,format:"long"}),new v({...La,format:"long"}),new nn,new v(pm),new v(gm),new v(hm),new v(Nm)]),new nn,new v({...Ea,format:"long"}),new v(sm),new v(lm),new v(am)]),new v(Fa),new v(cg),new v(Ha),new hs(new v(ug),[new v(fg)]),new v(mg),new v(pg)]),new nt(3,[new v(Am),new v(km),new v(Rm)])])}function Tg(){return[new v(Fa)]}function _g(){return[new v(Ba),new v(ag)]}function Cg(){return[new v(dg)]}function yg(){return[new nt(2,[new v(Ea),new v(Ta)]),new nt(3,[new v(_a),new v(Ca),new v(ya)]),new nt(3,[new v(ba),new v(Sa),new v(La)])]}function bg(){return[new v(gg),new v(hg),new v(Ng)]}var Sg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>';var Ns=class extends ne{constructor(e,t){super([new os(e.form)]),this.definition=e,this.key=t}show(e){let t=this.getDOMElement();document.body.append(t);let n=this.getForm();n.setValues(e),n.setOnCancel(this.hide.bind(this)),n.setOnSuccessfulSubmit(this.hide.bind(this)),this.getContext().manager.setModalActive(this.key,this)}hide(){this.getDOMElement().remove(),this.getContext().manager.setModalInactive(this.key)}getForm(){return this.children[0]}buildDOM(){let e=y("button",{class:"editor-modal-close",type:"button",title:this.trans("Close")});e.innerHTML=Sg,e.addEventListener("click",this.hide.bind(this));let t=y("div",{class:"editor-modal editor-form-modal"},[y("div",{class:"editor-modal-header"},[y("div",{class:"editor-modal-title"},[this.trans(this.definition.title)]),e]),y("div",{class:"editor-modal-body"},[this.getForm().getDOMElement()])]),n=y("div",{class:"editor-modal-wrapper"},[t]);return n.addEventListener("click",r=>{r.target&&!t.contains(r.target)&&this.hide()}),n}};var xs=class extends ne{constructor(e,t){super(t),this.target=e}buildDOM(){return y("div",{class:"editor-context-toolbar"},this.getChildren().map(e=>e.getDOMElement()))}updatePosition(){let e=this.getContext().scrollDOM.getBoundingClientRect(),t=this.target.getBoundingClientRect(),n=this.getDOMElement(),r=n.getBoundingClientRect(),i=t.bottom>e.top&&t.top<e.bottom;if(n.hidden=!i,!i)return;let s=t.bottom+6+r.height>e.bottom;n.classList.toggle("is-above",s);let a=t.left+t.width/2-r.width/2;s?n.style.top=t.top-6-r.height+"px":n.style.top=t.bottom+6+"px",n.style.left=a+"px"}insert(e){this.addChildren(...e),this.getDOMElement().append(...e.map(n=>n.getDOMElement()))}empty(){let e=this.getChildren();for(let t of e)t.getDOMElement().remove();this.removeChildren(...e)}destroy(){this.empty(),this.getDOMElement().remove()}};var Es=class{constructor(){this.modalDefinitionsByKey={};this.activeModalsByKey={};this.decoratorConstructorsByType={};this.decoratorInstancesByNodeKey={};this.context=null;this.toolbar=null;this.contextToolbarDefinitionsByKey={};this.activeContextToolbars=[];this.selectionChangeHandlers=new Set}setContext(e){this.context=e,this.setupEventListeners(e),this.setupEditor(e.editor)}getContext(){if(this.context===null)throw new Error("Context attempted to be used without being set");return this.context}triggerStateUpdateForElement(e){e.updateState({selection:null,editor:this.getContext().editor})}registerModal(e,t){this.modalDefinitionsByKey[e]=t}createModal(e){let t=this.modalDefinitionsByKey[e];if(!t)throw new Error(`Attempted to show modal of key [${e}] but no modal registered for that key`);let n=new Ns(t,e);return n.setContext(this.getContext()),n}setModalActive(e,t){this.activeModalsByKey[e]=t}setModalInactive(e){delete this.activeModalsByKey[e]}getActiveModal(e){return this.activeModalsByKey[e]}registerDecoratorType(e,t){this.decoratorConstructorsByType[e]=t}getDecorator(e,t){if(this.decoratorInstancesByNodeKey[t])return this.decoratorInstancesByNodeKey[t];let n=this.decoratorConstructorsByType[e];if(!n)throw new Error(`Attempted to use decorator of type [${e}] but not decorator registered for that type`);let r=new n(t);return this.decoratorInstancesByNodeKey[t]=r,r}getDecoratorByNodeKey(e){return this.decoratorInstancesByNodeKey[e]||null}setToolbar(e){this.toolbar&&this.toolbar.getDOMElement().remove(),this.toolbar=e,e.setContext(this.getContext()),this.getContext().containerDOM.prepend(e.getDOMElement())}registerContextToolbar(e,t){this.contextToolbarDefinitionsByKey[e]=t}triggerStateUpdate(e){Ru(e.editor,e.selection),this.toolbar?.updateState(e),this.updateContextToolbars(e);for(let t of this.activeContextToolbars)t.updateState(e);this.triggerSelectionChange(e.selection)}triggerStateRefresh(){let e=this.getContext().editor,t={editor:e,selection:le(e)};this.triggerStateUpdate(t),this.updateContextToolbars(t)}triggerFutureStateRefresh(){requestAnimationFrame(()=>{this.getContext().editor.getEditorState().read(()=>{this.triggerStateRefresh()})})}triggerSelectionChange(e){if(e)for(let t of this.selectionChangeHandlers)t(e)}onSelectionChange(e){this.selectionChangeHandlers.add(e)}offSelectionChange(e){this.selectionChangeHandlers.delete(e)}triggerLayoutUpdate(){window.requestAnimationFrame(()=>{for(let e of this.activeContextToolbars)e.updatePosition()})}getDefaultDirection(){return this.getContext().options.textDirection==="rtl"?"rtl":"ltr"}updateContextToolbars(e){for(let s=this.activeContextToolbars.length-1;s>=0;s--)this.activeContextToolbars[s].destroy(),this.activeContextToolbars.splice(s,1);let t=(e.selection?.getNodes()||[])[0]||null;if(!t)return;let n=e.editor.getElementByKey(t.getKey());if(!n)return;let r=Object.keys(this.contextToolbarDefinitionsByKey),i=new Map;for(let s of r){let l=this.contextToolbarDefinitionsByKey[s],a=n.closest(l.selector)||n.querySelector(l.selector);if(a){let c=l.displayTargetLocator?l.displayTargetLocator(a):a;i.has(c)||i.set(c,[]),i.get(c).push(...l.content)}}for(let[s,l]of i){let a=new xs(s,l);a.setContext(this.getContext()),this.activeContextToolbars.push(a),this.getContext().containerDOM.append(a.getDOMElement()),a.updatePosition()}}setupEditor(e){let t=n=>{e.getEditorState().read(()=>{let r=Object.keys(n);for(let i of r){let s=e.getElementByKey(i);if(!s)continue;let l=n[i],a=this.getDecorator(l.type,i);a.setNode(l.getNode());let c=a.render(this.getContext(),s);c&&s.append(c)}})};e.registerDecoratorListener(t),e.registerUpdateListener(({editorState:n,prevEditorState:r})=>{!r._selection?.is(n._selection)&&e.update(()=>{let s=T();this.triggerStateUpdate({editor:e,selection:s})})})}setupEventListeners(e){let t=this.triggerLayoutUpdate.bind(this);window.addEventListener("scroll",t,{capture:!0,passive:!0}),window.addEventListener("resize",t,{passive:!0})}};var Xn=class{constructor(e){this.node=null;this.onDestroyCallbacks=[];this.context=e}getNode(){if(!this.node)throw new Error("Attempted to get use node without it being set");return this.node}setNode(e){this.node=e}onDestroy(e){this.onDestroyCallbacks.push(e)}destroy(e){for(let t of this.onDestroyCallbacks)t()}};var Ts=class extends Xn{constructor(){super(...arguments);this.completedSetup=!1;this.latestCode="";this.latestLanguage="";this.editor=null}setup(t,n){let r=this.getNode(),i=n.querySelector("pre");if(!i)return;i&&(i.hidden=!0),this.latestCode=r.__code,this.latestLanguage=r.__language;let l=this.latestCode.split(`
|
|
`).length*19.2+18+24;n.style.height=`${l}px`;let a=Date.now();n.addEventListener("click",f=>{requestAnimationFrame(()=>{t.editor.update(()=>{ke(this.getNode())})})}),n.addEventListener("dblclick",f=>{t.editor.getEditorState().read(()=>{Pr(t.editor,this.getNode())})});let c=f=>{n.classList.toggle("selected",Pi(f,r))};t.manager.onSelectionChange(c),this.onDestroy(()=>{t.manager.offSelectionChange(c)});let m=f=>{this.editor=f.wysiwygView(n,document,this.latestCode,this.latestLanguage),setTimeout(()=>{n.style.height=""},12)};window.importVersioned("code").then(f=>{let d=Date.now()-a<20?20:0;setTimeout(()=>m(f),d)}),this.completedSetup=!0}update(){let t=this.getNode(),n=t.getCode(),r=t.getLanguage();this.latestCode===n&&this.latestLanguage===r||(this.latestLanguage=r,this.latestCode=n,this.editor&&(this.editor.setContent(n),this.editor.setMode(r,n)))}render(t,n){this.completedSetup?this.update():this.setup(t,n)}};var _s=class extends Xn{constructor(){super(...arguments);this.completedSetup=!1}setup(t,n){let r=this.getNode();n.classList.add("editor-diagram"),n.addEventListener("click",s=>{t.editor.update(()=>{ke(this.getNode())})}),n.addEventListener("dblclick",s=>{t.editor.getEditorState().read(()=>{Vr(t,this.getNode())})});let i=s=>{n.classList.toggle("selected",Pi(s,r))};t.manager.onSelectionChange(i),this.onDestroy(()=>{t.manager.offSelectionChange(i)}),this.completedSetup=!0}update(){}render(t,n){this.completedSetup?this.update():this.setup(t,n)}};var Cs=class extends Le{constructor(t){super();this.url="";this.url=t}buildDOM(){let t=y("div",{class:"editor-external-content"});return window.$http.get(this.url).then(n=>{typeof n.data=="string"&&(t.innerHTML=n.data)}),t}};var Lg={submitText:"Save",async action(o,e){return Zn(e.editor,o.get("source")?.toString()||""),!0},fields:[{label:"Source",name:"source",type:"textarea"}]},Mg={submitText:"Close",async action(){return!0},fields:[{build(){return new Cs("/help/wysiwyg")}}]};var Ka={link:{title:"Insert/Edit Link",form:rg},image:{title:"Insert/Edit Image",form:ng},media:{title:"Insert/Edit Media",form:ig},source:{title:"Source code",form:Lg},cell_properties:{title:"Cell Properties",form:Pf},row_properties:{title:"Row Properties",form:Ff},table_properties:{title:"Table Properties",form:Kf},details:{title:"Edit collapsible block",form:lg},about:{title:"About the WYSIWYG Editor",form:Mg}};function vg(o,e,t,n,r){let i=new Es,s={editor:n,containerDOM:o,editorDOM:e,scrollDOM:t,manager:i,translate(l){return r.translations[l]||l},error(l){let a=l instanceof Error?l.message:l;window.$events.error(a)},options:r};i.setContext(s),i.setToolbar(Eg(s));for(let l of Object.keys(Ka))i.registerModal(l,Ka[l]);return i.registerContextToolbar("image",{selector:"img:not([drawio-diagram] img)",content:Tg()}),i.registerContextToolbar("link",{selector:"a",content:_g(),displayTargetLocator(l){return l.querySelector("img")||l}}),i.registerContextToolbar("code",{selector:".editor-code-block-wrap",content:Cg()}),i.registerContextToolbar("table",{selector:"td,th",content:yg(),displayTargetLocator(l){return l.closest("table")}}),i.registerContextToolbar("details",{selector:"details",content:bg()}),i.registerDecoratorType("code",Ts),i.registerDecoratorType("diagram",_s),s}var Gn=class{constructor(e,t,n){this.startX=0;this.startY=0;this.target=null;this.container=e,this.dragTargetSelector=t,this.options=n,this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.container.addEventListener("mousedown",this.onMouseDown)}teardown(){this.container.removeEventListener("mousedown",this.onMouseDown),this.container.removeEventListener("mouseup",this.onMouseUp),this.container.removeEventListener("mousemove",this.onMouseMove)}onMouseDown(e){this.target=e.target.closest(this.dragTargetSelector),this.target&&(this.startX=e.screenX,this.startY=e.screenY,window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),this.options.down&&this.options.down(e,this.target))}onMouseMove(e){this.options.move&&this.target&&this.options.move(e,this.target,{x:e.screenX-this.startX,y:e.screenY-this.startY})}onMouseUp(e){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),this.options.up&&this.target&&this.options.up(e,this.target,{x:e.screenX-this.startX,y:e.screenY-this.startY})}};var Ua=class{constructor(e,t){this.markerDom=null;this.mouseTracker=null;this.dragging=!1;this.targetCell=null;this.xMarkerAtStart=!1;this.yMarkerAtStart=!1;this.editor=e,this.editScrollContainer=t,this.setupListeners()}teardown(){this.editScrollContainer.removeEventListener("mousemove",this.onCellMouseMove),window.removeEventListener("scroll",this.onScrollOrResize,{capture:!0}),window.removeEventListener("resize",this.onScrollOrResize),this.mouseTracker&&this.mouseTracker.teardown()}setupListeners(){this.onCellMouseMove=this.onCellMouseMove.bind(this),this.onScrollOrResize=this.onScrollOrResize.bind(this),this.editScrollContainer.addEventListener("mousemove",this.onCellMouseMove),window.addEventListener("scroll",this.onScrollOrResize,{capture:!0,passive:!0}),window.addEventListener("resize",this.onScrollOrResize,{passive:!0})}onScrollOrResize(){this.updateCurrentMarkerTargetPosition()}onCellMouseMove(e){let t=e.target.closest("td,th");if(!t||this.dragging)return;let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2;this.targetCell=t,this.xMarkerAtStart=e.clientX<=r,this.yMarkerAtStart=e.clientY<=i;let s=this.xMarkerAtStart?n.left:n.right,l=this.yMarkerAtStart?n.top:n.bottom;this.updateMarkersTo(t,s,l)}updateMarkersTo(e,t,n){let r=this.getMarkers(),s=e.closest("table").getBoundingClientRect(),l=this.editScrollContainer.getBoundingClientRect(),a=Math.max(s.top,l.top),m=Math.min(s.bottom,l.bottom)-a;r.x.style.left=t+"px",r.x.style.top=a+"px",r.x.style.height=m+"px",r.y.style.top=n+"px",r.y.style.left=s.left+"px",r.y.style.width=s.width+"px",r.y.hidden=n<l.top||n>l.bottom,r.x.hidden=s.top>l.bottom||s.bottom<l.top}updateCurrentMarkerTargetPosition(){if(!this.targetCell)return;let e=this.targetCell.getBoundingClientRect(),t=this.xMarkerAtStart?e.left:e.right,n=this.yMarkerAtStart?e.top:e.bottom;this.updateMarkersTo(this.targetCell,t,n)}getMarkers(){if(!this.markerDom){this.markerDom={x:y("div",{class:"editor-table-marker editor-table-marker-column"}),y:y("div",{class:"editor-table-marker editor-table-marker-row"})};let e=y("div",{class:"editor-table-marker-wrap"},[this.markerDom.x,this.markerDom.y]);this.editScrollContainer.after(e),this.watchMarkerMouseDrags(e)}return this.markerDom}watchMarkerMouseDrags(e){let t=this,n=0,r="left";this.mouseTracker=new Gn(e,".editor-table-marker",{down(i,s){s.classList.add("active"),t.dragging=!0,r=s.classList.contains("editor-table-marker-column")?"left":"top",n=Number(s.style[r].replace("px",""))},move(i,s,l){s.style[r]=n+l[r==="left"?"x":"y"]+"px"},up(i,s,l){s.classList.remove("active"),s.style.left="0",s.style.top="0",t.dragging=!1;let a=t.targetCell?.closest("table");if(r==="left"&&t.targetCell&&a){let c=t.getTargetCellColumnIndex(),m=l.x;t.xMarkerAtStart&&c>0?c-=1:t.xMarkerAtStart&&c===0&&(m=-m),t.editor.update(()=>{let f=ee(a);if(f instanceof xt){let d=lf(t.editor,f,c),u=Math.max(d+m,10);ca(f,c,u)}})}if(r==="top"&&t.targetCell){let c=t.targetCell;t.editor.update(()=>{let f=ee(c)?.getParent(),d=f?.getIndexWithinParent()||0,u=l.y;t.yMarkerAtStart&&d>0?d-=1:t.yMarkerAtStart&&d===0&&(u=-u);let p=f?.getParent()?.getChildren()[d];if(p instanceof Jt){let g=p.getHeight()||0,h=Math.max(g+u,10);p.setHeight(h)}})}}})}getTargetCellColumnIndex(){let e=this.targetCell;if(e===null)return-1;let t=0,n=e.parentElement;for(let r of n?.children||[]){let i=Number(r.getAttribute("colspan"));if((Number.isNaN(i)||i<1)&&(i=1),t+=i,r===e)return t-1}return-1}};function wg(o,e){let t=new Ua(o,e);return()=>{t.teardown()}}function ys(o){return o.html||""}function Dg(o){window.$events.listen("editor::replace",t=>{let n=ys(t);Zn(o,n)}),window.$events.listen("editor::append",t=>{let n=ys(t);Lm(o,n)}),window.$events.listen("editor::prepend",t=>{let n=ys(t);Mm(o,n)}),window.$events.listen("editor::insert",t=>{let n=ys(t);vm(o,n)}),window.$events.listen("editor::focus",()=>{wm(o)});let e=!0;o.registerUpdateListener(({dirtyElements:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{(t.size>0||n.size>0)&&(e?e=!1:window.$events.emit("editor-html-change",""))})}var bs=class{constructor(e){this.data=e}hasItems(){return!!this.data&&!!this.data.types&&this.data.types.length>0}containsTabularData(){let e=this.data.getData("text/rtf");return!!e&&e.includes("\\trowd")}getImages(){return this.getFiles().filter(e=>e.type.includes("image"))}getFiles(){let{files:e}=this.data;return[...e]}};function KE(o,e){let t=o.clientX,n=o.clientY;return document.elementFromPoint(t,n)?Du(e,o.clientX,o.clientY):null}function Og(o,e,t){let n=KE(e,t);n&&ke(n),zl(o,!0),(!B(n)||!n?.getTextContent())&&n?.remove()}async function UE(o,e,t){let i=((await window.$http.get(`/templates/${e}`)).data||{html:""}).html||"";o.update(()=>{let s=_o(o,i);Og(s,t,o)})}function Ag(o,e){let t=new bs(o),n=!1;if(!t.hasItems()||t.containsTabularData())return n;let r=t.getImages();return r.length>0&&(n=!0),e.editor.update(async()=>{for(let i of r){let s=window.baseUrl("/loading.gif"),l=Pn(s),a=$();a.append(l),Oe([a]);try{let c=await Qp(i,e.options.pageId),m=c.name.replace(/"/g,"");e.editor.update(()=>{let f=Pn(c.thumbs?.display||"",{alt:m}),d=gt(c.url,{target:"_blank"});d.append(f),l.replace(d)})}catch(c){e.editor.update(()=>{l.remove(!1)}),window.$events.error(c?.data?.message||e.options.translations.imageUploadErrorText),console.error(c)}}}),n}function zE(o){let e=o.editor;return t=>{let n=t.dataTransfer?.getData("bookstack/template")||"";if(n)return UE(e,n,t),t.preventDefault(),t.stopPropagation(),!0;let r=t.dataTransfer?.getData("text/html")||"";return r?(e.update(()=>{let i=_o(e,r);Og(i,t,e)}),t.preventDefault(),t.stopPropagation(),!0):t.dataTransfer&&Ag(t.dataTransfer,o)?(t.preventDefault(),t.stopPropagation(),!0):!1}}function WE(o){return e=>{if(!e.clipboardData)return!1;let t=Ag(e.clipboardData,o);return t&&e.preventDefault(),t}}function Rg(o){let e=zE(o),t=WE(o),n=o.editor.registerCommand(Do,e,qe),r=o.editor.registerCommand(oo,t,qe);return o.scrollDOM.addEventListener("drop",e),()=>{n(),r(),o.scrollDOM.removeEventListener("drop",e)}}var za=class{constructor(e,t){this.editor=e,this.editorContainer=t,this.setupListeners()}setupListeners(){this.handleClick=this.handleClick.bind(this),this.editorContainer.addEventListener("click",this.handleClick)}handleClick(e){let t=e.target;t instanceof HTMLElement&&t.nodeName==="LI"&&t.classList.contains("task-list-item")&&(this.handleTaskListItemClick(t,e),e.preventDefault())}handleTaskListItemClick(e,t){let n=e.getBoundingClientRect();t.clientX<=n.right&&t.clientX>=n.left&&t.clientY>=n.top&&t.clientY<=n.bottom||this.editor.update(()=>{let i=ee(e);X(i)&&i.setChecked(!i.getChecked())})}teardown(){this.editorContainer.removeEventListener("click",this.handleClick)}};function kg(o,e){let t=new za(o,e);return()=>{t.teardown()}}var Wa=class{constructor(e){this.tableSelections=new Map;this.unregisterMutationListener=()=>{};this.editor=e,this.init()}init(){this.unregisterMutationListener=this.editor.registerMutationListener(xt,e=>{for(let[t,n]of e)if(n==="created")this.editor.getEditorState().read(()=>{let r=j(t);K(r)&&this.initializeTableNode(r)});else if(n==="destroyed"){let r=this.tableSelections.get(t);r!==void 0&&(r.removeListeners(),this.tableSelections.delete(t))}})}initializeTableNode(e){let t=e.getKey(),n=this.editor.getElementByKey(t);if(n&&!this.tableSelections.has(t)){let r=sa(e,n,this.editor,!1);this.tableSelections.set(t,r)}}teardown(){this.unregisterMutationListener();for(let[,e]of this.tableSelections)e.removeListeners()}};function Ig(o){let e=new Wa(o);return()=>{e.teardown()}}function Ss(o,e){return is(o,e),!0}function to(o){return e=>(o(e),!0)}function $g(o){return o.dispatchCommand(Ne,"code"),!0}var Pg={"meta+s":()=>(window.$events.emit("editor-save-draft"),!0),"meta+enter":()=>(window.$events.emit("editor-save-page"),!0),"meta+1":o=>Ss(o,"h1"),"meta+2":o=>Ss(o,"h2"),"meta+3":o=>Ss(o,"h3"),"meta+4":o=>Ss(o,"h4"),"meta+5":to(Ur),"meta+d":to(Ur),"meta+6":to(zr),"meta+q":to(zr),"meta+7":to(qr),"meta+e":to(qr),"meta+8":$g,"meta+shift+e":$g,"meta+9":to(Im),"meta+o":to(o=>Wr(o,"number")),"meta+p":to(o=>Wr(o,"bullet")),"meta+k":(o,e)=>(o.getEditorState().read(()=>{let t=V(T(),Ot);gs(t,e)}),!0),"meta+shift+k":(o,e)=>(ms(t=>{ss(o,{text:t.name,title:t.link,target:"",url:t.link})}),!0)};function qE(o){return e=>{let t=YE(e);Pg[t]&&Pg[t](o.editor,o)&&(e.stopPropagation(),e.preventDefault())}}function YE(o){return[(Bg()?o.metaKey:o.ctrlKey)?"meta":"",o.shiftKey?"shift":"",o.key].filter(Boolean).join("+").toLowerCase()}function Bg(){return window.navigator.userAgent.includes("Mac OS X")}function ZE(o){o.registerCommand(Fe,e=>Bg()?e?.metaKey||!1:e?.ctrlKey||!1,qe)}function Fg(o){let e=qE(o);return ZE(o.editor),o.editor.registerRootListener((t,n)=>{t?.addEventListener("keydown",e),n?.removeEventListener("keydown",e)})}function VE(o){return ht(o)||eo(o)}var qa=class{constructor(e){this.dom=null;this.mouseTracker=null;this.activeSelection="";this.context=e,this.scrollContainer=e.scrollDOM,this.onSelectionChange=this.onSelectionChange.bind(this),e.manager.onSelectionChange(this.onSelectionChange)}onSelectionChange(e){let t=e?.getNodes()||[];if(this.activeSelection&&this.hide(),t.length===1&&VE(t[0])){let n=t[0],r=n.getKey(),i=this.context.editor.getElementByKey(r);i&&i.nodeName==="SPAN"&&(i=i.firstElementChild),i&&this.showForNode(n,i)}}teardown(){this.context.manager.offSelectionChange(this.onSelectionChange),this.hide()}showForNode(e,t){this.dom=this.buildDOM();let n=y("span",{class:"editor-node-resizer-ghost"});ht(e)&&(n=y("img",{src:t.getAttribute("src"),class:"editor-node-resizer-ghost"})),this.dom.append(n),this.context.scrollDOM.append(this.dom),this.updateDOMPosition(t),this.mouseTracker=this.setupTracker(this.dom,e,t),this.activeSelection=e.getKey()}updateDOMPosition(e){if(!this.dom)return;let t=this.scrollContainer.getBoundingClientRect(),n=e.getBoundingClientRect(),r=n.top-(t.top-this.scrollContainer.scrollTop),i=n.left-t.left;this.dom.style.top=`${r}px`,this.dom.style.left=`${i}px`,this.dom.style.width=n.width+"px",this.dom.style.height=n.height+"px"}updateDOMSize(e,t){this.dom&&(this.dom.style.width=e+"px",this.dom.style.height=t+"px")}hide(){this.mouseTracker?.teardown(),this.dom?.remove(),this.activeSelection=""}buildDOM(){let t=["nw","ne","se","sw"].map(n=>y("div",{class:`editor-node-resizer-handle ${n}`}));return y("div",{class:"editor-node-resizer"},t)}setupTracker(e,t,n){let r=0,i=0,s=0,l=!1,a=this,c=!1,m=!1,f=d=>{let u=d.x;c&&(u=0-u);let p=d.y;m&&(p=0-p);let g=Math.sqrt(Math.pow(Math.abs(u),2)+Math.pow(Math.abs(p),2)),_=u+p>0?g:0-g,N=Math.max(5,Math.round(r+_)),L=Math.round(N*s);return{width:N,height:L}};return new Gn(e,".editor-node-resizer-handle",{down(d,u){a.dom?.classList.add("active"),a.context.editor.getEditorState().read(()=>{let p=n.getBoundingClientRect();r=t.getWidth()||p.width,i=t.getHeight()||p.height,t.getHeight()&&(l=!0),s=i/r}),c=u.classList.contains("nw")||u.classList.contains("sw"),m=u.classList.contains("nw")||u.classList.contains("ne")},move(d,u,p){let g=f(p);a.updateDOMSize(g.width,g.height)},up(d,u,p){let g=f(p);a.context.editor.update(()=>{t.setWidth(g.width),t.setHeight(l?g.height:0),a.context.manager.triggerLayoutUpdate(),requestAnimationFrame(()=>{a.updateDOMPosition(n)})}),a.dom?.classList.remove("active")}})}};function Hg(o){let e=new qa(o);return()=>{e.teardown()}}function Ug(o){if(o.length===1){let e=o[0];if(B(e)||ht(e)||eo(e))return!0}return!1}function Kg(o){let e=le(o)?.getNodes()||[];Ug(e)&&o.update(()=>{e[0].remove()})}function XE(o,e){let t=le(o)?.getNodes()||[];if(Ug(t)){let n=t[0],r=In(n)||n;if(r)return requestAnimationFrame(()=>{o.update(()=>{let i=$();r.insertAfter(i),i.select()})}),e?.preventDefault(),!0}return!1}function GE(o,e){let t=zg(o);return t===null||t.detailsSibling?!1:(o.update(()=>{let n=$();t.parentDetails.insertAfter(n),n.select()}),e?.preventDefault(),!0)}function jE(o,e){let t=zg(o);if(t===null||t.parentBlock.getTextContent()!=="")return!1;e?.preventDefault();let n=t.parentDetails.getNextSibling();return o.update(()=>{if(n)n.selectStart();else{let r=$();t.parentDetails.insertAfter(r),r.select()}t.parentBlock.remove()}),!0}function zg(o){let t=le(o)?.getNodes()[0];if(!t)return null;let n=In(t),r=At(t,Ie);if(!Ie(r)||n===null||n.getKey()!==r.getLastChild()?.getKey())return null;let i=r.getNextSibling();return{parentDetails:r,parentBlock:n,detailsSibling:i}}function JE(o){if(o.length!==1)return!1;let e=o[0];return X(e)||X(e.getParent())}function QE(o,e){let t=e?.shiftKey?-40:40,r=T()?.getNodes()||[];return r.length>1||JE(r)?(o.update(()=>{Yr(o,t)}),e?.preventDefault(),!0):!1}function Wg(o){let e=o.editor.registerCommand(Bt,()=>(Kg(o.editor),!1),Dt),t=o.editor.registerCommand(Ft,()=>(Kg(o.editor),!1),Dt),n=o.editor.registerCommand(Fe,s=>XE(o.editor,s)||jE(o.editor,s),Dt),r=o.editor.registerCommand(wo,s=>QE(o.editor,s),Dt),i=o.editor.registerCommand(Pt,s=>GE(o.editor,s),Dt);return()=>{e(),t(),n(),r(),i()}}function eT(o){return o.toLowerCase().startsWith("http")?/(http|https):\/\/(\S+)\.\S+$/.test(o):!1}function tT(o,e,t){let n=e.getStartEndPoints();if(!n)return;let r=n[0].offset,i=o.getTextContent(),a=i.slice(0,r).lastIndexOf(" ")+1,c=i.slice(a,r);eT(c)&&t.update(()=>{let m=gt(c);m.append(new Je(c));let f=o.splitText(a,r),d=f.length===3?1:0,u=f[d];u&&u.replace(m)})}function qg(o){let e=r=>{let i=T(),s=ku(i);return s&&i&&tT(s,i,o),!1},t=o.registerCommand(Qn,e,bi),n=o.registerCommand(Fe,e,bi);return()=>{t(),n()}}function Z$(o,e,t={}){let n={namespace:"BookStackPageEditor",nodes:_f(),onError:console.error,theme:{text:{bold:"editor-theme-bold",code:"editor-theme-code",italic:"editor-theme-italic",strikethrough:"editor-theme-strikethrough",subscript:"editor-theme-subscript",superscript:"editor-theme-superscript",underline:"editor-theme-underline",underlineStrikethrough:"editor-theme-underline-strikethrough"}}},r=y("div",{contenteditable:"true",class:"editor-content-area page-content"}),i=y("div",{class:"editor-content-wrap"},[r]);o.append(i),o.classList.add("editor-container"),o.setAttribute("dir",t.textDirection),t.darkMode&&o.classList.add("editor-dark");let s=Al(n);s.setRootElement(r);let l=vg(o,r,i,s,t);Xt(wu(s),pu(s,gu(),300),Fg(l),Wg(l),wg(s,i),Ig(s),kg(s,r),Rg(l),Hg(l),qg(s)),Dg(s),Zn(s,e);let a=document.getElementById("lexical-debug");return a&&(a.hidden=!0,s.registerUpdateListener(({dirtyElements:c,dirtyLeaves:m,editorState:f,prevEditorState:d})=>{a.textContent=JSON.stringify(f.toJSON(),null,2)})),window.debugEditorState=()=>{console.log(s.getEditorState().toJSON())},Cf(l),new Ya(s)}var Ya=class{constructor(e){this.editor=e}async getContentAsHtml(){return await rs(this.editor)}};export{Ya as SimpleWysiwygEditorInterface,Z$ as createPageEditorInstance};
|
|
//# sourceMappingURL=wysiwyg.js.map
|