lexical 0.38.3-nightly.20251104.0 → 0.38.3-nightly.20251106.0

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=0,_=1,p=2,y=128,m=1,x=2,C=3,S=4,N=5,T=6,v=l||c||d?" ":"​",k="\n\n",E=i?" ":v,b="֑-߿יִ-﷽ﹰ-ﻼ",O="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",M=new RegExp("^[^"+O+"]*["+b+"]"),A=new RegExp("^[^"+b+"]*["+O+"]"),w={bold:1,capitalize:1024,code:16,highlight:y,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},D={directionless:1,unmergeable:2},P={center:2,end:6,justify:4,left:1,right:3,start:5},I={[x]:"center",[T]:"end",[S]:"justify",[m]:"left",[C]:"right",[N]:"start"},L={normal:0,segmented:2,token:1},F={[g]:"normal",[p]:"segmented",[_]:"token"},R="$config";function K(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Zr(s)&&K(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}let B=!1,z=0;function W(t){z=t.timeStamp}function $(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==Uo(t,n)}function U(t,e,n){const r=Ii(ki(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&ni(e,s,o,i,!1)}function J(t,e,n){if(tr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return Do(e)&&n.isAttached()}function Y(t,e,n,r){for(let o=t;o&&!Vi(o);o=xi(o)){const t=Uo(o,e);if(void 0!==t){const e=Wo(t,n);if(e)return no(e)||!Fi(o)?void 0:[o,e]}else if(o===r)return[r,Vo(n)]}}function j(t,e,n){B=!0;const r=performance.now()-z>100;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,_=Y(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Jn(y)&&Do(g)&&J(o,g,y)&&U(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=$o(r),s=r.parentNode;if(null!=s&&r!==a&&null===o&&!$(r,s,t)){if(i){const t=(Fi(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];($(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||$(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(u&&Go(o),i&&_i(t)&&o.insertRawText(f))})}finally{B=!1}}function H(t){const e=t._observer;if(null!==e){j(t,e.takeRecords(),e)}}function V(t){!function(t){0===z&&ki(t).addEventListener("textInput",W,!0)}(t),t._observer=new MutationObserver((e,n)=>{j(t,e,n)})}class G{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||nt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0)}}function q(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function X(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}=qi(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 Q{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 et(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 Q(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=et(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 Z(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Q(e,tt(e));return e.__state=n,n}function tt(t){return t.__state?t.__state.sharedNodeState:So($i(),t.getType()).sharedNodeState}function et(t){if(t)for(const e in t)return t}function nt(t){return t}function rt(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 ot(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 it(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function st(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&&rt(n,t,e)||e&&rt(n,e,t)||t&&ot(n,t,e)||e&&ot(n,e,t))}(c,a))}function lt(t,e){const n=t.mergeWithSibling(e),r=Rr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function ct(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(st(e,r)){r=lt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Jn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(st(r,n)){r=lt(r,n);break}break}n.remove()}}else r.remove()}function at(t){return ut(t.anchor),ut(t.focus),t}function ut(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 ft,dt,ht,gt,_t,pt,yt,mt,xt,Ct,St="",Nt=null,Tt=null,vt="",kt=!1,Et=!1;function bt(t,e){const n=yt.get(t);if(null!==e){const n=Jt(t);n.parentNode===e&&e.removeChild(n)}if(mt.has(t)||dt._keyToDOMMap.delete(t),Zr(n)){const t=Bt(n,yt);Ot(t,0,t.length-1,null)}void 0!==n&&di(Ct,ht,gt,n,"destroyed")}function Ot(t,e,n,r){let o=e;for(;o<=n;++o){const e=t[o];void 0!==e&&bt(e,r)}}function Mt(t,e){t.setProperty("text-align",e)}const At="40px";function wt(t,e){const n=ft.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")||At;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`)}function Dt(t,e){const n=t.style;0===e?Mt(n,""):1===e?Mt(n,"left"):2===e?Mt(n,"center"):3===e?Mt(n,"right"):4===e?Mt(n,"justify"):5===e?Mt(n,"start"):6===e&&Mt(n,"end")}function Pt(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 It(e,n){const r=mt.get(e);void 0===r&&t(60);const o=r.createDOM(ft,dt);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,dt),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(Pt(o,r),0!==t&&wt(o,t),0!==e){const t=e-1;Lt(Bt(r,mt),r,0,t,r.getDOMSlot(o))}const n=r.__format;0!==n&&Dt(o,n),r.isInline()||Rt(null,r,o),yi(r)&&(St+=k,vt+=k)}else{const t=r.getTextContent();if(no(r)){const t=r.decorate(dt,ft);null!==t&&Wt(e,t),o.contentEditable="false"}St+=t,vt+=t}return null!==n&&n.insertChild(o),di(Ct,ht,gt,r,"created"),o}function Lt(t,e,n,r,o){const i=St;St="";let s=n;for(;s<=r;++s){It(t[s],o);const e=mt.get(t[s]);null!==e&&Jn(e)&&null===Nt&&(Nt=e.getFormat(),Tt=e.getStyle())}yi(e)&&(St+=k);o.element.__lexicalTextContent=St,St=i+St}function Ft(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 Rt(t,e,n){const r=Ft(t,yt),o=Ft(e,mt);r!==o&&e.getDOMSlot(n).setManagedLineBreak(o)}function Kt(e,n,r){var o;Nt=null,Tt=null,function(e,n,r){const o=St,i=e.__size,s=n.__size;St="";const l=r.element;if(1===i&&1===s){const t=e.__first,r=n.__first;if(t===r)zt(t,l);else{const e=Jt(t),n=It(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}bt(t,null)}const o=mt.get(r);Jn(o)&&null===Nt&&(Nt=o.getFormat(),Tt=o.getStyle())}else{const o=Bt(e,yt),c=Bt(n,mt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&Lt(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;Ot(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=$t(zt(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=mi(dt,r);t===u?u=$t(zt(r,i.element)):(i.withBefore(u).insertChild(t),zt(r,i.element)),f++,d++}else It(r,i.withBefore(u)),d++;else u=$t(Jt(t)),bt(t,i.element),f++}const o=mt.get(r);null!==o&&Jn(o)&&null===Nt&&(Nt=o.getFormat(),Tt=o.getStyle())}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:dt.getElementByKey(e);Lt(n,t,d,l,i.withBefore(r))}else g&&!h&&Ot(e,f,s,i.element)}(n,o,c,i,s,r)}yi(n)&&(St+=k);l.__lexicalTextContent=St,St=o+St}(e,n,n.getDOMSlot(r)),o=n,null==Nt||Nt===o.__textFormat||Et||o.setTextFormat(Nt),function(t){null==Tt||Tt===t.__textStyle||Et||t.setTextStyle(Tt)}(n)}function Bt(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 zt(e,n){const r=yt.get(e);let o=mt.get(e);void 0!==r&&void 0!==o||t(61);const i=kt||pt.has(e)||_t.has(e),s=mi(dt,e);if(r===o&&!i){if(Zr(r)){const t=s.__lexicalTextContent;void 0!==t&&(St+=t,vt+=t)}else{const t=r.getTextContent();vt+=t,St+=t}return s}if(r!==o&&i&&di(Ct,ht,gt,o,"updated"),o.updateDOM(r,s,ft)){const r=It(e,null);return null===n&&t(62),n.replaceChild(r,s),bt(e,null),r}if(Zr(r)&&Zr(o)){const t=o.__indent;(kt||t!==r.__indent)&&wt(s,t);const e=o.__format;if((kt||e!==r.__format)&&Dt(s,e),i&&(Kt(r,o,s),oo(o)||o.isInline()||Rt(r,o,s)),yi(o)&&(St+=k,vt+=k),(kt||o.__dir!==r.__dir)&&(Pt(s,o),oo(o)&&!kt))for(const t of o.getChildren())if(Zr(t)){Pt(mi(dt,t.getKey()),t)}}else{const t=o.getTextContent();if(no(o)){const t=o.decorate(dt,ft);null!==t&&Wt(e,t)}St+=t,vt+=t}if(!Et&&oo(o)&&o.__cachedText!==vt){const t=o.getWritable();t.__cachedText=vt,o=t}return s}function Wt(t,e){let n=dt._pendingDecorators;const r=dt._decorators;if(null===n){if(r[t]===e)return;n=Yo(dt)}n[t]=e}function $t(t){let e=t.nextSibling;return null!==e&&e===dt._blockCursorElement&&(e=e.nextSibling),e}function Ut(t,e,n,r,o,i){St="",vt="",kt=2===r,dt=n,ft=n._config,ht=n._nodes,gt=dt._listeners.mutation,_t=o,pt=i,yt=t._nodeMap,mt=e._nodeMap,Et=e._readOnly,xt=new Map(n._keyToDOMMap);const s=new Map;return Ct=s,zt("root",null),dt=void 0,ht=void 0,_t=void 0,pt=void 0,yt=void 0,mt=void 0,ft=void 0,xt=void 0,Ct=void 0,s}function Jt(e){const n=xt.get(e);return void 0===n&&t(75,e),n}function Yt(t){return{type:t}}const jt=Yt("SELECTION_CHANGE_COMMAND"),Ht=Yt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Vt=Yt("CLICK_COMMAND"),Gt=Yt("DELETE_CHARACTER_COMMAND"),qt=Yt("INSERT_LINE_BREAK_COMMAND"),Xt=Yt("INSERT_PARAGRAPH_COMMAND"),Qt=Yt("CONTROLLED_TEXT_INSERTION_COMMAND"),Zt=Yt("PASTE_COMMAND"),te=Yt("REMOVE_TEXT_COMMAND"),ee=Yt("DELETE_WORD_COMMAND"),ne=Yt("DELETE_LINE_COMMAND"),re=Yt("FORMAT_TEXT_COMMAND"),oe=Yt("UNDO_COMMAND"),ie=Yt("REDO_COMMAND"),se=Yt("KEYDOWN_COMMAND"),le=Yt("KEY_ARROW_RIGHT_COMMAND"),ce=Yt("MOVE_TO_END"),ae=Yt("KEY_ARROW_LEFT_COMMAND"),ue=Yt("MOVE_TO_START"),fe=Yt("KEY_ARROW_UP_COMMAND"),de=Yt("KEY_ARROW_DOWN_COMMAND"),he=Yt("KEY_ENTER_COMMAND"),ge=Yt("KEY_SPACE_COMMAND"),_e=Yt("KEY_BACKSPACE_COMMAND"),pe=Yt("KEY_ESCAPE_COMMAND"),ye=Yt("KEY_DELETE_COMMAND"),me=Yt("KEY_TAB_COMMAND"),xe=Yt("INSERT_TAB_COMMAND"),Ce=Yt("INDENT_CONTENT_COMMAND"),Se=Yt("OUTDENT_CONTENT_COMMAND"),Ne=Yt("DROP_COMMAND"),Te=Yt("FORMAT_ELEMENT_COMMAND"),ve=Yt("DRAGSTART_COMMAND"),ke=Yt("DRAGOVER_COMMAND"),Ee=Yt("DRAGEND_COMMAND"),be=Yt("COPY_COMMAND"),Oe=Yt("CUT_COMMAND"),Me=Yt("SELECT_ALL_COMMAND"),Ae=Yt("CLEAR_EDITOR_COMMAND"),we=Yt("CLEAR_HISTORY_COMMAND"),De=Yt("CAN_REDO_COMMAND"),Pe=Yt("CAN_UNDO_COMMAND"),Ie=Yt("FOCUS_COMMAND"),Le=Yt("BLUR_COMMAND"),Fe=Yt("KEY_MODIFIER_COMMAND"),Re=Object.freeze({}),Ke=[["keydown",function(t,e){if(Be=t.timeStamp,ze=t.key,e.isComposing())return;if(pi(e,se,t))return;if(null==t.key)return;if(Ge&&ai(t))return Gr(e,()=>{sn(e,qe)}),Ge=!1,void(qe="");if(function(t){return si(t,"ArrowRight",{shiftKey:"any"})}(t))pi(e,le,t);else if(function(t){return si(t,"ArrowRight",li)}(t))pi(e,ce,t);else if(function(t){return si(t,"ArrowLeft",{shiftKey:"any"})}(t))pi(e,ae,t);else if(function(t){return si(t,"ArrowLeft",li)}(t))pi(e,ue,t);else if(function(t){return si(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))pi(e,fe,t);else if(function(t){return si(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))pi(e,de,t);else if(function(t){return si(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))He=!0,pi(e,he,t);else if(function(t){return" "===t.key}(t))pi(e,ge,t);else if(function(t){return o&&si(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),He=!0,pi(e,qt,!0);else if(function(t){return si(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))He=!1,pi(e,he,t);else if(function(t){return si(t,"Backspace",{shiftKey:"any"})||o&&si(t,"h",{ctrlKey:!0})}(t))ai(t)?pi(e,_e,t):(t.preventDefault(),pi(e,Gt,!0));else if(function(t){return"Escape"===t.key}(t))pi(e,pe,t);else if(function(t){return si(t,"Delete",{})||o&&si(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),pi(e,Gt,!1)):pi(e,ye,t);else if(function(t){return si(t,"Backspace",ci)}(t))t.preventDefault(),pi(e,ee,!0);else if(function(t){return si(t,"Delete",ci)}(t))t.preventDefault(),pi(e,ee,!1);else if(function(t){return o&&si(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),pi(e,ne,!0);else if(function(t){return o&&(si(t,"Delete",{metaKey:!0})||si(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),pi(e,ne,!1);else if(function(t){return si(t,"b",li)}(t))t.preventDefault(),pi(e,re,"bold");else if(function(t){return si(t,"u",li)}(t))t.preventDefault(),pi(e,re,"underline");else if(function(t){return si(t,"i",li)}(t))t.preventDefault(),pi(e,re,"italic");else if(function(t){return si(t,"Tab",{shiftKey:"any"})}(t))pi(e,me,t);else if(function(t){return si(t,"z",li)}(t))t.preventDefault(),pi(e,oe,void 0);else if(function(t){if(o)return si(t,"z",{metaKey:!0,shiftKey:!0});return si(t,"y",{ctrlKey:!0})||si(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),pi(e,ie,void 0);else{const n=e._editorState._selection;null===n||tr(n)?ui(t)&&(t.preventDefault(),pi(e,Me,t)):!function(t){return si(t,"c",li)}(t)?!function(t){return si(t,"x",li)}(t)?ui(t)&&(t.preventDefault(),pi(e,Me,t)):(t.preventDefault(),pi(e,Oe,t)):(t.preventDefault(),pi(e,be,t))}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&pi(e,Fe,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ri(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Gr(e,()=>{vo(n)||(je=!0)})}],["compositionstart",function(t,e){Gr(e,()=>{const n=pr();if(tr(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Bo(r.key),(t.timeStamp<Be+30||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||Jn(o)&&o.getStyle()!==n.style)&&pi(e,Qt,E)}})}],["compositionend",function(t,e){i?Ve=!0:c||!l&&!d?Gr(e,()=>{sn(e,t.data)}):(Ge=!0,qe=t.data)}],["input",function(t,e){t.stopPropagation(),Gr(e,()=>{if(Fi(t.target)&&vo(t.target))return;const n=pr(),r=t.data,o=on(t);if(null!=r&&tr(n)&&Ze(n,o,r,t.timeStamp,!1)){Ve&&(sn(e,r),Ve=!1);const o=n.anchor.getNode(),a=Ii(ki(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)===ti(a.anchorNode)||pi(e,Qt,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(Be=0,Bo(null))}else{ei(!1,e,null!==r?r:void 0),Ve&&(sn(e,r||void 0),Ve=!1)}!function(){Ir();const t=Rr();H(t)}()},{event:t}),$e=null}],["click",function(t,e){Gr(e,()=>{const n=pr(),r=Ii(ki(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===Ho().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=Xi(i,t=>Zr(t)&&!t.isInline());Zr(t)&&t.select(0)}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Fi(n)||Do(n)){Go(_r(o,r,e,t))}}pi(e,Vt,t)})}],["cut",Re],["copy",Re],["dragstart",Re],["dragover",Re],["dragend",Re],["paste",Re],["focus",Re],["blur",Re],["drop",Re]];s&&Ke.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,o=on(e);if("deleteCompositionText"===r||i&&_i(n))return;if("insertCompositionText"===r)return;Gr(n,()=>{const i=pr();if("deleteContentBackward"===r){if(null===i){const t=yr();if(!tr(t))return;Go(t.clone())}if(tr(i)){const r=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===ze&&s<Be+30&&n.isComposing()&&r){if(Bo(null),Be=0,setTimeout(()=>{Gr(n,()=>{Bo(null)})},30),tr(i)){const e=i.anchor.getNode();e.markDirty(),Jn(e)||t(142),rn(i,e)}}else{Bo(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(gi(i.anchor,!0))),!c){pi(n,Gt,!0);const t=pr();f&&tr(t)&&t.isCollapsed()&&(Xe=t,setTimeout(()=>Xe=null))}}return}}var s;if(!tr(i))return;const l=e.data;null!==$e&&ei(!1,n,$e),i.dirty&&null===$e||!i.isCollapsed()||oo(i.anchor.getNode())||null===o||i.applyDOMRange(o),$e=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":pi(n,Qt,e);break;case"insertFromComposition":Bo(null),pi(n,Qt,e);break;case"insertLineBreak":Bo(null),pi(n,qt,!1);break;case"insertParagraph":Bo(null),He&&!c?(He=!1,pi(n,qt,!1)):pi(n,Xt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":pi(n,Zt,e);break;case"deleteByComposition":(function(t,e){return t!==e||Zr(t)||Zr(e)||!Ao(t)||!Ao(e)})(d,h)&&pi(n,te,e);break;case"deleteByDrag":case"deleteByCut":pi(n,te,e);break;case"deleteContent":pi(n,Gt,!1);break;case"deleteWordBackward":pi(n,ee,!0);break;case"deleteWordForward":pi(n,ee,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":pi(n,ne,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":pi(n,ne,!1);break;case"formatStrikeThrough":pi(n,re,"strikethrough");break;case"formatBold":pi(n,re,"bold");break;case"formatItalic":pi(n,re,"italic");break;case"formatUnderline":pi(n,re,"underline");break;case"historyUndo":pi(n,oe,void 0);break;case"historyRedo":pi(n,ie,void 0)}else{if("\n"===l)e.preventDefault(),pi(n,qt,!1);else if(l===k)e.preventDefault(),pi(n,Xt,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=l&&Ze(i,o,l,e.timeStamp,!0)?(e.preventDefault(),pi(n,Qt,l)):$e=l;We=e.timeStamp}})}(e,n)]);let Be=0,ze=null,We=0,$e=null;const Ue=new WeakMap,Je=new WeakMap;let Ye=!1,je=!1,He=!1,Ve=!1,Ge=!1,qe="",Xe=null,Qe=[0,"",0,"root",0];function Ze(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=Rr(),u=Ii(ki(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||We<r+50)||c.isDirty()&&g<2||Xo(n))&&i.offset!==l.offset&&!c.isComposing()||wo(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==Io(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=Ao(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 tn(t,e){return Do(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function en(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;Ye&&(Ye=!1,tn(o,i)&&tn(s,l)&&!Xe)||Gr(n,()=>{if(!r)return void Go(null);if(!Eo(n,o,s))return;let c=pr();if(Xe&&tr(c)&&c.isCollapsed()){const t=c.anchor,e=Xe.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=Xe.clone(),Go(c))}if(Xe=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=ki(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=Qe,h=Ho(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)nn(c,l,a);else if("text"===r.type)Jn(o)||t(141),rn(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();nn(t,n,r)}(c,e):nn(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=2047,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}}pi(n,jt,void 0)})}function nn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function rn(t,e){nn(t,e.getFormat(),e.getStyle())}function on(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function sn(t,e){const n=t._compositionKey;if(Bo(null),null!==n&&null!=e){if(""===e){const e=Wo(n),r=Io(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&Jn(e)&&ni(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 pi(t,he,null)}}}ei(!0,t,e)}function ln(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const cn=new Map;function an(t){const e=Li(t.target);if(null===e)return;const n=Oo(e.anchorNode);if(null===n)return;je&&(je=!1,Gr(n,()=>{const r=yr(),o=e.anchorNode;if(Fi(o)||Do(o)){Go(_r(r,e,n,t))}}));const r=Qo(n),o=r[r.length-1],i=o._key,s=cn.get(i),l=s||o;l!==n&&en(e,l,!1),en(e,n,!0),n!==o?cn.set(i,n):s&&cn.delete(i)}function un(t){t._lexicalHandled=!0}function fn(t){return!0===t._lexicalHandled}const dn=()=>{};function hn(e){const n=Ue.get(e);if(void 0===n)return void dn();const r=Je.get(n);if(void 0===r)return void dn();const o=r-1;o>=0||t(164),Ue.delete(e),Je.set(n,o),0===o&&n.removeEventListener("selectionchange",an);const i=Mo(e);bo(i)?(!function(t){if(null!==t._parentEditor){const e=Qo(t),n=e[e.length-1]._key;cn.get(n)===t&&cn.delete(n)}else cn.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=ln(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function gn(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();Ti(o,t)&&n.set(t.__key,0,"element");Ti(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();Ro(t),mr(i,o,e,-1)}else Ro(t);n||bi(o)||o.canBeEmpty()||!o.isEmpty()||gn(o,e),e&&i&&oo(o)&&o.isEmpty()&&o.selectEnd()}const _n=Symbol.for("ephemeral");function pn(t){return t[_n]||!1}class yn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=qi(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}),Fo(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=Wo(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:Wo(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(bi(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:Wo(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:Wo(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?Ms(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ms(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Es(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ms(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(){if(pn(this))return this;const e=Wo(this.__key);return null===e&&t(113),e}getWritable(){if(pn(this))return this;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 Ko(o),o;const l=ji(o);return i.add(r),Ko(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 tt(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&Z(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){gn(this,!0,t)}replace(e,n){Ir();let r=pr();null!==r&&(r=r.clone()),Ai(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;Ro(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,h=o.__next,g=o.__parent;if(gn(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)){Go(r);const t=r.anchor,e=r.focus;t.key===i&&Qn(t,l),e.key===i&&Qn(e,l)}return zo()===i&&Bo(s),l}insertAfter(t,e=!0){Ir(),Ai(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(Ro(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(),Ai(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key;Ro(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 ho()}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()}}const mn="history-merge",xn="collaboration",Cn="skip-scroll-into-view",Sn="skip-dom-selection",Nn="skip-selection-focus";class Tn extends yn{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&&zi(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&&zi(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 Mi(new Tn)}function En(t){return t instanceof Tn}function bn(t){return Do(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function On(t,e){return 16&e?"code":e&y?"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=fi(o,"base");void 0!==s&&i.add(...s),s=fi(o,"underlineStrikethrough");let l=!1;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const t in w){const r=w[t];if(s=fi(o,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&i.remove(...s);continue}(0===(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?v:"");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 yn{__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 F[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===zo()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=w[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Lo(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:$n,priority:0}),em:()=>({conversion:$n,priority:0}),i:()=>({conversion:$n,priority:0}),mark:()=>({conversion:$n,priority:0}),s:()=>({conversion:$n,priority:0}),span:()=>({conversion:Ln,priority:0}),strong:()=>({conversion:$n,priority:0}),sub:()=>({conversion:$n,priority:0}),sup:()=>({conversion:$n,priority:0}),u:()=>({conversion:$n,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 Fi(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?w[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?D[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Lo(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=L[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=zo();t!==o.anchor.key&&t!==o.focus.key||Bo(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=zo(),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=it(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=it(e,n);const i=n.__key;o===r&&Bo(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&&Ko(e);null!==n&&Ko(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;zo()===o&&Bo(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(!Fi(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,Fi(n)){const t=n.style.display;if(""===t&&!Bi(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(Do(n))return n;if("BR"===n.nodeName)return null}}const Wn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function $n(t){const e=Wn[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Yn(t.style,e),node:null}}function Un(t=""){return Mi(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=fi(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 Mi(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 ks(Bs(As(this,"next")),Bs(As(t,"next")))<0}getNode(){const e=Wo(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()||(zo()===i&&Bo(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=Wo(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=ds(t[0],"next");Ds(Ts(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(cs(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(ls(t.focus)&&Zr(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=ps(t.focus.origin,"previous");cs(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=ms(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=Bs(t.anchor),r=Bs(t.anchor.getFlipped()),o=t=>ss(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}($s(Is(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),at(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=Lo(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=w[t];return 0!==(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),go(i))i.splice(0,0,[s]);else{const t=oo(o)?ho().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&&ws(l,Bs(As(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&&(wo(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Jn(t)&&t.canInsertTextBefore()&&!wo(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&&(wo(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Jn(t)&&!wo(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(Ao(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(_)&&!Ao(_)&&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(Ao(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;Ps(this,Ks(Is(this))),t&&pr()!==this&&Go(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Bo(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),Bo(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(wo(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||wo(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||wo(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=Xi(n,Wi),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=ho();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)&&Wi(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){const r=n.getParentOrThrow().getLastChild();let o=n;const i=[n];for(;o!==r;)o.getNextSibling()||t(140),o=o.getNextSibling(),i.push(o);let s=e;for(const t of i)s=s.insertAfter(t)}(r,u));const d=Xi(s,Wi);c&&Zr(d)&&(c.canMergeWhenEmpty()||Wi(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=ho();return Ho().splice(this.anchor.offset,0,[t]),t.select(),t}const e=vr(this),n=Xi(this.anchor.getNode(),Wi);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=Ii(ki(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()||Pi(s,o,l),this.dirty){let t=mi(o,this.anchor.key),e=mi(o,this.focus.key);"text"===this.anchor.type&&(t=Io(t)),"text"===this.focus.type&&(e=Io(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:Ei(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];Ti(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=Ss(As(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(cs(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=Bs(e);Ps(this,Ts(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(ls(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()),Go(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Ps(this,Ts(!e.origin.isEmpty()&&n.isEmpty()?Ls(ds(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!(Xo(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(bi(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(Fi(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=qo(f),Jn(i))s=gs(i,l?"next":"previous");else{let c=qo(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=gs(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)&&qo(e)===c?t:t+1,c=c.getParentOrThrow()}if(Zr(c))return qn(c.__key,s,"element")}}else i=qo(e);return Jn(i)?qn(i.__key,gs(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||!Eo(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=qo(t),r=qo(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=!B&&(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||void 0===s)&&tr(t)&&!Eo(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")}return}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(xn)&&f!==i||null!==f&&ko(f))return;if(!tr(e))return void(null!==t&&Eo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=mi(n,g),y=mi(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=Io(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=Io(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(),Qe=[E,b,O,M,A]),a!==m||u!==x||l!==T||c!==v||"Range"===r.type&&N||(null!==f&&i.contains(f)||o.has(Nn)||i.focus({preventScroll:!0}),"element"===d.type))){if(Nr(r,T,m,v,x),!o.has(Cn)&&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=Ci(n),o=vi(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=ki(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=xi(a)}}(n,e,i)}}Ye=!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(;!Wi(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=ho();return Ho().append(t),t.select(),[Ho(),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=As(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!zs(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 Ss(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(cs(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()),Go(t),!0}return c=Bs(c),l&&ws(t.anchor,c),ws(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=yo.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=Mo(r);if(bo(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=So(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 Wr(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function $r(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=0!==t._dirtyType,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(),_=Ut(i,n,t,e,r,o)}catch(e){if(e instanceof Error&&t._onError(e),Ar)throw e;return _o(t,null,r,n),V(t),t._dirtyType=2,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,m=t._normalizedNodes,x=t._updateTags,C=t._deferred;c&&(t._dirtyType=0,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=Yo(t)),delete r[i])}(t,n);const S=o?null:Ii(ki(t));if(t._editable&&null!==S&&(c||null===l||l.dirty||!l.is(s))&&null!==r&&!x.has(Sn)){Or=t,br=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&Pi(e,t,r),Tr(s,l,t,S,x,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()){Di(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&Di(e)){const n=e.getPreviousSibling();(null===n||Di(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&&Pi(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,_,x,p,i),tr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(jt,void 0);const N=t._pendingDecorators;null!==N&&(t._decorators=N,t._pendingDecorators=null,jr("decorator",t,!0,N)),function(t,e,n){const r=jo(e),o=jo(n);r!==o&&jr("textcontent",t,!0,o)}(t,e||i,n),jr("update",t,!0,{dirtyElements:y,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:m,prevEditorState:e||i,tags:x}),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,C),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),$r(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,$r(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();xo(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Ii(ki(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),0!==e._dirtyType&&(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()&&ct(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=zo(),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()&&ct(r),void 0!==r&&Wr(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&&Wr(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)&&K(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=2,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=0!==e._dirtyType||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&&To(()=>{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 yn{__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 I[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:Wo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Wo(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+=k)}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+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=P[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=w[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return Lo(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?P[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){pn(this)&&t(324,this.__key,this.__type);const o=this.getChildrenSize(),i=this.getWritable();e+n<=o||t(226,String(e),String(n),String(o));const s=i.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=o-n+r.length;if(0!==e)if(e===o)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;Ro(e.getWritable()),c.push(r),e=n}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,Ro(n);const r=e.__key;if(null===d)i.__first=r,n.__prev=null;else{const t=d.getWritable();t.__next=r,n.__prev=t.__key}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e}if(e+n===o){if(null!==d){d.getWritable().__next=null,i.__last=d.__key}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key}else t.__prev=null}if(i.__size=f,c.length){const t=pr();if(tr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:o}=t;to(r,e,n)&&Cr(r,r.getNode(),this,u,a),to(o,e,n)&&Cr(o,o.getNode(),this,u,a),0!==f||this.canBeEmpty()||bi(this)||this.remove()}}return i}getDOMSlot(t){return new qr(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Fi(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&&""===n||bi(this)||this.getChildren().some(Jn)||(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 yn{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()&&0!==Rr()._dirtyType||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 Ho().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(Ho())}))}}class ao extends Qr{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class uo extends Qr{static getType(){return"paragraph"}static clone(t){return new uo(t.__key)}createDOM(t){const e=document.createElement("p"),n=fi(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:fo,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Fi(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return ho().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(Jn);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=ho();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 fo(t){const e=ho();return t.style&&(e.setFormat(t.style.textAlign),Hi(t,e)),{node:e}}function ho(){return Mi(new uo)}function go(t){return t instanceof uo}function _o(t,e,n,r){const o=t._keyToDOMMap;o.clear(),t._editorState=so(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,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))}function po(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=qi(r),o=r.transform;if(!n.has(o)){n.add(o);const t=r.transform();t&&e.add(t)}if(t){const n=t.$transform;n&&e.add(n),r=t.extends}else{const t=Object.getPrototypeOf(r);r=t.prototype instanceof yn&&t!==yn?t:void 0}}return e}class yo{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=0,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=Zo(),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=Yi(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=Yi(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=Wo(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:mn}: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 pi(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=fi(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,_o(this,e,t,r),null!==e&&(this._config.disableEvents||hn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=vi(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=2,V(this),this._updateTags.add(mn),Yr(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;Ue.set(t,n);const r=Je.get(n)??0;r<1&&n.addEventListener("selectionchange",an),Je.set(n,r+1),t.__lexicalEditor=e;const o=ln(t);for(let n=0;n<Ke.length;n++){const[r,i]=Ke[n],s="function"==typeof i?t=>{fn(t)||(un(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(fn(t))return;un(t);const n=e.isEditable();switch(r){case"cut":return n&&pi(e,Oe,t);case"copy":return pi(e,be,t);case"paste":return n&&pi(e,Zt,t);case"dragstart":return n&&pi(e,ve,t);case"dragover":return n&&pi(e,ke,t);case"dragend":return n&&pi(e,Ee,t);case"focus":return n&&pi(e,Ie,t);case"blur":return n&&pi(e,Le,t);case"drop":return n&&pi(e,Ne,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(mn),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),H(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=2,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,xo(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=Ho();null!==r?r.dirty||Go(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),Si("focus"),Ni(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Ii(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()}}}yo.version="0.38.3-nightly.20251104.0+prod.cjs";let mo=null;function xo(t){mo=t}let Co=1;function So(e,n){const r=No(e,n);return void 0===r&&t(30,n),r}function No(t,e){return t._nodes.get(e)}const To="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function vo(t){return no(Jo(t))}function ko(t){const e=document.activeElement;if(!Fi(e))return!1;const n=e.nodeName;return no(Jo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Mo(e))}function Eo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!ko(e)&&Oo(e)===t}catch(t){return!1}}function bo(t){return t instanceof yo}function Oo(t){let e=t;for(;null!=e;){const t=Mo(e);if(bo(t))return t;e=xi(e)}return null}function Mo(t){return t?t.__lexicalEditor:null}function Ao(t){return Vn(t)||t.isToken()}function wo(t){return Ao(t)||t.isSegmented()}function Do(t){return Ri(t)&&3===t.nodeType}function Po(t){return Ri(t)&&9===t.nodeType}function Io(t){let e=t;for(;null!=e;){if(Do(e))return e;e=e.firstChild}return null}function Lo(t,e,n){const r=w[e];if(null!==n&&(t&r)===(n&r))return t;let o=t^r;return"subscript"===e?o&=~w.superscript:"superscript"===e?o&=~w.subscript:"lowercase"===e?(o&=~w.uppercase,o&=~w.capitalize):"uppercase"===e?(o&=~w.lowercase,o&=~w.capitalize):"capitalize"===e&&(o&=~w.lowercase,o&=~w.uppercase),o}function Fo(t,e){const n=function(){const t=mo;return mo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Ir(),Lr();const r=Rr(),o=Fr(),i=""+Co++;o._nodeMap.set(i,t),Zr(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=1,t.__key=i}function Ro(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 Ko(e){Lr(),pn(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,o=Fr(),i=Rr(),s=o._nodeMap,l=i._dirtyElements;null!==r&&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}}(r,s,l);const c=n.__key;i._dirtyType=1,Zr(e)?l.set(c,!0):i._dirtyLeaves.add(c)}function Bo(t){Ir();const e=Rr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Wo(n);null!==t&&t.getWritable()}if(null!==t){const e=Wo(t);null!==e&&e.getWritable()}}}function zo(){if(Pr())return null;return Rr()._compositionKey}function Wo(t,e){const n=(e||Fr())._nodeMap.get(t);return void 0===n?null:n}function $o(t,e){const n=Uo(t,Rr());return void 0!==n?Wo(n,e):null}function Uo(t,e){return t[`__lexicalKey_${e._key}`]}function Jo(t,e){let n=t;for(;null!=n;){const t=$o(n,e);if(null!==t)return t;n=xi(n)}return null}function Yo(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function jo(t){return t.read(()=>Ho().getTextContent())}function Ho(){return Vo(Fr())}function Vo(t){return t._nodeMap.get("root")}function Go(t){Ir();const e=Fr();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function qo(t){const e=Rr(),n=function(t,e){let n=t;for(;null!=n;){const t=Uo(n,e);if(void 0!==t)return t;n=xi(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Wo("root"):null}return Wo(n)}function Xo(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Qo(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function Zo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function ti(t){return Do(t)?t.nodeValue:null}function ei(t,e,n){const r=Ii(ki(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=ti(o);const r=Jo(o);if(null!==e&&Jn(r)){if(e===v&&n){const t=n.length;e=n,i=t,s=t}null!==e&&ni(r,e,i,s,t)}}}function ni(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]===v&&(a=e.slice(0,-1));const u=i.getTextContent();if(o||a!==u){if(""===a){if(Bo(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=zo(),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 ri(i,a,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=Un(i.getTextContent());i.replace(t),i=t}ri(i,a,g)}}}function ri(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=gs(t,o.offset,"clamp"))}}}function oi(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function ii(t,e){return oi(t,e,"altKey")&&oi(t,e,"ctrlKey")&&oi(t,e,"shiftKey")&&oi(t,e,"metaKey")}function si(t,e,n){return ii(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const li={ctrlKey:!o,metaKey:o},ci={altKey:o,ctrlKey:!o};function ai(t){return"Backspace"===t.key}function ui(t){return si(t,"a",li)}function fi(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 di(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 hi(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 gi(t,e){const n=t.offset;if("element"===t.type){return hi(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?hi(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function _i(t){const e=ki(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function pi(t,e,n){return function(t,e,n){const r=Qo(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 yi(t){return!oo(t)&&!t.isLastChild()&&!t.isInline()}function mi(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function xi(t){const e=t.assignedSlot||t.parentElement;return Ki(e)?e.host:e}function Ci(t){return Po(t)?t:Fi(t)?t.ownerDocument:null}function Si(t){Ir();Rr()._updateTags.add(t)}function Ni(t){Ir();Rr()._deferred.push(t)}function Ti(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function vi(t){const e=Ci(t);return e?e.defaultView:null}function ki(e){const n=e._window;return null===n&&t(78),n}function Ei(t){let e=t.getParentOrThrow();for(;null!==e;){if(bi(e))return e;e=e.getParentOrThrow()}return e}function bi(t){return oo(t)||Zr(t)&&t.isShadowRoot()}function Oi(t){const e=t.constructor.clone(t);return Fo(e,null),e.afterCloneFrom(t),e}function Mi(e){const n=Rr(),r=e.getType(),o=No(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 Ai(e,n){!oo(e.getParent())||Zr(n)||no(n)||t(99)}function wi(e){const n=Wo(e);return null===n&&t(63,e),n}function Di(t){return(no(t)||Zr(t)&&!t.canBeEmpty())&&!t.isInline()}function Pi(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function Ii(t){return n?(t||window).getSelection():null}function Li(t){const e=vi(t);return e?e.getSelection():null}function Fi(t){return Ri(t)&&1===t.nodeType}function Ri(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function Ki(t){return Ri(t)&&11===t.nodeType}function Bi(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 zi(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 Wi(t){if(no(t)&&!t.isInline())return!0;if(!Zr(t)||bi(t))return!1;const e=t.getFirstChild(),n=null===e||En(e)||Jn(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function $i(){return Rr()}const Ui=new WeakMap,Ji=new Map;function Yi(e){if(!e._readOnly&&e.isEmpty())return Ji;e._readOnly||t(192);let n=Ui.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),Ui.set(e,n)),n}function ji(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Hi(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r)}function Vi(t){return!0===t.__lexicalUnmanaged}function Gi(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==yn[e]}function qi(e){const n=R in e.prototype?e.prototype[R]():void 0,r=function(e){if(!(e===yn||e.prototype instanceof yn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{yo.version&&(r=JSON.parse(yo.version))}catch(t){}t(290,e.name,n,r)}return e===eo||e===Qr||e===yn}(e),o=!r&&Gi(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&&(Gi(e,"getType")||(e.getType=()=>s),Gi(e,"clone")||(e.clone=t=>(xo(t),new e)),Gi(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Gi(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const Xi=(t,e)=>{let n=t;for(;null!=n&&!oo(n);){if(e(n))return n;n=n.getParent()}return null},Qi={next:"previous",previous:"next"};class Zi{origin;constructor(t){this.origin=t}[Symbol.iterator](){return vs({hasNext:ls,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return ds(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ds(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=ds(e,this.direction)}for(const t of l.values())t.remove();return this}}class ts extends Zi{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ps(t,this.direction)}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ns(this.direction);return ds(this.getNodeAtCaret(),t)||ps(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof ts&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const es={root:oo,shadowRoot:bi};function ns(t){return Qi[t]}function rs(t,e="root"){return es[e](t)?null:t}class os extends Zi{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ds(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Zr(this.origin)?ps(this.origin,this.direction):null}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ns(this.direction);return ds(this.getNodeAtCaret(),t)||ps(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof os&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof os||t instanceof is)&&this.direction===t.direction&&this.origin.is(t.origin)}}class is extends Zi{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:hs(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){return hs(this.origin,ns(this.direction),this.offset)}isSamePointCaret(t){return t instanceof is&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof os||t instanceof is)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return ds(this.origin,this.direction)}}function ss(t){return t instanceof is}function ls(t){return t instanceof os}function cs(t){return t instanceof ts}const as={next:class extends is{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends is{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},us={next:class extends os{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends os{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},fs={next:class extends ts{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends ts{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function ds(t,e){return t?new us[e](t):null}function hs(t,e,n){return t?new as[e](t,gs(t,n)):null}function gs(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 _s(t,e){return new Cs(t,e)}function ps(t,e){return Zr(t)?new fs[e](t):null}function ys(t){return t&&t.getChildCaret()||t}function ms(t){return t&&ys(t.getAdjacentCaret())}class xs{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 xs(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return ss(e)?function(t,e){const{direction:n,origin:r}=t,o=gs(r,"focus"===e?ns(n):n);return _s(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[_s(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=ss(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ss(n),o=e=>e.isSameNodeCaret(n)?null:ms(e)||e.getParentCaret(t);return vs({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 Cs{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 hs(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function Ss(t){return Ts(t,ds(Ho(),t.direction))}function Ns(t){return Ts(t,t)}function Ts(e,n){return e.direction!==n.direction&&t(265),new xs(e,n,e.direction)}function vs(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 ks(e,n){const r=Ms(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 Es(r)}}function Es(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 bs(t,e){return e.is(t)}function Os(t){return Zr(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ms(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Os(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=Os(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(bs(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(bs(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((Zr(s)||bs(e,s))&&(Zr(i)||bs(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function As(e,n){const{type:r,key:o,offset:i}=e,s=wi(e.key);return"text"===r?(Jn(s)||t(266,s.getType(),o),hs(s,n,i)):(Zr(s)||t(267,s.getType(),o),Us(s,e.offset,n))}function ws(e,n){const{origin:r,direction:o}=n,i="next"===o;ss(n)?e.set(r.getKey(),n.offset,"text"):ls(n)?Jn(r)?e.set(r.getKey(),gs(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(cs(n)&&Zr(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Ds(t){const e=pr(),n=tr(e)?e:hr();return Ps(n,t),Go(n),n}function Ps(t,e){ws(t.anchor,e.anchor),ws(t.focus,e.focus)}function Is(t){const{anchor:e,focus:n}=t,r=As(e,"next"),o=As(n,"next"),i=ks(r,o)<=0?"next":"previous";return Ts(Ws(r,i),Ws(o,i))}function Ls(t){const{direction:e,origin:n}=t,r=ds(n,ns(e)).getNodeAtCaret();return r?ds(r,e):ps(n.getParentOrThrow(),e)}function Fs(t,e="root"){const n=[t];for(let r=cs(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Ls(r));return n}function Rs(t){return!!t&&t.origin.isAttached()}function Ks(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=$s(e,o),l=Fs(s.anchor,r),c=Fs(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(cs(t))a.add(t.origin.getKey());else if(ls(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=Ls(ds(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=hs(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(Rs(t)){f=Bs(t);break}for(const t of c)if(Rs(t)){d=Bs(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(bi(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Wi),f=u&&a(s,t=>n.has(t.getKey())&&Wi(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;ps(t,"previous").splice(0,e.getChildren()),e.remove()}const g=[f,d,...l,...c].find(Rs);if(g){return Ns(Ws(Bs(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function Bs(t){const e=function(t){let e=t;for(;cs(e);){const t=ms(e);if(!cs(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Jn(e.origin))return ss(e)?e:hs(e.origin,n,n);const r=e.getAdjacentCaret();return ls(r)&&Jn(r.origin)?hs(r.origin,n,ns(n)):e}function zs(t){return ss(t)&&t.offset!==gs(t.origin,t.direction)}function Ws(t,e){return t.direction===e?t:t.getFlipped()}function $s(t,e){return t.direction===e?t:Ts(Ws(t.focus,e),Ws(t.anchor,e))}function Us(t,e,n){let r=ps(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Ws(r,n)}function Js(e){const{origin:n,offset:r,direction:o}=e;if(r===gs(n,o))return e.getSiblingCaret();if(r===gs(n,ns(o)))return Ls(e.getSiblingCaret());const[i]=n.splitText(r);return Jn(i)||t(281),Ws(ds(i,"next"),o)}function Ys(t,e){return!0}exports.$addUpdateTag=Si,exports.$applyNodeReplacement=Mi,exports.$caretFromPoint=As,exports.$caretRangeFromSelection=Is,exports.$cloneWithProperties=ji,exports.$cloneWithPropertiesEphemeral=function(t){return(e=ji(t))[_n]=!0,e;var e},exports.$comparePointCaretNext=ks,exports.$copyNode=Oi,exports.$create=function(t){const e=$i();return Ir(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createLineBreakNode=kn,exports.$createNodeSelection=gr,exports.$createParagraphNode=ho,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=Ss,exports.$findMatchingParent=Xi,exports.$getAdjacentChildCaret=ms,exports.$getAdjacentNode=gi,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=ms(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=ms(r)}return o&&[o,n]},exports.$getCaretInDirection=Ws,exports.$getCaretRange=Ts,exports.$getCaretRangeInDirection=$s,exports.$getCharacterOffsets=or,exports.$getChildCaret=ps,exports.$getChildCaretAtIndex=Us,exports.$getChildCaretOrSelf=ys,exports.$getCollapsedCaretRange=Ns,exports.$getCommonAncestor=Ms,exports.$getCommonAncestorResultBranchOrder=Es,exports.$getEditor=$i,exports.$getNearestNodeFromDOMNode=Jo,exports.$getNearestRootOrShadowRoot=Ei,exports.$getNodeByKey=Wo,exports.$getNodeByKeyOrThrow=wi,exports.$getNodeFromDOMNode=$o,exports.$getPreviousSelection=yr,exports.$getRoot=Ho,exports.$getSelection=pr,exports.$getSiblingCaret=ds,exports.$getState=q,exports.$getStateChange=function(t,e,n){const r=q(t,n,"direct"),o=q(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=pr();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=gs,exports.$getTextPointCaret=hs,exports.$getTextPointCaretSlice=_s,exports.$getWritableNodeState=Z,exports.$hasAncestor=Ti,exports.$hasUpdateTag=function(t){return Rr()._updateTags.has(t)},exports.$insertNodes=function(t){let e=pr()||yr();null===e&&(e=Ho().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=function(t){return Zr(t)&&!t.isInline()},exports.$isChildCaret=cs,exports.$isDecoratorNode=no,exports.$isEditorState=function(t){return t instanceof co},exports.$isElementNode=Zr,exports.$isExtendableTextPointCaret=zs,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 Zi},exports.$isNodeSelection=nr,exports.$isParagraphNode=go,exports.$isRangeSelection=tr,exports.$isRootNode=oo,exports.$isRootOrShadowRoot=bi,exports.$isSiblingCaret=ls,exports.$isTabNode=Vn,exports.$isTextNode=Jn,exports.$isTextPointCaret=ss,exports.$isTextPointCaretSlice=function(t){return t instanceof Cs},exports.$isTokenOrSegmented=wo,exports.$isTokenOrTab=Ao,exports.$nodesOfType=function(t){const e=t.getType(),n=Fr();if(n._readOnly){const t=Yi(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=Bs,exports.$normalizeSelection__EXPERIMENTAL=at,exports.$onUpdate=Ni,exports.$parseSerializedNode=function(t){return Ur(t,Rr()._nodes)},exports.$removeTextFromCaretRange=Ks,exports.$rewindSiblingCaret=Ls,exports.$selectAll=function(t){const e=Ho();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"),at(t),t}{const t=e.select(0,e.getChildrenSize());return Go(at(t)),t}},exports.$setCompositionKey=Bo,exports.$setPointFromCaret=ws,exports.$setSelection=Go,exports.$setSelectionFromCaretRange=Ds,exports.$setState=function(t,e,n){let r;if(Ir(),"function"==typeof n){const o=t.getLatest(),i=q(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return Z(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=Oi,$splitTextPointCaretNext:n=Js,rootMode:r="shadowRoot",$shouldSplit:o=Ys}={}){if(ss(t))return n(t);const i=t.getParentCaret(r);if(i){const{origin:n}=i;if(cs(t)&&(!n.canBeEmpty()||!o(n,"first")))return Ls(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),bi(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=bi(n),s=e!==r||i?Oi(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=Ps,exports.ArtificialNode__DO_NOT_USE=ao,exports.BLUR_COMMAND=Le,exports.CAN_REDO_COMMAND=De,exports.CAN_UNDO_COMMAND=Pe,exports.CLEAR_EDITOR_COMMAND=Ae,exports.CLEAR_HISTORY_COMMAND=we,exports.CLICK_COMMAND=Vt,exports.COLLABORATION_TAG=xn,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=Qt,exports.COPY_COMMAND=be,exports.CUT_COMMAND=Oe,exports.DELETE_CHARACTER_COMMAND=Gt,exports.DELETE_LINE_COMMAND=ne,exports.DELETE_WORD_COMMAND=ee,exports.DRAGEND_COMMAND=Ee,exports.DRAGOVER_COMMAND=ke,exports.DRAGSTART_COMMAND=ve,exports.DROP_COMMAND=Ne,exports.DecoratorNode=eo,exports.ElementNode=Qr,exports.FOCUS_COMMAND=Ie,exports.FORMAT_ELEMENT_COMMAND=Te,exports.FORMAT_TEXT_COMMAND=re,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=mn,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=Ce,exports.INSERT_LINE_BREAK_COMMAND=qt,exports.INSERT_PARAGRAPH_COMMAND=Xt,exports.INSERT_TAB_COMMAND=xe,exports.INTERNAL_$isBlock=Wi,exports.IS_ALL_FORMATTING=2047,exports.IS_BOLD=1,exports.IS_CODE=16,exports.IS_HIGHLIGHT=y,exports.IS_ITALIC=2,exports.IS_STRIKETHROUGH=4,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=8,exports.KEY_ARROW_DOWN_COMMAND=de,exports.KEY_ARROW_LEFT_COMMAND=ae,exports.KEY_ARROW_RIGHT_COMMAND=le,exports.KEY_ARROW_UP_COMMAND=fe,exports.KEY_BACKSPACE_COMMAND=_e,exports.KEY_DELETE_COMMAND=ye,exports.KEY_DOWN_COMMAND=se,exports.KEY_ENTER_COMMAND=he,exports.KEY_ESCAPE_COMMAND=pe,exports.KEY_MODIFIER_COMMAND=Fe,exports.KEY_SPACE_COMMAND=ge,exports.KEY_TAB_COMMAND=me,exports.LineBreakNode=Tn,exports.MOVE_TO_END=ce,exports.MOVE_TO_START=ue,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=Se,exports.PASTE_COMMAND=Zt,exports.PASTE_TAG="paste",exports.ParagraphNode=uo,exports.REDO_COMMAND=ie,exports.REMOVE_TEXT_COMMAND=te,exports.RootNode=ro,exports.SELECTION_CHANGE_COMMAND=jt,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=Ht,exports.SELECT_ALL_COMMAND=Me,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=Sn,exports.SKIP_SCROLL_INTO_VIEW_TAG=Cn,exports.SKIP_SELECTION_FOCUS_TAG=Nn,exports.TEXT_TYPE_TO_FORMAT=w,exports.TabNode=jn,exports.TextNode=In,exports.UNDO_COMMAND=oe,exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=Yt,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:Zo()),c=e.editorState,a=[ro,In,Tn,jn,uo,ao,...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}qi(e);const o=e.getType(),i=po(e);h.set(o,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:X(a[t]),transforms:i})}}const g=new yo(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=2),g},exports.createSharedNodeState=X,exports.createState=function(t,e){return new G(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=ns,exports.getDOMOwnerDocument=Ci,exports.getDOMSelection=Ii,exports.getDOMSelectionFromTarget=Li,exports.getDOMTextNode=Io,exports.getEditorPropertyFromDOMNode=Mo,exports.getNearestEditorFromDOMNode=Oo,exports.getRegisteredNode=No,exports.getRegisteredNodeOrThrow=So,exports.getStaticNodeConfig=qi,exports.getTextDirection=function(t){return M.test(t)?"rtl":A.test(t)?"ltr":null},exports.getTransformSetFromKlass=po,exports.isBlockDomNode=zi,exports.isCurrentlyReadOnlyMode=Pr,exports.isDOMDocumentNode=Po,exports.isDOMNode=Ri,exports.isDOMTextNode=Do,exports.isDOMUnmanaged=Vi,exports.isDocumentFragment=Ki,exports.isExactShortcutMatch=si,exports.isHTMLAnchorElement=function(t){return Fi(t)&&"A"===t.tagName},exports.isHTMLElement=Fi,exports.isInlineDomNode=Bi,exports.isLexicalEditor=bo,exports.isModifierMatch=ii,exports.isSelectionCapturedInDecoratorInput=ko,exports.isSelectionWithinEditor=Eo,exports.makeStepwiseIterator=vs,exports.removeFromParent=Ro,exports.resetRandomKey=function(){Co=1},exports.safeCast=function(t){return t},exports.setDOMUnmanaged=function(t){t.__lexicalUnmanaged=!0},exports.setNodeIndentFromDOM=Hi,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=0,_=1,p=2,y=128,m=1,x=2,C=3,S=4,N=5,T=6,v=l||c||d?" ":"​",k="\n\n",E=i?" ":v,b="֑-߿יִ-﷽ﹰ-ﻼ",O="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",M=new RegExp("^[^"+O+"]*["+b+"]"),A=new RegExp("^[^"+b+"]*["+O+"]"),w={bold:1,capitalize:1024,code:16,highlight:y,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},D={directionless:1,unmergeable:2},P={center:2,end:6,justify:4,left:1,right:3,start:5},I={[x]:"center",[T]:"end",[S]:"justify",[m]:"left",[C]:"right",[N]:"start"},L={normal:0,segmented:2,token:1},F={[g]:"normal",[p]:"segmented",[_]:"token"},R="$config";function K(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Zr(s)&&K(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}let B=!1,z=0;function W(t){z=t.timeStamp}function $(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==Uo(t,n)}function U(t,e,n){const r=Ii(ki(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&ni(e,s,o,i,!1)}function J(t,e,n){if(tr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return Do(e)&&n.isAttached()}function Y(t,e,n,r){for(let o=t;o&&!Vi(o);o=xi(o)){const t=Uo(o,e);if(void 0!==t){const e=Wo(t,n);if(e)return no(e)||!Fi(o)?void 0:[o,e]}else if(o===r)return[r,Vo(n)]}}function j(t,e,n){B=!0;const r=performance.now()-z>100;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,_=Y(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Jn(y)&&Do(g)&&J(o,g,y)&&U(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=$o(r),s=r.parentNode;if(null!=s&&r!==a&&null===o&&!$(r,s,t)){if(i){const t=(Fi(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];($(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||$(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(u&&Go(o),i&&_i(t)&&o.insertRawText(f))})}finally{B=!1}}function H(t){const e=t._observer;if(null!==e){j(t,e.takeRecords(),e)}}function V(t){!function(t){0===z&&ki(t).addEventListener("textInput",W,!0)}(t),t._observer=new MutationObserver((e,n)=>{j(t,e,n)})}class G{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||nt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0)}}function q(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function X(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}=qi(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 Q{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 et(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 Q(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=et(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 Z(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Q(e,tt(e));return e.__state=n,n}function tt(t){return t.__state?t.__state.sharedNodeState:So($i(),t.getType()).sharedNodeState}function et(t){if(t)for(const e in t)return t}function nt(t){return t}function rt(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 ot(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 it(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function st(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&&rt(n,t,e)||e&&rt(n,e,t)||t&&ot(n,t,e)||e&&ot(n,e,t))}(c,a))}function lt(t,e){const n=t.mergeWithSibling(e),r=Rr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function ct(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(st(e,r)){r=lt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Jn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(st(r,n)){r=lt(r,n);break}break}n.remove()}}else r.remove()}function at(t){return ut(t.anchor),ut(t.focus),t}function ut(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 ft,dt,ht,gt,_t,pt,yt,mt,xt,Ct,St="",Nt=null,Tt=null,vt="",kt=!1,Et=!1;function bt(t,e){const n=yt.get(t);if(null!==e){const n=Jt(t);n.parentNode===e&&e.removeChild(n)}if(mt.has(t)||dt._keyToDOMMap.delete(t),Zr(n)){const t=Bt(n,yt);Ot(t,0,t.length-1,null)}void 0!==n&&di(Ct,ht,gt,n,"destroyed")}function Ot(t,e,n,r){let o=e;for(;o<=n;++o){const e=t[o];void 0!==e&&bt(e,r)}}function Mt(t,e){t.setProperty("text-align",e)}const At="40px";function wt(t,e){const n=ft.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")||At;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`)}function Dt(t,e){const n=t.style;0===e?Mt(n,""):1===e?Mt(n,"left"):2===e?Mt(n,"center"):3===e?Mt(n,"right"):4===e?Mt(n,"justify"):5===e?Mt(n,"start"):6===e&&Mt(n,"end")}function Pt(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 It(e,n){const r=mt.get(e);void 0===r&&t(60);const o=r.createDOM(ft,dt);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,dt),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(Pt(o,r),0!==t&&wt(o,t),0!==e){const t=e-1;Lt(Bt(r,mt),r,0,t,r.getDOMSlot(o))}const n=r.__format;0!==n&&Dt(o,n),r.isInline()||Rt(null,r,o),yi(r)&&(St+=k,vt+=k)}else{const t=r.getTextContent();if(no(r)){const t=r.decorate(dt,ft);null!==t&&Wt(e,t),o.contentEditable="false"}St+=t,vt+=t}return null!==n&&n.insertChild(o),di(Ct,ht,gt,r,"created"),o}function Lt(t,e,n,r,o){const i=St;St="";let s=n;for(;s<=r;++s){It(t[s],o);const e=mt.get(t[s]);null!==e&&Jn(e)&&null===Nt&&(Nt=e.getFormat(),Tt=e.getStyle())}yi(e)&&(St+=k);o.element.__lexicalTextContent=St,St=i+St}function Ft(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 Rt(t,e,n){const r=Ft(t,yt),o=Ft(e,mt);r!==o&&e.getDOMSlot(n).setManagedLineBreak(o)}function Kt(e,n,r){var o;Nt=null,Tt=null,function(e,n,r){const o=St,i=e.__size,s=n.__size;St="";const l=r.element;if(1===i&&1===s){const t=e.__first,r=n.__first;if(t===r)zt(t,l);else{const e=Jt(t),n=It(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}bt(t,null)}const o=mt.get(r);Jn(o)&&null===Nt&&(Nt=o.getFormat(),Tt=o.getStyle())}else{const o=Bt(e,yt),c=Bt(n,mt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&Lt(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;Ot(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=$t(zt(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=mi(dt,r);t===u?u=$t(zt(r,i.element)):(i.withBefore(u).insertChild(t),zt(r,i.element)),f++,d++}else It(r,i.withBefore(u)),d++;else u=$t(Jt(t)),bt(t,i.element),f++}const o=mt.get(r);null!==o&&Jn(o)&&null===Nt&&(Nt=o.getFormat(),Tt=o.getStyle())}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:dt.getElementByKey(e);Lt(n,t,d,l,i.withBefore(r))}else g&&!h&&Ot(e,f,s,i.element)}(n,o,c,i,s,r)}yi(n)&&(St+=k);l.__lexicalTextContent=St,St=o+St}(e,n,n.getDOMSlot(r)),o=n,null==Nt||Nt===o.__textFormat||Et||o.setTextFormat(Nt),function(t){null==Tt||Tt===t.__textStyle||Et||t.setTextStyle(Tt)}(n)}function Bt(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 zt(e,n){const r=yt.get(e);let o=mt.get(e);void 0!==r&&void 0!==o||t(61);const i=kt||pt.has(e)||_t.has(e),s=mi(dt,e);if(r===o&&!i){if(Zr(r)){const t=s.__lexicalTextContent;void 0!==t&&(St+=t,vt+=t)}else{const t=r.getTextContent();vt+=t,St+=t}return s}if(r!==o&&i&&di(Ct,ht,gt,o,"updated"),o.updateDOM(r,s,ft)){const r=It(e,null);return null===n&&t(62),n.replaceChild(r,s),bt(e,null),r}if(Zr(r)&&Zr(o)){const t=o.__indent;(kt||t!==r.__indent)&&wt(s,t);const e=o.__format;if((kt||e!==r.__format)&&Dt(s,e),i&&(Kt(r,o,s),oo(o)||o.isInline()||Rt(r,o,s)),yi(o)&&(St+=k,vt+=k),(kt||o.__dir!==r.__dir)&&(Pt(s,o),oo(o)&&!kt))for(const t of o.getChildren())if(Zr(t)){Pt(mi(dt,t.getKey()),t)}}else{const t=o.getTextContent();if(no(o)){const t=o.decorate(dt,ft);null!==t&&Wt(e,t)}St+=t,vt+=t}if(!Et&&oo(o)&&o.__cachedText!==vt){const t=o.getWritable();t.__cachedText=vt,o=t}return s}function Wt(t,e){let n=dt._pendingDecorators;const r=dt._decorators;if(null===n){if(r[t]===e)return;n=Yo(dt)}n[t]=e}function $t(t){let e=t.nextSibling;return null!==e&&e===dt._blockCursorElement&&(e=e.nextSibling),e}function Ut(t,e,n,r,o,i){St="",vt="",kt=2===r,dt=n,ft=n._config,ht=n._nodes,gt=dt._listeners.mutation,_t=o,pt=i,yt=t._nodeMap,mt=e._nodeMap,Et=e._readOnly,xt=new Map(n._keyToDOMMap);const s=new Map;return Ct=s,zt("root",null),dt=void 0,ht=void 0,_t=void 0,pt=void 0,yt=void 0,mt=void 0,ft=void 0,xt=void 0,Ct=void 0,s}function Jt(e){const n=xt.get(e);return void 0===n&&t(75,e),n}function Yt(t){return{type:t}}const jt=Yt("SELECTION_CHANGE_COMMAND"),Ht=Yt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Vt=Yt("CLICK_COMMAND"),Gt=Yt("DELETE_CHARACTER_COMMAND"),qt=Yt("INSERT_LINE_BREAK_COMMAND"),Xt=Yt("INSERT_PARAGRAPH_COMMAND"),Qt=Yt("CONTROLLED_TEXT_INSERTION_COMMAND"),Zt=Yt("PASTE_COMMAND"),te=Yt("REMOVE_TEXT_COMMAND"),ee=Yt("DELETE_WORD_COMMAND"),ne=Yt("DELETE_LINE_COMMAND"),re=Yt("FORMAT_TEXT_COMMAND"),oe=Yt("UNDO_COMMAND"),ie=Yt("REDO_COMMAND"),se=Yt("KEYDOWN_COMMAND"),le=Yt("KEY_ARROW_RIGHT_COMMAND"),ce=Yt("MOVE_TO_END"),ae=Yt("KEY_ARROW_LEFT_COMMAND"),ue=Yt("MOVE_TO_START"),fe=Yt("KEY_ARROW_UP_COMMAND"),de=Yt("KEY_ARROW_DOWN_COMMAND"),he=Yt("KEY_ENTER_COMMAND"),ge=Yt("KEY_SPACE_COMMAND"),_e=Yt("KEY_BACKSPACE_COMMAND"),pe=Yt("KEY_ESCAPE_COMMAND"),ye=Yt("KEY_DELETE_COMMAND"),me=Yt("KEY_TAB_COMMAND"),xe=Yt("INSERT_TAB_COMMAND"),Ce=Yt("INDENT_CONTENT_COMMAND"),Se=Yt("OUTDENT_CONTENT_COMMAND"),Ne=Yt("DROP_COMMAND"),Te=Yt("FORMAT_ELEMENT_COMMAND"),ve=Yt("DRAGSTART_COMMAND"),ke=Yt("DRAGOVER_COMMAND"),Ee=Yt("DRAGEND_COMMAND"),be=Yt("COPY_COMMAND"),Oe=Yt("CUT_COMMAND"),Me=Yt("SELECT_ALL_COMMAND"),Ae=Yt("CLEAR_EDITOR_COMMAND"),we=Yt("CLEAR_HISTORY_COMMAND"),De=Yt("CAN_REDO_COMMAND"),Pe=Yt("CAN_UNDO_COMMAND"),Ie=Yt("FOCUS_COMMAND"),Le=Yt("BLUR_COMMAND"),Fe=Yt("KEY_MODIFIER_COMMAND"),Re=Object.freeze({}),Ke=[["keydown",function(t,e){if(Be=t.timeStamp,ze=t.key,e.isComposing())return;if(pi(e,se,t))return;if(null==t.key)return;if(Ge&&ai(t))return Gr(e,()=>{sn(e,qe)}),Ge=!1,void(qe="");if(function(t){return si(t,"ArrowRight",{shiftKey:"any"})}(t))pi(e,le,t);else if(function(t){return si(t,"ArrowRight",li)}(t))pi(e,ce,t);else if(function(t){return si(t,"ArrowLeft",{shiftKey:"any"})}(t))pi(e,ae,t);else if(function(t){return si(t,"ArrowLeft",li)}(t))pi(e,ue,t);else if(function(t){return si(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))pi(e,fe,t);else if(function(t){return si(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))pi(e,de,t);else if(function(t){return si(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))He=!0,pi(e,he,t);else if(function(t){return" "===t.key}(t))pi(e,ge,t);else if(function(t){return o&&si(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),He=!0,pi(e,qt,!0);else if(function(t){return si(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))He=!1,pi(e,he,t);else if(function(t){return si(t,"Backspace",{shiftKey:"any"})||o&&si(t,"h",{ctrlKey:!0})}(t))ai(t)?pi(e,_e,t):(t.preventDefault(),pi(e,Gt,!0));else if(function(t){return"Escape"===t.key}(t))pi(e,pe,t);else if(function(t){return si(t,"Delete",{})||o&&si(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),pi(e,Gt,!1)):pi(e,ye,t);else if(function(t){return si(t,"Backspace",ci)}(t))t.preventDefault(),pi(e,ee,!0);else if(function(t){return si(t,"Delete",ci)}(t))t.preventDefault(),pi(e,ee,!1);else if(function(t){return o&&si(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),pi(e,ne,!0);else if(function(t){return o&&(si(t,"Delete",{metaKey:!0})||si(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),pi(e,ne,!1);else if(function(t){return si(t,"b",li)}(t))t.preventDefault(),pi(e,re,"bold");else if(function(t){return si(t,"u",li)}(t))t.preventDefault(),pi(e,re,"underline");else if(function(t){return si(t,"i",li)}(t))t.preventDefault(),pi(e,re,"italic");else if(function(t){return si(t,"Tab",{shiftKey:"any"})}(t))pi(e,me,t);else if(function(t){return si(t,"z",li)}(t))t.preventDefault(),pi(e,oe,void 0);else if(function(t){if(o)return si(t,"z",{metaKey:!0,shiftKey:!0});return si(t,"y",{ctrlKey:!0})||si(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),pi(e,ie,void 0);else{const n=e._editorState._selection;null===n||tr(n)?ui(t)&&(t.preventDefault(),pi(e,Me,t)):!function(t){return si(t,"c",li)}(t)?!function(t){return si(t,"x",li)}(t)?ui(t)&&(t.preventDefault(),pi(e,Me,t)):(t.preventDefault(),pi(e,Oe,t)):(t.preventDefault(),pi(e,be,t))}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&pi(e,Fe,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ri(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Gr(e,()=>{vo(n)||(je=!0)})}],["compositionstart",function(t,e){Gr(e,()=>{const n=pr();if(tr(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Bo(r.key),(t.timeStamp<Be+30||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||Jn(o)&&o.getStyle()!==n.style)&&pi(e,Qt,E)}})}],["compositionend",function(t,e){i?Ve=!0:c||!l&&!d?Gr(e,()=>{sn(e,t.data)}):(Ge=!0,qe=t.data)}],["input",function(t,e){t.stopPropagation(),Gr(e,()=>{if(Fi(t.target)&&vo(t.target))return;const n=pr(),r=t.data,o=on(t);if(null!=r&&tr(n)&&Ze(n,o,r,t.timeStamp,!1)){Ve&&(sn(e,r),Ve=!1);const o=n.anchor.getNode(),a=Ii(ki(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)===ti(a.anchorNode)||pi(e,Qt,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(Be=0,Bo(null))}else{ei(!1,e,null!==r?r:void 0),Ve&&(sn(e,r||void 0),Ve=!1)}!function(){Ir();const t=Rr();H(t)}()},{event:t}),$e=null}],["click",function(t,e){Gr(e,()=>{const n=pr(),r=Ii(ki(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===Ho().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=Xi(i,t=>Zr(t)&&!t.isInline());Zr(t)&&t.select(0)}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Fi(n)||Do(n)){Go(_r(o,r,e,t))}}pi(e,Vt,t)})}],["cut",Re],["copy",Re],["dragstart",Re],["dragover",Re],["dragend",Re],["paste",Re],["focus",Re],["blur",Re],["drop",Re]];s&&Ke.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,o=on(e);if("deleteCompositionText"===r||i&&_i(n))return;if("insertCompositionText"===r)return;Gr(n,()=>{const i=pr();if("deleteContentBackward"===r){if(null===i){const t=yr();if(!tr(t))return;Go(t.clone())}if(tr(i)){const r=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===ze&&s<Be+30&&n.isComposing()&&r){if(Bo(null),Be=0,setTimeout(()=>{Gr(n,()=>{Bo(null)})},30),tr(i)){const e=i.anchor.getNode();e.markDirty(),Jn(e)||t(142),rn(i,e)}}else{Bo(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(gi(i.anchor,!0))),!c){pi(n,Gt,!0);const t=pr();f&&tr(t)&&t.isCollapsed()&&(Xe=t,setTimeout(()=>Xe=null))}}return}}var s;if(!tr(i))return;const l=e.data;null!==$e&&ei(!1,n,$e),i.dirty&&null===$e||!i.isCollapsed()||oo(i.anchor.getNode())||null===o||i.applyDOMRange(o),$e=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":pi(n,Qt,e);break;case"insertFromComposition":Bo(null),pi(n,Qt,e);break;case"insertLineBreak":Bo(null),pi(n,qt,!1);break;case"insertParagraph":Bo(null),He&&!c?(He=!1,pi(n,qt,!1)):pi(n,Xt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":pi(n,Zt,e);break;case"deleteByComposition":(function(t,e){return t!==e||Zr(t)||Zr(e)||!Ao(t)||!Ao(e)})(d,h)&&pi(n,te,e);break;case"deleteByDrag":case"deleteByCut":pi(n,te,e);break;case"deleteContent":pi(n,Gt,!1);break;case"deleteWordBackward":pi(n,ee,!0);break;case"deleteWordForward":pi(n,ee,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":pi(n,ne,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":pi(n,ne,!1);break;case"formatStrikeThrough":pi(n,re,"strikethrough");break;case"formatBold":pi(n,re,"bold");break;case"formatItalic":pi(n,re,"italic");break;case"formatUnderline":pi(n,re,"underline");break;case"historyUndo":pi(n,oe,void 0);break;case"historyRedo":pi(n,ie,void 0)}else{if("\n"===l)e.preventDefault(),pi(n,qt,!1);else if(l===k)e.preventDefault(),pi(n,Xt,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=l&&Ze(i,o,l,e.timeStamp,!0)?(e.preventDefault(),pi(n,Qt,l)):$e=l;We=e.timeStamp}})}(e,n)]);let Be=0,ze=null,We=0,$e=null;const Ue=new WeakMap,Je=new WeakMap;let Ye=!1,je=!1,He=!1,Ve=!1,Ge=!1,qe="",Xe=null,Qe=[0,"",0,"root",0];function Ze(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=Rr(),u=Ii(ki(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||We<r+50)||c.isDirty()&&g<2||Xo(n))&&i.offset!==l.offset&&!c.isComposing()||wo(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==Io(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=Ao(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 tn(t,e){return Do(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function en(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;Ye&&(Ye=!1,tn(o,i)&&tn(s,l)&&!Xe)||Gr(n,()=>{if(!r)return void Go(null);if(!Eo(n,o,s))return;let c=pr();if(Xe&&tr(c)&&c.isCollapsed()){const t=c.anchor,e=Xe.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=Xe.clone(),Go(c))}if(Xe=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=ki(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=Qe,h=Ho(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)nn(c,l,a);else if("text"===r.type)Jn(o)||t(141),rn(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();nn(t,n,r)}(c,e):nn(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=2047,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}}pi(n,jt,void 0)})}function nn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function rn(t,e){nn(t,e.getFormat(),e.getStyle())}function on(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function sn(t,e){const n=t._compositionKey;if(Bo(null),null!==n&&null!=e){if(""===e){const e=Wo(n),r=Io(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&Jn(e)&&ni(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 pi(t,he,null)}}}ei(!0,t,e)}function ln(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const cn=new Map;function an(t){const e=Li(t.target);if(null===e)return;const n=Oo(e.anchorNode);if(null===n)return;je&&(je=!1,Gr(n,()=>{const r=yr(),o=e.anchorNode;if(Fi(o)||Do(o)){Go(_r(r,e,n,t))}}));const r=Qo(n),o=r[r.length-1],i=o._key,s=cn.get(i),l=s||o;l!==n&&en(e,l,!1),en(e,n,!0),n!==o?cn.set(i,n):s&&cn.delete(i)}function un(t){t._lexicalHandled=!0}function fn(t){return!0===t._lexicalHandled}const dn=()=>{};function hn(e){const n=Ue.get(e);if(void 0===n)return void dn();const r=Je.get(n);if(void 0===r)return void dn();const o=r-1;o>=0||t(164),Ue.delete(e),Je.set(n,o),0===o&&n.removeEventListener("selectionchange",an);const i=Mo(e);bo(i)?(!function(t){if(null!==t._parentEditor){const e=Qo(t),n=e[e.length-1]._key;cn.get(n)===t&&cn.delete(n)}else cn.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=ln(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function gn(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();Ti(o,t)&&n.set(t.__key,0,"element");Ti(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();Ro(t),mr(i,o,e,-1)}else Ro(t);n||bi(o)||o.canBeEmpty()||!o.isEmpty()||gn(o,e),e&&i&&oo(o)&&o.isEmpty()&&o.selectEnd()}const _n=Symbol.for("ephemeral");function pn(t){return t[_n]||!1}class yn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=qi(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}),Fo(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=Wo(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:Wo(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(bi(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:Wo(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:Wo(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?Ms(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ms(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Es(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ms(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(){if(pn(this))return this;const e=Wo(this.__key);return null===e&&t(113),e}getWritable(){if(pn(this))return this;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 Ko(o),o;const l=ji(o);return i.add(r),Ko(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 tt(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&Z(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){gn(this,!0,t)}replace(e,n){Ir();let r=pr();null!==r&&(r=r.clone()),Ai(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;Ro(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,h=o.__next,g=o.__parent;if(gn(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)){Go(r);const t=r.anchor,e=r.focus;t.key===i&&Qn(t,l),e.key===i&&Qn(e,l)}return zo()===i&&Bo(s),l}insertAfter(t,e=!0){Ir(),Ai(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(Ro(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(),Ai(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key;Ro(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 ho()}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()}}const mn="history-merge",xn="collaboration",Cn="skip-scroll-into-view",Sn="skip-dom-selection",Nn="skip-selection-focus";class Tn extends yn{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&&zi(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&&zi(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 Mi(new Tn)}function En(t){return t instanceof Tn}function bn(t){return Do(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function On(t,e){return 16&e?"code":e&y?"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=fi(o,"base");void 0!==s&&i.add(...s),s=fi(o,"underlineStrikethrough");let l=!1;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const t in w){const r=w[t];if(s=fi(o,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&i.remove(...s);continue}(0===(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?v:"");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 yn{__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 F[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===zo()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=w[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Lo(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:$n,priority:0}),em:()=>({conversion:$n,priority:0}),i:()=>({conversion:$n,priority:0}),mark:()=>({conversion:$n,priority:0}),s:()=>({conversion:$n,priority:0}),span:()=>({conversion:Ln,priority:0}),strong:()=>({conversion:$n,priority:0}),sub:()=>({conversion:$n,priority:0}),sup:()=>({conversion:$n,priority:0}),u:()=>({conversion:$n,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 Fi(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?w[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?D[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Lo(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=L[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=zo();t!==o.anchor.key&&t!==o.focus.key||Bo(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=zo(),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=it(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=it(e,n);const i=n.__key;o===r&&Bo(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&&Ko(e);null!==n&&Ko(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;zo()===o&&Bo(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(!Fi(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,Fi(n)){const t=n.style.display;if(""===t&&!Bi(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(Do(n))return n;if("BR"===n.nodeName)return null}}const Wn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function $n(t){const e=Wn[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Yn(t.style,e),node:null}}function Un(t=""){return Mi(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=fi(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 Mi(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 ks(Bs(As(this,"next")),Bs(As(t,"next")))<0}getNode(){const e=Wo(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()||(zo()===i&&Bo(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=Wo(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=ds(t[0],"next");Ds(Ts(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(cs(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(ls(t.focus)&&Zr(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=ps(t.focus.origin,"previous");cs(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=ms(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=Bs(t.anchor),r=Bs(t.anchor.getFlipped()),o=t=>ss(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}($s(Is(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),at(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=Lo(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=w[t];return 0!==(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),go(i))i.splice(0,0,[s]);else{const t=oo(o)?ho().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&&ws(l,Bs(As(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&&(wo(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Jn(t)&&t.canInsertTextBefore()&&!wo(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&&(wo(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Jn(t)&&!wo(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(Ao(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(_)&&!Ao(_)&&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(Ao(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;Ps(this,Ks(Is(this))),t&&pr()!==this&&Go(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Bo(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),Bo(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(wo(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||wo(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||wo(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=Xi(n,Wi),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=ho();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)&&Wi(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){const r=n.getParentOrThrow().getLastChild();let o=n;const i=[n];for(;o!==r;)o.getNextSibling()||t(140),o=o.getNextSibling(),i.push(o);let s=e;for(const t of i)s=s.insertAfter(t)}(r,u));const d=Xi(s,Wi);c&&Zr(d)&&(c.canMergeWhenEmpty()||Wi(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=ho();return Ho().splice(this.anchor.offset,0,[t]),t.select(),t}const e=vr(this),n=Xi(this.anchor.getNode(),Wi);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=Ii(ki(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()||Pi(s,o,l),this.dirty){let t=mi(o,this.anchor.key),e=mi(o,this.focus.key);"text"===this.anchor.type&&(t=Io(t)),"text"===this.focus.type&&(e=Io(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:Ei(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];Ti(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=Ss(As(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(cs(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=Bs(e);Ps(this,Ts(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(ls(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()),Go(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Ps(this,Ts(!e.origin.isEmpty()&&n.isEmpty()?Ls(ds(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!(Xo(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(bi(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(Fi(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=qo(f),Jn(i))s=gs(i,l?"next":"previous");else{let c=qo(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=gs(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)&&qo(e)===c?t:t+1,c=c.getParentOrThrow()}if(Zr(c))return qn(c.__key,s,"element")}}else i=qo(e);return Jn(i)?qn(i.__key,gs(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||!Eo(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=qo(t),r=qo(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=!B&&(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||void 0===s)&&tr(t)&&!Eo(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")}return}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(xn)&&f!==i||null!==f&&ko(f))return;if(!tr(e))return void(null!==t&&Eo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=mi(n,g),y=mi(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=Io(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=Io(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(),Qe=[E,b,O,M,A]),a!==m||u!==x||l!==T||c!==v||"Range"===r.type&&N||(null!==f&&i.contains(f)||o.has(Nn)||i.focus({preventScroll:!0}),"element"===d.type))){if(Nr(r,T,m,v,x),!o.has(Cn)&&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=Ci(n),o=vi(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=ki(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=xi(a)}}(n,e,i)}}Ye=!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(;!Wi(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=ho();return Ho().append(t),t.select(),[Ho(),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=As(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!zs(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 Ss(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(cs(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()),Go(t),!0}return c=Bs(c),l&&ws(t.anchor,c),ws(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=yo.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=Mo(r);if(bo(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=So(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 Wr(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function $r(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=0!==t._dirtyType,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(),_=Ut(i,n,t,e,r,o)}catch(e){if(e instanceof Error&&t._onError(e),Ar)throw e;return _o(t,null,r,n),V(t),t._dirtyType=2,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,m=t._normalizedNodes,x=t._updateTags,C=t._deferred;c&&(t._dirtyType=0,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=Yo(t)),delete r[i])}(t,n);const S=o?null:Ii(ki(t));if(t._editable&&null!==S&&(c||null===l||l.dirty||!l.is(s))&&null!==r&&!x.has(Sn)){Or=t,br=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&Pi(e,t,r),Tr(s,l,t,S,x,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()){Di(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&Di(e)){const n=e.getPreviousSibling();(null===n||Di(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&&Pi(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,_,x,p,i),tr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(jt,void 0);const N=t._pendingDecorators;null!==N&&(t._decorators=N,t._pendingDecorators=null,jr("decorator",t,!0,N)),function(t,e,n){const r=jo(e),o=jo(n);r!==o&&jr("textcontent",t,!0,o)}(t,e||i,n),jr("update",t,!0,{dirtyElements:y,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:m,prevEditorState:e||i,tags:x}),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,C),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),$r(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,$r(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();xo(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Ii(ki(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),0!==e._dirtyType&&(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()&&ct(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=zo(),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()&&ct(r),void 0!==r&&Wr(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&&Wr(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)&&K(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=2,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=0!==e._dirtyType||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&&To(()=>{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 yn{__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 I[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:Wo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Wo(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+=k)}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+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=P[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=w[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return Lo(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?P[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){pn(this)&&t(324,this.__key,this.__type);const o=this.getChildrenSize(),i=this.getWritable();e+n<=o||t(226,String(e),String(n),String(o));const s=i.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=o-n+r.length;if(0!==e)if(e===o)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;Ro(e.getWritable()),c.push(r),e=n}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,Ro(n);const r=e.__key;if(null===d)i.__first=r,n.__prev=null;else{const t=d.getWritable();t.__next=r,n.__prev=t.__key}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e}if(e+n===o){if(null!==d){d.getWritable().__next=null,i.__last=d.__key}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key}else t.__prev=null}if(i.__size=f,c.length){const t=pr();if(tr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:o}=t;to(r,e,n)&&Cr(r,r.getNode(),this,u,a),to(o,e,n)&&Cr(o,o.getNode(),this,u,a),0!==f||this.canBeEmpty()||bi(this)||this.remove()}}return i}getDOMSlot(t){return new qr(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Fi(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&&""===n||bi(this)||this.getChildren().some(Jn)||(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 yn{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()&&0!==Rr()._dirtyType||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 Ho().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(Ho())}))}}class ao extends Qr{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class uo extends Qr{static getType(){return"paragraph"}static clone(t){return new uo(t.__key)}createDOM(t){const e=document.createElement("p"),n=fi(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:fo,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Fi(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return ho().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(Jn);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=ho();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 fo(t){const e=ho();return t.style&&(e.setFormat(t.style.textAlign),Hi(t,e)),{node:e}}function ho(){return Mi(new uo)}function go(t){return t instanceof uo}function _o(t,e,n,r){const o=t._keyToDOMMap;o.clear(),t._editorState=so(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,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))}function po(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=qi(r),o=r.transform;if(!n.has(o)){n.add(o);const t=r.transform();t&&e.add(t)}if(t){const n=t.$transform;n&&e.add(n),r=t.extends}else{const t=Object.getPrototypeOf(r);r=t.prototype instanceof yn&&t!==yn?t:void 0}}return e}class yo{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=0,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=Zo(),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=Yi(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=Yi(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=Wo(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:mn}: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 pi(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=fi(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,_o(this,e,t,r),null!==e&&(this._config.disableEvents||hn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=vi(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=2,V(this),this._updateTags.add(mn),Yr(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;Ue.set(t,n);const r=Je.get(n)??0;r<1&&n.addEventListener("selectionchange",an),Je.set(n,r+1),t.__lexicalEditor=e;const o=ln(t);for(let n=0;n<Ke.length;n++){const[r,i]=Ke[n],s="function"==typeof i?t=>{fn(t)||(un(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(fn(t))return;un(t);const n=e.isEditable();switch(r){case"cut":return n&&pi(e,Oe,t);case"copy":return pi(e,be,t);case"paste":return n&&pi(e,Zt,t);case"dragstart":return n&&pi(e,ve,t);case"dragover":return n&&pi(e,ke,t);case"dragend":return n&&pi(e,Ee,t);case"focus":return n&&pi(e,Ie,t);case"blur":return n&&pi(e,Le,t);case"drop":return n&&pi(e,Ne,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(mn),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),H(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=2,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,xo(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=Ho();null!==r?r.dirty||Go(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),Si("focus"),Ni(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Ii(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()}}}yo.version="0.38.3-nightly.20251106.0+prod.cjs";let mo=null;function xo(t){mo=t}let Co=1;function So(e,n){const r=No(e,n);return void 0===r&&t(30,n),r}function No(t,e){return t._nodes.get(e)}const To="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function vo(t){return no(Jo(t))}function ko(t){const e=document.activeElement;if(!Fi(e))return!1;const n=e.nodeName;return no(Jo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Mo(e))}function Eo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!ko(e)&&Oo(e)===t}catch(t){return!1}}function bo(t){return t instanceof yo}function Oo(t){let e=t;for(;null!=e;){const t=Mo(e);if(bo(t))return t;e=xi(e)}return null}function Mo(t){return t?t.__lexicalEditor:null}function Ao(t){return Vn(t)||t.isToken()}function wo(t){return Ao(t)||t.isSegmented()}function Do(t){return Ri(t)&&3===t.nodeType}function Po(t){return Ri(t)&&9===t.nodeType}function Io(t){let e=t;for(;null!=e;){if(Do(e))return e;e=e.firstChild}return null}function Lo(t,e,n){const r=w[e];if(null!==n&&(t&r)===(n&r))return t;let o=t^r;return"subscript"===e?o&=~w.superscript:"superscript"===e?o&=~w.subscript:"lowercase"===e?(o&=~w.uppercase,o&=~w.capitalize):"uppercase"===e?(o&=~w.lowercase,o&=~w.capitalize):"capitalize"===e&&(o&=~w.lowercase,o&=~w.uppercase),o}function Fo(t,e){const n=function(){const t=mo;return mo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Ir(),Lr();const r=Rr(),o=Fr(),i=""+Co++;o._nodeMap.set(i,t),Zr(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=1,t.__key=i}function Ro(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 Ko(e){Lr(),pn(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,o=Fr(),i=Rr(),s=o._nodeMap,l=i._dirtyElements;null!==r&&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}}(r,s,l);const c=n.__key;i._dirtyType=1,Zr(e)?l.set(c,!0):i._dirtyLeaves.add(c)}function Bo(t){Ir();const e=Rr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Wo(n);null!==t&&t.getWritable()}if(null!==t){const e=Wo(t);null!==e&&e.getWritable()}}}function zo(){if(Pr())return null;return Rr()._compositionKey}function Wo(t,e){const n=(e||Fr())._nodeMap.get(t);return void 0===n?null:n}function $o(t,e){const n=Uo(t,Rr());return void 0!==n?Wo(n,e):null}function Uo(t,e){return t[`__lexicalKey_${e._key}`]}function Jo(t,e){let n=t;for(;null!=n;){const t=$o(n,e);if(null!==t)return t;n=xi(n)}return null}function Yo(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function jo(t){return t.read(()=>Ho().getTextContent())}function Ho(){return Vo(Fr())}function Vo(t){return t._nodeMap.get("root")}function Go(t){Ir();const e=Fr();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function qo(t){const e=Rr(),n=function(t,e){let n=t;for(;null!=n;){const t=Uo(n,e);if(void 0!==t)return t;n=xi(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Wo("root"):null}return Wo(n)}function Xo(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Qo(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function Zo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function ti(t){return Do(t)?t.nodeValue:null}function ei(t,e,n){const r=Ii(ki(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=ti(o);const r=Jo(o);if(null!==e&&Jn(r)){if(e===v&&n){const t=n.length;e=n,i=t,s=t}null!==e&&ni(r,e,i,s,t)}}}function ni(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]===v&&(a=e.slice(0,-1));const u=i.getTextContent();if(o||a!==u){if(""===a){if(Bo(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=zo(),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 ri(i,a,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=Un(i.getTextContent());i.replace(t),i=t}ri(i,a,g)}}}function ri(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=gs(t,o.offset,"clamp"))}}}function oi(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function ii(t,e){return oi(t,e,"altKey")&&oi(t,e,"ctrlKey")&&oi(t,e,"shiftKey")&&oi(t,e,"metaKey")}function si(t,e,n){return ii(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const li={ctrlKey:!o,metaKey:o},ci={altKey:o,ctrlKey:!o};function ai(t){return"Backspace"===t.key}function ui(t){return si(t,"a",li)}function fi(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 di(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 hi(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 gi(t,e){const n=t.offset;if("element"===t.type){return hi(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?hi(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function _i(t){const e=ki(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function pi(t,e,n){return function(t,e,n){const r=Qo(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 yi(t){return!oo(t)&&!t.isLastChild()&&!t.isInline()}function mi(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function xi(t){const e=t.assignedSlot||t.parentElement;return Ki(e)?e.host:e}function Ci(t){return Po(t)?t:Fi(t)?t.ownerDocument:null}function Si(t){Ir();Rr()._updateTags.add(t)}function Ni(t){Ir();Rr()._deferred.push(t)}function Ti(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function vi(t){const e=Ci(t);return e?e.defaultView:null}function ki(e){const n=e._window;return null===n&&t(78),n}function Ei(t){let e=t.getParentOrThrow();for(;null!==e;){if(bi(e))return e;e=e.getParentOrThrow()}return e}function bi(t){return oo(t)||Zr(t)&&t.isShadowRoot()}function Oi(t){const e=t.constructor.clone(t);return Fo(e,null),e.afterCloneFrom(t),e}function Mi(e){const n=Rr(),r=e.getType(),o=No(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 Ai(e,n){!oo(e.getParent())||Zr(n)||no(n)||t(99)}function wi(e){const n=Wo(e);return null===n&&t(63,e),n}function Di(t){return(no(t)||Zr(t)&&!t.canBeEmpty())&&!t.isInline()}function Pi(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function Ii(t){return n?(t||window).getSelection():null}function Li(t){const e=vi(t);return e?e.getSelection():null}function Fi(t){return Ri(t)&&1===t.nodeType}function Ri(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function Ki(t){return Ri(t)&&11===t.nodeType}function Bi(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 zi(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 Wi(t){if(no(t)&&!t.isInline())return!0;if(!Zr(t)||bi(t))return!1;const e=t.getFirstChild(),n=null===e||En(e)||Jn(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function $i(){return Rr()}const Ui=new WeakMap,Ji=new Map;function Yi(e){if(!e._readOnly&&e.isEmpty())return Ji;e._readOnly||t(192);let n=Ui.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),Ui.set(e,n)),n}function ji(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Hi(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r)}function Vi(t){return!0===t.__lexicalUnmanaged}function Gi(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==yn[e]}function qi(e){const n=R in e.prototype?e.prototype[R]():void 0,r=function(e){if(!(e===yn||e.prototype instanceof yn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{yo.version&&(r=JSON.parse(yo.version))}catch(t){}t(290,e.name,n,r)}return e===eo||e===Qr||e===yn}(e),o=!r&&Gi(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&&(Gi(e,"getType")||(e.getType=()=>s),Gi(e,"clone")||(e.clone=t=>(xo(t),new e)),Gi(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Gi(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const Xi=(t,e)=>{let n=t;for(;null!=n&&!oo(n);){if(e(n))return n;n=n.getParent()}return null},Qi={next:"previous",previous:"next"};class Zi{origin;constructor(t){this.origin=t}[Symbol.iterator](){return vs({hasNext:ls,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return ds(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ds(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=ds(e,this.direction)}for(const t of l.values())t.remove();return this}}class ts extends Zi{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ps(t,this.direction)}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ns(this.direction);return ds(this.getNodeAtCaret(),t)||ps(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof ts&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const es={root:oo,shadowRoot:bi};function ns(t){return Qi[t]}function rs(t,e="root"){return es[e](t)?null:t}class os extends Zi{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ds(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Zr(this.origin)?ps(this.origin,this.direction):null}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ns(this.direction);return ds(this.getNodeAtCaret(),t)||ps(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof os&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof os||t instanceof is)&&this.direction===t.direction&&this.origin.is(t.origin)}}class is extends Zi{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:hs(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return ds(rs(this.getParentAtCaret(),t),this.direction)}getFlipped(){return hs(this.origin,ns(this.direction),this.offset)}isSamePointCaret(t){return t instanceof is&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof os||t instanceof is)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return ds(this.origin,this.direction)}}function ss(t){return t instanceof is}function ls(t){return t instanceof os}function cs(t){return t instanceof ts}const as={next:class extends is{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends is{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},us={next:class extends os{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends os{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},fs={next:class extends ts{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends ts{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function ds(t,e){return t?new us[e](t):null}function hs(t,e,n){return t?new as[e](t,gs(t,n)):null}function gs(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 _s(t,e){return new Cs(t,e)}function ps(t,e){return Zr(t)?new fs[e](t):null}function ys(t){return t&&t.getChildCaret()||t}function ms(t){return t&&ys(t.getAdjacentCaret())}class xs{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 xs(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return ss(e)?function(t,e){const{direction:n,origin:r}=t,o=gs(r,"focus"===e?ns(n):n);return _s(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[_s(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=ss(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ss(n),o=e=>e.isSameNodeCaret(n)?null:ms(e)||e.getParentCaret(t);return vs({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 Cs{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 hs(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function Ss(t){return Ts(t,ds(Ho(),t.direction))}function Ns(t){return Ts(t,t)}function Ts(e,n){return e.direction!==n.direction&&t(265),new xs(e,n,e.direction)}function vs(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 ks(e,n){const r=Ms(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 Es(r)}}function Es(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 bs(t,e){return e.is(t)}function Os(t){return Zr(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ms(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Os(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=Os(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(bs(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(bs(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((Zr(s)||bs(e,s))&&(Zr(i)||bs(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function As(e,n){const{type:r,key:o,offset:i}=e,s=wi(e.key);return"text"===r?(Jn(s)||t(266,s.getType(),o),hs(s,n,i)):(Zr(s)||t(267,s.getType(),o),Us(s,e.offset,n))}function ws(e,n){const{origin:r,direction:o}=n,i="next"===o;ss(n)?e.set(r.getKey(),n.offset,"text"):ls(n)?Jn(r)?e.set(r.getKey(),gs(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(cs(n)&&Zr(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Ds(t){const e=pr(),n=tr(e)?e:hr();return Ps(n,t),Go(n),n}function Ps(t,e){ws(t.anchor,e.anchor),ws(t.focus,e.focus)}function Is(t){const{anchor:e,focus:n}=t,r=As(e,"next"),o=As(n,"next"),i=ks(r,o)<=0?"next":"previous";return Ts(Ws(r,i),Ws(o,i))}function Ls(t){const{direction:e,origin:n}=t,r=ds(n,ns(e)).getNodeAtCaret();return r?ds(r,e):ps(n.getParentOrThrow(),e)}function Fs(t,e="root"){const n=[t];for(let r=cs(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Ls(r));return n}function Rs(t){return!!t&&t.origin.isAttached()}function Ks(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=$s(e,o),l=Fs(s.anchor,r),c=Fs(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(cs(t))a.add(t.origin.getKey());else if(ls(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=Ls(ds(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=hs(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(Rs(t)){f=Bs(t);break}for(const t of c)if(Rs(t)){d=Bs(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(bi(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Wi),f=u&&a(s,t=>n.has(t.getKey())&&Wi(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;ps(t,"previous").splice(0,e.getChildren()),e.remove()}const g=[f,d,...l,...c].find(Rs);if(g){return Ns(Ws(Bs(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function Bs(t){const e=function(t){let e=t;for(;cs(e);){const t=ms(e);if(!cs(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Jn(e.origin))return ss(e)?e:hs(e.origin,n,n);const r=e.getAdjacentCaret();return ls(r)&&Jn(r.origin)?hs(r.origin,n,ns(n)):e}function zs(t){return ss(t)&&t.offset!==gs(t.origin,t.direction)}function Ws(t,e){return t.direction===e?t:t.getFlipped()}function $s(t,e){return t.direction===e?t:Ts(Ws(t.focus,e),Ws(t.anchor,e))}function Us(t,e,n){let r=ps(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Ws(r,n)}function Js(e){const{origin:n,offset:r,direction:o}=e;if(r===gs(n,o))return e.getSiblingCaret();if(r===gs(n,ns(o)))return Ls(e.getSiblingCaret());const[i]=n.splitText(r);return Jn(i)||t(281),Ws(ds(i,"next"),o)}function Ys(t,e){return!0}exports.$addUpdateTag=Si,exports.$applyNodeReplacement=Mi,exports.$caretFromPoint=As,exports.$caretRangeFromSelection=Is,exports.$cloneWithProperties=ji,exports.$cloneWithPropertiesEphemeral=function(t){return(e=ji(t))[_n]=!0,e;var e},exports.$comparePointCaretNext=ks,exports.$copyNode=Oi,exports.$create=function(t){const e=$i();return Ir(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createLineBreakNode=kn,exports.$createNodeSelection=gr,exports.$createParagraphNode=ho,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=Ss,exports.$findMatchingParent=Xi,exports.$getAdjacentChildCaret=ms,exports.$getAdjacentNode=gi,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=ms(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=ms(r)}return o&&[o,n]},exports.$getCaretInDirection=Ws,exports.$getCaretRange=Ts,exports.$getCaretRangeInDirection=$s,exports.$getCharacterOffsets=or,exports.$getChildCaret=ps,exports.$getChildCaretAtIndex=Us,exports.$getChildCaretOrSelf=ys,exports.$getCollapsedCaretRange=Ns,exports.$getCommonAncestor=Ms,exports.$getCommonAncestorResultBranchOrder=Es,exports.$getEditor=$i,exports.$getNearestNodeFromDOMNode=Jo,exports.$getNearestRootOrShadowRoot=Ei,exports.$getNodeByKey=Wo,exports.$getNodeByKeyOrThrow=wi,exports.$getNodeFromDOMNode=$o,exports.$getPreviousSelection=yr,exports.$getRoot=Ho,exports.$getSelection=pr,exports.$getSiblingCaret=ds,exports.$getState=q,exports.$getStateChange=function(t,e,n){const r=q(t,n,"direct"),o=q(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=pr();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=gs,exports.$getTextPointCaret=hs,exports.$getTextPointCaretSlice=_s,exports.$getWritableNodeState=Z,exports.$hasAncestor=Ti,exports.$hasUpdateTag=function(t){return Rr()._updateTags.has(t)},exports.$insertNodes=function(t){let e=pr()||yr();null===e&&(e=Ho().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=function(t){return Zr(t)&&!t.isInline()},exports.$isChildCaret=cs,exports.$isDecoratorNode=no,exports.$isEditorState=function(t){return t instanceof co},exports.$isElementNode=Zr,exports.$isExtendableTextPointCaret=zs,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 Zi},exports.$isNodeSelection=nr,exports.$isParagraphNode=go,exports.$isRangeSelection=tr,exports.$isRootNode=oo,exports.$isRootOrShadowRoot=bi,exports.$isSiblingCaret=ls,exports.$isTabNode=Vn,exports.$isTextNode=Jn,exports.$isTextPointCaret=ss,exports.$isTextPointCaretSlice=function(t){return t instanceof Cs},exports.$isTokenOrSegmented=wo,exports.$isTokenOrTab=Ao,exports.$nodesOfType=function(t){const e=t.getType(),n=Fr();if(n._readOnly){const t=Yi(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=Bs,exports.$normalizeSelection__EXPERIMENTAL=at,exports.$onUpdate=Ni,exports.$parseSerializedNode=function(t){return Ur(t,Rr()._nodes)},exports.$removeTextFromCaretRange=Ks,exports.$rewindSiblingCaret=Ls,exports.$selectAll=function(t){const e=Ho();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"),at(t),t}{const t=e.select(0,e.getChildrenSize());return Go(at(t)),t}},exports.$setCompositionKey=Bo,exports.$setPointFromCaret=ws,exports.$setSelection=Go,exports.$setSelectionFromCaretRange=Ds,exports.$setState=function(t,e,n){let r;if(Ir(),"function"==typeof n){const o=t.getLatest(),i=q(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return Z(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=Oi,$splitTextPointCaretNext:n=Js,rootMode:r="shadowRoot",$shouldSplit:o=Ys}={}){if(ss(t))return n(t);const i=t.getParentCaret(r);if(i){const{origin:n}=i;if(cs(t)&&(!n.canBeEmpty()||!o(n,"first")))return Ls(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),bi(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=bi(n),s=e!==r||i?Oi(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=Ps,exports.ArtificialNode__DO_NOT_USE=ao,exports.BLUR_COMMAND=Le,exports.CAN_REDO_COMMAND=De,exports.CAN_UNDO_COMMAND=Pe,exports.CLEAR_EDITOR_COMMAND=Ae,exports.CLEAR_HISTORY_COMMAND=we,exports.CLICK_COMMAND=Vt,exports.COLLABORATION_TAG=xn,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=Qt,exports.COPY_COMMAND=be,exports.CUT_COMMAND=Oe,exports.DELETE_CHARACTER_COMMAND=Gt,exports.DELETE_LINE_COMMAND=ne,exports.DELETE_WORD_COMMAND=ee,exports.DRAGEND_COMMAND=Ee,exports.DRAGOVER_COMMAND=ke,exports.DRAGSTART_COMMAND=ve,exports.DROP_COMMAND=Ne,exports.DecoratorNode=eo,exports.ElementNode=Qr,exports.FOCUS_COMMAND=Ie,exports.FORMAT_ELEMENT_COMMAND=Te,exports.FORMAT_TEXT_COMMAND=re,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=mn,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=Ce,exports.INSERT_LINE_BREAK_COMMAND=qt,exports.INSERT_PARAGRAPH_COMMAND=Xt,exports.INSERT_TAB_COMMAND=xe,exports.INTERNAL_$isBlock=Wi,exports.IS_ALL_FORMATTING=2047,exports.IS_BOLD=1,exports.IS_CODE=16,exports.IS_HIGHLIGHT=y,exports.IS_ITALIC=2,exports.IS_STRIKETHROUGH=4,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=8,exports.KEY_ARROW_DOWN_COMMAND=de,exports.KEY_ARROW_LEFT_COMMAND=ae,exports.KEY_ARROW_RIGHT_COMMAND=le,exports.KEY_ARROW_UP_COMMAND=fe,exports.KEY_BACKSPACE_COMMAND=_e,exports.KEY_DELETE_COMMAND=ye,exports.KEY_DOWN_COMMAND=se,exports.KEY_ENTER_COMMAND=he,exports.KEY_ESCAPE_COMMAND=pe,exports.KEY_MODIFIER_COMMAND=Fe,exports.KEY_SPACE_COMMAND=ge,exports.KEY_TAB_COMMAND=me,exports.LineBreakNode=Tn,exports.MOVE_TO_END=ce,exports.MOVE_TO_START=ue,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=Se,exports.PASTE_COMMAND=Zt,exports.PASTE_TAG="paste",exports.ParagraphNode=uo,exports.REDO_COMMAND=ie,exports.REMOVE_TEXT_COMMAND=te,exports.RootNode=ro,exports.SELECTION_CHANGE_COMMAND=jt,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=Ht,exports.SELECT_ALL_COMMAND=Me,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=Sn,exports.SKIP_SCROLL_INTO_VIEW_TAG=Cn,exports.SKIP_SELECTION_FOCUS_TAG=Nn,exports.TEXT_TYPE_TO_FORMAT=w,exports.TabNode=jn,exports.TextNode=In,exports.UNDO_COMMAND=oe,exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=Yt,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:Zo()),c=e.editorState,a=[ro,In,Tn,jn,uo,ao,...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}qi(e);const o=e.getType(),i=po(e);h.set(o,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:X(a[t]),transforms:i})}}const g=new yo(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=2),g},exports.createSharedNodeState=X,exports.createState=function(t,e){return new G(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=ns,exports.getDOMOwnerDocument=Ci,exports.getDOMSelection=Ii,exports.getDOMSelectionFromTarget=Li,exports.getDOMTextNode=Io,exports.getEditorPropertyFromDOMNode=Mo,exports.getNearestEditorFromDOMNode=Oo,exports.getRegisteredNode=No,exports.getRegisteredNodeOrThrow=So,exports.getStaticNodeConfig=qi,exports.getTextDirection=function(t){return M.test(t)?"rtl":A.test(t)?"ltr":null},exports.getTransformSetFromKlass=po,exports.isBlockDomNode=zi,exports.isCurrentlyReadOnlyMode=Pr,exports.isDOMDocumentNode=Po,exports.isDOMNode=Ri,exports.isDOMTextNode=Do,exports.isDOMUnmanaged=Vi,exports.isDocumentFragment=Ki,exports.isExactShortcutMatch=si,exports.isHTMLAnchorElement=function(t){return Fi(t)&&"A"===t.tagName},exports.isHTMLElement=Fi,exports.isInlineDomNode=Bi,exports.isLexicalEditor=bo,exports.isModifierMatch=ii,exports.isSelectionCapturedInDecoratorInput=ko,exports.isSelectionWithinEditor=Eo,exports.makeStepwiseIterator=vs,exports.removeFromParent=Ro,exports.resetRandomKey=function(){Co=1},exports.safeCast=function(t){return t},exports.setDOMUnmanaged=function(t){t.__lexicalUnmanaged=!0},exports.setNodeIndentFromDOM=Hi,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};