lexical 0.45.0 → 0.45.1-dev.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/dist/Lexical.dev.js +213 -148
- package/dist/Lexical.dev.mjs +210 -149
- package/dist/Lexical.js.flow +9 -1
- package/dist/Lexical.mjs +4 -0
- package/dist/Lexical.node.mjs +4 -0
- package/dist/Lexical.prod.js +1 -1
- package/dist/Lexical.prod.mjs +1 -1
- package/dist/LexicalNode.d.ts +8 -0
- package/dist/LexicalUpdates.d.ts +2 -0
- package/dist/LexicalUtils.d.ts +41 -5
- package/dist/index.d.ts +3 -3
- package/dist/nodes/LexicalLineBreakNode.d.ts +18 -0
- package/package.json +2 -2
- package/src/LexicalEditor.ts +10 -9
- package/src/LexicalEvents.ts +4 -5
- package/src/LexicalMutations.ts +0 -6
- package/src/LexicalNode.ts +8 -0
- package/src/LexicalReconciler.ts +8 -0
- package/src/LexicalSelection.ts +10 -11
- package/src/LexicalUpdates.ts +12 -0
- package/src/LexicalUtils.ts +66 -15
- package/src/index.ts +5 -0
- package/src/nodes/LexicalLineBreakNode.ts +18 -2
- package/src/nodes/LexicalTextNode.ts +2 -16
package/dist/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&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&o&&!u,h=0,g=1,_=2,p=128,y=1,m=2,x=3,C=4,S=5,T=6,N=a||l||d?"\xa0":"\u200b",v="\n\n",k=i?"\xa0":N,O="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",E="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",b=new RegExp("^[^"+E+"]*["+O+"]"),M=new RegExp("^[^"+O+"]*["+E+"]"),A={bold:1,capitalize:1024,code:16,highlight:p,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},w={directionless:1,unmergeable:2},D={center:2,end:6,justify:4,left:1,right:3,start:5},I={[m]:"center",[T]:"end",[C]:"justify",[y]:"left",[x]:"right",[S]:"start"},P={normal:0,segmented:2,token:1},F={[h]:"normal",[_]:"segmented",[g]:"token"},R="$config";function L(){return Ls()._blockCursorElement}class K{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new K(this.element,t,this.after)}withAfter(t){return new K(this.element,this.before,t)}withElement(t){return this.element===t?this:new K(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const r=B(t,this.element);if(null===r)return"after";const o=Array.prototype.indexOf.call(t.childNodes,r);if(o<0)return"after";if(e===t)return n<=o?"before":"after";const i=B(t,e);if(null===i)return"after";const s=Array.prototype.indexOf.call(t.childNodes,i);return s>=0&&s<=o?"before":"after"}getInsertionAnchor(){return this.before}}function B(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class z extends K{withBefore(t){return new z(this.element,t,this.after)}withAfter(t){return new z(this.element,this.before,t)}withElement(t){return this.element===t?this:new z(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){const t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return null!==e&&e===L()?e:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);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.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,o),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=o}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let n=0;for(let r=this.element.firstChild;null!==r&&r!==t&&r!==e;r=r.nextSibling)n++;return n}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset(),n=L(),o=this.element.childNodes,i=Math.min(r,o.length);let s=0;for(let t=e;t<i;t++)o[t]!==n&&s++;return[t,Math.min(s,t.getChildrenSize())]}const o=$(e,n);o.push(r);const i=$(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 $(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()}let W;try{W="0.45.0+prod.cjs"}catch(t){}const U=W??"0.45.0+source";class Y{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}const j=null;function H(t,e=1e3){return t instanceof J?t.clone():t.size<e?new Map(t):(new J).init(new Map(t),void 0,t.size)}class J{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,(new J).init(this._old,this._nursery,this._size)}init(t,e,n){return this._old=t,this._nursery=e,this._size=n,this}get size(){return this._size}has(t){return void 0!==this.get(t)}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return void 0!==e?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===j?void 0:e}shouldCompact(){return void 0!==this._nursery&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const t=new Map(this._old);for(const[e,n]of this._nursery)n!==j?t.set(e,n):t.delete(e);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const n=this.getWithTombstone(t);if(n===e)return this;const r=this.getNursery();return n!==j&&void 0!==n||(this._size++,n===j&&r.delete(t)),r.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,j),this._size--),e}getOrInsert(t,e){const n=this.get(t);return void 0!==n?n:(this.set(t,e),e)}getOrInsertComputed(t,e){const n=this.get(t);if(void 0!==n)return n;const r=e(t);return this.set(t,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(e)for(const n of e){const e=n[0],r=t?t.get(e):void 0;r!==j&&(void 0!==r&&(n[1]=r),yield n)}if(t)for(const n of t)n[1]===j||e&&e.has(n[0])||(yield n)}forEach(t,e){void 0!==e&&(t=t.bind(e));for(const[e,n]of this.entries())t(n,e,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}}function G(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(jo(s)&&G(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}let V=!1,q=0;function X(t){q=t.timeStamp}function Q(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==Ki(t,n)}function Z(t,e,n){const r=Es(ms(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&Xi(e,s,o,i,!1)}function tt(t,e,n){if($r(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return Ei(e)&&n.isAttached()}function et(t,e,n,r){for(let o=t;o&&!Vs(o);o=ds(o)){const t=Ki(o,e);if(void 0!==t){const e=Ri(t,n);if(e)return Go(e)||!Ms(o)?void 0:[o,e]}else if(o===r)return[r,Ui(n)]}}function nt(t,e,n){V=!0;const r=performance.now()-q>100;try{Uo(t,()=>{const o=oo()||function(t){return t.getEditorState().read(()=>{const t=oo();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,_=et(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&wr(y)&&Ei(g)&&tt(o,g,y)&&Z(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=Li(r),s=r.parentNode;if(null!=s&&r!==a&&null===o&&!Q(r,s,t)&&!Vs(r)){if(i){const t=(Ms(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];(Q(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||Q(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(u&&Yi(o),i&&as(t)&&o.insertRawText(f))})}finally{V=!1}}function rt(t){const e=t._observer;if(null!==e){nt(t,e.takeRecords(),e)}}function ot(t){!function(t){0===q&&ms(t).addEventListener("textInput",X,!0)}(t),t._observer=new MutationObserver((e,n)=>{nt(t,e,n)})}class it{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||dt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function st(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function lt(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}=Xs(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 ct{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 ft(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 ct(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)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}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=ft(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 at(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new ct(e,ut(e));return e.__state=n,n}function ut(t){return t.__state?t.__state.sharedNodeState:pi(Ls(),t.getType()).sharedNodeState}function ft(t){if(t)for(const e in t)return t}function dt(t){return t}function ht(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 gt(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 _t(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function pt(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;const n=new Set;return!(t&&ht(n,t,e)||e&&ht(n,e,t)||t&>(n,t,e)||e&>(n,e,t))}(c,a))}function yt(t,e){const n=t.mergeWithSibling(e),r=Mo()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function mt(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&wr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(pt(e,r)){r=yt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&wr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(pt(r,n)){r=yt(r,n);break}break}n.remove()}}else r.remove()}function xt(t){return Ct(t.anchor),Ct(t.focus),t}function Ct(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),wr(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!jo(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const St=Symbol.for("@lexical/CachedTextSize");function Tt(e,n){return Bt.read(()=>{let r=0,o=e;for(let e=0;e<n&&null!==o;e++){const i=Kt.get(o);if(void 0===i&&t(345,o),jo(i)){const s=zt.get(o);if(void 0!==s&&jo(s)&&s.__parent!==i.__parent)r+=i.getTextContentSize();else{const e=$t.get(o),n=e&&e.__lexicalTextContent;"string"!=typeof n&&t(346,i.getType()),r+=n.length}e<n-1&&!i.isInline()&&(r+=2)}else{const e=i[St];void 0===e&&t(347,i.getType(),o),r+=e}o=i.__next}return r},{editor:Ot})}function Nt(t){jo(t)||void 0===t[St]&&(t[St]=wr(t)?t.__text.length:t.getTextContentSize())}const vt=4;let kt,Ot,Et,bt="",Mt=null,At=null,wt=null;function Dt(){return{firstTextKey:wt,format:Mt,style:At}}function It(t){null!==t.firstTextKey&&(Mt=t.format,At=t.style,wt=t.firstTextKey)}function Pt(e){if(null!==wt)return;const n=e.__lexicalFirstTextKey;if(void 0===n&&t(348),null===n)return;const r=zt.get(n);wr(r)&&(Mt=r.getFormat(),At=r.getStyle(),wt=n)}let Ft,Rt,Lt,Kt,Bt,zt,$t,Wt,Ut,Yt,jt=!1,Ht=!1;function Jt(t,e){const n=Kt.get(t),r=zt.has(t);if(null!==e){const n=ue(t);n.parentNode===e&&e.removeChild(n)}if(!r){if(Ot._keyToDOMMap.delete(t),jo(n)){const t=Zs(n,Kt);Gt(t,0,t.length-1,null)}void 0!==n&&ss(Ut,Et,Ft,n,"destroyed")}}function Gt(t,e,n,r){for(let o=e;o<=n;++o){const e=t[o];void 0!==e&&Jt(e,r)}}function Vt(t,e){t.setProperty("text-align",e)}const qt="40px";function Xt(t,e){const n=kt.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)}t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * var(--lexical-indent-base-value, ${qt}))`)}function Qt(t,e){const n=t.style;0===e?Vt(n,""):1===e?Vt(n,"left"):2===e?Vt(n,"center"):3===e?Vt(n,"right"):4===e?Vt(n,"justify"):5===e?Vt(n,"start"):6===e&&Vt(n,"end")}function Zt(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(qo(t))return null;const n=t.getParentOrThrow();return Cs(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function te(e,n){const r=zt.get(e);if(void 0===r&&t(60),null!==n){const t=Kt.get(e);if(void 0!==t&&t.__parent!==r.__parent){const t=$t.get(e);if(void 0!==t)return n.insertChild(t),ie(e,n.element)}}const o=Yt.$createDOM(r,Ot);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,Ot),wr(r)?o.setAttribute("data-lexical-text","true"):Go(r)&&o.setAttribute("data-lexical-decorator","true"),jo(r)){const t=r.__indent,e=r.__size;if(Zt(o,r),0!==t&&Xt(o,t),0===e)o.__lexicalTextContent="",o.__lexicalFirstTextKey=null;else{const t=e-1;ee(Zs(r,zt),r,0,t,Bs(r,o,Ot))}const n=r.__format;0!==n&&Qt(o,n),r.isInline()||ne(null,r,o)}else{const t=r.getTextContent();if(Go(r)){const t=r.decorate(Ot,kt);null!==t&&se(e,t),o.contentEditable="false"}bt+=t}return null!==n&&n.insertChild(o),Yt.$decorateDOM(r,null,o,Ot),Nt(r),ss(Ut,Et,Ft,r,"created"),o}function ee(e,n,r,o,i){const s=bt,l=Dt();bt="",Mt=null,At=null,wt=null;let c=r;for(;c<=o;++c){const t=Dt();te(e[c],i);const n=zt.get(e[c]);null!==n&&wr(n)?null===Mt&&(Mt=n.getFormat(),At=n.getStyle(),wt=n.__key):jo(n)&&c<o&&!n.isInline()&&(bt+=v),It(t)}const a=Ot._keyToDOMMap.get(n.__key);void 0===a&&t(349,n.__key),a.__lexicalTextContent=bt,a.__lexicalFirstTextKey=wt,bt=s+bt,It(l)}function ne(t,e,n){const r=Bs(e,n,Ot),o=r.element.__lexicalLastChildKind??null,i=function(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return hr(t)?"line-break":Go(t)&&t.isInline()?"decorator":null}return"empty"}return null}(e,zt);o!==i&&r.setManagedLineBreak(i)}function re(e,n,r){var o;Mt=null,At=null,wt=null,function(e,n,r){const o=bt,i=e.__size,s=n.__size;bt="";const l=r.element,c=Ot._keyToDOMMap.get(n.__key);void 0===c&&t(351,n.__key);const a=s-i;if(!jt&&Math.abs(a)<=1&&i>=vt&&e.__first===n.__first&&(0!==a||!Ot._cloneNotNeeded.has(e.__key))){const i=c.__lexicalTextContent,u=Wt.get(e.__key);if(!jt&&"string"==typeof i&&void 0!==u){const s=function(t,e){const n=e.size;if(0===n||n>=t.__size)return null;let r=t.__last,o=null,i=0;for(;null!==r&&i<n;){if(!e.has(r))return null;o=r;const t=zt.get(r);if(void 0===t)return null;r=t.__prev,i++}if(i!==n)return null;if(null!==r&&e.has(r))return null;return o}(n,u);if(null!==s){const f=u.size;if(0===a){const e=Tt(s,f);let r=s,a=0;for(;null!==r&&a<f;){const t=zt.get(r);if(void 0===t)break;const e=Dt();ie(r,l),wr(t)&&null===Mt&&(Mt=t.getFormat(),At=t.getStyle(),wt=t.__key),It(e),r=t.__next,a++}let d="";for(r=s,a=0;null!==r&&a<f;){const e=zt.get(r);if(void 0===e)break;let n;if(jo(e)){const o=Ot._keyToDOMMap.get(r),i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(352,e.getType()),n=i}else n=e.getTextContent();d+=n,a<f-1&&jo(e)&&!e.isInline()&&(d+=v),r=e.__next,a++}const h=i.slice(0,i.length-e)+d;return c.__lexicalTextContent=h,bt=o+h,void oe(n,c,u)}if(function(e,n,r,o,i,s,l,c){if(1!==c&&-1!==c)return!1;const a=1===c?2:1;if(l!==a)return!1;const u=l-c;let f=e.__last;for(let t=0;t<u-1;t++){if(null===f)return!1;const t=Kt.get(f);if(void 0===t)return!1;f=t.__prev}if(null===f)return!1;const d=zt.get(s),h=Kt.get(f);if(void 0===d||void 0===h)return!1;if(d.__prev!==h.__prev)return!1;const g=[];let _=s;for(let t=0;t<l;t++){if(null===_)return!1;g.push(_);const t=zt.get(_);_=t?t.__next:null}const p=[];_=f;for(let t=0;t<u;t++){if(null===_)return!1;p.push(_);const t=Kt.get(_);_=t?t.__next:null}const y=new Set(p),m=new Set(g),x=[];let C=0,S=0;for(;C<u&&S<l;)if(g[S]===p[C])x.push({key:g[S],kind:"reconcile"}),C++,S++;else if(m.has(p[C])){if(y.has(g[S]))return!1;x.push({key:g[S],kind:"create",nextIndex:S}),S++}else x.push({key:p[C],kind:"destroy"}),C++;for(;C<u;)x.push({key:p[C++],kind:"destroy"});for(;S<l;)x.push({key:g[S],kind:"create",nextIndex:S}),S++;const T=Tt(f,u);for(const t of x){const e=Dt();if("reconcile"===t.kind)ie(t.key,r.element);else if("destroy"===t.kind)Jt(t.key,r.element);else{let e=null;for(let n=t.nextIndex+1;n<l;n++){const t=Ot._keyToDOMMap.get(g[n]);if(void 0!==t){e=t;break}}te(t.key,r.withBefore(e??r.before))}if("destroy"!==t.kind){const e=zt.get(t.key);e&&wr(e)&&null===Mt&&(Mt=e.getFormat(),At=e.getStyle(),wt=e.__key)}It(e)}let N="";for(let e=0;e<l;e++){const n=zt.get(g[e]);if(void 0===n)return!1;let r;if(jo(n)){const o=Ot._keyToDOMMap.get(g[e]),i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(350,n.getType()),r=i}else r=n.getTextContent();N+=r,e<l-1&&jo(n)&&!n.isInline()&&(N+=v)}const k=i.slice(0,i.length-T)+N;return o.__lexicalTextContent=k,!0}(e,0,r,c,i,s,f,a)){const e=c.__lexicalTextContent;return"string"!=typeof e&&t(353),bt=o+e,void oe(n,c,u)}}}if(0===a){let n=e.__first,r=0;for(;null!==n;){const e=zt.get(n);if(void 0===e)break;const o=jt||Lt.has(n)||Rt.has(n),i=Dt();if(o)ie(n,l);else{let r,o;if(jo(e)){o=$t.get(n);const i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(354,e.getType()),r=i}else r=e.getTextContent();bt+=r,void 0!==o&&Pt(o)}wr(e)?null===Mt&&(Mt=e.getFormat(),At=e.getStyle(),wt=e.__key):jo(e)&&r<s-1&&!e.isInline()&&(bt+=v),It(i),n=e.__next,r++}return c.__lexicalTextContent=bt,c.__lexicalFirstTextKey=wt,void(bt=o+bt)}}if(1===i&&1===s){const t=e.__first,o=n.__first;if(t===o)ie(t,l);else{const e=ue(t),n=te(o,null);try{e.parentNode===l?l.replaceChild(n,e):r.insertChild(n)}catch(r){if("object"==typeof r&&null!=r){const i=`${r.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${o}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(i)}throw r}Jt(t,null)}const i=zt.get(o);wr(i)&&null===Mt&&(Mt=i.getFormat(),At=i.getStyle(),wt=i.__key)}else{const o=Zs(e,Kt),c=Zs(n,zt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&ee(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;Gt(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],o=Dt();if(t===r)u=le(ie(r,i.element)),f++,d++;else{if(void 0===a&&(a=ce(n,d)),void 0===c)c=ce(e,f);else if(!c.has(t)){f++,It(o);continue}if(!a.has(t)){u=le(ue(t)),Jt(t,i.element),f++,c.delete(t),It(o);continue}if(c.has(r)){const t=fs(Ot,r);t!==u&&i.withBefore(u??i.before).insertChild(t),u=le(ie(r,i.element)),f++,d++}else te(r,i.withBefore(u??i.before)),d++}const s=zt.get(r);null!==s&&wr(s)?null===Mt&&(Mt=s.getFormat(),At=s.getStyle(),wt=s.__key):jo(s)&&d<=l&&!s.isInline()&&(bt+=v),It(o)}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Ot.getElementByKey(e);ee(n,t,d,l,i.withBefore(r??i.before))}else g&&!h&&Gt(e,f,s,i.element)}(n,o,c,i,s,r)}c.__lexicalTextContent=bt,c.__lexicalFirstTextKey=wt,bt=o+bt}(e,n,Bs(n,r,Ot)),Cs(n)||(o=n,null==Mt||Mt===o.__textFormat||Ht||o.setTextFormat(Mt),function(t){null==At||At===t.__textStyle||Ht||t.setTextStyle(At)}(n))}function oe(t,e,n){const r=e.__lexicalFirstTextKey;if(null!=r){const e=t.__key;let o=r;for(;null!==o;){const t=zt.get(o);if(void 0===t){o=null;break}if(t.__parent===e)break;o=t.__parent}if(null!==o&&!n.has(o)){const t=zt.get(r);if(wr(t))return Mt=t.getFormat(),void(At=t.getStyle())}}e.__lexicalFirstTextKey=wt}function ie(e,n){const r=Kt.get(e);let o=zt.get(e);void 0!==r&&void 0!==o||t(61);const i=jt||Lt.has(e)||Rt.has(e),s=fs(Ot,e);if(r===o&&!i){let e;if(jo(r)){const n=s.__lexicalTextContent;"string"!=typeof n&&t(355,r.getType()),e=n,Pt(s)}else e=r.getTextContent();return bt+=e,s}if(r!==o&&i&&ss(Ut,Et,Ft,o,"updated"),Yt.$updateDOM(o,r,s,Ot)){const r=te(e,null);return null===n&&t(62),n.replaceChild(r,s),Jt(e,null),r}if(jo(r)){jo(o)||t(334,e);const n=o.__indent;(jt||n!==r.__indent)&&Xt(s,n);const l=o.__format;if((jt||l!==r.__format)&&Qt(s,l),i)re(r,o,s),qo(o)||o.isInline()||ne(0,o,s);else{const e=s.__lexicalTextContent;"string"!=typeof e&&t(356,r.getType()),bt+=e,Pt(s)}if((jt||o.__dir!==r.__dir||o.__parent!==r.__parent)&&(Zt(s,o),qo(o)&&!jt))for(const t of o.getChildren())if(jo(t)){Zt(fs(Ot,t.getKey()),t)}}else{const t=o.getTextContent();if(Go(o)){const t=o.decorate(Ot,kt);null!==t&&se(e,t)}bt+=t}if(!Ht&&qo(o)){const t=o.getLatest();if(t.__cachedText!==bt){const e=t.getWritable();e.__cachedText=bt,o=e}}return Yt.$decorateDOM(o,r,s,Ot),Nt(o),s}function se(t,e){let n=Ot._pendingDecorators;const r=Ot._decorators;if(null===n){if(r[t]===e)return;n=zi(Ot)}n[t]=e}function le(t){let e=t.nextSibling;return null!==e&&e===Ot._blockCursorElement&&(e=e.nextSibling),e}function ce(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function ae(t,e,n,r,o,i){bt="",Mt=null,At=null,wt=null,jt=2===r,Ot=n,kt=n._config,Yt=n._config.dom||ai,Et=n._nodes,Ft=Ot._listeners.mutation,Rt=o,Lt=i,Kt=t._nodeMap,Bt=t,zt=e._nodeMap,Ht=e._readOnly,$t=H(n._keyToDOMMap),Wt=function(){const t=new Map,e=e=>{for(const n of e){const e=zt.get(n);if(void 0===e)continue;const r=e.__parent;if(null===r)continue;let o=t.get(r);void 0===o&&(o=new Set,t.set(r,o)),o.add(n)}};return e(Rt.keys()),e(Lt),t}();const s=new Map;return Ut=s,ie("root",null),Ot=void 0,Et=void 0,Rt=void 0,Lt=void 0,Kt=void 0,Bt=void 0,zt=void 0,kt=void 0,$t=void 0,Wt=void 0,Ut=void 0,Yt=ai,s}function ue(e){const n=$t.get(e);return void 0===n&&t(75,e),n}function fe(t){return{type:t}}const de=fe("SELECTION_CHANGE_COMMAND"),he=fe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ge=fe("CLICK_COMMAND"),_e=fe("BEFORE_INPUT_COMMAND"),pe=fe("INPUT_COMMAND"),ye=fe("COMPOSITION_START_COMMAND"),me=fe("COMPOSITION_END_COMMAND"),xe=fe("DELETE_CHARACTER_COMMAND"),Ce=fe("INSERT_LINE_BREAK_COMMAND"),Se=fe("INSERT_PARAGRAPH_COMMAND"),Te=fe("CONTROLLED_TEXT_INSERTION_COMMAND"),Ne=fe("PASTE_COMMAND"),ve=fe("REMOVE_TEXT_COMMAND"),ke=fe("DELETE_WORD_COMMAND"),Oe=fe("DELETE_LINE_COMMAND"),Ee=fe("FORMAT_TEXT_COMMAND"),be=fe("UNDO_COMMAND"),Me=fe("REDO_COMMAND"),Ae=fe("KEYDOWN_COMMAND"),we=fe("KEY_ARROW_RIGHT_COMMAND"),De=fe("MOVE_TO_END"),Ie=fe("KEY_ARROW_LEFT_COMMAND"),Pe=fe("MOVE_TO_START"),Fe=fe("KEY_ARROW_UP_COMMAND"),Re=fe("KEY_ARROW_DOWN_COMMAND"),Le=fe("KEY_ENTER_COMMAND"),Ke=fe("KEY_SPACE_COMMAND"),Be=fe("KEY_BACKSPACE_COMMAND"),ze=fe("KEY_ESCAPE_COMMAND"),$e=fe("KEY_DELETE_COMMAND"),We=fe("KEY_TAB_COMMAND"),Ue=fe("INSERT_TAB_COMMAND"),Ye=fe("INDENT_CONTENT_COMMAND"),je=fe("OUTDENT_CONTENT_COMMAND"),He=fe("DROP_COMMAND"),Je=fe("FORMAT_ELEMENT_COMMAND"),Ge=fe("DRAGSTART_COMMAND"),Ve=fe("DRAGOVER_COMMAND"),qe=fe("DRAGEND_COMMAND"),Xe=fe("COPY_COMMAND"),Qe=fe("CUT_COMMAND"),Ze=fe("SELECT_ALL_COMMAND"),tn=fe("CLEAR_EDITOR_COMMAND"),en=fe("CLEAR_HISTORY_COMMAND"),nn=fe("CAN_REDO_COMMAND"),rn=fe("CAN_UNDO_COMMAND"),on=fe("FOCUS_COMMAND"),sn=fe("BLUR_COMMAND"),ln=fe("KEY_MODIFIER_COMMAND"),cn=Object.freeze({}),an=[["keydown",function(t,e){un=t.timeStamp,fn=t.key,"Backspace"!==t.key&&In();if(e.isComposing())return;us(e,Ae,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;As(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Uo(e,()=>{xi(n)||(xn=!0)})}],["compositionstart",function(t,e){us(e,ye,t)}],["compositionend",function(t,e){i?Sn=!0:l||!a&&!d?us(e,me,t):(Tn=!0,Nn=t.data)}],["input",function(t,e){t.stopPropagation(),In(),Uo(e,()=>{e.dispatchCommand(pe,t)},{event:t}),hn=null}],["click",function(t,e){Uo(e,()=>{const n=oo(),r=Es(ms(e)),o=io();if(r)if($r(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!qo(e)&&1===Wi().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==o&&n.is(o)&&(r.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Ms(n)||Ei(n)){Yi(ro(o,r,e,t))}}us(e,ge,t)})}],["cut",cn],["copy",cn],["dragstart",cn],["dragover",cn],["dragend",cn],["paste",cn],["focus",cn],["blur",cn],["drop",cn]];s&&an.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||i&&as(e))return;if("insertCompositionText"===n)return;us(e,_e,t)}(t,e)]);let un=0,fn=null,dn=0,hn=null,gn=!1,_n=null;const pn=new WeakMap,yn=new WeakMap;let mn=!1,xn=!1,Cn=!1,Sn=!1,Tn=!1,Nn="",vn=null,kn=[0,"",0,"root",0];function On(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=Mo(),u=Es(ms(a)),f=null!==u?u.anchorNode:null,d=i.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!wr(c)||(!o&&(!s||dn<r+50)||c.isDirty()&&g<2||Hi(n))&&i.offset!==l.offset&&!c.isComposing()||Oi(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==$s(c,h,a)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(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=ki(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||function(t){const e=t.getPreviousSibling();return(wr(e)||jo(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}(t,c)}function En(t,e){return Ei(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function bn(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;mn&&(mn=!1,En(o,i)&&En(s,l)&&!vn)||Uo(n,()=>{if(!r)return void Yi(null);if(!Si(n,o,s))return;let c=oo();if(vn&&$r(c)&&c.isCollapsed()){const t=c.anchor,e=vn.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=vn.clone(),Yi(c))}if(vn=null,$r(c)){const r=c.anchor,o=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=ms(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=kn,h=Wi(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)Mn(c,l,a);else if("text"===r.type)wr(o)||t(141),An(c,o);else if("element"===r.type&&!g){jo(o)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();Mn(t,n,r)}(c,e):Mn(c,c.format,"")}}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(wr(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}}us(n,de,void 0)})}function Mn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function An(t,e){Mn(t,e.getFormat(),e.getStyle())}function wn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function Dn(t){if(null==t||t.length<=1||null==fn)return;const e=1===fn.length?fn:"Enter"===fn?"\n":"Tab"===fn?"\t":null;if(!e)return;const n=oo();if(!$r(n)||!n.isCollapsed())return;const r=n.anchor.getNode();if(!wr(r))return;const{offset:o}=n.anchor;if(r.getTextContentSize()===o){const t=r.getNextSibling();if("\n"===e){if(hr(t))t.selectEnd();else if(!t){const t=Qs(r,Zr),e=t&&t.getNextSibling();jo(e)&&e.selectStart()}}else"\t"===e?Fr(t)&&t.selectEnd():wr(t)&&t.getTextContent()[0]===e&&t.select(1,1)}else r.getTextContent()[o]===e&&r.select(o+1,o+1)}function In(){gn=!1,null!==_n&&(clearTimeout(_n),_n=null)}function Pn(){In(),gn=!0,_n=setTimeout(In,0)}function Fn(e){const n=e.inputType,r=wn(e),o=Mo(),i=oo();if("insertText"===n&&e.data&&gn){if(In(),e.preventDefault(),$r(i)&&!i.isCollapsed()){const t=i.isBackward()?i.anchor:i.focus;i.anchor.set(t.key,t.offset,t.type),i.focus.set(t.key,t.offset,t.type)}return!0}if("deleteContentBackward"===n){if(null===i){const t=io();if(!$r(t))return!0;Yi(t.clone())}if($r(i)){const n=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===fn&&s<un+30&&o.isComposing()&&n){if(Pi(null),un=0,setTimeout(()=>{Uo(o,()=>{Pi(null)})},30),$r(i)){const e=i.anchor.getNode();e.markDirty(),wr(e)||t(142),An(i,e)}}else{if(Pi(null),l&&null!==r&&!r.collapsed&&(i.applyDOMRange(r),!i.isCollapsed()))return e.preventDefault(),i.removeText(),!0;e.preventDefault();const t=i.anchor.getNode(),s=t.getTextContent(),c=t.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===s.length;let u=f&&n&&!a&&c;if(u&&i.isCollapsed()&&(u=!Go(cs(i.anchor,!0))),!u){us(o,xe,!0);const t=oo();f&&$r(t)&&t.isCollapsed()&&(vn=t,setTimeout(()=>vn=null))}}return!0}}var s;if(!$r(i))return!0;const c=e.data;null!==hn&&qi(!1,o,hn),i.dirty&&null===hn||!i.isCollapsed()||qo(i.anchor.getNode())||null===r||i.applyDOMRange(r),hn=null;const a=i.anchor,u=i.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===c)e.preventDefault(),us(o,Ce,!1);else if(c===v)e.preventDefault(),us(o,Se,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=c&&On(i,r,c,e.timeStamp,!0)?(e.preventDefault(),us(o,Te,c),Dn(c)):hn=c;return dn=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":us(o,Te,e);Dn((e.dataTransfer?e.dataTransfer.getData("text/plain"):null)??e.data);break;case"insertFromComposition":Pi(null),us(o,Te,e);break;case"insertLineBreak":Pi(null),us(o,Ce,!1);break;case"insertParagraph":Pi(null),Cn&&!l?(Cn=!1,us(o,Ce,!1)):us(o,Se,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":us(o,Ne,e);break;case"deleteByComposition":(function(t,e){return t!==e||jo(t)||jo(e)||!ki(t)||!ki(e)})(d,h)&&us(o,ve,e);break;case"deleteByDrag":gs(rr),us(o,ve,e);break;case"deleteByCut":us(o,ve,e);break;case"deleteContent":us(o,xe,!1);break;case"deleteWordBackward":us(o,ke,!0);break;case"deleteWordForward":us(o,ke,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":us(o,Oe,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":us(o,Oe,!1);break;case"formatStrikeThrough":us(o,Ee,"strikethrough");break;case"formatBold":us(o,Ee,"bold");break;case"formatItalic":us(o,Ee,"italic");break;case"formatUnderline":us(o,Ee,"underline");break;case"historyUndo":us(o,be,void 0);break;case"historyRedo":us(o,Me,void 0)}return!0}function Rn(t){if(Ms(t.target)&&xi(t.target))return!0;const e=Mo(),n=oo(),r=t.data,o=wn(t);if(null!=r&&$r(n)&&On(n,o,r,t.timeStamp,!1)){Sn&&(Bn(e,r),Sn=!1);const o=n.anchor.getNode(),l=Es(ms(e));if(null===l)return!0;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&wr(o)&&null!==l.anchorNode&&o.getTextContent().slice(0,a)+r+o.getTextContent().slice(a+u)===Vi(l.anchorNode)||us(e,Te,r);const d=r.length;i&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d,n._cachedNodes=null,n._cachedIsBackward=null),f&&e.isComposing()&&(un=0,Pi(null))}else{qi(!1,e,null!==r?r:void 0),Sn&&(Bn(e,r||void 0),Sn=!1)}return function(){Oo();const t=Mo();rt(t)}(),!0}function Ln(t){const e=Mo(),n=oo();if($r(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Pi(r.key),gs(or),(t.timeStamp<un+30||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||wr(o)&&o.getStyle()!==n.style)&&us(e,Te,k)}return!0}function Kn(t){return Bn(Mo(),t.data),gs(ir),!0}function Bn(t,e){const n=t._compositionKey;if(Pi(null),null!==n&&null!=e){if(""===e){const e=Ri(n),r=t.getElementByKey(n),o=null!==r&&wr(e)?$s(e,r,t):null;if(null!==o&&null!==o.nodeValue&&wr(e)){const n=Es(ms(t));let r=null,i=null;null!==n&&n.anchorNode===o&&(r=n.anchorOffset,i=n.focusOffset),Xi(e,o.nodeValue,r,i,!0)}return}if("\n"===e[e.length-1]){const e=oo();if($r(e)||Ur(e)){if($r(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type)}return void us(t,Le,null)}}}qi(!0,t,e)}function zn(t){const e=Mo();if(null==t.key)return!0;if(Tn){if(os(t))return Uo(e,()=>{Bn(e,Nn)}),Tn=!1,Nn="",!0;Tn=!1,Nn=""}if(function(t){return es(t,"ArrowRight",{shiftKey:"any"})}(t))us(e,we,t);else if(function(t){return es(t,"ArrowRight",{...ns,shiftKey:"any"})}(t))us(e,De,t);else if(function(t){return es(t,"ArrowLeft",{shiftKey:"any"})}(t))us(e,Ie,t);else if(function(t){return es(t,"ArrowLeft",{...ns,shiftKey:"any"})}(t))us(e,Pe,t);else if(function(t){return es(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))us(e,Fe,t);else if(function(t){return es(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))us(e,Re,t);else if(function(t){return es(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Cn=!0,us(e,Le,t);else if(function(t){return" "===t.key}(t))us(e,Ke,t);else if(function(t){return o&&es(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),Cn=!0,us(e,Ce,!0);else if(function(t){return es(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Cn=!1,us(e,Le,t);else if(function(t){return es(t,"Backspace",{shiftKey:"any"})||o&&es(t,"h",{ctrlKey:!0})}(t))os(t)?us(e,Be,t)&&Pn():(t.preventDefault(),us(e,xe,!0));else if(function(t){return"Escape"===t.key}(t))us(e,ze,t);else if(function(t){return es(t,"Delete",{})||o&&es(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),us(e,xe,!1)):us(e,$e,t);else if(function(t){return es(t,"Backspace",rs)}(t))t.preventDefault(),us(e,ke,!0);else if(function(t){return es(t,"Delete",rs)}(t))t.preventDefault(),us(e,ke,!1);else if(function(t){return o&&es(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),us(e,Oe,!0);else if(function(t){return o&&(es(t,"Delete",{metaKey:!0})||es(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),us(e,Oe,!1);else if(function(t){return es(t,"b",ns)}(t))t.preventDefault(),us(e,Ee,"bold");else if(function(t){return es(t,"u",ns)}(t))t.preventDefault(),us(e,Ee,"underline");else if(function(t){return es(t,"i",ns)}(t))t.preventDefault(),us(e,Ee,"italic");else if(function(t){return es(t,"Tab",{shiftKey:"any"})}(t))us(e,We,t);else if(function(t){return es(t,"z",ns)}(t))t.preventDefault(),us(e,be,void 0);else if(function(t){if(o)return es(t,"z",{metaKey:!0,shiftKey:!0});return es(t,"y",{ctrlKey:!0})||es(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),us(e,Me,void 0);else{const n=e._editorState._selection;!function(t){return es(t,"a",ns)}(t)?null===n||$r(n)||(!function(t){return es(t,"c",ns)}(t)?function(t){return es(t,"x",ns)}(t)&&(t.preventDefault(),us(e,Qe,t)):(t.preventDefault(),us(e,Xe,t))):(t.preventDefault(),us(e,Ze,t)&&Pn())}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(ln,t),!0}function $n(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const Wn=new Map;function Un(t){const e=bs(t.target);if(null===e)return;const n=Ni(e.anchorNode);if(null===n)return;xn&&(xn=!1,Uo(n,()=>{const r=io(),o=e.anchorNode;if(Ms(o)||Ei(o)){Yi(ro(r,e,n,t))}}));const r=Ji(n),o=r[r.length-1],i=o._key,s=Wn.get(i),l=s||o;l!==n&&bn(e,l,!1),bn(e,n,!0),n!==o?Wn.set(i,n):s&&Wn.delete(i)}function Yn(t){t._lexicalHandled=!0}function jn(t){return!0===t._lexicalHandled}const Hn=()=>{};function Jn(e){const n=pn.get(e);if(void 0===n)return void Hn();const r=yn.get(n);if(void 0===r)return void Hn();const o=r-1;o>=0||t(164),pn.delete(e),yn.set(n,o),0===o&&n.removeEventListener("selectionchange",Un);const i=vi(e);Ti(i)?(!function(t){if(null!==t._parentEditor){const e=Ji(t),n=e[e.length-1]._key;Wn.get(n)===t&&Wn.delete(n)}else Wn.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=$n(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function Gn(t,e,n){Oo();const r=t.__key,o=t.getParent();if(null===o)return;const i=function(t){const e=oo();if(!$r(e)||!jo(t))return e;const{anchor:n,focus:r}=e,o=n.getNode(),i=r.getNode();ps(o,t)&&n.set(t.__key,0,"element");ps(i,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if($r(i)&&e){const e=i.anchor,n=i.focus;e.key===r&&(co(e,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(co(n,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else Ur(i)&&e&&t.isSelected()&&t.selectPrevious();if($r(i)&&e&&!s){const e=t.getIndexWithinParent();Di(t),so(i,o,e,-1)}else Di(t);n||Cs(o)||o.canBeEmpty()||!o.isEmpty()||Gn(o,e),e&&i&&qo(o)&&o.isEmpty()&&o.selectEnd()}const Vn=Symbol.for("ephemeral");function qn(t){return t[Vn]||!1}const Xn={configurable:!0,enumerable:!1,value:void 0,writable:!0};class Qn{__type;__key;__parent;__prev;__next;__state;[St];static getType(){const{ownNodeType:e}=Xs(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))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Xn),Object.defineProperty(this,St,Xn),wi(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=Ri(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||oo();if(null==e)return!1;const n=e.getNodes().some(t=>t.__key===this.__key);if(wr(this))return n;if($r(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(Go(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:Ri(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(Cs(n))return jo(e)||e===this&&Go(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:Ri(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:Ri(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=jo(this)?this:this.getParent(),n=jo(t)?t:t.getParent(),r=e&&n?wl(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=wl(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===bl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=wl(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=jo(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=Mo()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(qn(this))return this;const e=Ri(this.__key);return null===e&&t(113),e}getWritable(){if(qn(this))return this;Oo();const t=bo(),e=Mo(),n=t._nodeMap,r=this.__key,o=this.getLatest(),i=e._cloneNotNeeded,s=oo();if(null!==s&&s.setCachedNodes(null),i.has(r))return Ii(o),o;const l=js(o);return i.add(r),Ii(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}getDOMSlot(t){return new K(t)}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 ut(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&at(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){Gn(this,!0,t)}replace(e,n){Oo();let r=oo();null!==r&&(r=r.clone()),Ns(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=null!==u?l.getIndexWithinParent():-1;Di(l),null!==u&&$r(r)&&so(r,u,f,-1);const d=o.getPreviousSibling(),h=o.getNextSibling(),g=o.__prev,_=o.__next,p=o.__parent;if(Gn(o,!1,!0),null===d)c.__first=s;else{d.getWritable().__next=s}if(l.__prev=g,null===h)c.__last=s;else{h.getWritable().__prev=s}l.__next=_,l.__parent=p,c.__size=a;let y=0;if(n&&(jo(this)&&jo(l)||t(139),y=l.getChildrenSize(),l.splice(y,0,this.getChildren())),$r(r)){Yi(r);const t=r.anchor,e=r.focus;t.key===i&&(n&&"element"===t.type?t.set(l.__key,y+t.offset,"element"):Br(t,l)),e.key===i&&(n&&"element"===e.type?e.set(l.__key,y+e.offset,"element"):Br(e,l))}return Fi()===i&&Pi(s),l}insertAfter(t,e=!0){Oo(),Ns(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.getParent(),i=oo();let s=!1,l=!1;if(null!==o){const n=t.getIndexWithinParent();if($r(i)){const t=o.__key,e=i.anchor,r=i.focus;s="element"===e.type&&e.key===t&&e.offset===n+1,l="element"===r.type&&r.key===t&&r.offset===n+1}Di(r),e&&$r(i)&&so(i,o,n,-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&&$r(i)){const t=this.getIndexWithinParent();so(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){Oo(),Ns(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key,i=oo(),s=r.getParent(),l=null!==s?r.getIndexWithinParent():-1;Di(r),null!==s&&e&&$r(i)&&so(i,s,l,-1);const c=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),u=n.__prev,f=this.getIndexWithinParent();if(null===c)a.__first=o;else{c.getWritable().__next=o}if(a.__size++,n.__prev=o,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,e&&$r(i)){so(i,this.getParentOrThrow(),f)}return t}isParentRequired(){return!1}createParentElementNode(){return oi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Oo();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(jo(n))return n.select();if(!wr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Oo();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(jo(n))return n.select(0,0);if(!wr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}const Zn="history-merge",tr="collaboration",er="skip-scroll-into-view",nr="skip-dom-selection",rr="skip-selection-focus",or="composition-start",ir="composition-end",sr=/\s*!important\s*$/i;function lr(t){const e={};if(!t)return e;let n="",r="",o=null,i=!1,s=!1,l=!1,c=0;for(let a=0;a<t.length;a++){const u=t[a];if(i)"*"===u&&"/"===t[a+1]&&(i=!1,a++);else if(s)l?r+=u:n+=u,s=!1;else if(null===o)if("/"!==u||"*"!==t[a+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==c){if(";"===u&&0===c){const t=n.trim(),o=r.trim();""!==t&&""!==o&&(e[t]=o),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else c=Math.max(0,c-1),l?r+=u:n+=u;else c++,l?r+=u:n+=u;else o=u,l?r+=u:n+=u;else i=!0,a++;else l?r+=u:n+=u,"\\"===u?s=!0:u===o&&(o=null)}const a=n.trim(),u=r.trim();return""!==a&&""!==u&&(e[a]=u),e}function cr(t,e,n){const r=sr.test(n)?"important":"",o=""===r?n:n.replace(sr,"").trim();t.setProperty(e,o,r)}function ar(t,e,n=""){if(e===n)return;const r=lr(n),o=lr(e);for(const e in o)delete r[e],cr(t,e,o[e]);for(const e in r)t.removeProperty(e)}class ur extends Qn{static getType(){return"linebreak"}static clone(t){return new ur(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&&Fs(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&gr(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&gr(n))return!0}}return!1}(t)||function(t){const e=t.parentElement;if(null!==e&&Fs(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&gr(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&gr(r))return!0}return!1}(t)?null:{conversion:fr,priority:0}}}static importJSON(t){return dr().updateFromJSON(t)}}function fr(t){return{node:dr()}}function dr(){return Ts(new ur)}function hr(t){return t instanceof ur}function gr(t){return Ei(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function _r(t,e){return 16&e?"code":e&p?"mark":32&e?"sub":64&e?"sup":null}function pr(t,e){return 1&e?"strong":2&e?"em":"span"}function yr(t,e,n,r,o){const i=r.classList;let s=is(o,"base");void 0!==s&&i.add(...s),s=is(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 A){const r=A[t];if(s=is(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 mr(t,e,n){const r=n.isComposing(),o=t+(r?N:""),s=Ls(),l=Ks(s).$getDOMSlot(n,e,s),c=l.getFirstChild();if(null===c||c.nodeType!==Node.TEXT_NODE)return void l.insertChild(document.createTextNode(o));const a=c,u=a.nodeValue;if(u!==o)if(r||i){const[t,e,n]=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)]}(u,o);0!==e&&a.deleteData(t,e),a.insertData(t,n)}else a.nodeValue=o}function xr(t,e,n,r,o,i){mr(o,t,e);const s=i.theme.text;void 0!==s&&yr(0,0,r,t,s)}function Cr(t,e){const n=document.createElement(e);return n.appendChild(t),n}class Sr extends Qn{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new Sr(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===Fi()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=A[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Ai(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=_r(0,n),o=pr(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));xr(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&ar(s.style,c),s}updateDOM(e,n,r){const o=this.__text,i=e.__format,s=this.__format,l=_r(0,i),c=_r(0,s),a=pr(0,i),u=pr(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 xr(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)),mr(o,f,this);const d=r.theme.text;void 0!==d&&i!==s&&yr(0,i,s,f,d);const h=e.__style,g=this.__style;return h!==g&&ar(n.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Or,priority:0}),b:()=>({conversion:Nr,priority:0}),code:()=>({conversion:Mr,priority:0}),em:()=>({conversion:Mr,priority:0}),i:()=>({conversion:Mr,priority:0}),mark:()=>({conversion:Mr,priority:0}),s:()=>({conversion:Mr,priority:0}),span:()=>({conversion:Tr,priority:0}),strong:()=>({conversion:Mr,priority:0}),sub:()=>({conversion:Mr,priority:0}),sup:()=>({conversion:Mr,priority:0}),u:()=>({conversion:Mr,priority:0})}}static importJSON(t){return Ar().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 Ms(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=Cr(n,"b")),this.hasFormat("italic")&&(n=Cr(n,"i")),this.hasFormat("strikethrough")&&(n=Cr(n,"s")),this.hasFormat("underline")&&(n=Cr(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?A[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?w[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Ai(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=P[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){Oo();let n=t,r=e;const o=oo(),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(!$r(o))return to(s,n,s,r,"text","text");{const t=Fi();t!==o.anchor.key&&t!==o.focus.key||Pi(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=oo();if(r&&$r(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){Oo();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,o=Fi(),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=oo();if($r(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=Ar(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=_t(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=Ar(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=_t(e,n);const i=n.__key;o===r&&Pi(i),x.push(n)}const C=p?p.offset:null,S=y?y.offset:null;let T=0;for(const t of x){if(!p&&!y)break;const e=T+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=T&&(p.set(t.getKey(),C-T,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=T){y.set(t.getKey(),S-T,"text");break}T=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&Ii(e);null!==n&&Ii(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),$r(m)&&so(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;Fi()===o&&Pi(r);const l=oo();if($r(l)){const t=l.anchor,i=l.focus;null!==t&&t.key===o&&ao(t,n,r,e,s),null!==i&&i.key===o&&ao(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 Tr(t){return{forChild:Dr(t.style),node:null}}function Nr(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Dr(e.style,n?void 0:"bold"),node:null}}const vr=new WeakMap;function kr(t){if(!Ms(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Or(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=vr.get(n))&&!kr(n);)r.push(n),n=n.parentNode;const o=void 0===e?n:e;for(let t=0;t<r.length;t++)vr.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(dr()):"\t"===n?e.push(Pr()):""!==n&&e.push(Ar(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=Er(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=Er(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:Ar(r)}}function Er(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,Ms(n)){const t=n.style.display;if(""===t&&!Is(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(Ei(n))return n;if("BR"===n.nodeName)return null}}const br={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Mr(t){const e=br[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Dr(t.style,e),node:null}}function Ar(t=""){return Ts(new Sr(t))}function wr(t){return t instanceof Sr}function Dr(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=>wr(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 Ir extends Sr{static getType(){return"tab"}static clone(t){return new Ir(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=is(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Pr().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 Pr(){return Ts(new Ir)}function Fr(t){return t instanceof Ir}class Rr{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 El($l(Dl(this,"next")),$l(Dl(t,"next")))<0}getNode(){const e=Ri(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,ko()||(Fi()===i&&Pi(t),null!==o&&(o.setCachedNodes(null),$r(o)&&(o._cachedIsBackward=null),o.dirty=!0)))}}function Lr(t,e,n){return new Rr(t,e,n)}function Kr(t,e){let n=e.__key,r=t.offset,o="element";if(wr(e)){o="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!jo(e)){const t=e.getNextSibling();if(wr(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 Br(t,e){if(jo(e)){const n=e.getLastDescendant();jo(n)||wr(n)?Kr(t,n):Kr(t,e)}else Kr(t,e)}class zr{_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(!Ur(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 zr(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(wr(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=Ri(t);null!==e&&n.push(e)}return ko()||(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((oo()||io())===this&&t[0]){const e=gl(t[0],"next");Pl(kl(e,e))}for(const e of t)e.remove()}}function $r(t){return t instanceof Wr}class Wr{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!$r(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(ul(n)){const{origin:t}=n;0===e.length?o.add(t):(i.add(t),e.push(t))}else{const{origin:t}=n;jo(t)&&i.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(al(t.focus)&&jo(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=ml(t.focus.origin,"previous");ul(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=Cl(n))o.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!jo(t)||i.has(t)||t.isEmpty()||o.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=$l(t.anchor),r=$l(t.anchor.getFlipped()),o=t=>cl(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}(Yl(Rl(this),"next"));return ko()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){return this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text"),this}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]=jr(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(jo(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,wr(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!Go(f)&&!hr(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=Mo(),n=e.getEditorState()._selection,r=Qr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[o,i,s]=r;this.anchor.set(o.key,o.offset,o.type,!0),this.focus.set(i.key,i.offset,i.type,!0),s&&(this.dirty=!0),xt(this)}clone(){const t=this.anchor,e=this.focus;return new Wr(Lr(t.key,t.offset,t.type),Lr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Ai(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=A[t];return 0!==(this.format&e)}insertRawText(t){this.insertNodes(_o(t))}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=Ar();if(s.setFormat(n),s.setStyle(r),ii(i))i.splice(0,0,[s]);else{const t=qo(o)?oi().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&&Il(l,$l(Dl(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];wr(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&&(Oi(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(wr(t)&&t.canInsertTextBefore()&&!Oi(t)||(t=Ar(),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&&(Oi(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(wr(t)&&!Oi(t)||(t=Ar(),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=Ar(d.getTextContent());t.setFormat(o),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||jo(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Xr(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(ki(d)){const t=Ar(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===o&&n===i){if(Fr(d)){const t=Ar(e);return t.setFormat(o),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=Ar(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,this._cachedNodes=null,this._cachedIsBackward=null))}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&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=jo(d)?d:d.getParentOrThrow();let r=jo(_)?_:_.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(wr(_)&&!ki(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=Ar(_.getTextContent());_.replace(t),_=t}qo(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)||jo(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(ki(d))if(c===h)d.select();else{const t=Ar(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=oo()===this;Fl(this,zl(Rl(this))),t&&oo()!==this&&Yi(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Pi(null);const n=this.getNodes(),r=[];for(const t of n)wr(t)&&r.push(t);const o=e=>{n.forEach(n=>{if(jo(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}})},i=r.length;if(0===i)return this.toggleFormat(t),Pi(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(Oi(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||Oi(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Oi(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=oo();return $r(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Qs(n,Rs),o=e[e.length-1];if(jo(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=po(this);r.splice(t,0,e),o.selectEnd()}return}if(!e.some(t=>(jo(t)||Go(t))&&!t.isInline())){jo(r)||t(211,n.constructor.name,n.getType());const i=po(this);return r.splice(i,0,e),void o.selectEnd()}const i=function(t){const e=oi();let n=null;for(let r=0;r<t.length;r++){const o=t[r],i=hr(o);if(i||Go(o)&&o.isInline()||jo(o)&&o.isInline()||wr(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=!jo(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;jo(f=u)&&Rs(f)&&!f.isEmpty()&&jo(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(jo(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=Qs(s,Rs);c&&jo(d)&&(c.canMergeWhenEmpty()||Rs(a))&&(d.append(...c.getChildren()),c.remove()),jo(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=jo(r)?r.getLastChild():null;hr(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=oi();return Wi().splice(this.anchor.offset,0,[t]),t.select(),t}const e=po(this),n=Qs(this.anchor.getNode(),Rs);jo(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=dr();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]=jr(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(wr(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(wr(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),wr(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(mo(this,t,e,n))return;const r="move"===t,o=Mo(),i=Es(ms(o));if(!i)return;const s=o._blockCursorElement,l=o._rootElement,c=this.focus.getNode();if(null===l||null===s||!jo(c)||c.isInline()||c.canBeEmpty()||Os(s,o,l),this.dirty){const t=fs(o,this.anchor.key),e=fs(o,this.focus.key);let n=t,r=e;if("text"===this.anchor.type){const e=this.anchor.getNode();n=wr(e)?$s(e,t,o):null}if("text"===this.focus.type){const t=this.focus.getNode();r=wr(t)?$s(t,e,o):null}n&&r&&uo(i,n,this.anchor.offset,r,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=qo(n)?n:xs(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];ps(e,o)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];jo(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];jo(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&&mo(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&jo(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(jo(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=Nl(Dl(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(ul(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(jo(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=$l(e);Fl(this,kl(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(al(e)){if(jo(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(Go(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&jo(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=no();t.add(e.origin.getKey()),Yi(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return e.origin.isEmpty()&&!n.isEmpty()&&e.origin.getParent()===n.getParent()?void e.origin.remove(!0):(Fl(this,kl(!e.origin.isEmpty()&&n.isEmpty()?Ll(gl(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&&Hr(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 Gr(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 Gr(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!(Hi(t)||Jr(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()&&qo(t.getParent())&&null===t.getPreviousSibling()&&Hr(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.isCollapsed()?this.deleteCharacter(t):this.removeText()}isBackward(){const t=this._cachedIsBackward;if(null!==t)return t;const e=this.focus.isBefore(this.anchor);return ko()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function Ur(t){return t instanceof zr}function Yr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function jr(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]:[Yr(n),Yr(r)]}function Hr(t,e){for(let n=e;n;n=n.getParent()){if(jo(n)){if(n.collapseAtStart(t))return!0;if(Cs(n))break}if(n.getPreviousSibling())break}return!1}const Jr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return()=>!1})();function Gr(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 Vr(e,n,r,o){let i,s=n,l=!1;if(Ms(e)){let c=!1;const a=e.childNodes,u=a.length,f=o._blockCursorElement;s===u&&u>0&&(c=!0,s=u-1),void 0!==Ki(e,o)||e===o.getRootElement()||xi(e)||(l=!0);let d=a[s],h=!1;if(d===f)d=a[s+1],h=!0;else if(null!==f){const t=f.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,f)&&s--}}if(i=ji(d),wr(i))s=pl(i,c?"next":"previous");else{let a=ji(e);if(null===a)return null;if(jo(a)){const l=o.getElementByKey(a.getKey());null===l&&t(214);const u=Bs(a,l,o);[a,s]=u.resolveChildIndex(a,l,e,n),jo(a)||t(215),c&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let f=a.getChildAtIndex(s);if(jo(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=c?f.getLastDescendant():f.getFirstDescendant();null===t?a=f:(f=t,a=jo(f)?f:f.getParentOrThrow()),s=0}wr(f)?(i=f,a=null,s=pl(f,c?"next":"previous")):f!==a&&c&&!h&&(jo(a)||t(216),s=Math.min(a.getChildrenSize(),s+1))}else{const t=a.getIndexWithinParent(),r=o.getElementByKey(a.getKey());let i="after";if(null!==r&&ji(e)===a){const t=Bs(a,r,o);t.element!==r?i=t.resolveLeafPosition(r,e,n):0===n&&Go(a)&&(i="before")}s="before"===i?t:t+1,a=a.getParentOrThrow()}if(jo(a))return[Lr(a.__key,s,"element"),l]}}else i=ji(e);return wr(i)?[Lr(i.__key,pl(i,s,"clamp"),"text"),l]:null}function qr(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&&jo(i)&&i.isInline()){const e=i.getPreviousSibling();wr(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else jo(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):wr(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===o.getTextContent().length){const r=o.getNextSibling(),i=o.getParent();if(e&&jo(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&jo(i)&&i.isInline()&&!i.canInsertTextAfter()){const e=i.getNextSibling();wr(e)&&t.set(e.__key,0,"text")}}}function Xr(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);qr(t,n,r),qr(e,!n,r),r&&e.set(t.key,t.offset,t.type)}}function Qr(t,e,n,r,o,i){if(null===t||null===n||!Si(o,t,n))return null;const s=Vr(t,e,$r(i)?i.anchor:null,o);if(null===s)return null;const l=Vr(n,r,$r(i)?i.focus:null,o);if(null===l)return null;const[c,a]=s,[u,f]=l;if("element"===c.type&&"element"===u.type){const e=ji(t),r=ji(n);if(Go(e)&&Go(r))return null}return Xr(c,u),[c,u,a||f]}function Zr(t){return jo(t)&&!t.isInline()}function to(t,e,n,r,o,i){const s=bo(),l=new Wr(Lr(t,e,o),Lr(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function eo(){const t=Lr("root",0,"element"),e=Lr("root",0,"element");return new Wr(t,e,0,"")}function no(){return new zr(new Set)}function ro(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=!V&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&i&&3===i.detail||"drop"===s||void 0===s);let a,u,f,d;if($r(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)&&$r(t)&&!Si(n,a,u))return t.clone();const h=Qr(a,f,u,d,n,t);if(null===h)return null;const[g,_,p]=h;let y=0,m="";if($r(t)){const e=t.anchor;if(g.key===e.key)y=t.format,m=t.style;else{const t=g.getNode();wr(t)?(y=t.getFormat(),m=t.getStyle()):jo(t)&&(y=t.getTextFormat(),m=t.getTextStyle())}}const x=new Wr(g,_,y,m);return p&&(x.dirty=!0),x}function oo(){return bo()._selection}function io(){return Mo()._editorState._selection}function so(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"),lo(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")}}lo(t)}function lo(t){const e=t.anchor,n=e.offset,r=t.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!jo(i))return;const t=i.getChildrenSize(),o=n>=t,s=o?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(wr(s)){let t=0;o&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}return}if(jo(i)){const t=i.getChildrenSize(),r=n>=t,o=r?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(wr(o)){let t=0;r&&(t=o.getTextContentSize()),e.set(o.__key,t,"text")}}if(jo(s)){const t=s.getChildrenSize(),e=o>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(o);if(wr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}function co(t,e,n,r,o){let i=null,s=0,l=null;null!==r?(i=r.__key,wr(r)?(s=r.getTextContentSize(),l="text"):jo(r)&&(s=r.getChildrenSize(),l="element")):null!==o&&(i=o.__key,wr(o)?l="text":jo(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 ao(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 uo(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch(t){}}function fo(t,e,n){const r=fs(t,e.getKey());if(jo(e)){const o=Bs(e,r,t);return[o.element,n+o.getFirstChildOffset()]}return[r,n]}function ho(t,e,n,r,o,s){const l=document.activeElement;if(o.has(tr)&&l!==s||null!==l&&Ci(l))return;if(!$r(e))return void(null!==t&&Si(n,r.anchorNode,r.focusNode)&&r.removeAllRanges());const c=e.anchor,a=e.focus,u=c.getNode(),f=a.getNode(),[d,h]=fo(n,u,c.offset),[g,_]=fo(n,f,a.offset),p=e.format,y=e.style,m=e.isCollapsed();let x=d,C=g,S=!1;var T,N,v,k,O;if(("text"===c.type?(x=wr(u)?$s(u,d,n):null,S=u.getFormat()!==p||u.getStyle()!==y):$r(t)&&"text"===t.anchor.type&&(S=!0),"text"===a.type&&(C=wr(f)?$s(f,g,n):null),null!==x&&null!==C)&&(m&&(null===t||S||$r(t)&&(t.format!==p||t.style!==y))&&(T=p,N=y,v=h,k=c.key,O=performance.now(),kn=[T,N,v,k,O]),"Range"===r.type&&m||r.anchorOffset!==h||r.focusOffset!==_||r.anchorNode!==x||r.focusNode!==C||(null!==l&&s.contains(l)||o.has(rr)||s.focus({preventScroll:!0}),"element"===c.type))){if(uo(r,x,h,C,_),!i||!e.isCollapsed()||null===s||o.has(rr)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!o.has(er)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=$r(e)&&"element"===e.anchor.type?x.childNodes[h]||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=hs(n),o=ys(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){const e=o.visualViewport;if(e){const t=e.offsetTop;l=t,c=t+e.height}else l=0,c=ms(t).innerHeight;const n=o.getComputedStyle(r.documentElement),i=parseFloat(n.scrollPaddingTop),s=parseFloat(n.scrollPaddingBottom);isFinite(i)&&(l+=i),isFinite(s)&&(c-=s)}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=ds(a)}}(n,e,s)}}mn=!0}}function go(t,e){for(const n of t.split(/(\r?\n|\t)/))"\n"===n||"\r\n"===n?e.linebreak():"\t"===n?e.tab():""!==n&&e.text(n)}function _o(t){const e=[];return go(t,{linebreak:()=>e.push(dr()),tab:()=>e.push(Pr()),text:t=>e.push(Ar(t))}),e}function po(e){let n=e;e.isCollapsed()||n.removeText();const r=oo();$r(r)&&(n=r),$r(n)||t(161);const o=n.anchor;let i=o.getNode(),s=o.offset;for(;!Rs(i);){const t=i;if([i,s]=yo(i,s),t.is(i))break}return s}function yo(t,e){const n=t.getParent();if(!n){const t=oi();return Wi().append(t),t.select(),[Wi(),0]}if(wr(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(!jo(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new Wr(Lr(t.__key,e,"element"),Lr(t.__key,e,"element"),0,""),o=t.insertNewAfter(n);o&&o.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function mo(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=Dl(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!Wl(c)){for(const t of c){a=!1;const{origin:e}=t;if(!Go(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of Nl(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(ul(t))t.origin.isInline()||(c=t);else{if(jo(t.origin))continue;Go(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===i)return!1;if(l&&!s&&Go(c.origin)&&c.origin.isKeyboardSelectable()){const t=no();return t.add(c.origin.getKey()),Yi(t),!0}return c=$l(c),l&&Il(t.anchor,c),Il(t.focus,c),a||!s}let xo=null,Co=null,So=!1,To=!1,No=0;const vo={characterData:!0,childList:!0,subtree:!0};function ko(){return So||null!==xo&&xo._readOnly}function Oo(){So&&t(13)}function Eo(){No>99&&t(14)}function bo(){return null===xo&&t(195,Ao()),xo}function Mo(){return null===Co&&t(337,Ao()),Co}function Ao(){let t=0;const e=new Set,n=di.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=vi(r);if(Ti(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 wo(){return Co}function Do(t,e,n){const r=e.__type,o=pi(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 Io(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Po(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 Fo(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(jo(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=Fo(l[t],n);s.append(e)}return s}function Ro(t,e,n){const r=xo,o=So,i=Co;xo=e,So=!0,Co=t;try{return n()}finally{xo=r,So=o,Co=i}}function Lo(e,n){const r=e._pendingEditorState,o=e._rootElement,i=e._headless||null===o;if(null===r)return void(e._deferred.length>0&&zo(e,e._deferred));const s=e._editorState,l=s._selection,c=r._selection,a=0!==e._dirtyType,u=xo,f=So,d=Co,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!i&&a&&null!==g){Co=e,xo=r,So=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,o=e._dirtyLeaves;g.disconnect(),_=ae(s,r,e,t,n,o)}catch(t){if(t instanceof Error&&e._onError(t),To)throw t;return li(e,null,o,r),ot(e),e._dirtyType=2,To=!0,Lo(e,s),void(To=!1)}finally{g.observe(o,vo),e._updating=h,xo=u,So=f,Co=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,C=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._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=zi(t)),delete r[i])}(e,r);const S=i?null:Es(ms(e));if(e._editable&&null!==S&&(a||null===c||c.dirty||!c.is(l))&&null!==o&&!x.has(nr)){Co=e,xo=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&Os(t,e,o),ho(l,c,e,S,x,o)}!function(t,e,n){let r=t._blockCursorElement;if($r(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()){ks(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&ks(e)){const n=e.getPreviousSibling();(null===n||ks(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=Bs(i,t.getElementByKey(i.__key),t).element;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=Gl(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&&Os(r,t,e)}(e,o,c)}finally{null!==g&&g.observe(o,vo),Co=d,xo=u}}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})}}}(e,_,x,p,s),$r(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(de,void 0);const T=e._pendingDecorators;null!==T&&(e._decorators=T,e._pendingDecorators=null,Ko("decorator",e,!0,T)),function(t,e,n){const r=$i(e),o=$i(n);r!==o&&Ko("textcontent",t,!0,o)}(e,n||s,r),Ko("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,mutatedNodes:_,normalizedNodes:m,prevEditorState:n||s,tags:x}),zo(e,C),function(e){const n=e._updates;if(0===n.length)return void(e._cascadeCount=0);if(e._cascadeCount++>99){e._updates=[],e._cascadeCount=0;try{t(343)}catch(t){t instanceof Error&&e._onError(t)}return}const r=n.shift();if(r){const[t,n]=r;Wo(e,t,n)}}(e)}function Ko(t,e,n,...r){const o=e._updating;e._updating=n;try{const n=e._listeners[t],o=Array.from(n);for(const[t,e]of o){e&&e();const o=t(...r);n.has(t)?n.set(t,o):o&&o()}}finally{e._updating=o}}function Bo(t,e,n,r){const o=Ji(t);let i;for(let t=4;t>=0;t--)for(let s=0;s<o.length;s++){const l=o[s];if(s>0&&l._updating){i=l;break}const c=l._commands.get(e);if(void 0!==c){const e=c[t];if(e.size>0){let t=!1;if(Uo(l,()=>{for(const o of e)if(o(n,r))return void(t=!0)}),t)return t}}}return i&&i.update(()=>{Bo(i,e,n,r)}),!1}function zo(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}}}function $o(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),Po(e,i.tag)),null==s?Wo(e,r,i):r()}}return o}function Wo(e,n,r){const o=e._updateTags;let i,s=!1,l=!1;void 0!==r&&(i=r.onUpdate,Po(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=Xo(a||c),u=!0),a._flushSync=l;const f=xo,d=So,h=Co,g=e._updating;xo=a,So=!1,e._updating=!0,Co=e;const _=e._headless||null===e.getRootElement();gi(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Es(ms(t));return $r(n)||null==n?ro(n,r,t,e):n.clone()}(e,r&&r.event||null));const o=e._compositionKey;n(),s=$o(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if($r(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);wr(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&mt(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=Fi(),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);wr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&mt(r),void 0!==r&&Io(r,i)&&Do(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){No++;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&&Io(c,i)&&Do(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,No++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),$o(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()||(jo(e)&&G(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($r(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 Ur(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 Lo(e)}finally{xo=f,So=d,Co=h,e._updating=g,No=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,Lo(e)):u&&mi(()=>{Lo(e)}):(a._flushSync=!1,u&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Uo(t,e,n){Co===t&&void 0===n?e():Wo(t,e,n)}class Yo extends Qn{__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=Mo()._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(wr(e)&&t.push(e),jo(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;jo(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;jo(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 jo(t)&&t.getLastDescendant()||t||null}const r=e[t];return jo(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Ri(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Ri(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(),jo(o)&&r!==n-1&&!o.isInline()&&(t+=v)}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(),jo(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=D[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=A[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return Ai(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Oo();const n=oo();let r=t,o=e;const i=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(wr(t)||jo(t))return t.select(0,0)}else if(!(void 0!==t&&t!==i||void 0!==e&&e!==i)){const t=this.getLastChild();if(wr(t)||jo(t))return t.select()}void 0===r&&(r=i),void 0===o&&(o=i);const s=this.__key;return $r(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,o,"element"),n.dirty=!0,n):to(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&&D[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){qn(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;Di(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--,Di(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=oo();if($r(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:o}=t;Ho(r,e,n)&&co(r,r.getNode(),this,u,a),Ho(o,e,n)&&co(o,o.getNode(),this,u,a),0!==f||this.canBeEmpty()||Cs(this)||this.remove()}}return i}getDOMSlot(t){return new z(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ms(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px",e.setAttribute("data-lexical-indent",String(t)));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||Cs(this)||this.getChildren().some(wr)||(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=Bs(this,t,e);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 jo(t){return t instanceof Yo}function Ho(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 Jo extends Qn{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Go(t){return t instanceof Jo}class Vo extends Yo{__cachedText;static getType(){return"root"}static clone(){return new Vo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return null===t||!ko()&&0!==Mo()._dirtyType?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)jo(e)||Go(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return Wi().updateFromJSON(t)}collapseAtStart(){return!0}}function qo(t){return t instanceof Vo}function Xo(t){return new ti(H(t._nodeMap))}function Qo(){return new ti(new Map([["root",new Vo]]))}function Zo(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),jo(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=Zo(i[t]);o.push(e)}}return n}class ti{_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 Ro(e&&e.editor||null,this,t)}clone(t){const e=new ti(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return Ro(null,this,()=>({root:Zo(Wi())}))}}class ei extends Yo{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class ni extends Yo{static getType(){return"paragraph"}static clone(t){return new ni(t.__key)}createDOM(t){const e=document.createElement("p"),n=is(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:ri,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ms(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return oi().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(wr);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=oi();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||wr(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 ri(t){const e=oi();if(Gs(e,t),Hs(t,e),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in D&&e.setFormat(n)}return Js(e,t),{node:e}}function oi(){return Ts(new ni)}function ii(t){return t instanceof ni}const si=0;function li(t,e,n,r,o){const i=t._keyToDOMMap;i.clear(),t._editorState=Qo(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function ci(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=Xs(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 Qn&&t!==Qn?t:void 0}}return e}const ai={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=yi(e,t.getType());return n&&void 0!==n.exportDOM?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,o)=>jo(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$shouldExclude:(t,e,n)=>jo(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function ui(t,e){const n=t.get(e);t.delete(e),n&&n()}function fi(t,e,n){return t.set(e,n),ui.bind(null,t,e)}class di{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_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 J,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},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=Gi(),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){return fi(this._listeners.update,t)}registerEditableListener(t){return fi(this._listeners.editable,t)}registerDecoratorListener(t){return fi(this._listeners.decorator,t)}registerTextContentListener(t){return fi(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return Vl(fi(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0)}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){void 0===r&&t(35);const o=this._commands;o.has(e)||o.set(e,[new Y,new Y,new Y,new Y,new Y]);const i=o.get(e);void 0===i&&t(36,String(e));const s=function(t){return 7&t}(r),l=i[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.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=Ys(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=Ys(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=Ri(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:Zn}: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 us(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=is(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,li(this,e,t,r,{preserveUpdateQueue:!0}),null!==e&&(this._config.disableEvents||Jn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=ys(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,ot(this),this._updateTags.add(Zn),Lo(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;pn.set(t,n);const r=yn.get(n)??0;r<1&&n.addEventListener("selectionchange",Un),yn.set(n,r+1),t.__lexicalEditor=e;const o=$n(t);for(let n=0;n<an.length;n++){const[r,i]=an[n],s="function"==typeof i?t=>{jn(t)||(Yn(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(jn(t))return;Yn(t);const n=e.isEditable();switch(r){case"cut":return n&&us(e,Qe,t);case"copy":return us(e,Xe,t);case"paste":return n&&us(e,Ne,t);case"dragstart":return n&&us(e,Ge,t);case"dragover":return n&&us(e,Ve,t);case"dragend":return n&&us(e,qe,t);case"focus":return n&&us(e,on,t);case"blur":return n&&us(e,sn,t);case"drop":return n&&us(e,He,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(Zn),Lo(this);Ko("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=Xo(e),r._selection=e._selection?e._selection.clone():null),rt(this);const o=this._pendingEditorState,i=this._updateTags,s=void 0!==n?n.tag:null;null===o||o.isEmpty()||(null!=s&&i.add(s),Lo(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Lo(this)}parseEditorState(t,e){return function(t,e,n){const r=Qo(),o=xo,i=So,s=Co,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,xo=r,So=!1,Co=e,gi(null);try{const o=e._nodes;Fo(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,xo=o,So=i,Co=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return Lo(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):Wo(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Uo(this,()=>{const r=oo(),o=Wi();null!==r?r.dirty||Yi(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),gs("focus"),_s(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Es(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ko("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}di.version=U;let hi=null;function gi(t){hi=t}let _i=1;function pi(e,n){const r=yi(e,n);return void 0===r&&t(30,n),r}function yi(t,e){return t._nodes.get(e)}const mi="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function xi(t){return Go(Bi(t))}function Ci(t){const e=document.activeElement;if(!Ms(e))return!1;const n=e.nodeName;return Go(Bi(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==vi(e))}function Si(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Ci(e)&&Ni(e)===t}catch(t){return!1}}function Ti(t){return t instanceof di}function Ni(t){let e=t;for(;null!=e;){const t=vi(e);if(Ti(t))return t;e=ds(e)}return null}function vi(t){return t?t.__lexicalEditor:null}function ki(t){return Fr(t)||t.isToken()}function Oi(t){return ki(t)||t.isSegmented()}function Ei(t){return As(t)&&3===t.nodeType}function bi(t){return As(t)&&9===t.nodeType}function Mi(t){let e=t;for(;null!=e;){if(Ei(e))return e;e=e.firstChild}return null}function Ai(t,e,n){const r=A[e];if(null!==n&&(t&r)===(n&r))return t;let o=t^r;return"subscript"===e?o&=~A.superscript:"superscript"===e?o&=~A.subscript:"lowercase"===e?(o&=~A.uppercase,o&=~A.capitalize):"uppercase"===e?(o&=~A.lowercase,o&=~A.capitalize):"capitalize"===e&&(o&=~A.lowercase,o&=~A.uppercase),o}function wi(t,e){const n=function(){const t=hi;return hi=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Oo(),Eo();const r=Mo(),o=bo(),i=""+_i++;o._nodeMap.set(i,t),jo(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),0===r._dirtyType&&(r._dirtyType=1),t.__key=i}function Di(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 Ii(e){Eo(),qn(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,o=bo(),i=Mo(),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;0===i._dirtyType&&(i._dirtyType=1),jo(e)?l.set(c,!0):i._dirtyLeaves.add(c)}function Pi(t){Oo();const e=Mo(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Ri(n);null!==t&&t.getWritable()}if(null!==t){const e=Ri(t);null!==e&&e.getWritable()}}}function Fi(){if(ko())return null;return Mo()._compositionKey}function Ri(t,e){const n=(e||bo())._nodeMap.get(t);return void 0===n?null:n}function Li(t,e){const n=Ki(t,Mo());return void 0!==n?Ri(n,e):null}function Ki(t,e){return t[`__lexicalKey_${e._key}`]}function Bi(t,e){let n=t;for(;null!=n;){const t=Li(n,e);if(null!==t)return t;n=ds(n)}return null}function zi(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function $i(t){return t.read(()=>Wi().getTextContent())}function Wi(){return Ui(bo())}function Ui(t){return t._nodeMap.get("root")}function Yi(t){Oo();const e=bo();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function ji(t){const e=Mo(),n=function(t,e){let n=t;for(;null!=n;){const t=Ki(n,e);if(void 0!==t)return t;n=ds(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Ri("root"):null}return Ri(n)}function Hi(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Ji(t){const e=[];for(let n=t;null!==n;n=n._parentEditor)e.push(n);return e}function Gi(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Vi(t){return Ei(t)?t.nodeValue:null}function qi(t,e,n){const r=Es(ms(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=Vi(o);const r=Bi(o);if(null!==e&&wr(r)){if((e===N||e===k)&&n){const t=n.length;e=n,i=t,s=t}null!==e&&Xi(r,e,i,s,t)}}}function Xi(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let c=e;if((s||o)&&(e.endsWith(N)&&(c=e.slice(0,-N.length)),o)){const t=k;let e;for(;-1!==(e=c.indexOf(t));)c=c.slice(0,e)+c.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length))}const u=i.getTextContent();if(o||c!==u){if(""===c){if(Pi(null),a||l||d)i.remove();else{const t=Mo();setTimeout(()=>{t.update(()=>{i.isAttached()&&i.remove()})},20)}return}const e=i.getParent(),o=io(),u=i.getTextContentSize(),f=Fi(),h=i.getKey();if(i.isToken()||null!==f&&h===f&&!s||$r(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=oo();if(!$r(g)||null===n||null===r)return void Qi(i,c,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=Ar(i.getTextContent());i.replace(t),i=t}Qi(i,c,g)}}}function Qi(t,e,n){if(t.setTextContent(e),$r(n)){const e=t.getKey();let r=!1;for(const o of["anchor","focus"]){const i=n[o];"text"===i.type&&i.key===e&&(i.offset=pl(t,i.offset,"clamp"),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Zi(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function ts(t,e){return Zi(t,e,"altKey")&&Zi(t,e,"ctrlKey")&&Zi(t,e,"shiftKey")&&Zi(t,e,"metaKey")}function es(t,e,n){if(!ts(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1)return!1;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const ns={ctrlKey:!o,metaKey:o},rs={altKey:o,ctrlKey:!o};function os(t){return"Backspace"===t.key}function is(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=Gl(o);return n[e]=t,t}return o}function ss(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 ls(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 cs(t,e){const n=t.offset;if("element"===t.type){return ls(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?ls(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function as(t){const e=ms(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function us(t,e,n){return Bo(t,e,n,t)}function fs(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function ds(t){const e=t.assignedSlot||t.parentElement;return ws(e)?e.host:e}function hs(t){return bi(t)?t:Ms(t)?t.ownerDocument:null}function gs(t){Oo();Mo()._updateTags.add(t)}function _s(t){Oo();Mo()._deferred.push(t)}function ps(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function ys(t){const e=hs(t);return e?e.defaultView:null}function ms(e){const n=e._window;return null===n&&t(78),n}function xs(t){let e=t.getParentOrThrow();for(;null!==e;){if(Cs(e))return e;e=e.getParentOrThrow()}return e}function Cs(t){return qo(t)||jo(t)&&t.isShadowRoot()}function Ss(t,e=!1){const n=t.constructor.clone(t);return wi(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function Ts(e){const n=Mo(),r=e.getType(),o=yi(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 Ns(e,n){!qo(e.getParent())||jo(n)||Go(n)||t(99)}function vs(e){const n=Ri(e);return null===n&&t(63,e),n}function ks(t){return(Go(t)||jo(t)&&!t.canBeEmpty())&&!t.isInline()}function Os(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function Es(t){return n?(t||window).getSelection():null}function bs(t){const e=ys(t);return e?e.getSelection():null}function Ms(t){return As(t)&&1===t.nodeType}function As(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function ws(t){return As(t)&&11===t.nodeType}const Ds=/^(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;function Is(t){return!(!Ms(t)||!t.style.display.startsWith("inline"))||Ds.test(t.nodeName)}const Ps=/^(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;function Fs(t){return(!Ms(t)||!t.style.display.startsWith("inline"))&&Ps.test(t.nodeName)}function Rs(t){if(Go(t)&&!t.isInline())return!0;if(!jo(t)||Cs(t))return!1;const e=t.getFirstChild(),n=null===e||hr(e)||wr(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Ls(){return Mo()}function Ks(t=Ls()){return t._config.dom||ai}function Bs(e,n,r=Ls()){const o=Ks(r).$getDOMSlot(e,n,r);return jo(e)&&(zs(o)||t(344,e.getKey(),e.getType())),o}function zs(t){return t instanceof z}function $s(t,e,n=Ls()){return Mi(Bs(t,e,n).element)}const Ws=new WeakMap,Us=new Map;function Ys(e){if(!e._readOnly&&e.isEmpty())return Us;e._readOnly||t(192);let n=Ws.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),Ws.set(e,n)),n}function js(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Hs(t,e){const n=t.getAttribute("data-lexical-indent");if(null!==n){const t=parseInt(n,10);if(Number.isFinite(t)&&t>=0)return void e.setIndent(t)}const r=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(r/40);e.setIndent(o)}function Js(t,e){const n=e.getAttribute("dir");return"ltr"===n||"rtl"===n?t.setDirection(n):t}function Gs(t,e){const n=e.style.textAlign;return n&&n in D?t.setFormat(n):t}function Vs(t){return!0===t.__lexicalUnmanaged}function qs(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==Qn[e]}function Xs(e){const n=R in e.prototype?e.prototype[R]():void 0,r=function(e){if(!(e===Qn||e.prototype instanceof Qn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{di.version&&(r=JSON.parse(di.version))}catch(t){}t(290,e.name,n,r)}return e===Jo||e===Yo||e===Qn}(e),o=!r&&qs(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&&(qs(e,"getType")||(e.getType=()=>s),qs(e,"clone")||(e.clone=t=>(gi(t),new e)),qs(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!qs(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const Qs=(t,e)=>{let n=t;for(;null!=n&&!qo(n);){if(e(n))return n;n=n.getParent()}return null};function Zs(e,n){const r=[];let o=e.__first;for(;null!==o;){const e=null===n?Ri(o):n.get(o);null==e&&t(174),r.push(o),o=e.__next}return r}const tl={next:"previous",previous:"next"};class el{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Ol({hasNext:al,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return gl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return gl(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=gl(e,this.direction)}for(const t of l.values())t.remove();return this}}class nl extends el{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ml(t,this.direction)}getParentCaret(t="root"){return gl(il(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ol(this.direction);return gl(this.getNodeAtCaret(),t)||ml(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof nl&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const rl={root:qo,shadowRoot:Cs};function ol(t){return tl[t]}function il(t,e="root"){return rl[e](t)?null:t}class sl extends el{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:gl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return jo(this.origin)?ml(this.origin,this.direction):null}getParentCaret(t="root"){return gl(il(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ol(this.direction);return gl(this.getNodeAtCaret(),t)||ml(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof sl&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof sl||t instanceof ll)&&this.direction===t.direction&&this.origin.is(t.origin)}}class ll extends el{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:_l(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return gl(il(this.getParentAtCaret(),t),this.direction)}getFlipped(){return _l(this.origin,ol(this.direction),this.offset)}isSamePointCaret(t){return t instanceof ll&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof sl||t instanceof ll)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return gl(this.origin,this.direction)}}function cl(t){return t instanceof ll}function al(t){return t instanceof sl}function ul(t){return t instanceof nl}const fl={next:class extends ll{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ll{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},dl={next:class extends sl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends sl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},hl={next:class extends nl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends nl{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function gl(t,e){return t?new dl[e](t):null}function _l(t,e,n){return t?new fl[e](t,pl(t,n)):null}function pl(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 yl(t,e){return new Tl(t,e)}function ml(t,e){return jo(t)?new hl[e](t):null}function xl(t){return t&&t.getChildCaret()||t}function Cl(t){return t&&xl(t.getAdjacentCaret())}class Sl{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 Sl(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return cl(e)?function(t,e){const{direction:n,origin:r}=t,o=pl(r,"focus"===e?ol(n):n);return yl(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[yl(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=cl(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=cl(n),o=e=>e.isSameNodeCaret(n)?null:Cl(e)||e.getParentCaret(t);return Ol({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 Tl{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 _l(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function Nl(t){return kl(t,gl(Wi(),t.direction))}function vl(t){return kl(t,t)}function kl(e,n){return e.direction!==n.direction&&t(265),new Sl(e,n,e.direction)}function Ol(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 El(e,n){const r=wl(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 bl(r)}}function bl(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 Ml(t,e){return e.is(t)}function Al(t){return jo(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function wl(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Al(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=Al(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(Ml(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(Ml(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((jo(s)||Ml(e,s))&&(jo(i)||Ml(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function Dl(e,n){const{type:r,key:o,offset:i}=e,s=vs(e.key);return"text"===r?(wr(s)||t(266,s.getType(),o),_l(s,n,i)):(jo(s)||t(267,s.getType(),o),jl(s,e.offset,n))}function Il(e,n){const{origin:r,direction:o}=n,i="next"===o;cl(n)?e.set(r.getKey(),n.offset,"text"):al(n)?wr(r)?e.set(r.getKey(),pl(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(ul(n)&&jo(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Pl(t){const e=oo(),n=$r(e)?e:eo();return Fl(n,t),Yi(n),n}function Fl(t,e){Il(t.anchor,e.anchor),Il(t.focus,e.focus)}function Rl(t){const{anchor:e,focus:n}=t,r=Dl(e,"next"),o=Dl(n,"next"),i=El(r,o)<=0?"next":"previous";return kl(Ul(r,i),Ul(o,i))}function Ll(t){const{direction:e,origin:n}=t,r=gl(n,ol(e)).getNodeAtCaret();return r?gl(r,e):ml(n.getParentOrThrow(),e)}function Kl(t,e="root"){const n=[t];for(let r=ul(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Ll(r));return n}function Bl(t){return!!t&&t.origin.isAttached()}function zl(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=Yl(e,o),l=Kl(s.anchor,r),c=Kl(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(ul(t))a.add(t.origin.getKey());else if(al(t)){const{origin:e}=t;jo(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=Ll(gl(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=Ar(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=_l(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(Bl(t)){f=$l(t);break}for(const t of c)if(Bl(t)){d=$l(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(Cs(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Rs),f=u&&a(s,t=>n.has(t.getKey())&&Rs(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;ml(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(!0);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(!0)}}const g=[f,d,...l,...c].find(Bl);if(g){return vl(Ul($l(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function $l(t){const e=function(t){let e=t;for(;ul(e);){const t=Cl(e);if(!ul(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(wr(e.origin))return cl(e)?e:_l(e.origin,n,n);const r=e.getAdjacentCaret();return al(r)&&wr(r.origin)?_l(r.origin,n,ol(n)):e}function Wl(t){return cl(t)&&t.offset!==pl(t.origin,t.direction)}function Ul(t,e){return t.direction===e?t:t.getFlipped()}function Yl(t,e){return t.direction===e?t:kl(Ul(t.focus,e),Ul(t.anchor,e))}function jl(t,e,n){let r=ml(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Ul(r,n)}function Hl(e){const{origin:n,offset:r,direction:o}=e;if(r===pl(n,o))return e.getSiblingCaret();if(r===pl(n,ol(o)))return Ll(e.getSiblingCaret());const[i]=n.splitText(r);return wr(i)||t(281),Ul(gl(i,"next"),o)}function Jl(t,e){return!0}function Gl(...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}function Vl(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}exports.$addUpdateTag=gs,exports.$applyNodeReplacement=Ts,exports.$caretFromPoint=Dl,exports.$caretRangeFromSelection=Rl,exports.$cloneWithProperties=js,exports.$cloneWithPropertiesEphemeral=function(t){return(e=js(t))[Vn]=!0,e;var e},exports.$comparePointCaretNext=El,exports.$copyNode=Ss,exports.$create=function(t){const e=Ls();return Oo(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createChildrenArray=Zs,exports.$createLineBreakNode=dr,exports.$createNodeSelection=no,exports.$createParagraphNode=oi,exports.$createPoint=Lr,exports.$createRangeSelection=eo,exports.$createRangeSelectionFromDom=function(t,e){return ro(null,t,e,null)},exports.$createTabNode=Pr,exports.$createTextNode=Ar,exports.$extendCaretToRange=Nl,exports.$findMatchingParent=Qs,exports.$fullReconcile=function(){Mo()._dirtyType=2},exports.$generateNodesFromRawText=_o,exports.$getAdjacentChildCaret=Cl,exports.$getAdjacentNode=cs,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=Cl(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=Cl(r)}return o&&[o,n]},exports.$getCaretInDirection=Ul,exports.$getCaretRange=kl,exports.$getCaretRangeInDirection=Yl,exports.$getCharacterOffsets=jr,exports.$getChildCaret=ml,exports.$getChildCaretAtIndex=jl,exports.$getChildCaretOrSelf=xl,exports.$getCollapsedCaretRange=vl,exports.$getCommonAncestor=wl,exports.$getCommonAncestorResultBranchOrder=bl,exports.$getDOMSlot=Bs,exports.$getDOMTextNode=$s,exports.$getEditor=Ls,exports.$getEditorDOMRenderConfig=Ks,exports.$getNearestNodeFromDOMNode=Bi,exports.$getNearestRootOrShadowRoot=xs,exports.$getNodeByKey=Ri,exports.$getNodeByKeyOrThrow=vs,exports.$getNodeFromDOMNode=Li,exports.$getPreviousSelection=io,exports.$getRoot=Wi,exports.$getSelection=oo,exports.$getSiblingCaret=gl,exports.$getState=st,exports.$getStateChange=function(t,e,n){const r=st(t,n,"direct"),o=st(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=oo();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=pl,exports.$getTextPointCaret=_l,exports.$getTextPointCaretSlice=yl,exports.$getWritableNodeState=at,exports.$hasAncestor=ps,exports.$hasUpdateTag=function(t){return Mo()._updateTags.has(t)},exports.$insertNodes=function(t){let e=oo()||io();null===e&&(e=Wi().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=Zr,exports.$isChildCaret=ul,exports.$isDecoratorNode=Go,exports.$isEditorState=function(t){return t instanceof ti},exports.$isElementDOMSlot=zs,exports.$isElementNode=jo,exports.$isExtendableTextPointCaret=Wl,exports.$isInlineElementOrDecoratorNode=function(t){return jo(t)&&t.isInline()||Go(t)&&t.isInline()},exports.$isLeafNode=function(t){return wr(t)||hr(t)||Go(t)},exports.$isLexicalNode=function(t){return t instanceof Qn},exports.$isLineBreakNode=hr,exports.$isNodeCaret=function(t){return t instanceof el},exports.$isNodeSelection=Ur,exports.$isParagraphNode=ii,exports.$isRangeSelection=$r,exports.$isRootNode=qo,exports.$isRootOrShadowRoot=Cs,exports.$isSiblingCaret=al,exports.$isTabNode=Fr,exports.$isTextNode=wr,exports.$isTextPointCaret=cl,exports.$isTextPointCaretSlice=function(t){return t instanceof Tl},exports.$isTokenOrSegmented=Oi,exports.$isTokenOrTab=ki,exports.$nodesOfType=function(t){const e=t.getType(),n=bo();if(n._readOnly){const t=Ys(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=$l,exports.$normalizeSelection__EXPERIMENTAL=xt,exports.$onUpdate=_s,exports.$parseSerializedNode=function(t){return Fo(t,Mo()._nodes)},exports.$removeTextFromCaretRange=zl,exports.$rewindSiblingCaret=Ll,exports.$selectAll=function(t){const e=Wi();if($r(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"),xt(t),t}{const t=e.select(0,e.getChildrenSize());return Yi(xt(t)),t}},exports.$setCompositionKey=Pi,exports.$setDirectionFromDOM=Js,exports.$setFormatFromDOM=Gs,exports.$setPointFromCaret=Il,exports.$setSelection=Yi,exports.$setSelectionFromCaretRange=Pl,exports.$setState=function(t,e,n){let r;if(Oo(),"function"==typeof n){const o=t.getLatest(),i=st(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return at(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=Ss,$splitTextPointCaretNext:n=Hl,rootMode:r="shadowRoot",$shouldSplit:o=Jl,removeEmptyDestination:i=!1}={}){if(cl(t))return n(t);const s=t.getParentCaret(r);if(s){const{origin:n}=s;if(ul(t)){const t=Ll(s);if(i&&n.isEmpty())return n.remove(),t;if(!n.canBeEmpty()||!o(n,"first"))return t}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||!i&&n.canBeEmpty()&&o(n,"last"))&&s.insert(e(n).splice(0,0,r))}return s},exports.$splitNode=function(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Cs(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=Cs(n),s=e!==r||i?Ss(e):e;if(i)return jo(e)&&jo(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.$updateDOMSelection=ho,exports.$updateRangeSelectionFromCaretRange=Fl,exports.ArtificialNode__DO_NOT_USE=ei,exports.BEFORE_INPUT_COMMAND=_e,exports.BLUR_COMMAND=sn,exports.CAN_REDO_COMMAND=nn,exports.CAN_UNDO_COMMAND=rn,exports.CAN_USE_BEFORE_INPUT=s,exports.CAN_USE_DOM=n,exports.CLEAR_EDITOR_COMMAND=tn,exports.CLEAR_HISTORY_COMMAND=en,exports.CLICK_COMMAND=ge,exports.COLLABORATION_TAG=tr,exports.COMMAND_PRIORITY_BEFORE_CRITICAL=-4,exports.COMMAND_PRIORITY_BEFORE_EDITOR=-8,exports.COMMAND_PRIORITY_BEFORE_HIGH=-5,exports.COMMAND_PRIORITY_BEFORE_LOW=-7,exports.COMMAND_PRIORITY_BEFORE_NORMAL=-6,exports.COMMAND_PRIORITY_CRITICAL=4,exports.COMMAND_PRIORITY_EDITOR=si,exports.COMMAND_PRIORITY_HIGH=3,exports.COMMAND_PRIORITY_LOW=1,exports.COMMAND_PRIORITY_NORMAL=2,exports.COMPOSITION_END_COMMAND=me,exports.COMPOSITION_END_TAG=ir,exports.COMPOSITION_START_COMMAND=ye,exports.COMPOSITION_START_TAG=or,exports.CONTROLLED_TEXT_INSERTION_COMMAND=Te,exports.COPY_COMMAND=Xe,exports.CUT_COMMAND=Qe,exports.DEFAULT_EDITOR_DOM_CONFIG=ai,exports.DELETE_CHARACTER_COMMAND=xe,exports.DELETE_LINE_COMMAND=Oe,exports.DELETE_WORD_COMMAND=ke,exports.DRAGEND_COMMAND=qe,exports.DRAGOVER_COMMAND=Ve,exports.DRAGSTART_COMMAND=Ge,exports.DROP_COMMAND=He,exports.DecoratorNode=Jo,exports.ElementNode=Yo,exports.FOCUS_COMMAND=on,exports.FORMAT_ELEMENT_COMMAND=Je,exports.FORMAT_TEXT_COMMAND=Ee,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=Zn,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=Ye,exports.INPUT_COMMAND=pe,exports.INSERT_LINE_BREAK_COMMAND=Ce,exports.INSERT_PARAGRAPH_COMMAND=Se,exports.INSERT_TAB_COMMAND=Ue,exports.INTERNAL_$isBlock=Rs,exports.IS_ALL_FORMATTING=2047,exports.IS_ANDROID=c,exports.IS_ANDROID_CHROME=f,exports.IS_APPLE=o,exports.IS_APPLE_WEBKIT=d,exports.IS_BOLD=1,exports.IS_CHROME=u,exports.IS_CODE=16,exports.IS_FIREFOX=i,exports.IS_HIGHLIGHT=p,exports.IS_IOS=l,exports.IS_ITALIC=2,exports.IS_SAFARI=a,exports.IS_STRIKETHROUGH=4,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=8,exports.KEY_ARROW_DOWN_COMMAND=Re,exports.KEY_ARROW_LEFT_COMMAND=Ie,exports.KEY_ARROW_RIGHT_COMMAND=we,exports.KEY_ARROW_UP_COMMAND=Fe,exports.KEY_BACKSPACE_COMMAND=Be,exports.KEY_DELETE_COMMAND=$e,exports.KEY_DOWN_COMMAND=Ae,exports.KEY_ENTER_COMMAND=Le,exports.KEY_ESCAPE_COMMAND=ze,exports.KEY_MODIFIER_COMMAND=ln,exports.KEY_SPACE_COMMAND=Ke,exports.KEY_TAB_COMMAND=We,exports.LineBreakNode=ur,exports.MOVE_TO_END=De,exports.MOVE_TO_START=Pe,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=je,exports.PASTE_COMMAND=Ne,exports.PASTE_TAG="paste",exports.ParagraphNode=ni,exports.REDO_COMMAND=Me,exports.REMOVE_TEXT_COMMAND=ve,exports.RootNode=Vo,exports.SELECTION_CHANGE_COMMAND=de,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=he,exports.SELECT_ALL_COMMAND=Ze,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=nr,exports.SKIP_SCROLL_INTO_VIEW_TAG=er,exports.SKIP_SELECTION_FOCUS_TAG=rr,exports.TEXT_TYPE_TO_FORMAT=A,exports.TabNode=Ir,exports.TextNode=Sr,exports.UNDO_COMMAND=be,exports.addClassNamesToElement=function(t,...e){const n=Gl(...e);n.length>0&&t.classList.add(...n)},exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=fe,exports.createEditor=function(t){const e=t||{},n=wo(),r=e.theme||{},o=void 0===t?n:e.parentEditor||null,i=e.disableEvents||!1,s=Qo(),l=e.namespace||(null!==o?o._config.namespace:Gi()),c=e.editorState,a=[Vo,Sr,ur,Ir,ni,ei,...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}Xs(e);const o=e.getType(),i=ci(e);h.set(o,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:lt(a[t]),transforms:i})}}const g=new di(s,o,h,{disableEvents:i,dom:{...ai,...t&&t.dom},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),function(t){t.registerCommand(_e,Fn,si),t.registerCommand(pe,Rn,si),t.registerCommand(ye,Ln,si),t.registerCommand(me,Kn,si),t.registerCommand(Ae,zn,si)}(g),g},exports.createSharedNodeState=lt,exports.createState=function(t,e){return new it(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=ol,exports.getDOMOwnerDocument=hs,exports.getDOMSelection=Es,exports.getDOMSelectionFromTarget=bs,exports.getDOMTextNode=Mi,exports.getEditorPropertyFromDOMNode=vi,exports.getNearestEditorFromDOMNode=Ni,exports.getRegisteredNode=yi,exports.getRegisteredNodeOrThrow=pi,exports.getStaticNodeConfig=Xs,exports.getStyleObjectFromCSS=lr,exports.getTextDirection=function(t){return b.test(t)?"rtl":M.test(t)?"ltr":null},exports.getTransformSetFromKlass=ci,exports.isBlockDomNode=Fs,exports.isCurrentlyReadOnlyMode=ko,exports.isDOMDocumentNode=bi,exports.isDOMNode=As,exports.isDOMTextNode=Ei,exports.isDOMUnmanaged=Vs,exports.isDocumentFragment=ws,exports.isExactShortcutMatch=es,exports.isHTMLAnchorElement=function(t){return Ms(t)&&"A"===t.tagName},exports.isHTMLElement=Ms,exports.isHTMLTableCellElement=function(t){return Ms(t)&&("TD"===t.tagName||"TH"===t.tagName)},exports.isHTMLTableRowElement=function(t){return Ms(t)&&"TR"===t.tagName},exports.isInlineDomNode=Is,exports.isLexicalEditor=Ti,exports.isModifierMatch=ts,exports.isSelectionCapturedInDecoratorInput=Ci,exports.isSelectionWithinEditor=Si,exports.makeStepwiseIterator=Ol,exports.mergeRegister=Vl,exports.normalizeClassNames=Gl,exports.removeClassNamesFromElement=function(t,...e){const n=Gl(...e);n.length>0&&t.classList.remove(...n)},exports.removeFromParent=Di,exports.resetRandomKey=function(){_i=1},exports.safeCast=function(t){return t},exports.setDOMStyleFromCSS=ar,exports.setDOMStyleObject=function(t,e){for(const n in e){const r=e[n];null==r?t.removeProperty(n):cr(t,n,r)}},exports.setDOMUnmanaged=function(t){t.__lexicalUnmanaged=!0},exports.setNodeIndentFromDOM=Hs,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},exports.stopLexicalPropagation=Yn,exports.toggleTextFormatType=Ai,exports.tokenizeRawText=go;
|
|
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&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&o&&!u,h=0,g=1,_=2,p=128,y=1,m=2,x=3,C=4,S=5,T=6,N=a||l||d?"\xa0":"\u200b",v="\n\n",k=i?"\xa0":N,O="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",E="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",b=new RegExp("^[^"+E+"]*["+O+"]"),M=new RegExp("^[^"+O+"]*["+E+"]"),A={bold:1,capitalize:1024,code:16,highlight:p,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},D={directionless:1,unmergeable:2},w={center:2,end:6,justify:4,left:1,right:3,start:5},I={[m]:"center",[T]:"end",[C]:"justify",[y]:"left",[x]:"right",[S]:"start"},P={normal:0,segmented:2,token:1},F={[h]:"normal",[_]:"segmented",[g]:"token"},R="$config";function L(){return Ks()._blockCursorElement}class K{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new K(this.element,t,this.after)}withAfter(t){return new K(this.element,this.before,t)}withElement(t){return this.element===t?this:new K(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const r=B(t,this.element);if(null===r)return"after";const o=Array.prototype.indexOf.call(t.childNodes,r);if(o<0)return"after";if(e===t)return n<=o?"before":"after";const i=B(t,e);if(null===i)return"after";const s=Array.prototype.indexOf.call(t.childNodes,i);return s>=0&&s<=o?"before":"after"}getInsertionAnchor(){return this.before}}function B(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class z extends K{withBefore(t){return new z(this.element,t,this.after)}withAfter(t){return new z(this.element,this.before,t)}withElement(t){return this.element===t?this:new z(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){const t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return null!==e&&e===L()?e:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);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.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,o),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=o}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let n=0;for(let r=this.element.firstChild;null!==r&&r!==t&&r!==e;r=r.nextSibling)n++;return n}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset(),n=L(),o=this.element.childNodes,i=Math.min(r,o.length);let s=0;for(let t=e;t<i;t++)o[t]!==n&&s++;return[t,Math.min(s,t.getChildrenSize())]}const o=$(e,n);o.push(r);const i=$(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 $(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()}let W;try{W="0.45.1-dev.0+prod.cjs"}catch(t){}const U=W??"0.45.1-dev.0+source";class Y{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}const j=null;function H(t,e=1e3){return t instanceof J?t.clone():t.size<e?new Map(t):(new J).init(new Map(t),void 0,t.size)}class J{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,(new J).init(this._old,this._nursery,this._size)}init(t,e,n){return this._old=t,this._nursery=e,this._size=n,this}get size(){return this._size}has(t){return void 0!==this.get(t)}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return void 0!==e?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===j?void 0:e}shouldCompact(){return void 0!==this._nursery&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const t=new Map(this._old);for(const[e,n]of this._nursery)n!==j?t.set(e,n):t.delete(e);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const n=this.getWithTombstone(t);if(n===e)return this;const r=this.getNursery();return n!==j&&void 0!==n||(this._size++,n===j&&r.delete(t)),r.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,j),this._size--),e}getOrInsert(t,e){const n=this.get(t);return void 0!==n?n:(this.set(t,e),e)}getOrInsertComputed(t,e){const n=this.get(t);if(void 0!==n)return n;const r=e(t);return this.set(t,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(e)for(const n of e){const e=n[0],r=t?t.get(e):void 0;r!==j&&(void 0!==r&&(n[1]=r),yield n)}if(t)for(const n of t)n[1]===j||e&&e.has(n[0])||(yield n)}forEach(t,e){void 0!==e&&(t=t.bind(e));for(const[e,n]of this.entries())t(n,e,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}}function G(t,e,n,r,o,i){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(zo(s)&&G(s,t,n,r,o,i),n.has(t)||i.delete(t),o.push(t)),s=s.getNextSibling()}}let V=!1,q=0;function X(t){q=t.timeStamp}function Q(t,e,n){const r="BR"===t.nodeName,o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&void 0!==zi(t,n)}function Z(t,e,n){const r=bs(xs(n));let o=null,i=null;null!==r&&r.anchorNode===t&&(o=r.anchorOffset,i=r.focusOffset);const s=t.nodeValue;null!==s&&Qi(e,s,o,i,!1)}function tt(t,e,n){if(Rr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return bi(e)&&n.isAttached()}function et(t,e,n){for(let r=t;r&&!Xs(r);r=hs(r)){const t=zi(r,e);if(void 0!==t){const e=Li(t,n);if(e)return Uo(e)||!As(r)?void 0:[r,e]}}}function nt(t,e,n){V=!0;const r=performance.now()-q>100;try{Ko(t,()=>{const o=Zr()||function(t){return t.getEditorState().read(()=>{const t=Zr();return null!==t?t.clone():null})}(t),s=new Map,l=t._editorState,c=t._blockCursorElement;let a=!1,u="";for(let n=0;n<e.length;n++){const f=e[n],d=f.type,h=f.target,g=et(h,t,l);if(!g)continue;const[_,p]=g;if("characterData"===d)r&&Or(p)&&bi(h)&&tt(o,h,p)&&Z(h,p,t);else if("childList"===d){a=!0;const e=f.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],o=Ki(r),s=r.parentNode;if(null!=s&&r!==c&&null===o&&!Q(r,s,t)&&!Xs(r)){if(i){const t=(As(r)?r.innerText:null)||r.nodeValue;t&&(u+=t)}s.removeChild(r)}}const n=f.removedNodes,r=n.length;if(r>0){let e=0;for(let o=0;o<r;o++){const r=n[o];(Q(r,h,t)||c===r)&&(h.appendChild(r),e++)}r!==e&&s.set(_,p)}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const f=n.takeRecords();if(f.length>0){for(let e=0;e<f.length;e++){const n=f[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||Q(n,o,t)||i.removeChild(n)}}n.takeRecords()}null!==o&&(a&&ji(o),i&&us(t)&&o.insertRawText(u))})}finally{V=!1}}function rt(t){const e=t._observer;if(null!==e){nt(t,e.takeRecords(),e)}}function ot(t){!function(t){0===q&&xs(t).addEventListener("textInput",X,!0)}(t),t._observer=new MutationObserver((e,n)=>{nt(t,e,n)})}class it{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||dt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function st(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function lt(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}=tl(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 ct{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 ft(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 ct(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)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}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=ft(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 at(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new ct(e,ut(e));return e.__state=n,n}function ut(t){return t.__state?t.__state.sharedNodeState:mi(Ks(),t.getType()).sharedNodeState}function ft(t){if(t)for(const e in t)return t}function dt(t){return t}function ht(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 gt(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 _t(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function pt(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;const n=new Set;return!(t&&ht(n,t,e)||e&&ht(n,e,t)||t&>(n,t,e)||e&>(n,e,t))}(c,a))}function yt(t,e){const n=t.mergeWithSibling(e),r=vo()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function mt(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Or(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(pt(e,r)){r=yt(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Or(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(pt(r,n)){r=yt(r,n);break}break}n.remove()}}else r.remove()}function xt(t){return Ct(t.anchor),Ct(t.focus),t}function Ct(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),Or(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!zo(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const St=Symbol.for("@lexical/CachedTextSize");function Tt(e,n){return Bt.read(()=>{let r=0,o=e;for(let e=0;e<n&&null!==o;e++){const i=Kt.get(o);if(void 0===i&&t(345,o),zo(i)){const s=zt.get(o);if(void 0!==s&&zo(s)&&s.__parent!==i.__parent)r+=i.getTextContentSize();else{const e=$t.get(o),n=e&&e.__lexicalTextContent;"string"!=typeof n&&t(346,i.getType()),r+=n.length}e<n-1&&!i.isInline()&&(r+=2)}else{const e=i[St];void 0===e&&t(347,i.getType(),o),r+=e}o=i.__next}return r},{editor:Ot})}function Nt(t){zo(t)||void 0===t[St]&&(t[St]=Or(t)?t.__text.length:t.getTextContentSize())}const vt=4;let kt,Ot,Et,bt="",Mt=null,At=null,Dt=null;function wt(){return{firstTextKey:Dt,format:Mt,style:At}}function It(t){null!==t.firstTextKey&&(Mt=t.format,At=t.style,Dt=t.firstTextKey)}function Pt(e){if(null!==Dt)return;const n=e.__lexicalFirstTextKey;if(void 0===n&&t(348),null===n)return;const r=zt.get(n);Or(r)&&(Mt=r.getFormat(),At=r.getStyle(),Dt=n)}let Ft,Rt,Lt,Kt,Bt,zt,$t,Wt,Ut,Yt,jt=!1,Ht=!1;function Jt(t,e){const n=Kt.get(t),r=zt.has(t);if(null!==e){const n=ue(t);n.parentNode===e&&e.removeChild(n)}if(!r){if(Ot._keyToDOMMap.delete(t),zo(n)){const t=nl(n,Kt);Gt(t,0,t.length-1,null)}void 0!==n&&ls(Ut,Et,Ft,n,"destroyed")}}function Gt(t,e,n,r){for(let o=e;o<=n;++o){const e=t[o];void 0!==e&&Jt(e,r)}}function Vt(t,e){t.setProperty("text-align",e)}const qt="40px";function Xt(t,e){const n=kt.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)}t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * var(--lexical-indent-base-value, ${qt}))`)}function Qt(t,e){const n=t.style;0===e?Vt(n,""):1===e?Vt(n,"left"):2===e?Vt(n,"center"):3===e?Vt(n,"right"):4===e?Vt(n,"justify"):5===e?Vt(n,"start"):6===e&&Vt(n,"end")}function Zt(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(jo(t))return null;const n=t.getParentOrThrow();return Ss(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function te(e,n){const r=zt.get(e);if(void 0===r&&t(60),null!==n){const t=Kt.get(e);if(void 0!==t&&t.__parent!==r.__parent){const t=$t.get(e);if(void 0!==t)return n.insertChild(t),ie(e,n.element)}}const o=Yt.$createDOM(r,Ot);if(function(t,e,n){const r=n._keyToDOMMap;Bi(e,n,t),r.set(t,e)}(e,o,Ot),Or(r)?o.setAttribute("data-lexical-text","true"):Uo(r)&&(o.setAttribute("data-lexical-decorator","true"),qs(o,{captureSelection:!0})),zo(r)){const t=r.__indent,e=r.__size;if(Zt(o,r),0!==t&&Xt(o,t),0===e)o.__lexicalTextContent="",o.__lexicalFirstTextKey=null;else{const t=e-1;ee(nl(r,zt),r,0,t,zs(r,o,Ot))}const n=r.__format;0!==n&&Qt(o,n),r.isInline()||ne(null,r,o)}else{const t=r.getTextContent();if(Uo(r)){const t=r.decorate(Ot,kt);null!==t&&se(e,t),o.contentEditable="false"}bt+=t}return null!==n&&n.insertChild(o),Yt.$decorateDOM(r,null,o,Ot),Nt(r),ls(Ut,Et,Ft,r,"created"),o}function ee(e,n,r,o,i){const s=bt,l=wt();bt="",Mt=null,At=null,Dt=null;let c=r;for(;c<=o;++c){const t=wt();te(e[c],i);const n=zt.get(e[c]);null!==n&&Or(n)?null===Mt&&(Mt=n.getFormat(),At=n.getStyle(),Dt=n.__key):zo(n)&&c<o&&!n.isInline()&&(bt+=v),It(t)}const a=Ot._keyToDOMMap.get(n.__key);void 0===a&&t(349,n.__key),a.__lexicalTextContent=bt,a.__lexicalFirstTextKey=Dt,bt=s+bt,It(l)}function ne(t,e,n){const r=zs(e,n,Ot),o=r.element.__lexicalLastChildKind??null,i=function(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return ti(t)?"line-break":Uo(t)&&t.isInline()?"decorator":null}return"empty"}return null}(e,zt);o!==i&&r.setManagedLineBreak(i)}function re(e,n,r){var o;Mt=null,At=null,Dt=null,function(e,n,r){const o=bt,i=e.__size,s=n.__size;bt="";const l=r.element,c=Ot._keyToDOMMap.get(n.__key);void 0===c&&t(351,n.__key);const a=s-i;if(!jt&&Math.abs(a)<=1&&i>=vt&&e.__first===n.__first&&(0!==a||!Ot._cloneNotNeeded.has(e.__key))){const i=c.__lexicalTextContent,u=Wt.get(e.__key);if(!jt&&"string"==typeof i&&void 0!==u){const s=function(t,e){const n=e.size;if(0===n||n>=t.__size)return null;let r=t.__last,o=null,i=0;for(;null!==r&&i<n;){if(!e.has(r))return null;o=r;const t=zt.get(r);if(void 0===t)return null;r=t.__prev,i++}if(i!==n)return null;if(null!==r&&e.has(r))return null;return o}(n,u);if(null!==s){const f=u.size;if(0===a){const e=Tt(s,f);let r=s,a=0;for(;null!==r&&a<f;){const t=zt.get(r);if(void 0===t)break;const e=wt();ie(r,l),Or(t)&&null===Mt&&(Mt=t.getFormat(),At=t.getStyle(),Dt=t.__key),It(e),r=t.__next,a++}let d="";for(r=s,a=0;null!==r&&a<f;){const e=zt.get(r);if(void 0===e)break;let n;if(zo(e)){const o=Ot._keyToDOMMap.get(r),i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(352,e.getType()),n=i}else n=e.getTextContent();d+=n,a<f-1&&zo(e)&&!e.isInline()&&(d+=v),r=e.__next,a++}const h=i.slice(0,i.length-e)+d;return c.__lexicalTextContent=h,bt=o+h,void oe(n,c,u)}if(function(e,n,r,o,i,s,l,c){if(1!==c&&-1!==c)return!1;const a=1===c?2:1;if(l!==a)return!1;const u=l-c;let f=e.__last;for(let t=0;t<u-1;t++){if(null===f)return!1;const t=Kt.get(f);if(void 0===t)return!1;f=t.__prev}if(null===f)return!1;const d=zt.get(s),h=Kt.get(f);if(void 0===d||void 0===h)return!1;if(d.__prev!==h.__prev)return!1;const g=[];let _=s;for(let t=0;t<l;t++){if(null===_)return!1;g.push(_);const t=zt.get(_);_=t?t.__next:null}const p=[];_=f;for(let t=0;t<u;t++){if(null===_)return!1;p.push(_);const t=Kt.get(_);_=t?t.__next:null}const y=new Set(p),m=new Set(g),x=[];let C=0,S=0;for(;C<u&&S<l;)if(g[S]===p[C])x.push({key:g[S],kind:"reconcile"}),C++,S++;else if(m.has(p[C])){if(y.has(g[S]))return!1;x.push({key:g[S],kind:"create",nextIndex:S}),S++}else x.push({key:p[C],kind:"destroy"}),C++;for(;C<u;)x.push({key:p[C++],kind:"destroy"});for(;S<l;)x.push({key:g[S],kind:"create",nextIndex:S}),S++;const T=Tt(f,u);for(const t of x){const e=wt();if("reconcile"===t.kind)ie(t.key,r.element);else if("destroy"===t.kind)Jt(t.key,r.element);else{let e=null;for(let n=t.nextIndex+1;n<l;n++){const t=Ot._keyToDOMMap.get(g[n]);if(void 0!==t){e=t;break}}te(t.key,r.withBefore(e??r.before))}if("destroy"!==t.kind){const e=zt.get(t.key);e&&Or(e)&&null===Mt&&(Mt=e.getFormat(),At=e.getStyle(),Dt=e.__key)}It(e)}let N="";for(let e=0;e<l;e++){const n=zt.get(g[e]);if(void 0===n)return!1;let r;if(zo(n)){const o=Ot._keyToDOMMap.get(g[e]),i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(350,n.getType()),r=i}else r=n.getTextContent();N+=r,e<l-1&&zo(n)&&!n.isInline()&&(N+=v)}const k=i.slice(0,i.length-T)+N;return o.__lexicalTextContent=k,!0}(e,0,r,c,i,s,f,a)){const e=c.__lexicalTextContent;return"string"!=typeof e&&t(353),bt=o+e,void oe(n,c,u)}}}if(0===a){let n=e.__first,r=0;for(;null!==n;){const e=zt.get(n);if(void 0===e)break;const o=jt||Lt.has(n)||Rt.has(n),i=wt();if(o)ie(n,l);else{let r,o;if(zo(e)){o=$t.get(n);const i=o&&o.__lexicalTextContent;"string"!=typeof i&&t(354,e.getType()),r=i}else r=e.getTextContent();bt+=r,void 0!==o&&Pt(o)}Or(e)?null===Mt&&(Mt=e.getFormat(),At=e.getStyle(),Dt=e.__key):zo(e)&&r<s-1&&!e.isInline()&&(bt+=v),It(i),n=e.__next,r++}return c.__lexicalTextContent=bt,c.__lexicalFirstTextKey=Dt,void(bt=o+bt)}}if(1===i&&1===s){const t=e.__first,o=n.__first;if(t===o)ie(t,l);else{const e=ue(t),n=te(o,null);try{e.parentNode===l?l.replaceChild(n,e):r.insertChild(n)}catch(r){if("object"==typeof r&&null!=r){const i=`${r.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${o}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(i)}throw r}Jt(t,null)}const i=zt.get(o);Or(i)&&null===Mt&&(Mt=i.getFormat(),At=i.getStyle(),Dt=i.__key)}else{const o=nl(e,Kt),c=nl(n,zt);if(o.length!==i&&t(227),c.length!==s&&t(228),0===i)0!==s&&ee(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;Gt(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],o=wt();if(t===r)u=le(ie(r,i.element)),f++,d++;else{if(void 0===a&&(a=ce(n,d)),void 0===c)c=ce(e,f);else if(!c.has(t)){f++,It(o);continue}if(!a.has(t)){u=le(ue(t)),Jt(t,i.element),f++,c.delete(t),It(o);continue}if(c.has(r)){const t=ds(Ot,r);t!==u&&i.withBefore(u??i.before).insertChild(t),u=le(ie(r,i.element)),f++,d++}else te(r,i.withBefore(u??i.before)),d++}const s=zt.get(r);null!==s&&Or(s)?null===Mt&&(Mt=s.getFormat(),At=s.getStyle(),Dt=s.__key):zo(s)&&d<=l&&!s.isInline()&&(bt+=v),It(o)}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Ot.getElementByKey(e);ee(n,t,d,l,i.withBefore(r??i.before))}else g&&!h&&Gt(e,f,s,i.element)}(n,o,c,i,s,r)}c.__lexicalTextContent=bt,c.__lexicalFirstTextKey=Dt,bt=o+bt}(e,n,zs(n,r,Ot)),Ss(n)||(o=n,null==Mt||Mt===o.__textFormat||Ht||o.setTextFormat(Mt),function(t){null==At||At===t.__textStyle||Ht||t.setTextStyle(At)}(n))}function oe(t,e,n){const r=e.__lexicalFirstTextKey;if(null!=r){const e=t.__key;let o=r;for(;null!==o;){const t=zt.get(o);if(void 0===t){o=null;break}if(t.__parent===e)break;o=t.__parent}if(null!==o&&!n.has(o)){const t=zt.get(r);if(Or(t))return Mt=t.getFormat(),void(At=t.getStyle())}}e.__lexicalFirstTextKey=Dt}function ie(e,n){const r=Kt.get(e);let o=zt.get(e);void 0!==r&&void 0!==o||t(61);const i=jt||Lt.has(e)||Rt.has(e),s=ds(Ot,e);if(r===o&&!i){let e;if(zo(r)){const n=s.__lexicalTextContent;"string"!=typeof n&&t(355,r.getType()),e=n,Pt(s)}else e=r.getTextContent();return bt+=e,s}if(r!==o&&i&&ls(Ut,Et,Ft,o,"updated"),Yt.$updateDOM(o,r,s,Ot)){const r=te(e,null);return null===n&&t(62),n.replaceChild(r,s),Jt(e,null),r}if(zo(r)){zo(o)||t(334,e);const n=o.__indent;(jt||n!==r.__indent)&&Xt(s,n);const l=o.__format;if((jt||l!==r.__format)&&Qt(s,l),i)re(r,o,s),jo(o)||o.isInline()||ne(0,o,s);else{const e=s.__lexicalTextContent;"string"!=typeof e&&t(356,r.getType()),bt+=e,Pt(s)}if((jt||o.__dir!==r.__dir||o.__parent!==r.__parent)&&(Zt(s,o),jo(o)&&!jt))for(const t of o.getChildren())if(zo(t)){Zt(ds(Ot,t.getKey()),t)}}else{const t=o.getTextContent();if(Uo(o)){const t=o.decorate(Ot,kt);null!==t&&se(e,t)}bt+=t}if(!Ht&&jo(o)){const t=o.getLatest();if(t.__cachedText!==bt){const e=t.getWritable();e.__cachedText=bt,o=e}}return Yt.$decorateDOM(o,r,s,Ot),Nt(o),s}function se(t,e){let n=Ot._pendingDecorators;const r=Ot._decorators;if(null===n){if(r[t]===e)return;n=Wi(Ot)}n[t]=e}function le(t){let e=t.nextSibling;return null!==e&&e===Ot._blockCursorElement&&(e=e.nextSibling),e}function ce(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function ae(t,e,n,r,o,i){bt="",Mt=null,At=null,Dt=null,jt=2===r,Ot=n,kt=n._config,Yt=n._config.dom||fi,Et=n._nodes,Ft=Ot._listeners.mutation,Rt=o,Lt=i,Kt=t._nodeMap,Bt=t,zt=e._nodeMap,Ht=e._readOnly,$t=H(n._keyToDOMMap),Wt=function(){const t=new Map,e=e=>{for(const n of e){const e=zt.get(n);if(void 0===e)continue;const r=e.__parent;if(null===r)continue;let o=t.get(r);void 0===o&&(o=new Set,t.set(r,o)),o.add(n)}};return e(Rt.keys()),e(Lt),t}();const s=new Map;return Ut=s,ie("root",null),Ot=void 0,Et=void 0,Rt=void 0,Lt=void 0,Kt=void 0,Bt=void 0,zt=void 0,kt=void 0,$t=void 0,Wt=void 0,Ut=void 0,Yt=fi,s}function ue(e){const n=$t.get(e);return void 0===n&&t(75,e),n}function fe(t){return{type:t}}const de=fe("SELECTION_CHANGE_COMMAND"),he=fe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ge=fe("CLICK_COMMAND"),_e=fe("BEFORE_INPUT_COMMAND"),pe=fe("INPUT_COMMAND"),ye=fe("COMPOSITION_START_COMMAND"),me=fe("COMPOSITION_END_COMMAND"),xe=fe("DELETE_CHARACTER_COMMAND"),Ce=fe("INSERT_LINE_BREAK_COMMAND"),Se=fe("INSERT_PARAGRAPH_COMMAND"),Te=fe("CONTROLLED_TEXT_INSERTION_COMMAND"),Ne=fe("PASTE_COMMAND"),ve=fe("REMOVE_TEXT_COMMAND"),ke=fe("DELETE_WORD_COMMAND"),Oe=fe("DELETE_LINE_COMMAND"),Ee=fe("FORMAT_TEXT_COMMAND"),be=fe("UNDO_COMMAND"),Me=fe("REDO_COMMAND"),Ae=fe("KEYDOWN_COMMAND"),De=fe("KEY_ARROW_RIGHT_COMMAND"),we=fe("MOVE_TO_END"),Ie=fe("KEY_ARROW_LEFT_COMMAND"),Pe=fe("MOVE_TO_START"),Fe=fe("KEY_ARROW_UP_COMMAND"),Re=fe("KEY_ARROW_DOWN_COMMAND"),Le=fe("KEY_ENTER_COMMAND"),Ke=fe("KEY_SPACE_COMMAND"),Be=fe("KEY_BACKSPACE_COMMAND"),ze=fe("KEY_ESCAPE_COMMAND"),$e=fe("KEY_DELETE_COMMAND"),We=fe("KEY_TAB_COMMAND"),Ue=fe("INSERT_TAB_COMMAND"),Ye=fe("INDENT_CONTENT_COMMAND"),je=fe("OUTDENT_CONTENT_COMMAND"),He=fe("DROP_COMMAND"),Je=fe("FORMAT_ELEMENT_COMMAND"),Ge=fe("DRAGSTART_COMMAND"),Ve=fe("DRAGOVER_COMMAND"),qe=fe("DRAGEND_COMMAND"),Xe=fe("COPY_COMMAND"),Qe=fe("CUT_COMMAND"),Ze=fe("SELECT_ALL_COMMAND"),tn=fe("CLEAR_EDITOR_COMMAND"),en=fe("CLEAR_HISTORY_COMMAND"),nn=fe("CAN_REDO_COMMAND"),rn=fe("CAN_UNDO_COMMAND"),on=fe("FOCUS_COMMAND"),sn=fe("BLUR_COMMAND"),ln=fe("KEY_MODIFIER_COMMAND"),cn=Object.freeze({}),an=[["keydown",function(t,e){un=t.timeStamp,fn=t.key,"Backspace"!==t.key&&In();if(e.isComposing())return;fs(e,Ae,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ds(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Ko(e,()=>{Qs(n,e)||(xn=!0)})}],["compositionstart",function(t,e){fs(e,ye,t)}],["compositionend",function(t,e){i?Sn=!0:l||!a&&!d?fs(e,me,t):(Tn=!0,Nn=t.data)}],["input",function(t,e){t.stopPropagation(),In(),Ko(e,()=>{e.dispatchCommand(pe,t)},{event:t}),hn=null}],["click",function(t,e){Ko(e,()=>{const n=Zr(),r=bs(xs(e)),o=to();if(r)if(Rr(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!jo(e)&&1===Yi().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==o&&n.is(o)&&(r.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(As(n)||bi(n)){ji(Qr(o,r,e,t))}}fs(e,ge,t)})}],["cut",cn],["copy",cn],["dragstart",cn],["dragover",cn],["dragend",cn],["paste",cn],["focus",cn],["blur",cn],["drop",cn]];s&&an.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||i&&us(e))return;if("insertCompositionText"===n)return;fs(e,_e,t)}(t,e)]);let un=0,fn=null,dn=0,hn=null,gn=!1,_n=null;const pn=new WeakMap,yn=new WeakMap;let mn=!1,xn=!1,Cn=!1,Sn=!1,Tn=!1,Nn="",vn=null,kn=[0,"",0,"root",0];function On(t,e,n,r,o){const i=t.anchor,l=t.focus,c=i.getNode(),a=vo(),u=bs(xs(a)),f=null!==u?u.anchorNode:null,d=i.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Or(c)||(!o&&(!s||dn<r+50)||c.isDirty()&&g<2||Ji(n))&&i.offset!==l.offset&&!c.isComposing()||Ei(c)||c.isDirty()&&g>1||(o||!s)&&null!==h&&!c.isComposing()&&f!==Ws(c,h,a)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(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=Oi(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||function(t){const e=t.getPreviousSibling();return(Or(e)||zo(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}(t,c)}function En(t,e){return bi(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function bn(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;mn&&(mn=!1,En(o,i)&&En(s,l)&&!vn)||Ko(n,()=>{if(!r)return void ji(null);if(!Ti(n,o,s))return;let c=Zr();if(vn&&Rr(c)&&c.isCollapsed()){const t=c.anchor,e=vn.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=vn.clone(),ji(c))}if(vn=null,Rr(c)){const r=c.anchor,o=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=xs(n).event,s=i?i.timeStamp:performance.now(),[l,a,u,f,d]=kn,h=Yi(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)Mn(c,l,a);else if("text"===r.type)Or(o)||t(141),An(c,o);else if("element"===r.type&&!g){zo(o)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();Mn(t,n,r)}(c,e):Mn(c,c.format,"")}}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(Or(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}}fs(n,de,void 0)})}function Mn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function An(t,e){Mn(t,e.getFormat(),e.getStyle())}function Dn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function wn(t){if(null==t||t.length<=1||null==fn)return;const e=1===fn.length?fn:"Enter"===fn?"\n":"Tab"===fn?"\t":null;if(!e)return;const n=Zr();if(!Rr(n)||!n.isCollapsed())return;const r=n.anchor.getNode();if(!Or(r))return;const{offset:o}=n.anchor;if(r.getTextContentSize()===o){const t=r.getNextSibling();if("\n"===e){if(ti(t))t.selectEnd();else if(!t){const t=el(r,Gr),e=t&&t.getNextSibling();zo(e)&&e.selectStart()}}else"\t"===e?Ar(t)&&t.selectEnd():Or(t)&&t.getTextContent()[0]===e&&t.select(1,1)}else r.getTextContent()[o]===e&&r.select(o+1,o+1)}function In(){gn=!1,null!==_n&&(clearTimeout(_n),_n=null)}function Pn(){In(),gn=!0,_n=setTimeout(In,0)}function Fn(e){const n=e.inputType,r=Dn(e),o=vo(),i=Zr();if("insertText"===n&&e.data&&gn){if(In(),e.preventDefault(),Rr(i)&&!i.isCollapsed()){const t=i.isBackward()?i.anchor:i.focus;i.anchor.set(t.key,t.offset,t.type),i.focus.set(t.key,t.offset,t.type)}return!0}if("deleteContentBackward"===n){if(null===i){const t=to();if(!Rr(t))return!0;ji(t.clone())}if(Rr(i)){const n=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===fn&&s<un+30&&o.isComposing()&&n){if(Fi(null),un=0,setTimeout(()=>{Ko(o,()=>{Fi(null)})},30),Rr(i)){const e=i.anchor.getNode();e.markDirty(),Or(e)||t(142),An(i,e)}}else{if(Fi(null),l&&null!==r&&!r.collapsed&&(i.applyDOMRange(r),!i.isCollapsed()))return e.preventDefault(),i.removeText(),!0;e.preventDefault();const t=i.anchor.getNode(),s=t.getTextContent(),c=t.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===s.length;let u=f&&n&&!a&&c;if(u&&i.isCollapsed()&&(u=!Uo(as(i.anchor,!0))),!u){fs(o,xe,!0);const t=Zr();f&&Rr(t)&&t.isCollapsed()&&(vn=t,setTimeout(()=>vn=null))}}return!0}}var s;if(!Rr(i))return!0;const c=e.data;null!==hn&&Xi(!1,o,hn),i.dirty&&null===hn||!i.isCollapsed()||jo(i.anchor.getNode())||null===r||i.applyDOMRange(r),hn=null;const a=i.anchor,u=i.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===c)e.preventDefault(),fs(o,Ce,!1);else if(c===v)e.preventDefault(),fs(o,Se,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=c&&On(i,r,c,e.timeStamp,!0)?(e.preventDefault(),fs(o,Te,c),wn(c)):hn=c;return dn=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":fs(o,Te,e);wn((e.dataTransfer?e.dataTransfer.getData("text/plain"):null)??e.data);break;case"insertFromComposition":Fi(null),fs(o,Te,e);break;case"insertLineBreak":Fi(null),fs(o,Ce,!1);break;case"insertParagraph":Fi(null),Cn&&!l?(Cn=!1,fs(o,Ce,!1)):fs(o,Se,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":fs(o,Ne,e);break;case"deleteByComposition":(function(t,e){return t!==e||zo(t)||zo(e)||!Oi(t)||!Oi(e)})(d,h)&&fs(o,ve,e);break;case"deleteByDrag":_s(rr),fs(o,ve,e);break;case"deleteByCut":fs(o,ve,e);break;case"deleteContent":fs(o,xe,!1);break;case"deleteWordBackward":fs(o,ke,!0);break;case"deleteWordForward":fs(o,ke,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":fs(o,Oe,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":fs(o,Oe,!1);break;case"formatStrikeThrough":fs(o,Ee,"strikethrough");break;case"formatBold":fs(o,Ee,"bold");break;case"formatItalic":fs(o,Ee,"italic");break;case"formatUnderline":fs(o,Ee,"underline");break;case"historyUndo":fs(o,be,void 0);break;case"historyRedo":fs(o,Me,void 0)}return!0}function Rn(t){const e=vo();if(As(t.target)&&Qs(t.target,e))return!0;const n=Zr(),r=t.data,o=Dn(t);if(null!=r&&Rr(n)&&On(n,o,r,t.timeStamp,!1)){Sn&&(Bn(e,r),Sn=!1);const o=n.anchor.getNode(),l=bs(xs(e));if(null===l)return!0;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Or(o)&&null!==l.anchorNode&&o.getTextContent().slice(0,a)+r+o.getTextContent().slice(a+u)===qi(l.anchorNode)||fs(e,Te,r);const d=r.length;i&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d,n._cachedNodes=null,n._cachedIsBackward=null),f&&e.isComposing()&&(un=0,Fi(null))}else{Xi(!1,e,null!==r?r:void 0),Sn&&(Bn(e,r||void 0),Sn=!1)}return function(){So();const t=vo();rt(t)}(),!0}function Ln(t){const e=vo(),n=Zr();if(Rr(n)&&!e.isComposing()){const r=n.anchor,o=n.anchor.getNode();Fi(r.key),_s(or),(t.timeStamp<un+30||"element"===r.type||!n.isCollapsed()||o.getFormat()!==n.format||Or(o)&&o.getStyle()!==n.style)&&fs(e,Te,k)}return!0}function Kn(t){return Bn(vo(),t.data),_s(ir),!0}function Bn(t,e){const n=t._compositionKey;if(Fi(null),null!==n&&null!=e){if(""===e){const e=Li(n),r=t.getElementByKey(n),o=null!==r&&Or(e)?Ws(e,r,t):null;if(null!==o&&null!==o.nodeValue&&Or(e)){const n=bs(xs(t));let r=null,i=null;null!==n&&n.anchorNode===o&&(r=n.anchorOffset,i=n.focusOffset),Qi(e,o.nodeValue,r,i,!0)}return}if("\n"===e[e.length-1]){const e=Zr();if(Rr(e)||Kr(e)){if(Rr(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type)}return void fs(t,Le,null)}}}Xi(!0,t,e)}function zn(t){const e=vo();if(null==t.key)return!0;if(Tn){if(is(t))return Ko(e,()=>{Bn(e,Nn)}),Tn=!1,Nn="",!0;Tn=!1,Nn=""}if(function(t){return ns(t,"ArrowRight",{shiftKey:"any"})}(t))fs(e,De,t);else if(function(t){return ns(t,"ArrowRight",{...rs,shiftKey:"any"})}(t))fs(e,we,t);else if(function(t){return ns(t,"ArrowLeft",{shiftKey:"any"})}(t))fs(e,Ie,t);else if(function(t){return ns(t,"ArrowLeft",{...rs,shiftKey:"any"})}(t))fs(e,Pe,t);else if(function(t){return ns(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))fs(e,Fe,t);else if(function(t){return ns(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))fs(e,Re,t);else if(function(t){return ns(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Cn=!0,fs(e,Le,t);else if(function(t){return" "===t.key}(t))fs(e,Ke,t);else if(function(t){return o&&ns(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),Cn=!0,fs(e,Ce,!0);else if(function(t){return ns(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Cn=!1,fs(e,Le,t);else if(function(t){return ns(t,"Backspace",{shiftKey:"any"})||o&&ns(t,"h",{ctrlKey:!0})}(t))is(t)?fs(e,Be,t)&&Pn():(t.preventDefault(),fs(e,xe,!0));else if(function(t){return"Escape"===t.key}(t))fs(e,ze,t);else if(function(t){return ns(t,"Delete",{})||o&&ns(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),fs(e,xe,!1)):fs(e,$e,t);else if(function(t){return ns(t,"Backspace",os)}(t))t.preventDefault(),fs(e,ke,!0);else if(function(t){return ns(t,"Delete",os)}(t))t.preventDefault(),fs(e,ke,!1);else if(function(t){return o&&ns(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),fs(e,Oe,!0);else if(function(t){return o&&(ns(t,"Delete",{metaKey:!0})||ns(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),fs(e,Oe,!1);else if(function(t){return ns(t,"b",rs)}(t))t.preventDefault(),fs(e,Ee,"bold");else if(function(t){return ns(t,"u",rs)}(t))t.preventDefault(),fs(e,Ee,"underline");else if(function(t){return ns(t,"i",rs)}(t))t.preventDefault(),fs(e,Ee,"italic");else if(function(t){return ns(t,"Tab",{shiftKey:"any"})}(t))fs(e,We,t);else if(function(t){return ns(t,"z",rs)}(t))t.preventDefault(),fs(e,be,void 0);else if(function(t){if(o)return ns(t,"z",{metaKey:!0,shiftKey:!0});return ns(t,"y",{ctrlKey:!0})||ns(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),fs(e,Me,void 0);else{const n=e._editorState._selection;!function(t){return ns(t,"a",rs)}(t)?null===n||Rr(n)||(!function(t){return ns(t,"c",rs)}(t)?function(t){return ns(t,"x",rs)}(t)&&(t.preventDefault(),fs(e,Qe,t)):(t.preventDefault(),fs(e,Xe,t))):(t.preventDefault(),fs(e,Ze,t)&&Pn())}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(ln,t),!0}function $n(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const Wn=new Map;function Un(t){const e=Ms(t.target);if(null===e)return;const n=vi(e.anchorNode);if(null===n)return;xn&&(xn=!1,Ko(n,()=>{const r=to(),o=e.anchorNode;if(As(o)||bi(o)){ji(Qr(r,e,n,t))}}));const r=Gi(n),o=r[r.length-1],i=o._key,s=Wn.get(i),l=s||o;l!==n&&bn(e,l,!1),bn(e,n,!0),n!==o?Wn.set(i,n):s&&Wn.delete(i)}function Yn(t){t._lexicalHandled=!0}function jn(t){return!0===t._lexicalHandled}const Hn=()=>{};function Jn(e){const n=pn.get(e);if(void 0===n)return void Hn();const r=yn.get(n);if(void 0===r)return void Hn();const o=r-1;o>=0||t(164),pn.delete(e),yn.set(n,o),0===o&&n.removeEventListener("selectionchange",Un);const i=ki(e);Ni(i)?(!function(t){if(null!==t._parentEditor){const e=Gi(t),n=e[e.length-1]._key;Wn.get(n)===t&&Wn.delete(n)}else Wn.delete(t._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=$n(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function Gn(t,e,n){So();const r=t.__key,o=t.getParent();if(null===o)return;const i=function(t){const e=Zr();if(!Rr(e)||!zo(t))return e;const{anchor:n,focus:r}=e,o=n.getNode(),i=r.getNode();ys(o,t)&&n.set(t.__key,0,"element");ys(i,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if(Rr(i)&&e){const e=i.anchor,n=i.focus;e.key===r&&(ro(e,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(ro(n,t,o,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else Kr(i)&&e&&t.isSelected()&&t.selectPrevious();if(Rr(i)&&e&&!s){const e=t.getIndexWithinParent();Ii(t),eo(i,o,e,-1)}else Ii(t);n||Ss(o)||o.canBeEmpty()||!o.isEmpty()||Gn(o,e),e&&i&&jo(o)&&o.isEmpty()&&o.selectEnd()}const Vn=Symbol.for("ephemeral");function qn(t){return t[Vn]||!1}const Xn={configurable:!0,enumerable:!1,value:void 0,writable:!0};class Qn{__type;__key;__parent;__prev;__next;__state;[St];static getType(){const{ownNodeType:e}=tl(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))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Xn),Object.defineProperty(this,St,Xn),wi(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=Li(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||Zr();if(null==e)return!1;const n=e.getNodes().some(t=>t.__key===this.__key);if(Or(this))return n;if(Rr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(Uo(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:Li(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(Ss(n))return zo(e)||e===this&&Uo(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:Li(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:Li(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=zo(this)?this:this.getParent(),n=zo(t)?t:t.getParent(),r=e&&n?Pl(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Pl(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Dl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Pl(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=zo(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=vo()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(qn(this))return this;const e=Li(this.__key);return null===e&&t(113),e}getWritable(){if(qn(this))return this;So();const t=No(),e=vo(),n=t._nodeMap,r=this.__key,o=this.getLatest(),i=e._cloneNotNeeded,s=Zr();if(null!==s&&s.setCachedNodes(null),i.has(r))return Pi(o),o;const l=Hs(o);return i.add(r),Pi(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}getDOMSlot(t){return new K(t)}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 ut(n).flatKeys)t in e&&(void 0!==o&&o!==r||(o={...r}),o[t]=e[t]);return(n.__state||o)&&at(t).updateFromJSON(o),n}(this,t)}static transform(){return null}remove(t){Gn(this,!0,t)}replace(e,n){So();let r=Zr();null!==r&&(r=r.clone()),vs(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=null!==u?l.getIndexWithinParent():-1;Ii(l),null!==u&&Rr(r)&&eo(r,u,f,-1);const d=o.getPreviousSibling(),h=o.getNextSibling(),g=o.__prev,_=o.__next,p=o.__parent;if(Gn(o,!1,!0),null===d)c.__first=s;else{d.getWritable().__next=s}if(l.__prev=g,null===h)c.__last=s;else{h.getWritable().__prev=s}l.__next=_,l.__parent=p,c.__size=a;let y=0;if(n&&(zo(this)&&zo(l)||t(139),y=l.getChildrenSize(),l.splice(y,0,this.getChildren())),Rr(r)){ji(r);const t=r.anchor,e=r.focus;t.key===i&&(n&&"element"===t.type?t.set(l.__key,y+t.offset,"element"):Pr(t,l)),e.key===i&&(n&&"element"===e.type?e.set(l.__key,y+e.offset,"element"):Pr(e,l))}return Ri()===i&&Fi(s),l}insertAfter(t,e=!0){So(),vs(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.getParent(),i=Zr();let s=!1,l=!1;if(null!==o){const n=t.getIndexWithinParent();if(Rr(i)){const t=o.__key,e=i.anchor,r=i.focus;s="element"===e.type&&e.key===t&&e.offset===n+1,l="element"===r.type&&r.key===t&&r.offset===n+1}Ii(r),e&&Rr(i)&&eo(i,o,n,-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&&Rr(i)){const t=this.getIndexWithinParent();eo(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){So(),vs(this,t);const n=this.getWritable(),r=t.getWritable(),o=r.__key,i=Zr(),s=r.getParent(),l=null!==s?r.getIndexWithinParent():-1;Ii(r),null!==s&&e&&Rr(i)&&eo(i,s,l,-1);const c=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),u=n.__prev,f=this.getIndexWithinParent();if(null===c)a.__first=o;else{c.getWritable().__next=o}if(a.__size++,n.__prev=o,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,e&&Rr(i)){eo(i,this.getParentOrThrow(),f)}return t}isParentRequired(){return!1}createParentElementNode(){return si()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){So();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(zo(n))return n.select();if(!Or(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){So();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(zo(n))return n.select(0,0);if(!Or(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}const Zn="history-merge",tr="collaboration",er="skip-scroll-into-view",nr="skip-dom-selection",rr="skip-selection-focus",or="composition-start",ir="composition-end",sr=/\s*!important\s*$/i;function lr(t){const e={};if(!t)return e;let n="",r="",o=null,i=!1,s=!1,l=!1,c=0;for(let a=0;a<t.length;a++){const u=t[a];if(i)"*"===u&&"/"===t[a+1]&&(i=!1,a++);else if(s)l?r+=u:n+=u,s=!1;else if(null===o)if("/"!==u||"*"!==t[a+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==c){if(";"===u&&0===c){const t=n.trim(),o=r.trim();""!==t&&""!==o&&(e[t]=o),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else c=Math.max(0,c-1),l?r+=u:n+=u;else c++,l?r+=u:n+=u;else o=u,l?r+=u:n+=u;else i=!0,a++;else l?r+=u:n+=u,"\\"===u?s=!0:u===o&&(o=null)}const a=n.trim(),u=r.trim();return""!==a&&""!==u&&(e[a]=u),e}function cr(t,e,n){const r=sr.test(n)?"important":"",o=""===r?n:n.replace(sr,"").trim();t.setProperty(e,o,r)}function ar(t,e,n=""){if(e===n)return;const r=lr(n),o=lr(e);for(const e in o)delete r[e],cr(t,e,o[e]);for(const e in r)t.removeProperty(e)}function ur(t,e){return 16&e?"code":e&p?"mark":32&e?"sub":64&e?"sup":null}function fr(t,e){return 1&e?"strong":2&e?"em":"span"}function dr(t,e,n,r,o){const i=r.classList;let s=ss(o,"base");void 0!==s&&i.add(...s),s=ss(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 A){const r=A[t];if(s=ss(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 hr(t,e,n){const r=n.isComposing(),o=t+(r?N:""),s=Ks(),l=Bs(s).$getDOMSlot(n,e,s),c=l.getFirstChild();if(null===c||c.nodeType!==Node.TEXT_NODE)return void l.insertChild(document.createTextNode(o));const a=c,u=a.nodeValue;if(u!==o)if(r||i){const[t,e,n]=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)]}(u,o);0!==e&&a.deleteData(t,e),a.insertData(t,n)}else a.nodeValue=o}function gr(t,e,n,r,o,i){hr(o,t,e);const s=i.theme.text;void 0!==s&&dr(0,0,r,t,s)}function _r(t,e){const n=document.createElement(e);return n.appendChild(t),n}class pr extends Qn{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new pr(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===Ri()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=A[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Di(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=ur(0,n),o=fr(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));gr(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&ar(s.style,c),s}updateDOM(e,n,r){const o=this.__text,i=e.__format,s=this.__format,l=ur(0,i),c=ur(0,s),a=fr(0,i),u=fr(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 gr(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)),hr(o,f,this);const d=r.theme.text;void 0!==d&&i!==s&&dr(0,i,s,f,d);const h=e.__style,g=this.__style;return h!==g&&ar(n.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Sr,priority:0}),b:()=>({conversion:mr,priority:0}),code:()=>({conversion:vr,priority:0}),em:()=>({conversion:vr,priority:0}),i:()=>({conversion:vr,priority:0}),mark:()=>({conversion:vr,priority:0}),s:()=>({conversion:vr,priority:0}),span:()=>({conversion:yr,priority:0}),strong:()=>({conversion:vr,priority:0}),sub:()=>({conversion:vr,priority:0}),sup:()=>({conversion:vr,priority:0}),u:()=>({conversion:vr,priority:0})}}static importJSON(t){return kr().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 As(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=_r(n,"b")),this.hasFormat("italic")&&(n=_r(n,"i")),this.hasFormat("strikethrough")&&(n=_r(n,"s")),this.hasFormat("underline")&&(n=_r(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?A[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=Di(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=P[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){So();let n=t,r=e;const o=Zr(),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(!Rr(o))return Vr(s,n,s,r,"text","text");{const t=Ri();t!==o.anchor.key&&t!==o.focus.key||Fi(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=Zr();if(r&&Rr(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){So();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,o=Ri(),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=Zr();if(Rr(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=kr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=_t(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=kr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=_t(e,n);const i=n.__key;o===r&&Fi(i),x.push(n)}const C=p?p.offset:null,S=y?y.offset:null;let T=0;for(const t of x){if(!p&&!y)break;const e=T+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=T&&(p.set(t.getKey(),C-T,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=T){y.set(t.getKey(),S-T,"text");break}T=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&Pi(e);null!==n&&Pi(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),Rr(m)&&eo(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;Ri()===o&&Fi(r);const l=Zr();if(Rr(l)){const t=l.anchor,i=l.focus;null!==t&&t.key===o&&oo(t,n,r,e,s),null!==i&&i.key===o&&oo(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 yr(t){return{forChild:Er(t.style),node:null}}function mr(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Er(e.style,n?void 0:"bold"),node:null}}const xr=new WeakMap;function Cr(t){if(!As(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Sr(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=xr.get(n))&&!Cr(n);)r.push(n),n=n.parentNode;const o=void 0===e?n:e;for(let t=0;t<r.length;t++)xr.set(r[t],o);return o}(n))return{node:ao(r)};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=Tr(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=Tr(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:kr(r)}}function Tr(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,As(n)){const t=n.style.display;if(""===t&&!Ps(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(bi(n))return n;if("BR"===n.nodeName)return null}}const Nr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function vr(t){const e=Nr[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Er(t.style,e),node:null}}function kr(t=""){return Ns(new pr(t))}function Or(t){return t instanceof pr}function Er(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=>Or(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 br extends pr{static getType(){return"tab"}static clone(t){return new br(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=ss(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Mr().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 Mr(){return Ns(new br)}function Ar(t){return t instanceof br}class Dr{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 Al(Yl(Fl(this,"next")),Yl(Fl(t,"next")))<0}getNode(){const e=Li(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,Co()||(Ri()===i&&Fi(t),null!==o&&(o.setCachedNodes(null),Rr(o)&&(o._cachedIsBackward=null),o.dirty=!0)))}}function wr(t,e,n){return new Dr(t,e,n)}function Ir(t,e){let n=e.__key,r=t.offset,o="element";if(Or(e)){o="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!zo(e)){const t=e.getNextSibling();if(Or(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 Pr(t,e){if(zo(e)){const n=e.getLastDescendant();zo(n)||Or(n)?Ir(t,n):Ir(t,e)}else Ir(t,e)}class Fr{_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(!Kr(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 Fr(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(Or(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=Li(t);null!==e&&n.push(e)}return Co()||(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((Zr()||to())===this&&t[0]){const e=yl(t[0],"next");Ll(bl(e,e))}for(const e of t)e.remove()}}function Rr(t){return t instanceof Lr}class Lr{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Rr(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(hl(n)){const{origin:t}=n;0===e.length?o.add(t):(i.add(t),e.push(t))}else{const{origin:t}=n;zo(t)&&i.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(dl(t.focus)&&zo(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=Sl(t.focus.origin,"previous");hl(n)&&o.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=Nl(n))o.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!zo(t)||i.has(t)||t.isEmpty()||o.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=Yl(t.anchor),r=Yl(t.anchor.getFlipped()),o=t=>fl(t)?t.origin:t.getNodeAtCaret(),i=o(n)||o(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(i)}return e}(Jl(Bl(this),"next"));return Co()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){return this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text"),this}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]=zr(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(zo(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,Or(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!Uo(f)&&!ti(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=vo(),n=e.getEditorState()._selection,r=Jr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[o,i,s]=r;this.anchor.set(o.key,o.offset,o.type,!0),this.focus.set(i.key,i.offset,i.type,!0),s&&(this.dirty=!0),xt(this)}clone(){const t=this.anchor,e=this.focus;return new Lr(wr(t.key,t.offset,t.type),wr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Di(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=A[t];return 0!==(this.format&e)}insertRawText(t){this.insertNodes(ao(t))}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=kr();if(s.setFormat(n),s.setStyle(r),li(i))i.splice(0,0,[s]);else{const t=jo(o)?si().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&&Rl(l,Yl(Fl(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Or(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&&(Ei(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Or(t)&&t.canInsertTextBefore()&&!Ei(t)||(t=kr(),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&&(Ei(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Or(t)&&!Ei(t)||(t=kr(),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=kr(d.getTextContent());t.setFormat(o),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||zo(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Hr(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(Oi(d)){const t=kr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===o&&n===i){if(Ar(d)){const t=kr(e);return t.setFormat(o),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=kr(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,this._cachedNodes=null,this._cachedIsBackward=null))}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&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=zo(d)?d:d.getParentOrThrow();let r=zo(_)?_:_.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(Or(_)&&!Oi(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=kr(_.getTextContent());_.replace(t),_=t}jo(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)||zo(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(Oi(d))if(c===h)d.select();else{const t=kr(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=Zr()===this;Kl(this,Ul(Bl(this))),t&&Zr()!==this&&ji(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Fi(null);const n=this.getNodes(),r=[];for(const t of n)Or(t)&&r.push(t);const o=e=>{n.forEach(n=>{if(zo(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}})},i=r.length;if(0===i)return this.toggleFormat(t),Fi(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(Ei(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||Ei(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Ei(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=Zr();return Rr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=el(n,Ls),o=e[e.length-1];if(zo(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=uo(this);r.splice(t,0,e),o.selectEnd()}return}if(!e.some(t=>(zo(t)||Uo(t))&&!t.isInline())){zo(r)||t(211,n.constructor.name,n.getType());const i=uo(this);return r.splice(i,0,e),void o.selectEnd()}const i=function(t){const e=si();let n=null;for(let r=0;r<t.length;r++){const o=t[r],i=ti(o);if(i||Uo(o)&&o.isInline()||zo(o)&&o.isInline()||Or(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=!zo(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;zo(f=u)&&Ls(f)&&!f.isEmpty()&&zo(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(zo(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=el(s,Ls);c&&zo(d)&&(c.canMergeWhenEmpty()||Ls(a))&&(d.append(...c.getChildren()),c.remove()),zo(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=zo(r)?r.getLastChild():null;ti(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=si();return Yi().splice(this.anchor.offset,0,[t]),t.select(),t}const e=uo(this),n=el(this.anchor.getNode(),Ls);zo(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=Zo();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]=zr(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(Or(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(Or(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),Or(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(ho(this,t,e,n))return;const r="move"===t,o=vo(),i=bs(xs(o));if(!i)return;const s=o._blockCursorElement,l=o._rootElement,c=this.focus.getNode();if(null===l||null===s||!zo(c)||c.isInline()||c.canBeEmpty()||Es(s,o,l),this.dirty){const t=ds(o,this.anchor.key),e=ds(o,this.focus.key);let n=t,r=e;if("text"===this.anchor.type){const e=this.anchor.getNode();n=Or(e)?Ws(e,t,o):null}if("text"===this.focus.type){const t=this.focus.getNode();r=Or(t)?Ws(t,e,o):null}n&&r&&io(i,n,this.anchor.offset,r,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=jo(n)?n:Cs(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];ys(e,o)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];zo(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];zo(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&&ho(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&zo(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(zo(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=Ol(Fl(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(hl(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(zo(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Yl(e);Kl(this,bl(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(dl(e)){if(zo(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(Uo(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&zo(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=Xr();t.add(e.origin.getKey()),ji(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return e.origin.isEmpty()&&!n.isEmpty()&&e.origin.getParent()===n.getParent()?void e.origin.remove(!0):(Kl(this,bl(!e.origin.isEmpty()&&n.isEmpty()?zl(yl(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&&$r(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 Ur(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 Ur(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!(Ji(t)||Wr(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()&&jo(t.getParent())&&null===t.getPreviousSibling()&&$r(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.isCollapsed()?this.deleteCharacter(t):this.removeText()}isBackward(){const t=this._cachedIsBackward;if(null!==t)return t;const e=this.focus.isBefore(this.anchor);return Co()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function Kr(t){return t instanceof Fr}function Br(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function zr(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]:[Br(n),Br(r)]}function $r(t,e){for(let n=e;n;n=n.getParent()){if(zo(n)){if(n.collapseAtStart(t))return!0;if(Ss(n))break}if(n.getPreviousSibling())break}return!1}const Wr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return()=>!1})();function Ur(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 Yr(e,n,r,o){let i,s=n,l=!1;if(As(e)){let c=!1;const a=e.childNodes,u=a.length,f=o._blockCursorElement;s===u&&u>0&&(c=!0,s=u-1),void 0!==zi(e,o)||Qs(e,o)||(l=!0);let d=a[s],h=!1;if(d===f)d=a[s+1],h=!0;else if(null!==f){const t=f.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,f)&&s--}}if(i=Hi(d),Or(i))s=xl(i,c?"next":"previous");else{let a=Hi(e);if(null===a)return null;if(zo(a)){const l=o.getElementByKey(a.getKey());null===l&&t(214);const u=zs(a,l,o);[a,s]=u.resolveChildIndex(a,l,e,n),zo(a)||t(215),c&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let f=a.getChildAtIndex(s);if(zo(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=c?f.getLastDescendant():f.getFirstDescendant();null===t?a=f:(f=t,a=zo(f)?f:f.getParentOrThrow()),s=0}Or(f)?(i=f,a=null,s=xl(f,c?"next":"previous")):f!==a&&c&&!h&&(zo(a)||t(216),s=Math.min(a.getChildrenSize(),s+1))}else{const t=a.getIndexWithinParent(),r=o.getElementByKey(a.getKey());let i="after";if(null!==r&&Hi(e)===a){const t=zs(a,r,o);t.element!==r?i=t.resolveLeafPosition(r,e,n):0===n&&Uo(a)&&(i="before")}s="before"===i?t:t+1,a=a.getParentOrThrow()}if(zo(a))return[wr(a.__key,s,"element"),l]}}else i=Hi(e);return Or(i)?[wr(i.__key,xl(i,s,"clamp"),"text"),l]:null}function jr(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&&zo(i)&&i.isInline()){const e=i.getPreviousSibling();Or(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else zo(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Or(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===o.getTextContent().length){const r=o.getNextSibling(),i=o.getParent();if(e&&zo(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&zo(i)&&i.isInline()&&!i.canInsertTextAfter()){const e=i.getNextSibling();Or(e)&&t.set(e.__key,0,"text")}}}function Hr(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);jr(t,n,r),jr(e,!n,r),r&&e.set(t.key,t.offset,t.type)}}function Jr(t,e,n,r,o,i){if(null===t||null===n||!Ti(o,t,n))return null;const s=Yr(t,e,Rr(i)?i.anchor:null,o);if(null===s)return null;const l=Yr(n,r,Rr(i)?i.focus:null,o);if(null===l)return null;const[c,a]=s,[u,f]=l;if("element"===c.type&&"element"===u.type){const e=Hi(t),r=Hi(n);if(Uo(e)&&Uo(r))return null}return Hr(c,u),[c,u,a||f]}function Gr(t){return zo(t)&&!t.isInline()}function Vr(t,e,n,r,o,i){const s=No(),l=new Lr(wr(t,e,o),wr(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function qr(){const t=wr("root",0,"element"),e=wr("root",0,"element");return new Lr(t,e,0,"")}function Xr(){return new Fr(new Set)}function Qr(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=!V&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&i&&3===i.detail||"drop"===s||void 0===s);let a,u,f,d;if(Rr(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)&&Rr(t)&&!Ti(n,a,u))return t.clone();const h=Jr(a,f,u,d,n,t);if(null===h)return null;const[g,_,p]=h;let y=0,m="";if(Rr(t)){const e=t.anchor;if(g.key===e.key)y=t.format,m=t.style;else{const t=g.getNode();Or(t)?(y=t.getFormat(),m=t.getStyle()):zo(t)&&(y=t.getTextFormat(),m=t.getTextStyle())}}const x=new Lr(g,_,y,m);return p&&(x.dirty=!0),x}function Zr(){return No()._selection}function to(){return vo()._editorState._selection}function eo(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"),no(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")}}no(t)}function no(t){const e=t.anchor,n=e.offset,r=t.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!zo(i))return;const t=i.getChildrenSize(),o=n>=t,s=o?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Or(s)){let t=0;o&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}return}if(zo(i)){const t=i.getChildrenSize(),r=n>=t,o=r?i.getChildAtIndex(t-1):i.getChildAtIndex(n);if(Or(o)){let t=0;r&&(t=o.getTextContentSize()),e.set(o.__key,t,"text")}}if(zo(s)){const t=s.getChildrenSize(),e=o>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(o);if(Or(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}function ro(t,e,n,r,o){let i=null,s=0,l=null;null!==r?(i=r.__key,Or(r)?(s=r.getTextContentSize(),l="text"):zo(r)&&(s=r.getChildrenSize(),l="element")):null!==o&&(i=o.__key,Or(o)?l="text":zo(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 oo(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 io(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch(t){}}function so(t,e,n){const r=ds(t,e.getKey());if(zo(e)){const o=zs(e,r,t);return[o.element,n+o.getFirstChildOffset()]}return[r,n]}function lo(t,e,n,r,o,s){const l=document.activeElement;if(o.has(tr)&&l!==s||null!==l&&Si(l))return;if(!Rr(e))return void(null!==t&&Ti(n,r.anchorNode,r.focusNode)&&r.removeAllRanges());const c=e.anchor,a=e.focus,u=c.getNode(),f=a.getNode(),[d,h]=so(n,u,c.offset),[g,_]=so(n,f,a.offset),p=e.format,y=e.style,m=e.isCollapsed();let x=d,C=g,S=!1;var T,N,v,k,O;if(("text"===c.type?(x=Or(u)?Ws(u,d,n):null,S=u.getFormat()!==p||u.getStyle()!==y):Rr(t)&&"text"===t.anchor.type&&(S=!0),"text"===a.type&&(C=Or(f)?Ws(f,g,n):null),null!==x&&null!==C)&&(m&&(null===t||S||Rr(t)&&(t.format!==p||t.style!==y))&&(T=p,N=y,v=h,k=c.key,O=performance.now(),kn=[T,N,v,k,O]),"Range"===r.type&&m||r.anchorOffset!==h||r.focusOffset!==_||r.anchorNode!==x||r.focusNode!==C||(null!==l&&s.contains(l)||o.has(rr)||s.focus({preventScroll:!0}),"element"===c.type))){if(io(r,x,h,C,_),!i||!e.isCollapsed()||null===s||o.has(rr)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!o.has(er)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=Rr(e)&&"element"===e.anchor.type?x.childNodes[h]||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=gs(n),o=ms(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){const e=o.visualViewport;if(e){const t=e.offsetTop;l=t,c=t+e.height}else l=0,c=xs(t).innerHeight;const n=o.getComputedStyle(r.documentElement),i=parseFloat(n.scrollPaddingTop),s=parseFloat(n.scrollPaddingBottom);isFinite(i)&&(l+=i),isFinite(s)&&(c-=s)}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=hs(a)}}(n,e,s)}}mn=!0}}function co(t,e){for(const n of t.split(/(\r?\n|\t)/))"\n"===n||"\r\n"===n?e.linebreak():"\t"===n?e.tab():""!==n&&e.text(n)}function ao(t){const e=[];return co(t,{linebreak:()=>e.push(Zo()),tab:()=>e.push(Mr()),text:t=>e.push(kr(t))}),e}function uo(e){let n=e;e.isCollapsed()||n.removeText();const r=Zr();Rr(r)&&(n=r),Rr(n)||t(161);const o=n.anchor;let i=o.getNode(),s=o.offset;for(;!Ls(i);){const t=i;if([i,s]=fo(i,s),t.is(i))break}return s}function fo(t,e){const n=t.getParent();if(!n){const t=si();return Yi().append(t),t.select(),[Yi(),0]}if(Or(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(!zo(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new Lr(wr(t.__key,e,"element"),wr(t.__key,e,"element"),0,""),o=t.insertNewAfter(n);o&&o.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function ho(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=Fl(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=i,a="decorators-and-blocks"===o;if(!jl(c)){for(const t of c){a=!1;const{origin:e}=t;if(!Uo(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of Ol(i).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(hl(t))t.origin.isInline()||(c=t);else{if(zo(t.origin))continue;Uo(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===i)return!1;if(l&&!s&&Uo(c.origin)&&c.origin.isKeyboardSelectable()){const t=Xr();return t.add(c.origin.getKey()),ji(t),!0}return c=Yl(c),l&&Rl(t.anchor,c),Rl(t.focus,c),a||!s}let go=null,_o=null,po=!1,yo=!1,mo=0;const xo={characterData:!0,childList:!0,subtree:!0};function Co(){return po||null!==go&&go._readOnly}function So(){po&&t(13)}function To(){mo>99&&t(14)}function No(){return null===go&&t(195,ko()),go}function vo(){return null===_o&&t(337,ko()),_o}function ko(){let t=0;const e=new Set,n=gi.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=ki(r);if(Ni(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 Oo(){return _o}function Eo(t,e,n){const r=e.__type,o=mi(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 bo(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Mo(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 Ao(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(zo(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=Ao(l[t],n);s.append(e)}return s}function Do(t,e,n){const r=go,o=po,i=_o;go=e,po=!0,_o=t;try{return n()}finally{go=r,po=o,_o=i}}function wo(e,n){const r=e._pendingEditorState,o=e._rootElement,i=e._headless||null===o;if(null===r)return void(e._deferred.length>0&&Fo(e,e._deferred));const s=e._editorState,l=s._selection,c=r._selection,a=0!==e._dirtyType,u=go,f=po,d=_o,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!i&&a&&null!==g){_o=e,go=r,po=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,o=e._dirtyLeaves;g.disconnect(),_=ae(s,r,e,t,n,o)}catch(t){if(t instanceof Error&&e._onError(t),yo)throw t;return ai(e,null,o,r),ot(e),e._dirtyType=2,yo=!0,wo(e,s),void(yo=!1)}finally{g.observe(o,xo),e._updating=h,go=u,po=f,_o=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,C=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._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=Wi(t)),delete r[i])}(e,r);const S=i?null:bs(xs(e));if(e._editable&&null!==S&&(a||null===c||c.dirty||!c.is(l))&&null!==o&&!x.has(nr)){_o=e,go=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&Es(t,e,o),lo(l,c,e,S,x,o)}!function(t,e,n){let r=t._blockCursorElement;if(Rr(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()){Os(i.getChildAtIndex(s-1))&&(l=!0)}else{const e=i.getChildAtIndex(s);if(null!==e&&Os(e)){const n=e.getPreviousSibling();(null===n||Os(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=zs(i,t.getElementByKey(i.__key),t).element;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=Xl(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&&Es(r,t,e)}(e,o,c)}finally{null!==g&&g.observe(o,xo),_o=d,go=u}}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})}}}(e,_,x,p,s),Rr(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(de,void 0);const T=e._pendingDecorators;null!==T&&(e._decorators=T,e._pendingDecorators=null,Io("decorator",e,!0,T)),function(t,e,n){const r=Ui(e),o=Ui(n);r!==o&&Io("textcontent",t,!0,o)}(e,n||s,r),Io("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,mutatedNodes:_,normalizedNodes:m,prevEditorState:n||s,tags:x}),Fo(e,C),function(e){const n=e._updates;if(0===n.length)return void(e._cascadeCount=0);if(e._cascadeCount++>99){e._updates=[],e._cascadeCount=0;try{t(343)}catch(t){t instanceof Error&&e._onError(t)}return}const r=n.shift();if(r){const[t,n]=r;Lo(e,t,n)}}(e)}function Io(t,e,n,...r){const o=e._updating;e._updating=n;try{const n=e._listeners[t],o=Array.from(n);for(const[t,e]of o){e&&e();const o=t(...r);n.has(t)?n.set(t,o):o&&o()}}finally{e._updating=o}}function Po(t,e,n,r){const o=Gi(t);let i;for(let t=4;t>=0;t--)for(let s=0;s<o.length;s++){const l=o[s];if(s>0&&l._updating){i=l;break}const c=l._commands.get(e);if(void 0!==c){const e=c[t];if(e.size>0){let t=!1;if(Ko(l,()=>{for(const o of e)if(o(n,r))return void(t=!0)}),t)return t}}}return i&&i.update(()=>{Po(i,e,n,r)}),!1}function Fo(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}}}function Ro(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),Mo(e,i.tag)),null==s?Lo(e,r,i):r()}}return o}function Lo(e,n,r){const o=e._updateTags;let i,s=!1,l=!1;void 0!==r&&(i=r.onUpdate,Mo(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=Ho(a||c),u=!0),a._flushSync=l;const f=go,d=po,h=_o,g=e._updating;go=a,po=!1,e._updating=!0,_o=e;const _=e._headless||null===e.getRootElement();pi(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=bs(xs(t));return Rr(n)||null==n?Qr(n,r,t,e):n.clone()}(e,r&&r.event||null));const o=e._compositionKey;n(),s=Ro(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(Rr(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);Or(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&mt(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,o=t._nodeMap,i=Ri(),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);Or(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&mt(r),void 0!==r&&bo(r,i)&&Eo(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){mo++;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&&bo(c,i)&&Eo(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,mo++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),Ro(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()||(zo(e)&&G(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(Rr(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 Kr(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 wo(e)}finally{go=f,po=d,_o=h,e._updating=g,mo=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,wo(e)):u&&Ci(()=>{wo(e)}):(a._flushSync=!1,u&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Ko(t,e,n){_o===t&&void 0===n?e():Lo(t,e,n)}class Bo extends Qn{__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=vo()._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(Or(e)&&t.push(e),zo(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;zo(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;zo(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 zo(t)&&t.getLastDescendant()||t||null}const r=e[t];return zo(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Li(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Li(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(),zo(o)&&r!==n-1&&!o.isInline()&&(t+=v)}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(),zo(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=w[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=A[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return Di(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){So();const n=Zr();let r=t,o=e;const i=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Or(t)||zo(t))return t.select(0,0)}else if(!(void 0!==t&&t!==i||void 0!==e&&e!==i)){const t=this.getLastChild();if(Or(t)||zo(t))return t.select()}void 0===r&&(r=i),void 0===o&&(o=i);const s=this.__key;return Rr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,o,"element"),n.dirty=!0,n):Vr(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&&w[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){qn(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;Ii(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--,Ii(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=Zr();if(Rr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:o}=t;$o(r,e,n)&&ro(r,r.getNode(),this,u,a),$o(o,e,n)&&ro(o,o.getNode(),this,u,a),0!==f||this.canBeEmpty()||Ss(this)||this.remove()}}return i}getDOMSlot(t){return new z(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(As(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px",e.setAttribute("data-lexical-indent",String(t)));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||Ss(this)||this.getChildren().some(Or)||(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=zs(this,t,e);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 zo(t){return t instanceof Bo}function $o(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 Wo extends Qn{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Uo(t){return t instanceof Wo}class Yo extends Bo{__cachedText;static getType(){return"root"}static clone(){return new Yo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return null===t||!Co()&&0!==vo()._dirtyType?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)zo(e)||Uo(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return Yi().updateFromJSON(t)}collapseAtStart(){return!0}}function jo(t){return t instanceof Yo}function Ho(t){return new Vo(H(t._nodeMap))}function Jo(){return new Vo(new Map([["root",new Yo]]))}function Go(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),zo(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=Go(i[t]);o.push(e)}}return n}class Vo{_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 Do(e&&e.editor||null,this,t)}clone(t){const e=new Vo(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return Do(null,this,()=>({root:Go(Yi())}))}}class qo extends Bo{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class Xo extends Qn{static getType(){return"linebreak"}static clone(t){return new Xo(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=>ei(t)||ni(t)?null:{conversion:Qo,priority:0}}}static importJSON(t){return Zo().updateFromJSON(t)}}function Qo(t){return{node:Zo()}}function Zo(){return Ns(new Xo)}function ti(t){return t instanceof Xo}function ei(t){const e=t.parentElement;if(null!==e&&Rs(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&ri(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&ri(n))return!0}}return!1}function ni(t){const e=t.parentElement;if(null!==e&&Rs(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&ri(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&ri(r))return!0}return!1}function ri(t){return bi(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}class oi extends Bo{static getType(){return"paragraph"}static clone(t){return new oi(t.__key)}createDOM(t){const e=document.createElement("p"),n=ss(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:ii,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(As(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return si().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(Or);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=si();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||Or(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 ii(t){const e=si();if(Vs(e,t),Js(t,e),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in w&&e.setFormat(n)}return Gs(e,t),{node:e}}function si(){return Ns(new oi)}function li(t){return t instanceof oi}const ci=0;function ai(t,e,n,r,o){const i=t._keyToDOMMap;i.clear(),t._editorState=Jo(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent="",function(t,e){const n=`__lexicalKey_${e._key}`;delete t[n]}(e,t)),null!==n&&(n.textContent="",i.set("root",n),Bi(n,t,"root"))}function ui(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=tl(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 Qn&&t!==Qn?t:void 0}}return e}const fi={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=xi(e,t.getType());return n&&void 0!==n.exportDOM?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,o)=>zo(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$shouldExclude:(t,e,n)=>zo(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function di(t,e){const n=t.get(e);t.delete(e),n&&n()}function hi(t,e,n){return t.set(e,n),di.bind(null,t,e)}class gi{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_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 J,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},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=Vi(),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){return hi(this._listeners.update,t)}registerEditableListener(t){return hi(this._listeners.editable,t)}registerDecoratorListener(t){return hi(this._listeners.decorator,t)}registerTextContentListener(t){return hi(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return Ql(hi(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0)}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){void 0===r&&t(35);const o=this._commands;o.has(e)||o.set(e,[new Y,new Y,new Y,new Y,new Y]);const i=o.get(e);void 0===i&&t(36,String(e));const s=function(t){return 7&t}(r),l=i[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.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=js(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=js(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=Li(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:Zn}: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 fs(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=ss(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,ai(this,e,t,r,{preserveUpdateQueue:!0}),null!==e&&(this._config.disableEvents||Jn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=ms(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,ot(this),this._updateTags.add(Zn),wo(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;pn.set(t,n);const r=yn.get(n)??0;r<1&&n.addEventListener("selectionchange",Un),yn.set(n,r+1),t.__lexicalEditor=e;const o=$n(t);for(let n=0;n<an.length;n++){const[r,i]=an[n],s="function"==typeof i?t=>{jn(t)||(Yn(t),(e.isEditable()||"click"===r)&&i(t,e))}:t=>{if(jn(t))return;Yn(t);const n=e.isEditable();switch(r){case"cut":return n&&fs(e,Qe,t);case"copy":return fs(e,Xe,t);case"paste":return n&&fs(e,Ne,t);case"dragstart":return n&&fs(e,Ge,t);case"dragover":return n&&fs(e,Ve,t);case"dragend":return n&&fs(e,qe,t);case"focus":return n&&fs(e,on,t);case"blur":return n&&fs(e,sn,t);case"drop":return n&&fs(e,He,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(Zn),wo(this);Io("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=Ho(e),r._selection=e._selection?e._selection.clone():null),rt(this);const o=this._pendingEditorState,i=this._updateTags,s=void 0!==n?n.tag:null;null===o||o.isEmpty()||(null!=s&&i.add(s),wo(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||wo(this)}parseEditorState(t,e){return function(t,e,n){const r=Jo(),o=go,i=po,s=_o,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,go=r,po=!1,_o=e,pi(null);try{const o=e._nodes;Ao(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,go=o,po=i,_o=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return wo(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):Lo(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ko(this,()=>{const r=Zr(),o=Yi();null!==r?r.dirty||ji(r.clone()):0!==o.getChildrenSize()&&("rootStart"===e.defaultSelection?o.selectStart():o.selectEnd()),_s("focus"),ps(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=bs(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Io("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}gi.version=U;let _i=null;function pi(t){_i=t}let yi=1;function mi(e,n){const r=xi(e,n);return void 0===r&&t(30,n),r}function xi(t,e){return t._nodes.get(e)}const Ci="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function Si(t){const e=document.activeElement;if(!As(e))return!1;const n=e.nodeName;return Uo($i(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==ki(e))}function Ti(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Si(e)&&vi(e)===t}catch(t){return!1}}function Ni(t){return t instanceof gi}function vi(t){let e=t;for(;null!=e;){const t=ki(e);if(Ni(t))return t;e=hs(e)}return null}function ki(t){return t?t.__lexicalEditor:null}function Oi(t){return Ar(t)||t.isToken()}function Ei(t){return Oi(t)||t.isSegmented()}function bi(t){return Ds(t)&&3===t.nodeType}function Mi(t){return Ds(t)&&9===t.nodeType}function Ai(t){let e=t;for(;null!=e;){if(bi(e))return e;e=e.firstChild}return null}function Di(t,e,n){const r=A[e];if(null!==n&&(t&r)===(n&r))return t;let o=t^r;return"subscript"===e?o&=~A.superscript:"superscript"===e?o&=~A.subscript:"lowercase"===e?(o&=~A.uppercase,o&=~A.capitalize):"uppercase"===e?(o&=~A.lowercase,o&=~A.capitalize):"capitalize"===e&&(o&=~A.lowercase,o&=~A.uppercase),o}function wi(t,e){const n=function(){const t=_i;return _i=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);So(),To();const r=vo(),o=No(),i=""+yi++;o._nodeMap.set(i,t),zo(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),0===r._dirtyType&&(r._dirtyType=1),t.__key=i}function Ii(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 Pi(e){To(),qn(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,o=No(),i=vo(),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;0===i._dirtyType&&(i._dirtyType=1),zo(e)?l.set(c,!0):i._dirtyLeaves.add(c)}function Fi(t){So();const e=vo(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Li(n);null!==t&&t.getWritable()}if(null!==t){const e=Li(t);null!==e&&e.getWritable()}}}function Ri(){if(Co())return null;return vo()._compositionKey}function Li(t,e){const n=(e||No())._nodeMap.get(t);return void 0===n?null:n}function Ki(t,e){const n=zi(t,vo());return void 0!==n?Li(n,e):null}function Bi(t,e,n){t[`__lexicalKey_${e._key}`]=n}function zi(t,e){return t[`__lexicalKey_${e._key}`]}function $i(t,e){let n=t;for(;null!=n;){const t=Ki(n,e);if(null!==t)return t;n=hs(n)}return null}function Wi(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Ui(t){return t.read(()=>Yi().getTextContent())}function Yi(){return No()._nodeMap.get("root")}function ji(t){So();const e=No();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Hi(t){const e=function(t,e){let n=t;for(;null!=n;){const t=zi(n,e);if(void 0!==t)return t;n=hs(n)}return null}(t,vo());return null===e?null:Li(e)}function Ji(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Gi(t){const e=[];for(let n=t;null!==n;n=n._parentEditor)e.push(n);return e}function Vi(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function qi(t){return bi(t)?t.nodeValue:null}function Xi(t,e,n){const r=bs(xs(e));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let e=qi(o);const r=$i(o);if(null!==e&&Or(r)){if((e===N||e===k)&&n){const t=n.length;e=n,i=t,s=t}null!==e&&Qi(r,e,i,s,t)}}}function Qi(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let c=e;if((s||o)&&(e.endsWith(N)&&(c=e.slice(0,-N.length)),o)){const t=k;let e;for(;-1!==(e=c.indexOf(t));)c=c.slice(0,e)+c.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length))}const u=i.getTextContent();if(o||c!==u){if(""===c){if(Fi(null),a||l||d)i.remove();else{const t=vo();setTimeout(()=>{t.update(()=>{i.isAttached()&&i.remove()})},20)}return}const e=i.getParent(),o=to(),u=i.getTextContentSize(),f=Ri(),h=i.getKey();if(i.isToken()||null!==f&&h===f&&!s||Rr(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=Zr();if(!Rr(g)||null===n||null===r)return void Zi(i,c,g);if(g.setTextNodeRange(i,n,i,r),i.isSegmented()){const t=kr(i.getTextContent());i.replace(t),i=t}Zi(i,c,g)}}}function Zi(t,e,n){if(t.setTextContent(e),Rr(n)){const e=t.getKey();let r=!1;for(const o of["anchor","focus"]){const i=n[o];"text"===i.type&&i.key===e&&(i.offset=xl(t,i.offset,"clamp"),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function ts(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function es(t,e){return ts(t,e,"altKey")&&ts(t,e,"ctrlKey")&&ts(t,e,"shiftKey")&&ts(t,e,"metaKey")}function ns(t,e,n){if(!es(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1)return!1;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const rs={ctrlKey:!o,metaKey:o},os={altKey:o,ctrlKey:!o};function is(t){return"Backspace"===t.key}function ss(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=Xl(o);return n[e]=t,t}return o}function ls(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 cs(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 as(t,e){const n=t.offset;if("element"===t.type){return cs(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?cs(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function us(t){const e=xs(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function fs(t,e,n){return Po(t,e,n,t)}function ds(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function hs(t){const e=t.assignedSlot||t.parentElement;return ws(e)?e.host:e}function gs(t){return Mi(t)?t:As(t)?t.ownerDocument:null}function _s(t){So();vo()._updateTags.add(t)}function ps(t){So();vo()._deferred.push(t)}function ys(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function ms(t){const e=gs(t);return e?e.defaultView:null}function xs(e){const n=e._window;return null===n&&t(78),n}function Cs(t){let e=t.getParentOrThrow();for(;null!==e;){if(Ss(e))return e;e=e.getParentOrThrow()}return e}function Ss(t){return jo(t)||zo(t)&&t.isShadowRoot()}function Ts(t,e=!1){const n=t.constructor.clone(t);return wi(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function Ns(e){const n=vo(),r=e.getType(),o=xi(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 vs(e,n){!jo(e.getParent())||zo(n)||Uo(n)||t(99)}function ks(e){const n=Li(e);return null===n&&t(63,e),n}function Os(t){return(Uo(t)||zo(t)&&!t.canBeEmpty())&&!t.isInline()}function Es(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function bs(t){return n?(t||window).getSelection():null}function Ms(t){const e=ms(t);return e?e.getSelection():null}function As(t){return Ds(t)&&1===t.nodeType}function Ds(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function ws(t){return Ds(t)&&11===t.nodeType}const Is=/^(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;function Ps(t){return!(!As(t)||!t.style.display.startsWith("inline"))||Is.test(t.nodeName)}const Fs=/^(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;function Rs(t){return(!As(t)||!t.style.display.startsWith("inline"))&&Fs.test(t.nodeName)}function Ls(t){if(Uo(t)&&!t.isInline())return!0;if(!zo(t)||Ss(t))return!1;const e=t.getFirstChild(),n=null===e||ti(e)||Or(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Ks(){return vo()}function Bs(t=Ks()){return t._config.dom||fi}function zs(e,n,r=Ks()){const o=Bs(r).$getDOMSlot(e,n,r);return zo(e)&&($s(o)||t(344,e.getKey(),e.getType())),o}function $s(t){return t instanceof z}function Ws(t,e,n=Ks()){return Ai(zs(t,e,n).element)}const Us=new WeakMap,Ys=new Map;function js(e){if(!e._readOnly&&e.isEmpty())return Ys;e._readOnly||t(192);let n=Us.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),Us.set(e,n)),n}function Hs(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Js(t,e){const n=t.getAttribute("data-lexical-indent");if(null!==n){const t=parseInt(n,10);if(Number.isFinite(t)&&t>=0)return void e.setIndent(t)}const r=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(r/40);e.setIndent(o)}function Gs(t,e){const n=e.getAttribute("dir");return"ltr"===n||"rtl"===n?t.setDirection(n):t}function Vs(t,e){const n=e.style.textAlign;return n&&n in w?t.setFormat(n):t}function qs(t,e){t.__lexicalUnmanaged=!0,e&&void 0!==e.captureSelection&&(t.__lexicalCapturedSelection=e.captureSelection)}function Xs(t){return!0===t.__lexicalUnmanaged}function Qs(t,e){let n=t;for(;null!=n;){if(!0===n.__lexicalCapturedSelection)return!0;if(void 0!==zi(n,e))return!1;n=hs(n)}return!1}function Zs(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==Qn[e]}function tl(e){const n=R in e.prototype?e.prototype[R]():void 0,r=function(e){if(!(e===Qn||e.prototype instanceof Qn)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{gi.version&&(r=JSON.parse(gi.version))}catch(t){}t(290,e.name,n,r)}return e===Wo||e===Bo||e===Qn}(e),o=!r&&Zs(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&&(Zs(e,"getType")||(e.getType=()=>s),Zs(e,"clone")||(e.clone=t=>(pi(t),new e)),Zs(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Zs(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const el=(t,e)=>{let n=t;for(;null!=n&&!jo(n);){if(e(n))return n;n=n.getParent()}return null};function nl(e,n){const r=[];let o=e.__first;for(;null!==o;){const e=null===n?Li(o):n.get(o);null==e&&t(174),r.push(o),o=e.__next}return r}const rl={next:"previous",previous:"next"};class ol{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Ml({hasNext:dl,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return yl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return yl(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=yl(e,this.direction)}for(const t of l.values())t.remove();return this}}class il extends ol{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Sl(t,this.direction)}getParentCaret(t="root"){return yl(cl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ll(this.direction);return yl(this.getNodeAtCaret(),t)||Sl(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof il&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const sl={root:jo,shadowRoot:Ss};function ll(t){return rl[t]}function cl(t,e="root"){return sl[e](t)?null:t}class al extends ol{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:yl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return zo(this.origin)?Sl(this.origin,this.direction):null}getParentCaret(t="root"){return yl(cl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=ll(this.direction);return yl(this.getNodeAtCaret(),t)||Sl(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof al&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof al||t instanceof ul)&&this.direction===t.direction&&this.origin.is(t.origin)}}class ul extends ol{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:ml(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return yl(cl(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ml(this.origin,ll(this.direction),this.offset)}isSamePointCaret(t){return t instanceof ul&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof al||t instanceof ul)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return yl(this.origin,this.direction)}}function fl(t){return t instanceof ul}function dl(t){return t instanceof al}function hl(t){return t instanceof il}const gl={next:class extends ul{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ul{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},_l={next:class extends al{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends al{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},pl={next:class extends il{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends il{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function yl(t,e){return t?new _l[e](t):null}function ml(t,e,n){return t?new gl[e](t,xl(t,n)):null}function xl(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 Cl(t,e){return new kl(t,e)}function Sl(t,e){return zo(t)?new pl[e](t):null}function Tl(t){return t&&t.getChildCaret()||t}function Nl(t){return t&&Tl(t.getAdjacentCaret())}class vl{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 vl(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return fl(e)?function(t,e){const{direction:n,origin:r}=t,o=xl(r,"focus"===e?ll(n):n);return Cl(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[Cl(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=fl(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=fl(n),o=e=>e.isSameNodeCaret(n)?null:Nl(e)||e.getParentCaret(t);return Ml({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 kl{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 ml(t.setTextContent(o.slice(0,n)+o.slice(r)),e,n)}}function Ol(t){return bl(t,yl(Yi(),t.direction))}function El(t){return bl(t,t)}function bl(e,n){return e.direction!==n.direction&&t(265),new vl(e,n,e.direction)}function Ml(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 Al(e,n){const r=Pl(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 Dl(r)}}function Dl(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 wl(t,e){return e.is(t)}function Il(t){return zo(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Pl(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Il(e);t;n=t,t=t.getParent())r.set(t,n);for(let[o,i]=Il(n);o;i=o,o=o.getParent()){const s=r.get(o);if(void 0!==s)return null===s?(wl(e,o)||t(276),{commonAncestor:o,type:"ancestor"}):null===i?(wl(n,o)||t(277),{commonAncestor:o,type:"descendant"}):((zo(s)||wl(e,s))&&(zo(i)||wl(n,i))&&o.is(s.getParent())&&o.is(i.getParent())||t(278),{a:s,b:i,commonAncestor:o,type:"branch"})}return null}function Fl(e,n){const{type:r,key:o,offset:i}=e,s=ks(e.key);return"text"===r?(Or(s)||t(266,s.getType(),o),ml(s,n,i)):(zo(s)||t(267,s.getType(),o),Gl(s,e.offset,n))}function Rl(e,n){const{origin:r,direction:o}=n,i="next"===o;fl(n)?e.set(r.getKey(),n.offset,"text"):dl(n)?Or(r)?e.set(r.getKey(),xl(r,o),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(i?1:0),"element"):(hl(n)&&zo(r)||t(268),e.set(r.getKey(),i?0:r.getChildrenSize(),"element"))}function Ll(t){const e=Zr(),n=Rr(e)?e:qr();return Kl(n,t),ji(n),n}function Kl(t,e){Rl(t.anchor,e.anchor),Rl(t.focus,e.focus)}function Bl(t){const{anchor:e,focus:n}=t,r=Fl(e,"next"),o=Fl(n,"next"),i=Al(r,o)<=0?"next":"previous";return bl(Hl(r,i),Hl(o,i))}function zl(t){const{direction:e,origin:n}=t,r=yl(n,ll(e)).getNodeAtCaret();return r?yl(r,e):Sl(n.getParentOrThrow(),e)}function $l(t,e="root"){const n=[t];for(let r=hl(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(zl(r));return n}function Wl(t){return!!t&&t.origin.isAttached()}function Ul(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",o="next";let i=n;const s=Jl(e,o),l=$l(s.anchor,r),c=$l(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(hl(t))a.add(t.origin.getKey());else if(dl(t)){const{origin:e}=t;zo(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=zl(yl(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=kr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=ml(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(Wl(t)){f=Yl(t);break}for(const t of c)if(Wl(t)){d=Yl(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(Ss(o))return;!n&&e(o)&&(n=o)}return n},u=a(i,Ls),f=u&&a(s,t=>n.has(t.getKey())&&Ls(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;Sl(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(!0);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(!0)}}const g=[f,d,...l,...c].find(Wl);if(g){return El(Hl(Yl(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function Yl(t){const e=function(t){let e=t;for(;hl(e);){const t=Nl(e);if(!hl(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Or(e.origin))return fl(e)?e:ml(e.origin,n,n);const r=e.getAdjacentCaret();return dl(r)&&Or(r.origin)?ml(r.origin,n,ll(n)):e}function jl(t){return fl(t)&&t.offset!==xl(t.origin,t.direction)}function Hl(t,e){return t.direction===e?t:t.getFlipped()}function Jl(t,e){return t.direction===e?t:bl(Hl(t.focus,e),Hl(t.anchor,e))}function Gl(t,e,n){let r=Sl(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Hl(r,n)}function Vl(e){const{origin:n,offset:r,direction:o}=e;if(r===xl(n,o))return e.getSiblingCaret();if(r===xl(n,ll(o)))return zl(e.getSiblingCaret());const[i]=n.splitText(r);return Or(i)||t(281),Hl(yl(i,"next"),o)}function ql(t,e){return!0}function Xl(...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}function Ql(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}exports.$addUpdateTag=_s,exports.$applyNodeReplacement=Ns,exports.$assumeActiveEditor=function(e){null!==No()&&null===_o&&(_o=e),_o!==e&&t(365)},exports.$caretFromPoint=Fl,exports.$caretRangeFromSelection=Bl,exports.$cloneWithProperties=Hs,exports.$cloneWithPropertiesEphemeral=function(t){return(e=Hs(t))[Vn]=!0,e;var e},exports.$comparePointCaretNext=Al,exports.$copyNode=Ts,exports.$create=function(t){const e=Ks();return So(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)},exports.$createChildrenArray=nl,exports.$createLineBreakNode=Zo,exports.$createNodeSelection=Xr,exports.$createParagraphNode=si,exports.$createPoint=wr,exports.$createRangeSelection=qr,exports.$createRangeSelectionFromDom=function(t,e){return Qr(null,t,e,null)},exports.$createTabNode=Mr,exports.$createTextNode=kr,exports.$extendCaretToRange=Ol,exports.$findMatchingParent=el,exports.$fullReconcile=function(){vo()._dirtyType=2},exports.$generateNodesFromRawText=ao,exports.$getAdjacentChildCaret=Nl,exports.$getAdjacentNode=as,exports.$getAdjacentSiblingOrParentSiblingCaret=function(t,e="root"){let n=0,r=t,o=Nl(r);for(;null===o;){if(n--,o=r.getParentCaret(e),!o)return null;r=o,o=Nl(r)}return o&&[o,n]},exports.$getCaretInDirection=Hl,exports.$getCaretRange=bl,exports.$getCaretRangeInDirection=Jl,exports.$getCharacterOffsets=zr,exports.$getChildCaret=Sl,exports.$getChildCaretAtIndex=Gl,exports.$getChildCaretOrSelf=Tl,exports.$getCollapsedCaretRange=El,exports.$getCommonAncestor=Pl,exports.$getCommonAncestorResultBranchOrder=Dl,exports.$getDOMSlot=zs,exports.$getDOMTextNode=Ws,exports.$getEditor=Ks,exports.$getEditorDOMRenderConfig=Bs,exports.$getNearestNodeFromDOMNode=$i,exports.$getNearestRootOrShadowRoot=Cs,exports.$getNodeByKey=Li,exports.$getNodeByKeyOrThrow=ks,exports.$getNodeFromDOMNode=Ki,exports.$getPreviousSelection=to,exports.$getRoot=Yi,exports.$getSelection=Zr,exports.$getSiblingCaret=yl,exports.$getState=st,exports.$getStateChange=function(t,e,n){const r=st(t,n,"direct"),o=st(e,n,"direct");return n.isEqual(r,o)?null:[r,o]},exports.$getTextContent=function(){const t=Zr();return null===t?"":t.getTextContent()},exports.$getTextNodeOffset=xl,exports.$getTextPointCaret=ml,exports.$getTextPointCaretSlice=Cl,exports.$getWritableNodeState=at,exports.$hasAncestor=ys,exports.$hasUpdateTag=function(t){return vo()._updateTags.has(t)},exports.$insertNodes=function(t){let e=Zr()||to();null===e&&(e=Yi().selectEnd()),e.insertNodes(t)},exports.$isBlockElementNode=Gr,exports.$isChildCaret=hl,exports.$isDecoratorNode=Uo,exports.$isEditorState=function(t){return t instanceof Vo},exports.$isElementDOMSlot=$s,exports.$isElementNode=zo,exports.$isExtendableTextPointCaret=jl,exports.$isInlineElementOrDecoratorNode=function(t){return zo(t)&&t.isInline()||Uo(t)&&t.isInline()},exports.$isLeafNode=function(t){return Or(t)||ti(t)||Uo(t)},exports.$isLexicalNode=function(t){return t instanceof Qn},exports.$isLineBreakNode=ti,exports.$isNodeCaret=function(t){return t instanceof ol},exports.$isNodeSelection=Kr,exports.$isParagraphNode=li,exports.$isRangeSelection=Rr,exports.$isRootNode=jo,exports.$isRootOrShadowRoot=Ss,exports.$isSiblingCaret=dl,exports.$isTabNode=Ar,exports.$isTextNode=Or,exports.$isTextPointCaret=fl,exports.$isTextPointCaretSlice=function(t){return t instanceof kl},exports.$isTokenOrSegmented=Ei,exports.$isTokenOrTab=Oi,exports.$nodesOfType=function(t){const e=t.getType(),n=No();if(n._readOnly){const t=js(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=Yl,exports.$normalizeSelection__EXPERIMENTAL=xt,exports.$onUpdate=ps,exports.$parseSerializedNode=function(t){return Ao(t,vo()._nodes)},exports.$removeTextFromCaretRange=Ul,exports.$rewindSiblingCaret=zl,exports.$selectAll=function(t){const e=Yi();if(Rr(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"),xt(t),t}{const t=e.select(0,e.getChildrenSize());return ji(xt(t)),t}},exports.$setCompositionKey=Fi,exports.$setDirectionFromDOM=Gs,exports.$setFormatFromDOM=Vs,exports.$setPointFromCaret=Rl,exports.$setSelection=ji,exports.$setSelectionFromCaretRange=Ll,exports.$setState=function(t,e,n){let r;if(So(),"function"==typeof n){const o=t.getLatest(),i=st(o,e);if(r=n(i),e.isEqual(i,r))return o}else r=n;const o=t.getWritable();return at(o).updateFromKnown(e,r),o},exports.$splitAtPointCaretNext=function(t,{$copyElementNode:e=Ts,$splitTextPointCaretNext:n=Vl,rootMode:r="shadowRoot",$shouldSplit:o=ql,removeEmptyDestination:i=!1}={}){if(fl(t))return n(t);const s=t.getParentCaret(r);if(s){const{origin:n}=s;if(hl(t)){const t=zl(s);if(i&&n.isEmpty())return n.remove(),t;if(!n.canBeEmpty()||!o(n,"first"))return t}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||!i&&n.canBeEmpty()&&o(n,"last"))&&s.insert(e(n).splice(0,0,r))}return s},exports.$splitNode=function(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Ss(e)&&t(102);const o=e=>{const n=e.getParentOrThrow(),i=Ss(n),s=e!==r||i?Ts(e):e;if(i)return zo(e)&&zo(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.$updateDOMSelection=lo,exports.$updateRangeSelectionFromCaretRange=Kl,exports.ArtificialNode__DO_NOT_USE=qo,exports.BEFORE_INPUT_COMMAND=_e,exports.BLUR_COMMAND=sn,exports.CAN_REDO_COMMAND=nn,exports.CAN_UNDO_COMMAND=rn,exports.CAN_USE_BEFORE_INPUT=s,exports.CAN_USE_DOM=n,exports.CLEAR_EDITOR_COMMAND=tn,exports.CLEAR_HISTORY_COMMAND=en,exports.CLICK_COMMAND=ge,exports.COLLABORATION_TAG=tr,exports.COMMAND_PRIORITY_BEFORE_CRITICAL=-4,exports.COMMAND_PRIORITY_BEFORE_EDITOR=-8,exports.COMMAND_PRIORITY_BEFORE_HIGH=-5,exports.COMMAND_PRIORITY_BEFORE_LOW=-7,exports.COMMAND_PRIORITY_BEFORE_NORMAL=-6,exports.COMMAND_PRIORITY_CRITICAL=4,exports.COMMAND_PRIORITY_EDITOR=ci,exports.COMMAND_PRIORITY_HIGH=3,exports.COMMAND_PRIORITY_LOW=1,exports.COMMAND_PRIORITY_NORMAL=2,exports.COMPOSITION_END_COMMAND=me,exports.COMPOSITION_END_TAG=ir,exports.COMPOSITION_START_COMMAND=ye,exports.COMPOSITION_START_TAG=or,exports.CONTROLLED_TEXT_INSERTION_COMMAND=Te,exports.COPY_COMMAND=Xe,exports.CUT_COMMAND=Qe,exports.DEFAULT_EDITOR_DOM_CONFIG=fi,exports.DELETE_CHARACTER_COMMAND=xe,exports.DELETE_LINE_COMMAND=Oe,exports.DELETE_WORD_COMMAND=ke,exports.DRAGEND_COMMAND=qe,exports.DRAGOVER_COMMAND=Ve,exports.DRAGSTART_COMMAND=Ge,exports.DROP_COMMAND=He,exports.DecoratorNode=Wo,exports.ElementNode=Bo,exports.FOCUS_COMMAND=on,exports.FORMAT_ELEMENT_COMMAND=Je,exports.FORMAT_TEXT_COMMAND=Ee,exports.HISTORIC_TAG="historic",exports.HISTORY_MERGE_TAG=Zn,exports.HISTORY_PUSH_TAG="history-push",exports.INDENT_CONTENT_COMMAND=Ye,exports.INPUT_COMMAND=pe,exports.INSERT_LINE_BREAK_COMMAND=Ce,exports.INSERT_PARAGRAPH_COMMAND=Se,exports.INSERT_TAB_COMMAND=Ue,exports.INTERNAL_$isBlock=Ls,exports.IS_ALL_FORMATTING=2047,exports.IS_ANDROID=c,exports.IS_ANDROID_CHROME=f,exports.IS_APPLE=o,exports.IS_APPLE_WEBKIT=d,exports.IS_BOLD=1,exports.IS_CHROME=u,exports.IS_CODE=16,exports.IS_FIREFOX=i,exports.IS_HIGHLIGHT=p,exports.IS_IOS=l,exports.IS_ITALIC=2,exports.IS_SAFARI=a,exports.IS_STRIKETHROUGH=4,exports.IS_SUBSCRIPT=32,exports.IS_SUPERSCRIPT=64,exports.IS_UNDERLINE=8,exports.KEY_ARROW_DOWN_COMMAND=Re,exports.KEY_ARROW_LEFT_COMMAND=Ie,exports.KEY_ARROW_RIGHT_COMMAND=De,exports.KEY_ARROW_UP_COMMAND=Fe,exports.KEY_BACKSPACE_COMMAND=Be,exports.KEY_DELETE_COMMAND=$e,exports.KEY_DOWN_COMMAND=Ae,exports.KEY_ENTER_COMMAND=Le,exports.KEY_ESCAPE_COMMAND=ze,exports.KEY_MODIFIER_COMMAND=ln,exports.KEY_SPACE_COMMAND=Ke,exports.KEY_TAB_COMMAND=We,exports.LineBreakNode=Xo,exports.MOVE_TO_END=we,exports.MOVE_TO_START=Pe,exports.NODE_STATE_KEY="$",exports.OUTDENT_CONTENT_COMMAND=je,exports.PASTE_COMMAND=Ne,exports.PASTE_TAG="paste",exports.ParagraphNode=oi,exports.REDO_COMMAND=Me,exports.REMOVE_TEXT_COMMAND=ve,exports.RootNode=Yo,exports.SELECTION_CHANGE_COMMAND=de,exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND=he,exports.SELECT_ALL_COMMAND=Ze,exports.SKIP_COLLAB_TAG="skip-collab",exports.SKIP_DOM_SELECTION_TAG=nr,exports.SKIP_SCROLL_INTO_VIEW_TAG=er,exports.SKIP_SELECTION_FOCUS_TAG=rr,exports.TEXT_TYPE_TO_FORMAT=A,exports.TabNode=br,exports.TextNode=pr,exports.UNDO_COMMAND=be,exports.addClassNamesToElement=function(t,...e){const n=Xl(...e);n.length>0&&t.classList.add(...n)},exports.buildImportMap=function(t){return t},exports.configExtension=function(...t){return t},exports.createCommand=fe,exports.createEditor=function(t){const e=t||{},n=Oo(),r=e.theme||{},o=void 0===t?n:e.parentEditor||null,i=e.disableEvents||!1,s=Jo(),l=e.namespace||(null!==o?o._config.namespace:Vi()),c=e.editorState,a=[Yo,pr,Xo,br,oi,qo,...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}tl(e);const o=e.getType(),i=ui(e);h.set(o,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:lt(a[t]),transforms:i})}}const g=new gi(s,o,h,{disableEvents:i,dom:{...fi,...t&&t.dom},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),function(t){t.registerCommand(_e,Fn,ci),t.registerCommand(pe,Rn,ci),t.registerCommand(ye,Ln,ci),t.registerCommand(me,Kn,ci),t.registerCommand(Ae,zn,ci)}(g),g},exports.createSharedNodeState=lt,exports.createState=function(t,e){return new it(t,e)},exports.declarePeerDependency=function(t,e){return[t,e]},exports.defineExtension=function(t){return t},exports.flipDirection=ll,exports.getDOMOwnerDocument=gs,exports.getDOMSelection=bs,exports.getDOMSelectionFromTarget=Ms,exports.getDOMTextNode=Ai,exports.getEditorPropertyFromDOMNode=ki,exports.getNearestEditorFromDOMNode=vi,exports.getRegisteredNode=xi,exports.getRegisteredNodeOrThrow=mi,exports.getStaticNodeConfig=tl,exports.getStyleObjectFromCSS=lr,exports.getTextDirection=function(t){return b.test(t)?"rtl":M.test(t)?"ltr":null},exports.getTransformSetFromKlass=ui,exports.isBlockDomNode=Rs,exports.isCurrentlyReadOnlyMode=Co,exports.isDOMCapturingSelection=Qs,exports.isDOMDocumentNode=Mi,exports.isDOMNode=Ds,exports.isDOMTextNode=bi,exports.isDOMUnmanaged=Xs,exports.isDocumentFragment=ws,exports.isExactShortcutMatch=ns,exports.isHTMLAnchorElement=function(t){return As(t)&&"A"===t.tagName},exports.isHTMLElement=As,exports.isHTMLTableCellElement=function(t){return As(t)&&("TD"===t.tagName||"TH"===t.tagName)},exports.isHTMLTableRowElement=function(t){return As(t)&&"TR"===t.tagName},exports.isInlineDomNode=Ps,exports.isLastChildInBlockNode=ni,exports.isLexicalEditor=Ni,exports.isModifierMatch=es,exports.isOnlyChildInBlockNode=ei,exports.isSelectionCapturedInDecoratorInput=Si,exports.isSelectionWithinEditor=Ti,exports.makeStepwiseIterator=Ml,exports.mergeRegister=Ql,exports.normalizeClassNames=Xl,exports.removeClassNamesFromElement=function(t,...e){const n=Xl(...e);n.length>0&&t.classList.remove(...n)},exports.removeFromParent=Ii,exports.resetRandomKey=function(){yi=1},exports.safeCast=function(t){return t},exports.setDOMStyleFromCSS=ar,exports.setDOMStyleObject=function(t,e){for(const n in e){const r=e[n];null==r?t.removeProperty(n):cr(t,n,r)}},exports.setDOMUnmanaged=qs,exports.setNodeIndentFromDOM=Js,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},exports.stopLexicalPropagation=Yn,exports.toggleTextFormatType=Di,exports.tokenizeRawText=co;
|