lexical 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.prod.js CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,o=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&o&&!u;function h(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const g=1,_=3,p=9,y=11,m=0,x=1,C=2,S=0,N=1,T=2,v=4,k=8,E=128,b=1792|(112|(3|v|k)|E),O=1,M=2,A=3,w=4,D=5,P=6,I=l||c||d?" ":"​",L="\n\n",F=i?" ":I,R={bold:1,capitalize:1024,code:16,highlight:E,italic:2,lowercase:256,strikethrough:v,subscript:32,superscript:64,underline:k,uppercase:512},K={directionless:1,unmergeable:2},B={center:M,end:P,justify:w,left:O,right:A,start:D},z={[M]:"center",[P]:"end",[w]:"justify",[O]:"left",[A]:"right",[D]:"start"},$={normal:0,segmented:2,token:1},W={[S]:"normal",[T]:"segmented",[N]:"token"},U="$config";function J(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Zr(s)&&J(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}const Y=100;let j=!1,H=0;function V(t){H=t.timeStamp}function G(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==jo(t,n)}function q(t,e,n){const r=Ri(Oi(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&ii(e,s,o,i,!1)}function X(t,e,n){if(tr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return Lo(e)&&n.isAttached()}function Q(t,e,n,r){for(let o=t;o&&!Xi(o);o=Ni(o)){const t=jo(o,e);if(void 0!==t){const e=Jo(t,n);if(e)return no(e)||!Bi(o)?void 0:[o,e]}else if(o===r)return[r,Xo(n)]}}function Z(t,e,n){j=!0;const r=performance.now()-H>Y;try{Gr(t,(()=>{const o=pr()||function(t){return t.getEditorState().read((()=>{const t=pr();return null!==t?t.clone():null}))}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=Q(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Jn(y)&&Lo(g)&&X(o,g,y)&&q(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],o=Yo(r),s=r.parentNode;if(null!=s&&r!==a&&null===o&&!G(r,s,t)){if(i){const t=(Bi(r)?r.innerText:null)||r.nodeValue;t&&(f+=t)}s.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let o=0;o<r;o++){const r=n[o];(G(r,g,t)||a===r)&&(g.appendChild(r),e++)}r!==e&&s.set(p,y)}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,o=n.target;for(let e=0;e<r.length;e++){const n=r[e],i=n.parentNode;null==i||"BR"!==n.nodeName||G(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(u&&Qo(o),i&&mi(t)&&o.insertRawText(f))}))}finally{j=!1}}function tt(t){const e=t._observer;if(null!==e){Z(t,e.takeRecords(),e)}}function et(t){!function(t){0===H&&Oi(t).addEventListener("textInput",V,!0)}(t),t._observer=new MutationObserver(((e,n)=>{Z(t,e,n)}))}class nt{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||at).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0)}}function rt(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function ot(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Zi(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t)}}return{flatKeys:n,sharedConfigMap:e}}class it{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,o=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:i}=this.sharedNodeState,s=void 0!==o?o:function(t,e,n){let r=n.size;if(e)for(const o in e){const e=t.get(o);e&&n.has(e)||r++}return r}(i,n,r);this.size=s}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return ct(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new it(t,e,function(t,e,n){let r;if(n)for(const[o,i]of Object.entries(n)){const n=t.get(o);n?e.has(n)||e.set(n,n.parse(i)):(r=r||{},r[o]=i)}return r}(e.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:o}=this;r.has(t)||o&&n in o||(o&&(delete o[n],this.unknownState=ct(o)),this.size++),r.set(t,e)}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n)}}function st(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new it(e,lt(e));return e.__state=n,n}function lt(t){return t.__state?t.__state.sharedNodeState:vo(Yi(),t.getType()).sharedNodeState}function ct(t){if(t)for(const e in t)return t}function at(t){return t}function ut(t,e,n){for(const[r,o]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==o&&!r.isEqual(e,o))return!0}return!1}function ft(t,e,n){const{unknownState:r}=e,o=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(o?o[e]:void 0))return!0}return!1}function dt(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function ht(t,e){const n=t.__mode,r=t.__format,o=t.__style,i=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return(null===n||n===i)&&(null===r||r===s)&&(null===o||o===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return!0;if(t&&e&&t.size!==e.size)return!1;const n=new Set;return!(t&&ut(n,t,e)||e&&ut(n,e,t)||t&&ft(n,t,e)||e&&ft(n,e,t))}(c,a))}function gt(t,e){const n=t.mergeWithSibling(e),r=Rr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function _t(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Jn(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(ht(e,r)){r=gt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Jn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(ht(r,n)){r=gt(r,n);break}break}n.remove()}}else r.remove()}function pt(t){return yt(t.anchor),yt(t.focus),t}function yt(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,o;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),o=!0):(r=e.getChildAtIndex(n),o=!1),Jn(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!Zr(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}let mt,xt,Ct,St,Nt,Tt,vt,kt,Et,bt,Ot="",Mt=null,At="",wt="",Dt=!1,Pt=!1;function It(t,e){const n=vt.get(t);if(null!==e){const n=Xt(t);n.parentNode===e&&e.removeChild(n)}if(kt.has(t)||xt._keyToDOMMap.delete(t),Zr(n)){const t=jt(n,vt);Lt(t,0,t.length-1,null)}void 0!==n&&_i(bt,Ct,St,n,"destroyed")}function Lt(t,e,n,r){let o=e;for(;o<=n;++o){const e=t[o];void 0!==e&&It(e,r)}}function Ft(t,e){t.setProperty("text-align",e)}const Rt="40px";function Kt(t,e){const n=mt.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||Rt;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`)}function Bt(t,e){const n=t.style;0===e?Ft(n,""):e===O?Ft(n,"left"):e===M?Ft(n,"center"):e===A?Ft(n,"right"):e===w?Ft(n,"justify"):e===D?Ft(n,"start"):e===P&&Ft(n,"end")}function zt(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(oo(t))return null;const n=t.getParentOrThrow();return oo(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function $t(e,n){const r=kt.get(e);void 0===r&&t(60);const o=r.createDOM(mt,xt);if(function(t,e,n){const r=n._keyToDOMMap;(function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n})(e,n,t),r.set(t,e)}(e,o,xt),Jn(r)?o.setAttribute("data-lexical-text","true"):no(r)&&o.setAttribute("data-lexical-decorator","true"),Zr(r)){const t=r.__indent,e=r.__size;if(zt(o,r),0!==t&&Kt(o,t),0!==e){const t=e-1;Wt(jt(r,kt),r,0,t,r.getDOMSlot(o))}const n=r.__format;0!==n&&Bt(o,n),r.isInline()||Jt(null,r,o),Ci(r)&&(Ot+=L,wt+=L)}else{const t=r.getTextContent();if(no(r)){const t=r.decorate(xt,mt);null!==t&&Vt(e,t),o.contentEditable="false"}Ot+=t,wt+=t}return null!==n&&n.insertChild(o),_i(bt,Ct,St,r,"created"),o}function Wt(t,e,n,r,o){const i=Ot;Ot="";let s=n;for(;s<=r;++s){$t(t[s],o);const e=kt.get(t[s]);null!==e&&Jn(e)&&(null===Mt&&(Mt=e.getFormat()),""===At&&(At=e.getStyle()))}Ci(e)&&(Ot+=L);o.element.__lexicalTextContent=Ot,Ot=i+Ot}function Ut(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return En(t)?"line-break":no(t)&&t.isInline()?"decorator":null}return"empty"}return null}function Jt(t,e,n){const r=Ut(t,vt),o=Ut(e,kt);r!==o&&e.getDOMSlot(n).setManagedLineBreak(o)}function Yt(e,n,r){var o;Mt=null,At="",function(e,n,r){const o=Ot,i=e.__size,s=n.__size;Ot="";const l=r.element;if(1===i&&1===s){const t=e.__first,r=n.__first;if(t===r)Ht(t,l);else{const e=Xt(t),n=$t(r,null);try{l.replaceChild(n,e)}catch(o){if("object"==typeof o&&null!=o){const i=`${o.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(i)}throw o}It(t,null)}const o=kt.get(r);Jn(o)&&(null===Mt&&(Mt=o.getFormat()),""===At&&(At=o.getStyle()))}else{const o=jt(e,vt),c=jt(n,kt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&Wt(c,n,0,s-1,r);else if(0===s){if(0!==i){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Lt(o,0,i-1,t?null:l),t&&(l.textContent="")}}else!function(t,e,n,r,o,i){const s=r-1,l=o-1;let c,a,u=i.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=Gt(Ht(r,i.element)),f++,d++;else{void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const o=a.has(t),s=c.has(r);if(o)if(s){const t=Si(xt,r);t===u?u=Gt(Ht(r,i.element)):(i.withBefore(u).insertChild(t),Ht(r,i.element)),f++,d++}else $t(r,i.withBefore(u)),d++;else u=Gt(Xt(t)),It(t,i.element),f++}const o=kt.get(r);null!==o&&Jn(o)&&(null===Mt&&(Mt=o.getFormat()),""===At&&(At=o.getStyle()))}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:xt.getElementByKey(e);Wt(n,t,d,l,i.withBefore(r))}else g&&!h&&Lt(e,f,s,i.element)}(n,o,c,i,s,r)}Ci(n)&&(Ot+=L);l.__lexicalTextContent=Ot,Ot=o+Ot}(e,n,n.getDOMSlot(r)),o=n,null==Mt||Mt===o.__textFormat||Pt||o.setTextFormat(Mt),function(t){""===At||At===t.__textStyle||Pt||t.setTextStyle(At)}(n)}function jt(e,n){const r=[];let o=e.__first;for(;null!==o;){const e=n.get(o);void 0===e&&t(101),r.push(o),o=e.__next}return r}function Ht(e,n){const r=vt.get(e);let o=kt.get(e);void 0!==r&&void 0!==o||t(61);const i=Dt||Tt.has(e)||Nt.has(e),s=Si(xt,e);if(r===o&&!i){if(Zr(r)){const t=s.__lexicalTextContent;void 0!==t&&(Ot+=t,wt+=t)}else{const t=r.getTextContent();wt+=t,Ot+=t}return s}if(r!==o&&i&&_i(bt,Ct,St,o,"updated"),o.updateDOM(r,s,mt)){const r=$t(e,null);return null===n&&t(62),n.replaceChild(r,s),It(e,null),r}if(Zr(r)&&Zr(o)){const t=o.__indent;(Dt||t!==r.__indent)&&Kt(s,t);const e=o.__format;if((Dt||e!==r.__format)&&Bt(s,e),i&&(Yt(r,o,s),oo(o)||o.isInline()||Jt(r,o,s)),Ci(o)&&(Ot+=L,wt+=L),(Dt||o.__dir!==r.__dir)&&(zt(s,o),oo(o)&&!Dt))for(const t of o.getChildren())if(Zr(t)){zt(Si(xt,t.getKey()),t)}}else{const t=o.getTextContent();if(no(o)){const t=o.decorate(xt,mt);null!==t&&Vt(e,t)}Ot+=t,wt+=t}if(!Pt&&oo(o)&&o.__cachedText!==wt){const t=o.getWritable();t.__cachedText=wt,o=t}return s}function Vt(t,e){let n=xt._pendingDecorators;const r=xt._decorators;if(null===n){if(r[t]===e)return;n=Vo(xt)}n[t]=e}function Gt(t){let e=t.nextSibling;return null!==e&&e===xt._blockCursorElement&&(e=e.nextSibling),e}function qt(t,e,n,r,o,i){Ot="",wt="",Dt=r===C,xt=n,mt=n._config,Ct=n._nodes,St=xt._listeners.mutation,Nt=o,Tt=i,vt=t._nodeMap,kt=e._nodeMap,Pt=e._readOnly,Et=new Map(n._keyToDOMMap);const s=new Map;return bt=s,Ht("root",null),xt=void 0,Ct=void 0,Nt=void 0,Tt=void 0,vt=void 0,kt=void 0,mt=void 0,Et=void 0,bt=void 0,s}function Xt(e){const n=Et.get(e);return void 0===n&&t(75,e),n}function Qt(t){return{type:t}}const Zt=Qt("SELECTION_CHANGE_COMMAND"),te=Qt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ee=Qt("CLICK_COMMAND"),ne=Qt("DELETE_CHARACTER_COMMAND"),re=Qt("INSERT_LINE_BREAK_COMMAND"),oe=Qt("INSERT_PARAGRAPH_COMMAND"),ie=Qt("CONTROLLED_TEXT_INSERTION_COMMAND"),se=Qt("PASTE_COMMAND"),le=Qt("REMOVE_TEXT_COMMAND"),ce=Qt("DELETE_WORD_COMMAND"),ae=Qt("DELETE_LINE_COMMAND"),ue=Qt("FORMAT_TEXT_COMMAND"),fe=Qt("UNDO_COMMAND"),de=Qt("REDO_COMMAND"),he=Qt("KEYDOWN_COMMAND"),ge=Qt("KEY_ARROW_RIGHT_COMMAND"),_e=Qt("MOVE_TO_END"),pe=Qt("KEY_ARROW_LEFT_COMMAND"),ye=Qt("MOVE_TO_START"),me=Qt("KEY_ARROW_UP_COMMAND"),xe=Qt("KEY_ARROW_DOWN_COMMAND"),Ce=Qt("KEY_ENTER_COMMAND"),Se=Qt("KEY_SPACE_COMMAND"),Ne=Qt("KEY_BACKSPACE_COMMAND"),Te=Qt("KEY_ESCAPE_COMMAND"),ve=Qt("KEY_DELETE_COMMAND"),ke=Qt("KEY_TAB_COMMAND"),Ee=Qt("INSERT_TAB_COMMAND"),be=Qt("INDENT_CONTENT_COMMAND"),Oe=Qt("OUTDENT_CONTENT_COMMAND"),Me=Qt("DROP_COMMAND"),Ae=Qt("FORMAT_ELEMENT_COMMAND"),we=Qt("DRAGSTART_COMMAND"),De=Qt("DRAGOVER_COMMAND"),Pe=Qt("DRAGEND_COMMAND"),Ie=Qt("COPY_COMMAND"),Le=Qt("CUT_COMMAND"),Fe=Qt("SELECT_ALL_COMMAND"),Re=Qt("CLEAR_EDITOR_COMMAND"),Ke=Qt("CLEAR_HISTORY_COMMAND"),Be=Qt("CAN_REDO_COMMAND"),ze=Qt("CAN_UNDO_COMMAND"),$e=Qt("FOCUS_COMMAND"),We=Qt("BLUR_COMMAND"),Ue=Qt("KEY_MODIFIER_COMMAND"),Je=Object.freeze({}),Ye=30,je=[["keydown",function(t,e){if(He=t.timeStamp,Ve=t.key,e.isComposing())return;if(xi(e,he,t))return;if(null==t.key)return;if(nn&&di(t))return Gr(e,(()=>{hn(e,rn)})),nn=!1,void(rn="");if(function(t){return ai(t,"ArrowRight",{shiftKey:"any"})}(t))xi(e,ge,t);else if(function(t){return ai(t,"ArrowRight",ui)}(t))xi(e,_e,t);else if(function(t){return ai(t,"ArrowLeft",{shiftKey:"any"})}(t))xi(e,pe,t);else if(function(t){return ai(t,"ArrowLeft",ui)}(t))xi(e,ye,t);else if(function(t){return ai(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))xi(e,me,t);else if(function(t){return ai(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))xi(e,xe,t);else if(function(t){return ai(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))tn=!0,xi(e,Ce,t);else if(function(t){return" "===t.key}(t))xi(e,Se,t);else if(function(t){return o&&ai(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),tn=!0,xi(e,re,!0);else if(function(t){return ai(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))tn=!1,xi(e,Ce,t);else if(function(t){return ai(t,"Backspace",{shiftKey:"any"})||o&&ai(t,"h",{ctrlKey:!0})}(t))di(t)?xi(e,Ne,t):(t.preventDefault(),xi(e,ne,!0));else if(function(t){return"Escape"===t.key}(t))xi(e,Te,t);else if(function(t){return ai(t,"Delete",{})||o&&ai(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),xi(e,ne,!1)):xi(e,ve,t);else if(function(t){return ai(t,"Backspace",fi)}(t))t.preventDefault(),xi(e,ce,!0);else if(function(t){return ai(t,"Delete",fi)}(t))t.preventDefault(),xi(e,ce,!1);else if(function(t){return o&&ai(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),xi(e,ae,!0);else if(function(t){return o&&(ai(t,"Delete",{metaKey:!0})||ai(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),xi(e,ae,!1);else if(function(t){return ai(t,"b",ui)}(t))t.preventDefault(),xi(e,ue,"bold");else if(function(t){return ai(t,"u",ui)}(t))t.preventDefault(),xi(e,ue,"underline");else if(function(t){return ai(t,"i",ui)}(t))t.preventDefault(),xi(e,ue,"italic");else if(function(t){return ai(t,"Tab",{shiftKey:"any"})}(t))xi(e,ke,t);else if(function(t){return ai(t,"z",ui)}(t))t.preventDefault(),xi(e,fe,void 0);else if(function(t){if(o)return ai(t,"z",{metaKey:!0,shiftKey:!0});return ai(t,"y",{ctrlKey:!0})||ai(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),xi(e,de,void 0);else{const n=e._editorState._selection;null===n||tr(n)?hi(t)&&(t.preventDefault(),xi(e,Fe,t)):!function(t){return ai(t,"c",ui)}(t)?!function(t){return ai(t,"x",ui)}(t)?hi(t)&&(t.preventDefault(),xi(e,Fe,t)):(t.preventDefault(),xi(e,Le,t)):(t.preventDefault(),xi(e,Ie,t))}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&xi(e,Ue,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;zi(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Gr(e,(()=>{bo(n)||(Ze=!0)}))}],["compositionstart",function(t,e){Gr(e,(()=>{const n=pr();if(tr(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Wo(r.key),(t.timeStamp<He+Ye||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||Jn(o)&&o.getStyle()!==n.style)&&xi(e,ie,F)}}))}],["compositionend",function(t,e){i?en=!0:c||!l&&!d?Gr(e,(()=>{hn(e,t.data)})):(nn=!0,rn=t.data)}],["input",function(t,e){t.stopPropagation(),Gr(e,(()=>{if(Bi(t.target)&&bo(t.target))return;const n=pr(),r=t.data,o=dn(t);if(null!=r&&tr(n)&&ln(n,o,r,t.timeStamp,!1)){en&&(hn(e,r),en=!1);const o=n.anchor.getNode(),a=Ri(Oi(e));if(null===a)return;const u=n.isBackward(),f=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Jn(o)&&null!==a.anchorNode&&o.getTextContent().slice(0,f)+r+o.getTextContent().slice(f+h)===ri(a.anchorNode)||xi(e,ie,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(He=0,Wo(null))}else{oi(!1,e,null!==r?r:void 0),en&&(hn(e,r||void 0),en=!1)}!function(){Ir();const t=Rr();tt(t)}()}),{event:t}),qe=null}],["click",function(t,e){Gr(e,(()=>{const n=pr(),r=Ri(Oi(e)),o=yr();if(r)if(tr(n)){const e=n.anchor,i=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!oo(i)&&1===qo().getChildrenSize()&&i.getTopLevelElementOrThrow().isEmpty()&&null!==o&&n.is(o))r.removeAllRanges(),n.dirty=!0;else if(3===t.detail&&!n.isCollapsed()){if(i!==n.focus.getNode()){const t=ts(i,(t=>Zr(t)&&!t.isInline()));Zr(t)&&t.select(0)}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Bi(n)||Lo(n)){Qo(_r(o,r,e,t))}}xi(e,ee,t)}))}],["cut",Je],["copy",Je],["dragstart",Je],["dragover",Je],["dragend",Je],["paste",Je],["focus",Je],["blur",Je],["drop",Je]];s&&je.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,o=dn(e);if("deleteCompositionText"===r||i&&mi(n))return;if("insertCompositionText"===r)return;Gr(n,(()=>{const i=pr();if("deleteContentBackward"===r){if(null===i){const t=yr();if(!tr(t))return;Qo(t.clone())}if(tr(i)){const r=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===Ve&&s<He+Ye&&n.isComposing()&&r){if(Wo(null),He=0,setTimeout((()=>{Gr(n,(()=>{Wo(null)}))}),Ye),tr(i)){const e=i.anchor.getNode();e.markDirty(),Jn(e)||t(142),fn(i,e)}}else{Wo(null),e.preventDefault();const t=i.anchor.getNode(),o=t.getTextContent(),s=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let c=f&&r&&!l&&s;if(c&&i.isCollapsed()&&(c=!no(yi(i.anchor,!0))),!c){xi(n,ne,!0);const t=pr();f&&tr(t)&&t.isCollapsed()&&(on=t,setTimeout((()=>on=null)))}}return}}var s;if(!tr(i))return;const l=e.data;null!==qe&&oi(!1,n,qe),i.dirty&&null===qe||!i.isCollapsed()||oo(i.anchor.getNode())||null===o||i.applyDOMRange(o),qe=null;const a=i.anchor,u=i.focus,d=a.getNode(),h=u.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":xi(n,ie,e);break;case"insertFromComposition":Wo(null),xi(n,ie,e);break;case"insertLineBreak":Wo(null),xi(n,re,!1);break;case"insertParagraph":Wo(null),tn&&!c?(tn=!1,xi(n,re,!1)):xi(n,oe,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":xi(n,se,e);break;case"deleteByComposition":(function(t,e){return t!==e||Zr(t)||Zr(e)||!Po(t)||!Po(e)})(d,h)&&xi(n,le,e);break;case"deleteByDrag":case"deleteByCut":xi(n,le,e);break;case"deleteContent":xi(n,ne,!1);break;case"deleteWordBackward":xi(n,ce,!0);break;case"deleteWordForward":xi(n,ce,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":xi(n,ae,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":xi(n,ae,!1);break;case"formatStrikeThrough":xi(n,ue,"strikethrough");break;case"formatBold":xi(n,ue,"bold");break;case"formatItalic":xi(n,ue,"italic");break;case"formatUnderline":xi(n,ue,"underline");break;case"historyUndo":xi(n,fe,void 0);break;case"historyRedo":xi(n,de,void 0)}else{if("\n"===l)e.preventDefault(),xi(n,re,!1);else if(l===L)e.preventDefault(),xi(n,oe,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=l&&ln(i,o,l,e.timeStamp,!0)?(e.preventDefault(),xi(n,ie,l)):qe=l;Ge=e.timeStamp}}))}(e,n)]);let He=0,Ve=null,Ge=0,qe=null;const Xe=new WeakMap;let Qe=!1,Ze=!1,tn=!1,en=!1,nn=!1,rn="",on=null,sn=[0,"",0,"root",0];function ln(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=Rr(),u=Ri(Oi(a)),f=null!==u?u.anchorNode:null,d=i.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Jn(c)||(!o&&(!s||Ge<r+50)||c.isDirty()&&g<2||ti(n))&&i.offset!==l.offset&&!c.isComposing()||Io(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==Ro(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;const n=t.anchor.offset,r=e.getParentOrThrow(),o=Po(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||function(t){const e=t.getPreviousSibling();return(Jn(e)||Zr(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}(t,c)}function cn(t,e){return Lo(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function an(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;Qe&&(Qe=!1,cn(o,i)&&cn(s,l)&&!on)||Gr(n,(()=>{if(!r)return void Qo(null);if(!Mo(n,o,s))return;let c=pr();if(on&&tr(c)&&c.isCollapsed()){const t=c.anchor,e=on.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=on.clone(),Qo(c))}if(on=null,tr(c)){const r=c.anchor,o=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=Oi(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=sn,h=qo(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)un(c,l,a);else if("text"===r.type)Jn(o)||t(141),fn(c,o);else if("element"===r.type&&!g){Zr(o)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();un(t,n,r)}(c,e):un(c,0,"")}}else{const t=r.key,e=c.focus.key,n=c.getNodes(),o=n.length,s=c.isBackward(),a=s?l:i,u=s?i:l,f=s?e:t,d=s?t:e;let h=b,g=!1;for(let t=0;t<o;t++){const e=n[t],r=e.getTextContentSize();if(Jn(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===o-1&&e.__key===d&&0===u)&&(g=!0,h&=e.getFormat(),0===h))break}c.format=g?h:0}}xi(n,Zt,void 0)}))}function un(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function fn(t,e){un(t,e.getFormat(),e.getStyle())}function dn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function hn(t,e){const n=t._compositionKey;if(Wo(null),null!==n&&null!=e){if(""===e){const e=Jo(n),r=Ro(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&Jn(e)&&ii(e,r.nodeValue,null,null,!0))}if("\n"===e[e.length-1]){const e=pr();if(tr(e)){const n=e.focus;return e.anchor.set(n.key,n.offset,n.type),void xi(t,Ce,null)}}}oi(!0,t,e)}function gn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const _n=new Map;function pn(t){const e=Ki(t.target);if(null===e)return;const n=wo(e.anchorNode);if(null===n)return;Ze&&(Ze=!1,Gr(n,(()=>{const r=yr(),o=e.anchorNode;if(Bi(o)||Lo(o)){Qo(_r(r,e,n,t))}})));const r=ei(n),o=r[r.length-1],i=o._key,s=_n.get(i),l=s||o;l!==n&&an(e,l,!1),an(e,n,!0),n!==o?_n.set(i,n):s&&_n.delete(i)}function yn(t){t._lexicalHandled=!0}function mn(t){return!0===t._lexicalHandled}const xn=()=>{};function Cn(e){const n=e.ownerDocument,r=Xe.get(n);if(void 0===r)return void xn();const o=r-1;o>=0||t(164),Xe.set(n,o),0===o&&n.removeEventListener("selectionchange",pn);const i=Do(e);Ao(i)?(!function(t){if(null!==t._parentEditor){const e=ei(t),n=e[e.length-1]._key;_n.get(n)===t&&_n.delete(n)}else _n.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=gn(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function Sn(t,e,n){Ir();const r=t.__key,o=t.getParent();if(null===o)return;const i=function(t){const e=pr();if(!tr(e)||!Zr(t))return e;const{anchor:n,focus:r}=e,o=n.getNode(),i=r.getNode();Ei(o,t)&&n.set(t.__key,0,"element");Ei(i,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if(tr(i)&&e){const e=i.anchor,n=i.focus;e.key===r&&(Cr(e,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(Cr(n,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else nr(i)&&e&&t.isSelected()&&t.selectPrevious();if(tr(i)&&e&&!s){const e=t.getIndexWithinParent();zo(t),mr(i,o,e,-1)}else zo(t);n||Ai(o)||o.canBeEmpty()||!o.isEmpty()||Sn(o,e),e&&i&&oo(o)&&o.isEmpty()&&o.selectEnd()}class Nn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=Zi(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name)}$config(){return{}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Bo(this,t)}getType(){return this.__type}isInline(){t(137,this.constructor.name)}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return!0;const e=Jo(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||pr();if(null==e)return!1;const n=e.getNodes().some((t=>t.__key===this.__key));if(Jn(this))return n;if(tr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(no(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return-1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return null===t?null:Jo(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(Ai(n))return Zr(e)||e===this&&no(e)||t(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Jo(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Jo(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Zr(this)?this:this.getParent(),n=Zr(t)?t:t.getParent(),r=e&&n?Ds(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ds(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Ms(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ds(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],o=new Set;let i=this;for(;null!==i;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=Zr(i)?n?i.getFirstChild():i.getLastChild():null;if(null!==l){i=l;continue}const c=n?i.getNextSibling():i.getPreviousSibling();if(null!==c){i=c;continue}const a=i.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||o.has(f.__key)||r.push(f)}while(null===u);i=u}return n||r.reverse(),r}isDirty(){const t=Rr()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){const e=Jo(this.__key);return null===e&&t(113),e}getWritable(){Ir();const t=Fr(),e=Rr(),n=t._nodeMap,r=this.__key,o=this.getLatest(),i=e._cloneNotNeeded,s=pr();if(null!==s&&s.setCachedNodes(null),i.has(r))return $o(o),o;const l=Gi(o);return i.add(r),$o(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name)}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let o=r;for(const t of lt(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&st(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){Sn(this,!0,t)}replace(e,n){Ir();let r=pr();null!==r&&(r=r.clone()),Pi(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;zo(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,h=o.__next,g=o.__parent;if(Sn(o,!1,!0),null===u)c.__first=s;else{u.getWritable().__next=s}if(l.__prev=d,null===f)c.__last=s;else{f.getWritable().__prev=s}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Zr(this)&&Zr(l)||t(139),this.getChildren().forEach((t=>{l.append(t)}))),tr(r)){Qo(r);const t=r.anchor,e=r.focus;t.key===i&&Qn(t,l),e.key===i&&Qn(e,l)}return Uo()===i&&Wo(s),l}insertAfter(t,e=!0){Ir(),Pi(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.getParent(),i=pr();let s=!1,l=!1;if(null!==o){const e=t.getIndexWithinParent();if(zo(r),tr(i)){const t=o.__key,n=i.anchor,r=i.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else{c.getWritable().__prev=u}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&tr(i)){const t=this.getIndexWithinParent();mr(i,a,t+1);const e=a.__key;s&&i.anchor.set(e,t+2,"element"),l&&i.focus.set(e,t+2,"element")}return t}insertBefore(t,e=!0){Ir(),Pi(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key;zo(r);const i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===i)s.__first=o;else{i.getWritable().__next=o}s.__size++,n.__prev=o,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=pr();if(e&&tr(a)){mr(a,this.getParentOrThrow(),c)}return t}isParentRequired(){return!1}createParentElementNode(){return yo()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Ir();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Zr(n))return n.select();if(!Jn(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Ir();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Zr(n))return n.select(0,0);if(!Jn(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}class Tn extends Nn{static getType(){return"linebreak"}static clone(t){return new Tn(t.__key)}constructor(t){super(t)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>function(t){const e=t.parentElement;if(null!==e&&Ui(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&bn(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&bn(n))return!0}}return!1}(t)||function(t){const e=t.parentElement;if(null!==e&&Ui(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&bn(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&bn(r))return!0}return!1}(t)?null:{conversion:vn,priority:0}}}static importJSON(t){return kn().updateFromJSON(t)}}function vn(t){return{node:kn()}}function kn(){return Di(new Tn)}function En(t){return t instanceof Tn}function bn(t){return Lo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function On(t,e){return 16&e?"code":e&E?"mark":32&e?"sub":64&e?"sup":null}function Mn(t,e){return 1&e?"strong":2&e?"em":"span"}function An(t,e,n,r,o){const i=r.classList;let s=gi(o,"base");void 0!==s&&i.add(...s),s=gi(o,"underlineStrikethrough");let l=!1;const c=e&k&&e&v;void 0!==s&&(n&k&&n&v?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const t in R){const r=R[t];if(s=gi(o,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&i.remove(...s);continue}e&r&&(!c||"underline"!==t)&&"strikethrough"!==t||i.add(...s)}else e&r&&i.remove(...s)}}function wn(t,e,n){const r=e.firstChild,o=n.isComposing(),s=t+(o?I:"");if(null==r)e.textContent=s;else{const t=r.nodeValue;if(t!==s)if(o||i){const[e,n,o]=function(t,e){const n=t.length,r=e.length;let o=0,i=0;for(;o<n&&o<r&&t[o]===e[o];)o++;for(;i+o<n&&i+o<r&&t[n-i-1]===e[r-i-1];)i++;return[o,n-o-i,e.slice(o,r-i)]}(t,s);0!==n&&r.deleteData(e,n),r.insertData(e,o)}else r.nodeValue=s}}function Dn(t,e,n,r,o,i){wn(o,t,e);const s=i.theme.text;void 0!==s&&An(0,0,r,t,s)}function Pn(t,e){const n=document.createElement(e);return n.appendChild(t),n}class In extends Nn{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new In(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return W[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Uo()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=R[t];return!!(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Ko(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=On(0,n),o=Mn(0,n),i=null===r?o:r,s=document.createElement(i);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(o),s.appendChild(l));Dn(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&(s.style.cssText=c),s}updateDOM(e,n,r){const o=this.__text,i=e.__format,s=this.__format,l=On(0,i),c=On(0,s),a=Mn(0,i),u=Mn(0,s);if((null===l?a:l)!==(null===c?u:c))return!0;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const i=document.createElement(u);return Dn(i,this,0,s,o,r),n.replaceChild(i,e),!1}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),wn(o,f,this);const d=r.theme.text;void 0!==d&&i!==s&&An(0,i,s,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Bn,priority:0}),b:()=>({conversion:Fn,priority:0}),code:()=>({conversion:Wn,priority:0}),em:()=>({conversion:Wn,priority:0}),i:()=>({conversion:Wn,priority:0}),mark:()=>({conversion:Wn,priority:0}),s:()=>({conversion:Wn,priority:0}),span:()=>({conversion:Ln,priority:0}),strong:()=>({conversion:Wn,priority:0}),sub:()=>({conversion:Wn,priority:0}),sup:()=>({conversion:Wn,priority:0}),u:()=>({conversion:Wn,priority:0})}}static importJSON(t){return Un().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Bi(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Pn(n,"b")),this.hasFormat("italic")&&(n=Pn(n,"i")),this.hasFormat("strikethrough")&&(n=Pn(n,"s")),this.hasFormat("underline")&&(n=Pn(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?R[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?K[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Ko(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=$[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Ir();let n=t,r=e;const o=pr(),i=this.getTextContent(),s=this.__key;if("string"==typeof i){const t=i.length;void 0===n&&(n=t),void 0===r&&(r=t)}else n=0,r=0;if(!tr(o))return dr(s,n,s,r,"text","text");{const t=Uo();t!==o.anchor.key&&t!==o.focus.key||Wo(s),o.setTextNodeRange(this,n,this,r)}return o}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const o=this.getWritable(),i=o.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=pr();if(r&&tr(c)){const e=t+s;c.setTextNodeRange(o,e,o,e)}const a=i.slice(0,l)+n+i.slice(l+e);return o.__text=a,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Ir();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,o=Uo(),i=n.length;t.sort(((t,e)=>t-e)),t.push(i);const s=[],l=t.length;for(let e=0,r=0;e<i&&r<=l;r++){const o=t[r];o>e&&(s.push(n.slice(e,o)),e=o)}const c=s.length;if(1===c)return[e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=!1,p=null,y=null;const m=pr();if(tr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e)}e.isSegmented()?(f=Un(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=dt(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=Un(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=dt(e,n);const i=n.__key;o===r&&Wo(i),x.push(n)}const C=p?p.offset:null,S=y?y.offset:null;let N=0;for(const t of x){if(!p&&!y)break;const e=N+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=N&&(p.set(t.getKey(),C-N,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=N){y.set(t.getKey(),S-N,"text");break}N=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&$o(e);null!==n&&$o(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),tr(m)&&mr(m,u,e,c-1)}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,o=e.__key,i=this.__text,s=i.length;Uo()===o&&Wo(r);const l=pr();if(tr(l)){const t=l.anchor,i=l.focus;null!==t&&t.key===o&&Sr(t,n,r,e,s),null!==i&&i.key===o&&Sr(i,n,r,e,s)}const c=e.__text,a=n?c+i:i+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Ln(t){return{forChild:Yn(t.style),node:null}}function Fn(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Yn(e.style,n?void 0:"bold"),node:null}}const Rn=new WeakMap;function Kn(t){if(!Bi(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Bn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=Rn.get(n))&&!Kn(n);)r.push(n),n=n.parentNode;const o=void 0===e?n:e;for(let t=0;t<r.length;t++)Rn.set(r[t],o);return o}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(kn()):"\t"===n?e.push(Hn()):""!==n&&e.push(Un(n))}return{node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return{node:null};if(" "===r[0]){let t=n,e=!0;for(;null!==t&&null!==(t=zn(t,!1));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=!1;break}}e&&(r=r.slice(1))}if(" "===r[r.length-1]){let t=n,e=!0;for(;null!==t&&null!==(t=zn(t,!0));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=!1;break}}e&&(r=r.slice(0,r.length-1))}return""===r?{node:null}:{node:Un(r)}}function zn(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t}if(n=t,Bi(n)){const t=n.style.display;if(""===t&&!Wi(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(Lo(n))return n;if("BR"===n.nodeName)return null}}const $n={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Wn(t){const e=$n[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Yn(t.style,e),node:null}}function Un(t=""){return Di(new In(t))}function Jn(t){return t instanceof In}function Yn(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),o="700"===n||"bold"===n,i=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Jn(t)?(o&&!t.hasFormat("bold")&&t.toggleFormat("bold"),i&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class jn extends In{static getType(){return"tab"}static clone(t){return new jn(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=gi(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Hn().updateFromJSON(t)}setTextContent(t){return"\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,o){return""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return"normal"!==e&&t(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Hn(){return Di(new jn)}function Vn(t){return t instanceof jn}class Gn{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return Os(Ws(Ps(this,"next")),Ws(Ps(t,"next")))<0}getNode(){const e=Jo(this.key);return null===e&&t(20),e}set(t,e,n,r){const o=this._selection,i=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,Pr()||(Uo()===i&&Wo(t),null!==o&&(o.setCachedNodes(null),o.dirty=!0)))}}function qn(t,e,n){return new Gn(t,e,n)}function Xn(t,e){let n=e.__key,r=t.offset,o="element";if(Jn(e)){o="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!Zr(e)){const t=e.getNextSibling();if(Jn(t))n=t.__key,r=0,o="text";else{const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,o)}function Qn(t,e){if(Zr(e)){const n=e.getLastDescendant();Zr(n)||Jn(n)?Xn(t,n):Xn(t,e)}else Xn(t,e)}class Zn{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!nr(t))return!1;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every((t=>n.has(t)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new Zn(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let o;if(Jn(r))o=r.select();else{const t=r.getIndexWithinParent()+1;o=r.getParentOrThrow().select(t,t)}o.insertNodes(t);for(let t=0;t<n;t++)e[t].remove()}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Jo(t);null!==e&&n.push(e)}return Pr()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((pr()||yr())===this&&t[0]){const e=_s(t[0],"next");Ls(Es(e,e))}for(const e of t)e.remove()}}function tr(t){return t instanceof er}class er{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!tr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const o=new Set,i=new Set;for(const n of t)if(fs(n)){const{origin:t}=n;0===e.length?o.add(t):(i.add(t),e.push(t))}else{const{origin:t}=n;Zr(t)&&i.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(us(t.focus)&&Zr(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=xs(t.focus.origin,"previous");fs(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=Ss(n))o.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!Zr(t)||i.has(t)||t.isEmpty()||o.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=Ws(t.anchor),r=Ws(t.anchor.getFlipped()),o=t=>as(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}(Ys(Rs(this),"next"));return Pr()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const t=this.getNodes();if(0===t.length)return"";const e=t[0],n=t[t.length-1],r=this.anchor,o=this.focus,i=r.isBefore(o),[s,l]=or(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(Zr(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,Jn(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===o.type&&o.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=i?t.slice(s):t.slice(l):f===n&&(t=i?t.slice(0,l):t.slice(0,s)),c+=t}else!no(f)&&!En(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=Rr(),n=e.getEditorState()._selection,r=fr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[o,i]=r;this.anchor.set(o.key,o.offset,o.type,!0),this.focus.set(i.key,i.offset,i.type,!0),pt(this)}clone(){const t=this.anchor,e=this.focus;return new er(qn(t.key,t.offset,t.type),qn(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Ko(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=R[t];return!!(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(kn()):"\t"===r?n.push(Hn()):n.push(Un(r))}this.insertNodes(n)}insertText(e){const n=this.anchor,r=this.focus,o=this.format,i=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const o=t.getNode(),i=o.getChildAtIndex(t.offset),s=Un();if(s.setFormat(n),s.setStyle(r),mo(i))i.splice(0,0,[s]);else{const t=oo(o)?yo().append(s):s;null===i?o.append(t):i.insertBefore(t)}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text")}(s,l,o,i),"element"===l.type&&Is(l,Ws(Ps(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Jn(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(Io(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Jn(t)&&t.canInsertTextBefore()&&!Io(t)||(t=Un(),t.setFormat(o),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(Io(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Jn(t)&&!Io(t)||(t=Un(),t.setFormat(o),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=Un(d.getTextContent());t.setFormat(o),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Zr(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),ur(this.anchor,this.focus,null),void this.insertText(e)}if(1===f){if(Po(d)){const t=Un(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===o&&n===i){if(Vn(d)){const t=Un(e);return t.setFormat(o),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=Un(e);if(t.setFormat(o),t.setStyle(i),t.select(),0===c)d.insertBefore(t,!1);else{const[e]=d.splitText(c);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(o),d.setStyle(i)}const r=a-c;d=d.spliceText(c,r,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=Zr(d)?d:d.getParentOrThrow();let r=Zr(_)?_:_.getParentOrThrow(),o=_;if(!n.is(r)&&r.isInline())do{o=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(Jn(_)&&!Po(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=Un(_.getTextContent());_.replace(t),_=t}oo(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key)}else{const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove()}else t.add(_.__key);const i=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=i.length-1;t>=0;t--){const e=i[t];if(e.is(d)||Zr(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(o)?g||p.insertAfter(e,!1):e.remove())}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),o=r.length;(0===o||r[o-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Po(d))if(c===h)d.select();else{const t=Un(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=pr()===this;Fs(this,$s(Rs(this))),t&&pr()!==this&&Qo(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Wo(null);const n=this.getNodes(),r=[];for(const t of n)Jn(t)&&r.push(t);const o=e=>{n.forEach((n=>{if(Zr(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}}))},i=r.length;if(0===i)return this.toggleFormat(t),Wo(null),void o(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);o(g);const _=i-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(Io(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text")}return void(this.format=g)}0===h||Io(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Io(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],o=n.getFormatFlags(t,m);n.setFormat(o)}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=pr();return tr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=ts(n,Ji),o=e[e.length-1];if(Zr(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=vr(this);r.splice(t,0,e),o.selectEnd()}return}if(!e.some((t=>(Zr(t)||no(t))&&!t.isInline()))){Zr(r)||t(211,n.constructor.name,n.getType());const i=vr(this);return r.splice(i,0,e),void o.selectEnd()}const i=function(t){const e=yo();let n=null;for(let r=0;r<t.length;r++){const o=t[r],i=En(o);if(i||no(o)&&o.isInline()||Zr(o)&&o.isInline()||Jn(o)||o.isParentRequired()){if(null===n&&(n=o.createParentElementNode(),e.append(n),i))continue;null!==n&&n.append(o)}else e.append(o),n=null}return e}(e),s=i.getLastDescendant(),l=i.getChildren(),c=!Zr(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;Zr(f=u)&&Ji(f)&&!f.isEmpty()&&Zr(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Zr(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n,r){const o=n.getParentOrThrow().getLastChild();let i=n;const s=[n];for(;i!==o;)i.getNextSibling()||t(140),i=i.getNextSibling(),s.push(i);let l=e;for(const t of s)l=l.insertAfter(t)}(r,u));const d=ts(s,Ji);c&&Zr(d)&&(c.canMergeWhenEmpty()||Ji(a))&&(d.append(...c.getChildren()),c.remove()),Zr(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=Zr(r)?r.getLastChild():null;En(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=yo();return qo().splice(this.anchor.offset,0,[t]),t.select(),t}const e=vr(this),n=ts(this.anchor.getNode(),Ji);Zr(n)||t(213);const r=n.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(t){const e=kn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n)}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[o,i]=or(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[i,o]:[o,i];if(0===e)return[];if(1===e){if(Jn(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return[n]}if(Jn(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),Jn(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,e,n){if(Er(this,t,e,n))return;const r="move"===t,o=Rr(),i=Ri(Oi(o));if(!i)return;const s=o._blockCursorElement,l=o._rootElement,c=this.focus.getNode();if(null===l||null===s||!Zr(c)||c.isInline()||c.canBeEmpty()||Fi(s,o,l),this.dirty){let t=Si(o,this.anchor.key),e=Si(o,this.focus.key);"text"===this.anchor.type&&(t=Ro(t)),"text"===this.focus.type&&(e=Ro(e)),t&&e&&Nr(i,t,this.anchor.offset,e,this.focus.offset)}if(function(t,e,n,r){t.modify(e,n,r)}(i,t,e?"backward":"forward",n),i.rangeCount>0){const t=i.getRangeAt(0),n=this.anchor.getNode(),o=oo(n)?n:Mi(n);if(this.applyDOMRange(t),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let t=0;t<n.length;t++){const e=n[t];Ei(e,o)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];Zr(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];Zr(t)?t.selectEnd():t.getParentOrThrow().selectEnd()}i.anchorNode===t.startContainer&&i.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,o=n.offset,i=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,o,i,!0)}(this)}}"lineboundary"===n&&Er(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Zr(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Zr(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=vs(Ps(e,t?"previous":"next"));if(r.getTextSlices().every((t=>null===t||0===t.distance))){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(fs(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Zr(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Ws(e);Fs(this,Es(t,t)),r.anchor.origin.remove()}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"})}else{if("merge-block"===t.type)break;if(us(e)){if(Zr(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(no(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Zr(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=gr();t.add(e.origin.getKey()),Qo(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Fs(this,Es(!e.origin.isEmpty()&&n.isEmpty()?Ks(_s(n,e.direction)):r.anchor,e)),this.removeText()}}const o=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&ir(this,e.getNode()))return}else{const r="text"===o.type?o.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=o.offset,i=r.getTextContentSize();if(r.is(n)||t&&e!==i||!t&&0!==e)return void lr(r,t,e)}else if(null!==n&&n.isSegmented()){const o=e.offset,i=n.getTextContentSize();if(n.is(r)||t&&0!==o||!t&&o!==i)return void lr(n,t,o)}!function(t,e){const n=t.anchor,r=t.focus,o=n.getNode(),i=r.getNode();if(o===i&&"text"===n.type&&"text"===r.type){const t=n.offset,i=r.offset,s=t<i,l=s?t:i,c=s?i:t,a=c-1;if(l!==a){(function(t){return!(ti(t)||sr(t))})(o.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type))}}}(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&oo(t.getParent())&&null===t.getPreviousSibling()&&ir(this,t)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function nr(t){return t instanceof Zn}function rr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function or(t){const e=t.getStartEndPoints();if(null===e)return[0,0];const[n,r]=e;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[rr(n),rr(r)]}function ir(t,e){for(let n=e;n;n=n.getParent()){if(Zr(n)){if(n.collapseAtStart(t))return!0;if(Ai(n))break}if(n.getPreviousSibling())break}return!1}const sr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return()=>!1})();function lr(t,e,n){const r=t,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let t=0;t<i;t++){const r=t===i-1;if(l=s,s+=o[t].length,e&&s===n||s>n||r){o.splice(t,1),r&&(l=void 0);break}}const c=o.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function cr(e,n,r,o){let i,s=n;if(Bi(e)){let l=!1;const c=e.childNodes,a=c.length,u=o._blockCursorElement;s===a&&(l=!0,s=a-1);let f=c[s],d=!1;if(f===u)f=c[s+1],d=!0;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--}}if(i=Zo(f),Jn(i))s=ys(i,l?"next":"previous");else{let c=Zo(e);if(null===c)return null;if(Zr(c)){const a=o.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Zr(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Zr(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Zr(f)?f:f.getParentOrThrow()),s=0}Jn(f)?(i=f,c=null,s=ys(f,l?"next":"previous")):f!==c&&l&&!d&&(Zr(c)||t(216),s=Math.min(c.getChildrenSize(),s+1))}else{const t=c.getIndexWithinParent();s=0===n&&no(c)&&Zo(e)===c?t:t+1,c=c.getParentOrThrow()}if(Zr(c))return qn(c.__key,s,"element")}}else i=Zo(e);return Jn(i)?qn(i.__key,ys(i,s,"clamp"),"text"):null}function ar(t,e,n){const r=t.offset,o=t.getNode();if(0===r){const r=o.getPreviousSibling(),i=o.getParent();if(e){if((n||!e)&&null===r&&Zr(i)&&i.isInline()){const e=i.getPreviousSibling();Jn(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else Zr(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Jn(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===o.getTextContent().length){const r=o.getNextSibling(),i=o.getParent();if(e&&Zr(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Zr(i)&&i.isInline()&&!i.canInsertTextAfter()){const e=i.getNextSibling();Jn(e)&&t.set(e.__key,0,"text")}}}function ur(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),o=t.is(e);ar(t,r,o),ar(e,!r,o),o&&e.set(t.key,t.offset,t.type);const i=Rr();if(i.isComposing()&&i._compositionKey!==t.key&&tr(n)){const r=n.anchor,o=n.focus;t.set(r.key,r.offset,r.type,!0),e.set(o.key,o.offset,o.type,!0)}}}function fr(t,e,n,r,o,i){if(null===t||null===n||!Mo(o,t,n))return null;const s=cr(t,e,tr(i)?i.anchor:null,o);if(null===s)return null;const l=cr(n,r,tr(i)?i.focus:null,o);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Zo(t),r=Zo(n);if(no(e)&&no(r))return null}return ur(s,l,i),[s,l]}function dr(t,e,n,r,o,i){const s=Fr(),l=new er(qn(t,e,o),qn(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function hr(){const t=qn("root",0,"element"),e=qn("root",0,"element");return new er(t,e,0,"")}function gr(){return new Zn(new Set)}function _r(t,e,n,r){const o=n._window;if(null===o)return null;const i=r||o.event,s=i?i.type:void 0,l="selectionchange"===s,c=!j&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&i&&3===i.detail||"drop"===s||void 0===s);let a,u,f,d;if(tr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&tr(t)&&!Mo(n,a,u))return t.clone();const h=fr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new er(g,_,tr(t)?t.format:0,tr(t)?t.style:"")}function pr(){return Fr()._selection}function yr(){return Rr()._editorState._selection}function mr(t,e,n,r=1){const o=t.anchor,i=t.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=o.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);o.set(c,n,"element"),i.set(c,n,"element"),xr(t)}}else{const s=t.isBackward(),l=s?i:o,a=l.getNode(),u=s?o:i,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element")}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element")}}xr(t)}function xr(t){const e=t.anchor,n=e.offset,r=t.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!Zr(i))return;const t=i.getChildrenSize(),o=n>=t,s=o?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Jn(s)){let t=0;o&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}}else{if(Zr(i)){const t=i.getChildrenSize(),r=n>=t,o=r?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Jn(o)){let t=0;r&&(t=o.getTextContentSize()),e.set(o.__key,t,"text")}}if(Zr(s)){const t=s.getChildrenSize(),e=o>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(o);if(Jn(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}}function Cr(t,e,n,r,o){let i=null,s=0,l=null;null!==r?(i=r.__key,Jn(r)?(s=r.getTextContentSize(),l="text"):Zr(r)&&(s=r.getChildrenSize(),l="element")):null!==o&&(i=o.__key,Jn(o)?l="text":Zr(o)&&(l="element")),null!==i&&null!==l?t.set(i,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Sr(t,e,n,r,o){"text"===t.type?t.set(n,t.offset+(e?0:o),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function Nr(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch(t){}}function Tr(t,e,n,r,o,i,s){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(o.has(uo)&&f!==i||null!==f&&Oo(f))return;if(!tr(e))return void(null!==t&&Mo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Si(n,g),y=Si(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,N=e.isCollapsed();let T=p,v=y,k=!1;if("text"===d.type){T=Ro(p);const t=d.getNode();k=t.getFormat()!==C||t.getStyle()!==S}else tr(t)&&"text"===t.anchor.type&&(k=!0);var E,b,O,M,A;if(("text"===h.type&&(v=Ro(y)),null!==T&&null!==v)&&(N&&(null===t||k||tr(t)&&(t.format!==C||t.style!==S))&&(E=C,b=S,O=m,M=g,A=performance.now(),sn=[E,b,O,M,A]),a!==m||u!==x||l!==T||c!==v||"Range"===r.type&&N||(null!==f&&i.contains(f)||i.focus({preventScroll:!0}),"element"===d.type))){if(Nr(r,T,m,v,x),!o.has(fo)&&e.isCollapsed()&&null!==i&&i===document.activeElement){const t=tr(e)&&"element"===e.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();!function(t,e,n){const r=Ti(n),o=bi(r);if(null===r||null===o)return;let{top:i,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=Oi(t).innerHeight;else{const t=a.getBoundingClientRect();l=t.top,c=t.bottom}let n=0;if(i<l?n=-(l-i):s>c&&(n=s-c),0!==n)if(e)o.scrollBy(0,n);else{const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;i-=e,s-=e}if(e)break;a=Ni(a)}}(n,e,i)}}Qe=!0}}function vr(e){let n=e;e.isCollapsed()||n.removeText();const r=pr();tr(r)&&(n=r),tr(n)||t(161);const o=n.anchor;let i=o.getNode(),s=o.offset;for(;!Ji(i);){const t=i;if([i,s]=kr(i,s),t.is(i))break}return s}function kr(t,e){const n=t.getParent();if(!n){const t=yo();return qo().append(t),t.select(),[qo(),0]}if(Jn(t)){const r=t.splitText(e);if(0===r.length)return[n,t.getIndexWithinParent()];const o=0===e?0:1;return[n,r[0].getIndexWithinParent()+o]}if(!Zr(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new er(qn(t.__key,e,"element"),qn(t.__key,e,"element"),0,""),o=t.insertNewAfter(n);o&&o.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Er(t,e,n,r,o="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),!0}const i=Ps(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!Us(c)){for(const t of c){a=!1;const{origin:e}=t;if(!no(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of vs(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(fs(t))t.origin.isInline()||(c=t);else{if(Zr(t.origin))continue;no(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===i)return!1;if(l&&!s&&no(c.origin)&&c.origin.isKeyboardSelectable()){const t=gr();return t.add(c.origin.getKey()),Qo(t),!0}return c=Ws(c),l&&Is(t.anchor,c),Is(t.focus,c),a||!s}let br=null,Or=null,Mr=!1,Ar=!1,wr=0;const Dr={characterData:!0,childList:!0,subtree:!0};function Pr(){return Mr||null!==br&&br._readOnly}function Ir(){Mr&&t(13)}function Lr(){wr>99&&t(14)}function Fr(){return null===br&&t(195,Kr()),br}function Rr(){return null===Or&&t(196,Kr()),Or}function Kr(){let t=0;const e=new Set,n=Co.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=Do(r);if(Ao(o))t++;else if(o){let t=String(o.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Br(){return Or}function zr(t,e,n){const r=e.__type,o=vo(t,r);let i=n.get(r);void 0===i&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let t=0;t<s&&(i[t](e),e.isAttached());t++);}function $r(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Wr(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t)}function Ur(e,n){const r=e.type,o=n.get(r);void 0===o&&t(17,r);const i=o.klass;e.type!==i.getType()&&t(18,i.name);const s=i.importJSON(e),l=e.children;if(Zr(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=Ur(l[t],n);s.append(e)}return s}function Jr(t,e,n){const r=br,o=Mr,i=Or;br=e,Mr=!0,Or=t;try{return n()}finally{br=r,Mr=o,Or=i}}function Yr(t,e){const n=t._pendingEditorState,r=t._rootElement,o=t._headless||null===r;if(null===n)return;const i=t._editorState,s=i._selection,l=n._selection,c=t._dirtyType!==m,a=br,u=Mr,f=Or,d=t._updating,g=t._observer;let _=null;if(t._pendingEditorState=null,t._editorState=n,!o&&c&&null!==g){Or=t,br=n,Mr=!1,t._updating=!0;try{const e=t._dirtyType,r=t._dirtyElements,o=t._dirtyLeaves;g.disconnect(),_=qt(i,n,t,e,r,o)}catch(e){if(e instanceof Error&&t._onError(e),Ar)throw e;return xo(t,null,r,n),et(t),t._dirtyType=C,Ar=!0,Yr(t,i),void(Ar=!1)}finally{g.observe(r,Dr),t._updating=d,br=a,Mr=u,Or=f}}n._readOnly||(n._readOnly=!0);const p=t._dirtyLeaves,y=t._dirtyElements,x=t._normalizedNodes,S=t._updateTags,N=t._deferred;c&&(t._dirtyType=m,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const o=e._nodeMap;let i;for(i in r)o.has(i)||(r===n&&(r=Vo(t)),delete r[i])}(t,n);const T=o?null:Ri(Oi(t));if(t._editable&&null!==T&&(c||null===l||l.dirty)&&null!==r&&!S.has(ho)){Or=t,br=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&Fi(e,t,r),Tr(s,l,t,T,S,r)}!function(t,e,n){let r=t._blockCursorElement;if(tr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const o=n.anchor,i=o.getNode(),s=o.offset;let l=!1,c=null;if(s===i.getChildrenSize()){Li(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&Li(e)){const n=e.getPreviousSibling();(null===n||Li(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=t.getElementByKey(i.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=h(r);r=e.blockCursor=t}void 0!==r&&n.classList.add(...r)}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&Fi(r,t,e)}(t,r,l)}finally{null!==g&&g.observe(r,Dr),Or=f,br=a}}null!==_&&function(t,e,n,r,o){const i=Array.from(t._listeners.mutation),s=i.length;for(let t=0;t<s;t++){const[s,l]=i[t];for(const t of l){const i=e.get(t);void 0!==i&&s(i,{dirtyLeaves:r,prevEditorState:o,updateTags:n})}}}(t,_,S,p,i),tr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(Zt,void 0);const v=t._pendingDecorators;null!==v&&(t._decorators=v,t._pendingDecorators=null,jr("decorator",t,!0,v)),function(t,e,n){const r=Go(e),o=Go(n);r!==o&&jr("textcontent",t,!0,o)}(t,e||i,n),jr("update",t,!0,{dirtyElements:y,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:x,prevEditorState:e||i,tags:S}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=!0;try{for(let t=0;t<e.length;t++)e[t]()}finally{t._updating=n}}}(t,N),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;Vr(t,e,r)}}}(t)}function jr(t,e,n,...r){const o=e._updating;e._updating=n;try{const n=Array.from(e._listeners[t]);for(let t=0;t<n.length;t++)n[t].apply(null,r)}finally{e._updating=o}}function Hr(e,n){const r=e._updates;let o=n||!1;for(;0!==r.length;){const n=r.shift();if(n){const[r,i]=n,s=e._pendingEditorState;let l;void 0!==i&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(null===s&&t(191),s._flushSync=!0),l&&e._deferred.push(l),Wr(e,i.tag)),null==s?Vr(e,r,i):r()}}return o}function Vr(e,n,r){const o=e._updateTags;let i,s=!1,l=!1;void 0!==r&&(i=r.onUpdate,Wr(e,r.tag),s=r.skipTransforms||!1,l=r.discrete||!1),i&&e._deferred.push(i);const c=e._editorState;let a=e._pendingEditorState,u=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=io(a||c),u=!0),a._flushSync=l;const f=br,d=Mr,h=Or,g=e._updating;br=a,Mr=!1,e._updating=!0,Or=e;const _=e._headless||null===e.getRootElement();No(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Ri(Oi(t));return tr(n)||null==n?_r(n,r,t,e):n.clone()}(e,r&&r.event||null));const o=e._compositionKey;n(),s=Hr(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(tr(r)){const t=r.anchor,e=r.focus;let o;if("text"===t.type&&(o=t.getNode(),o.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();o!==t&&t.selectionTransform(n,r)}}}(a,e),e._dirtyType!==m&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);Jn(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&_t(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=Uo(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=o.get(t);Jn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&_t(r),void 0!==r&&$r(r,i)&&zr(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){wr++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=o.get(n);void 0!==c&&$r(c,i)&&zr(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,wr++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),Hr(e),function(t,e,n,r){const o=t._nodeMap,i=e._nodeMap,s=[];for(const[t]of r){const e=i.get(t);void 0!==e&&(e.isAttached()||(Zr(e)&&J(e,t,o,i,s,r),o.has(t)||r.delete(t),s.push(t)))}for(const t of s)i.delete(t);for(const t of n){const e=i.get(t);void 0===e||e.isAttached()||(o.has(t)||n.delete(t),i.delete(t))}}(c,a,e._dirtyLeaves,e._dirtyElements));o!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(tr(i)){const e=a._nodeMap,n=i.anchor.key,r=i.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19)}else nr(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=C,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Yr(e)}finally{br=f,Mr=d,Or=h,e._updating=g,wr=0}const p=e._dirtyType!==m||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);p?a._flushSync?(a._flushSync=!1,Yr(e)):u&&Eo((()=>{Yr(e)})):(a._flushSync=!1,u&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Gr(t,e,n){Or===t&&void 0===n?e():Vr(t,e,n)}class qr{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new qr(this.element,t,this.after)}withAfter(t){return new qr(this.element,this.before,t)}withElement(t){return this.element===t?this:new qr(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||c||l);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,o=document.createElement("br");if(n.insertBefore(o,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,o),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=o}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return[t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const o=Xr(e,n);o.push(r);const i=Xr(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<i.length;t++){const e=o[t],n=i[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return[t.getParentOrThrow(),s]}}function Xr(e,n){const r=[];let o=n;for(;o!==e&&null!==o;o=o.parentNode){let t=0;for(let e=o.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t)}return o!==e&&t(225),r.reverse()}class Qr extends Nn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return z[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=Rr()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Jn(e)&&t.push(e),Zr(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Zr(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;Zr(t);){const e=t.getLastChild();if(null===e)break;t=e}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Zr(t)&&t.getLastDescendant()||t||null}const r=e[t];return Zr(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Jo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Jo(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=o.getTextContent(),Zr(o)&&r!==n-1&&!o.isInline()&&(t+=L)}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=o.getTextContentSize(),Zr(o)&&r!==n-1&&!o.isInline()&&(t+=L.length)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=B[t];return!!(this.getFormat()&e)}return!1}hasTextFormat(t){const e=R[t];return!!(this.getTextFormat()&e)}getFormatFlags(t,e){return Ko(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Ir();const n=pr();let r=t,o=e;const i=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Jn(t)||Zr(t))return t.select(0,0)}else if(!(void 0!==t&&t!==i||void 0!==e&&e!==i)){const t=this.getLastChild();if(Jn(t)||Zr(t))return t.select()}void 0===r&&(r=i),void 0===o&&(o=i);const s=this.__key;return tr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,o,"element"),n.dirty=!0,n):dr(s,r,s,o,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach((t=>t.remove())),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?B[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){const o=r.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const l=s.__key,c=[],a=[],u=this.getChildAtIndex(e+n);let f=null,d=i-n+o;if(0!==e)if(e===i)f=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(f=t.getPreviousSibling())}if(n>0){let e=null===f?this.getFirstChild():f.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;zo(e.getWritable()),a.push(r),e=n}}let h=f;for(let e=0;e<o;e++){const n=r[e];null!==h&&n.is(h)&&(f=h=h.getPreviousSibling());const o=n.getWritable();o.__parent===l&&d--,zo(o);const i=n.__key;if(null===h)s.__first=i,o.__prev=null;else{const t=h.getWritable();t.__next=i,o.__prev=t.__key}n.__key===l&&t(76),o.__parent=l,c.push(i),h=n}if(e+n===i){if(null!==h){h.getWritable().__next=null,s.__last=h.__key}}else if(null!==u){const t=u.getWritable();if(null!==h){const e=h.getWritable();t.__prev=h.__key,e.__next=u.__key}else t.__prev=null}if(s.__size=d,a.length){const t=pr();if(tr(t)){const e=new Set(a),n=new Set(c),{anchor:r,focus:o}=t;to(r,e,n)&&Cr(r,r.getNode(),this,f,u),to(o,e,n)&&Cr(o,o.getNode(),this,f,u),0!==d||this.canBeEmpty()||Ai(this)||this.remove()}}return s}getDOMSlot(t){return new qr(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Bi(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n)}return{element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,e,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const o=e.getElementByKey(t.getKey());null!==o&&(null==r?(n.insertChild(o),r=o):r!==o&&n.replaceChild(o,r),r=r.nextSibling)}}}function Zr(t){return t instanceof Qr}function to(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return!0;r=r.getParent()}return!1}class eo extends Nn{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function no(t){return t instanceof eo}class ro extends Qr{__cachedText;static getType(){return"root"}static clone(){return new ro}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return!Pr()&&Rr()._dirtyType!==m||null===t?super.getTextContent():t}remove(){t(52)}replace(e){t(53)}insertBefore(e){t(54)}insertAfter(e){t(55)}updateDOM(t,e){return!1}splice(e,n,r){for(const e of r)Zr(e)||no(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return qo().updateFromJSON(t)}collapseAtStart(){return!0}}function oo(t){return t instanceof ro}function io(t){return new co(new Map(t._nodeMap))}function so(){return new co(new Map([["root",new ro]]))}function lo(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Zr(e)){const o=n.children;Array.isArray(o)||t(59,r.name);const i=e.getChildren();for(let t=0;t<i.length;t++){const e=lo(i[t]);o.push(e)}}return n}class co{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return Jr(e&&e.editor||null,this,t)}clone(t){const e=new co(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return Jr(null,this,(()=>({root:lo(qo())})))}}const ao="history-merge",uo="collaboration",fo="skip-scroll-into-view",ho="skip-dom-selection";class go extends Qr{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class _o extends Qr{static getType(){return"paragraph"}static clone(t){return new _o(t.__key)}createDOM(t){const e=document.createElement("p"),n=gi(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n)}return e}updateDOM(t,e,n){return!1}static importDOM(){return{p:t=>({conversion:po,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Bi(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return yo().updateFromJSON(t)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=yo();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Jn(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function po(t){const e=yo();return t.style&&(e.setFormat(t.style.textAlign),qi(t,e)),{node:e}}function yo(){return Di(new _o)}function mo(t){return t instanceof _o}function xo(t,e,n,r){const o=t._keyToDOMMap;o.clear(),t._editorState=so(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=m,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const i=t._observer;null!==i&&(i.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",o.set("root",n))}class Co{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,o,i,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,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=m,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=ni(),this._onError=o,this._htmlConversions=i,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t)}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t)}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t)}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t)}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t)}}registerCommand(e,n,r){void 0===r&&t(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(e);void 0===i&&t(36,String(e));const s=i[r];return s.add(n),()=>{s.delete(n),i.every((t=>0===t.size))&&o.delete(e)}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,o=this._listeners.mutation;let i=o.get(e);void 0===i&&(i=new Set,o.set(e,i)),i.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{i.delete(r),0===i.size&&o.delete(e)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Vi(n).get(e.getType());if(!r)return;const o=new Map;for(const t of r.keys())o.set(t,"created");o.size>0&&t(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],o=n.replaceWithKlass;if(null!=o){const t=this.registerNodeTransformToKlass(o,e);r.push(t)}return function(t,e){const n=Vi(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e)}if(0===r.length)return;t.update((()=>{for(const t of r)for(const e of t.keys()){const t=Jo(e);t&&t.markDirty()}}),null===t._pendingEditorState?{tag:ao}:void 0)}(this,r.map((t=>t.klass.getType()))),()=>{r.forEach((t=>t.transforms.delete(e)))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return xi(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=gi(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,xo(this,e,t,r),null!==e&&(this._config.disableEvents||Cn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=bi(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=C,et(this),this._updateTags.add(ao),Yr(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument,r=Xe.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",pn),Xe.set(n,(r||0)+1),t.__lexicalEditor=e;const o=gn(t);for(let n=0;n<je.length;n++){const[r,i]=je[n],s="function"==typeof i?t=>{mn(t)||(yn(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(mn(t))return;yn(t);const n=e.isEditable();switch(r){case"cut":return n&&xi(e,Le,t);case"copy":return xi(e,Ie,t);case"paste":return n&&xi(e,se,t);case"dragstart":return n&&xi(e,we,t);case"dragover":return n&&xi(e,De,t);case"dragend":return n&&xi(e,Pe,t);case"focus":return n&&xi(e,$e,t);case"blur":return n&&xi(e,We,t);case"drop":return n&&xi(e,Me,t)}};t.addEventListener(r,s),o.push((()=>{t.removeEventListener(r,s)}))}}(t,this),null!=n&&t.classList.add(...n)}else this._window=null,this._updateTags.add(ao),Yr(this);jr("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=io(e),r._selection=e._selection?e._selection.clone():null),tt(this);const o=this._pendingEditorState,i=this._updateTags,s=void 0!==n?n.tag:null;null===o||o.isEmpty()||(null!=s&&i.add(s),Yr(this)),this._pendingEditorState=r,this._dirtyType=C,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Yr(this)}parseEditorState(t,e){return function(t,e,n){const r=so(),o=br,i=Mr,s=Or,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,br=r,Mr=!1,Or=e,No(null);try{const o=e._nodes;Ur(t.root,o),n&&n(),r._readOnly=!0}catch(t){t instanceof Error&&e._onError(t)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,br=o,Mr=i,Or=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return Yr(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):Vr(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Gr(this,(()=>{const r=pr(),o=qo();null!==r?r.dirty||Qo(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),vi("focus"),ki((()=>{n.removeAttribute("autocapitalize"),t&&t()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Ri(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,jr("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}Co.version="0.36.0+prod.cjs";let So=null;function No(t){So=t}let To=1;function vo(e,n){const r=ko(e,n);return void 0===r&&t(30,n),r}function ko(t,e){return t._nodes.get(e)}const Eo="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function bo(t){return no(Ho(t))}function Oo(t){const e=document.activeElement;if(!Bi(e))return!1;const n=e.nodeName;return no(Ho(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Do(e))}function Mo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Oo(e)&&wo(e)===t}catch(t){return!1}}function Ao(t){return t instanceof Co}function wo(t){let e=t;for(;null!=e;){const t=Do(e);if(Ao(t))return t;e=Ni(e)}return null}function Do(t){return t?t.__lexicalEditor:null}function Po(t){return Vn(t)||t.isToken()}function Io(t){return Po(t)||t.isSegmented()}function Lo(t){return zi(t)&&t.nodeType===_}function Fo(t){return zi(t)&&t.nodeType===p}function Ro(t){let e=t;for(;null!=e;){if(Lo(e))return e;e=e.firstChild}return null}function Ko(t,e,n){const r=R[e];if(null!==n&&(t&r)==(n&r))return t;let o=t^r;return"subscript"===e?o&=~R.superscript:"superscript"===e?o&=~R.subscript:"lowercase"===e?(o&=~R.uppercase,o&=~R.capitalize):"uppercase"===e?(o&=~R.lowercase,o&=~R.capitalize):"capitalize"===e&&(o&=~R.lowercase,o&=~R.uppercase),o}function Bo(t,e){const n=function(){const t=So;return So=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Ir(),Lr();const r=Rr(),o=Fr(),i=""+To++;o._nodeMap.set(i,t),Zr(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=x,t.__key=i}function zo(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),s=null!==i?i.__key:null,l=null!==o?o.__key:null,c=null!==o?o.getWritable():null,a=null!==i?i.getWritable():null;null===o&&(r.__first=s),null===i&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function $o(t){Lr();const e=t.getLatest(),n=e.__parent,r=Fr(),o=Rr(),i=r._nodeMap,s=o._dirtyElements;null!==n&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,!1),r=t.__parent}}(n,i,s);const l=e.__key;o._dirtyType=x,Zr(t)?s.set(l,!0):o._dirtyLeaves.add(l)}function Wo(t){Ir();const e=Rr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Jo(n);null!==t&&t.getWritable()}if(null!==t){const e=Jo(t);null!==e&&e.getWritable()}}}function Uo(){if(Pr())return null;return Rr()._compositionKey}function Jo(t,e){const n=(e||Fr())._nodeMap.get(t);return void 0===n?null:n}function Yo(t,e){const n=jo(t,Rr());return void 0!==n?Jo(n,e):null}function jo(t,e){return t[`__lexicalKey_${e._key}`]}function Ho(t,e){let n=t;for(;null!=n;){const t=Yo(n,e);if(null!==t)return t;n=Ni(n)}return null}function Vo(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Go(t){return t.read((()=>qo().getTextContent()))}function qo(){return Xo(Fr())}function Xo(t){return t._nodeMap.get("root")}function Qo(t){Ir();const e=Fr();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Zo(t){const e=Rr(),n=function(t,e){let n=t;for(;null!=n;){const t=jo(n,e);if(void 0!==t)return t;n=Ni(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Jo("root"):null}return Jo(n)}function ti(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function ei(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function ni(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function ri(t){return Lo(t)?t.nodeValue:null}function oi(t,e,n){const r=Ri(Oi(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=ri(o);const r=Ho(o);if(null!==e&&Jn(r)){if(e===I&&n){const t=n.length;e=n,i=t,s=t}null!==e&&ii(r,e,i,s,t)}}}function ii(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let a=e;(s||o)&&e[e.length-1]===I&&(a=e.slice(0,-1));const u=i.getTextContent();if(o||a!==u){if(""===a){if(Wo(null),l||c||d)i.remove();else{const t=Rr();setTimeout((()=>{t.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}const e=i.getParent(),o=yr(),u=i.getTextContentSize(),f=Uo(),h=i.getKey();if(i.isToken()||null!==f&&h===f&&!s||tr(o)&&(null!==e&&!e.canInsertTextBefore()&&0===o.anchor.offset||o.anchor.key===t.__key&&0===o.anchor.offset&&!i.canInsertTextBefore()&&!s||o.focus.key===t.__key&&o.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const g=pr();if(!tr(g)||null===n||null===r)return void si(i,a,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=Un(i.getTextContent());i.replace(t),i=t}si(i,a,g)}}}function si(t,e,n){if(t.setTextContent(e),tr(n)){const e=t.getKey();for(const r of["anchor","focus"]){const o=n[r];"text"===o.type&&o.key===e&&(o.offset=ys(t,o.offset,"clamp"))}}}function li(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function ci(t,e){return li(t,e,"altKey")&&li(t,e,"ctrlKey")&&li(t,e,"shiftKey")&&li(t,e,"metaKey")}function ai(t,e,n){return ci(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const ui={ctrlKey:!o,metaKey:o},fi={altKey:o,ctrlKey:!o};function di(t){return"Backspace"===t.key}function hi(t){return ai(t,"a",ui)}function gi(t,e){void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const o=t[e];if("string"==typeof o){const t=h(o);return n[e]=t,t}return o}function _i(e,n,r,o,i){if(0===r.size)return;const s=o.__type,l=o.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===i;(void 0===f||d)&&u.set(l,d?"updated":i)}function pi(t,e,n){const r=t.getParent();let o=n,i=t;return null!==r&&(e&&0===n?(o=i.getIndexWithinParent(),i=r):e||n!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?o-1:o)}function yi(t,e){const n=t.offset;if("element"===t.type){return pi(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?pi(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function mi(t){const e=Oi(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function xi(t,e,n){return function(t,e,n){const r=ei(t);for(let o=4;o>=0;o--)for(let i=0;i<r.length;i++){const s=r[i],l=s._commands.get(e);if(void 0!==l){const e=l[o];if(void 0!==e){const r=Array.from(e),o=r.length;let i=!1;if(Gr(s,(()=>{for(let e=0;e<o;e++)if(r[e](n,t))return void(i=!0)})),i)return i}}}return!1}(t,e,n)}function Ci(t){return!oo(t)&&!t.isLastChild()&&!t.isInline()}function Si(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function Ni(t){const e=t.assignedSlot||t.parentElement;return $i(e)?e.host:e}function Ti(t){return Fo(t)?t:Bi(t)?t.ownerDocument:null}function vi(t){Ir();Rr()._updateTags.add(t)}function ki(t){Ir();Rr()._deferred.push(t)}function Ei(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function bi(t){const e=Ti(t);return e?e.defaultView:null}function Oi(e){const n=e._window;return null===n&&t(78),n}function Mi(t){let e=t.getParentOrThrow();for(;null!==e;){if(Ai(e))return e;e=e.getParentOrThrow()}return e}function Ai(t){return oo(t)||Zr(t)&&t.isShadowRoot()}function wi(t){const e=t.constructor.clone(t);return Bo(e,null),e.afterCloneFrom(t),e}function Di(e){const n=Rr(),r=e.getType(),o=ko(n,r);void 0===o&&t(200,e.constructor.name,r);const{replace:i,replaceWithKlass:s}=o;if(null!==i){const n=i(e),o=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),o.name,o.getType(),e.constructor.name,r):n instanceof e.constructor&&o!==e.constructor||t(202,o.name,o.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,o.name,o.getType()),n}return e}function Pi(e,n){!oo(e.getParent())||Zr(n)||no(n)||t(99)}function Ii(e){const n=Jo(e);return null===n&&t(63,e),n}function Li(t){return(no(t)||Zr(t)&&!t.canBeEmpty())&&!t.isInline()}function Fi(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function Ri(t){return n?(t||window).getSelection():null}function Ki(t){const e=bi(t);return e?e.getSelection():null}function Bi(t){return zi(t)&&t.nodeType===g}function zi(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function $i(t){return zi(t)&&t.nodeType===y}function Wi(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function Ui(t){const 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 null!==t.nodeName.match(e)}function Ji(t){if(no(t)&&!t.isInline())return!0;if(!Zr(t)||Ai(t))return!1;const e=t.getFirstChild(),n=null===e||En(e)||Jn(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Yi(){return Rr()}const ji=new WeakMap,Hi=new Map;function Vi(e){if(!e._readOnly&&e.isEmpty())return Hi;e._readOnly||t(192);let n=ji.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let o=e.get(t);o||(o=new Map,e.set(t,o)),o.set(n,r)}return e}(e),ji.set(e,n)),n}function Gi(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function qi(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r)}function Xi(t){return!0===t.__lexicalUnmanaged}function Qi(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==Nn[e]}function Zi(e){const n=U in e.prototype?e.prototype[U]():void 0,r=function(e){if(!(e===Nn||e.prototype instanceof Nn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{Co.version&&(r=JSON.parse(Co.version))}catch(t){}t(290,e.name,n,r)}return e===eo||e===Qr||e===Nn}(e),o=!r&&Qi(e,"getType")?e.getType():void 0;let i,s=o;if(n)if(o)i=n[o];else for(const[t,e]of Object.entries(n))s=t,i=e;if(!r&&s&&(Qi(e,"getType")||(e.getType=()=>s),Qi(e,"clone")||(e.clone=t=>(No(t),new e)),Qi(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Qi(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const ts=(t,e)=>{let n=t;for(;null!=n&&!oo(n);){if(e(n))return n;n=n.getParent()}return null},es={next:"previous",previous:"next"};class ns{origin;constructor(t){this.origin=t}[Symbol.iterator](){return bs({hasNext:us,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return _s(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return _s(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let t=i.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e)}for(const e of o){if(l.size>0){const n=i.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||i.origin.is(e));else{const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e)}else null===n&&t(263,Array.from(l).join(" "))}else i.insert(e);i=_s(e,this.direction)}for(const t of l.values())t.remove();return this}}class rs extends ns{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:xs(t,this.direction)}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=is(this.direction);return _s(this.getNodeAtCaret(),t)||xs(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof rs&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const os={root:oo,shadowRoot:Ai};function is(t){return es[t]}function ss(t,e="root"){return os[e](t)?null:t}class ls extends ns{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:_s(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Zr(this.origin)?xs(this.origin,this.direction):null}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=is(this.direction);return _s(this.getNodeAtCaret(),t)||xs(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof ls&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof ls||t instanceof cs)&&this.direction===t.direction&&this.origin.is(t.origin)}}class cs extends ns{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ps(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ps(this.origin,is(this.direction),this.offset)}isSamePointCaret(t){return t instanceof cs&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ls||t instanceof cs)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return _s(this.origin,this.direction)}}function as(t){return t instanceof cs}function us(t){return t instanceof ls}function fs(t){return t instanceof rs}const ds={next:class extends cs{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends cs{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},hs={next:class extends ls{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ls{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},gs={next:class extends rs{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends rs{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function _s(t,e){return t?new hs[e](t):null}function ps(t,e,n){return t?new ds[e](t,ys(t,n)):null}function ys(t,n,r="error"){const o=t.getTextContentSize();let i="next"===n?o:"previous"===n?0:n;return(i<0||i>o)&&("clamp"!==r&&e(284,String(n),String(o),t.getKey()),i=i<0?0:o),i}function ms(t,e){return new Ts(t,e)}function xs(t,e){return Zr(t)?new gs[e](t):null}function Cs(t){return t&&t.getChildCaret()||t}function Ss(t){return t&&Cs(t.getAdjacentCaret())}class Ns{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new Ns(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return as(e)?function(t,e){const{direction:n,origin:r}=t,o=ys(r,"focus"===e?is(n):n);return ms(t,o-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return[ms(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=as(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=as(n),o=e=>e.isSameNodeCaret(n)?null:Ss(e)||e.getParentCaret(t);return bs({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:o(e),map:t=>t,step:o})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Ts{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),o=t.getTextContent();return ps(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function vs(t){return Es(t,_s(qo(),t.direction))}function ks(t){return Es(t,t)}function Es(e,n){return e.direction!==n.direction&&t(265),new Ns(e,n,e.direction)}function bs(t){const{initial:e,hasNext:n,step:r,map:o}=t;let i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};const t={done:!1,value:o(i)};return i=r(i),t}}}function Os(e,n){const r=Ds(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case"same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===n.type?1:-1;case"branch":return Ms(r)}}function Ms(t){const{a:e,b:n}=t,r=e.__key,o=n.__key;let i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===o)return-1;if(s.__key===r)return 1}return null===i?1:-1}function As(t,e){return e.is(t)}function ws(t){return Zr(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ds(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=ws(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=ws(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(As(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(As(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((Zr(s)||As(e,s))&&(Zr(i)||As(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function Ps(e,n){const{type:r,key:o,offset:i}=e,s=Ii(e.key);return"text"===r?(Jn(s)||t(266,s.getType(),o),ps(s,n,i)):(Zr(s)||t(267,s.getType(),o),js(s,e.offset,n))}function Is(e,n){const{origin:r,direction:o}=n,i="next"===o;as(n)?e.set(r.getKey(),n.offset,"text"):us(n)?Jn(r)?e.set(r.getKey(),ys(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(fs(n)&&Zr(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Ls(t){const e=pr(),n=tr(e)?e:hr();return Fs(n,t),Qo(n),n}function Fs(t,e){Is(t.anchor,e.anchor),Is(t.focus,e.focus)}function Rs(t){const{anchor:e,focus:n}=t,r=Ps(e,"next"),o=Ps(n,"next"),i=Os(r,o)<=0?"next":"previous";return Es(Js(r,i),Js(o,i))}function Ks(t){const{direction:e,origin:n}=t,r=_s(n,is(e)).getNodeAtCaret();return r?_s(r,e):xs(n.getParentOrThrow(),e)}function Bs(t,e="root"){const n=[t];for(let r=fs(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Ks(r));return n}function zs(t){return!!t&&t.origin.isAttached()}function $s(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=Ys(e,o),l=Bs(s.anchor,r),c=Bs(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(fs(t))a.add(t.origin.getKey());else if(us(t)){const{origin:e}=t;Zr(e)&&!a.has(e.getKey())||u.push(e)}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Ks(_s(e,o)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===i||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){i="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=Un(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=ps(n,o,e.offset)}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped())}}let f,d;for(const t of l)if(zs(t)){f=Ws(t);break}for(const t of c)if(zs(t)){d=Ws(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),o=e.getParentAtCaret();if(!r||!o)return null;const i=r.getParents().reverse();i.push(r);const s=o.getParents().reverse();s.push(o);const l=Math.min(i.length,s.length);let c;for(c=0;c<l&&i[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const o=t[r];if(Ai(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Ji),f=u&&a(s,(t=>n.has(t.getKey())&&Ji(t)));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;xs(t,"previous").splice(0,e.getChildren()),e.remove()}const g=[f,d,...l,...c].find(zs);if(g){return ks(Js(Ws(g),e.direction))}t(269,JSON.stringify(l.map((t=>t.origin.__key))))}function Ws(t){const e=function(t){let e=t;for(;fs(e);){const t=Ss(e);if(!fs(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Jn(e.origin))return as(e)?e:ps(e.origin,n,n);const r=e.getAdjacentCaret();return us(r)&&Jn(r.origin)?ps(r.origin,n,is(n)):e}function Us(t){return as(t)&&t.offset!==ys(t.origin,t.direction)}function Js(t,e){return t.direction===e?t:t.getFlipped()}function Ys(t,e){return t.direction===e?t:Es(Js(t.focus,e),Js(t.anchor,e))}function js(t,e,n){let r=xs(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Js(r,n)}function Hs(e){const{origin:n,offset:r,direction:o}=e;if(r===ys(n,o))return e.getSiblingCaret();if(r===ys(n,is(o)))return Ks(e.getSiblingCaret());const[i]=n.splitText(r);return Jn(i)||t(281),Js(_s(i,"next"),o)}function Vs(t,e){return!0}exports.$addUpdateTag=vi,exports.$applyNodeReplacement=Di,exports.$caretFromPoint=Ps,exports.$caretRangeFromSelection=Rs,exports.$cloneWithProperties=Gi,exports.$comparePointCaretNext=Os,exports.$copyNode=wi,exports.$create=function(t){const e=Yi();return Ir(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createLineBreakNode=kn,exports.$createNodeSelection=gr,exports.$createParagraphNode=yo,exports.$createPoint=qn,exports.$createRangeSelection=hr,exports.$createRangeSelectionFromDom=function(t,e){return _r(null,t,e,null)},exports.$createTabNode=Hn,exports.$createTextNode=Un,exports.$extendCaretToRange=vs,exports.$findMatchingParent=ts,exports.$getAdjacentChildCaret=Ss,exports.$getAdjacentNode=yi,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=Ss(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=Ss(r)}return o&&[o,n]},exports.$getCaretInDirection=Js,exports.$getCaretRange=Es,exports.$getCaretRangeInDirection=Ys,exports.$getCharacterOffsets=or,exports.$getChildCaret=xs,exports.$getChildCaretAtIndex=js,exports.$getChildCaretOrSelf=Cs,exports.$getCollapsedCaretRange=ks,exports.$getCommonAncestor=Ds,exports.$getCommonAncestorResultBranchOrder=Ms,exports.$getEditor=Yi,exports.$getNearestNodeFromDOMNode=Ho,exports.$getNearestRootOrShadowRoot=Mi,exports.$getNodeByKey=Jo,exports.$getNodeByKeyOrThrow=Ii,exports.$getNodeFromDOMNode=Yo,exports.$getPreviousSelection=yr,exports.$getRoot=qo,exports.$getSelection=pr,exports.$getSiblingCaret=_s,exports.$getState=rt,exports.$getStateChange=function(t,e,n){const r=rt(t,n,"direct"),o=rt(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=pr();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=ys,exports.$getTextPointCaret=ps,exports.$getTextPointCaretSlice=ms,exports.$getWritableNodeState=st,exports.$hasAncestor=Ei,exports.$hasUpdateTag=function(t){return Rr()._updateTags.has(t)},exports.$insertNodes=function(t){let e=pr()||yr();null===e&&(e=qo().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=function(t){return Zr(t)&&!t.isInline()},exports.$isChildCaret=fs,exports.$isDecoratorNode=no,exports.$isEditorState=function(t){return t instanceof co},exports.$isElementNode=Zr,exports.$isExtendableTextPointCaret=Us,exports.$isInlineElementOrDecoratorNode=function(t){return Zr(t)&&t.isInline()||no(t)&&t.isInline()},exports.$isLeafNode=function(t){return Jn(t)||En(t)||no(t)},exports.$isLineBreakNode=En,exports.$isNodeCaret=function(t){return t instanceof ns},exports.$isNodeSelection=nr,exports.$isParagraphNode=mo,exports.$isRangeSelection=tr,exports.$isRootNode=oo,exports.$isRootOrShadowRoot=Ai,exports.$isSiblingCaret=us,exports.$isTabNode=Vn,exports.$isTextNode=Jn,exports.$isTextPointCaret=as,exports.$isTextPointCaretSlice=function(t){return t instanceof Ts},exports.$isTokenOrSegmented=Io,exports.$isTokenOrTab=Po,exports.$nodesOfType=function(t){const e=t.getType(),n=Fr();if(n._readOnly){const t=Vi(n).get(e);return t?Array.from(t.values()):[]}const r=n._nodeMap,o=[];for(const[,n]of r)n instanceof t&&n.__type===e&&n.isAttached()&&o.push(n);return o},exports.$normalizeCaret=Ws,exports.$normalizeSelection__EXPERIMENTAL=pt,exports.$onUpdate=ki,exports.$parseSerializedNode=function(t){return Ur(t,Rr()._nodes)},exports.$removeTextFromCaretRange=$s,exports.$rewindSiblingCaret=Ks,exports.$selectAll=function(t){const e=qo();if(tr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),pt(t),t}{const t=e.select(0,e.getChildrenSize());return Qo(pt(t)),t}},exports.$setCompositionKey=Wo,exports.$setPointFromCaret=Is,exports.$setSelection=Qo,exports.$setSelectionFromCaretRange=Ls,exports.$setState=function(t,e,n){let r;if(Ir(),"function"==typeof n){const o=t.getLatest(),i=rt(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return st(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=wi,$splitTextPointCaretNext:n=Hs,rootMode:r="shadowRoot",$shouldSplit:o=Vs}={}){if(as(t))return n(t);const i=t.getParentCaret(r);if(i){const{origin:n}=i;if(fs(t)&&(!n.canBeEmpty()||!o(n,"first")))return Ks(i);const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||n.canBeEmpty()&&o(n,"last"))&&i.insert(e(n).splice(0,0,r))}return i},exports.$splitNode=function(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Ai(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=Ai(n),s=e!==r||i?wi(e):e;if(i)return Zr(e)&&Zr(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,i]=o(n),l=e.getNextSiblings();return i.append(s,...l),[t,r,s]}},[i,s]=o(r);return[i,s]},exports.$updateRangeSelectionFromCaretRange=Fs,exports.ArtificialNode__DO_NOT_USE=go,exports.BLUR_COMMAND=We,exports.CAN_REDO_COMMAND=Be,exports.CAN_UNDO_COMMAND=ze,exports.CLEAR_EDITOR_COMMAND=Re,exports.CLEAR_HISTORY_COMMAND=Ke,exports.CLICK_COMMAND=ee,exports.COLLABORATION_TAG=uo,exports.COMMAND_PRIORITY_CRITICAL=4,exports.COMMAND_PRIORITY_EDITOR=0,exports.COMMAND_PRIORITY_HIGH=3,exports.COMMAND_PRIORITY_LOW=1,exports.COMMAND_PRIORITY_NORMAL=2,exports.CONTROLLED_TEXT_INSERTION_COMMAND=ie,exports.COPY_COMMAND=Ie,exports.CUT_COMMAND=Le,exports.DELETE_CHARACTER_COMMAND=ne,exports.DELETE_LINE_COMMAND=ae,exports.DELETE_WORD_COMMAND=ce,exports.DRAGEND_COMMAND=Pe,exports.DRAGOVER_COMMAND=De,exports.DRAGSTART_COMMAND=we,exports.DROP_COMMAND=Me,exports.DecoratorNode=eo,exports.ElementNode=Qr,exports.FOCUS_COMMAND=$e,exports.FORMAT_ELEMENT_COMMAND=Ae,exports.FORMAT_TEXT_COMMAND=ue,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=ao,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=be,exports.INSERT_LINE_BREAK_COMMAND=re,exports.INSERT_PARAGRAPH_COMMAND=oe,exports.INSERT_TAB_COMMAND=Ee,exports.INTERNAL_$isBlock=Ji,exports.IS_ALL_FORMATTING=b,exports.IS_BOLD=1,exports.IS_CODE=16,exports.IS_HIGHLIGHT=E,exports.IS_ITALIC=2,exports.IS_STRIKETHROUGH=v,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=k,exports.KEY_ARROW_DOWN_COMMAND=xe,exports.KEY_ARROW_LEFT_COMMAND=pe,exports.KEY_ARROW_RIGHT_COMMAND=ge,exports.KEY_ARROW_UP_COMMAND=me,exports.KEY_BACKSPACE_COMMAND=Ne,exports.KEY_DELETE_COMMAND=ve,exports.KEY_DOWN_COMMAND=he,exports.KEY_ENTER_COMMAND=Ce,exports.KEY_ESCAPE_COMMAND=Te,exports.KEY_MODIFIER_COMMAND=Ue,exports.KEY_SPACE_COMMAND=Se,exports.KEY_TAB_COMMAND=ke,exports.LineBreakNode=Tn,exports.MOVE_TO_END=_e,exports.MOVE_TO_START=ye,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=Oe,exports.PASTE_COMMAND=se,exports.PASTE_TAG="paste",exports.ParagraphNode=_o,exports.REDO_COMMAND=de,exports.REMOVE_TEXT_COMMAND=le,exports.RootNode=ro,exports.SELECTION_CHANGE_COMMAND=Zt,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=te,exports.SELECT_ALL_COMMAND=Fe,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=ho,exports.SKIP_SCROLL_INTO_VIEW_TAG=fo,exports.TEXT_TYPE_TO_FORMAT=R,exports.TabNode=jn,exports.TextNode=In,exports.UNDO_COMMAND=fe,exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=Qt,exports.createEditor=function(t){const e=t||{},n=Br(),r=e.theme||{},o=void 0===t?n:e.parentEditor||null,i=e.disableEvents||!1,s=so(),l=e.namespace||(null!==o?o._config.namespace:ni()),c=e.editorState,a=[ro,In,Tn,jn,_o,go,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else{h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null}const{ownNodeConfig:o}=Zi(e),i=e.getType(),s=e.transform(),l=new Set;o&&o.$transform&&l.add(o.$transform),null!==s&&l.add(s),h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:ot(a[t]),transforms:l})}}const g=new Co(s,o,h,{disableEvents:i,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,o=t=>{Object.keys(t).forEach((e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e])}))};return t.forEach((t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&o(n)})),e&&o(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=C),g},exports.createSharedNodeState=ot,exports.createState=function(t,e){return new nt(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=is,exports.getDOMOwnerDocument=Ti,exports.getDOMSelection=Ri,exports.getDOMSelectionFromTarget=Ki,exports.getDOMTextNode=Ro,exports.getEditorPropertyFromDOMNode=Do,exports.getNearestEditorFromDOMNode=wo,exports.getRegisteredNode=ko,exports.getRegisteredNodeOrThrow=vo,exports.getStaticNodeConfig=Zi,exports.isBlockDomNode=Ui,exports.isCurrentlyReadOnlyMode=Pr,exports.isDOMDocumentNode=Fo,exports.isDOMNode=zi,exports.isDOMTextNode=Lo,exports.isDOMUnmanaged=Xi,exports.isDocumentFragment=$i,exports.isExactShortcutMatch=ai,exports.isHTMLAnchorElement=function(t){return Bi(t)&&"A"===t.tagName},exports.isHTMLElement=Bi,exports.isInlineDomNode=Wi,exports.isLexicalEditor=Ao,exports.isModifierMatch=ci,exports.isSelectionCapturedInDecoratorInput=Oo,exports.isSelectionWithinEditor=Mo,exports.makeStepwiseIterator=bs,exports.removeFromParent=zo,exports.resetRandomKey=function(){To=1},exports.safeCast=function(t){return t},exports.setDOMUnmanaged=function(t){t.__lexicalUnmanaged=!0},exports.setNodeIndentFromDOM=qi,exports.shallowMergeConfig=function(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t};
9
+ "use strict";function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,o=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&o&&!u;function h(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const g=1,_=3,p=9,y=11,m=0,x=1,C=2,S=0,N=1,T=2,v=4,k=8,E=128,b=1792|(112|(3|v|k)|E),O=1,M=2,A=3,w=4,D=5,P=6,I=l||c||d?" ":"​",L="\n\n",F=i?" ":I,R={bold:1,capitalize:1024,code:16,highlight:E,italic:2,lowercase:256,strikethrough:v,subscript:32,superscript:64,underline:k,uppercase:512},K={directionless:1,unmergeable:2},B={center:M,end:P,justify:w,left:O,right:A,start:D},z={[M]:"center",[P]:"end",[w]:"justify",[O]:"left",[A]:"right",[D]:"start"},$={normal:0,segmented:2,token:1},W={[S]:"normal",[T]:"segmented",[N]:"token"},U="$config";function J(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Zr(s)&&J(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}const Y=100;let j=!1,H=0;function V(t){H=t.timeStamp}function G(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==jo(t,n)}function q(t,e,n){const r=Ri(Oi(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&ii(e,s,o,i,!1)}function X(t,e,n){if(tr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return Lo(e)&&n.isAttached()}function Q(t,e,n,r){for(let o=t;o&&!Xi(o);o=Ni(o)){const t=jo(o,e);if(void 0!==t){const e=Jo(t,n);if(e)return no(e)||!Bi(o)?void 0:[o,e]}else if(o===r)return[r,Xo(n)]}}function Z(t,e,n){j=!0;const r=performance.now()-H>Y;try{Gr(t,(()=>{const o=pr()||function(t){return t.getEditorState().read((()=>{const t=pr();return null!==t?t.clone():null}))}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=Q(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Jn(y)&&Lo(g)&&X(o,g,y)&&q(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],o=Yo(r),s=r.parentNode;if(null!=s&&r!==a&&null===o&&!G(r,s,t)){if(i){const t=(Bi(r)?r.innerText:null)||r.nodeValue;t&&(f+=t)}s.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let o=0;o<r;o++){const r=n[o];(G(r,g,t)||a===r)&&(g.appendChild(r),e++)}r!==e&&s.set(p,y)}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,o=n.target;for(let e=0;e<r.length;e++){const n=r[e],i=n.parentNode;null==i||"BR"!==n.nodeName||G(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(u&&Qo(o),i&&mi(t)&&o.insertRawText(f))}))}finally{j=!1}}function tt(t){const e=t._observer;if(null!==e){Z(t,e.takeRecords(),e)}}function et(t){!function(t){0===H&&Oi(t).addEventListener("textInput",V,!0)}(t),t._observer=new MutationObserver(((e,n)=>{Z(t,e,n)}))}class nt{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||at).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0)}}function rt(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function ot(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Zi(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t)}}return{flatKeys:n,sharedConfigMap:e}}class it{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,o=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:i}=this.sharedNodeState,s=void 0!==o?o:function(t,e,n){let r=n.size;if(e)for(const o in e){const e=t.get(o);e&&n.has(e)||r++}return r}(i,n,r);this.size=s}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return ct(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new it(t,e,function(t,e,n){let r;if(n)for(const[o,i]of Object.entries(n)){const n=t.get(o);n?e.has(n)||e.set(n,n.parse(i)):(r=r||{},r[o]=i)}return r}(e.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:o}=this;r.has(t)||o&&n in o||(o&&(delete o[n],this.unknownState=ct(o)),this.size++),r.set(t,e)}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n)}}function st(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new it(e,lt(e));return e.__state=n,n}function lt(t){return t.__state?t.__state.sharedNodeState:vo(Yi(),t.getType()).sharedNodeState}function ct(t){if(t)for(const e in t)return t}function at(t){return t}function ut(t,e,n){for(const[r,o]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==o&&!r.isEqual(e,o))return!0}return!1}function ft(t,e,n){const{unknownState:r}=e,o=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(o?o[e]:void 0))return!0}return!1}function dt(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function ht(t,e){const n=t.__mode,r=t.__format,o=t.__style,i=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return(null===n||n===i)&&(null===r||r===s)&&(null===o||o===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return!0;if(t&&e&&t.size!==e.size)return!1;const n=new Set;return!(t&&ut(n,t,e)||e&&ut(n,e,t)||t&&ft(n,t,e)||e&&ft(n,e,t))}(c,a))}function gt(t,e){const n=t.mergeWithSibling(e),r=Rr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function _t(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Jn(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(ht(e,r)){r=gt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Jn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(ht(r,n)){r=gt(r,n);break}break}n.remove()}}else r.remove()}function pt(t){return yt(t.anchor),yt(t.focus),t}function yt(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,o;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),o=!0):(r=e.getChildAtIndex(n),o=!1),Jn(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!Zr(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}let mt,xt,Ct,St,Nt,Tt,vt,kt,Et,bt,Ot="",Mt=null,At="",wt="",Dt=!1,Pt=!1;function It(t,e){const n=vt.get(t);if(null!==e){const n=Xt(t);n.parentNode===e&&e.removeChild(n)}if(kt.has(t)||xt._keyToDOMMap.delete(t),Zr(n)){const t=jt(n,vt);Lt(t,0,t.length-1,null)}void 0!==n&&_i(bt,Ct,St,n,"destroyed")}function Lt(t,e,n,r){let o=e;for(;o<=n;++o){const e=t[o];void 0!==e&&It(e,r)}}function Ft(t,e){t.setProperty("text-align",e)}const Rt="40px";function Kt(t,e){const n=mt.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||Rt;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`)}function Bt(t,e){const n=t.style;0===e?Ft(n,""):e===O?Ft(n,"left"):e===M?Ft(n,"center"):e===A?Ft(n,"right"):e===w?Ft(n,"justify"):e===D?Ft(n,"start"):e===P&&Ft(n,"end")}function zt(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(oo(t))return null;const n=t.getParentOrThrow();return oo(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function $t(e,n){const r=kt.get(e);void 0===r&&t(60);const o=r.createDOM(mt,xt);if(function(t,e,n){const r=n._keyToDOMMap;(function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n})(e,n,t),r.set(t,e)}(e,o,xt),Jn(r)?o.setAttribute("data-lexical-text","true"):no(r)&&o.setAttribute("data-lexical-decorator","true"),Zr(r)){const t=r.__indent,e=r.__size;if(zt(o,r),0!==t&&Kt(o,t),0!==e){const t=e-1;Wt(jt(r,kt),r,0,t,r.getDOMSlot(o))}const n=r.__format;0!==n&&Bt(o,n),r.isInline()||Jt(null,r,o),Ci(r)&&(Ot+=L,wt+=L)}else{const t=r.getTextContent();if(no(r)){const t=r.decorate(xt,mt);null!==t&&Vt(e,t),o.contentEditable="false"}Ot+=t,wt+=t}return null!==n&&n.insertChild(o),_i(bt,Ct,St,r,"created"),o}function Wt(t,e,n,r,o){const i=Ot;Ot="";let s=n;for(;s<=r;++s){$t(t[s],o);const e=kt.get(t[s]);null!==e&&Jn(e)&&(null===Mt&&(Mt=e.getFormat()),""===At&&(At=e.getStyle()))}Ci(e)&&(Ot+=L);o.element.__lexicalTextContent=Ot,Ot=i+Ot}function Ut(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return En(t)?"line-break":no(t)&&t.isInline()?"decorator":null}return"empty"}return null}function Jt(t,e,n){const r=Ut(t,vt),o=Ut(e,kt);r!==o&&e.getDOMSlot(n).setManagedLineBreak(o)}function Yt(e,n,r){var o;Mt=null,At="",function(e,n,r){const o=Ot,i=e.__size,s=n.__size;Ot="";const l=r.element;if(1===i&&1===s){const t=e.__first,r=n.__first;if(t===r)Ht(t,l);else{const e=Xt(t),n=$t(r,null);try{l.replaceChild(n,e)}catch(o){if("object"==typeof o&&null!=o){const i=`${o.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(i)}throw o}It(t,null)}const o=kt.get(r);Jn(o)&&(null===Mt&&(Mt=o.getFormat()),""===At&&(At=o.getStyle()))}else{const o=jt(e,vt),c=jt(n,kt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&Wt(c,n,0,s-1,r);else if(0===s){if(0!==i){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Lt(o,0,i-1,t?null:l),t&&(l.textContent="")}}else!function(t,e,n,r,o,i){const s=r-1,l=o-1;let c,a,u=i.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=Gt(Ht(r,i.element)),f++,d++;else{void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const o=a.has(t),s=c.has(r);if(o)if(s){const t=Si(xt,r);t===u?u=Gt(Ht(r,i.element)):(i.withBefore(u).insertChild(t),Ht(r,i.element)),f++,d++}else $t(r,i.withBefore(u)),d++;else u=Gt(Xt(t)),It(t,i.element),f++}const o=kt.get(r);null!==o&&Jn(o)&&(null===Mt&&(Mt=o.getFormat()),""===At&&(At=o.getStyle()))}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:xt.getElementByKey(e);Wt(n,t,d,l,i.withBefore(r))}else g&&!h&&Lt(e,f,s,i.element)}(n,o,c,i,s,r)}Ci(n)&&(Ot+=L);l.__lexicalTextContent=Ot,Ot=o+Ot}(e,n,n.getDOMSlot(r)),o=n,null==Mt||Mt===o.__textFormat||Pt||o.setTextFormat(Mt),function(t){""===At||At===t.__textStyle||Pt||t.setTextStyle(At)}(n)}function jt(e,n){const r=[];let o=e.__first;for(;null!==o;){const e=n.get(o);void 0===e&&t(101),r.push(o),o=e.__next}return r}function Ht(e,n){const r=vt.get(e);let o=kt.get(e);void 0!==r&&void 0!==o||t(61);const i=Dt||Tt.has(e)||Nt.has(e),s=Si(xt,e);if(r===o&&!i){if(Zr(r)){const t=s.__lexicalTextContent;void 0!==t&&(Ot+=t,wt+=t)}else{const t=r.getTextContent();wt+=t,Ot+=t}return s}if(r!==o&&i&&_i(bt,Ct,St,o,"updated"),o.updateDOM(r,s,mt)){const r=$t(e,null);return null===n&&t(62),n.replaceChild(r,s),It(e,null),r}if(Zr(r)&&Zr(o)){const t=o.__indent;(Dt||t!==r.__indent)&&Kt(s,t);const e=o.__format;if((Dt||e!==r.__format)&&Bt(s,e),i&&(Yt(r,o,s),oo(o)||o.isInline()||Jt(r,o,s)),Ci(o)&&(Ot+=L,wt+=L),(Dt||o.__dir!==r.__dir)&&(zt(s,o),oo(o)&&!Dt))for(const t of o.getChildren())if(Zr(t)){zt(Si(xt,t.getKey()),t)}}else{const t=o.getTextContent();if(no(o)){const t=o.decorate(xt,mt);null!==t&&Vt(e,t)}Ot+=t,wt+=t}if(!Pt&&oo(o)&&o.__cachedText!==wt){const t=o.getWritable();t.__cachedText=wt,o=t}return s}function Vt(t,e){let n=xt._pendingDecorators;const r=xt._decorators;if(null===n){if(r[t]===e)return;n=Vo(xt)}n[t]=e}function Gt(t){let e=t.nextSibling;return null!==e&&e===xt._blockCursorElement&&(e=e.nextSibling),e}function qt(t,e,n,r,o,i){Ot="",wt="",Dt=r===C,xt=n,mt=n._config,Ct=n._nodes,St=xt._listeners.mutation,Nt=o,Tt=i,vt=t._nodeMap,kt=e._nodeMap,Pt=e._readOnly,Et=new Map(n._keyToDOMMap);const s=new Map;return bt=s,Ht("root",null),xt=void 0,Ct=void 0,Nt=void 0,Tt=void 0,vt=void 0,kt=void 0,mt=void 0,Et=void 0,bt=void 0,s}function Xt(e){const n=Et.get(e);return void 0===n&&t(75,e),n}function Qt(t){return{type:t}}const Zt=Qt("SELECTION_CHANGE_COMMAND"),te=Qt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ee=Qt("CLICK_COMMAND"),ne=Qt("DELETE_CHARACTER_COMMAND"),re=Qt("INSERT_LINE_BREAK_COMMAND"),oe=Qt("INSERT_PARAGRAPH_COMMAND"),ie=Qt("CONTROLLED_TEXT_INSERTION_COMMAND"),se=Qt("PASTE_COMMAND"),le=Qt("REMOVE_TEXT_COMMAND"),ce=Qt("DELETE_WORD_COMMAND"),ae=Qt("DELETE_LINE_COMMAND"),ue=Qt("FORMAT_TEXT_COMMAND"),fe=Qt("UNDO_COMMAND"),de=Qt("REDO_COMMAND"),he=Qt("KEYDOWN_COMMAND"),ge=Qt("KEY_ARROW_RIGHT_COMMAND"),_e=Qt("MOVE_TO_END"),pe=Qt("KEY_ARROW_LEFT_COMMAND"),ye=Qt("MOVE_TO_START"),me=Qt("KEY_ARROW_UP_COMMAND"),xe=Qt("KEY_ARROW_DOWN_COMMAND"),Ce=Qt("KEY_ENTER_COMMAND"),Se=Qt("KEY_SPACE_COMMAND"),Ne=Qt("KEY_BACKSPACE_COMMAND"),Te=Qt("KEY_ESCAPE_COMMAND"),ve=Qt("KEY_DELETE_COMMAND"),ke=Qt("KEY_TAB_COMMAND"),Ee=Qt("INSERT_TAB_COMMAND"),be=Qt("INDENT_CONTENT_COMMAND"),Oe=Qt("OUTDENT_CONTENT_COMMAND"),Me=Qt("DROP_COMMAND"),Ae=Qt("FORMAT_ELEMENT_COMMAND"),we=Qt("DRAGSTART_COMMAND"),De=Qt("DRAGOVER_COMMAND"),Pe=Qt("DRAGEND_COMMAND"),Ie=Qt("COPY_COMMAND"),Le=Qt("CUT_COMMAND"),Fe=Qt("SELECT_ALL_COMMAND"),Re=Qt("CLEAR_EDITOR_COMMAND"),Ke=Qt("CLEAR_HISTORY_COMMAND"),Be=Qt("CAN_REDO_COMMAND"),ze=Qt("CAN_UNDO_COMMAND"),$e=Qt("FOCUS_COMMAND"),We=Qt("BLUR_COMMAND"),Ue=Qt("KEY_MODIFIER_COMMAND"),Je=Object.freeze({}),Ye=30,je=[["keydown",function(t,e){if(He=t.timeStamp,Ve=t.key,e.isComposing())return;if(xi(e,he,t))return;if(null==t.key)return;if(nn&&di(t))return Gr(e,(()=>{hn(e,rn)})),nn=!1,void(rn="");if(function(t){return ai(t,"ArrowRight",{shiftKey:"any"})}(t))xi(e,ge,t);else if(function(t){return ai(t,"ArrowRight",ui)}(t))xi(e,_e,t);else if(function(t){return ai(t,"ArrowLeft",{shiftKey:"any"})}(t))xi(e,pe,t);else if(function(t){return ai(t,"ArrowLeft",ui)}(t))xi(e,ye,t);else if(function(t){return ai(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))xi(e,me,t);else if(function(t){return ai(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))xi(e,xe,t);else if(function(t){return ai(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))tn=!0,xi(e,Ce,t);else if(function(t){return" "===t.key}(t))xi(e,Se,t);else if(function(t){return o&&ai(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),tn=!0,xi(e,re,!0);else if(function(t){return ai(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))tn=!1,xi(e,Ce,t);else if(function(t){return ai(t,"Backspace",{shiftKey:"any"})||o&&ai(t,"h",{ctrlKey:!0})}(t))di(t)?xi(e,Ne,t):(t.preventDefault(),xi(e,ne,!0));else if(function(t){return"Escape"===t.key}(t))xi(e,Te,t);else if(function(t){return ai(t,"Delete",{})||o&&ai(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),xi(e,ne,!1)):xi(e,ve,t);else if(function(t){return ai(t,"Backspace",fi)}(t))t.preventDefault(),xi(e,ce,!0);else if(function(t){return ai(t,"Delete",fi)}(t))t.preventDefault(),xi(e,ce,!1);else if(function(t){return o&&ai(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),xi(e,ae,!0);else if(function(t){return o&&(ai(t,"Delete",{metaKey:!0})||ai(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),xi(e,ae,!1);else if(function(t){return ai(t,"b",ui)}(t))t.preventDefault(),xi(e,ue,"bold");else if(function(t){return ai(t,"u",ui)}(t))t.preventDefault(),xi(e,ue,"underline");else if(function(t){return ai(t,"i",ui)}(t))t.preventDefault(),xi(e,ue,"italic");else if(function(t){return ai(t,"Tab",{shiftKey:"any"})}(t))xi(e,ke,t);else if(function(t){return ai(t,"z",ui)}(t))t.preventDefault(),xi(e,fe,void 0);else if(function(t){if(o)return ai(t,"z",{metaKey:!0,shiftKey:!0});return ai(t,"y",{ctrlKey:!0})||ai(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),xi(e,de,void 0);else{const n=e._editorState._selection;null===n||tr(n)?hi(t)&&(t.preventDefault(),xi(e,Fe,t)):!function(t){return ai(t,"c",ui)}(t)?!function(t){return ai(t,"x",ui)}(t)?hi(t)&&(t.preventDefault(),xi(e,Fe,t)):(t.preventDefault(),xi(e,Le,t)):(t.preventDefault(),xi(e,Ie,t))}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&xi(e,Ue,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;zi(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Gr(e,(()=>{bo(n)||(Ze=!0)}))}],["compositionstart",function(t,e){Gr(e,(()=>{const n=pr();if(tr(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Wo(r.key),(t.timeStamp<He+Ye||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||Jn(o)&&o.getStyle()!==n.style)&&xi(e,ie,F)}}))}],["compositionend",function(t,e){i?en=!0:c||!l&&!d?Gr(e,(()=>{hn(e,t.data)})):(nn=!0,rn=t.data)}],["input",function(t,e){t.stopPropagation(),Gr(e,(()=>{if(Bi(t.target)&&bo(t.target))return;const n=pr(),r=t.data,o=dn(t);if(null!=r&&tr(n)&&ln(n,o,r,t.timeStamp,!1)){en&&(hn(e,r),en=!1);const o=n.anchor.getNode(),a=Ri(Oi(e));if(null===a)return;const u=n.isBackward(),f=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Jn(o)&&null!==a.anchorNode&&o.getTextContent().slice(0,f)+r+o.getTextContent().slice(f+h)===ri(a.anchorNode)||xi(e,ie,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(He=0,Wo(null))}else{oi(!1,e,null!==r?r:void 0),en&&(hn(e,r||void 0),en=!1)}!function(){Ir();const t=Rr();tt(t)}()}),{event:t}),qe=null}],["click",function(t,e){Gr(e,(()=>{const n=pr(),r=Ri(Oi(e)),o=yr();if(r)if(tr(n)){const e=n.anchor,i=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!oo(i)&&1===qo().getChildrenSize()&&i.getTopLevelElementOrThrow().isEmpty()&&null!==o&&n.is(o))r.removeAllRanges(),n.dirty=!0;else if(3===t.detail&&!n.isCollapsed()){if(i!==n.focus.getNode()){const t=ts(i,(t=>Zr(t)&&!t.isInline()));Zr(t)&&t.select(0)}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Bi(n)||Lo(n)){Qo(_r(o,r,e,t))}}xi(e,ee,t)}))}],["cut",Je],["copy",Je],["dragstart",Je],["dragover",Je],["dragend",Je],["paste",Je],["focus",Je],["blur",Je],["drop",Je]];s&&je.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,o=dn(e);if("deleteCompositionText"===r||i&&mi(n))return;if("insertCompositionText"===r)return;Gr(n,(()=>{const i=pr();if("deleteContentBackward"===r){if(null===i){const t=yr();if(!tr(t))return;Qo(t.clone())}if(tr(i)){const r=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===Ve&&s<He+Ye&&n.isComposing()&&r){if(Wo(null),He=0,setTimeout((()=>{Gr(n,(()=>{Wo(null)}))}),Ye),tr(i)){const e=i.anchor.getNode();e.markDirty(),Jn(e)||t(142),fn(i,e)}}else{Wo(null),e.preventDefault();const t=i.anchor.getNode(),o=t.getTextContent(),s=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let c=f&&r&&!l&&s;if(c&&i.isCollapsed()&&(c=!no(yi(i.anchor,!0))),!c){xi(n,ne,!0);const t=pr();f&&tr(t)&&t.isCollapsed()&&(on=t,setTimeout((()=>on=null)))}}return}}var s;if(!tr(i))return;const l=e.data;null!==qe&&oi(!1,n,qe),i.dirty&&null===qe||!i.isCollapsed()||oo(i.anchor.getNode())||null===o||i.applyDOMRange(o),qe=null;const a=i.anchor,u=i.focus,d=a.getNode(),h=u.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":xi(n,ie,e);break;case"insertFromComposition":Wo(null),xi(n,ie,e);break;case"insertLineBreak":Wo(null),xi(n,re,!1);break;case"insertParagraph":Wo(null),tn&&!c?(tn=!1,xi(n,re,!1)):xi(n,oe,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":xi(n,se,e);break;case"deleteByComposition":(function(t,e){return t!==e||Zr(t)||Zr(e)||!Po(t)||!Po(e)})(d,h)&&xi(n,le,e);break;case"deleteByDrag":case"deleteByCut":xi(n,le,e);break;case"deleteContent":xi(n,ne,!1);break;case"deleteWordBackward":xi(n,ce,!0);break;case"deleteWordForward":xi(n,ce,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":xi(n,ae,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":xi(n,ae,!1);break;case"formatStrikeThrough":xi(n,ue,"strikethrough");break;case"formatBold":xi(n,ue,"bold");break;case"formatItalic":xi(n,ue,"italic");break;case"formatUnderline":xi(n,ue,"underline");break;case"historyUndo":xi(n,fe,void 0);break;case"historyRedo":xi(n,de,void 0)}else{if("\n"===l)e.preventDefault(),xi(n,re,!1);else if(l===L)e.preventDefault(),xi(n,oe,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=l&&ln(i,o,l,e.timeStamp,!0)?(e.preventDefault(),xi(n,ie,l)):qe=l;Ge=e.timeStamp}}))}(e,n)]);let He=0,Ve=null,Ge=0,qe=null;const Xe=new WeakMap;let Qe=!1,Ze=!1,tn=!1,en=!1,nn=!1,rn="",on=null,sn=[0,"",0,"root",0];function ln(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=Rr(),u=Ri(Oi(a)),f=null!==u?u.anchorNode:null,d=i.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Jn(c)||(!o&&(!s||Ge<r+50)||c.isDirty()&&g<2||ti(n))&&i.offset!==l.offset&&!c.isComposing()||Io(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==Ro(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;const n=t.anchor.offset,r=e.getParentOrThrow(),o=Po(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||function(t){const e=t.getPreviousSibling();return(Jn(e)||Zr(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}(t,c)}function cn(t,e){return Lo(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function an(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;Qe&&(Qe=!1,cn(o,i)&&cn(s,l)&&!on)||Gr(n,(()=>{if(!r)return void Qo(null);if(!Mo(n,o,s))return;let c=pr();if(on&&tr(c)&&c.isCollapsed()){const t=c.anchor,e=on.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=on.clone(),Qo(c))}if(on=null,tr(c)){const r=c.anchor,o=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=Oi(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=sn,h=qo(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)un(c,l,a);else if("text"===r.type)Jn(o)||t(141),fn(c,o);else if("element"===r.type&&!g){Zr(o)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();un(t,n,r)}(c,e):un(c,0,"")}}else{const t=r.key,e=c.focus.key,n=c.getNodes(),o=n.length,s=c.isBackward(),a=s?l:i,u=s?i:l,f=s?e:t,d=s?t:e;let h=b,g=!1;for(let t=0;t<o;t++){const e=n[t],r=e.getTextContentSize();if(Jn(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===o-1&&e.__key===d&&0===u)&&(g=!0,h&=e.getFormat(),0===h))break}c.format=g?h:0}}xi(n,Zt,void 0)}))}function un(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function fn(t,e){un(t,e.getFormat(),e.getStyle())}function dn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function hn(t,e){const n=t._compositionKey;if(Wo(null),null!==n&&null!=e){if(""===e){const e=Jo(n),r=Ro(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&Jn(e)&&ii(e,r.nodeValue,null,null,!0))}if("\n"===e[e.length-1]){const e=pr();if(tr(e)){const n=e.focus;return e.anchor.set(n.key,n.offset,n.type),void xi(t,Ce,null)}}}oi(!0,t,e)}function gn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const _n=new Map;function pn(t){const e=Ki(t.target);if(null===e)return;const n=wo(e.anchorNode);if(null===n)return;Ze&&(Ze=!1,Gr(n,(()=>{const r=yr(),o=e.anchorNode;if(Bi(o)||Lo(o)){Qo(_r(r,e,n,t))}})));const r=ei(n),o=r[r.length-1],i=o._key,s=_n.get(i),l=s||o;l!==n&&an(e,l,!1),an(e,n,!0),n!==o?_n.set(i,n):s&&_n.delete(i)}function yn(t){t._lexicalHandled=!0}function mn(t){return!0===t._lexicalHandled}const xn=()=>{};function Cn(e){const n=e.ownerDocument,r=Xe.get(n);if(void 0===r)return void xn();const o=r-1;o>=0||t(164),Xe.set(n,o),0===o&&n.removeEventListener("selectionchange",pn);const i=Do(e);Ao(i)?(!function(t){if(null!==t._parentEditor){const e=ei(t),n=e[e.length-1]._key;_n.get(n)===t&&_n.delete(n)}else _n.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=gn(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function Sn(t,e,n){Ir();const r=t.__key,o=t.getParent();if(null===o)return;const i=function(t){const e=pr();if(!tr(e)||!Zr(t))return e;const{anchor:n,focus:r}=e,o=n.getNode(),i=r.getNode();Ei(o,t)&&n.set(t.__key,0,"element");Ei(i,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if(tr(i)&&e){const e=i.anchor,n=i.focus;e.key===r&&(Cr(e,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(Cr(n,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else nr(i)&&e&&t.isSelected()&&t.selectPrevious();if(tr(i)&&e&&!s){const e=t.getIndexWithinParent();zo(t),mr(i,o,e,-1)}else zo(t);n||Ai(o)||o.canBeEmpty()||!o.isEmpty()||Sn(o,e),e&&i&&oo(o)&&o.isEmpty()&&o.selectEnd()}class Nn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=Zi(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name)}$config(){return{}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Bo(this,t)}getType(){return this.__type}isInline(){t(137,this.constructor.name)}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return!0;const e=Jo(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||pr();if(null==e)return!1;const n=e.getNodes().some((t=>t.__key===this.__key));if(Jn(this))return n;if(tr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(no(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return-1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return null===t?null:Jo(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(Ai(n))return Zr(e)||e===this&&no(e)||t(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Jo(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Jo(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Zr(this)?this:this.getParent(),n=Zr(t)?t:t.getParent(),r=e&&n?Ds(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ds(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Ms(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ds(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],o=new Set;let i=this;for(;null!==i;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=Zr(i)?n?i.getFirstChild():i.getLastChild():null;if(null!==l){i=l;continue}const c=n?i.getNextSibling():i.getPreviousSibling();if(null!==c){i=c;continue}const a=i.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||o.has(f.__key)||r.push(f)}while(null===u);i=u}return n||r.reverse(),r}isDirty(){const t=Rr()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){const e=Jo(this.__key);return null===e&&t(113),e}getWritable(){Ir();const t=Fr(),e=Rr(),n=t._nodeMap,r=this.__key,o=this.getLatest(),i=e._cloneNotNeeded,s=pr();if(null!==s&&s.setCachedNodes(null),i.has(r))return $o(o),o;const l=Gi(o);return i.add(r),$o(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name)}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let o=r;for(const t of lt(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&st(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){Sn(this,!0,t)}replace(e,n){Ir();let r=pr();null!==r&&(r=r.clone()),Pi(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;zo(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,h=o.__next,g=o.__parent;if(Sn(o,!1,!0),null===u)c.__first=s;else{u.getWritable().__next=s}if(l.__prev=d,null===f)c.__last=s;else{f.getWritable().__prev=s}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Zr(this)&&Zr(l)||t(139),this.getChildren().forEach((t=>{l.append(t)}))),tr(r)){Qo(r);const t=r.anchor,e=r.focus;t.key===i&&Qn(t,l),e.key===i&&Qn(e,l)}return Uo()===i&&Wo(s),l}insertAfter(t,e=!0){Ir(),Pi(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.getParent(),i=pr();let s=!1,l=!1;if(null!==o){const e=t.getIndexWithinParent();if(zo(r),tr(i)){const t=o.__key,n=i.anchor,r=i.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else{c.getWritable().__prev=u}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&tr(i)){const t=this.getIndexWithinParent();mr(i,a,t+1);const e=a.__key;s&&i.anchor.set(e,t+2,"element"),l&&i.focus.set(e,t+2,"element")}return t}insertBefore(t,e=!0){Ir(),Pi(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key;zo(r);const i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===i)s.__first=o;else{i.getWritable().__next=o}s.__size++,n.__prev=o,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=pr();if(e&&tr(a)){mr(a,this.getParentOrThrow(),c)}return t}isParentRequired(){return!1}createParentElementNode(){return yo()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Ir();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Zr(n))return n.select();if(!Jn(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Ir();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Zr(n))return n.select(0,0);if(!Jn(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}class Tn extends Nn{static getType(){return"linebreak"}static clone(t){return new Tn(t.__key)}constructor(t){super(t)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>function(t){const e=t.parentElement;if(null!==e&&Ui(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&bn(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&bn(n))return!0}}return!1}(t)||function(t){const e=t.parentElement;if(null!==e&&Ui(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&bn(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&bn(r))return!0}return!1}(t)?null:{conversion:vn,priority:0}}}static importJSON(t){return kn().updateFromJSON(t)}}function vn(t){return{node:kn()}}function kn(){return Di(new Tn)}function En(t){return t instanceof Tn}function bn(t){return Lo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function On(t,e){return 16&e?"code":e&E?"mark":32&e?"sub":64&e?"sup":null}function Mn(t,e){return 1&e?"strong":2&e?"em":"span"}function An(t,e,n,r,o){const i=r.classList;let s=gi(o,"base");void 0!==s&&i.add(...s),s=gi(o,"underlineStrikethrough");let l=!1;const c=e&k&&e&v;void 0!==s&&(n&k&&n&v?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const t in R){const r=R[t];if(s=gi(o,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&i.remove(...s);continue}e&r&&(!c||"underline"!==t)&&"strikethrough"!==t||i.add(...s)}else e&r&&i.remove(...s)}}function wn(t,e,n){const r=e.firstChild,o=n.isComposing(),s=t+(o?I:"");if(null==r)e.textContent=s;else{const t=r.nodeValue;if(t!==s)if(o||i){const[e,n,o]=function(t,e){const n=t.length,r=e.length;let o=0,i=0;for(;o<n&&o<r&&t[o]===e[o];)o++;for(;i+o<n&&i+o<r&&t[n-i-1]===e[r-i-1];)i++;return[o,n-o-i,e.slice(o,r-i)]}(t,s);0!==n&&r.deleteData(e,n),r.insertData(e,o)}else r.nodeValue=s}}function Dn(t,e,n,r,o,i){wn(o,t,e);const s=i.theme.text;void 0!==s&&An(0,0,r,t,s)}function Pn(t,e){const n=document.createElement(e);return n.appendChild(t),n}class In extends Nn{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new In(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return W[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Uo()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=R[t];return!!(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Ko(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=On(0,n),o=Mn(0,n),i=null===r?o:r,s=document.createElement(i);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(o),s.appendChild(l));Dn(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&(s.style.cssText=c),s}updateDOM(e,n,r){const o=this.__text,i=e.__format,s=this.__format,l=On(0,i),c=On(0,s),a=Mn(0,i),u=Mn(0,s);if((null===l?a:l)!==(null===c?u:c))return!0;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const i=document.createElement(u);return Dn(i,this,0,s,o,r),n.replaceChild(i,e),!1}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),wn(o,f,this);const d=r.theme.text;void 0!==d&&i!==s&&An(0,i,s,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Bn,priority:0}),b:()=>({conversion:Fn,priority:0}),code:()=>({conversion:Wn,priority:0}),em:()=>({conversion:Wn,priority:0}),i:()=>({conversion:Wn,priority:0}),mark:()=>({conversion:Wn,priority:0}),s:()=>({conversion:Wn,priority:0}),span:()=>({conversion:Ln,priority:0}),strong:()=>({conversion:Wn,priority:0}),sub:()=>({conversion:Wn,priority:0}),sup:()=>({conversion:Wn,priority:0}),u:()=>({conversion:Wn,priority:0})}}static importJSON(t){return Un().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Bi(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Pn(n,"b")),this.hasFormat("italic")&&(n=Pn(n,"i")),this.hasFormat("strikethrough")&&(n=Pn(n,"s")),this.hasFormat("underline")&&(n=Pn(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?R[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?K[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Ko(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=$[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Ir();let n=t,r=e;const o=pr(),i=this.getTextContent(),s=this.__key;if("string"==typeof i){const t=i.length;void 0===n&&(n=t),void 0===r&&(r=t)}else n=0,r=0;if(!tr(o))return dr(s,n,s,r,"text","text");{const t=Uo();t!==o.anchor.key&&t!==o.focus.key||Wo(s),o.setTextNodeRange(this,n,this,r)}return o}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const o=this.getWritable(),i=o.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=pr();if(r&&tr(c)){const e=t+s;c.setTextNodeRange(o,e,o,e)}const a=i.slice(0,l)+n+i.slice(l+e);return o.__text=a,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Ir();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,o=Uo(),i=n.length;t.sort(((t,e)=>t-e)),t.push(i);const s=[],l=t.length;for(let e=0,r=0;e<i&&r<=l;r++){const o=t[r];o>e&&(s.push(n.slice(e,o)),e=o)}const c=s.length;if(1===c)return[e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=!1,p=null,y=null;const m=pr();if(tr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e)}e.isSegmented()?(f=Un(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=dt(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=Un(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=dt(e,n);const i=n.__key;o===r&&Wo(i),x.push(n)}const C=p?p.offset:null,S=y?y.offset:null;let N=0;for(const t of x){if(!p&&!y)break;const e=N+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=N&&(p.set(t.getKey(),C-N,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=N){y.set(t.getKey(),S-N,"text");break}N=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&$o(e);null!==n&&$o(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),tr(m)&&mr(m,u,e,c-1)}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,o=e.__key,i=this.__text,s=i.length;Uo()===o&&Wo(r);const l=pr();if(tr(l)){const t=l.anchor,i=l.focus;null!==t&&t.key===o&&Sr(t,n,r,e,s),null!==i&&i.key===o&&Sr(i,n,r,e,s)}const c=e.__text,a=n?c+i:i+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Ln(t){return{forChild:Yn(t.style),node:null}}function Fn(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Yn(e.style,n?void 0:"bold"),node:null}}const Rn=new WeakMap;function Kn(t){if(!Bi(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Bn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=Rn.get(n))&&!Kn(n);)r.push(n),n=n.parentNode;const o=void 0===e?n:e;for(let t=0;t<r.length;t++)Rn.set(r[t],o);return o}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(kn()):"\t"===n?e.push(Hn()):""!==n&&e.push(Un(n))}return{node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return{node:null};if(" "===r[0]){let t=n,e=!0;for(;null!==t&&null!==(t=zn(t,!1));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=!1;break}}e&&(r=r.slice(1))}if(" "===r[r.length-1]){let t=n,e=!0;for(;null!==t&&null!==(t=zn(t,!0));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=!1;break}}e&&(r=r.slice(0,r.length-1))}return""===r?{node:null}:{node:Un(r)}}function zn(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t}if(n=t,Bi(n)){const t=n.style.display;if(""===t&&!Wi(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(Lo(n))return n;if("BR"===n.nodeName)return null}}const $n={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Wn(t){const e=$n[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Yn(t.style,e),node:null}}function Un(t=""){return Di(new In(t))}function Jn(t){return t instanceof In}function Yn(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),o="700"===n||"bold"===n,i=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Jn(t)?(o&&!t.hasFormat("bold")&&t.toggleFormat("bold"),i&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class jn extends In{static getType(){return"tab"}static clone(t){return new jn(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=gi(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Hn().updateFromJSON(t)}setTextContent(t){return"\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,o){return""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return"normal"!==e&&t(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Hn(){return Di(new jn)}function Vn(t){return t instanceof jn}class Gn{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return Os(Ws(Ps(this,"next")),Ws(Ps(t,"next")))<0}getNode(){const e=Jo(this.key);return null===e&&t(20),e}set(t,e,n,r){const o=this._selection,i=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,Pr()||(Uo()===i&&Wo(t),null!==o&&(o.setCachedNodes(null),o.dirty=!0)))}}function qn(t,e,n){return new Gn(t,e,n)}function Xn(t,e){let n=e.__key,r=t.offset,o="element";if(Jn(e)){o="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!Zr(e)){const t=e.getNextSibling();if(Jn(t))n=t.__key,r=0,o="text";else{const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,o)}function Qn(t,e){if(Zr(e)){const n=e.getLastDescendant();Zr(n)||Jn(n)?Xn(t,n):Xn(t,e)}else Xn(t,e)}class Zn{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!nr(t))return!1;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every((t=>n.has(t)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new Zn(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let o;if(Jn(r))o=r.select();else{const t=r.getIndexWithinParent()+1;o=r.getParentOrThrow().select(t,t)}o.insertNodes(t);for(let t=0;t<n;t++)e[t].remove()}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Jo(t);null!==e&&n.push(e)}return Pr()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((pr()||yr())===this&&t[0]){const e=_s(t[0],"next");Ls(Es(e,e))}for(const e of t)e.remove()}}function tr(t){return t instanceof er}class er{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!tr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const o=new Set,i=new Set;for(const n of t)if(fs(n)){const{origin:t}=n;0===e.length?o.add(t):(i.add(t),e.push(t))}else{const{origin:t}=n;Zr(t)&&i.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(us(t.focus)&&Zr(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=xs(t.focus.origin,"previous");fs(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=Ss(n))o.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!Zr(t)||i.has(t)||t.isEmpty()||o.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=Ws(t.anchor),r=Ws(t.anchor.getFlipped()),o=t=>as(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}(Ys(Rs(this),"next"));return Pr()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const t=this.getNodes();if(0===t.length)return"";const e=t[0],n=t[t.length-1],r=this.anchor,o=this.focus,i=r.isBefore(o),[s,l]=or(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(Zr(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,Jn(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===o.type&&o.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=i?t.slice(s):t.slice(l):f===n&&(t=i?t.slice(0,l):t.slice(0,s)),c+=t}else!no(f)&&!En(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=Rr(),n=e.getEditorState()._selection,r=fr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[o,i]=r;this.anchor.set(o.key,o.offset,o.type,!0),this.focus.set(i.key,i.offset,i.type,!0),pt(this)}clone(){const t=this.anchor,e=this.focus;return new er(qn(t.key,t.offset,t.type),qn(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Ko(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=R[t];return!!(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(kn()):"\t"===r?n.push(Hn()):n.push(Un(r))}this.insertNodes(n)}insertText(e){const n=this.anchor,r=this.focus,o=this.format,i=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const o=t.getNode(),i=o.getChildAtIndex(t.offset),s=Un();if(s.setFormat(n),s.setStyle(r),mo(i))i.splice(0,0,[s]);else{const t=oo(o)?yo().append(s):s;null===i?o.append(t):i.insertBefore(t)}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text")}(s,l,o,i),"element"===l.type&&Is(l,Ws(Ps(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Jn(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(Io(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Jn(t)&&t.canInsertTextBefore()&&!Io(t)||(t=Un(),t.setFormat(o),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(Io(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Jn(t)&&!Io(t)||(t=Un(),t.setFormat(o),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=Un(d.getTextContent());t.setFormat(o),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Zr(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),ur(this.anchor,this.focus,null),void this.insertText(e)}if(1===f){if(Po(d)){const t=Un(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===o&&n===i){if(Vn(d)){const t=Un(e);return t.setFormat(o),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=Un(e);if(t.setFormat(o),t.setStyle(i),t.select(),0===c)d.insertBefore(t,!1);else{const[e]=d.splitText(c);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(o),d.setStyle(i)}const r=a-c;d=d.spliceText(c,r,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=Zr(d)?d:d.getParentOrThrow();let r=Zr(_)?_:_.getParentOrThrow(),o=_;if(!n.is(r)&&r.isInline())do{o=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(Jn(_)&&!Po(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=Un(_.getTextContent());_.replace(t),_=t}oo(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key)}else{const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove()}else t.add(_.__key);const i=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=i.length-1;t>=0;t--){const e=i[t];if(e.is(d)||Zr(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(o)?g||p.insertAfter(e,!1):e.remove())}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),o=r.length;(0===o||r[o-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Po(d))if(c===h)d.select();else{const t=Un(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=pr()===this;Fs(this,$s(Rs(this))),t&&pr()!==this&&Qo(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Wo(null);const n=this.getNodes(),r=[];for(const t of n)Jn(t)&&r.push(t);const o=e=>{n.forEach((n=>{if(Zr(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}}))},i=r.length;if(0===i)return this.toggleFormat(t),Wo(null),void o(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);o(g);const _=i-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(Io(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text")}return void(this.format=g)}0===h||Io(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Io(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],o=n.getFormatFlags(t,m);n.setFormat(o)}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=pr();return tr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=ts(n,Ji),o=e[e.length-1];if(Zr(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=vr(this);r.splice(t,0,e),o.selectEnd()}return}if(!e.some((t=>(Zr(t)||no(t))&&!t.isInline()))){Zr(r)||t(211,n.constructor.name,n.getType());const i=vr(this);return r.splice(i,0,e),void o.selectEnd()}const i=function(t){const e=yo();let n=null;for(let r=0;r<t.length;r++){const o=t[r],i=En(o);if(i||no(o)&&o.isInline()||Zr(o)&&o.isInline()||Jn(o)||o.isParentRequired()){if(null===n&&(n=o.createParentElementNode(),e.append(n),i))continue;null!==n&&n.append(o)}else e.append(o),n=null}return e}(e),s=i.getLastDescendant(),l=i.getChildren(),c=!Zr(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;Zr(f=u)&&Ji(f)&&!f.isEmpty()&&Zr(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Zr(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n,r){const o=n.getParentOrThrow().getLastChild();let i=n;const s=[n];for(;i!==o;)i.getNextSibling()||t(140),i=i.getNextSibling(),s.push(i);let l=e;for(const t of s)l=l.insertAfter(t)}(r,u));const d=ts(s,Ji);c&&Zr(d)&&(c.canMergeWhenEmpty()||Ji(a))&&(d.append(...c.getChildren()),c.remove()),Zr(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=Zr(r)?r.getLastChild():null;En(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=yo();return qo().splice(this.anchor.offset,0,[t]),t.select(),t}const e=vr(this),n=ts(this.anchor.getNode(),Ji);Zr(n)||t(213);const r=n.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(t){const e=kn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n)}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[o,i]=or(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[i,o]:[o,i];if(0===e)return[];if(1===e){if(Jn(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return[n]}if(Jn(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),Jn(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,e,n){if(Er(this,t,e,n))return;const r="move"===t,o=Rr(),i=Ri(Oi(o));if(!i)return;const s=o._blockCursorElement,l=o._rootElement,c=this.focus.getNode();if(null===l||null===s||!Zr(c)||c.isInline()||c.canBeEmpty()||Fi(s,o,l),this.dirty){let t=Si(o,this.anchor.key),e=Si(o,this.focus.key);"text"===this.anchor.type&&(t=Ro(t)),"text"===this.focus.type&&(e=Ro(e)),t&&e&&Nr(i,t,this.anchor.offset,e,this.focus.offset)}if(function(t,e,n,r){t.modify(e,n,r)}(i,t,e?"backward":"forward",n),i.rangeCount>0){const t=i.getRangeAt(0),n=this.anchor.getNode(),o=oo(n)?n:Mi(n);if(this.applyDOMRange(t),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let t=0;t<n.length;t++){const e=n[t];Ei(e,o)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];Zr(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];Zr(t)?t.selectEnd():t.getParentOrThrow().selectEnd()}i.anchorNode===t.startContainer&&i.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,o=n.offset,i=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,o,i,!0)}(this)}}"lineboundary"===n&&Er(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Zr(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Zr(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=vs(Ps(e,t?"previous":"next"));if(r.getTextSlices().every((t=>null===t||0===t.distance))){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(fs(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Zr(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Ws(e);Fs(this,Es(t,t)),r.anchor.origin.remove()}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"})}else{if("merge-block"===t.type)break;if(us(e)){if(Zr(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(no(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Zr(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=gr();t.add(e.origin.getKey()),Qo(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Fs(this,Es(!e.origin.isEmpty()&&n.isEmpty()?Ks(_s(n,e.direction)):r.anchor,e)),this.removeText()}}const o=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&ir(this,e.getNode()))return}else{const r="text"===o.type?o.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=o.offset,i=r.getTextContentSize();if(r.is(n)||t&&e!==i||!t&&0!==e)return void lr(r,t,e)}else if(null!==n&&n.isSegmented()){const o=e.offset,i=n.getTextContentSize();if(n.is(r)||t&&0!==o||!t&&o!==i)return void lr(n,t,o)}!function(t,e){const n=t.anchor,r=t.focus,o=n.getNode(),i=r.getNode();if(o===i&&"text"===n.type&&"text"===r.type){const t=n.offset,i=r.offset,s=t<i,l=s?t:i,c=s?i:t,a=c-1;if(l!==a){(function(t){return!(ti(t)||sr(t))})(o.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type))}}}(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&oo(t.getParent())&&null===t.getPreviousSibling()&&ir(this,t)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function nr(t){return t instanceof Zn}function rr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function or(t){const e=t.getStartEndPoints();if(null===e)return[0,0];const[n,r]=e;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[rr(n),rr(r)]}function ir(t,e){for(let n=e;n;n=n.getParent()){if(Zr(n)){if(n.collapseAtStart(t))return!0;if(Ai(n))break}if(n.getPreviousSibling())break}return!1}const sr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return()=>!1})();function lr(t,e,n){const r=t,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let t=0;t<i;t++){const r=t===i-1;if(l=s,s+=o[t].length,e&&s===n||s>n||r){o.splice(t,1),r&&(l=void 0);break}}const c=o.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function cr(e,n,r,o){let i,s=n;if(Bi(e)){let l=!1;const c=e.childNodes,a=c.length,u=o._blockCursorElement;s===a&&(l=!0,s=a-1);let f=c[s],d=!1;if(f===u)f=c[s+1],d=!0;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--}}if(i=Zo(f),Jn(i))s=ys(i,l?"next":"previous");else{let c=Zo(e);if(null===c)return null;if(Zr(c)){const a=o.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Zr(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Zr(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Zr(f)?f:f.getParentOrThrow()),s=0}Jn(f)?(i=f,c=null,s=ys(f,l?"next":"previous")):f!==c&&l&&!d&&(Zr(c)||t(216),s=Math.min(c.getChildrenSize(),s+1))}else{const t=c.getIndexWithinParent();s=0===n&&no(c)&&Zo(e)===c?t:t+1,c=c.getParentOrThrow()}if(Zr(c))return qn(c.__key,s,"element")}}else i=Zo(e);return Jn(i)?qn(i.__key,ys(i,s,"clamp"),"text"):null}function ar(t,e,n){const r=t.offset,o=t.getNode();if(0===r){const r=o.getPreviousSibling(),i=o.getParent();if(e){if((n||!e)&&null===r&&Zr(i)&&i.isInline()){const e=i.getPreviousSibling();Jn(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else Zr(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Jn(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===o.getTextContent().length){const r=o.getNextSibling(),i=o.getParent();if(e&&Zr(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Zr(i)&&i.isInline()&&!i.canInsertTextAfter()){const e=i.getNextSibling();Jn(e)&&t.set(e.__key,0,"text")}}}function ur(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),o=t.is(e);ar(t,r,o),ar(e,!r,o),o&&e.set(t.key,t.offset,t.type);const i=Rr();if(i.isComposing()&&i._compositionKey!==t.key&&tr(n)){const r=n.anchor,o=n.focus;t.set(r.key,r.offset,r.type,!0),e.set(o.key,o.offset,o.type,!0)}}}function fr(t,e,n,r,o,i){if(null===t||null===n||!Mo(o,t,n))return null;const s=cr(t,e,tr(i)?i.anchor:null,o);if(null===s)return null;const l=cr(n,r,tr(i)?i.focus:null,o);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Zo(t),r=Zo(n);if(no(e)&&no(r))return null}return ur(s,l,i),[s,l]}function dr(t,e,n,r,o,i){const s=Fr(),l=new er(qn(t,e,o),qn(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function hr(){const t=qn("root",0,"element"),e=qn("root",0,"element");return new er(t,e,0,"")}function gr(){return new Zn(new Set)}function _r(t,e,n,r){const o=n._window;if(null===o)return null;const i=r||o.event,s=i?i.type:void 0,l="selectionchange"===s,c=!j&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&i&&3===i.detail||"drop"===s||void 0===s);let a,u,f,d;if(tr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&tr(t)&&!Mo(n,a,u))return t.clone();const h=fr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new er(g,_,tr(t)?t.format:0,tr(t)?t.style:"")}function pr(){return Fr()._selection}function yr(){return Rr()._editorState._selection}function mr(t,e,n,r=1){const o=t.anchor,i=t.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=o.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);o.set(c,n,"element"),i.set(c,n,"element"),xr(t)}}else{const s=t.isBackward(),l=s?i:o,a=l.getNode(),u=s?o:i,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element")}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element")}}xr(t)}function xr(t){const e=t.anchor,n=e.offset,r=t.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!Zr(i))return;const t=i.getChildrenSize(),o=n>=t,s=o?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Jn(s)){let t=0;o&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}}else{if(Zr(i)){const t=i.getChildrenSize(),r=n>=t,o=r?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Jn(o)){let t=0;r&&(t=o.getTextContentSize()),e.set(o.__key,t,"text")}}if(Zr(s)){const t=s.getChildrenSize(),e=o>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(o);if(Jn(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}}function Cr(t,e,n,r,o){let i=null,s=0,l=null;null!==r?(i=r.__key,Jn(r)?(s=r.getTextContentSize(),l="text"):Zr(r)&&(s=r.getChildrenSize(),l="element")):null!==o&&(i=o.__key,Jn(o)?l="text":Zr(o)&&(l="element")),null!==i&&null!==l?t.set(i,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Sr(t,e,n,r,o){"text"===t.type?t.set(n,t.offset+(e?0:o),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function Nr(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch(t){}}function Tr(t,e,n,r,o,i,s){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(o.has(uo)&&f!==i||null!==f&&Oo(f))return;if(!tr(e))return void(null!==t&&Mo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Si(n,g),y=Si(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,N=e.isCollapsed();let T=p,v=y,k=!1;if("text"===d.type){T=Ro(p);const t=d.getNode();k=t.getFormat()!==C||t.getStyle()!==S}else tr(t)&&"text"===t.anchor.type&&(k=!0);var E,b,O,M,A;if(("text"===h.type&&(v=Ro(y)),null!==T&&null!==v)&&(N&&(null===t||k||tr(t)&&(t.format!==C||t.style!==S))&&(E=C,b=S,O=m,M=g,A=performance.now(),sn=[E,b,O,M,A]),a!==m||u!==x||l!==T||c!==v||"Range"===r.type&&N||(null!==f&&i.contains(f)||i.focus({preventScroll:!0}),"element"===d.type))){if(Nr(r,T,m,v,x),!o.has(fo)&&e.isCollapsed()&&null!==i&&i===document.activeElement){const t=tr(e)&&"element"===e.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();!function(t,e,n){const r=Ti(n),o=bi(r);if(null===r||null===o)return;let{top:i,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=Oi(t).innerHeight;else{const t=a.getBoundingClientRect();l=t.top,c=t.bottom}let n=0;if(i<l?n=-(l-i):s>c&&(n=s-c),0!==n)if(e)o.scrollBy(0,n);else{const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;i-=e,s-=e}if(e)break;a=Ni(a)}}(n,e,i)}}Qe=!0}}function vr(e){let n=e;e.isCollapsed()||n.removeText();const r=pr();tr(r)&&(n=r),tr(n)||t(161);const o=n.anchor;let i=o.getNode(),s=o.offset;for(;!Ji(i);){const t=i;if([i,s]=kr(i,s),t.is(i))break}return s}function kr(t,e){const n=t.getParent();if(!n){const t=yo();return qo().append(t),t.select(),[qo(),0]}if(Jn(t)){const r=t.splitText(e);if(0===r.length)return[n,t.getIndexWithinParent()];const o=0===e?0:1;return[n,r[0].getIndexWithinParent()+o]}if(!Zr(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new er(qn(t.__key,e,"element"),qn(t.__key,e,"element"),0,""),o=t.insertNewAfter(n);o&&o.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Er(t,e,n,r,o="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),!0}const i=Ps(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!Us(c)){for(const t of c){a=!1;const{origin:e}=t;if(!no(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of vs(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(fs(t))t.origin.isInline()||(c=t);else{if(Zr(t.origin))continue;no(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===i)return!1;if(l&&!s&&no(c.origin)&&c.origin.isKeyboardSelectable()){const t=gr();return t.add(c.origin.getKey()),Qo(t),!0}return c=Ws(c),l&&Is(t.anchor,c),Is(t.focus,c),a||!s}let br=null,Or=null,Mr=!1,Ar=!1,wr=0;const Dr={characterData:!0,childList:!0,subtree:!0};function Pr(){return Mr||null!==br&&br._readOnly}function Ir(){Mr&&t(13)}function Lr(){wr>99&&t(14)}function Fr(){return null===br&&t(195,Kr()),br}function Rr(){return null===Or&&t(196,Kr()),Or}function Kr(){let t=0;const e=new Set,n=Co.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=Do(r);if(Ao(o))t++;else if(o){let t=String(o.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Br(){return Or}function zr(t,e,n){const r=e.__type,o=vo(t,r);let i=n.get(r);void 0===i&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let t=0;t<s&&(i[t](e),e.isAttached());t++);}function $r(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Wr(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t)}function Ur(e,n){const r=e.type,o=n.get(r);void 0===o&&t(17,r);const i=o.klass;e.type!==i.getType()&&t(18,i.name);const s=i.importJSON(e),l=e.children;if(Zr(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=Ur(l[t],n);s.append(e)}return s}function Jr(t,e,n){const r=br,o=Mr,i=Or;br=e,Mr=!0,Or=t;try{return n()}finally{br=r,Mr=o,Or=i}}function Yr(t,e){const n=t._pendingEditorState,r=t._rootElement,o=t._headless||null===r;if(null===n)return;const i=t._editorState,s=i._selection,l=n._selection,c=t._dirtyType!==m,a=br,u=Mr,f=Or,d=t._updating,g=t._observer;let _=null;if(t._pendingEditorState=null,t._editorState=n,!o&&c&&null!==g){Or=t,br=n,Mr=!1,t._updating=!0;try{const e=t._dirtyType,r=t._dirtyElements,o=t._dirtyLeaves;g.disconnect(),_=qt(i,n,t,e,r,o)}catch(e){if(e instanceof Error&&t._onError(e),Ar)throw e;return xo(t,null,r,n),et(t),t._dirtyType=C,Ar=!0,Yr(t,i),void(Ar=!1)}finally{g.observe(r,Dr),t._updating=d,br=a,Mr=u,Or=f}}n._readOnly||(n._readOnly=!0);const p=t._dirtyLeaves,y=t._dirtyElements,x=t._normalizedNodes,S=t._updateTags,N=t._deferred;c&&(t._dirtyType=m,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const o=e._nodeMap;let i;for(i in r)o.has(i)||(r===n&&(r=Vo(t)),delete r[i])}(t,n);const T=o?null:Ri(Oi(t));if(t._editable&&null!==T&&(c||null===l||l.dirty)&&null!==r&&!S.has(ho)){Or=t,br=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&Fi(e,t,r),Tr(s,l,t,T,S,r)}!function(t,e,n){let r=t._blockCursorElement;if(tr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const o=n.anchor,i=o.getNode(),s=o.offset;let l=!1,c=null;if(s===i.getChildrenSize()){Li(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&Li(e)){const n=e.getPreviousSibling();(null===n||Li(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=t.getElementByKey(i.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=h(r);r=e.blockCursor=t}void 0!==r&&n.classList.add(...r)}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&Fi(r,t,e)}(t,r,l)}finally{null!==g&&g.observe(r,Dr),Or=f,br=a}}null!==_&&function(t,e,n,r,o){const i=Array.from(t._listeners.mutation),s=i.length;for(let t=0;t<s;t++){const[s,l]=i[t];for(const t of l){const i=e.get(t);void 0!==i&&s(i,{dirtyLeaves:r,prevEditorState:o,updateTags:n})}}}(t,_,S,p,i),tr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(Zt,void 0);const v=t._pendingDecorators;null!==v&&(t._decorators=v,t._pendingDecorators=null,jr("decorator",t,!0,v)),function(t,e,n){const r=Go(e),o=Go(n);r!==o&&jr("textcontent",t,!0,o)}(t,e||i,n),jr("update",t,!0,{dirtyElements:y,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:x,prevEditorState:e||i,tags:S}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=!0;try{for(let t=0;t<e.length;t++)e[t]()}finally{t._updating=n}}}(t,N),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;Vr(t,e,r)}}}(t)}function jr(t,e,n,...r){const o=e._updating;e._updating=n;try{const n=Array.from(e._listeners[t]);for(let t=0;t<n.length;t++)n[t].apply(null,r)}finally{e._updating=o}}function Hr(e,n){const r=e._updates;let o=n||!1;for(;0!==r.length;){const n=r.shift();if(n){const[r,i]=n,s=e._pendingEditorState;let l;void 0!==i&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(null===s&&t(191),s._flushSync=!0),l&&e._deferred.push(l),Wr(e,i.tag)),null==s?Vr(e,r,i):r()}}return o}function Vr(e,n,r){const o=e._updateTags;let i,s=!1,l=!1;void 0!==r&&(i=r.onUpdate,Wr(e,r.tag),s=r.skipTransforms||!1,l=r.discrete||!1),i&&e._deferred.push(i);const c=e._editorState;let a=e._pendingEditorState,u=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=io(a||c),u=!0),a._flushSync=l;const f=br,d=Mr,h=Or,g=e._updating;br=a,Mr=!1,e._updating=!0,Or=e;const _=e._headless||null===e.getRootElement();No(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Ri(Oi(t));return tr(n)||null==n?_r(n,r,t,e):n.clone()}(e,r&&r.event||null));const o=e._compositionKey;n(),s=Hr(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(tr(r)){const t=r.anchor,e=r.focus;let o;if("text"===t.type&&(o=t.getNode(),o.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();o!==t&&t.selectionTransform(n,r)}}}(a,e),e._dirtyType!==m&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);Jn(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&_t(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=Uo(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=o.get(t);Jn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&_t(r),void 0!==r&&$r(r,i)&&zr(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){wr++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=o.get(n);void 0!==c&&$r(c,i)&&zr(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,wr++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),Hr(e),function(t,e,n,r){const o=t._nodeMap,i=e._nodeMap,s=[];for(const[t]of r){const e=i.get(t);void 0!==e&&(e.isAttached()||(Zr(e)&&J(e,t,o,i,s,r),o.has(t)||r.delete(t),s.push(t)))}for(const t of s)i.delete(t);for(const t of n){const e=i.get(t);void 0===e||e.isAttached()||(o.has(t)||n.delete(t),i.delete(t))}}(c,a,e._dirtyLeaves,e._dirtyElements));o!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(tr(i)){const e=a._nodeMap,n=i.anchor.key,r=i.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19)}else nr(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=C,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Yr(e)}finally{br=f,Mr=d,Or=h,e._updating=g,wr=0}const p=e._dirtyType!==m||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);p?a._flushSync?(a._flushSync=!1,Yr(e)):u&&Eo((()=>{Yr(e)})):(a._flushSync=!1,u&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Gr(t,e,n){Or===t&&void 0===n?e():Vr(t,e,n)}class qr{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new qr(this.element,t,this.after)}withAfter(t){return new qr(this.element,this.before,t)}withElement(t){return this.element===t?this:new qr(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||c||l);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,o=document.createElement("br");if(n.insertBefore(o,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,o),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=o}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return[t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const o=Xr(e,n);o.push(r);const i=Xr(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<i.length;t++){const e=o[t],n=i[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return[t.getParentOrThrow(),s]}}function Xr(e,n){const r=[];let o=n;for(;o!==e&&null!==o;o=o.parentNode){let t=0;for(let e=o.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t)}return o!==e&&t(225),r.reverse()}class Qr extends Nn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return z[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=Rr()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Jn(e)&&t.push(e),Zr(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Zr(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;Zr(t);){const e=t.getLastChild();if(null===e)break;t=e}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Zr(t)&&t.getLastDescendant()||t||null}const r=e[t];return Zr(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Jo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Jo(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=o.getTextContent(),Zr(o)&&r!==n-1&&!o.isInline()&&(t+=L)}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=o.getTextContentSize(),Zr(o)&&r!==n-1&&!o.isInline()&&(t+=L.length)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=B[t];return!!(this.getFormat()&e)}return!1}hasTextFormat(t){const e=R[t];return!!(this.getTextFormat()&e)}getFormatFlags(t,e){return Ko(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Ir();const n=pr();let r=t,o=e;const i=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Jn(t)||Zr(t))return t.select(0,0)}else if(!(void 0!==t&&t!==i||void 0!==e&&e!==i)){const t=this.getLastChild();if(Jn(t)||Zr(t))return t.select()}void 0===r&&(r=i),void 0===o&&(o=i);const s=this.__key;return tr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,o,"element"),n.dirty=!0,n):dr(s,r,s,o,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach((t=>t.remove())),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?B[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){const o=r.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const l=s.__key,c=[],a=[],u=this.getChildAtIndex(e+n);let f=null,d=i-n+o;if(0!==e)if(e===i)f=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(f=t.getPreviousSibling())}if(n>0){let e=null===f?this.getFirstChild():f.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;zo(e.getWritable()),a.push(r),e=n}}let h=f;for(let e=0;e<o;e++){const n=r[e];null!==h&&n.is(h)&&(f=h=h.getPreviousSibling());const o=n.getWritable();o.__parent===l&&d--,zo(o);const i=n.__key;if(null===h)s.__first=i,o.__prev=null;else{const t=h.getWritable();t.__next=i,o.__prev=t.__key}n.__key===l&&t(76),o.__parent=l,c.push(i),h=n}if(e+n===i){if(null!==h){h.getWritable().__next=null,s.__last=h.__key}}else if(null!==u){const t=u.getWritable();if(null!==h){const e=h.getWritable();t.__prev=h.__key,e.__next=u.__key}else t.__prev=null}if(s.__size=d,a.length){const t=pr();if(tr(t)){const e=new Set(a),n=new Set(c),{anchor:r,focus:o}=t;to(r,e,n)&&Cr(r,r.getNode(),this,f,u),to(o,e,n)&&Cr(o,o.getNode(),this,f,u),0!==d||this.canBeEmpty()||Ai(this)||this.remove()}}return s}getDOMSlot(t){return new qr(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Bi(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n)}return{element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,e,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const o=e.getElementByKey(t.getKey());null!==o&&(null==r?(n.insertChild(o),r=o):r!==o&&n.replaceChild(o,r),r=r.nextSibling)}}}function Zr(t){return t instanceof Qr}function to(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return!0;r=r.getParent()}return!1}class eo extends Nn{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function no(t){return t instanceof eo}class ro extends Qr{__cachedText;static getType(){return"root"}static clone(){return new ro}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return!Pr()&&Rr()._dirtyType!==m||null===t?super.getTextContent():t}remove(){t(52)}replace(e){t(53)}insertBefore(e){t(54)}insertAfter(e){t(55)}updateDOM(t,e){return!1}splice(e,n,r){for(const e of r)Zr(e)||no(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return qo().updateFromJSON(t)}collapseAtStart(){return!0}}function oo(t){return t instanceof ro}function io(t){return new co(new Map(t._nodeMap))}function so(){return new co(new Map([["root",new ro]]))}function lo(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Zr(e)){const o=n.children;Array.isArray(o)||t(59,r.name);const i=e.getChildren();for(let t=0;t<i.length;t++){const e=lo(i[t]);o.push(e)}}return n}class co{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return Jr(e&&e.editor||null,this,t)}clone(t){const e=new co(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return Jr(null,this,(()=>({root:lo(qo())})))}}const ao="history-merge",uo="collaboration",fo="skip-scroll-into-view",ho="skip-dom-selection";class go extends Qr{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class _o extends Qr{static getType(){return"paragraph"}static clone(t){return new _o(t.__key)}createDOM(t){const e=document.createElement("p"),n=gi(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n)}return e}updateDOM(t,e,n){return!1}static importDOM(){return{p:t=>({conversion:po,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Bi(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return yo().updateFromJSON(t)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=yo();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Jn(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function po(t){const e=yo();return t.style&&(e.setFormat(t.style.textAlign),qi(t,e)),{node:e}}function yo(){return Di(new _o)}function mo(t){return t instanceof _o}function xo(t,e,n,r){const o=t._keyToDOMMap;o.clear(),t._editorState=so(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=m,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const i=t._observer;null!==i&&(i.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",o.set("root",n))}class Co{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,o,i,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,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=m,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=ni(),this._onError=o,this._htmlConversions=i,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t)}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t)}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t)}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t)}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t)}}registerCommand(e,n,r){void 0===r&&t(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(e);void 0===i&&t(36,String(e));const s=i[r];return s.add(n),()=>{s.delete(n),i.every((t=>0===t.size))&&o.delete(e)}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,o=this._listeners.mutation;let i=o.get(e);void 0===i&&(i=new Set,o.set(e,i)),i.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{i.delete(r),0===i.size&&o.delete(e)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Vi(n).get(e.getType());if(!r)return;const o=new Map;for(const t of r.keys())o.set(t,"created");o.size>0&&t(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],o=n.replaceWithKlass;if(null!=o){const t=this.registerNodeTransformToKlass(o,e);r.push(t)}return function(t,e){const n=Vi(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e)}if(0===r.length)return;t.update((()=>{for(const t of r)for(const e of t.keys()){const t=Jo(e);t&&t.markDirty()}}),null===t._pendingEditorState?{tag:ao}:void 0)}(this,r.map((t=>t.klass.getType()))),()=>{r.forEach((t=>t.transforms.delete(e)))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return xi(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=gi(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,xo(this,e,t,r),null!==e&&(this._config.disableEvents||Cn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=bi(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=C,et(this),this._updateTags.add(ao),Yr(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument,r=Xe.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",pn),Xe.set(n,(r||0)+1),t.__lexicalEditor=e;const o=gn(t);for(let n=0;n<je.length;n++){const[r,i]=je[n],s="function"==typeof i?t=>{mn(t)||(yn(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(mn(t))return;yn(t);const n=e.isEditable();switch(r){case"cut":return n&&xi(e,Le,t);case"copy":return xi(e,Ie,t);case"paste":return n&&xi(e,se,t);case"dragstart":return n&&xi(e,we,t);case"dragover":return n&&xi(e,De,t);case"dragend":return n&&xi(e,Pe,t);case"focus":return n&&xi(e,$e,t);case"blur":return n&&xi(e,We,t);case"drop":return n&&xi(e,Me,t)}};t.addEventListener(r,s),o.push((()=>{t.removeEventListener(r,s)}))}}(t,this),null!=n&&t.classList.add(...n)}else this._window=null,this._updateTags.add(ao),Yr(this);jr("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=io(e),r._selection=e._selection?e._selection.clone():null),tt(this);const o=this._pendingEditorState,i=this._updateTags,s=void 0!==n?n.tag:null;null===o||o.isEmpty()||(null!=s&&i.add(s),Yr(this)),this._pendingEditorState=r,this._dirtyType=C,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Yr(this)}parseEditorState(t,e){return function(t,e,n){const r=so(),o=br,i=Mr,s=Or,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,br=r,Mr=!1,Or=e,No(null);try{const o=e._nodes;Ur(t.root,o),n&&n(),r._readOnly=!0}catch(t){t instanceof Error&&e._onError(t)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,br=o,Mr=i,Or=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return Yr(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):Vr(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Gr(this,(()=>{const r=pr(),o=qo();null!==r?r.dirty||Qo(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),vi("focus"),ki((()=>{n.removeAttribute("autocapitalize"),t&&t()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Ri(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,jr("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}Co.version="0.36.1+prod.cjs";let So=null;function No(t){So=t}let To=1;function vo(e,n){const r=ko(e,n);return void 0===r&&t(30,n),r}function ko(t,e){return t._nodes.get(e)}const Eo="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function bo(t){return no(Ho(t))}function Oo(t){const e=document.activeElement;if(!Bi(e))return!1;const n=e.nodeName;return no(Ho(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Do(e))}function Mo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Oo(e)&&wo(e)===t}catch(t){return!1}}function Ao(t){return t instanceof Co}function wo(t){let e=t;for(;null!=e;){const t=Do(e);if(Ao(t))return t;e=Ni(e)}return null}function Do(t){return t?t.__lexicalEditor:null}function Po(t){return Vn(t)||t.isToken()}function Io(t){return Po(t)||t.isSegmented()}function Lo(t){return zi(t)&&t.nodeType===_}function Fo(t){return zi(t)&&t.nodeType===p}function Ro(t){let e=t;for(;null!=e;){if(Lo(e))return e;e=e.firstChild}return null}function Ko(t,e,n){const r=R[e];if(null!==n&&(t&r)==(n&r))return t;let o=t^r;return"subscript"===e?o&=~R.superscript:"superscript"===e?o&=~R.subscript:"lowercase"===e?(o&=~R.uppercase,o&=~R.capitalize):"uppercase"===e?(o&=~R.lowercase,o&=~R.capitalize):"capitalize"===e&&(o&=~R.lowercase,o&=~R.uppercase),o}function Bo(t,e){const n=function(){const t=So;return So=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Ir(),Lr();const r=Rr(),o=Fr(),i=""+To++;o._nodeMap.set(i,t),Zr(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=x,t.__key=i}function zo(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),s=null!==i?i.__key:null,l=null!==o?o.__key:null,c=null!==o?o.getWritable():null,a=null!==i?i.getWritable():null;null===o&&(r.__first=s),null===i&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function $o(t){Lr();const e=t.getLatest(),n=e.__parent,r=Fr(),o=Rr(),i=r._nodeMap,s=o._dirtyElements;null!==n&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,!1),r=t.__parent}}(n,i,s);const l=e.__key;o._dirtyType=x,Zr(t)?s.set(l,!0):o._dirtyLeaves.add(l)}function Wo(t){Ir();const e=Rr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Jo(n);null!==t&&t.getWritable()}if(null!==t){const e=Jo(t);null!==e&&e.getWritable()}}}function Uo(){if(Pr())return null;return Rr()._compositionKey}function Jo(t,e){const n=(e||Fr())._nodeMap.get(t);return void 0===n?null:n}function Yo(t,e){const n=jo(t,Rr());return void 0!==n?Jo(n,e):null}function jo(t,e){return t[`__lexicalKey_${e._key}`]}function Ho(t,e){let n=t;for(;null!=n;){const t=Yo(n,e);if(null!==t)return t;n=Ni(n)}return null}function Vo(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Go(t){return t.read((()=>qo().getTextContent()))}function qo(){return Xo(Fr())}function Xo(t){return t._nodeMap.get("root")}function Qo(t){Ir();const e=Fr();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Zo(t){const e=Rr(),n=function(t,e){let n=t;for(;null!=n;){const t=jo(n,e);if(void 0!==t)return t;n=Ni(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Jo("root"):null}return Jo(n)}function ti(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function ei(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function ni(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function ri(t){return Lo(t)?t.nodeValue:null}function oi(t,e,n){const r=Ri(Oi(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=ri(o);const r=Ho(o);if(null!==e&&Jn(r)){if(e===I&&n){const t=n.length;e=n,i=t,s=t}null!==e&&ii(r,e,i,s,t)}}}function ii(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let a=e;(s||o)&&e[e.length-1]===I&&(a=e.slice(0,-1));const u=i.getTextContent();if(o||a!==u){if(""===a){if(Wo(null),l||c||d)i.remove();else{const t=Rr();setTimeout((()=>{t.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}const e=i.getParent(),o=yr(),u=i.getTextContentSize(),f=Uo(),h=i.getKey();if(i.isToken()||null!==f&&h===f&&!s||tr(o)&&(null!==e&&!e.canInsertTextBefore()&&0===o.anchor.offset||o.anchor.key===t.__key&&0===o.anchor.offset&&!i.canInsertTextBefore()&&!s||o.focus.key===t.__key&&o.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const g=pr();if(!tr(g)||null===n||null===r)return void si(i,a,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=Un(i.getTextContent());i.replace(t),i=t}si(i,a,g)}}}function si(t,e,n){if(t.setTextContent(e),tr(n)){const e=t.getKey();for(const r of["anchor","focus"]){const o=n[r];"text"===o.type&&o.key===e&&(o.offset=ys(t,o.offset,"clamp"))}}}function li(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function ci(t,e){return li(t,e,"altKey")&&li(t,e,"ctrlKey")&&li(t,e,"shiftKey")&&li(t,e,"metaKey")}function ai(t,e,n){return ci(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const ui={ctrlKey:!o,metaKey:o},fi={altKey:o,ctrlKey:!o};function di(t){return"Backspace"===t.key}function hi(t){return ai(t,"a",ui)}function gi(t,e){void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const o=t[e];if("string"==typeof o){const t=h(o);return n[e]=t,t}return o}function _i(e,n,r,o,i){if(0===r.size)return;const s=o.__type,l=o.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===i;(void 0===f||d)&&u.set(l,d?"updated":i)}function pi(t,e,n){const r=t.getParent();let o=n,i=t;return null!==r&&(e&&0===n?(o=i.getIndexWithinParent(),i=r):e||n!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?o-1:o)}function yi(t,e){const n=t.offset;if("element"===t.type){return pi(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?pi(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function mi(t){const e=Oi(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function xi(t,e,n){return function(t,e,n){const r=ei(t);for(let o=4;o>=0;o--)for(let i=0;i<r.length;i++){const s=r[i],l=s._commands.get(e);if(void 0!==l){const e=l[o];if(void 0!==e){const r=Array.from(e),o=r.length;let i=!1;if(Gr(s,(()=>{for(let e=0;e<o;e++)if(r[e](n,t))return void(i=!0)})),i)return i}}}return!1}(t,e,n)}function Ci(t){return!oo(t)&&!t.isLastChild()&&!t.isInline()}function Si(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function Ni(t){const e=t.assignedSlot||t.parentElement;return $i(e)?e.host:e}function Ti(t){return Fo(t)?t:Bi(t)?t.ownerDocument:null}function vi(t){Ir();Rr()._updateTags.add(t)}function ki(t){Ir();Rr()._deferred.push(t)}function Ei(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function bi(t){const e=Ti(t);return e?e.defaultView:null}function Oi(e){const n=e._window;return null===n&&t(78),n}function Mi(t){let e=t.getParentOrThrow();for(;null!==e;){if(Ai(e))return e;e=e.getParentOrThrow()}return e}function Ai(t){return oo(t)||Zr(t)&&t.isShadowRoot()}function wi(t){const e=t.constructor.clone(t);return Bo(e,null),e.afterCloneFrom(t),e}function Di(e){const n=Rr(),r=e.getType(),o=ko(n,r);void 0===o&&t(200,e.constructor.name,r);const{replace:i,replaceWithKlass:s}=o;if(null!==i){const n=i(e),o=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),o.name,o.getType(),e.constructor.name,r):n instanceof e.constructor&&o!==e.constructor||t(202,o.name,o.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,o.name,o.getType()),n}return e}function Pi(e,n){!oo(e.getParent())||Zr(n)||no(n)||t(99)}function Ii(e){const n=Jo(e);return null===n&&t(63,e),n}function Li(t){return(no(t)||Zr(t)&&!t.canBeEmpty())&&!t.isInline()}function Fi(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function Ri(t){return n?(t||window).getSelection():null}function Ki(t){const e=bi(t);return e?e.getSelection():null}function Bi(t){return zi(t)&&t.nodeType===g}function zi(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function $i(t){return zi(t)&&t.nodeType===y}function Wi(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function Ui(t){const 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 null!==t.nodeName.match(e)}function Ji(t){if(no(t)&&!t.isInline())return!0;if(!Zr(t)||Ai(t))return!1;const e=t.getFirstChild(),n=null===e||En(e)||Jn(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Yi(){return Rr()}const ji=new WeakMap,Hi=new Map;function Vi(e){if(!e._readOnly&&e.isEmpty())return Hi;e._readOnly||t(192);let n=ji.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let o=e.get(t);o||(o=new Map,e.set(t,o)),o.set(n,r)}return e}(e),ji.set(e,n)),n}function Gi(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function qi(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r)}function Xi(t){return!0===t.__lexicalUnmanaged}function Qi(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==Nn[e]}function Zi(e){const n=U in e.prototype?e.prototype[U]():void 0,r=function(e){if(!(e===Nn||e.prototype instanceof Nn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{Co.version&&(r=JSON.parse(Co.version))}catch(t){}t(290,e.name,n,r)}return e===eo||e===Qr||e===Nn}(e),o=!r&&Qi(e,"getType")?e.getType():void 0;let i,s=o;if(n)if(o)i=n[o];else for(const[t,e]of Object.entries(n))s=t,i=e;if(!r&&s&&(Qi(e,"getType")||(e.getType=()=>s),Qi(e,"clone")||(e.clone=t=>(No(t),new e)),Qi(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Qi(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const ts=(t,e)=>{let n=t;for(;null!=n&&!oo(n);){if(e(n))return n;n=n.getParent()}return null},es={next:"previous",previous:"next"};class ns{origin;constructor(t){this.origin=t}[Symbol.iterator](){return bs({hasNext:us,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return _s(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return _s(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let t=i.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e)}for(const e of o){if(l.size>0){const n=i.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||i.origin.is(e));else{const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e)}else null===n&&t(263,Array.from(l).join(" "))}else i.insert(e);i=_s(e,this.direction)}for(const t of l.values())t.remove();return this}}class rs extends ns{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:xs(t,this.direction)}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=is(this.direction);return _s(this.getNodeAtCaret(),t)||xs(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof rs&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const os={root:oo,shadowRoot:Ai};function is(t){return es[t]}function ss(t,e="root"){return os[e](t)?null:t}class ls extends ns{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:_s(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Zr(this.origin)?xs(this.origin,this.direction):null}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=is(this.direction);return _s(this.getNodeAtCaret(),t)||xs(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof ls&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof ls||t instanceof cs)&&this.direction===t.direction&&this.origin.is(t.origin)}}class cs extends ns{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ps(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return _s(ss(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ps(this.origin,is(this.direction),this.offset)}isSamePointCaret(t){return t instanceof cs&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ls||t instanceof cs)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return _s(this.origin,this.direction)}}function as(t){return t instanceof cs}function us(t){return t instanceof ls}function fs(t){return t instanceof rs}const ds={next:class extends cs{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends cs{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},hs={next:class extends ls{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ls{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},gs={next:class extends rs{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends rs{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function _s(t,e){return t?new hs[e](t):null}function ps(t,e,n){return t?new ds[e](t,ys(t,n)):null}function ys(t,n,r="error"){const o=t.getTextContentSize();let i="next"===n?o:"previous"===n?0:n;return(i<0||i>o)&&("clamp"!==r&&e(284,String(n),String(o),t.getKey()),i=i<0?0:o),i}function ms(t,e){return new Ts(t,e)}function xs(t,e){return Zr(t)?new gs[e](t):null}function Cs(t){return t&&t.getChildCaret()||t}function Ss(t){return t&&Cs(t.getAdjacentCaret())}class Ns{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new Ns(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return as(e)?function(t,e){const{direction:n,origin:r}=t,o=ys(r,"focus"===e?is(n):n);return ms(t,o-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return[ms(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=as(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=as(n),o=e=>e.isSameNodeCaret(n)?null:Ss(e)||e.getParentCaret(t);return bs({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:o(e),map:t=>t,step:o})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Ts{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),o=t.getTextContent();return ps(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function vs(t){return Es(t,_s(qo(),t.direction))}function ks(t){return Es(t,t)}function Es(e,n){return e.direction!==n.direction&&t(265),new Ns(e,n,e.direction)}function bs(t){const{initial:e,hasNext:n,step:r,map:o}=t;let i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};const t={done:!1,value:o(i)};return i=r(i),t}}}function Os(e,n){const r=Ds(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case"same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===n.type?1:-1;case"branch":return Ms(r)}}function Ms(t){const{a:e,b:n}=t,r=e.__key,o=n.__key;let i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===o)return-1;if(s.__key===r)return 1}return null===i?1:-1}function As(t,e){return e.is(t)}function ws(t){return Zr(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ds(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=ws(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=ws(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(As(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(As(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((Zr(s)||As(e,s))&&(Zr(i)||As(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function Ps(e,n){const{type:r,key:o,offset:i}=e,s=Ii(e.key);return"text"===r?(Jn(s)||t(266,s.getType(),o),ps(s,n,i)):(Zr(s)||t(267,s.getType(),o),js(s,e.offset,n))}function Is(e,n){const{origin:r,direction:o}=n,i="next"===o;as(n)?e.set(r.getKey(),n.offset,"text"):us(n)?Jn(r)?e.set(r.getKey(),ys(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(fs(n)&&Zr(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Ls(t){const e=pr(),n=tr(e)?e:hr();return Fs(n,t),Qo(n),n}function Fs(t,e){Is(t.anchor,e.anchor),Is(t.focus,e.focus)}function Rs(t){const{anchor:e,focus:n}=t,r=Ps(e,"next"),o=Ps(n,"next"),i=Os(r,o)<=0?"next":"previous";return Es(Js(r,i),Js(o,i))}function Ks(t){const{direction:e,origin:n}=t,r=_s(n,is(e)).getNodeAtCaret();return r?_s(r,e):xs(n.getParentOrThrow(),e)}function Bs(t,e="root"){const n=[t];for(let r=fs(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Ks(r));return n}function zs(t){return!!t&&t.origin.isAttached()}function $s(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=Ys(e,o),l=Bs(s.anchor,r),c=Bs(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(fs(t))a.add(t.origin.getKey());else if(us(t)){const{origin:e}=t;Zr(e)&&!a.has(e.getKey())||u.push(e)}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Ks(_s(e,o)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===i||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){i="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=Un(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=ps(n,o,e.offset)}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped())}}let f,d;for(const t of l)if(zs(t)){f=Ws(t);break}for(const t of c)if(zs(t)){d=Ws(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),o=e.getParentAtCaret();if(!r||!o)return null;const i=r.getParents().reverse();i.push(r);const s=o.getParents().reverse();s.push(o);const l=Math.min(i.length,s.length);let c;for(c=0;c<l&&i[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const o=t[r];if(Ai(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Ji),f=u&&a(s,(t=>n.has(t.getKey())&&Ji(t)));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;xs(t,"previous").splice(0,e.getChildren()),e.remove()}const g=[f,d,...l,...c].find(zs);if(g){return ks(Js(Ws(g),e.direction))}t(269,JSON.stringify(l.map((t=>t.origin.__key))))}function Ws(t){const e=function(t){let e=t;for(;fs(e);){const t=Ss(e);if(!fs(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Jn(e.origin))return as(e)?e:ps(e.origin,n,n);const r=e.getAdjacentCaret();return us(r)&&Jn(r.origin)?ps(r.origin,n,is(n)):e}function Us(t){return as(t)&&t.offset!==ys(t.origin,t.direction)}function Js(t,e){return t.direction===e?t:t.getFlipped()}function Ys(t,e){return t.direction===e?t:Es(Js(t.focus,e),Js(t.anchor,e))}function js(t,e,n){let r=xs(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Js(r,n)}function Hs(e){const{origin:n,offset:r,direction:o}=e;if(r===ys(n,o))return e.getSiblingCaret();if(r===ys(n,is(o)))return Ks(e.getSiblingCaret());const[i]=n.splitText(r);return Jn(i)||t(281),Js(_s(i,"next"),o)}function Vs(t,e){return!0}exports.$addUpdateTag=vi,exports.$applyNodeReplacement=Di,exports.$caretFromPoint=Ps,exports.$caretRangeFromSelection=Rs,exports.$cloneWithProperties=Gi,exports.$comparePointCaretNext=Os,exports.$copyNode=wi,exports.$create=function(t){const e=Yi();return Ir(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createLineBreakNode=kn,exports.$createNodeSelection=gr,exports.$createParagraphNode=yo,exports.$createPoint=qn,exports.$createRangeSelection=hr,exports.$createRangeSelectionFromDom=function(t,e){return _r(null,t,e,null)},exports.$createTabNode=Hn,exports.$createTextNode=Un,exports.$extendCaretToRange=vs,exports.$findMatchingParent=ts,exports.$getAdjacentChildCaret=Ss,exports.$getAdjacentNode=yi,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=Ss(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=Ss(r)}return o&&[o,n]},exports.$getCaretInDirection=Js,exports.$getCaretRange=Es,exports.$getCaretRangeInDirection=Ys,exports.$getCharacterOffsets=or,exports.$getChildCaret=xs,exports.$getChildCaretAtIndex=js,exports.$getChildCaretOrSelf=Cs,exports.$getCollapsedCaretRange=ks,exports.$getCommonAncestor=Ds,exports.$getCommonAncestorResultBranchOrder=Ms,exports.$getEditor=Yi,exports.$getNearestNodeFromDOMNode=Ho,exports.$getNearestRootOrShadowRoot=Mi,exports.$getNodeByKey=Jo,exports.$getNodeByKeyOrThrow=Ii,exports.$getNodeFromDOMNode=Yo,exports.$getPreviousSelection=yr,exports.$getRoot=qo,exports.$getSelection=pr,exports.$getSiblingCaret=_s,exports.$getState=rt,exports.$getStateChange=function(t,e,n){const r=rt(t,n,"direct"),o=rt(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=pr();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=ys,exports.$getTextPointCaret=ps,exports.$getTextPointCaretSlice=ms,exports.$getWritableNodeState=st,exports.$hasAncestor=Ei,exports.$hasUpdateTag=function(t){return Rr()._updateTags.has(t)},exports.$insertNodes=function(t){let e=pr()||yr();null===e&&(e=qo().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=function(t){return Zr(t)&&!t.isInline()},exports.$isChildCaret=fs,exports.$isDecoratorNode=no,exports.$isEditorState=function(t){return t instanceof co},exports.$isElementNode=Zr,exports.$isExtendableTextPointCaret=Us,exports.$isInlineElementOrDecoratorNode=function(t){return Zr(t)&&t.isInline()||no(t)&&t.isInline()},exports.$isLeafNode=function(t){return Jn(t)||En(t)||no(t)},exports.$isLineBreakNode=En,exports.$isNodeCaret=function(t){return t instanceof ns},exports.$isNodeSelection=nr,exports.$isParagraphNode=mo,exports.$isRangeSelection=tr,exports.$isRootNode=oo,exports.$isRootOrShadowRoot=Ai,exports.$isSiblingCaret=us,exports.$isTabNode=Vn,exports.$isTextNode=Jn,exports.$isTextPointCaret=as,exports.$isTextPointCaretSlice=function(t){return t instanceof Ts},exports.$isTokenOrSegmented=Io,exports.$isTokenOrTab=Po,exports.$nodesOfType=function(t){const e=t.getType(),n=Fr();if(n._readOnly){const t=Vi(n).get(e);return t?Array.from(t.values()):[]}const r=n._nodeMap,o=[];for(const[,n]of r)n instanceof t&&n.__type===e&&n.isAttached()&&o.push(n);return o},exports.$normalizeCaret=Ws,exports.$normalizeSelection__EXPERIMENTAL=pt,exports.$onUpdate=ki,exports.$parseSerializedNode=function(t){return Ur(t,Rr()._nodes)},exports.$removeTextFromCaretRange=$s,exports.$rewindSiblingCaret=Ks,exports.$selectAll=function(t){const e=qo();if(tr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),pt(t),t}{const t=e.select(0,e.getChildrenSize());return Qo(pt(t)),t}},exports.$setCompositionKey=Wo,exports.$setPointFromCaret=Is,exports.$setSelection=Qo,exports.$setSelectionFromCaretRange=Ls,exports.$setState=function(t,e,n){let r;if(Ir(),"function"==typeof n){const o=t.getLatest(),i=rt(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return st(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=wi,$splitTextPointCaretNext:n=Hs,rootMode:r="shadowRoot",$shouldSplit:o=Vs}={}){if(as(t))return n(t);const i=t.getParentCaret(r);if(i){const{origin:n}=i;if(fs(t)&&(!n.canBeEmpty()||!o(n,"first")))return Ks(i);const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||n.canBeEmpty()&&o(n,"last"))&&i.insert(e(n).splice(0,0,r))}return i},exports.$splitNode=function(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Ai(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=Ai(n),s=e!==r||i?wi(e):e;if(i)return Zr(e)&&Zr(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,i]=o(n),l=e.getNextSiblings();return i.append(s,...l),[t,r,s]}},[i,s]=o(r);return[i,s]},exports.$updateRangeSelectionFromCaretRange=Fs,exports.ArtificialNode__DO_NOT_USE=go,exports.BLUR_COMMAND=We,exports.CAN_REDO_COMMAND=Be,exports.CAN_UNDO_COMMAND=ze,exports.CLEAR_EDITOR_COMMAND=Re,exports.CLEAR_HISTORY_COMMAND=Ke,exports.CLICK_COMMAND=ee,exports.COLLABORATION_TAG=uo,exports.COMMAND_PRIORITY_CRITICAL=4,exports.COMMAND_PRIORITY_EDITOR=0,exports.COMMAND_PRIORITY_HIGH=3,exports.COMMAND_PRIORITY_LOW=1,exports.COMMAND_PRIORITY_NORMAL=2,exports.CONTROLLED_TEXT_INSERTION_COMMAND=ie,exports.COPY_COMMAND=Ie,exports.CUT_COMMAND=Le,exports.DELETE_CHARACTER_COMMAND=ne,exports.DELETE_LINE_COMMAND=ae,exports.DELETE_WORD_COMMAND=ce,exports.DRAGEND_COMMAND=Pe,exports.DRAGOVER_COMMAND=De,exports.DRAGSTART_COMMAND=we,exports.DROP_COMMAND=Me,exports.DecoratorNode=eo,exports.ElementNode=Qr,exports.FOCUS_COMMAND=$e,exports.FORMAT_ELEMENT_COMMAND=Ae,exports.FORMAT_TEXT_COMMAND=ue,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=ao,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=be,exports.INSERT_LINE_BREAK_COMMAND=re,exports.INSERT_PARAGRAPH_COMMAND=oe,exports.INSERT_TAB_COMMAND=Ee,exports.INTERNAL_$isBlock=Ji,exports.IS_ALL_FORMATTING=b,exports.IS_BOLD=1,exports.IS_CODE=16,exports.IS_HIGHLIGHT=E,exports.IS_ITALIC=2,exports.IS_STRIKETHROUGH=v,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=k,exports.KEY_ARROW_DOWN_COMMAND=xe,exports.KEY_ARROW_LEFT_COMMAND=pe,exports.KEY_ARROW_RIGHT_COMMAND=ge,exports.KEY_ARROW_UP_COMMAND=me,exports.KEY_BACKSPACE_COMMAND=Ne,exports.KEY_DELETE_COMMAND=ve,exports.KEY_DOWN_COMMAND=he,exports.KEY_ENTER_COMMAND=Ce,exports.KEY_ESCAPE_COMMAND=Te,exports.KEY_MODIFIER_COMMAND=Ue,exports.KEY_SPACE_COMMAND=Se,exports.KEY_TAB_COMMAND=ke,exports.LineBreakNode=Tn,exports.MOVE_TO_END=_e,exports.MOVE_TO_START=ye,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=Oe,exports.PASTE_COMMAND=se,exports.PASTE_TAG="paste",exports.ParagraphNode=_o,exports.REDO_COMMAND=de,exports.REMOVE_TEXT_COMMAND=le,exports.RootNode=ro,exports.SELECTION_CHANGE_COMMAND=Zt,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=te,exports.SELECT_ALL_COMMAND=Fe,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=ho,exports.SKIP_SCROLL_INTO_VIEW_TAG=fo,exports.TEXT_TYPE_TO_FORMAT=R,exports.TabNode=jn,exports.TextNode=In,exports.UNDO_COMMAND=fe,exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=Qt,exports.createEditor=function(t){const e=t||{},n=Br(),r=e.theme||{},o=void 0===t?n:e.parentEditor||null,i=e.disableEvents||!1,s=so(),l=e.namespace||(null!==o?o._config.namespace:ni()),c=e.editorState,a=[ro,In,Tn,jn,_o,go,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else{h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null}const{ownNodeConfig:o}=Zi(e),i=e.getType(),s=e.transform(),l=new Set;o&&o.$transform&&l.add(o.$transform),null!==s&&l.add(s),h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:ot(a[t]),transforms:l})}}const g=new Co(s,o,h,{disableEvents:i,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,o=t=>{Object.keys(t).forEach((e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e])}))};return t.forEach((t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&o(n)})),e&&o(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=C),g},exports.createSharedNodeState=ot,exports.createState=function(t,e){return new nt(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=is,exports.getDOMOwnerDocument=Ti,exports.getDOMSelection=Ri,exports.getDOMSelectionFromTarget=Ki,exports.getDOMTextNode=Ro,exports.getEditorPropertyFromDOMNode=Do,exports.getNearestEditorFromDOMNode=wo,exports.getRegisteredNode=ko,exports.getRegisteredNodeOrThrow=vo,exports.getStaticNodeConfig=Zi,exports.isBlockDomNode=Ui,exports.isCurrentlyReadOnlyMode=Pr,exports.isDOMDocumentNode=Fo,exports.isDOMNode=zi,exports.isDOMTextNode=Lo,exports.isDOMUnmanaged=Xi,exports.isDocumentFragment=$i,exports.isExactShortcutMatch=ai,exports.isHTMLAnchorElement=function(t){return Bi(t)&&"A"===t.tagName},exports.isHTMLElement=Bi,exports.isInlineDomNode=Wi,exports.isLexicalEditor=Ao,exports.isModifierMatch=ci,exports.isSelectionCapturedInDecoratorInput=Oo,exports.isSelectionWithinEditor=Mo,exports.makeStepwiseIterator=bs,exports.removeFromParent=zo,exports.resetRandomKey=function(){To=1},exports.safeCast=function(t){return t},exports.setDOMUnmanaged=function(t){t.__lexicalUnmanaged=!0},exports.setNodeIndentFromDOM=qi,exports.shallowMergeConfig=function(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t};