Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lexical

Package Overview
Dependencies
Maintainers
2
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lexical - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

239

Lexical.js
'use strict';const aa=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,ba=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,ca={bold:1,underline:8,strikethrough:4,italic:2,code:16,subscript:32,superscript:64},da={left:1,right:3,center:2,justify:4},ea={normal:0,token:1,segmented:2,
inert:3};function p(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}let fa=!1,ha=0;function ia(a){ha=a.timeStamp}function ja(a){return a.getEditorState().read(()=>{const b=q();return null!==b?b.clone():null})}
function ka(a,b,c){fa=!0;const d=100<performance.now()-ha;try{la(a,()=>{t("onMutation");var e=new Map,f=a.getRootElement(),g=a._editorState,h=!1;for(var l=0;l<b.length;l++){var k=b[l],m=k.type,n=k.target,r=ma(n,g);if(!y(r))if("characterData"===m){if(d&&3===n.nodeType&&A(r)&&r.isAttached()){k=window.getSelection();var u=m=null;null!==k&&k.anchorNode===n&&(m=k.anchorOffset,u=k.focusOffset);pa(r,n.nodeValue,m,u,!1)}}else if("childList"===m){h=!0;m=k.addedNodes;for(u=0;u<m.length;u++){var z=m[u],v=qa(z);
function ka(a,b,c){fa=!0;const d=100<performance.now()-ha;try{la(a,()=>{t("onMutation");var e=new Map,f=a.getRootElement(),g=a._editorState,h=!1;for(var l=0;l<b.length;l++){var k=b[l],m=k.type,n=k.target,r=ma(n,g);if(!y(r))if("characterData"===m){if(d&&3===n.nodeType&&A(r)&&r.isAttached()){k=window.getSelection();var u=m=null;null!==k&&k.anchorNode===n&&(m=k.anchorOffset,u=k.focusOffset);na(r,n.nodeValue,m,u,!1)}}else if("childList"===m){h=!0;m=k.addedNodes;for(u=0;u<m.length;u++){var z=m[u],v=qa(z);
const x=z.parentNode;null!=x&&null===v&&x.removeChild(z)}k=k.removedNodes;m=k.length;if(0<m){u=0;for(z=0;z<m;z++)v=k[z],"BR"!==v.nodeName||n.__lexicalLineBreak!==v&&void 0===v["__lexicalKey_"+a._key]||(n.appendChild(v),u++);m!==u&&(n===f&&(r=ra(g)),e.set(n,r))}}}if(0<e.size)for(e=Array.from(e.entries()),f=0;f<e.length;f++){const [x,w]=e[f];if(B(w))for(g=w.__children,l=x.firstChild,r=0;r<g.length;r++)n=a.getElementByKey(g[r]),null!==n&&(null==l?(x.appendChild(n),l=n):l!==n&&x.replaceChild(n,l),l=l.nextSibling);

@@ -8,134 +8,137 @@ else A(w)&&w.markDirty()}e=c.takeRecords();if(0<e.length){for(f=0;f<e.length;f++)for(l=e[f],g=l.addedNodes,l=l.target,r=0;r<g.length;r++)n=g[r],k=n.parentNode,null!=k&&"BR"===n.nodeName&&l.__lexicalLineBreak!==n&&void 0===n["__lexicalKey_"+a._key]&&k.removeChild(n);c.takeRecords()}h&&(h=q()||ja(a),null!==h&&(h.dirty=!0,sa(h)))},!0)}finally{fa=!1}}function ta(a){const b=a._observer;if(null!==b){const c=b.takeRecords();ka(a,c,b)}}

const va="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,wa=va&&"documentMode"in document?document.documentMode:null,C=va&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xa=va&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ya=va&&"InputEvent"in window&&!wa?"getTargetRanges"in new window.InputEvent("input"):!1;let za=0;const Aa=window.Promise,Ba="function"===typeof queueMicrotask?queueMicrotask:a=>Aa.resolve().then(a);
function Fa(a,b,c){a=a.getRootElement();try{return null!==a&&a.contains(b)&&a.contains(c)&&null!=b&&!y(ma(b))}catch(d){return!1}}function D(a){return a.isToken()||a.isInert()}function Ga(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Ha(a,b,c){b=ca[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ia(a){return A(a)||Ja(a)||y(a)}
function Ka(a){99<La&&p(26);var b=a.getLatest(),c=b.__parent,d=E();const e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;B(a)?d.set(b,!0):e._dirtyLeaves.add(b)}function G(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Ka(b);null!==a&&Ka(a)}
function Ca(a,b,c){a=a.getRootElement();try{return null!==a&&a.contains(b)&&a.contains(c)&&null!=b&&!y(ma(b))}catch(d){return!1}}function D(a){return a.isToken()||a.isInert()}function Ga(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Ha(a,b,c){b=ca[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ia(a){return A(a)||Ja(a)||y(a)||Ka(a)}
function La(a){99<Ma&&p(26);var b=a.getLatest(),c=b.__parent,d=E();const e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;B(a)?d.set(b,!0):e._dirtyLeaves.add(b)}function G(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&La(b);null!==a&&La(a)}
function H(a){I();var b=F();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=J(c),null!==b&&b.getWritable());null!==a&&(a=J(a),null!==a&&a.getWritable())}function K(){return F()._compositionKey}function J(a,b){a=(b||E())._nodeMap.get(a);return void 0===a?null:a}function qa(a,b){const c=F();a=a["__lexicalKey_"+c._key];return void 0!==a?J(a,b):null}function ma(a,b){for(;null!=a;){const c=qa(a,b);if(null!==c)return c;a=a.parentNode}return null}
function Ma(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}function t(a){F()._log.push(a)}function Na(a){return a.read(()=>ra().getTextContent())}function Oa(a,b){la(a,()=>{var c=E();if(!c.isEmpty())if("root"===b)ra().markDirty();else{c=Array.from(c._nodeMap);for(let d=0;d<c.length;d++)c[d][1].markDirty()}},!0,null===a._pendingEditorState?{tag:"without-history"}:void 0)}function ra(a){return(a||E())._nodeMap.get("root")}function sa(a){E()._selection=a}
function Pa(a){var b=F(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?J("root"):null):J(c)}function Qa(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Ra(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
function Sa(a,b){a=window.getSelection();if(null!==a){var {anchorNode:c,anchorOffset:d,focusOffset:e}=a;null!==c&&3===c.nodeType&&(a=ma(c),A(a)&&pa(a,c.nodeValue,d,e,b))}}
function pa(a,b,c,d,e){if(a.isAttached()&&(e||!a.isDirty())){var f=a.isComposing();let g=b;(f||e)&&"\u00a0"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(e||g!==b)""===g?(f&&H(null),a.remove()):(e=a.getParent(),b=Ta(),D(a)||null!==K()&&!f||null!==e&&null!==b&&!e.canInsertTextBefore()&&0===b.anchor.offset?a.markDirty():(f=q(),null!==f&&null!==c&&null!==d&&(f.setTextNodeRange(a,c,a,d),a.isSegmented()&&(c=a.getTextContent(),c=L(c),a.replace(c),a=c)),a.setTextContent(g)))}}
function Ua(a,b,c){var d=a.anchor;const e=a.focus;var f=d.getNode();(b=d.key!==e.key||d.offset!==e.offset&&!f.isComposing()||(c||f.isDirty())&&1<b.length||!A(f)||f.getFormat()!==a.format)||(f.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=f.getParentOrThrow(),d=f.isToken(),a=0===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),f=f.getTextContentSize()===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||f):b=!1);return b}
class Va{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;B(b)&&(b=b.getDescendantByIndex(d));B(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=J(this.key);null===a&&p(5);return a}set(a,b,c){const d=q(),e=this.key;this.key=a;this.offset=b;this.type=
c;M||(K()===e&&H(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function P(a,b,c){return new Va(a,b,c)}function Wa(a,b){const c=b.getKey();let d=a.offset,e="element";A(b)&&(e="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,e)}function Xa(a,b){if(B(b)){const c=b.getLastDescendant();B(c)||A(c)?Wa(a,c):Wa(a,b)}else A(b)&&Wa(a,b)}
function Ya(a,b,c){b=a.getNode();const d=b.getChildAtIndex(a.offset),e=L();e.setFormat(c);null===d?b.append(e):d.insertBefore(e);a.set(e.getKey(),0,"text")}function Q(a,b,c,d){a.key=b;a.offset=c;a.type=d}
class Za{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return null===a?!1:this.anchor.is(a.anchor)&&this.focus.is(a.focus)}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();B(c)&&(c=c.getDescendantByIndex(a.offset));B(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?B(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,b,c,d){Q(this.anchor,
a.__key,b,"text");Q(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,e=this.focus;const f=d.isBefore(e);d=d.getCharacterOffset();e=e.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(B(k))h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,A(k)){let m=k.getTextContent();k===b?m=k===c?d<e?m.slice(d,e):m.slice(e,d):f?m.slice(d):m.slice(e):k===c&&(m=f?m.slice(0,e):m.slice(0,
d));g+=m}else!y(k)&&!Ja(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=F();a=$a(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b);if(null!==a){var [c,d]=a;Q(this.anchor,c.key,c.offset,c.type);Q(this.focus,d.key,d.offset,d.type)}}clone(){const a=this.anchor,b=this.focus;return new Za(P(a.key,a.offset,a.type),P(b.key,b.offset,b.type),this.format)}toggleFormatType(a){this.format=Ha(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&
ca[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const e=b[d];""!==e&&a.push(L(e));d!==c-1&&a.push(ab())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?Ya(b,c,e):d||"element"!==c.type||Ya(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;b=(d?b:c).offset;var l=h.offset;c=f[0];A(c)||p(6);d=c.getTextContent().length;var k=c.getParentOrThrow();
if(!this.isCollapsed()||b!==d||!c.isSegmented()&&!c.isToken()&&c.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==b||!c.isSegmented()&&!c.isToken()&&c.canInsertTextBefore()&&k.canInsertTextBefore())c.isSegmented()&&b!==d&&(k=L(c.getTextContent()),c.replace(k),c=k);else{m=c.getPreviousSibling();if(!A(m)||D(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?c.insertBefore(m):k.insertBefore(m);m.select();c=m;if(""!==a){this.insertText(a);return}}else{var m=c.getNextSibling();if(!A(m)||
D(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?c.insertAfter(m):k.insertAfter(m);m.select(0,0);c=m;if(""!==a){this.insertText(a);return}}if(1===g)if(D(c))c.remove();else{f=c.getFormat();if(b===l&&f!==e)if(""===c.getTextContent())c.setFormat(e);else{f=L(a);f.setFormat(e);f.select();0===b?c.insertBefore(f):([g]=c.splitText(b),g.insertAfter(f));return}c=c.spliceText(b,l-b,a,!0);""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=f[g-
1];e=new Set([...c.getParentKeys(),...k.getParentKeys()]);var n=B(c)?c:c.getParentOrThrow();m=B(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?A(k)&&!D(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,l,""),e.add(k.getKey())):k.remove():e.add(k.getKey());h=m.getChildren();l=new Set(f);const r=n.is(m);if(m.canBeEmpty()||n===m){for(n=h.length-1;0<=n;n--){const u=h[n];
if(u.is(c)||B(u)&&u.isParentOf(c))break;u.isAttached()&&(!l.has(u)||u.is(k)?r||c.insertAfter(u):u.remove())}if(!r)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))e.delete(h.getKey()),l=h;h=h.getParent()}}else n.append(m);D(c)?b===d?c.select():c.remove():(c=c.spliceText(b,d-b,a,!0),""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],c=b.getKey(),e.has(c)||B(b)&&!b.canSelectionRemove()||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=
this.getNodes(),c=b.length-1;let d=b[0],e=b[c];if(this.isCollapsed())this.toggleFormatType(a);else{var f=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(A(n)){k=n.getFormatFlags(a,null);break}}var r=f.offset;n=(m=f.isBefore(g))?r:l;m=m?l:r;if(n===d.getTextContentSize()){const u=d.getNextSibling();A(u)&&(n=r=0,d=u,k=d.getFormatFlags(a,null))}if(d.is(e))A(d)&&("element"===f.type&&"element"===g.type?(d.setFormat(k),d.select(n,m),this.format=
k):(n=r>l?l:r,m=r>l?r:l,n!==m&&(0===n&&m===h?(d.setFormat(k),d.select(n,m)):(a=d.splitText(n,m),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,m-n)),this.format=k)));else for(A(d)&&(0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),f=k,A(e)&&(f=e.getFormatFlags(a,k),k=e.getTextContent().length,0!==m&&(m!==k&&([e]=e.splitText(m)),e.setFormat(f))),k=1;k<c;k++)m=b[k],g=m.getKey(),A(m)&&g!==d.getKey()&&g!==e.getKey()&&!m.isToken()&&(g=m.getFormatFlags(a,f),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||
this.removeText();var c=this.anchor,d=c.offset,e=c.getNode(),f=e;"element"===c.type&&(f=c.getNode(),c=f.getChildAtIndex(d-1),f=null===c?f:c);c=[];var g=e.getNextSiblings(),h=e.getTopLevelElementOrThrow();if(A(e))if(f=e.getTextContent().length,0===d&&0!==f)f=e.getPreviousSibling(),f=null!==f?f:e.getParentOrThrow(),c.push(e);else if(d===f)f=e;else{if(D(e))return!1;[f,e]=e.splitText(d);c.push(e)}e=f;c.push(...g);d=a[0];var l=!1;for(g=0;g<a.length;g++){const n=a[g];if(B(n)){if(n.is(d)){if(B(f)&&f.isEmpty()&&
f.canReplaceWith(n)){f.replace(n);f=n;l=!0;continue}var k=n.getFirstDescendant();if(Ia(k)){k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(B(f))for(let r=0;r<m;r++)f.append(l[r]);else{for(--m;0<=m;m--)f.insertAfter(l[m]);f=f.getParentOrThrow()}k.remove();l=!0;if(k.is(n))continue}}A(f)&&(f=h)}else l&&R(f.getParent())&&p(7);l=!1;if(B(f))if(B(n)){if(n.canBeEmpty()||!n.isEmpty())f=f.insertAfter(n)}else k=f.getFirstChild(),null!==k?k.insertBefore(n):f.append(n),f=n;else B(n)?(f=n.getParentOrThrow(),
g--):f=f.insertAfter(n)}b&&(A(e)?e.select():(a=f.getPreviousSibling(),A(a)?a.select():(a=f.getIndexWithinParent(),f.getParentOrThrow().select(a,a))));if(B(f)){if(a=f.getLastDescendant(),b||(null===a?f.select():A(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],h=a.getParentOrThrow(),B(f)&&!B(a)?(f.append(a),f=a):B(a)&&!a.canInsertAfter(f)?(e=h.constructor.clone(h),B(e)||p(8),e.append(a),f.insertAfter(e)):f.insertAfter(a),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||
(A(f)?f.select():(c=f.getParentOrThrow(),f=f.getIndexWithinParent()+1,c.select(f,f)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var e=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,b]=c.splitText(b),a.push(b))}else e=a.getNode(),a=e.getChildren().slice(b).reverse();b=e.insertNewAfter(this);if(null===b)this.insertLineBreak();else if(B(b)){e=a.length;
c=null;if(0!==e)for(d=0;d<e;d++){const f=a[d];null===c?b.append(f):c.insertBefore(f);c=f}b.canBeEmpty()||0!==b.getChildrenSize()?b.selectStart():(b.selectPrevious(),b.remove())}}insertLineBreak(a){const b=ab();a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const e=this.focus;var f=a[0];let g=a[c];var h=d.getCharacterOffset();const l=e.getCharacterOffset();if(0===b)return[];if(1===b)return A(f)?(a=h>l?l:h,c=f.splitText(a,
h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);A(f)&&(d=b?h:l,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));A(g)&&(f=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==f&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a;var g=d.offset;if("element"===d.type)g=d.getNode().getChildAtIndex(b?g-1:g);else{var h=d.getNode();g=b&&0===g||!b&&g===h.getTextContentSize()?b?h.getPreviousSibling():h.getNextSibling():null}if(y(g)&&
(h=b?g.getPreviousSibling():g.getNextSibling(),!A(h))){a=g.getParentOrThrow().getKey();c=g.getIndexWithinParent();b||c++;d.set(a,c,"element");f&&e.set(a,c,"element");return}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),f||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(f=this.focus,b=this.anchor,d=b.key,e=b.offset,a=b.type,Q(b,f.key,f.offset,f.type),Q(f,d,e,a)))}deleteCharacter(a){if(this.isCollapsed()){var b=
this.anchor,c=this.focus,d=b.getNode();if(B(d)&&!d.canSelectionRemove()||!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==
c||!a&&0!==b){bb(e,a);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){bb(d,a);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;const h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?e.offset=f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();
a=this.anchor;"text"===a.type&&(a=a.getNode(),d=a.getTextContent(),e=this.anchor.offset,0===e&&a.isSimpleText()?(e=a.getPreviousSibling(),A(e)&&"hashtag"===e.getType()&&(e.select(),b=e.getTextContent(),e.setTextContent(b+d),a.remove())):A(a)&&"hashtag"===a.getType()&&e===a.getTextContentSize()&&(e=a.getNextSibling(),A(e)&&e.isSimpleText()&&(b=e.getTextContent(),a.setTextContent(d+b),e.remove())))}deleteLine(a){this.isCollapsed()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&
this.modify("extend",a,"word");this.removeText()}}function bb(a,b){var c=a.getTextContent().split(/\s/g);b?c.pop():c.shift();c=c.join(" ");""===c?a.remove():(a=a.setTextContent(c),b?a.select():a.select(0,0))}
function cb(a,b){if(1===a.nodeType){let e=!1;var c=a.childNodes;var d=c.length;b===d&&(e=!0,b=d-1);c=Pa(c[b]);if(A(c))b=e?c.getTextContentSize():0;else{d=Pa(a);if(null===d)return null;B(d)?(a=d.getChildAtIndex(b),B(a)&&(d=e?a.getLastDescendant():a.getFirstDescendant(),null===d?(d=a,b=0):(a=d,d=a.getParentOrThrow())),A(a)?(c=a,d=null,b=e?c.getTextContentSize():0):a!==d&&e&&b++):(b=d.getIndexWithinParent()+1,d=d.getParentOrThrow());if(R(d))return null;if(B(d))return P(d.__key,b,"element")}}else c=Pa(a);
return A(c)?P(c.__key,b,"text"):null}
function $a(a,b,c,d,e){if(null===a||null===c||!Fa(e,a,c))return null;a=cb(a,b);if(null===a)return null;c=cb(c,d);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const f=c.getNode(),g=d.getTextContentSize(),h=a.offset,l=c.offset;d===f&&h===l?0===b&&(d=d.getPreviousSibling(),A(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):h===g&&(b=d.getNextSibling(),A(b)&&!b.isInert()&&(a.key=b.__key,a.offset=0));b=e.getEditorState()._selection;
e.isComposing()&&e._compositionKey!==a.key&&null!==b&&(e=b.anchor,b=b.focus,Q(a,e.key,e.offset,e.type),Q(c,b.key,b.offset,b.type))}return[a,c]}function db(a,b,c,d,e,f){const g=E();a=new Za(P(a,b,e),P(c,d,f),0);a.dirty=!0;return g._selection=a}
function eb(a){const b=a.getEditorState()._selection;var c=(c=window.event)&&c.type;c=!fa&&("selectionchange"===c||"beforeinput"===c||"compositionstart"===c||"compositionend"===c||"click"===c&&3===window.event.detail||void 0===c);let d,e;if(null===b||c){var f=window.getSelection();if(null===f)return null;c=f.anchorNode;d=f.focusNode;e=f.anchorOffset;f=f.focusOffset}else return a=b.anchor,c=b.focus,new Za(P(a.key,a.offset,a.type),P(c.key,c.offset,c.type),b.format);a=$a(c,e,d,f,a);if(null===a)return null;
const [g,h]=a;return new Za(g,h,null===b?0:b.format)}function q(){return E()._selection}function Ta(){return F()._editorState._selection}
function fb(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.getKey(),a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),gb(a));else{var l=a.isBackward();h=l?f:e;var k=h.getNode();e=l?e:f;f=e.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));gb(a)}}
function gb(a){var b=a.anchor,c=b.offset;const d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())B(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),A(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.getKey(),c,"text"),d.set(g.getKey(),c,"text")));else{if(B(f)){const h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);A(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.getKey(),f,"text"))}B(g)&&(c=g.getChildrenSize(),e=(b=e>=
c)?g.getChildAtIndex(c-1):g.getChildAtIndex(e),A(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.getKey(),g,"text")))}}function hb(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){var c=a.anchor;const d=a.focus;let e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
function ib(a,b,c){let d=null,e=0,f=null;var g=b.getPreviousSibling();null!==g?(d=g.__key,A(g)?(e=g.getTextContentSize(),f="text"):B(g)&&(e=g.getChildrenSize(),f="element")):(g=b.getNextSibling(),null!==g&&(d=g.__key,A(g)?f="text":B(g)&&(f="element")));null!==d&&null!==f?a.set(d,e,f):(e=b.getIndexWithinParent(),a.set(c.__key,e,"element"))}function jb(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
function kb(a,b){I();var c=a.__key;const d=a.getParent();if(null!==d){var e=q(),f=!1;if(null!==e&&b){var g=e.anchor;const h=e.focus;g.key===c&&(ib(g,a,d),f=!0);h.key===c&&(ib(h,a,d),f=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&p(16);G(a);g.splice(c,1);a.getWritable().__parent=null;null!==e&&b&&!f&&fb(e,d,c,-1);null===d||R(d)||d.canBeEmpty()||0!==d.getChildrenSize()||kb(d,b)}}
class lb{static getType(){p(31,this.name)}static clone(){p(32,this.name)}constructor(a){this.__type=this.constructor.getType();if(!a){I();99<La&&p(26);a=F();const b=E(),c=""+za++;b._nodeMap.set(c,this);B(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;a=c}this.__key=a;this.__parent=null}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=J(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=q();
function Na(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}function t(a){F()._log.push(a)}function Oa(a){return a.read(()=>ra().getTextContent())}function Pa(a,b){la(a,()=>{var c=E();if(!c.isEmpty())if("root"===b)ra().markDirty();else{c=Array.from(c._nodeMap);for(let d=0;d<c.length;d++)c[d][1].markDirty()}},!0,null===a._pendingEditorState?{tag:"without-history"}:void 0)}function ra(a){return(a||E())._nodeMap.get("root")}function sa(a){E()._selection=a}
function Qa(a){var b=F(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?J("root"):null):J(c)}function Ra(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Sa(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
function Ta(a,b){a=window.getSelection();if(null!==a){var {anchorNode:c,anchorOffset:d,focusOffset:e}=a;null!==c&&3===c.nodeType&&(a=ma(c),A(a)&&na(a,c.nodeValue,d,e,b))}}
function na(a,b,c,d,e){if(a.isAttached()&&(e||!a.isDirty())){var f=a.isComposing();let g=b;(f||e)&&"\u00a0"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(e||g!==b)""===g?(f&&H(null),a.remove()):(e=a.getParent(),b=Ua(),D(a)||null!==K()&&!f||null!==e&&null!==b&&!e.canInsertTextBefore()&&0===b.anchor.offset?a.markDirty():(f=q(),null!==f&&null!==c&&null!==d&&(f.setTextNodeRange(a,c,a,d),a.isSegmented()&&(c=a.getTextContent(),c=L(c),a.replace(c),a=c)),a.setTextContent(g)))}}
function Va(a,b,c){var d=a.anchor;const e=a.focus;var f=d.getNode();(b=d.key!==e.key||d.offset!==e.offset&&!f.isComposing()||(c||f.isDirty())&&1<b.length||!A(f)||f.getFormat()!==a.format)||(f.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=f.getParentOrThrow(),d=f.isToken(),a=0===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),f=f.getTextContentSize()===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||f):b=!1);return b}
class Wa{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;B(b)&&(b=b.getDescendantByIndex(d));B(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=J(this.key);null===a&&p(5);return a}set(a,b,c){const d=q(),e=this.key;this.key=a;this.offset=b;this.type=
c;M||(K()===e&&H(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function P(a,b,c){return new Wa(a,b,c)}function Xa(a,b){const c=b.getKey();let d=a.offset,e="element";A(b)&&(e="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,e)}function Ya(a,b){if(B(b)){const c=b.getLastDescendant();B(c)||A(c)?Xa(a,c):Xa(a,b)}else A(b)&&Xa(a,b)}
function Za(a,b,c){b=a.getNode();const d=b.getChildAtIndex(a.offset),e=L();e.setFormat(c);null===d?b.append(e):d.insertBefore(e);a.set(e.getKey(),0,"text")}function Q(a,b,c,d){a.key=b;a.offset=c;a.type=d}
class $a{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return null===a?!1:this.anchor.is(a.anchor)&&this.focus.is(a.focus)}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();B(c)&&(c=c.getDescendantByIndex(a.offset));B(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?B(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,b,c,d){Q(this.anchor,
a.__key,b,"text");Q(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,e=this.focus;const f=d.isBefore(e);d=d.getCharacterOffset();e=e.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(B(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,A(k)){let m=k.getTextContent();k===b?m=k===c?d<e?m.slice(d,e):m.slice(e,d):f?m.slice(d):m.slice(e):k===c&&(m=f?m.slice(0,
e):m.slice(0,d));g+=m}else!(y(k)||Ja(k)||Ka(k))||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=F();a=ab(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b);if(null!==a){var [c,d]=a;Q(this.anchor,c.key,c.offset,c.type);Q(this.focus,d.key,d.offset,d.type)}}clone(){const a=this.anchor,b=this.focus;return new $a(P(a.key,a.offset,a.type),P(b.key,b.offset,b.type),this.format)}toggleFormatType(a){this.format=Ha(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==
(this.format&ca[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const e=b[d];""!==e&&a.push(L(e));d!==c-1&&a.push(bb())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?Za(b,c,e):d||"element"!==c.type||Za(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;b=(d?b:c).offset;var l=h.offset;c=f[0];A(c)||p(6);d=c.getTextContent().length;
var k=c.getParentOrThrow();if(!this.isCollapsed()||b!==d||!c.isSegmented()&&!c.isToken()&&c.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==b||!c.isSegmented()&&!c.isToken()&&c.canInsertTextBefore()&&k.canInsertTextBefore())c.isSegmented()&&b!==d&&(k=L(c.getTextContent()),c.replace(k),c=k);else{m=c.getPreviousSibling();if(!A(m)||D(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?c.insertBefore(m):k.insertBefore(m);m.select();c=m;if(""!==a){this.insertText(a);return}}else{var m=
c.getNextSibling();if(!A(m)||D(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?c.insertAfter(m):k.insertAfter(m);m.select(0,0);c=m;if(""!==a){this.insertText(a);return}}if(1===g)if(D(c))c.remove();else{f=c.getFormat();if(b===l&&f!==e)if(""===c.getTextContent())c.setFormat(e);else{f=L(a);f.setFormat(e);f.select();0===b?c.insertBefore(f):([g]=c.splitText(b),g.insertAfter(f));return}c=c.spliceText(b,l-b,a,!0);""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
a.length)}else{k=f[g-1];e=new Set([...c.getParentKeys(),...k.getParentKeys()]);var n=B(c)?c:c.getParentOrThrow();m=B(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?A(k)&&!D(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,l,""),e.add(k.getKey())):k.remove():e.add(k.getKey());h=m.getChildren();l=new Set(f);const r=n.is(m);if(m.canBeEmpty()||n===m){for(n=h.length-
1;0<=n;n--){const u=h[n];if(u.is(c)||B(u)&&u.isParentOf(c))break;u.isAttached()&&(!l.has(u)||u.is(k)?r||c.insertAfter(u):u.remove())}if(!r)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))e.delete(h.getKey()),l=h;h=h.getParent()}}else n.append(m);D(c)?b===d?c.select():c.remove():(c=c.spliceText(b,d-b,a,!0),""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],c=b.getKey(),e.has(c)||B(b)&&!b.canSelectionRemove()||
b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],e=b[c];if(this.isCollapsed())this.toggleFormatType(a);else{var f=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(A(n)){k=n.getFormatFlags(a,null);break}}var r=f.offset;n=(m=f.isBefore(g))?r:l;m=m?l:r;if(n===d.getTextContentSize()){const u=d.getNextSibling();A(u)&&(n=r=0,d=u,k=d.getFormatFlags(a,null))}if(d.is(e))A(d)&&("element"===
f.type&&"element"===g.type?(d.setFormat(k),d.select(n,m),this.format=k):(n=r>l?l:r,m=r>l?r:l,n!==m&&(0===n&&m===h?(d.setFormat(k),d.select(n,m)):(a=d.splitText(n,m),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,m-n)),this.format=k)));else for(A(d)&&(0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),f=k,A(e)&&(f=e.getFormatFlags(a,k),k=e.getTextContent().length,0!==m&&(m!==k&&([e]=e.splitText(m)),e.setFormat(f))),k=1;k<c;k++)m=b[k],g=m.getKey(),A(m)&&g!==d.getKey()&&g!==e.getKey()&&!m.isToken()&&(g=m.getFormatFlags(a,
f),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,e=c.getNode(),f=e;"element"===c.type&&(f=c.getNode(),c=f.getChildAtIndex(d-1),f=null===c?f:c);c=[];var g=e.getNextSiblings(),h=e.getTopLevelElementOrThrow();if(A(e))if(f=e.getTextContent().length,0===d&&0!==f)f=e.getPreviousSibling(),f=null!==f?f:e.getParentOrThrow(),c.push(e);else if(d===f)f=e;else{if(D(e))return!1;[f,e]=e.splitText(d);c.push(e)}e=f;c.push(...g);d=a[0];var l=!1;for(g=0;g<a.length;g++){const n=
a[g];if(B(n)){if(n.is(d)){if(B(f)&&f.isEmpty()&&f.canReplaceWith(n)){f.replace(n);f=n;l=!0;continue}var k=n.getFirstDescendant();if(Ia(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(B(f))for(let r=0;r<m;r++)f.append(l[r]);else{for(--m;0<=m;m--)f.insertAfter(l[m]);f=f.getParentOrThrow()}k.remove();l=!0;if(k.is(n))continue}}A(f)&&(f=h)}else l&&R(f.getParent())&&p(7);l=!1;if(B(f))if(B(n)){if(n.canBeEmpty()||!n.isEmpty())f=f.insertAfter(n)}else k=
f.getFirstChild(),null!==k?k.insertBefore(n):f.append(n),f=n;else B(n)?(f=n.getParentOrThrow(),g--):f=f.insertAfter(n)}b&&(A(e)?e.select():(a=f.getPreviousSibling(),A(a)?a.select():(a=f.getIndexWithinParent(),f.getParentOrThrow().select(a,a))));if(B(f)){if(a=f.getLastDescendant(),b||(null===a?f.select():A(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],h=a.getParentOrThrow(),B(f)&&!B(a)?(f.append(a),f=a):B(a)&&!a.canInsertAfter(f)?(e=h.constructor.clone(h),B(e)||p(8),e.append(a),
f.insertAfter(e)):f.insertAfter(a),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(A(f)?f.select():(c=f.getParentOrThrow(),f=f.getIndexWithinParent()+1,c.select(f,f)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var e=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,b]=c.splitText(b),a.push(b))}else e=a.getNode(),a=e.getChildren().slice(b).reverse();b=
e.insertNewAfter(this);if(null===b)this.insertLineBreak();else if(B(b)){e=a.length;c=null;if(0!==e)for(d=0;d<e;d++){const f=a[d];null===c?b.append(f):c.insertBefore(f);c=f}b.canBeEmpty()||0!==b.getChildrenSize()?b.selectStart():(b.selectPrevious(),b.remove())}}insertLineBreak(a){const b=bb();a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const e=this.focus;var f=a[0];let g=a[c];var h=d.getCharacterOffset();const l=
e.getCharacterOffset();if(0===b)return[];if(1===b)return A(f)?(a=h>l?l:h,c=f.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);A(f)&&(d=b?h:l,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));A(g)&&(f=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==f&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a;var g=d.offset;if("element"===d.type)g=d.getNode().getChildAtIndex(b?g-1:g);else{var h=d.getNode();g=
b&&0===g||!b&&g===h.getTextContentSize()?b?h.getPreviousSibling():h.getNextSibling():null}if(y(g)&&(h=b?g.getPreviousSibling():g.getNextSibling(),!A(h))){a=g.getParentOrThrow().getKey();c=g.getIndexWithinParent();b||c++;d.set(a,c,"element");f&&e.set(a,c,"element");return}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),f||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(f=this.focus,b=this.anchor,d=b.key,e=b.offset,
a=b.type,Q(b,f.key,f.offset,f.type),Q(f,d,e,a)))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(B(d)&&!d.canSelectionRemove()||!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():
null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){cb(e,a);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){cb(d,a);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;const h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?e.offset=f:d.offset=
f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();a=this.anchor;"text"===a.type&&(a=a.getNode(),d=a.getTextContent(),e=this.anchor.offset,0===e&&a.isSimpleText()?(e=a.getPreviousSibling(),A(e)&&"hashtag"===e.getType()&&(e.select(),b=e.getTextContent(),e.setTextContent(b+d),a.remove())):A(a)&&"hashtag"===a.getType()&&e===a.getTextContentSize()&&(e=a.getNextSibling(),A(e)&&e.isSimpleText()&&(b=e.getTextContent(),
a.setTextContent(d+b),e.remove())))}deleteLine(a){this.isCollapsed()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function cb(a,b){var c=a.getTextContent().split(/\s/g);b?c.pop():c.shift();c=c.join(" ");""===c?a.remove():(a=a.setTextContent(c),b?a.select():a.select(0,0))}
function db(a,b){if(1===a.nodeType){let e=!1;var c=a.childNodes;var d=c.length;b===d&&(e=!0,b=d-1);c=Qa(c[b]);if(A(c))b=e?c.getTextContentSize():0;else{if(Ka(c))return P(c.__key,0,"element");d=Qa(a);if(null===d)return null;B(d)?(a=d.getChildAtIndex(b),B(a)&&(d=e?a.getLastDescendant():a.getFirstDescendant(),null===d?(d=a,b=0):(a=d,d=a.getParentOrThrow())),A(a)?(c=a,d=null,b=e?c.getTextContentSize():0):a!==d&&e&&b++):(b=d.getIndexWithinParent()+1,d=d.getParentOrThrow());if(R(d))return null;if(B(d))return P(d.__key,
b,"element")}}else c=Qa(a);return A(c)?P(c.__key,b,"text"):null}
function ab(a,b,c,d,e){if(null===a||null===c||!Ca(e,a,c))return null;a=db(a,b);if(null===a)return null;c=db(c,d);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const f=c.getNode(),g=d.getTextContentSize(),h=a.offset,l=c.offset;d===f&&h===l?0===b&&(d=d.getPreviousSibling(),A(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):h===g&&(b=d.getNextSibling(),A(b)&&!b.isInert()&&(a.key=b.__key,a.offset=0));b=e.getEditorState()._selection;
e.isComposing()&&e._compositionKey!==a.key&&null!==b&&(e=b.anchor,b=b.focus,Q(a,e.key,e.offset,e.type),Q(c,b.key,b.offset,b.type))}return[a,c]}function eb(a,b,c,d,e,f){const g=E();a=new $a(P(a,b,e),P(c,d,f),0);a.dirty=!0;return g._selection=a}
function fb(a){const b=a.getEditorState()._selection;var c=(c=window.event)&&c.type;c=!fa&&("selectionchange"===c||"beforeinput"===c||"compositionstart"===c||"compositionend"===c||"click"===c&&3===window.event.detail||void 0===c);let d,e;if(null===b||c){var f=window.getSelection();if(null===f)return null;c=f.anchorNode;d=f.focusNode;e=f.anchorOffset;f=f.focusOffset}else return a=b.anchor,c=b.focus,new $a(P(a.key,a.offset,a.type),P(c.key,c.offset,c.type),b.format);a=ab(c,e,d,f,a);if(null===a)return null;
const [g,h]=a;return new $a(g,h,null===b?0:b.format)}function q(){return E()._selection}function Ua(){return F()._editorState._selection}
function gb(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.getKey(),a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),hb(a));else{var l=a.isBackward();h=l?f:e;var k=h.getNode();e=l?e:f;f=e.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));hb(a)}}
function hb(a){var b=a.anchor,c=b.offset;const d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())B(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),A(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.getKey(),c,"text"),d.set(g.getKey(),c,"text")));else{if(B(f)){const h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);A(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.getKey(),f,"text"))}B(g)&&(c=g.getChildrenSize(),e=(b=e>=
c)?g.getChildAtIndex(c-1):g.getChildAtIndex(e),A(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.getKey(),g,"text")))}}function ib(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){var c=a.anchor;const d=a.focus;let e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
function jb(a,b,c){let d=null,e=0,f=null;var g=b.getPreviousSibling();null!==g?(d=g.__key,A(g)?(e=g.getTextContentSize(),f="text"):B(g)&&(e=g.getChildrenSize(),f="element")):(g=b.getNextSibling(),null!==g&&(d=g.__key,A(g)?f="text":B(g)&&(f="element")));null!==d&&null!==f?a.set(d,e,f):(e=b.getIndexWithinParent(),a.set(c.__key,e,"element"))}function kb(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
function lb(a,b){I();var c=a.__key;const d=a.getParent();if(null!==d){var e=q(),f=!1;if(null!==e&&b){var g=e.anchor;const h=e.focus;g.key===c&&(jb(g,a,d),f=!0);h.key===c&&(jb(h,a,d),f=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&p(16);G(a);g.splice(c,1);a.getWritable().__parent=null;null!==e&&b&&!f&&gb(e,d,c,-1);null===d||R(d)||d.canBeEmpty()||0!==d.getChildrenSize()||lb(d,b)}}
class mb{static getType(){p(31,this.name)}static clone(){p(32,this.name)}constructor(a){this.__type=this.constructor.getType();if(!a){I();99<Ma&&p(26);a=F();const b=E(),c=""+za++;b._nodeMap.set(c,this);B(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;a=c}this.__key=a;this.__parent=null}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=J(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=q();
if(null==a)return!1;const b=(new Set(a.getNodes().map(c=>c.__key))).has(this.__key);return A(this)?b:"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){const a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){const a=this.getLatest().__parent;return null===a?null:J(a)}getParentOrThrow(){const a=this.getParent();null===a&&p(33,this.__key);return a}getTopLevelElement(){let a=
this;for(;null!==a;){const b=a.getParent();if(R(b)&&B(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&p(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
b?null:J(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>mb(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:J(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>mb(c))}getCommonAncestor(a){const b=this.getParents();var c=
b?null:J(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>nb(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:J(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>nb(c))}getCommonAncestor(a){const b=this.getParents();var c=
a.getParents();B(this)&&b.unshift(this);B(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){const e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.getKey()===a.getKey()}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===
b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){const b=this.isBefore(a),c=[],d=new Set;var e=this;let f=null;for(;;){var g=e.__key;d.has(g)||(d.add(g),c.push(e));if(e===a)break;g=B(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==g)null===f&&(f=e),e=g;else if(g=b?e.getNextSibling():e.getPreviousSibling(),null!==g)e=g;else{g=e.getParentOrThrow();
d.has(g.__key)||c.push(g);if(g===a)break;e=g;g.is(f)&&(f=null);do null===e&&p(35),g=b?e.getNextSibling():e.getPreviousSibling(),e=e.getParent(),null!==e&&(e.is(f)&&(f=null),null!==g||d.has(e.__key)||c.push(e));while(null===g);e=g}}b||c.reverse();return c}isDirty(){const a=F()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===K()}getLatest(){const a=J(this.__key);null===a&&p(36);return a}getWritable(){I();var a=E(),b=F();a=a._nodeMap;const c=this.__key,d=this.getLatest(),
e=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return Ka(d),d;const f=d.constructor.clone(d);f.__parent=e;B(d)&&B(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):A(d)&&A(f)?(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail):y(d)&&y(f)&&(f.__state=d.__state);b.add(c);f.__key=c;Ka(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){p(37)}updateDOM(){p(38)}remove(){I();
kb(this,!0)}replace(a){I();const b=this.__key;a=a.getWritable();var c=a.getParent();if(null!==c){c=c.getWritable().__children;var d=c.indexOf(a.__key);-1===d&&p(16);G(a);c.splice(d,1)}d=this.getParentOrThrow();var e=d.getWritable().__children;const f=e.indexOf(this.__key);c=a.__key;-1===f&&p(16);e.splice(f,0,c);a.__parent=d.__key;kb(this,!1);G(a);e=q();null!==e&&(d=e.anchor,e=e.focus,d.key===b&&Xa(d,a),e.key===b&&Xa(e,a));K()===b&&H(c);return a}insertAfter(a){I();var b=this.getWritable(),c=a.getWritable(),
d=c.getParent();const e=q();var f=!1,g=!1;if(null!==d){var h=d.getWritable().__children,l=h.indexOf(c.__key);-1===l&&p(16);G(c);if(null!==e){g=d.getKey();d=a.getIndexWithinParent();f=e.anchor;const k=e.focus;f="element"===f.type&&f.key===g&&f.offset===d+1;g="element"===k.type&&k.key===g&&k.offset===d+1}h.splice(l,1)}h=this.getParentOrThrow().getWritable();l=c.__key;c.__parent=b.__parent;d=h.__children;b=d.indexOf(b.__key);-1===b&&p(16);d.splice(b+1,0,l);G(c);null!==e&&(fb(e,h,b+1),c=h.getKey(),f&&
e.anchor.set(c,b+2,"element"),g&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){I();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();if(null!==d){d=d.getWritable().__children;var e=d.indexOf(c.__key);-1===e&&p(16);G(c);d.splice(e,1)}d=this.getParentOrThrow().getWritable();e=c.__key;c.__parent=b.__parent;const f=d.__children;b=f.indexOf(b.__key);-1===b&&p(16);f.splice(b,0,e);G(c);c=q();null!==c&&fb(c,d,b);return a}selectPrevious(a,b){I();const c=this.getPreviousSibling(),d=this.getParentOrThrow();
return null===c?d.select(0,0):B(c)?c.select():A(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();const c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):A(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function mb(a){const b=J(a);null===b&&p(39,a);return b}
class nb extends lb{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=J(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
e=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return La(d),d;const f=d.constructor.clone(d);f.__parent=e;B(d)&&B(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):A(d)&&A(f)?(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail):y(d)&&y(f)&&(f.__state=d.__state);b.add(c);f.__key=c;La(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){p(37)}updateDOM(){p(38)}remove(){I();
lb(this,!0)}replace(a){I();const b=this.__key;a=a.getWritable();var c=a.getParent();if(null!==c){c=c.getWritable().__children;var d=c.indexOf(a.__key);-1===d&&p(16);G(a);c.splice(d,1)}d=this.getParentOrThrow();var e=d.getWritable().__children;const f=e.indexOf(this.__key);c=a.__key;-1===f&&p(16);e.splice(f,0,c);a.__parent=d.__key;lb(this,!1);G(a);e=q();null!==e&&(d=e.anchor,e=e.focus,d.key===b&&Ya(d,a),e.key===b&&Ya(e,a));K()===b&&H(c);return a}insertAfter(a){I();var b=this.getWritable(),c=a.getWritable(),
d=c.getParent();const e=q();var f=!1,g=!1;if(null!==d){var h=d.getWritable().__children,l=h.indexOf(c.__key);-1===l&&p(16);G(c);if(null!==e){g=d.getKey();d=a.getIndexWithinParent();f=e.anchor;const k=e.focus;f="element"===f.type&&f.key===g&&f.offset===d+1;g="element"===k.type&&k.key===g&&k.offset===d+1}h.splice(l,1)}h=this.getParentOrThrow().getWritable();l=c.__key;c.__parent=b.__parent;d=h.__children;b=d.indexOf(b.__key);-1===b&&p(16);d.splice(b+1,0,l);G(c);null!==e&&(gb(e,h,b+1),c=h.getKey(),f&&
e.anchor.set(c,b+2,"element"),g&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){I();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();if(null!==d){d=d.getWritable().__children;var e=d.indexOf(c.__key);-1===e&&p(16);G(c);d.splice(e,1)}d=this.getParentOrThrow().getWritable();e=c.__key;c.__parent=b.__parent;const f=d.__children;b=f.indexOf(b.__key);-1===b&&p(16);f.splice(b,0,e);G(c);c=q();null!==c&&gb(c,d,b);return a}selectPrevious(a,b){I();const c=this.getPreviousSibling(),d=this.getParentOrThrow();
return null===c?d.select(0,0):B(c)?c.select():A(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();const c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):A(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function nb(a){const b=J(a);null===b&&p(39,a);return b}
class ob extends mb{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=J(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
F()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let e=0;e<c.length;e++){var d=J(c[e]);!A(d)||!a&&d.isInert()?B(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(B(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(B(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],B(a)&&a.getLastDescendant()||a;a=b[a];return B(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:J(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&p(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,b=a.length;return 0===b?null:J(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:J(a)}getTextContent(a,
b){let c="";const d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){const g=d[f];c+=g.getTextContent(a,b);B(g)&&f!==e-1&&(c+="\n\n")}return c}getDirection(){return this.__dir}hasFormat(a){a=da[a];return 0!==(this.getFormat()&a)}select(a,b){I();const c=q();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(null===c)return db(d,a,d,b,"element","element");c.anchor.set(d,a,"element");c.focus.set(d,b,"element");c.dirty=!0;return c}selectStart(){const a=this.getFirstDescendant();
return B(a)||A(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return B(a)||A(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();const b=this.getWritable(),c=b.__key,d=b.__children,e=a.length;var f=this.getLastChild();null!==f&&Ka(f);for(f=0;f<e;f++){var g=a[f];g.__key===c&&p(49);g=g.getWritable();var h=g.getParent();if(null!==h){h=
b){let c="";const d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){const g=d[f];c+=g.getTextContent(a,b);B(g)&&f!==e-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.__dir}hasFormat(a){a=da[a];return 0!==(this.getFormat()&a)}select(a,b){I();const c=q();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(null===c)return eb(d,a,d,b,"element","element");c.anchor.set(d,a,"element");c.focus.set(d,b,"element");c.dirty=!0;return c}selectStart(){const a=this.getFirstDescendant();
return B(a)||A(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return B(a)||A(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();const b=this.getWritable(),c=b.__key,d=b.__children,e=a.length;var f=this.getLastChild();null!==f&&La(f);for(f=0;f<e;f++){var g=a[f];g.__key===c&&p(49);g=g.getWritable();var h=g.getParent();if(null!==h){h=
h.getWritable().__children;const l=h.indexOf(g.__key);-1===l&&p(16);h.splice(l,1)}g.__parent=c;d.push(g.__key)}return b}setDirection(a){I();const b=this.getWritable();b.__dir=a;return b}setFormat(a){I();this.getWritable().__format=da[a];return this}setIndent(a){I();this.getWritable().__indent=a;return this}insertNewAfter(){return null}canInsertTab(){return!1}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canSelectionRemove(){return!0}canMergeWith(){return!1}}
function B(a){return a instanceof nb}
class ob{constructor(a,b){this.id=a||Ra();this.editorState=b||null;this.editor=null}init(a){let b=this.editorState;"string"===typeof b&&(this.editorState=b=a.parseEditorState(b),null!==b&&a.setEditorState(b,{tag:"without-history"}))}set(a){this.editor=a;this.editorState=a.getEditorState()}toJSON(){const a=this.editorState;return{id:this.id,type:"editor",editorState:null===a||"string"===typeof a?a:JSON.stringify(a.toJSON())}}isEmpty(){return null===this.editorState}}
function pb(a,b){return new ob(a,b)}class qb{constructor(a,b){this._editor=a;this._observers=new Set;this._map=b||new Map}get(a){return this._map.get(a)}has(a){return this._map.has(a)}set(a,b){this._map.set(a,b);const c=Array.from(this._observers);for(let d=0;d<c.length;d++)c[d](a,b)}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}destroy(){this._observers.clear()}toJSON(){return{type:"map",map:Array.from(this._map.entries())}}}function rb(a,b){return new qb(a,b)}
class sb extends lb{constructor(a,b){super(b);b=F();this.__state=a||rb(b)}decorate(){p(4)}}function y(a){return a instanceof sb}
class tb extends nb{static getType(){return"root"}static clone(){return new tb}constructor(){super("root");this.__cachedText=null}getTextContent(a,b){const c=this.__cachedText;return!M&&0!==F()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}select(){p(9)}remove(){p(10)}replace(){p(11)}insertBefore(){p(12)}insertAfter(){p(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];B(c)||y(c)||p(46)}return super.append(...a)}canBeEmpty(){return!1}}
function R(a){return a instanceof tb}function ub(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function vb(){return new wb(new Map([["root",new tb]]))}
class wb{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=S,d=M,e=T;S=this;M=!0;T=null;try{var b=a();break a}finally{S=c,M=d,T=e}b=void 0}return b}clone(a){a=new wb(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:null===a?null:{anchor:{key:a.anchor.key,offset:a.anchor.offset,
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type}}}}}let U="",V="",W="",xb,X,yb=!1,zb=!1,Ab=null,Bb,Cb,Db,Eb,Fb;function Gb(a,b){const c=Db.get(a);if(null!==b){const d=Hb(a);b.removeChild(d)}Eb.has(a)||X._keyToDOMMap.delete(a);B(c)&&(a=c.__children,Ib(a,0,a.length-1,null))}function Ib(a,b,c,d){for(;b<=c;++b){const e=a[b];void 0!==e&&Gb(e,d)}}function Jb(a,b){a.setProperty("text-align",b)}
function Kb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}function Lb(a,b){a=a.style;0===b?Jb(a,""):1===b?Jb(a,"left"):2===b?Jb(a,"center"):3===b?Jb(a,"right"):4===b&&Jb(a,"justify")}
function Mb(a,b,c){var d=Eb.get(a);void 0===d&&p(42);const e=d.createDOM(xb,X);var f=X._keyToDOMMap;e["__lexicalKey_"+X._key]=a;f.set(a,e);A(d)?e.setAttribute("data-lexical-text","true"):y(d)&&e.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&Kb(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;const h=V;V="";Nb(f,0,g,e,null);Ob(d,e);V=h}d=d.__format;0!==d&&Lb(e,d);Pb(null,a,e)}else y(d)?(f=d.decorate(X),d=d.getTextContent(),null!==f&&Qb(a,f),e.contentEditable="false",
U+=d,W+=d):(a=d.getTextContent(),A(d)&&(d.isDirectionless()||(V+=a),d.isInert()&&(d=e.style,d.pointerEvents="none",d.userSelect="none",e.contentEditable="false",d.setProperty("-webkit-user-select","none"))),U+=a,W+=a);null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));return e}function Nb(a,b,c,d,e){const f=U;for(U="";b<=c;++b)Mb(a[b],d,e);d.__lexicalTextContent=U;U=f+U}function Rb(a,b){a=b.get(a[a.length-1]);return Ja(a)||y(a)}
function Pb(a,b,c){a=null!==a&&(0===a.length||Rb(a,Db));b=null!==b&&(0===b.length||Rb(b,Eb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
function Ob(a,b){const c=b.__lexicalDir;if(b.__lexicalDirTextContent!==V||c!==Ab){var d=""===V;if(d)var e=Ab;else e=V,e=aa.test(e)?"rtl":ba.test(e)?"ltr":null;if(e!==c){const f=b.classList,g=xb.theme;null===e||d&&"ltr"===e?(b.removeAttribute("dir"),d=g[c],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.remove(...d))):null!==e&&(d=g[e],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.add(...d)),b.dir=e);zb||(a.getWritable().__dir=e)}Ab=e;b.__lexicalDirTextContent=V;b.__lexicalDir=
function B(a){return a instanceof ob}
class pb{constructor(a,b){this.id=a||Sa();this.editorState=b||null;this.editor=null}init(a){let b=this.editorState;"string"===typeof b&&(this.editorState=b=a.parseEditorState(b),null!==b&&a.setEditorState(b,{tag:"without-history"}))}set(a){this.editor=a;this.editorState=a.getEditorState()}toJSON(){const a=this.editorState;return{id:this.id,type:"editor",editorState:null===a||"string"===typeof a?a:JSON.stringify(a.toJSON())}}isEmpty(){return null===this.editorState}}
function qb(a,b){return new pb(a,b)}class rb{constructor(a,b){this._editor=a;this._observers=new Set;this._map=b||new Map}get(a){return this._map.get(a)}has(a){return this._map.has(a)}set(a,b){this._map.set(a,b);const c=Array.from(this._observers);for(let d=0;d<c.length;d++)c[d](a,b)}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}destroy(){this._observers.clear()}toJSON(){return{type:"map",map:Array.from(this._map.entries())}}}function sb(a,b){return new rb(a,b)}
class tb extends mb{constructor(a,b){super(b);b=F();this.__state=a||sb(b)}decorate(){p(4)}}function y(a){return a instanceof tb}
class ub extends ob{static getType(){return"root"}static clone(){return new ub}constructor(){super("root");this.__cachedText=null}getTextContent(a,b){const c=this.__cachedText;return!M&&0!==F()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}select(){p(9)}remove(){p(10)}replace(){p(11)}insertBefore(){p(12)}insertAfter(){p(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];B(c)||y(c)||p(46)}return super.append(...a)}canBeEmpty(){return!1}}
function R(a){return a instanceof ub}function vb(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function wb(){return new xb(new Map([["root",new ub]]))}
class xb{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=S,d=M,e=T;S=this;M=!0;T=null;try{var b=a();break a}finally{S=c,M=d,T=e}b=void 0}return b}clone(a){a=new xb(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:null===a?null:{anchor:{key:a.anchor.key,offset:a.anchor.offset,
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type}}}}}let U="",V="",W="",yb,X,zb=!1,Ab=!1,Bb=null,Cb,Db,Eb,Fb,Gb;function Hb(a,b){const c=Eb.get(a);if(null!==b){const d=Ib(a);b.removeChild(d)}Fb.has(a)||X._keyToDOMMap.delete(a);B(c)&&(a=c.__children,Jb(a,0,a.length-1,null))}function Jb(a,b,c,d){for(;b<=c;++b){const e=a[b];void 0!==e&&Hb(e,d)}}function Kb(a,b){a.setProperty("text-align",b)}
function Lb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}function Mb(a,b){a=a.style;0===b?Kb(a,""):1===b?Kb(a,"left"):2===b?Kb(a,"center"):3===b?Kb(a,"right"):4===b&&Kb(a,"justify")}
function Nb(a,b,c){var d=Fb.get(a);void 0===d&&p(42);const e=d.createDOM(yb,X);var f=X._keyToDOMMap;e["__lexicalKey_"+X._key]=a;f.set(a,e);A(d)?e.setAttribute("data-lexical-text","true"):y(d)&&e.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&Lb(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;const h=V;V="";Ob(f,0,g,e,null);Pb(d,e);V=h}d=d.__format;0!==d&&Mb(e,d);Qb(null,a,e)}else y(d)?(f=d.decorate(X),d=d.getTextContent(),null!==f&&Rb(a,f),e.contentEditable="false",
U+=d,W+=d):(a=d.getTextContent(),A(d)&&(d.isDirectionless()||(V+=a),d.isInert()&&(d=e.style,d.pointerEvents="none",d.userSelect="none",e.contentEditable="false",d.setProperty("-webkit-user-select","none"))),U+=a,W+=a);null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));return e}function Ob(a,b,c,d,e){const f=U;for(U="";b<=c;++b)Nb(a[b],d,e);d.__lexicalTextContent=U;U=f+U}function Sb(a,b){a=b.get(a[a.length-1]);return Ja(a)||y(a)}
function Qb(a,b,c){a=null!==a&&(0===a.length||Sb(a,Eb));b=null!==b&&(0===b.length||Sb(b,Fb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
function Pb(a,b){const c=b.__lexicalDir;if(b.__lexicalDirTextContent!==V||c!==Bb){var d=""===V;if(d)var e=Bb;else e=V,e=aa.test(e)?"rtl":ba.test(e)?"ltr":null;if(e!==c){const f=b.classList,g=yb.theme;null===e||d&&"ltr"===e?(b.removeAttribute("dir"),d=g[c],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.remove(...d))):null!==e&&(d=g[e],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.add(...d)),b.dir=e);Ab||(a.getWritable().__dir=e)}Bb=e;b.__lexicalDirTextContent=V;b.__lexicalDir=
e}}
function Sb(a,b){var c=Db.get(a),d=Eb.get(a);void 0!==c&&void 0!==d||p(43);var e=yb||Cb.has(a)||Bb.has(a);const f=Tb(X,a);if(c===d&&!e)return B(c)?(d=f.__lexicalTextContent,void 0!==d&&(U+=d,W+=d),d=f.__lexicalDirTextContent,void 0!==d&&(V+=d)):y(c)||(d=c.getTextContent(),A(c)&&!c.isDirectionless()&&(V+=d),W+=d,U+=d),f;if(d.updateDOM(c,f,xb))return d=Mb(a,null,null),null===b&&p(44),b.replaceChild(d,f),Gb(a,null),d;if(B(c)&&B(d)){if(a=d.__indent,a!==c.__indent&&Kb(f,a),a=d.__format,a!==c.__format&&Lb(f,
a),c=c.__children,a=d.__children,c!==a||e){var g=c,h=a;e=d;b=V;V="";const u=U;U="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Sb(m,f);else{var n=Hb(m);h=Mb(h,null,null);f.replaceChild(h,n);Gb(m,null)}}else if(0===l)0!==k&&Nb(h,0,k-1,f,null);else if(0===k)0!==l&&(m=null==f.__lexicalLineBreak,Ib(g,0,l-1,m?null:f),m&&(f.textContent=""));else{const z=l-1;l=k-1;let v=f.firstChild,x=0;for(k=0;x<=z&&k<=l;){var r=g[x];const w=h[k];if(r===w)v=Sb(w,f).nextSibling,x++,k++;else{void 0===
m&&(m=new Set(g));void 0===n&&(n=new Set(h));const N=n.has(r),Ca=m.has(w);N?(Ca?(r=Tb(X,w),r===v?v=Sb(w,f).nextSibling:(null!=v?f.insertBefore(r,v):f.appendChild(r),Sb(w,f)),x++):Mb(w,f,v),k++):(v=Hb(r).nextSibling,Gb(r,f),x++)}}m=x>z;n=k>l;m&&!n?(m=h[l+1],m=void 0===m?null:X.getElementByKey(m),Nb(h,k,l,f,m)):n&&!m&&Ib(g,x,z,f)}f.__lexicalTextContent=U;U=u+U;Ob(e,f);V=b;R(d)||Pb(c,a,f)}}else y(d)?(c=d.decorate(X),null!==c&&Qb(a,c)):(c=d.getTextContent(),A(d)&&!d.isDirectionless()&&(V+=c),U+=c,W+=
c);!zb&&R(d)&&d.__cachedText!==W&&(d=d.getWritable(),d.__cachedText=W);return f}function Qb(a,b){let c=X._pendingDecorators;const d=X._decorators;if(null===c){if(d[a]===b)return;c=Ma(X)}c[a]=b}function Hb(a){a=Fb.get(a);void 0===a&&p(45);return a}function Tb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&p(45);return a}function Ub(a,b,c,d,e){a=a.__children;const f=a.length;for(let g=0;g<f;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(B(l)&&Ub(l,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}
function Zb(a,b,c,d){var e=Array.from(c),f=e.length;const g=Array.from(d),h=g.length;a=a._nodeMap;b=b._nodeMap;for(let l=0;l<f;l++){const k=e[l],m=b.get(k);void 0===m||m.isAttached()||(a.has(k)||c.delete(k),b.delete(k))}for(c=0;c<h;c++)e=g[c][0],f=b.get(e),void 0===f||f.isAttached()||(B(f)&&Ub(f,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
function $b(a,b){b=b.map;const c=new Map;for(let d=0;d<b.length;d++){const [e,f]=b[d];let g;"string"===typeof f||"number"===typeof f||"boolean"===typeof f||null===f?g=f:"object"===typeof f?g="editor"===f.type?pb(f.id,f.editorState):$b(a,f):p(48);c.set(e,g)}return rb(a,c)}
function ac(a,b,c,d,e={}){var f=a.__type,g=c._registeredNodes.get(f);void 0===g&&p(24,f);f=g.klass;g=a.__key;a.__key=void 0;f=f.clone(a);a.__key=g;g=f.__key;R(f)&&E()._nodeMap.set("root",f);f.__parent=d;if(B(f)){d=a.__children;for(let l=0;l<d.length;l++){var h=b.get(d[l]);void 0!==h&&(h=ac(h,b,c,g,e).getKey(),f.__children.push(h))}f.__indent=a.__indent;f.__format=a.__format;f.__dir=a.__dir}else A(f)?(f.__format=a.__format,f.__style=a.__style,f.__mode=a.__mode,f.__detail=a.__detail):y(f)&&(f.__state=
$b(c,a.__state));b=null!=e?e.originalSelection:void 0;null!=b&&(a.__key===b.anchor.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.anchor.key=f.__key),a.__key===b.focus.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.focus.key=f.__key));return f}
function bc(a,b){const c=a.__mode,d=a.__format;a=a.__style;const e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function cc(a,b){const c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
function dc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&A(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{bc(b,a)&&(a=cc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&A(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{bc(a,c)&&cc(a,c);break}}}let S=null,T=null,M=!1,ec=!1,La=0;function I(){M&&p(25)}function E(){null===S&&p(27);return S}
function F(){null===T&&p(28);return T}function fc(a,b,c){var d=b.__type;const e=a._registeredNodes.get(d);void 0===e&&p(23,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function gc(a,b){var c=b._dirtyLeaves;a=a._nodeMap;b=c.size;c=Array.from(c);for(let d=0;d<b;d++){const e=a.get(c[d]);A(e)&&e.isSimpleText()&&!e.isUnmergeable()&&dc(e)}}
function hc(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const e=K(),f=new Map;var g=c,h=g.size,l=d;let k=l.size;for(;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;g=Array.from(g);for(var m=0;m<h;m++){var n=g[m];const r=a.get(n);A(r)&&r.isSimpleText()&&!r.isUnmergeable()&&dc(r);void 0!==r&&void 0!==r&&r.__key!==e&&r.isAttached()&&fc(b,r,f);c.add(n)}g=b._dirtyLeaves;h=g.size;if(0<h){La++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;h=Array.from(l);for(l=0;l<k;l++)m=h[l],g=m[0],
m=m[1],"root"!==g&&m&&(m=h[l][1],n=a.get(g),void 0!==n&&void 0!==n&&n.__key!==e&&n.isAttached()&&fc(b,n,f),d.set(g,m));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;La++}b._dirtyLeaves=c;b._dirtyElements=d}
function Y(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,e=d._selection,f=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=S,l=M,k=T,m=a._updating;T=a;S=b;M=!1;a._updating=!0;try{var n=a._observer;if(g&&null!==n){var r=a._dirtyType,u=a._dirtyElements,z=a._dirtyLeaves;n.disconnect();try{V=W=U="",yb=2===r,Ab=null,X=a,xb=a._config,Bb=u,Cb=z,Db=d._nodeMap,Eb=b._nodeMap,zb=b._readOnly,Fb=new Map(a._keyToDOMMap),Sb("root",null),
Fb=xb=Eb=Db=Cb=Bb=X=void 0}finally{n.observe(c,{childList:!0,subtree:!0,characterData:!0})}}const Z=window.getSelection();if(null!==Z&&(g||null===f||f.dirty)){n=Z;const Da=n.anchorNode,Vb=n.focusNode,Ac=n.anchorOffset,Bc=n.focusOffset,Ea=document.activeElement,na=a._rootElement;if(!a._updateTags.has("collaboration")||Ea===na)if(null===f)null!==e&&Fa(a,Da,Vb)&&n.removeAllRanges();else{var v=f.anchor,x=f.focus,w=x.key,N=Tb(a,v.key),Ca=Tb(a,w),Wb=v.offset,Xb=x.offset;e=N;w=Ca;"text"===v.type&&(e=Ga(N));
"text"===x.type&&(w=Ga(Ca));if(null!==e&&null!==w)if(Ac===Wb&&Bc===Xb&&Da===e&&Vb===w)null===na||null!==Ea&&na.contains(Ea)||na.focus({preventScroll:!0});else try{if(n.setBaseAndExtent(e,Wb,w,Xb),f.isCollapsed()&&na===Ea){const oa=3===e.nodeType?e.parentNode:e;if(null!==oa){const Yb=oa.getBoundingClientRect();Yb.bottom>window.innerHeight?oa.scrollIntoView(!1):0>Yb.top&&oa.scrollIntoView()}}}catch(oa){}}}}catch(Z){ic("error",a,!1,Z,Z._log);ec||(jc(a,null,c,b),ua(a),a._dirtyType=2,ec=!0,a._log.push("ReconcileRecover"),
Y(a),ec=!1);return}finally{a._updating=m,S=h,M=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;f=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;k=a._log;a._log=[];g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=a._decorators;m=a._pendingDecorators||g;v=b._nodeMap;for(var O in m)v.has(O)||(m===g&&(m=Ma(a)),delete m[O]);O=a._pendingDecorators;null!==O&&(a._decorators=O,a._pendingDecorators=null,ic("decorator",
a,!0,O));O=Na(d);g=Na(b);O!==g&&ic("textcontent",a,!0,g);ic("update",a,!0,{tags:l,normalizedNodes:h,prevEditorState:d,editorState:b,dirtyLeaves:c,dirtyElements:f,log:k});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(O=0;O<b.length;O++)b[O]()}finally{a._updating=d}}b=a._updates;if(0!==b.length){const [Z,Da]=b.shift();kc(a,Z,!1,Da)}}}
function ic(a,b,c,...d){const e=b._updating;b._updating=c;try{const f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a](...d)}finally{b._updating=e}}function lc(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=lc(a,b,c)});return e}const d=Qa(a);for(let e=4;0<=e;e--)for(let f=0;f<d.length;f++){const g=Array.from(d[f]._listeners.command[e]);for(let h=0;h<g.length;h++)if(!0===g[h](b,c,a))return!0}return!1}
function mc(a,b){for(a=a._updates;0!==a.length;){const [c,d]=a.shift(),e=void 0!==d&&d.onUpdate;e&&b.push(e);c()}}
function kc(a,b,c,d){const e=a._deferred;let f,g,h=!1;void 0!==d&&(f=d.onUpdate,g=d.tag,h=d.skipTransforms);f&&e.push(f);const l=a._editorState;d=a._pendingEditorState;let k=!1;null===d&&(d=a._pendingEditorState=new wb(new Map(l._nodeMap)),k=!0);const m=S,n=M,r=T,u=a._updating;S=d;M=!1;a._updating=!0;T=a;try{k&&(d._selection=eb(a));const z=a._compositionKey;b();mc(a,e);hb(d,a);0!==a._dirtyType&&(!c&&d.isEmpty()&&p(29),h?gc(d,a):hc(d,a),mc(a,e),Zb(l,d,a._dirtyLeaves,a._dirtyElements));z!==a._compositionKey&&
(d._flushSync=!0);const v=d._selection;if(null!==v){const x=d._nodeMap,w=v.focus.key;void 0!==x.get(v.anchor.key)&&void 0!==x.get(w)||p(30)}}catch(z){ic("error",a,!1,z,a._log);a._pendingEditorState=l;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._log.push("UpdateRecover");Y(a);return}finally{S=m,M=n,T=r,a._updating=u,La=0}0!==a._dirtyType||ub(d,a)?(null!=g&&a._updateTags.add(g),d._flushSync?(d._flushSync=!1,Y(a)):k&&Ba(()=>{Y(a)})):(f&&(b=e.indexOf(f),
e.splice(b,1)),d._flushSync=!1,k&&(a._pendingEditorState=null))}function la(a,b,c,d){a._updating?a._updates.push([b,d]):kc(a,b,c,d)}class nc extends lb{static getType(){return"linebreak"}static clone(a){return new nc(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}}function ab(){return new nc}function Ja(a){return a instanceof nc}
const oc={},vc=[["selectionchange",pc],["keydown",qc],["compositionstart",rc],["compositionend",sc],["input",tc],["click",uc],["cut",oc],["copy",oc],["dragstart",oc],["paste",oc],["focus",oc],["blur",oc]];ya?vc.push(["beforeinput",wc]):vc.push(["drop",oc]);let xc=!1;
function pc(a,b){a=window.getSelection();const c=b.getRootElement();c&&!c.contains(a.anchorNode)||b.update(()=>{t("onSelectionChange");const d=q();if(null!==d&&d.isCollapsed()){var e=d.anchor;"text"===e.type?(e=e.getNode(),d.format=e.getFormat()):"element"===e.type&&(d.format=0)}b.execCommand("selectionChange")})}
function uc(a,b){b.update(()=>{t("onClick");const c=q();if(null!==c){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===ra().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}})}
function wc(a,b){const c=a.inputType;"deleteCompositionText"!==c&&"insertCompositionText"!==c&&b.update(()=>{t("onBeforeInputForRichText");const d=q();if(null!==d)if("deleteContentBackward"===c)H(null),a.preventDefault(),b.execCommand("deleteCharacter",!0);else{var e=a.data;if(!d.dirty&&d.isCollapsed()&&a.getTargetRanges){var f=a.getTargetRanges()[0];f&&d.applyDOMRange(f)}var g=d.focus;f=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===e?(a.preventDefault(),b.execCommand("insertLineBreak")):
"\n\n"===e?(a.preventDefault(),b.execCommand("insertParagraph")):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&Ua(d,e,!0)&&(a.preventDefault(),b.execCommand("insertText",e));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":b.execCommand("insertText",a);break;case "insertFromComposition":H(null);b.execCommand("insertText",a);break;case "insertLineBreak":H(null);b.execCommand("insertLineBreak");
function Tb(a,b){var c=Eb.get(a),d=Fb.get(a);void 0!==c&&void 0!==d||p(43);var e=zb||Db.has(a)||Cb.has(a);const f=Ub(X,a);if(c===d&&!e)return B(c)?(d=f.__lexicalTextContent,void 0!==d&&(U+=d,W+=d),d=f.__lexicalDirTextContent,void 0!==d&&(V+=d)):y(c)||(d=c.getTextContent(),A(c)&&!c.isDirectionless()&&(V+=d),W+=d,U+=d),f;if(d.updateDOM(c,f,yb))return d=Nb(a,null,null),null===b&&p(44),b.replaceChild(d,f),Hb(a,null),d;if(B(c)&&B(d)){if(a=d.__indent,a!==c.__indent&&Lb(f,a),a=d.__format,a!==c.__format&&Mb(f,
a),c=c.__children,a=d.__children,c!==a||e){var g=c,h=a;e=d;b=V;V="";const u=U;U="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Tb(m,f);else{var n=Ib(m);h=Nb(h,null,null);f.replaceChild(h,n);Hb(m,null)}}else if(0===l)0!==k&&Ob(h,0,k-1,f,null);else if(0===k)0!==l&&(m=null==f.__lexicalLineBreak,Jb(g,0,l-1,m?null:f),m&&(f.textContent=""));else{const z=l-1;l=k-1;let v=f.firstChild,x=0;for(k=0;x<=z&&k<=l;){var r=g[x];const w=h[k];if(r===w)v=Tb(w,f).nextSibling,x++,k++;else{void 0===
m&&(m=new Set(g));void 0===n&&(n=new Set(h));const N=n.has(r),Da=m.has(w);N?(Da?(r=Ub(X,w),r===v?v=Tb(w,f).nextSibling:(null!=v?f.insertBefore(r,v):f.appendChild(r),Tb(w,f)),x++):Nb(w,f,v),k++):(v=Ib(r).nextSibling,Hb(r,f),x++)}}m=x>z;n=k>l;m&&!n?(m=h[l+1],m=void 0===m?null:X.getElementByKey(m),Ob(h,k,l,f,m)):n&&!m&&Jb(g,x,z,f)}f.__lexicalTextContent=U;U=u+U;Pb(e,f);V=b;R(d)||Qb(c,a,f)}}else y(d)?(c=d.decorate(X),null!==c&&Rb(a,c)):(c=d.getTextContent(),A(d)&&!d.isDirectionless()&&(V+=c),U+=c,W+=
c);!Ab&&R(d)&&d.__cachedText!==W&&(d=d.getWritable(),d.__cachedText=W);return f}function Rb(a,b){let c=X._pendingDecorators;const d=X._decorators;if(null===c){if(d[a]===b)return;c=Na(X)}c[a]=b}function Ib(a){a=Gb.get(a);void 0===a&&p(45);return a}function Ub(a,b){a=a._keyToDOMMap.get(b);void 0===a&&p(45);return a}function Vb(a,b,c,d,e){a=a.__children;const f=a.length;for(let g=0;g<f;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(B(l)&&Vb(l,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}
function Wb(a,b,c,d){var e=Array.from(c),f=e.length;const g=Array.from(d),h=g.length;a=a._nodeMap;b=b._nodeMap;for(let l=0;l<f;l++){const k=e[l],m=b.get(k);void 0===m||m.isAttached()||(a.has(k)||c.delete(k),b.delete(k))}for(c=0;c<h;c++)e=g[c][0],f=b.get(e),void 0===f||f.isAttached()||(B(f)&&Vb(f,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
function Xb(a,b){b=b.map;const c=new Map;for(let d=0;d<b.length;d++){const [e,f]=b[d];let g;"string"===typeof f||"number"===typeof f||"boolean"===typeof f||null===f?g=f:"object"===typeof f?g="editor"===f.type?qb(f.id,f.editorState):Xb(a,f):p(48);c.set(e,g)}return sb(a,c)}
function bc(a,b,c,d,e={}){var f=a.__type,g=c._registeredNodes.get(f);void 0===g&&p(24,f);f=g.klass;g=a.__key;a.__key=void 0;f=f.clone(a);a.__key=g;g=f.__key;R(f)&&E()._nodeMap.set("root",f);f.__parent=d;if(B(f)){d=a.__children;for(let l=0;l<d.length;l++){var h=b.get(d[l]);void 0!==h&&(h=bc(h,b,c,g,e).getKey(),f.__children.push(h))}f.__indent=a.__indent;f.__format=a.__format;f.__dir=a.__dir}else A(f)?(f.__format=a.__format,f.__style=a.__style,f.__mode=a.__mode,f.__detail=a.__detail):y(f)&&(f.__state=
Xb(c,a.__state));b=null!=e?e.originalSelection:void 0;null!=b&&(a.__key===b.anchor.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.anchor.key=f.__key),a.__key===b.focus.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.focus.key=f.__key));return f}
function cc(a,b){const c=a.__mode,d=a.__format;a=a.__style;const e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function dc(a,b){const c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
function ec(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&A(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{cc(b,a)&&(a=dc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&A(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{cc(a,c)&&dc(a,c);break}}}let S=null,T=null,M=!1,fc=!1,Ma=0;function I(){M&&p(25)}function E(){null===S&&p(27);return S}
function F(){null===T&&p(28);return T}function gc(a,b,c){var d=b.__type;const e=a._registeredNodes.get(d);void 0===e&&p(23,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function hc(a,b){var c=b._dirtyLeaves;a=a._nodeMap;b=c.size;c=Array.from(c);for(let d=0;d<b;d++){const e=a.get(c[d]);A(e)&&e.isSimpleText()&&!e.isUnmergeable()&&ec(e)}}
function ic(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const e=K(),f=new Map;var g=c,h=g.size,l=d;let k=l.size;for(;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;g=Array.from(g);for(var m=0;m<h;m++){var n=g[m];const r=a.get(n);A(r)&&r.isSimpleText()&&!r.isUnmergeable()&&ec(r);void 0!==r&&void 0!==r&&r.__key!==e&&r.isAttached()&&gc(b,r,f);c.add(n)}g=b._dirtyLeaves;h=g.size;if(0<h){Ma++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;h=Array.from(l);for(l=0;l<k;l++)m=h[l],g=m[0],
m=m[1],"root"!==g&&m&&(m=h[l][1],n=a.get(g),void 0!==n&&void 0!==n&&n.__key!==e&&n.isAttached()&&gc(b,n,f),d.set(g,m));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;Ma++}b._dirtyLeaves=c;b._dirtyElements=d}
function Y(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,e=d._selection,f=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=S,l=M,k=T,m=a._updating;T=a;S=b;M=!1;a._updating=!0;try{var n=a._observer;if(g&&null!==n){var r=a._dirtyType,u=a._dirtyElements,z=a._dirtyLeaves;n.disconnect();try{V=W=U="",zb=2===r,Bb=null,X=a,yb=a._config,Cb=u,Db=z,Eb=d._nodeMap,Fb=b._nodeMap,Ab=b._readOnly,Gb=new Map(a._keyToDOMMap),Tb("root",null),
Gb=yb=Fb=Eb=Db=Cb=X=void 0}finally{n.observe(c,{childList:!0,subtree:!0,characterData:!0})}}const Z=window.getSelection();if(null!==Z&&(g||null===f||f.dirty)){n=Z;const Ea=n.anchorNode,Yb=n.focusNode,Cc=n.anchorOffset,Dc=n.focusOffset,Fa=document.activeElement,oa=a._rootElement;if(!a._updateTags.has("collaboration")||Fa===oa)if(null===f)null!==e&&Ca(a,Ea,Yb)&&n.removeAllRanges();else{var v=f.anchor,x=f.focus,w=x.key,N=Ub(a,v.key),Da=Ub(a,w),Zb=v.offset,$b=x.offset;e=N;w=Da;"text"===v.type&&(e=Ga(N));
"text"===x.type&&(w=Ga(Da));if(null!==e&&null!==w)if(Cc===Zb&&Dc===$b&&Ea===e&&Yb===w)null===oa||null!==Fa&&oa.contains(Fa)||oa.focus({preventScroll:!0});else try{if(n.setBaseAndExtent(e,Zb,w,$b),f.isCollapsed()&&oa===Fa){const pa=3===e.nodeType?e.parentNode:e;if(null!==pa){const ac=pa.getBoundingClientRect();ac.bottom>window.innerHeight?pa.scrollIntoView(!1):0>ac.top&&pa.scrollIntoView()}}}catch(pa){}}}}catch(Z){jc("error",a,!1,Z,Z._log);fc||(kc(a,null,c,b),ua(a),a._dirtyType=2,fc=!0,a._log.push("ReconcileRecover"),
Y(a),fc=!1);return}finally{a._updating=m,S=h,M=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;f=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;k=a._log;a._log=[];g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=a._decorators;m=a._pendingDecorators||g;v=b._nodeMap;for(var O in m)v.has(O)||(m===g&&(m=Na(a)),delete m[O]);O=a._pendingDecorators;null!==O&&(a._decorators=O,a._pendingDecorators=null,jc("decorator",
a,!0,O));O=Oa(d);g=Oa(b);O!==g&&jc("textcontent",a,!0,g);jc("update",a,!0,{tags:l,normalizedNodes:h,prevEditorState:d,editorState:b,dirtyLeaves:c,dirtyElements:f,log:k});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(O=0;O<b.length;O++)b[O]()}finally{a._updating=d}}b=a._updates;if(0!==b.length){const [Z,Ea]=b.shift();lc(a,Z,!1,Ea)}}}
function jc(a,b,c,...d){const e=b._updating;b._updating=c;try{const f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a](...d)}finally{b._updating=e}}function mc(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=mc(a,b,c)});return e}const d=Ra(a);for(let e=4;0<=e;e--)for(let f=0;f<d.length;f++){const g=Array.from(d[f]._listeners.command[e]);for(let h=0;h<g.length;h++)if(!0===g[h](b,c,a))return!0}return!1}
function nc(a,b){for(a=a._updates;0!==a.length;){const [c,d]=a.shift(),e=void 0!==d&&d.onUpdate;e&&b.push(e);c()}}
function lc(a,b,c,d){const e=a._deferred;let f,g,h=!1;void 0!==d&&(f=d.onUpdate,g=d.tag,h=d.skipTransforms);f&&e.push(f);const l=a._editorState;d=a._pendingEditorState;let k=!1;null===d&&(d=a._pendingEditorState=new xb(new Map(l._nodeMap)),k=!0);const m=S,n=M,r=T,u=a._updating;S=d;M=!1;a._updating=!0;T=a;try{k&&(d._selection=fb(a));const z=a._compositionKey;b();nc(a,e);ib(d,a);0!==a._dirtyType&&(!c&&d.isEmpty()&&p(29),h?hc(d,a):ic(d,a),nc(a,e),Wb(l,d,a._dirtyLeaves,a._dirtyElements));z!==a._compositionKey&&
(d._flushSync=!0);const v=d._selection;if(null!==v){const x=d._nodeMap,w=v.focus.key;void 0!==x.get(v.anchor.key)&&void 0!==x.get(w)||p(30)}}catch(z){jc("error",a,!1,z,a._log);a._pendingEditorState=l;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._log.push("UpdateRecover");Y(a);return}finally{S=m,M=n,T=r,a._updating=u,Ma=0}0!==a._dirtyType||vb(d,a)?(null!=g&&a._updateTags.add(g),d._flushSync?(d._flushSync=!1,Y(a)):k&&Ba(()=>{Y(a)})):(f&&(b=e.indexOf(f),
e.splice(b,1)),d._flushSync=!1,k&&(a._pendingEditorState=null))}function la(a,b,c,d){a._updating?a._updates.push([b,d]):lc(a,b,c,d)}class oc extends mb{static getType(){return"linebreak"}static clone(a){return new oc(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}}function bb(){return new oc}function Ja(a){return a instanceof oc}
class pc extends mb{static getType(){return"horizontal-rule"}static clone(a){return new pc(a.__key)}constructor(a){super(a)}createDOM(){const a=document.createElement("hr");a.setAttribute("contenteditable","false");return a}updateDOM(){return!1}getChildrenSize(){return 0}}function Ka(a){return a instanceof pc}
const qc={},xc=[["selectionchange",rc],["keydown",sc],["compositionstart",tc],["compositionend",uc],["input",vc],["click",wc],["cut",qc],["copy",qc],["dragstart",qc],["paste",qc],["focus",qc],["blur",qc]];ya?xc.push(["beforeinput",yc]):xc.push(["drop",qc]);let zc=!1;
function rc(a,b){const c=window.getSelection();a=Ra(b);(a=a[a.length-1].getRootElement())&&!a.contains(c.anchorNode)||b.update(()=>{t("onSelectionChange");if(Ca(b,c.anchorNode,c.focusNode)){var d=q();if(null!==d&&d.isCollapsed()){var e=d.anchor;"text"===e.type?(e=e.getNode(),d.format=e.getFormat()):"element"===e.type&&(d.format=0)}b.execCommand("selectionChange")}})}
function wc(a,b){b.update(()=>{t("onClick");const c=q();if(null!==c){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===ra().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}})}
function yc(a,b){const c=a.inputType;"deleteCompositionText"!==c&&"insertCompositionText"!==c&&b.update(()=>{t("onBeforeInputForRichText");const d=q();if(null!==d)if("deleteContentBackward"===c)H(null),a.preventDefault(),b.execCommand("deleteCharacter",!0);else{var e=a.data;if(!d.dirty&&d.isCollapsed()&&a.getTargetRanges){var f=a.getTargetRanges()[0];f&&d.applyDOMRange(f)}var g=d.focus;f=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===e?(a.preventDefault(),b.execCommand("insertLineBreak")):
"\n\n"===e?(a.preventDefault(),b.execCommand("insertParagraph")):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&Va(d,e,!0)&&(a.preventDefault(),b.execCommand("insertText",e));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":b.execCommand("insertText",a);break;case "insertFromComposition":H(null);b.execCommand("insertText",a);break;case "insertLineBreak":H(null);b.execCommand("insertLineBreak");
break;case "insertParagraph":H(null);b.execCommand("insertParagraph");break;case "insertFromPaste":case "insertFromPasteAsQuotation":b.execCommand("paste",a);break;case "deleteByComposition":f===g&&!B(f)&&!B(g)&&D(f)&&D(g)||b.execCommand("removeText");break;case "deleteByDrag":case "deleteByCut":b.execCommand("removeText");break;case "deleteContent":b.execCommand("deleteCharacter",!1);break;case "deleteWordBackward":b.execCommand("deleteWord",!0);break;case "deleteWordForward":b.execCommand("deleteWord",
!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":b.execCommand("deleteLine",!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":b.execCommand("deleteLine",!1);break;case "formatStrikeThrough":b.execCommand("formatText","strikethrough");break;case "formatBold":b.execCommand("formatText","bold");break;case "formatItalic":b.execCommand("formatText","italic");break;case "formatUnderline":b.execCommand("formatText","underline");break;case "historyUndo":b.execCommand("undo");
break;case "historyRedo":b.execCommand("redo")}}})}function tc(a,b){a.stopPropagation();b.update(()=>{t("onInput");var c=q();const d=a.data;null!=d&&null!==c&&Ua(c,d,!1)?b.execCommand("insertText",d):Sa(b,!1);I();c=F();ta(c)})}function rc(a,b){b.update(()=>{t("onCompositionStart");const c=q();if(null!==c&&!b.isComposing()){const d=c.anchor;H(d.key);null==a.data||xc&&"element"!==d.type&&c.isCollapsed()||b.execCommand("insertText"," ")}})}
function yc(a,b){b.update(()=>{t("onCompositionEnd");H(null);Sa(b,!0)})}function sc(a,b){xa?setTimeout(()=>{yc(a,b)},0):yc(a,b)}
function qc(a,b){xc="Unidentified"===a.key&&229===a.keyCode;b.isComposing()||b.update(()=>{t("onKeyDown");if(null!==q()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(37!==c||e||f||g)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)b.execCommand("keyEnter",a);else if(C&&e&&79===c)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==c||d){var h=C?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",
break;case "historyRedo":b.execCommand("redo")}}})}function vc(a,b){a.stopPropagation();b.update(()=>{t("onInput");var c=q();const d=a.data;null!=d&&null!==c&&Va(c,d,!1)?b.execCommand("insertText",d):Ta(b,!1);I();c=F();ta(c)})}function tc(a,b){b.update(()=>{t("onCompositionStart");const c=q();if(null!==c&&!b.isComposing()){const d=c.anchor;H(d.key);null==a.data||zc&&"element"!==d.type&&c.isCollapsed()||b.execCommand("insertText"," ")}})}
function Ac(a,b){b.update(()=>{t("onCompositionEnd");H(null);Ta(b,!0)})}function uc(a,b){xa?setTimeout(()=>{Ac(a,b)},0):Ac(a,b)}
function sc(a,b){zc="Unidentified"===a.key&&229===a.keyCode;b.isComposing()||b.update(()=>{t("onKeyDown");if(null!==q()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(37!==c||e||f||g)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)b.execCommand("keyEnter",a);else if(C&&e&&79===c)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==c||d){var h=C?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",
!0):27===c?b.execCommand("keyEscape",a):(h=C?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?b.execCommand("keyDelete",a):b.execCommand("deleteCharacter",!1):8===c&&(C?g:e)?(a.preventDefault(),b.execCommand("deleteWord",!0)):46===c&&(C?g:e)?(a.preventDefault(),b.execCommand("deleteWord",!1)):C&&f&&8===c?(a.preventDefault(),b.execCommand("deleteLine",!0)):C&&f&&46===c?(a.preventDefault(),b.execCommand("deleteLine",!1)):66===c&&(C?f:e)?(a.preventDefault(),b.execCommand("formatText","bold")):
85===c&&(C?f:e)?(a.preventDefault(),b.execCommand("formatText","underline")):73===c&&(C?f:e)?(a.preventDefault(),b.execCommand("formatText","italic")):9!==c||g||e||f?90===c&&!d&&(C?f:e)?(a.preventDefault(),b.execCommand("undo")):(h=C?90===c&&f&&d:89===c&&e||90===c&&e&&d,h&&(a.preventDefault(),b.execCommand("redo"))):b.execCommand("keyTab",a))}else b.execCommand("keyEnter",a);else b.execCommand("keyArrowDown",a);else b.execCommand("keyArrowUp",a);else b.execCommand("keyArrowLeft",a);else b.execCommand("keyArrowRight",
a)}})}function zc(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}function Cc(a){a=a.getRootElement();return null!==a&&"true"===a.contentEditable}function Dc(a){let b=a._lexicalEventHandles;void 0===b&&(b=[],a._lexicalEventHandles=b);return b}
function Ec(a,b){const c=Dc(a);for(let d=0;d<vc.length;d++){const [e,f]=vc[d],g="function"===typeof f?h=>{Cc(b)&&f(h,b)}:h=>{Cc(b)&&b.execCommand(e,h)};zc(e,a).addEventListener(e,g);c.push(()=>{zc(e,a).removeEventListener(e,g)})}}
function jc(a,b,c,d){const e=a._keyToDOMMap;e.clear();a._editorState=vb();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._log=[];a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
function Fc(a,b){const c=b.getType();let d=a.get(c);void 0===d&&(d={count:0,klass:b,transforms:new Set},a.set(c,d));const e=d;e.count++;return()=>{1===e.count?a.delete(c):e.count--}}
class Gc{constructor(a,b,c){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,error:new Set,textcontent:new Set,textmutation:new Set,root:new Set,update:new Set,command:[new Set,new Set,new Set,new Set,new Set]};this._config=c;this._registeredNodes=new Map;this.registerNodes([tb,Hc,nc]);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._log=[];this._key=""+za++}isComposing(){return null!=this._compositionKey}registerNodes(a){const b=a.length,c=this._registeredNodes,d=[];for(let e=0;e<b;e++)d.push(Fc(c,a[e]));return()=>{for(let e=0;e<b;e++)d[e]()}}addListener(a,b,c){const d=this._listeners[a];if("command"===a&&void 0!==c){const f=d[c];f.add(b);return()=>
{f.delete(b)}}d.add(b);const e="root"===a;e&&b(this._rootElement,null);return()=>{d.delete(b);e&&b(null,this._rootElement)}}addTransform(a,b){const c=a.getType(),d=this._registeredNodes.get(c);void 0===d&&p(18,a.name);const e=d.transforms;e.add(b);Oa(this,c);return()=>{e.delete(b)}}execCommand(a,b){return lc(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}setRootElement(a){const b=this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;
this._rootElement=a;jc(this,b,a,c);if(null!==b&&!this._config.disableEvents){c=Dc(b);for(let d=0;d<c.length;d++)c[d]();b._lexicalEventHandles=[]}null!==a&&(a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,ua(this),this._updateTags.add("without-history"),Y(this),this._config.disableEvents||Ec(a,this));ic("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&p(19);ta(this);const c=this._pendingEditorState,
d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),Y(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Y(this)}parseEditorState(a){const b=JSON.parse(a);a=new Map;a=new wb(a);const c={originalSelection:b._selection},d=M,e=T;S=a;M=!1;T=this;try{var f=new Map(b._nodeMap);const g=f.get("root");ac(g,f,this,null,c)}finally{S=a,M=d,T=e}f=c.remappedSelection||c.originalSelection;f=null===f?null:new Za(P(f.anchor.key,f.anchor.offset,
f.anchor.type),P(f.focus.key,f.focus.offset,f.focus.type),0);a._selection=f;return a}update(a,b){la(this,a,!1,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),la(this,()=>{const c=q(),d=ra();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},!0,{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){const a=this._rootElement;null!==a&&a.blur()}}function Ic(a,b){return b&1?"strong":b&2?"em":"span"}
function Jc(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Kc(a,b,c,d,e){a=d.classList;d=Jc(e,"base");void 0!==d&&a.add(...d);d=Jc(e,"underlineStrikethrough");let f=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ca)h=ca[l],d=Jc(e,l),void 0!==d&&(c&h?!f||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
function Lc(a,b,c){const d=b.firstChild;c=c.isComposing()?"\u00a0":"";a+=c;null==d?b.textContent=a:d.nodeValue!==a&&(d.nodeValue=a)}
class Hc extends lb{static getType(){return"text"}static clone(a){return new Hc(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
(this.getLatest().__detail&2)}hasFormat(a){a=ca[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return Ha(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Ic(this,b),e=document.createElement(null===c?d:c);let f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Lc(this.__text,
c,this);a=a.theme.text;void 0!==a&&Kc(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){const d=this.__text;var e=a.__format,f=this.__format,g=e&16?"code":null;const h=f&16?"code":null;var l=Ic(this,e);const k=Ic(this,f);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return e=b.firstChild,null==e&&p(20),a=g=document.createElement(k),Lc(d,a,this),c=c.theme.text,void 0!==c&&Kc(k,0,f,a,c),b.replaceChild(g,e),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
l&&p(21));Lc(d,l,this);c=c.theme.text;void 0!==c&&e!==f&&Kc(k,e,f,l,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}selectionTransform(){}setFormat(a){I();const b=this.getWritable();this.getWritable().__format=a;return b}setStyle(a){I();const b=this.getWritable();this.getWritable().__style=a;return b}toggleFormat(a){a=ca[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){const a=this.getWritable();
a.__detail^=2;return a}setMode(a){a=ea[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();const b=this.getWritable();b.__text=a;return b}select(a,b){I();const c=q();var d=this.getTextContent();const e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(null===c)return db(e,a,e,b,"text","text");d=K();d!==c.anchor.key&&d!==c.focus.key||H(e);c.setTextNodeRange(this,a,this,b);return c}spliceText(a,b,c,d){I();const e=this.getWritable(),f=e.__text,
a)}})}function Bc(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}function Ec(a){a=a.getRootElement();return null!==a&&"true"===a.contentEditable}function Fc(a){let b=a._lexicalEventHandles;void 0===b&&(b=[],a._lexicalEventHandles=b);return b}
function Gc(a,b){const c=Fc(a);for(let d=0;d<xc.length;d++){const [e,f]=xc[d],g="function"===typeof f?h=>{Ec(b)&&f(h,b)}:h=>{Ec(b)&&b.execCommand(e,h)};Bc(e,a).addEventListener(e,g);c.push(()=>{Bc(e,a).removeEventListener(e,g)})}}
function kc(a,b,c,d){const e=a._keyToDOMMap;e.clear();a._editorState=wb();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._log=[];a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
function Hc(a,b){const c=b.getType();let d=a.get(c);void 0===d&&(d={count:0,klass:b,transforms:new Set},a.set(c,d));const e=d;e.count++;return()=>{1===e.count?a.delete(c):e.count--}}
class Ic{constructor(a,b,c){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,error:new Set,textcontent:new Set,textmutation:new Set,root:new Set,update:new Set,command:[new Set,new Set,new Set,new Set,new Set]};this._config=c;this._registeredNodes=new Map;this.registerNodes([ub,Jc,pc,oc]);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._log=[];this._key=""+za++}isComposing(){return null!=this._compositionKey}registerNodes(a){const b=a.length,c=this._registeredNodes,d=[];for(let e=0;e<b;e++)d.push(Hc(c,a[e]));return()=>{for(let e=0;e<b;e++)d[e]()}}addListener(a,b,c){const d=this._listeners[a];if("command"===a&&void 0!==c){const f=d[c];f.add(b);return()=>
{f.delete(b)}}d.add(b);const e="root"===a;e&&b(this._rootElement,null);return()=>{d.delete(b);e&&b(null,this._rootElement)}}addTransform(a,b){const c=a.getType(),d=this._registeredNodes.get(c);void 0===d&&p(18,a.name);const e=d.transforms;e.add(b);Pa(this,c);return()=>{e.delete(b)}}execCommand(a,b){return mc(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}setRootElement(a){const b=this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;
this._rootElement=a;kc(this,b,a,c);if(null!==b&&!this._config.disableEvents){c=Fc(b);for(let d=0;d<c.length;d++)c[d]();b._lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect="text",c.whiteSpace="pre-wrap",c.overflowWrap="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,ua(this),this._updateTags.add("without-history"),Y(this),this._config.disableEvents||Gc(a,this));jc("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
b){a.isEmpty()&&p(19);ta(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),Y(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Y(this)}parseEditorState(a){const b=JSON.parse(a);a=new Map;a=new xb(a);const c={originalSelection:b._selection},d=M,e=T;S=a;M=!1;T=this;try{var f=new Map(b._nodeMap);const g=f.get("root");bc(g,f,this,null,c)}finally{S=a,M=d,T=e}f=c.remappedSelection||c.originalSelection;
f=null===f?null:new $a(P(f.anchor.key,f.anchor.offset,f.anchor.type),P(f.focus.key,f.focus.offset,f.focus.type),0);a._selection=f;return a}update(a,b){la(this,a,!1,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),la(this,()=>{const c=q(),d=ra();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},!0,{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){const a=this._rootElement;null!==a&&a.blur()}}
function Kc(a,b){return b&1?"strong":b&2?"em":"span"}function Lc(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}
function Mc(a,b,c,d,e){a=d.classList;d=Lc(e,"base");void 0!==d&&a.add(...d);d=Lc(e,"underlineStrikethrough");let f=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ca)h=ca[l],d=Lc(e,l),void 0!==d&&(c&h?!f||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
function Nc(a,b,c){const d=b.firstChild;c=c.isComposing()?"\u00a0":"";a+=c;null==d?b.textContent=a:d.nodeValue!==a&&(d.nodeValue=a)}
class Jc extends mb{static getType(){return"text"}static clone(a){return new Jc(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
(this.getLatest().__detail&2)}hasFormat(a){a=ca[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return Ha(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Kc(this,b),e=document.createElement(null===c?d:c);let f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Nc(this.__text,
c,this);a=a.theme.text;void 0!==a&&Mc(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){const d=this.__text;var e=a.__format,f=this.__format,g=e&16?"code":null;const h=f&16?"code":null;var l=Kc(this,e);const k=Kc(this,f);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return e=b.firstChild,null==e&&p(20),a=g=document.createElement(k),Nc(d,a,this),c=c.theme.text,void 0!==c&&Mc(k,0,f,a,c),b.replaceChild(g,e),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
l&&p(21));Nc(d,l,this);c=c.theme.text;void 0!==c&&e!==f&&Mc(k,e,f,l,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}selectionTransform(){}setFormat(a){I();const b=this.getWritable();this.getWritable().__format=a;return b}setStyle(a){I();const b=this.getWritable();this.getWritable().__style=a;return b}toggleFormat(a){a=ca[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){const a=this.getWritable();
a.__detail^=2;return a}setMode(a){a=ea[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();const b=this.getWritable();b.__text=a;return b}select(a,b){I();const c=q();var d=this.getTextContent();const e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(null===c)return eb(e,a,e,b,"text","text");d=K();d!==c.anchor.key&&d!==c.focus.key||H(e);c.setTextNodeRange(this,a,this,b);return c}spliceText(a,b,c,d){I();const e=this.getWritable(),f=e.__text,
g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=q();d&&null!==l&&(a+=g,l.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);return e.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){I();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=K(),f=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&f.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var k=a[0];c=b.getParentOrThrow();
l=c.__key;const m=b.getFormat(),n=b.getStyle(),r=b.__detail;g=!1;b.isSegmented()?(h=L(k),h.__parent=l,h.__format=m,h.__style=n,h.__detail=r,g=!0):(h=b.getWritable(),h.__text=k);b=q();h=[h];k=k.length;for(let v=1;v<f;v++){var u=a[v],z=u.length;u=L(u).getWritable();u.__format=m;u.__style=n;u.__detail=r;const x=u.__key;z=k+z;if(null!==b){const w=b.anchor,N=b.focus;w.key===d&&"text"===w.type&&w.offset>k&&w.offset<=z&&(w.key=x,w.offset-=k,b.dirty=!0);N.key===d&&"text"===N.type&&N.offset>k&&N.offset<=z&&
(N.key=x,N.offset-=k,b.dirty=!0)}e===d&&H(x);k=z;u.__parent=l;h.push(u)}G(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(v=>v.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);null!==b&&fb(b,c,d,f-1);return h}mergeWithSibling(a){const b=a===this.getPreviousSibling();b||a===this.getNextSibling()||p(22);const c=this.__key,d=a.__key,e=this.__text,f=e.length;K()===d&&H(c);const g=q();if(null!==g){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(jb(h,b,c,a,f),g.dirty=!0);null!==
l&&l.key===d&&(jb(l,b,c,a,f),g.dirty=!0)}this.setTextContent(b?a.__text+e:e+a.__text);a.remove();return this.getLatest()}}function L(a=""){return new Hc(a)}function A(a){return a instanceof Hc}exports.$createLineBreakNode=ab;exports.$createNodeFromParse=function(a,b){I();const c=F();return ac(a,b,c,null)};exports.$createSelection=function(){const a=P("root",0,"element"),b=P("root",0,"element");return new Za(a,b,0)};exports.$createTextNode=L;exports.$getCompositionKey=K;
exports.$getNearestNodeFromDOMNode=ma;exports.$getNodeByKey=J;exports.$getPreviousSelection=Ta;exports.$getRoot=ra;exports.$getSelection=q;exports.$isDecoratorNode=y;exports.$isElementNode=B;exports.$isLeafNode=Ia;exports.$isLineBreakNode=Ja;exports.$isRootNode=R;exports.$isTextNode=A;exports.$log=t;exports.$setCompositionKey=H;exports.$setSelection=sa;exports.DecoratorNode=sb;exports.ElementNode=nb;exports.TextNode=Hc;exports.VERSION="0.1.3";exports.createDecoratorEditor=pb;
exports.createDecoratorMap=rb;exports.createEditor=function(a){var b=a||{};a=b.namespace||Ra();const c=b.theme||{},d=b.context||{},e=b.parentEditor||null,f=b.htmlTransforms||{},g=b.disableEvents||!1,h=vb();b=b.initialEditorState;a=new Gc(h,e,{context:d,namespace:a,theme:c,htmlTransforms:f,disableEvents:g});void 0!==b&&(a._pendingEditorState=b,a._dirtyType=2);return a};exports.isDecoratorEditor=function(a){return a instanceof ob};exports.isDecoratorMap=function(a){return a instanceof qb};
(N.key=x,N.offset-=k,b.dirty=!0)}e===d&&H(x);k=z;u.__parent=l;h.push(u)}G(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(v=>v.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);null!==b&&gb(b,c,d,f-1);return h}mergeWithSibling(a){const b=a===this.getPreviousSibling();b||a===this.getNextSibling()||p(22);const c=this.__key,d=a.__key,e=this.__text,f=e.length;K()===d&&H(c);const g=q();if(null!==g){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(kb(h,b,c,a,f),g.dirty=!0);null!==
l&&l.key===d&&(kb(l,b,c,a,f),g.dirty=!0)}this.setTextContent(b?a.__text+e:e+a.__text);a.remove();return this.getLatest()}}function L(a=""){return new Jc(a)}function A(a){return a instanceof Jc}exports.$createHorizontalRuleNode=function(){return new pc};exports.$createLineBreakNode=bb;exports.$createNodeFromParse=function(a,b){I();const c=F();return bc(a,b,c,null)};exports.$createSelection=function(){const a=P("root",0,"element"),b=P("root",0,"element");return new $a(a,b,0)};
exports.$createTextNode=L;exports.$getCompositionKey=K;exports.$getNearestNodeFromDOMNode=ma;exports.$getNodeByKey=J;exports.$getPreviousSelection=Ua;exports.$getRoot=ra;exports.$getSelection=q;exports.$isDecoratorNode=y;exports.$isElementNode=B;exports.$isHorizontalRuleNode=Ka;exports.$isLeafNode=Ia;exports.$isLineBreakNode=Ja;exports.$isRootNode=R;exports.$isTextNode=A;exports.$log=t;exports.$setCompositionKey=H;exports.$setSelection=sa;exports.DecoratorNode=tb;exports.ElementNode=ob;
exports.TextNode=Jc;exports.VERSION="0.1.4";exports.createDecoratorEditor=qb;exports.createDecoratorMap=sb;exports.createEditor=function(a){var b=a||{};a=b.namespace||Sa();const c=b.theme||{},d=b.context||{},e=b.parentEditor||null,f=b.htmlTransforms||{},g=b.disableEvents||!1,h=wb();b=b.initialEditorState;a=new Ic(h,e,{context:d,namespace:a,theme:c,htmlTransforms:f,disableEvents:g});void 0!==b&&(a._pendingEditorState=b,a._dirtyType=2);return a};
exports.isDecoratorEditor=function(a){return a instanceof pb};exports.isDecoratorMap=function(a){return a instanceof rb};

@@ -6,4 +6,4 @@ 'use strict';var f=require("lexical"),g=require("lexical/ParagraphNode"),l=require("lexical/ListNode"),m=require("lexical/ListItemNode");function n(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}function p(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}function q(a,...b){b.forEach(c=>{a.classList.remove(...c.split(" "))})}

this;null!==e;)m.$isListItemNode(e)&&0<e.getNextSiblings().length&&(d=!1),e=e.getParent();if(f.$isElementNode(c)&&""===this.getTextContent()&&(null===b||null===a)&&d){null===a?(a=g.$createParagraphNode(),c.insertAfter(a)):(a=g.$createParagraphNode(),c.insertBefore(a));for(b=this;null==b.getNextSibling()&&null==b.getPreviousSibling();){c=b.getParent();if(null==c||!v(b)&&!l.$isListNode(b))break;b=c}b.remove()}else a=w(),this.insertAfter(a);return a}collapseAtStart(a){const b=g.$createParagraphNode();
this.getChildren().forEach(h=>b.append(h));var c=this.getParentOrThrow(),d=c.getParentOrThrow();const e=v(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.replace(b),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}canInsertAfter(a){return v(a)}canReplaceWith(a){return v(a)}canMergeWith(a){return g.$isParagraphNode(a)||v(a)}}
function t(a){var b=a.getParent();let c=1;null!=b&&(l.$isListNode(b)?c=b.__start:n(47));a=a.getPreviousSiblings();for(b=0;b<a.length;b++){const d=a[b];v(d)&&!l.$isListNode(d.getFirstChild())&&c++}return c}function u(a,b,c){const d=[],e=[],h=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var k=b.nested.listitem;void 0!==h&&(b=h.split(" "),d.push(...b));void 0!==k&&(k=k.split(" "),c.getChildren().some(x=>l.$isListNode(x))?d.push(...k):e.push(...k));0<d.length&&p(a,...d);0<e.length&&q(a,...e)}
this.getChildren().forEach(h=>b.append(h));var c=this.getParentOrThrow(),d=c.getParentOrThrow();const e=v(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.replace(b),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}insertBefore(a){const b=this.getNextSiblings();v(a)&&b.forEach(c=>c.markDirty());return super.insertBefore(a)}canInsertAfter(a){return v(a)}canReplaceWith(a){return v(a)}canMergeWith(a){return g.$isParagraphNode(a)||
v(a)}}function t(a){var b=a.getParent();let c=1;null!=b&&(l.$isListNode(b)?c=b.__start:n(47));a=a.getPreviousSiblings();for(b=0;b<a.length;b++){const d=a[b];v(d)&&!l.$isListNode(d.getFirstChild())&&c++}return c}function u(a,b,c){const d=[],e=[],h=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var k=b.nested.listitem;void 0!==h&&(b=h.split(" "),d.push(...b));void 0!==k&&(k=k.split(" "),c.getChildren().some(x=>l.$isListNode(x))?d.push(...k):e.push(...k));0<d.length&&p(a,...d);0<e.length&&q(a,...e)}
function w(){return new r}function v(a){return a instanceof r}exports.$createListItemNode=w;exports.$isListItemNode=v;exports.ListItemNode=r;

@@ -16,3 +16,3 @@ {

"license": "MIT",
"version": "0.1.3",
"version": "0.1.4",
"main": "Lexical.js",

@@ -19,0 +19,0 @@ "repository": {

@@ -5,2 +5,51 @@ # `lexical`

The `lexical` package contains only the core Lexical engine and nodes. This package is intended to be used in conjunction with packages that wire Lexical up to applications, such as `@lexical/react`.
The core of Lexical is a dependency-free text editor engine that allows for powerful, simple and complex,
editor implementations to be built on top. Lexical's engine provides three main parts:
- editor instances that each attach to a single content editable element.
- a set of editor states that represent the current and pending states of the editor at any given time.
- a DOM reconciler that takes a set of editor states, diffs the changes, and updates the DOM according to their state.
By design, the core of Lexical tries to be as minimal as possible.
Lexical doesn't directly concern itself with things that monolithic editors tend to do – such as UI components, toolbars or rich-text features and markdown. Instead
the logic for those features can be included via a plugin interface and used as and when they're needed. This ensures great extensibilty and keeps code-sizes
to a minimal – ensuring apps only pay the cost for what they actually import.
For React apps, Lexical has tight intergration with React 18+ via the optional `@lexical/react` package. This package provides
production-ready utility functions, helpers and React hooks that make it seemless to create text editors within React.
## Usage
The `lexical` package contains only the core Lexical engine and nodes. This package is intended to be used in conjunction with packages that wire Lexical up to applications, such as `@lexical/react`.
## Working with Lexical
This section covers how to use Lexical, independently of any framework or library. For those intending to use Lexical in their React applications,
it's advisable to [check out the source-code for the hooks that are shipped in `@lexical/react`](https://github.com/facebook/lexical/tree/main/packages/lexical-react/src).
### Creating an editor instance and using it
When you work with Lexical, you normally work with a single editor instance. An editor instance can be created from the `lexical` package and accepts
an optional configuration object that allows for theming and the passing of context:
```js
import {createEditor} from 'lexical';
const config = {
theme: {
...
},
};
const editor = createEditor(config);
```
Once you have an editor instance, when ready, you can associate the editor instance with a content editable `<div>` element in your document:
```js
const contentEditableElement = document.getElementById('editor');
editor.setRootElement(contentEditableElement);
```
If you want to clear the editor instance from the element, you can pass `null`. Alternatively, you can switch to another element if need be,
just pass an alternative element reference to `setRootElement`.

@@ -1,7 +0,10 @@

'use strict';var r=require("lexical");function v(a,...e){e.forEach(g=>{null!=g&&"string"===typeof g&&a.classList.add(...g.split(" "))})}const x=document.createElement("style");x.appendChild(document.createTextNode("::selection{background-color: transparent}"));function A(a){for(;null!=a;){const e=a.nodeName;if("TD"===e||"TH"===e){a=a._cell;if(void 0===a)break;return a}a=a.parentNode}return null}
function B(a){const e=[],g={rows:0,columns:0,cells:e};(new MutationObserver(b=>{var d=a.firstChild;let h=0,f=0,n=!1;for(let k=0;k<b.length;k++){const l=b[k].target.nodeName;if("TABLE"===l||"TR"===l){n=!0;break}}if(n){for(e.length=0;null!=d;){b=d.nodeName;if("TD"===b||"TH"===b)b={elem:d,highlighted:!1,x:h,y:f},d._cell=b,void 0===e[f]&&(e[f]=[]),e[f][h]=b;else if(b=d.firstChild,null!=b){d=b;continue}b=d.nextSibling;if(null!=b)h++,d=b;else if(b=d.parentNode,null!=b){d=b.nextSibling;if(null==d)break;
f++;h=0}}g.columns=h+1;g.rows=f+1}})).observe(a,{childList:!0,subtree:!0});return g}function C(a,e,g,b,d){const h=[];for(let f=0;f<d.length;f++){const n=d[f];for(let k=0;k<n.length;k++){const l=n[k],q=l.elem.style;k>=a&&k<=e&&f>=g&&f<=b?(l.highlighted||(l.highlighted=!0,q.setProperty("background-color","rgb(163, 187, 255)"),q.setProperty("caret-color","transparent")),h.push(l)):l.highlighted&&(l.highlighted=!1,q.removeProperty("background-color"),q.removeProperty("caret-color"))}}return h}
function D(a,e,g){const b=B(e);if(null!==g.getRootElement()){var d=!1,h=!1,f=-1,n=-1,k=-1,l=-1,q=[];e.addEventListener("mousemove",m=>{if(d){var c=A(m.target);if(null!==c){const t=c.x;c=c.y;if(!h&&(f!==t||n!==c))m.preventDefault(),m=window.getSelection(),m.setBaseAndExtent(m.anchorNode,0,m.anchorNode,0),h=!0,document.body&&document.body.appendChild(x),null===u&&(u=g.addListener("command",(w,y)=>{if("deleteCharacter"===w){if(q.length===b.columns*b.rows)return a.selectPrevious(),a.remove(),z(),!0;q.forEach(({elem:p})=>
{p=r.$getNearestNodeFromDOMNode(p);r.$isElementNode(p)&&p.clear()});return!0}return"formatText"===w?(F(y),!0):!1},1));else if(t===k&&c===l)return;k=t;l=c;h&&(q=C(Math.min(f,k),Math.max(f,k),Math.min(n,l),Math.max(n,l),b.cells))}}});var z=()=>{d=h=!1;l=k=n=f=-1;C(-1,-1,-1,-1,b.cells);q=[];null!==u&&(u(),u=null);const m=x.parentNode;null!=m&&m.removeChild(x)};e.addEventListener("mouseleave",()=>{});var F=m=>{let c=r.$getSelection();null===c&&(c=r.$createSelection());const t=c,w=t.anchor,y=t.focus;q.forEach(p=>
{p=r.$getNearestNodeFromDOMNode(p.elem);r.$isElementNode(p)&&(w.set(p.getKey(),0,"element"),y.set(p.getKey(),p.getChildrenSize(),"element"),t.formatText(m))});c.anchor.set(c.anchor.key,c.anchor.offset,c.anchor.type);c.focus.set(c.anchor.key,c.anchor.offset,c.anchor.type);r.$setSelection(c)},u=null;e.addEventListener("mousedown",m=>{d?h&&z():setTimeout(()=>{h&&z();const c=A(m.target);null!==c&&(d=!0,f=c.x,n=c.y,document.addEventListener("mouseup",()=>{d=!1},{capture:!0,once:!0}))},0)})}}
class E extends r.ElementNode{static getType(){return"table"}static clone(a){return new E(a.__key)}constructor(a){super(a)}createDOM(a,e){const g=document.createElement("table");v(g,a.theme.table);D(this,g,e);return g}updateDOM(){return!1}canExtractContents(){return!1}canBeEmpty(){return!1}}exports.$createTableNode=function(){return new E};exports.$isTableNode=function(a){return a instanceof E};exports.TableNode=E;
'use strict';var r=require("lexical");function y(a,...f){f.forEach(e=>{null!=e&&"string"===typeof e&&a.classList.add(...e.split(" "))})}const z=document.createElement("style");z.appendChild(document.createTextNode("::selection{background-color: transparent}"));function A(a){for(;null!=a;){const f=a.nodeName;if("TD"===f||"TH"===f){a=a._cell;if(void 0===a)break;return a}a=a.parentNode}return null}
function B(a,f,e){const q=[],l={rows:0,columns:0,cells:q};(new MutationObserver(p=>{e.update(()=>{var d=f.firstChild;let m=0,g=0;var b=!1;for(let h=0;h<p.length;h++){const t=p[h].target.nodeName;if("TABLE"===t||"TR"===t){b=!0;break}}if(b){for(q.length=0;null!=d;){b=d.nodeName;if("TD"===b||"TH"===b)b={elem:d,highlighted:!1,x:m,y:g},d._cell=b,void 0===q[g]&&(q[g]=[]),q[g][m]=b;else if(b=d.firstChild,null!=b){d=b;continue}b=d.nextSibling;if(null!=b)m++,d=b;else if(b=d.parentNode,null!=b){d=b.nextSibling;
if(null==d)break;g++;m=0}}l.columns=m+1;l.rows=g+1;a.setGrid(l)}})})).observe(f,{childList:!0,subtree:!0});a.setGrid(l);return l}
function C(a,f,e,q,l){const p=[];for(let d=0;d<l.length;d++){const m=l[d];for(let g=0;g<m.length;g++){const b=m[g],h=b.elem.style;g>=a&&g<=f&&d>=e&&d<=q?(b.highlighted||(b.highlighted=!0,h.setProperty("background-color","rgb(163, 187, 255)"),h.setProperty("caret-color","transparent")),p.push(b)):b.highlighted&&(b.highlighted=!1,h.removeProperty("background-color"),h.removeProperty("caret-color"))}}return p}
function D(a,f,e){const q=a.getGrid();if(null!==e.getRootElement()){var l=!1,p=!1,d=-1,m=-1,g=-1,b=-1,h=[];if(null==q)throw Error("Table grid not found.");f.addEventListener("mousemove",k=>{if(l){var c=A(k.target);if(null!==c){const u=c.x;c=c.y;if(!p&&(d!==u||m!==c))k.preventDefault(),k=window.getSelection(),k.setBaseAndExtent(k.anchorNode,0,k.anchorNode,0),p=!0,document.body&&document.body.appendChild(z),null===w&&(w=e.addListener("command",(v,x)=>{if("deleteCharacter"===v){if(h.length===q.columns*
q.rows)return a.selectPrevious(),a.remove(),t(),!0;h.forEach(({elem:n})=>{n=r.$getNearestNodeFromDOMNode(n);r.$isElementNode(n)&&n.clear()});return!0}if("formatText"===v)return F(x),!0;"insertText"===v&&t();return!1},1));else if(u===g&&c===b)return;g=u;b=c;if(p){const v=Math.min(d,g),x=Math.max(d,g),n=Math.min(m,b),G=Math.max(m,b);e.update(()=>{h=a.setSelectionState({fromX:v,toX:x,fromY:n,toY:G})})}}}});var t=()=>{e.update(()=>{l=p=!1;b=g=m=d=-1;e.update(()=>{a.setSelectionState(null)});h=[];null!==
w&&(w(),w=null);const k=z.parentNode;null!=k&&k.removeChild(z)})};f.addEventListener("mouseleave",()=>{});var F=k=>{let c=r.$getSelection();null===c&&(c=r.$createSelection());const u=c,v=u.anchor,x=u.focus;h.forEach(n=>{n=r.$getNearestNodeFromDOMNode(n.elem);r.$isElementNode(n)&&(v.set(n.getKey(),0,"element"),x.set(n.getKey(),n.getChildrenSize(),"element"),u.formatText(k))});c.anchor.set(c.anchor.key,c.anchor.offset,c.anchor.type);c.focus.set(c.anchor.key,c.anchor.offset,c.anchor.type);r.$setSelection(c)},
w=null;f.addEventListener("mousedown",k=>{l?p&&t():setTimeout(()=>{p&&t();const c=A(k.target);null!==c&&(l=!0,d=c.x,m=c.y,document.addEventListener("mouseup",()=>{l=!1},{capture:!0,once:!0}))},0)});window.addEventListener("click",k=>{0<h.length&&!f.contains(k.target)&&e.update(()=>{a.setSelectionState(null)})})}}
class E extends r.ElementNode{static getType(){return"table"}static clone(a){return new E(a.__key,a.__selectionShape,a.__grid)}constructor(a,f,e){super(a);this.__selectionShape=f;this.__grid=e}createDOM(a,f){const e=document.createElement("table");y(e,a.theme.table);B(this,e,f);D(this,e,f);return e}updateDOM(){return!1}canExtractContents(){return!1}canBeEmpty(){return!1}setSelectionState(a){this.getWritable().__selectionShape=a;return null==this.__grid?[]:a?C(a.fromX,a.toX,a.fromY,a.toY,this.__grid.cells):
C(-1,-1,-1,-1,this.__grid.cells)}getSelectionState(){return this.__selectionShape}setGrid(a){this.getWritable().__grid=a}getGrid(){return this.__grid}}exports.$createTableNode=function(){return new E};exports.$isTableNode=function(a){return a instanceof E};exports.TableNode=E;exports.trackTableGrid=B;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc