lexical 0.14.2 → 0.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Lexical.dev.js +79 -14
- package/{Lexical.dev.esm.js → Lexical.dev.mjs} +79 -15
- package/Lexical.js.flow +4 -1
- package/{Lexical.esm.js → Lexical.mjs} +3 -2
- package/Lexical.node.mjs +116 -0
- package/Lexical.prod.js +185 -183
- package/Lexical.prod.mjs +7 -0
- package/LexicalSelection.d.ts +1 -0
- package/index.d.ts +2 -3
- package/nodes/LexicalElementNode.d.ts +1 -1
- package/nodes/LexicalParagraphNode.d.ts +15 -5
- package/nodes/LexicalTextNode.d.ts +1 -1
- package/package.json +21 -3
- package/Lexical.prod.esm.js +0 -7
package/Lexical.prod.js
CHANGED
|
@@ -4,208 +4,210 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
'use strict';let aa={},ca={},da={},ea={},fa={},
|
|
8
|
-
function
|
|
9
|
-
let Ta="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,
|
|
10
|
-
!window.MSStream,$a=Ta&&/Android/.test(navigator.userAgent),ab=Ta&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bb=Ta&&$a&&ab,cb=Ta&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ab,db=Ya||Za||cb?"\u00a0":"\u200b",eb=
|
|
11
|
-
|
|
7
|
+
'use strict';let aa={},ca={},da={},ea={},fa={},ha={},ia={},la={},na={},oa={},pa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},za={},Aa={},Ba={},Ca={},Da={},Ea={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={},Oa={},Pa={},Qa={},Ra={},Sa={};
|
|
8
|
+
function p(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
|
9
|
+
let Ta="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Ua=Ta&&"documentMode"in document?document.documentMode:null,t=Ta&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Va=Ta&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xa=Ta&&"InputEvent"in window&&!Ua?"getTargetRanges"in new window.InputEvent("input"):!1,Ya=Ta&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Za=Ta&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
|
|
10
|
+
!window.MSStream,$a=Ta&&/Android/.test(navigator.userAgent),ab=Ta&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bb=Ta&&$a&&ab,cb=Ta&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ab,db=Ya||Za||cb?"\u00a0":"\u200b",eb=Va?"\u00a0":db,fb=/^[^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]/,gb=/^[^\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]/,
|
|
11
|
+
hb={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},ib={directionless:1,unmergeable:2},jb={center:2,end:6,justify:4,left:1,right:3,start:5},nb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},ob={normal:0,segmented:2,token:1},pb={0:"normal",2:"segmented",1:"token"};function qb(...a){let b=[];for(let c of a)if(c&&"string"===typeof c)for(let [d]of c.matchAll(/\S+/g))b.push(d);return b}let rb=!1,sb=0;
|
|
12
12
|
function tb(a){sb=a.timeStamp}function ub(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function vb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
|
|
13
|
-
function wb(a,b,c){rb=!0;let d=100<performance.now()-sb;try{v(a,()=>{let e=u()||vb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,q="";for(var
|
|
14
|
-
w&&(l=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&zb(A,w,l,r,!1))}else if("childList"===r){m=!0;r=l.addedNodes;for(x=0;x<r.length;x++){z=r[x];var ba=Ab(z),W=z.parentNode;null==W||z===k||null!==ba||"BR"===z.nodeName&&ub(z,W,a)||(
|
|
15
|
-
|
|
13
|
+
function wb(a,b,c){rb=!0;let d=100<performance.now()-sb;try{v(a,()=>{let e=u()||vb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,q="";for(var n=0;n<b.length;n++){var l=b[n],r=l.type,w=l.target,A=xb(w,h);if(!(null===A&&w!==g||y(A)))if("characterData"===r){if(l=d&&B(A))a:{l=e;r=w;var x=A;if(C(l)){var z=l.anchor.getNode();if(z.is(x)&&l.format!==z.getFormat()){l=!1;break a}}l=3===r.nodeType&&x.isAttached()}l&&(x=yb(a._window),r=l=null,null!==x&&x.anchorNode===
|
|
14
|
+
w&&(l=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&zb(A,w,l,r,!1))}else if("childList"===r){m=!0;r=l.addedNodes;for(x=0;x<r.length;x++){z=r[x];var ba=Ab(z),W=z.parentNode;null==W||z===k||null!==ba||"BR"===z.nodeName&&ub(z,W,a)||(Va&&(ba=z.innerText||z.nodeValue)&&(q+=ba),W.removeChild(z))}l=l.removedNodes;r=l.length;if(0<r){x=0;for(z=0;z<r;z++)if(W=l[z],"BR"===W.nodeName&&ub(W,w,a)||k===W)w.appendChild(W),x++;r!==x&&(w===g&&(A=h._nodeMap.get("root")),f.set(w,A))}}}if(0<f.size)for(let [Wa,
|
|
15
|
+
ma]of f)if(E(ma))for(f=ma.getChildrenKeys(),g=Wa.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(Wa.appendChild(k),g=k):g!==k&&Wa.replaceChild(k,g),g=g.nextSibling);else B(ma)&&ma.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,n=0;n<h.length;n++)A=h[n],w=A.parentNode,null==w||"BR"!==A.nodeName||ub(A,k,a)||w.removeChild(A);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,Bb(e)),Va&&Cb(a)&&e.insertRawText(q))})}finally{rb=
|
|
16
16
|
!1}}function Db(a){let b=a._observer;if(null!==b){let c=b.takeRecords();wb(a,c,b)}}function Eb(a){0===sb&&Fb(a).addEventListener("textInput",tb,!0);a._observer=new MutationObserver((b,c)=>{wb(a,b,c)})}function Gb(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function Hb(a,b){let c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
|
17
17
|
function Ib(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Gb(b,a)&&(a=Hb(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Gb(a,c)&&Hb(a,c);break}}}function Jb(a){Kb(a.anchor);Kb(a.focus);return a}
|
|
18
|
-
function Kb(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Lb=1,
|
|
19
|
-
function
|
|
20
|
-
function Yb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Zb(a,b,c){let d=
|
|
18
|
+
function Kb(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Lb=1,Mb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
|
19
|
+
function Nb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return y(xb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}function Ob(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Nb(b)&&Vb(b)===a}catch(e){return!1}}function Vb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Wb(a)}return null}function Xb(a){return a.isToken()||a.isSegmented()}
|
|
20
|
+
function Yb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Zb(a,b,c){let d=hb[b];if(null!==c&&(a&d)===(c&d))return a;a^=d;"subscript"===b?a&=~hb.superscript:"superscript"===b&&(a&=~hb.subscript);return a}function $b(a,b){if(null!=b)a.__key=b;else{G();99<ac&&p(14);b=F();var c=bc(),d=""+Lb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
|
21
21
|
function cc(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
|
22
|
-
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function dc(a){99<ac&&
|
|
22
|
+
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function dc(a){99<ac&&p(14);var b=a.getLatest(),c=b.__parent,d=bc();let e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
|
23
23
|
function H(a){G();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=I(c),null!==b&&b.getWritable()),null!==a&&(a=I(a),null!==a&&a.getWritable()))}function ec(){return fc()?null:F()._compositionKey}function I(a,b){a=(b||bc())._nodeMap.get(a);return void 0===a?null:a}function Ab(a,b){let c=F();a=a[`__lexicalKey_${c._key}`];return void 0!==a?I(a,b):null}function xb(a,b){for(;null!=a;){let c=Ab(a,b);if(null!==c)return c;a=Wb(a)}return null}
|
|
24
24
|
function gc(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function hc(a){return a.read(()=>J().getTextContent())}function ic(a,b){v(a,()=>{var c=bc();if(!c.isEmpty())if("root"===b)J().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function J(){return bc()._nodeMap.get("root")}function Bb(a){G();let b=bc();null!==a&&(a.dirty=!0,a.setCachedNodes(null));b._selection=a}
|
|
25
25
|
function jc(a){var b=F(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Wb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?I("root"):null):I(c)}function kc(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function lc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function mc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
26
26
|
function nc(a,b,c){b=yb(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=xb(d),null!==b&&B(d))){if(b===db&&c){let g=c.length;b=c;f=e=g}null!==b&&zb(d,b,e,f,a)}}}
|
|
27
|
-
function zb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),q=b;(m||e)&&b[b.length-1]===db&&(q=b.slice(0,-1));b=f.getTextContent();if(e||q!==b)if(""===q)if(H(null),Ya||Za||cb)f.remove();else{let
|
|
27
|
+
function zb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),q=b;(m||e)&&b[b.length-1]===db&&(q=b.slice(0,-1));b=f.getTextContent();if(e||q!==b)if(""===q)if(H(null),Ya||Za||cb)f.remove();else{let n=F();setTimeout(()=>{n.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=oc();var g=f.getTextContentSize(),h=ec(),k=f.getKey();f.isToken()||null!==h&&k===h&&!m||C(b)&&(null!==e&&!e.canInsertTextBefore()&&0===b.anchor.offset||b.anchor.key===a.__key&&0===b.anchor.offset&&
|
|
28
28
|
!f.canInsertTextBefore()&&!m||b.focus.key===a.__key&&b.focus.offset===g&&!f.canInsertTextAfter()&&!m)?f.markDirty():(a=u(),C(a)&&null!==c&&null!==d&&(a.setTextNodeRange(f,c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=K(c),f.replace(c),f=c)),f.setTextContent(q))}}}
|
|
29
|
-
function pc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
|
30
|
-
function qc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=qb(a),c[b]=a):a}function rc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&
|
|
29
|
+
function pc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()&&!b.isComposing()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()&&!b.isComposing()||d:!1}
|
|
30
|
+
function qc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=qb(a),c[b]=a):a}function rc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&p(33,c),c=b.klass,b=a.get(c),void 0===b&&(b=new Map,a.set(c,b)),a=b.get(d),c="destroyed"===a&&"created"===e,(void 0===a||c)&&b.set(d,c?"updated":e))}
|
|
31
31
|
function sc(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}function tc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),sc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?sc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
|
32
|
-
function Cb(a){a=(a=Fb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function uc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function vc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&
|
|
33
|
-
function xc(a){for(a=a.getParentOrThrow();null!==a&&!yc(a);)a=a.getParentOrThrow();return a}function yc(a){return L(a)||E(a)&&a.isShadowRoot()}function zc(a){a=a.constructor.clone(a);$b(a,null);return a}function Ac(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&
|
|
32
|
+
function Cb(a){a=(a=Fb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function uc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function vc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&p(75,b);return a}function Wb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function wc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Fb(a){a=a._window;null===a&&p(78);return a}
|
|
33
|
+
function xc(a){for(a=a.getParentOrThrow();null!==a&&!yc(a);)a=a.getParentOrThrow();return a}function yc(a){return L(a)||E(a)&&a.isShadowRoot()}function zc(a){a=a.constructor.clone(a);$b(a,null);return a}function Ac(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&p(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||p(98),b):a}function Bc(a,b){a=a.getParent();!L(a)||E(b)||y(b)||p(99)}function Cc(a){return(y(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}
|
|
34
34
|
function Dc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function yb(a){return Ta?(a||window).getSelection():null}function Ec(a){return 1===a.nodeType}function Fc(a){if(y(a)&&!a.isInline())return!0;if(!E(a)||yc(a))return!1;var b=a.getFirstChild();b=null===b||Gc(b)||B(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}
|
|
35
35
|
function Hc(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}function Ic(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(E(a)&&Ic(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}
|
|
36
|
-
function Jc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Ic(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Kc="",
|
|
37
|
-
function
|
|
38
|
-
function
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
function
|
|
42
|
-
function
|
|
43
|
-
N;b.__lexicalDir=d}}function
|
|
44
|
-
function
|
|
45
|
-
d.__format;a!==c.__format&&
|
|
46
|
-
else{void 0===k&&(k=new Set(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
break;case "
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
function
|
|
64
|
-
a):
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
function
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
36
|
+
function Jc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Ic(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Kc=null,Lc="",Mc,O,Nc,Oc=!1,Pc=!1,Qc,Rc=null,Sc,bd,cd,dd,ed,fd;
|
|
37
|
+
function gd(a,b){let c=cd.get(a);if(null!==b){let d=hd(a);d.parentNode===b&&b.removeChild(d)}dd.has(a)||O._keyToDOMMap.delete(a);E(c)&&(a=id(c,cd),jd(a,0,a.length-1,null));void 0!==c&&rc(fd,Nc,Qc,c,"destroyed")}function jd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&gd(e,d)}}function kd(a,b){a.setProperty("text-align",b)}
|
|
38
|
+
function ld(a,b){var c=Mc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function md(a,b){a=a.style;0===b?kd(a,""):1===b?kd(a,"left"):2===b?kd(a,"center"):3===b?kd(a,"right"):4===b?kd(a,"justify"):5===b?kd(a,"start"):6===b&&kd(a,"end")}
|
|
39
|
+
function nd(a,b,c){let d=dd.get(a);void 0===d&&p(60);let e=d.createDOM(Mc,O);var f=O._keyToDOMMap;e["__lexicalKey_"+O._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):y(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&ld(e,a);if(0!==f){--f;a=id(d,dd);var g=N;N="";od(a,d,0,f,e,null);pd(d,e);N=g}a=d.__format;0!==a&&md(e,a);d.isInline()||qd(null,d,e);uc(d)&&(M+="\n\n",Lc+="\n\n")}else f=d.getTextContent(),y(d)?(g=d.decorate(O,Mc),null!==g&&
|
|
40
|
+
rd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(N+=f)),M+=f,Lc+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));rc(fd,Nc,Qc,d,"created");return e}function od(a,b,c,d,e,f){let g=M;for(M="";c<=d;++c){nd(a[c],e,f);let h=dd.get(a[c]);null!==h&&null===Kc&&B(h)&&(Kc=h.getFormat())}uc(b)&&(M+="\n\n");e.__lexicalTextContent=M;M=g+M}function sd(a,b){a=b.get(a);return Gc(a)||y(a)&&a.isInline()}
|
|
41
|
+
function qd(a,b,c){a=null!==a&&(0===a.__size||sd(a.__last,cd));b=0===b.__size||sd(b.__last,dd);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
42
|
+
function pd(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==N||c!==Rc){let f=""===N;if(f)var d=Rc;else d=N,d=fb.test(d)?"rtl":gb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Mc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=qb(e),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=qb(k),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);Pc||(a.getWritable().__dir=d)}Rc=d;b.__lexicalDirTextContent=
|
|
43
|
+
N;b.__lexicalDir=d}}function id(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&p(101);c.push(a);a=d.__next}return c}
|
|
44
|
+
function td(a,b){var c=cd.get(a),d=dd.get(a);void 0!==c&&void 0!==d||p(61);var e=Oc||bd.has(a)||Sc.has(a);let f=vc(O,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(M+=d,Lc+=d),d=f.__lexicalDirTextContent,void 0!==d&&(N+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(N+=d),Lc+=d,M+=d),f;c!==d&&e&&rc(fd,Nc,Qc,d,"updated");if(d.updateDOM(c,f,Mc))return d=nd(a,null,null),null===b&&p(62),b.replaceChild(d,f),gd(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&ld(f,a);a=
|
|
45
|
+
d.__format;a!==c.__format&&md(f,a);if(e){a=N;N="";Kc=null;e=M;var g=c.__size,h=d.__size;M="";if(1===g&&1===h){var k=c.__first,m=d.__first;if(k===m)td(k,f);else{b=hd(k);var q=nd(m,null,null);f.replaceChild(q,b);gd(k,null)}k=dd.get(m);null===Kc&&B(k)&&(Kc=k.getFormat())}else{b=id(c,cd);var n=id(d,dd);if(0===g)0!==h&&od(n,d,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,jd(b,0,g-1,k?null:f),k&&(f.textContent=""));else{q=b;b=n;n=g-1;g=h-1;let w=f.firstChild,A=0;for(h=0;A<=n&&h<=g;){var l=
|
|
46
|
+
q[A],r=b[h];if(l===r)w=ud(td(r,f)),A++,h++;else{void 0===k&&(k=new Set(q));void 0===m&&(m=new Set(b));let x=m.has(l),z=k.has(r);x?(z?(l=vc(O,r),l===w?w=ud(td(r,f)):(null!=w?f.insertBefore(l,w):f.appendChild(l),td(r,f)),A++):nd(r,f,w),h++):(w=ud(hd(l)),gd(l,f),A++)}r=dd.get(r);null!==r&&null===Kc&&B(r)&&(Kc=r.getFormat())}k=A>n;m=h>g;k&&!m?(k=b[g+1],k=void 0===k?null:O.getElementByKey(k),od(b,d,h,g,f,k)):m&&!k&&jd(q,A,n,f)}}uc(d)&&(M+="\n\n");f.__lexicalTextContent=M;M=e+M;pd(d,f);vd(d)&&null!=Kc&&
|
|
47
|
+
Kc!==d.__textFormat&&d.setTextFormat(Kc);N=a;Kc=null;L(d)||d.isInline()||qd(c,d,f)}uc(d)&&(M+="\n\n",Lc+="\n\n")}else c=d.getTextContent(),y(d)?(e=d.decorate(O,Mc),null!==e&&rd(a,e)):B(d)&&!d.isDirectionless()&&(N+=c),M+=c,Lc+=c;!Pc&&L(d)&&d.__cachedText!==Lc&&(d.getWritable().__cachedText=Lc);return f}function rd(a,b){let c=O._pendingDecorators,d=O._decorators;if(null===c){if(d[a]===b)return;c=gc(O)}c[a]=b}
|
|
48
|
+
function ud(a){a=a.nextSibling;null!==a&&a===O._blockCursorElement&&(a=a.nextSibling);return a}function hd(a){let b=ed.get(a);void 0===b&&p(75,a);return b}let wd=Object.freeze({}),Dd=[["keydown",xd],["pointerdown",yd],["compositionstart",zd],["compositionend",Ad],["input",Bd],["click",Cd],["cut",wd],["copy",wd],["dragstart",wd],["dragover",wd],["dragend",wd],["paste",wd],["focus",wd],["blur",wd],["drop",wd]];Xa&&Dd.push(["beforeinput",(a,b)=>Ed(a,b)]);
|
|
49
|
+
let Fd=0,Gd=0,Hd=0,Id=null,Jd=new WeakMap,Kd=!1,Ld=!1,Md=!1,Nd=!1,Od=[0,"",0,"root",0];
|
|
50
|
+
function Pd(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=F();let m=yb(k._window),q=null!==m?m.anchorNode:null,n=f.key;k=k.getElementByKey(n);let l=c.length;return n!==g.key||!B(h)||(!e&&(!Xa||Hd<d+50)||h.isDirty()&&2>l||kc(c))&&f.offset!==g.offset&&!h.isComposing()||Xb(h)||h.isDirty()&&1<l||(e||!Xa)&&null!==k&&!h.isComposing()&&q!==Yb(k)||null!==m&&null!==b&&(!b.collapsed||b.startContainer!==m.anchorNode||b.startOffset!==m.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
|
51
|
+
pc(a,h)}function Qd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
|
52
|
+
function Rd(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Kd&&(Kd=!1,Qd(d,e)&&Qd(f,g)))return;v(b,()=>{if(!c)Bb(null);else if(Ob(b,d,f)){var h=u();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var q=Fb(b).event;q=q?q.timeStamp:performance.now();let [A,x,z,ba,W]=Od;var n=J();n=!1===b.isComposing()&&""===n.getTextContent();q<W+200&&k.offset===z&&k.key===ba?(h.format=A,h.style=x):"text"===k.type?(B(m)||p(141),
|
|
53
|
+
h.format=m.getFormat(),h.style=m.getStyle()):"element"!==k.type||n||(k=k.getNode(),k instanceof Sd&&0===k.getChildrenSize()?h.format=k.getTextFormat():h.format=0,h.style="")}else{var l=k.key,r=h.focus.key;k=h.getNodes();m=k.length;var w=h.isBackward();q=w?g:e;n=w?e:g;let A=w?r:l;l=w?l:r;r=255;w=!1;for(let x=0;x<m;x++){let z=k[x],ba=z.getTextContentSize();if(B(z)&&0!==ba&&!(0===x&&z.__key===A&&q===ba||x===m-1&&z.__key===l&&0===n)&&(w=!0,r&=z.getFormat(),0===r))break}h.format=w?r:0}}R(b,aa,void 0)}})}
|
|
54
|
+
function Cd(a,b){v(b,()=>{let c=u();var d=yb(b._window);let e=oc();if(d)if(C(c)){let g=c.anchor;var f=g.getNode();"element"===g.type&&0===g.offset&&c.isCollapsed()&&!L(f)&&1===J().getChildrenSize()&&f.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)?(d.removeAllRanges(),c.dirty=!0):3!==a.detail||c.isCollapsed()||(d=c.focus.getNode(),f!==d&&(E(f)?f.select(0):f.getParentOrThrow().select(0)))}else"touch"===a.pointerType&&(f=d.anchorNode,null!==f&&(f=f.nodeType,1===f||3===f))&&(d=Td(e,d,b,a),
|
|
55
|
+
Bb(d));R(b,ca,a)})}function yd(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{y(xb(c))||(Ld=!0)})}function Ud(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Vd(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
|
|
56
|
+
function Ed(a,b){let c=a.inputType,d=Ud(a);"deleteCompositionText"===c||Va&&Cb(b)||"insertCompositionText"!==c&&v(b,()=>{var e=u();if("deleteContentBackward"===c){if(null===e){var f=oc();if(!C(f))return;Bb(f.clone())}if(C(e)){f=e.anchor.key===e.focus.key;if(229===Gd&&a.timeStamp<Fd+30&&b.isComposing()&&f)H(null),Fd=0,setTimeout(()=>{v(b,()=>{H(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),B(f)||p(142),e.style=f.getStyle());else{H(null);a.preventDefault();var g=e.anchor.getNode().getTextContent();
|
|
57
|
+
e=0===e.anchor.offset&&e.focus.offset===g.length;bb&&f&&!e||R(b,da,!0)}return}}if(C(e)){f=a.data;null!==Id&&nc(!1,b,Id);e.dirty&&null===Id||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Id=null;var h=e.focus;g=e.anchor.getNode();h=h.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),R(b,ea,!1)):"\n\n"===f?(a.preventDefault(),R(b,fa,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),e.insertRawText(f)):
|
|
58
|
+
null!=f&&Pd(e,d,f,a.timeStamp,!0)?(a.preventDefault(),R(b,ha,f)):Id=f,Hd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":R(b,ha,a);break;case "insertFromComposition":H(null);R(b,ha,a);break;case "insertLineBreak":H(null);R(b,ea,!1);break;case "insertParagraph":H(null);Md&&!Za?(Md=!1,R(b,ea,!1)):R(b,fa,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":R(b,ia,a);break;case "deleteByComposition":Vd(g,h)&&R(b,
|
|
59
|
+
la,a);break;case "deleteByDrag":case "deleteByCut":R(b,la,a);break;case "deleteContent":R(b,da,!1);break;case "deleteWordBackward":R(b,na,!0);break;case "deleteWordForward":R(b,na,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":R(b,oa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":R(b,oa,!1);break;case "formatStrikeThrough":R(b,pa,"strikethrough");break;case "formatBold":R(b,pa,"bold");break;case "formatItalic":R(b,pa,"italic");
|
|
60
|
+
break;case "formatUnderline":R(b,pa,"underline");break;case "historyUndo":R(b,ra,void 0);break;case "historyRedo":R(b,sa,void 0)}}})}
|
|
61
|
+
function Bd(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data,e=Ud(a);if(null!=d&&C(c)&&Pd(c,e,d,a.timeStamp,!1)){Nd&&(Wd(b,d),Nd=!1);var f=c.anchor,g=f.getNode();e=yb(b._window);if(null===e)return;let h=f.offset;if(f=Xa&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||R(b,ha,d);d=d.length;Va&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
|
62
|
+
d);Ya||Za||cb||!b.isComposing()||(Fd=0,H(null))}else nc(!1,b,null!==d?d:void 0),Nd&&(Wd(b,d||void 0),Nd=!1);G();c=F();Db(c)});Id=null}function zd(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();H(d.key);(a.timeStamp<Fd+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||B(e)&&e.getStyle()!==c.style)&&R(b,ha,eb)}})}
|
|
63
|
+
function Wd(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=I(c);a=Yb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&zb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);R(a,Ba,null);return}}nc(!0,a,b)}function Ad(a,b){Va?Nd=!0:v(b,()=>{Wd(b,a.data)})}
|
|
64
|
+
function xd(a,b){Fd=a.timeStamp;Gd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!R(b,ta,a)){if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)Md=!0,R(b,Ba,a);else if(32===c)R(b,Ca,a);else if(t&&e&&79===c)a.preventDefault(),Md=!0,R(b,ea,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?R(b,Da,a):(a.preventDefault(),R(b,da,!0)):27===c?R(b,Ea,
|
|
65
|
+
a):(h=t?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?R(b,Ha,a):(a.preventDefault(),R(b,da,!1)):8===c&&(t?g:e)?(a.preventDefault(),R(b,na,!0)):46===c&&(t?g:e)?(a.preventDefault(),R(b,na,!1)):t&&f&&8===c?(a.preventDefault(),R(b,oa,!0)):t&&f&&46===c?(a.preventDefault(),R(b,oa,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,pa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,pa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,pa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
|
|
66
|
+
R(b,ra,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),R(b,sa,void 0)):Xd(b._editorState._selection)?(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),R(b,Na,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),R(b,Oa,a)):65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a)))):!Va&&65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a))):R(b,Ia,a))}else Md=!1,R(b,Ba,a);else R(b,Aa,a);else R(b,za,a);else R(b,xa,a);else R(b,wa,a);else R(b,va,a);else R(b,ua,a);(e||d||g||f)&&R(b,Sa,a)}}}
|
|
67
|
+
function Yd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Zd=new Map;
|
|
68
|
+
function $d(a){var b=a.target;let c=yb(null==b?null:9===b.nodeType?b.defaultView:b.ownerDocument.defaultView);if(null!==c){var d=Vb(c.anchorNode);if(null!==d){Ld&&(Ld=!1,v(d,()=>{var h=oc(),k=c.anchorNode;null!==k&&(k=k.nodeType,1===k||3===k)&&(h=Td(h,c,d,a),Bb(h))}));b=lc(d);b=b[b.length-1];var e=b._key,f=Zd.get(e),g=f||b;g!==d&&Rd(c,g,!1);Rd(c,d,!0);d!==b?Zd.set(e,d):f&&Zd.delete(e)}}}
|
|
69
|
+
function ae(a,b){var c=a.ownerDocument,d=Jd.get(c);(void 0===d||1>d)&&c.addEventListener("selectionchange",$d);Jd.set(c,d||1);a.__lexicalEditor=b;c=Yd(a);for(d=0;d<Dd.length;d++){let [e,f]=Dd[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,(b.isEditable()||"click"===e)&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return R(b,Oa,h);case "copy":return R(b,Na,h);case "paste":return R(b,ia,h);case "dragstart":return R(b,
|
|
70
|
+
Ka,h);case "dragover":return R(b,La,h);case "dragend":return R(b,Ma,h);case "focus":return R(b,Qa,h);case "blur":return R(b,Ra,h);case "drop":return R(b,Ja,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
|
71
|
+
function be(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=u();if(C(f)&&E(a)){var {anchor:g,focus:h}=f;var k=g.getNode();var m=h.getNode();wc(k,a)&&g.set(a.__key,0,"element");wc(m,a)&&h.set(a.__key,0,"element")}k=f;m=!1;if(C(k)&&b){f=k.anchor;let q=k.focus;f.key===d&&(ce(f,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0);q.key===d&&(ce(q,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0)}else Xd(k)&&b&&a.isSelected()&&a.selectPrevious();C(k)&&b&&!m?(d=a.getIndexWithinParent(),
|
|
72
|
+
cc(a),de(k,e,d,-1)):cc(a);c||yc(e)||e.canBeEmpty()||!e.isEmpty()||be(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
|
73
|
+
class ee{static getType(){p(64,this.name)}static clone(){p(65,this.name)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;$b(this,a)}getType(){return this.__type}isInline(){p(137,this.constructor.name)}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=I(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&
|
|
74
|
+
"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:I(a)}getParentOrThrow(){let a=this.getParent();null===a&&p(66,this.__key);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();
|
|
75
|
+
if(yc(b))return E(a)||p(138),a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&p(67,this.__key);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:I(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==
|
|
75
76
|
b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=this.getLatest().__next;return null===a?null:I(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(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++){let e=b[d];if(c.has(e))return e}return null}is(a){return null==
|
|
76
77
|
a?!1:this.__key===a.__key}isBefore(a){if(this===a)return!1;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=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let 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){let b=this.isBefore(a),c=
|
|
77
|
-
[],d=new Set;for(var e=this;null!==e;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=E(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do if(null===f&&
|
|
78
|
-
F()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=I(this.__key);null===a&&
|
|
79
|
-
B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;dc(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){
|
|
80
|
-
e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;cc(g);let k=d.getPreviousSibling(),m=d.getNextSibling(),q=d.__prev,
|
|
81
|
-
b=!0){G();Bc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();cc(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,q=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;
|
|
82
|
-
b&&C(f)&&(b=this.getIndexWithinParent(),
|
|
83
|
-
|
|
84
|
-
c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function
|
|
85
|
-
class
|
|
86
|
-
version:1}}}function
|
|
87
|
-
function
|
|
88
|
-
function
|
|
89
|
-
class
|
|
90
|
-
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=
|
|
91
|
-
null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;
|
|
92
|
-
e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&
|
|
93
|
-
sub:()=>({conversion:
|
|
94
|
-
return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?
|
|
78
|
+
[],d=new Set;for(var e=this;null!==e;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=E(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do if(null===f&&p(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f)null!==e||d.has(f.__key)||c.push(f);else break;while(null===e)}}b||c.reverse();return c}isDirty(){let a=
|
|
79
|
+
F()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=I(this.__key);null===a&&p(113);return a}getWritable(){G();var a=bc(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&f.setCachedNodes(null);if(b.has(c))return dc(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(vd(d)&&vd(f)&&(f.__textFormat=d.__textFormat),f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,
|
|
80
|
+
f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;dc(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){p(70)}updateDOM(){p(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){p(72)}static importJSON(){p(18,this.name)}static transform(){return null}remove(a){be(this,!0,a)}replace(a,b){G();var c=u();null!==c&&
|
|
81
|
+
(c=c.clone());Bc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;cc(g);let k=d.getPreviousSibling(),m=d.getNextSibling(),q=d.__prev,n=d.__next,l=d.__parent;be(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=q;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=n;g.__parent=l;a.__size=h;b&&(E(this)&&E(g)||p(139),this.getChildren().forEach(r=>{g.append(r)}));C(c)&&(Bb(c),b=c.anchor,c=c.focus,b.key===e&&
|
|
82
|
+
fe(b,g),c.key===e&&fe(c,g));ec()===e&&H(f);return g}insertAfter(a,b=!0){G();Bc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();cc(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,q=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;
|
|
83
|
+
c.__next=m;d.__next=q;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),de(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){G();Bc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;cc(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;
|
|
84
|
+
d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),de(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return ge()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===
|
|
85
|
+
c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function he(a,b,c){c=c||b.getParentOrThrow().getLastChild();let d=b;for(b=[b];d!==c;)d.getNextSibling()||p(140),d=d.getNextSibling(),b.push(d);for(let e of b)a=a.insertAfter(e)}
|
|
86
|
+
class ie extends ee{static getType(){return"linebreak"}static clone(a){return new ie(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{a:{var b=a.parentElement;if(null!==b){let c=b.firstChild;if(c===a||c.nextSibling===a&&je(c))if(b=b.lastChild,b===a||b.previousSibling===a&&je(b)){a=!0;break a}}a=!1}return a?null:{conversion:ke,priority:0}}}}static importJSON(){return le()}exportJSON(){return{type:"linebreak",
|
|
87
|
+
version:1}}}function ke(){return{node:le()}}function le(){return Ac(new ie)}function Gc(a){return a instanceof ie}function je(a){return 3===a.nodeType&&/^( |\t|\r?\n)+$/.test(a.textContent||"")}function me(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function ne(a,b){return b&1?"strong":b&2?"em":"span"}
|
|
88
|
+
function oe(a,b,c,d,e){a=d.classList;d=qc(e,"base");void 0!==d&&a.add(...d);d=qc(e,"underlineStrikethrough");let f=!1,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(let k in hb)h=hb[k],d=qc(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
|
89
|
+
function pe(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?db:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Va){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function qe(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
|
90
|
+
class re extends ee{static getType(){return"text"}static clone(a){return new re(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}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return pb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===ec()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
|
91
|
+
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=hb[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Zb(c,a,b)}canHaveFormat(){return!0}createDOM(a){var b=this.__format,c=me(this,b);let d=ne(this,b),e=document.createElement(null===c?d:c),f=e;this.hasFormat("code")&&e.setAttribute("spellcheck","false");
|
|
92
|
+
null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;pe(this.__text,c,this);a=a.theme.text;void 0!==a&&oe(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=me(this,e);let h=me(this,f);var k=ne(this,e);let m=ne(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&p(48),a=g=document.createElement(m),pe(d,a,this),c=c.theme.text,void 0!==c&&oe(m,0,f,a,c),b.replaceChild(g,
|
|
93
|
+
e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&p(49));pe(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&oe(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:se,priority:0}),b:()=>({conversion:te,priority:0}),code:()=>({conversion:ue,priority:0}),em:()=>({conversion:ue,priority:0}),i:()=>({conversion:ue,priority:0}),s:()=>({conversion:ue,priority:0}),span:()=>({conversion:ve,priority:0}),strong:()=>({conversion:ue,priority:0}),
|
|
94
|
+
sub:()=>({conversion:ue,priority:0}),sup:()=>({conversion:ue,priority:0}),u:()=>({conversion:ue,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&Ec(a)||p(132);a.style.whiteSpace="pre-wrap";this.hasFormat("bold")&&(a=qe(a,"b"));this.hasFormat("italic")&&(a=qe(a,"i"));this.hasFormat("strikethrough")&&(a=qe(a,"s"));this.hasFormat("underline")&&(a=qe(a,"u"));
|
|
95
|
+
return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?hb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?ib[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){let b=this.getFormat();a=Zb(b,a,null);return this.setFormat(a)}toggleDirectionless(){let a=
|
|
95
96
|
this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ob[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=ec(),d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,
|
|
96
|
-
a,this,b);else return
|
|
97
|
-
f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=b.getFormat();let q=b.getStyle(),
|
|
98
|
-
if(C(b)){let x=b.anchor,z=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=r&&(x.key=A,x.offset-=m,b.dirty=!0);z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=r&&(z.key=A,z.offset-=m,b.dirty=!0)}e===d&&H(A);m=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&dc(d);null!==e&&dc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&
|
|
99
|
-
a===this.getNextSibling()||
|
|
100
|
-
function
|
|
101
|
-
function
|
|
102
|
-
function
|
|
103
|
-
b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=
|
|
104
|
-
let
|
|
105
|
-
let
|
|
106
|
-
class
|
|
107
|
-
function
|
|
108
|
-
class
|
|
109
|
-
fc()||(ec()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function
|
|
110
|
-
function
|
|
111
|
-
class
|
|
112
|
-
this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new
|
|
113
|
-
a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof
|
|
114
|
-
class
|
|
115
|
-
d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);fc()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){
|
|
116
|
-
if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=
|
|
117
|
-
|
|
118
|
-
!0}hasFormat(a){return 0!==(this.format&
|
|
119
|
-
var q=b.getParentOrThrow(),
|
|
120
|
-
b.getPreviousSibling();if(!B(l)||Xb(l))l=K(),l.setFormat(e),q.canInsertTextBefore()?b.insertBefore(l):q.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)q=K(b.getTextContent()),q.setFormat(e),b.replace(q),b=q;else if(!(this.isCollapsed()||""===a||(l=
|
|
121
|
-
h)if(b.isToken())a=K(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(
|
|
122
|
-
"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=h))}else{e=new Set([...b.getParentKeys(),...
|
|
123
|
-
|
|
124
|
-
|
|
97
|
+
a,this,b);else return we(e,a,e,b,"text","text");return c}selectStart(){return this.select(0,0)}selectEnd(){let a=this.getTextContentSize();return this.select(a,a)}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=ec(),
|
|
98
|
+
f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=b.getFormat();let q=b.getStyle(),n=b.__detail;g=!1;b.isSegmented()?(h=K(m),h.__format=k,h.__style=q,h.__detail=n,g=!0):(h=b.getWritable(),h.__text=m);b=u();h=[h];m=m.length;for(let w=1;w<f;w++){var l=a[w],r=l.length;l=K(l).getWritable();l.__format=k;l.__style=q;l.__detail=n;let A=l.__key;r=m+r;
|
|
99
|
+
if(C(b)){let x=b.anchor,z=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=r&&(x.key=A,x.offset-=m,b.dirty=!0);z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=r&&(z.key=A,z.offset-=m,b.dirty=!0)}e===d&&H(A);m=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&dc(d);null!==e&&dc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&de(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||
|
|
100
|
+
a===this.getNextSibling()||p(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;ec()===d&&H(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(xe(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(xe(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
|
101
|
+
function ve(a){a=a.style;let b=a.fontWeight,c="700"===b||"bold"===b,d="line-through"===a.textDecoration,e="italic"===a.fontStyle,f="underline"===a.textDecoration,g=a.verticalAlign;return{forChild:h=>{if(!B(h))return h;c&&h.toggleFormat("bold");d&&h.toggleFormat("strikethrough");e&&h.toggleFormat("italic");f&&h.toggleFormat("underline");"sub"===g&&h.toggleFormat("subscript");"super"===g&&h.toggleFormat("superscript");return h},node:null}}
|
|
102
|
+
function te(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}let ye=new WeakMap;
|
|
103
|
+
function se(a){null===a.parentElement&&p(129);for(var b=a.textContent||"",c,d=a.parentNode,e=[a];null!==d&&void 0===(c=ye.get(d))&&!("PRE"===d.nodeName||1===d.nodeType&&void 0!==d.style&&void 0!==d.style.whiteSpace&&d.style.whiteSpace.startsWith("pre"));)e.push(d),d=d.parentNode;c=void 0===c?d:c;for(d=0;d<e.length;d++)ye.set(e[d],c);if(null!==c){b=b.split(/(\r?\n|\t)/);a=[];e=b.length;for(c=0;c<e;c++)d=b[c],"\n"===d||"\r\n"===d?a.push(le()):"\t"===d?a.push(ze()):""!==d&&a.push(K(d));return{node:a}}b=
|
|
104
|
+
b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=Je(e,!1));)if(d=e.textContent||"",0<d.length){/[ \t\n]$/.test(d)&&(b=b.slice(1));c=!1;break}c&&(b=b.slice(1))}if(" "===b[b.length-1]){for(e=!0;null!==a&&null!==(a=Je(a,!0));)if(0<(a.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){e=!1;break}e&&(b=b.slice(0,b.length-1))}return""===b?{node:null}:{node:K(b)}}
|
|
105
|
+
let Ke=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function Je(a,b){for(;;){for(var c=void 0;null===(c=b?a.nextSibling:a.previousSibling);)if(a=a.parentElement,null===a)return null;a=c;if(1===a.nodeType&&(c=a.style.display,""===c&&null===a.nodeName.match(Ke)||""!==c&&!c.startsWith("inline")))return null;for(;null!==(c=b?a.firstChild:a.lastChild);)a=c;if(3===a.nodeType)return a;if("BR"===a.nodeName)return null}}
|
|
106
|
+
let Le={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ue(a){let b=Le[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return Ac(new re(a))}function B(a){return a instanceof re}
|
|
107
|
+
class Me extends re{static getType(){return"tab"}static clone(a){let b=new Me(a.__key);b.__text=a.__text;b.__format=a.__format;b.__style=a.__style;return b}constructor(a){super("\t",a);this.__detail=2}static importDOM(){return null}static importJSON(a){let b=ze();b.setFormat(a.format);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){p(126)}setDetail(){p(127)}setMode(){p(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}
|
|
108
|
+
function ze(){return Ac(new Me)}function Ne(a){return a instanceof Me}
|
|
109
|
+
class Oe{constructor(a,b,c){this._selection=null;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(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=I(this.key);null===a&&p(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
|
110
|
+
fc()||(ec()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function Pe(a,b,c){return new Oe(a,b,c)}function Qe(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function fe(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?Qe(a,c):Qe(a,b)}else Qe(a,b)}
|
|
111
|
+
function Re(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?ge().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function Se(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
112
|
+
class Te{constructor(a){this._cachedNodes=null;this._nodes=a;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){if(!Xd(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();
|
|
113
|
+
this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Te(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=this.getNodes(),c=b.length;var d=b[c-1];if(B(d))d=d.select();else{let e=d.getIndexWithinParent()+1;d=d.getParentOrThrow().select(e,e)}d.insertNodes(a);for(a=0;a<c;a++)b[a].remove()}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=I(c),null!==b&&a.push(b);fc()||(this._cachedNodes=
|
|
114
|
+
a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof Ue}
|
|
115
|
+
class Ue{constructor(a,b,c,d){this.anchor=a;this.focus=b;a._selection=this;b._selection=this;this._cachedNodes=null;this.format=c;this.style=d;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=this.anchor;var b=this.focus,c=a.isBefore(b),
|
|
116
|
+
d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);fc()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Se(this.anchor,a.__key,b,"text");Se(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();
|
|
117
|
+
if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=Ve(this),k="",m=!0;for(let q=0;q<a.length;q++){let n=a[q];if(E(n)&&!n.isInline())m||(k+="\n"),m=n.isEmpty()?!1:!0;else if(m=!1,B(n)){let l=n.getTextContent();if(n===b)if(n===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else n===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!y(n)&&!Gc(n)||n===c&&this.isCollapsed()||(k+=
|
|
118
|
+
n.getTextContent())}return k}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;a=We(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Se(this.anchor,d.key,d.offset,d.type);Se(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Ue(Pe(a.key,a.offset,a.type),Pe(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Zb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=
|
|
119
|
+
!0}hasFormat(a){return 0!==(this.format&hb[a])}insertRawText(a){a=a.split(/(\r?\n|\t)/);let b=[],c=a.length;for(let d=0;d<c;d++){let e=a[d];"\n"===e||"\r\n"===e?b.push(le()):"\t"===e?b.push(ze()):b.push(K(e))}this.insertNodes(b)}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?Re(b,c,e,f):d||"element"!==c.type||Re(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||p(26);d=b.getTextContent().length;
|
|
120
|
+
var q=b.getParentOrThrow(),n=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!q.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();B(l)&&l.canInsertTextBefore()&&!Xb(l)||(l=K(),l.setFormat(e),q.canInsertTextAfter()?b.insertAfter(l):q.insertAfter(l));l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!q.canInsertTextBefore()&&null===b.getPreviousSibling())){l=
|
|
121
|
+
b.getPreviousSibling();if(!B(l)||Xb(l))l=K(),l.setFormat(e),q.canInsertTextBefore()?b.insertBefore(l):q.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)q=K(b.getTextContent()),q.setFormat(e),b.replace(q),b=q;else if(!(this.isCollapsed()||""===a||(l=n.getParent(),q.canInsertTextBefore()&&q.canInsertTextAfter()&&(!E(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");Xe(this.anchor,this.focus,null);this.insertText(a);return}if(1===
|
|
122
|
+
h)if(b.isToken())a=K(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(Ne(b)){a=K(a);a.setFormat(e);a.setStyle(f);a.select();b.replace(a);return}b=b.spliceText(c,m-c,a,!0);""===b.getTextContent()?b.remove():
|
|
123
|
+
"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=h))}else{e=new Set([...b.getParentKeys(),...n.getParentKeys()]);l=E(b)?b:b.getParentOrThrow();f=E(n)?n:n.getParentOrThrow();q=n;if(!l.is(f)&&f.isInline()){do q=f,f=f.getParentOrThrow();while(f.isInline())}if("text"===k.type&&(0!==m||""===n.getTextContent())||"element"===k.type&&n.getIndexWithinParent()<m)if(B(n)&&!n.isToken()&&m!==n.getTextContentSize()){if(n.isSegmented()){var r=K(n.getTextContent());
|
|
124
|
+
n.replace(r);n=r}L(k.getNode())||"text"!==k.type||(n=n.spliceText(0,m,""));e.add(n.__key)}else k=n.getParentOrThrow(),k.canBeEmpty()||1!==k.getChildrenSize()?n.remove():k.remove();else e.add(n.__key);k=f.getChildren();m=new Set(g);n=l.is(f);l=l.isInline()&&null===b.getNextSibling()?l:b;for(r=k.length-1;0<=r;r--){let w=k[r];if(w.is(b)||E(w)&&w.isParentOf(b))break;w.isAttached()&&(!m.has(w)||w.is(q)?n||l.insertAfter(w,!1):w.remove())}if(!n)for(k=f,f=null;null!==k;){m=k.getChildren();n=m.length;if(0===
|
|
125
|
+
n||m[n-1].is(f))e.delete(k.__key),f=k;k=k.getParent()}b.isToken()?c===d?b.select():(a=K(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<h;a++)b=g[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),H(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
|
|
125
126
|
H(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,q=c[m];e="text"===d.type?d.offset:q.getTextContentSize();if(k.is(q))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
|
|
126
|
-
this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var
|
|
127
|
-
this.focus:this.anchor;var c=Hc(b.getNode(),Fc);b=a[a.length-1];if("__language"in c&&E(c))if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=
|
|
128
|
-
f=e[1]);f&&
|
|
129
|
-
[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),a.selectStart(),a):null}insertLineBreak(a){var b=
|
|
130
|
-
a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=tc(d,b);if(y(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b
|
|
127
|
+
this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var n=q.getFormatFlags(a,g);0<e&&(e!==q.getTextContentSize()&&([q]=q.splitText(e)),q.setFormat(n));for(h+=1;h<m;h++){let l=c[h];if(!l.isToken()){let r=l.getFormatFlags(a,n);l.setFormat(r)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(q.__key,e,"text");this.format=g|n}}}}}insertNodes(a){if(0!==a.length){if("root"===this.anchor.key){this.insertParagraph();var b=u();C(b)||p(134);return b.insertNodes(a)}b=this.isBackward()?
|
|
128
|
+
this.focus:this.anchor;var c=Hc(b.getNode(),Fc);b=a[a.length-1];if("__language"in c&&E(c))if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=Ye(this);c.splice(d,0,a);b.selectEnd()}else if(a.some(g=>(E(g)||y(g))&&!g.isInline())){b=Ze(a);a=b.getLastDescendant();var e=b.getChildren();b=E(c)&&c.isEmpty()?null:this.insertParagraph();d=e[e.length-1];var f=e[0];(g=>E(g)&&Fc(g)&&!g.isEmpty()&&E(c)&&(!c.isEmpty()||"__value"in c&&"__checked"in c))(f)&&(E(c)||p(135),c.append(...f.getChildren()),
|
|
129
|
+
f=e[1]);f&&he(c,f);e=Hc(a,Fc);b&&E(e)&&("__value"in b&&"__checked"in b||Fc(d))&&(e.append(...b.getChildren()),b.remove());E(c)&&c.isEmpty()&&c.remove();a.selectEnd();a=E(c)?c.getLastChild():null;Gc(a)&&e!==c&&a.remove()}else E(c)||p(135),d=Ye(this),c.splice(d,0,a),b.selectEnd()}}insertParagraph(){if("root"===this.anchor.key){var a=ge();J().splice(this.anchor.offset,0,[a]);a.select();return a}var b=Ye(this);a=Hc(this.anchor.getNode(),Fc);E(a)||p(136);b=(b=a.getChildAtIndex(b))?[b,...b.getNextSiblings()]:
|
|
130
|
+
[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),a.selectStart(),a):null}insertLineBreak(a){var b=le();this.insertNodes([b]);a&&(a=b.getParentOrThrow(),b=b.getIndexWithinParent(),a.select(b,b))}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Ve(this);if(0===b)return[];if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?
|
|
131
|
+
a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=tc(d,b);if(y(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=$e(),b.add(g.__key),Bb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):
|
|
131
132
|
(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=F(),d=yb(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||Dc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:xc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],wc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?
|
|
132
|
-
b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,
|
|
133
|
-
a?null:a.getNextSibling()),E(b)&&b.isShadowRoot())?!0:!1}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=c.getNode();if(this.forwardDeletion(c,d,a))return;var e=this.focus,f=tc(e,a);if(y(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(d)&&0===d.getChildrenSize()?(d.remove(),a
|
|
134
|
-
"text"===e.type?e.getNode():null;d="text"===c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=e.offset,e=f.getTextContentSize(),f.is(d)||a&&c!==e||!a&&0!==c){
|
|
133
|
+
b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Se(f,b.key,b.offset,b.type),Se(b,d,g,e),this._cachedNodes=null}}}forwardDeletion(a,b,c){return!c&&("element"===a.type&&E(b)&&a.offset===b.getChildrenSize()||"text"===a.type&&a.offset===b.getTextContentSize())&&(a=b.getParent(),b=b.getNextSibling()||(null===
|
|
134
|
+
a?null:a.getNextSibling()),E(b)&&b.isShadowRoot())?!0:!1}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=c.getNode();if(this.forwardDeletion(c,d,a))return;var e=this.focus,f=tc(e,a);if(y(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(d)&&0===d.getChildrenSize()?(d.remove(),a=$e(),a.add(f.__key),Bb(a)):(f.remove(),F().dispatchCommand(aa,void 0));return}if(!a&&E(f)&&E(d)&&d.isEmpty()){d.remove();f.selectStart();return}this.modify("extend",a,"character");if(!this.isCollapsed()){f=
|
|
135
|
+
"text"===e.type?e.getNode():null;d="text"===c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=e.offset,e=f.getTextContentSize(),f.is(d)||a&&c!==e||!a&&0!==c){af(f,a,c);return}}else if(null!==d&&d.isSegmented()&&(c=c.offset,e=d.getTextContentSize(),d.is(f)||a&&0!==c||!a&&c!==e)){af(d,a,c);return}d=this.anchor;f=this.focus;c=d.getNode();e=f.getNode();if(c===e&&"text"===d.type&&"text"===f.type){var g=d.offset,h=f.offset;let k=g<h;e=k?g:h;h=k?h:g;g=h-1;e!==g&&(c=c.getTextContent().slice(e,h),
|
|
135
136
|
kc(c)||(a?f.offset=g:d.offset=g))}}else if(a&&0===c.offset&&("element"===c.type?c.getNode():c.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();a&&!b&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset&&(a=this.anchor.getNode(),a.isEmpty()&&L(a.getParent())&&0===a.getIndexWithinParent()&&a.collapseAtStart(this))}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&
|
|
136
|
-
this.modify("extend",a,"character"));this.removeText()}deleteWord(a){if(this.isCollapsed()){let b=this.anchor,c=b.getNode();if(this.forwardDeletion(b,c,a))return;this.modify("extend",a,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function
|
|
137
|
-
function
|
|
138
|
-
function
|
|
139
|
-
B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&y(f)&&jc(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return
|
|
140
|
-
function
|
|
141
|
-
b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function
|
|
142
|
-
function
|
|
143
|
-
function
|
|
144
|
-
function
|
|
137
|
+
this.modify("extend",a,"character"));this.removeText()}deleteWord(a){if(this.isCollapsed()){let b=this.anchor,c=b.getNode();if(this.forwardDeletion(b,c,a))return;this.modify("extend",a,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Xd(a){return a instanceof Te}function bf(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
|
|
138
|
+
function Ve(a){a=a.getStartEndPoints();if(null===a)return[0,0];let [b,c]=a;return"element"===b.type&&"element"===c.type&&b.key===c.key&&b.offset===c.offset?[0,0]:[bf(b),bf(c)]}function af(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
|
139
|
+
function cf(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=jc(k);if(B(d))e=h?d.getTextContentSize():0;else{f=jc(a);if(null===f)return null;if(E(f)){e=Math.min(f.getChildrenSize(),e);a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=
|
|
140
|
+
c,f=E(a)?a:a.getParentOrThrow()));B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&y(f)&&jc(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return Pe(f.__key,e,"element")}}else d=jc(a);return B(d)?Pe(d.__key,e,"text"):null}
|
|
141
|
+
function df(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
|
142
|
+
b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Xe(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);df(a,d,e);df(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Se(a,d.key,d.offset,d.type),Se(b,c.key,c.offset,c.type))}}
|
|
143
|
+
function We(a,b,c,d,e,f){if(null===a||null===c||!Ob(e,a,c))return null;b=cf(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=cf(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=jc(a),c=jc(c),y(a)&&y(c)))return null;Xe(b,d,f);return[b,d]}function we(a,b,c,d,e,f){let g=bc();a=new Ue(Pe(a,b,e),Pe(c,d,f),0,"");a.dirty=!0;return g._selection=a}function $e(){return new Te(new Set)}
|
|
144
|
+
function ef(a){let b=a.getEditorState()._selection,c=yb(a._window);return C(b)||null==b?Td(b,c,a,null):b.clone()}
|
|
145
|
+
function Td(a,b,c,d){var e=c._window;if(null===e)return null;var f=(e=d||e.event)?e.type:void 0;d="selectionchange"===f;e=!rb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Ob(c,e,f))return a.clone()}else return a.clone();c=We(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Ue(h,k,C(a)?a.format:
|
|
145
146
|
0,C(a)?a.style:"")}function u(){return bc()._selection}function oc(){return F()._editorState._selection}
|
|
146
|
-
function
|
|
147
|
-
function
|
|
148
|
-
1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function
|
|
149
|
-
function
|
|
150
|
-
function
|
|
151
|
-
function
|
|
152
|
-
function
|
|
153
|
-
function F(){null===T&&
|
|
154
|
-
function
|
|
155
|
-
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var
|
|
159
|
-
X!==d||null!==X&&
|
|
160
|
-
|
|
161
|
-
let
|
|
162
|
-
"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),
|
|
163
|
-
let V=
|
|
164
|
-
null===h||null!==g&&g.is(h)||a.dispatchCommand(aa,void 0);var
|
|
165
|
-
|
|
147
|
+
function de(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)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),ff(a)}else{let m=a.isBackward();h=m?f:e;var k=h.getNode();e=m?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}ff(a)}}
|
|
148
|
+
function ff(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
|
149
|
+
1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function gf(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
|
150
|
+
function ce(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function xe(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
|
151
|
+
function Ye(a){a.isCollapsed()||a.removeText();var b=a.anchor;a=b.getNode();for(b=b.offset;!Fc(a);)[a,b]=hf(a,b);return b}
|
|
152
|
+
function hf(a,b){var c=a.getParent();if(!c)return c=ge(),J().append(c),c.select(),[J(),0];if(B(a)){var d=a.splitText(b);if(0===d.length)return[c,a.getIndexWithinParent()];a=0===b?0:1;a=d[0].getIndexWithinParent()+a;return[c,a]}if(!E(a)||0===b)return[c,a.getIndexWithinParent()];if(d=a.getChildAtIndex(b))b=new Ue(Pe(a.__key,b,"element"),Pe(a.__key,b,"element"),0,""),(b=a.insertNewAfter(b))&&b.append(d,...d.getNextSiblings());return[c,a.getIndexWithinParent()+1]}
|
|
153
|
+
function Ze(a){let b=ge(),c=null;for(let d=0;d<a.length;d++){let e=a[d],f=Gc(e);if(f||y(e)&&e.isInline()||E(e)&&e.isInline()||B(e)||e.isParentRequired()){if(null===c&&(c=e.createParentElementNode(),b.append(c),f))continue;null!==c&&c.append(e)}else b.append(e),c=null}return b}let S=null,T=null,U=!1,jf=!1,ac=0,kf={characterData:!0,childList:!0,subtree:!0};function fc(){return U||null!==S&&S._readOnly}function G(){U&&p(13)}function bc(){null===S&&p(15);return S}
|
|
154
|
+
function F(){null===T&&p(16);return T}function lf(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&p(30,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 mf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Ib(b)}
|
|
155
|
+
function nf(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=ec(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let q of g)g=a.get(q),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Ib(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&lf(b,g,f),c.add(q);g=b._dirtyLeaves;h=g.size;if(0<h){ac++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let q of k)if(k=q[0],m=q[1],"root"===k||m)g=a.get(k),void 0!==
|
|
156
|
+
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&lf(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;ac++}b._dirtyLeaves=c;b._dirtyElements=d}function of(a,b){var c=a.type,d=b.get(c);void 0===d&&p(17,c);c=d.klass;a.type!==c.getType()&&p(18,c.name);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=of(a[d],b);c.append(e)}return c}function pf(a,b){let c=S,d=U,e=T;S=a;U=!0;T=null;try{return b()}finally{S=c,U=d,T=e}}
|
|
157
|
+
function qf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,m=S,q=U,n=T,l=a._updating,r=a._observer,w=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==r){T=a;S=c;U=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;r.disconnect();var A=D,x=P,z=Q;N=Lc=M="";Oc=2===A;Rc=null;O=a;Mc=a._config;Nc=a._nodes;Qc=O._listeners.mutation;Sc=x;bd=z;cd=f._nodeMap;
|
|
158
|
+
dd=c._nodeMap;Pc=c._readOnly;ed=new Map(a._keyToDOMMap);let ja=new Map;fd=ja;td("root",null);fd=ed=Mc=dd=cd=bd=Sc=Nc=O=void 0;w=ja}catch(D){D instanceof Error&&a._onError(D);if(jf)throw D;rf(a,null,d,c);Eb(a);a._dirtyType=2;jf=!0;qf(a,f);jf=!1;return}finally{r.observe(d,kf),a._updating=l,S=m,U=q,T=n}}c._readOnly||(c._readOnly=!0);var ba=a._dirtyLeaves,W=a._dirtyElements,Wa=a._normalizedNodes,ma=a._updateTags,Tc=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
|
159
|
+
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var Ae=a._decorators,Pb=a._pendingDecorators||Ae,Cf=c._nodeMap,Uc;for(Uc in Pb)Cf.has(Uc)||(Pb===Ae&&(Pb=gc(a)),delete Pb[Uc]);var ka=e?null:yb(a._window);if(a._editable&&null!==ka&&(k||null===h||h.dirty)){T=a;S=c;try{null!==r&&r.disconnect();if(k||null===h||h.dirty){let D=a._blockCursorElement;null!==D&&Dc(D,a,d);a:{let P=ka.anchorNode,Q=ka.focusNode,ja=ka.anchorOffset,kb=ka.focusOffset,X=document.activeElement;if(!(ma.has("collaboration")&&
|
|
160
|
+
X!==d||null!==X&&Nb(X)))if(C(h)){var lb=h.anchor,Vc=h.focus,Be=lb.key,Df=Vc.key,Ce=vc(a,Be),De=vc(a,Df),Qb=lb.offset,Ee=Vc.offset,Wc=h.format,Xc=h.style,Fe=h.isCollapsed(),mb=Ce,Rb=De,Yc=!1;if("text"===lb.type){mb=Yb(Ce);let Y=lb.getNode();Yc=Y.getFormat()!==Wc||Y.getStyle()!==Xc}else C(g)&&"text"===g.anchor.type&&(Yc=!0);"text"===Vc.type&&(Rb=Yb(De));if(null!==mb&&null!==Rb){if(Fe&&(null===g||Yc||C(g)&&(g.format!==Wc||g.style!==Xc))){var Ef=performance.now();Od=[Wc,Xc,Qb,Be,Ef]}if(ja===Qb&&kb===
|
|
161
|
+
Ee&&P===mb&&Q===Rb&&("Range"!==ka.type||!Fe)&&(null!==X&&d.contains(X)||d.focus({preventScroll:!0}),"element"!==lb.type))break a;try{ka.setBaseAndExtent(mb,Qb,Rb,Ee)}catch(Y){}if(!ma.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Y=h instanceof Ue&&"element"===h.anchor.type?mb.childNodes[Qb]||null:0<ka.rangeCount?ka.getRangeAt(0):null;if(null!==Y){let Z;if(Y instanceof Text){let V=document.createRange();V.selectNode(Y);Z=V.getBoundingClientRect()}else Z=Y.getBoundingClientRect();
|
|
162
|
+
let ya=d.ownerDocument,Fa=ya.defaultView;if(null!==Fa)for(var {top:Zc,bottom:$c}=Z,Sb,Tb,qa=d;null!==qa;){let V=qa===ya.body;if(V)Sb=0,Tb=Fb(a).innerHeight;else{let Ub=qa.getBoundingClientRect();Sb=Ub.top;Tb=Ub.bottom}let Ga=0;Zc<Sb?Ga=-(Sb-Zc):$c>Tb&&(Ga=$c-Tb);if(0!==Ga)if(V)Fa.scrollBy(0,Ga);else{let Ub=qa.scrollTop;qa.scrollTop+=Ga;let Ge=qa.scrollTop-Ub;Zc-=Ge;$c-=Ge}if(V)break;qa=Wb(qa)}}}Kd=!0}}else null!==g&&Ob(a,P,Q)&&ka.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(h)&&h.isCollapsed()&&
|
|
163
|
+
"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),ja=P.offset,kb=Q.getChildrenSize(),X=!1,Y=null;if(ja===kb){let Z=Q.getChildAtIndex(ja-1);Cc(Z)&&(X=!0)}else{let Z=Q.getChildAtIndex(ja);if(Cc(Z)){let ya=Z.getPreviousSibling();if(null===ya||Cc(ya))X=!0,Y=a.getElementByKey(Z.__key)}}if(X){let Z=a.getElementByKey(Q.__key);if(null===D){let ya=a._config.theme,Fa=document.createElement("div");Fa.contentEditable="false";Fa.setAttribute("data-lexical-cursor","true");
|
|
164
|
+
let V=ya.blockCursor;if(void 0!==V){if("string"===typeof V){let Ga=qb(V);V=ya.blockCursor=Ga}void 0!==V&&Fa.classList.add(...V)}a._blockCursorElement=D=Fa}d.style.caretColor="transparent";null===Y?Z.appendChild(D):Z.insertBefore(D,Y);break a}}null!==D&&Dc(D,a,d)}null!==r&&r.observe(d,kf)}finally{T=n,S=m}}if(null!==w){var Ff=w;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ja,kb]=D[Q],X=Ff.get(kb);void 0!==X&&ja(X,{dirtyLeaves:ba,prevEditorState:f,updateTags:ma})}}C(h)||
|
|
165
|
+
null===h||null!==g&&g.is(h)||a.dispatchCommand(aa,void 0);var ad=a._pendingDecorators;null!==ad&&(a._decorators=ad,a._pendingDecorators=null,sf("decorator",a,!0,ad));var Gf=hc(b||f),He=hc(c);Gf!==He&&sf("textcontent",a,!0,He);sf("update",a,!0,{dirtyElements:W,dirtyLeaves:ba,editorState:c,normalizedNodes:Wa,prevEditorState:b||f,tags:ma});a._deferred=[];if(0!==Tc.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<Tc.length;P++)Tc[P]()}finally{a._updating=D}}var Ie=a._updates;if(0!==Ie.length){let D=
|
|
166
|
+
Ie.shift();if(D){let [P,Q]=D;tf(a,P,Q)}}}}function sf(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
|
166
167
|
function R(a,b,c){if(!1===a._updating||T!==a){let f=!1;a.update(()=>{f=R(a,b,c)});return f}let d=lc(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
|
167
|
-
function
|
|
168
|
-
function
|
|
169
|
-
b();e=
|
|
170
|
-
a._updating=q,ac=0}0!==a._dirtyType||
|
|
171
|
-
class
|
|
168
|
+
function uf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
|
169
|
+
function tf(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new vf(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=S;let k=U,m=T,q=a._updating;S=g;U=!1;a._updating=!0;T=a;try{h&&(a._headless?null!==c._selection&&(g._selection=c._selection.clone()):g._selection=ef(a));let n=a._compositionKey;
|
|
170
|
+
b();e=uf(a,e);gf(g,a);0!==a._dirtyType&&(e?mf(g,a):nf(g,a),uf(a),Jc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let r=g._nodeMap,w=l.focus.key;void 0!==r.get(l.anchor.key)&&void 0!==r.get(w)||p(19)}else Xd(l)&&0===l._nodes.size&&(g._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();qf(a);return}finally{S=f,U=k,T=m,
|
|
171
|
+
a._updating=q,ac=0}0!==a._dirtyType||wf(g,a)?g._flushSync?(g._flushSync=!1,qf(a)):h&&Mb(()=>{qf(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):tf(a,b,c)}class xf extends ee{constructor(a){super(a)}decorate(){p(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function y(a){return a instanceof xf}
|
|
172
|
+
class yf extends ee{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return nb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
|
172
173
|
this.getChildrenSize()}isDirty(){let a=F()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(E(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;E(a);){let b=a.getFirstChild();if(null===b)break;a=b}return a}getLastDescendant(){let a=this.getLastChild();
|
|
173
|
-
for(;E(a);){let b=a.getLastChild();if(null===b)break;a=b}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:I(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&
|
|
174
|
-
null===a&&
|
|
175
|
-
b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=
|
|
176
|
-
void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return
|
|
177
|
-
this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?
|
|
178
|
-
r&&
|
|
179
|
-
a.__prev=null);f.__size=
|
|
180
|
-
function E(a){return a instanceof
|
|
181
|
-
class
|
|
182
|
-
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof
|
|
183
|
-
function
|
|
184
|
-
class
|
|
185
|
-
class
|
|
186
|
-
0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=
|
|
187
|
-
|
|
188
|
-
function
|
|
189
|
-
function
|
|
190
|
-
|
|
174
|
+
for(;E(a);){let b=a.getLastChild();if(null===b)break;a=b}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:I(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&p(45,this.__key);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:I(a)}getLastChildOrThrow(){let a=this.getLastChild();
|
|
175
|
+
null===a&&p(96,this.__key);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();E(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getTextContentSize(){let a=0,
|
|
176
|
+
b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=jb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&(a=this.getLastChild(),B(a)||E(a)))return a.select();
|
|
177
|
+
void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return we(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return a?a.selectStart():this.select()}selectEnd(){let a=this.getLastDescendant();return a?a.selectEnd():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),0,a)}setDirection(a){let b=
|
|
178
|
+
this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?jb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),q=null,n=e-b+d;if(0!==a)if(a===e)q=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(q=l.getPreviousSibling())}if(0<b){var r=null===q?this.getFirstChild():q.getNextSibling();for(l=0;l<b;l++){null===
|
|
179
|
+
r&&p(100);var w=r.getNextSibling(),A=r.__key;r=r.getWritable();cc(r);k.push(A);r=w}}l=q;for(w=0;w<d;w++){A=c[w];null!==l&&A.is(l)&&(q=l=l.getPreviousSibling());r=A.getWritable();r.__parent===g&&n--;cc(r);let x=A.__key;null===l?(f.__first=x,r.__prev=null):(l=l.getWritable(),l.__next=x,r.__prev=l.__key);A.__key===g&&p(76);r.__parent=g;h.push(x);l=A}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=l.__key,b.__next=m.__key):
|
|
180
|
+
a.__prev=null);f.__size=n;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:z}=a;zf(x,k,h)&&ce(x,x.getNode(),this,q,m);zf(z,k,h)&&ce(z,z.getNode(),this,q,m);0!==n||this.canBeEmpty()||yc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
|
|
181
|
+
function E(a){return a instanceof yf}function zf(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
|
182
|
+
class Af extends yf{static getType(){return"root"}static clone(){return new Af}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){p(51)}getTextContent(){let a=this.__cachedText;return!fc()&&0!==F()._dirtyType||null===a?super.getTextContent():a}remove(){p(52)}replace(){p(53)}insertBefore(){p(54)}insertAfter(){p(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||y(c)||p(56)}return super.append(...a)}static importJSON(a){let b=J();b.setFormat(a.format);
|
|
183
|
+
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof Af}function wf(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 Bf(){return new vf(new Map([["root",new Af]]))}
|
|
184
|
+
function Hf(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&p(130,c.name);if(E(a)){let d=b.children;Array.isArray(d)||p(59,c.name);a=a.getChildren();for(c=0;c<a.length;c++){let e=Hf(a[c]);d.push(e)}}return b}
|
|
185
|
+
class vf{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){return pf(this,a)}clone(a){a=new vf(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return pf(this,()=>({root:Hf(J())}))}}
|
|
186
|
+
class Sd extends yf{constructor(a){super(a);this.__textFormat=0}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(a){let b=this.getWritable();b.__textFormat=a;return b}hasTextFormat(a){a=hb[a];return 0!==(this.getTextFormat()&a)}static clone(a){return new Sd(a.__key)}createDOM(a){let b=document.createElement("p");a=qc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:If,
|
|
187
|
+
priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));if(a&&Ec(a)){this.isEmpty()&&a.append(document.createElement("br"));var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=ge();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);b.setTextFormat(a.textFormat);return b}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),type:"paragraph",
|
|
188
|
+
version:1}}insertNewAfter(a,b){let c=ge();c.setTextFormat(a.format);a=this.getDirection();c.setDirection(a);c.setFormat(this.getFormatType());this.insertAfter(c,b);return c}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}
|
|
189
|
+
function If(a){let b=ge();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function ge(){return Ac(new Sd)}function vd(a){return a instanceof Sd}
|
|
190
|
+
function rf(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=Bf();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._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
|
191
|
+
function Jf(a,b){let c=new Map,d=new Set,e=f=>{Object.keys(f).forEach(g=>{let h=c.get(g);void 0===h&&(h=[],c.set(g,h));h.push(f[g])})};a.forEach(f=>{let g=f.klass.importDOM;null==g||d.has(g)||(d.add(g),f=g.call(f.klass),null!==f&&e(f))});b&&e(b);return c}
|
|
192
|
+
class Kf{constructor(a,b,c,d,e,f,g){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,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
|
191
193
|
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=mc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
|
|
192
|
-
this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&
|
|
193
|
-
e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&
|
|
194
|
-
{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=qc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;
|
|
195
|
-
b.ownerDocument,e=
|
|
196
|
-
"pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,Eb(this),this._updateTags.add("history-merge"),
|
|
197
|
-
d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
|
|
198
|
-
!1;T=this;try{
|
|
199
|
-
a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=yb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,
|
|
200
|
-
exports.$createLineBreakNode=
|
|
201
|
-
exports.$getPreviousSelection=oc;exports.$getRoot=J;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=wc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=u()||oc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};
|
|
202
|
-
exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||y(a)&&a.isInline()};exports.$isLeafNode=function(a){return B(a)||Gc(a)||y(a)};exports.$isLineBreakNode=Gc;exports.$isNodeSelection=
|
|
203
|
-
exports.$nodesOfType=function(a){var b=bc();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=Jb;exports.$parseSerializedNode=function(a){return
|
|
204
|
-
exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);yc(a)&&
|
|
205
|
-
exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=
|
|
206
|
-
exports.ElementNode=
|
|
207
|
-
exports.KEY_ENTER_COMMAND=Ba;exports.KEY_ESCAPE_COMMAND=
|
|
208
|
-
exports.TabNode=
|
|
209
|
-
exports.createEditor=function(a){var b=a||{},c=T,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=
|
|
210
|
-
new Set;null!==x&&z.add(x);a.set(A,{exportDOM:
|
|
211
|
-
exports.isSelectionCapturedInDecoratorInput=
|
|
194
|
+
this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&p(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&p(36,String(a));let f=e[c];f.add(b);return()=>{f.delete(b);
|
|
195
|
+
e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&p(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){var c=a.getType();c=this._nodes.get(c);void 0===c&&p(37,a.name);c.transforms.add(b);return c}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));ic(this,a.getType());return()=>
|
|
196
|
+
{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=qc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;rf(this,b,a,c);if(null!==b){if(!this._config.disableEvents){var d=
|
|
197
|
+
b.ownerDocument,e=Jd.get(d);if(void 0===e)throw Error("Root element not registered");Jd.set(d,e-1);0===Jd.get(d)&&d.removeEventListener("selectionchange",$d);d=b.__lexicalEditor;null!==d&&void 0!==d&&(null!==d._parentEditor?(e=lc(d),e=e[e.length-1]._key,Zd.get(e)===d&&Zd.delete(e)):Zd.delete(d._key),b.__lexicalEditor=null);d=Yd(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",
|
|
198
|
+
d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,Eb(this),this._updateTags.add("history-merge"),qf(this),this._config.disableEvents||ae(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);sf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&p(38);Db(this);let c=this._pendingEditorState,
|
|
199
|
+
d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),qf(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);qf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=Bf(),d=S,e=U,f=T,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;S=c;U=
|
|
200
|
+
!1;T=this;try{of(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(q){q instanceof Error&&this._onError(q)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,S=d,U=e,T=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=J();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
|
|
201
|
+
a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=yb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,sf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}exports.$addUpdateTag=function(a){G();F()._updateTags.add(a)};exports.$applyNodeReplacement=Ac;exports.$copyNode=zc;
|
|
202
|
+
exports.$createLineBreakNode=le;exports.$createNodeSelection=$e;exports.$createParagraphNode=ge;exports.$createPoint=Pe;exports.$createRangeSelection=function(){let a=Pe("root",0,"element"),b=Pe("root",0,"element");return new Ue(a,b,0,"")};exports.$createRangeSelectionFromDom=function(a,b){return Td(null,a,b,null)};exports.$createTabNode=ze;exports.$createTextNode=K;exports.$getAdjacentNode=tc;exports.$getCharacterOffsets=Ve;exports.$getEditor=function(){return F()};
|
|
203
|
+
exports.$getNearestNodeFromDOMNode=xb;exports.$getNearestRootOrShadowRoot=xc;exports.$getNodeByKey=I;exports.$getPreviousSelection=oc;exports.$getRoot=J;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=wc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=u()||oc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};
|
|
204
|
+
exports.$isDecoratorNode=y;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||y(a)&&a.isInline()};exports.$isLeafNode=function(a){return B(a)||Gc(a)||y(a)};exports.$isLineBreakNode=Gc;exports.$isNodeSelection=Xd;exports.$isParagraphNode=vd;exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=yc;exports.$isTabNode=Ne;exports.$isTextNode=B;
|
|
205
|
+
exports.$nodesOfType=function(a){var b=bc();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=Jb;exports.$parseSerializedNode=function(a){return of(a,F()._nodes)};exports.$selectAll=function(){var a=J();a=a.select(0,a.getChildrenSize());Bb(Jb(a))};exports.$setCompositionKey=H;exports.$setSelection=Bb;
|
|
206
|
+
exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);yc(a)&&p(102);let d=g=>{const h=g.getParentOrThrow(),k=yc(h),m=g!==c||k?zc(g):g;if(k)return E(g)&&E(m)||p(133),g.insertAfter(m),[g,m,m];const [q,n,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[q,n,m]},[e,f]=d(c);return[e,f]};exports.BLUR_COMMAND=Ra;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;
|
|
207
|
+
exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ha;exports.COPY_COMMAND=Na;exports.CUT_COMMAND=Oa;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=oa;exports.DELETE_WORD_COMMAND=na;exports.DRAGEND_COMMAND=Ma;exports.DRAGOVER_COMMAND=La;exports.DRAGSTART_COMMAND=Ka;exports.DROP_COMMAND=Ja;exports.DecoratorNode=xf;
|
|
208
|
+
exports.ElementNode=yf;exports.FOCUS_COMMAND=Qa;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=pa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=fa;exports.INSERT_TAB_COMMAND={};exports.KEY_ARROW_DOWN_COMMAND=Aa;exports.KEY_ARROW_LEFT_COMMAND=wa;exports.KEY_ARROW_RIGHT_COMMAND=ua;exports.KEY_ARROW_UP_COMMAND=za;exports.KEY_BACKSPACE_COMMAND=Da;exports.KEY_DELETE_COMMAND=Ha;exports.KEY_DOWN_COMMAND=ta;
|
|
209
|
+
exports.KEY_ENTER_COMMAND=Ba;exports.KEY_ESCAPE_COMMAND=Ea;exports.KEY_MODIFIER_COMMAND=Sa;exports.KEY_SPACE_COMMAND=Ca;exports.KEY_TAB_COMMAND=Ia;exports.LineBreakNode=ie;exports.MOVE_TO_END=va;exports.MOVE_TO_START=xa;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ia;exports.ParagraphNode=Sd;exports.REDO_COMMAND=sa;exports.REMOVE_TEXT_COMMAND=la;exports.RootNode=Af;exports.SELECTION_CHANGE_COMMAND=aa;exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND={};exports.SELECT_ALL_COMMAND=Pa;
|
|
210
|
+
exports.TabNode=Me;exports.TextNode=re;exports.UNDO_COMMAND=ra;exports.createCommand=function(){return{}};
|
|
211
|
+
exports.createEditor=function(a){var b=a||{},c=T,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=Bf(),h=b.namespace||(null!==e?e._config.namespace:mc()),k=b.editorState,m=[Af,re,ie,Me,Sd,...(b.nodes||[])],{onError:q,html:n}=b;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let r=m[c],w=null;var l=null;"function"!==typeof r&&(l=r,r=l.replace,w=l.with,l=l.withKlass||null);let A=r.getType(),x=r.transform(),z=
|
|
212
|
+
new Set;null!==x&&z.add(x);a.set(A,{exportDOM:n&&n.export?n.export.get(r):void 0,klass:r,replace:w,replaceWithKlass:l,transforms:z})}d=new Kf(g,e,a,{disableEvents:f,namespace:h,theme:d},q?q:console.error,Jf(a,n?n.import:void 0),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Vb;exports.isCurrentlyReadOnlyMode=fc;exports.isHTMLAnchorElement=function(a){return Ec(a)&&"A"===a.tagName};exports.isHTMLElement=Ec;
|
|
213
|
+
exports.isSelectionCapturedInDecoratorInput=Nb;exports.isSelectionWithinEditor=Ob
|