lexxy 0.9.7.beta → 0.9.9.beta
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.
- checksums.yaml +4 -4
- data/app/assets/javascript/lexxy.js +246 -113
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.js.map +1 -1
- data/app/assets/javascript/lexxy.min.js +2 -2
- data/app/assets/javascript/lexxy.min.js.br +0 -0
- data/app/assets/javascript/lexxy.min.js.gz +0 -0
- data/lib/lexxy/engine.rb +1 -1
- data/lib/lexxy/version.rb +1 -1
- metadata +1 -1
|
@@ -6204,7 +6204,7 @@ var purify = createDOMPurify();
|
|
|
6204
6204
|
*
|
|
6205
6205
|
*/
|
|
6206
6206
|
|
|
6207
|
-
function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o$1=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s$1=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a$1=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a$1&&u,d$1=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u,h$1=0,g$1=1,_$3=2,k$3=128,N$3=1,b$5=2,w$5=3,E$5=4,O$4=5,M$7=6,A$2=l||c||d$1?"\xa0":"\u200b",P$3="\n\n",D$5=o$1?"\xa0":A$2,F$5="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",L$5="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",I$4=new RegExp("^[^"+L$5+"]*["+F$5+"]"),K$4=new RegExp("^[^"+F$5+"]*["+L$5+"]"),z$6={bold:1,capitalize:1024,code:16,highlight:k$3,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},R$4={directionless:1,unmergeable:2},B$3={center:2,end:6,justify:4,left:1,right:3,start:5},W$5={[b$5]:"center",[M$7]:"end",[E$5]:"justify",[N$3]:"left",[w$5]:"right",[O$4]:"start"},J$3={normal:0,segmented:2,token:1},j$6={[h$1]:"normal",[_$3]:"segmented",[g$1]:"token"},$$4="$config";function V$6(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Pi(s)&&V$6(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling();}}let Y$4=false,q$6=0;function H$5(t){q$6=t.timeStamp;}function G$4(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==Fo(t,n)}function X$4(t,e,n){const r=Es(ms(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&Yo(e,s,i,o,false);}function Q$5(t,e,n){if(wr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return vo(e)&&n.isAttached()}function Z$4(t,e,n,r){for(let i=t;i&&!Vs(i);i=fs(i)){const t=Fo(i,e);if(void 0!==t){const e=Po(t,n);if(e)return Li(e)||!Ps(i)?void 0:[i,e]}else if(i===r)return [r,Ro(n)]}}function tt$2(t,e,n){Y$4=true;const r=performance.now()-q$6>100;try{Ei(t,()=>{const i=$r()||function(t){return t.getEditorState().read(()=>{const t=$r();return null!==t?t.clone():null})}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=Z$4(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&yr(y)&&vo(g)&&Q$5(i,g,y)&&X$4(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],i=Do(r),s=r.parentNode;if(null!=s&&r!==a&&null===i&&!G$4(r,s,t)){if(o$1){const t=(Ps(r)?r.innerText:null)||r.nodeValue;t&&(f+=t);}s.removeChild(r);}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(G$4(r,g,t)||a===r)&&(g.appendChild(r),e++);}r!==e&&s.set(p,y);}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],o=n.parentNode;null==o||"BR"!==n.nodeName||G$4(n,i,t)||o.removeChild(n);}}n.takeRecords();}null!==i&&(u&&Bo(i),o$1&&cs(t)&&i.insertRawText(f));});}finally{Y$4=false;}}function et$2(t){const e=t._observer;if(null!==e){tt$2(t,e.takeRecords(),e);}}function nt$1(t){!function(t){0===q$6&&ms(t).addEventListener("textInput",H$5,true);}(t),t._observer=new MutationObserver((e,n)=>{tt$2(t,e,n);});}let rt$1 = class rt{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||ht$5).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||false;}};function it$2(t,e){return new rt$1(t,e)}function ot$2(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function lt$2(t,e,n){let r;if(di(),"function"==typeof n){const i=t.getLatest(),o=ot$2(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return ut$1(i).updateFromKnown(e,r),i}function ct$1(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=qs(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t);}}return {flatKeys:n,sharedConfigMap:e}}let at$2 = class at{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(o,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return dt$3(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new at(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o);}return r}(e.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=dt$3(i)),this.size++),r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);}};function ut$1(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new at$2(e,ft$2(e));return e.__state=n,n}function ft$2(t){return t.__state?t.__state.sharedNodeState:ao(zs(),t.getType()).sharedNodeState}function dt$3(t){if(t)for(const e in t)return t}function ht$5(t){return t}function gt$2(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return true}return false}function _t$4(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return true}return false}function pt$4(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function yt$3(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set;return !(t&>$2(n,t,e)||e&>$2(n,e,t)||t&&_t$4(n,t,e)||e&&_t$4(n,e,t))}(c,a))}function mt$4(t,e){const n=t.mergeWithSibling(e),r=_i()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function xt$3(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&yr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(yt$3(e,r)){r=mt$4(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&yr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(yt$3(r,n)){r=mt$4(r,n);break}break}n.remove();}}else r.remove();}function Ct$3(t){return St$3(t.anchor),St$3(t.focus),t}function St$3(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),yr(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!Pi(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let vt$3,kt$4,Tt$4,Nt$3,bt$3,wt$4,Et$2,Ot$3,Mt$4,At$3,Pt$3="",Dt$4=null,Ft$4=null,Lt$5=false,It$3=false;function Kt$4(t,e){const n=Et$2.get(t);if(null!==e){const n=ee$5(t);n.parentNode===e&&e.removeChild(n);}if(Ot$3.has(t)||kt$4._keyToDOMMap.delete(t),Pi(n)){const t=Ht$4(n,Et$2);zt$3(t,0,t.length-1,null);} void 0!==n&&is(At$3,Tt$4,Nt$3,n,"destroyed");}function zt$3(t,e,n,r){for(let i=e;i<=n;++i){const e=t[i];void 0!==e&&Kt$4(e,r);}}function Rt$3(t,e){t.setProperty("text-align",e);}const Bt$4="40px";function Wt$3(t,e){const n=vt$3.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}if(0===e)return void t.style.setProperty("padding-inline-start","");const r=getComputedStyle(kt$4._rootElement||t).getPropertyValue("--lexical-indent-base-value")||Bt$4;t.style.setProperty("padding-inline-start",`calc(${e} * ${r})`);}function Jt$4(t,e){const n=t.style;0===e?Rt$3(n,""):1===e?Rt$3(n,"left"):2===e?Rt$3(n,"center"):3===e?Rt$3(n,"right"):4===e?Rt$3(n,"justify"):5===e?Rt$3(n,"start"):6===e&&Rt$3(n,"end");}function jt$4(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(Ki(t))return null;const n=t.getParentOrThrow();return Ki(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir");}function Ut$3(e,n){const r=Ot$3.get(e);void 0===r&&t(60);const i=r.createDOM(vt$3,kt$4);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,kt$4),yr(r)?i.setAttribute("data-lexical-text","true"):Li(r)&&i.setAttribute("data-lexical-decorator","true"),Pi(r)){const t=r.__indent,e=r.__size;if(jt$4(i,r),0!==t&&Wt$3(i,t),0!==e){const t=e-1;$t$2(Ht$4(r,Ot$3),r,0,t,r.getDOMSlot(i));}const n=r.__format;0!==n&&Jt$4(i,n),r.isInline()||Yt$3(null,r,i);}else {const t=r.getTextContent();if(Li(r)){const t=r.decorate(kt$4,vt$3);null!==t&&Xt$3(e,t),i.contentEditable="false";}Pt$3+=t;}return null!==n&&n.insertChild(i),is(At$3,Tt$4,Nt$3,r,"created"),i}function $t$2(t,e,n,r,i){const o=Pt$3;Pt$3="";let s=n;for(;s<=r;++s){Ut$3(t[s],i);const e=Ot$3.get(t[s]);null!==e&&yr(e)?null===Dt$4&&(Dt$4=e.getFormat(),Ft$4=e.getStyle()):Pi(e)&&s<r&&!e.isInline()&&(Pt$3+=P$3);}i.element.__lexicalTextContent=Pt$3,Pt$3=o+Pt$3;}function Vt$3(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Zn(t)?"line-break":Li(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Yt$3(t,e,n){const r=Vt$3(t,Et$2),i=Vt$3(e,Ot$3);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function qt$3(e,n,r){var i;Dt$4=null,Ft$4=null,function(e,n,r){const i=Pt$3,o=e.__size,s=n.__size;Pt$3="";const l=r.element;if(1===o&&1===s){const t=e.__first,r=n.__first;if(t===r)Gt$3(t,l);else {const e=ee$5(t),n=Ut$3(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const o=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw i}Kt$4(t,null);}const i=Ot$3.get(r);yr(i)&&null===Dt$4&&(Dt$4=i.getFormat(),Ft$4=i.getStyle());}else {const i=Ht$4(e,Et$2),c=Ht$4(n,Ot$3);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&$t$2(c,0,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;zt$3(i,0,o-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=Qt$3(Gt$3(r,o.element)),f++,d++;else {if(void 0===a&&(a=Zt$3(n,d)),void 0===c)c=Zt$3(e,f);else if(!c.has(t)){f++;continue}if(!a.has(t)){u=Qt$3(ee$5(t)),Kt$4(t,o.element),f++,c.delete(t);continue}if(c.has(r)){const t=us(kt$4,r);t!==u&&o.withBefore(u).insertChild(t),u=Qt$3(Gt$3(r,o.element)),f++,d++;}else Ut$3(r,o.withBefore(u)),d++;}const i=Ot$3.get(r);null!==i&&yr(i)?null===Dt$4&&(Dt$4=i.getFormat(),Ft$4=i.getStyle()):Pi(i)&&d<=l&&!i.isInline()&&(Pt$3+=P$3);}const h=f>s,g=d>l;if(h&&!g){const t=n[l+1],e=void 0===t?null:kt$4.getElementByKey(t);$t$2(n,0,d,l,o.withBefore(e));}else g&&!h&&zt$3(e,f,s,o.element);}(0,i,c,o,s,r);}l.__lexicalTextContent=Pt$3,Pt$3=i+Pt$3;}(e,n,n.getDOMSlot(r)),i=n,null==Dt$4||Dt$4===i.__textFormat||It$3||i.setTextFormat(Dt$4),function(t){null==Ft$4||Ft$4===t.__textStyle||It$3||t.setTextStyle(Ft$4);}(n);}function Ht$4(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function Gt$3(e,n){const r=Et$2.get(e);let i=Ot$3.get(e);void 0!==r&&void 0!==i||t(61);const o=Lt$5||wt$4.has(e)||bt$3.has(e),s=us(kt$4,e);if(r===i&&!o){let t;if(Pi(r)){const e=s.__lexicalTextContent;"string"==typeof e?t=e:(t=r.getTextContent(),s.__lexicalTextContent=t);}else t=r.getTextContent();return Pt$3+=t,s}if(r!==i&&o&&is(At$3,Tt$4,Nt$3,i,"updated"),i.updateDOM(r,s,vt$3)){const r=Ut$3(e,null);return null===n&&t(62),n.replaceChild(r,s),Kt$4(e,null),r}if(Pi(r)){Pi(i)||t(334,e);const n=i.__indent;(Lt$5||n!==r.__indent)&&Wt$3(s,n);const l=i.__format;if((Lt$5||l!==r.__format)&&Jt$4(s,l),o)qt$3(r,i,s),Ki(i)||i.isInline()||Yt$3(r,i,s);else {const t=s.__lexicalTextContent;let e;"string"==typeof t?e=t:(e=r.getTextContent(),s.__lexicalTextContent=e),Pt$3+=e;}if((Lt$5||i.__dir!==r.__dir)&&(jt$4(s,i),Ki(i)&&!Lt$5))for(const t of i.getChildren())if(Pi(t)){jt$4(us(kt$4,t.getKey()),t);}}else {const t=i.getTextContent();if(Li(i)){const t=i.decorate(kt$4,vt$3);null!==t&&Xt$3(e,t);}Pt$3+=t;}if(!It$3&&Ki(i)&&i.__cachedText!==Pt$3){const t=i.getWritable();t.__cachedText=Pt$3,i=t;}return s}function Xt$3(t,e){let n=kt$4._pendingDecorators;const r=kt$4._decorators;if(null===n){if(r[t]===e)return;n=Io(kt$4);}n[t]=e;}function Qt$3(t){let e=t.nextSibling;return null!==e&&e===kt$4._blockCursorElement&&(e=e.nextSibling),e}function Zt$3(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function te$5(t,e,n,r,i,o){Pt$3="",Lt$5=2===r,kt$4=n,vt$3=n._config,Tt$4=n._nodes,Nt$3=kt$4._listeners.mutation,bt$3=i,wt$4=o,Et$2=t._nodeMap,Ot$3=e._nodeMap,It$3=e._readOnly,Mt$4=new Map(n._keyToDOMMap);const s=new Map;return At$3=s,Gt$3("root",null),kt$4=void 0,Tt$4=void 0,bt$3=void 0,wt$4=void 0,Et$2=void 0,Ot$3=void 0,vt$3=void 0,Mt$4=void 0,At$3=void 0,s}function ee$5(e){const n=Mt$4.get(e);return void 0===n&&t(75,e),n}function ne$5(t){return {type:t}}const re$3=ne$5("SELECTION_CHANGE_COMMAND"),ie$4=ne$5("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),oe$5=ne$5("CLICK_COMMAND"),se$4=ne$5("BEFORE_INPUT_COMMAND"),le$4=ne$5("INPUT_COMMAND"),ce$4=ne$5("COMPOSITION_START_COMMAND"),ae$3=ne$5("COMPOSITION_END_COMMAND"),ue$2=ne$5("DELETE_CHARACTER_COMMAND"),fe$3=ne$5("INSERT_LINE_BREAK_COMMAND"),de$2=ne$5("INSERT_PARAGRAPH_COMMAND"),he$2=ne$5("CONTROLLED_TEXT_INSERTION_COMMAND"),ge$3=ne$5("PASTE_COMMAND"),_e$2=ne$5("REMOVE_TEXT_COMMAND"),pe$2=ne$5("DELETE_WORD_COMMAND"),ye$1=ne$5("DELETE_LINE_COMMAND"),me$2=ne$5("FORMAT_TEXT_COMMAND"),xe$1=ne$5("UNDO_COMMAND"),Ce$1=ne$5("REDO_COMMAND"),Se$1=ne$5("KEYDOWN_COMMAND"),ve$1=ne$5("KEY_ARROW_RIGHT_COMMAND"),ke$3=ne$5("MOVE_TO_END"),Te$1=ne$5("KEY_ARROW_LEFT_COMMAND"),Ne$2=ne$5("MOVE_TO_START"),be$2=ne$5("KEY_ARROW_UP_COMMAND"),we$1=ne$5("KEY_ARROW_DOWN_COMMAND"),Ee$2=ne$5("KEY_ENTER_COMMAND"),Oe$2=ne$5("KEY_SPACE_COMMAND"),Me$2=ne$5("KEY_BACKSPACE_COMMAND"),Ae$2=ne$5("KEY_ESCAPE_COMMAND"),Pe$2=ne$5("KEY_DELETE_COMMAND"),De$2=ne$5("KEY_TAB_COMMAND"),Fe$1=ne$5("INSERT_TAB_COMMAND"),Le$3=ne$5("INDENT_CONTENT_COMMAND"),Ie$2=ne$5("OUTDENT_CONTENT_COMMAND"),Ke$2=ne$5("DROP_COMMAND"),ze$2=ne$5("FORMAT_ELEMENT_COMMAND"),Re$1=ne$5("DRAGSTART_COMMAND"),Be$2=ne$5("DRAGOVER_COMMAND"),We$2=ne$5("DRAGEND_COMMAND"),Je$2=ne$5("COPY_COMMAND"),je$2=ne$5("CUT_COMMAND"),Ue$2=ne$5("SELECT_ALL_COMMAND"),$e$2=ne$5("CLEAR_EDITOR_COMMAND"),Ve$2=ne$5("CLEAR_HISTORY_COMMAND"),Ye$1=ne$5("CAN_REDO_COMMAND"),qe$2=ne$5("CAN_UNDO_COMMAND"),He$2=ne$5("FOCUS_COMMAND"),Ge$1=ne$5("BLUR_COMMAND"),Xe$2=ne$5("KEY_MODIFIER_COMMAND"),Qe$1=Object.freeze({}),Ze$1=[["keydown",function(t,e){if(tn$1=t.timeStamp,en$1=t.key,e.isComposing())return;as(e,Se$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ds(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Ei(e,()=>{ho(n)||(cn$1=true);});}],["compositionstart",function(t,e){as(e,ce$4,t);}],["compositionend",function(t,e){o$1?un$1=true:c||!l&&!d$1?as(e,ae$3,t):(fn$1=true,dn$1=t.data);}],["input",function(t,e){t.stopPropagation(),Ei(e,()=>{e.dispatchCommand(le$4,t);},{event:t}),rn$1=null;}],["click",function(t,e){Ei(e,()=>{const n=$r(),r=Es(ms(e)),i=Vr();if(r)if(wr(n)){const e=n.anchor,o=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!Ki(o)&&1===zo().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(o!==n.focus.getNode()){const t=Gs(o,t=>Pi(t)&&!t.isInline());Pi(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Ps(n)||vo(n)){Bo(Ur(i,r,e,t));}}as(e,oe$5,t);});}],["cut",Qe$1],["copy",Qe$1],["dragstart",Qe$1],["dragover",Qe$1],["dragend",Qe$1],["paste",Qe$1],["focus",Qe$1],["blur",Qe$1],["drop",Qe$1]];s$1&&Ze$1.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||o$1&&cs(e))return;if("insertCompositionText"===n)return;as(e,se$4,t);}(t,e)]);let tn$1=0,en$1=null,nn$1=0,rn$1=null;const on$1=new WeakMap,sn$1=new WeakMap;let ln$1=false,cn$1=false,an$1=false,un$1=false,fn$1=false,dn$1="",hn$1=null,gn$1=[0,"",0,"root",0];function _n$1(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=_i(),u=Es(ms(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!yr(c)||(!i&&(!s$1||nn$1<r+50)||c.isDirty()&&g<2||Jo(n))&&o.offset!==l.offset&&!c.isComposing()||So(c)||c.isDirty()&&g>1||(i||!s$1)&&null!==h&&!c.isComposing()&&f!==To(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==t.format||c.getStyle()!==t.style)||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=Co(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (yr(e)||Pi(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function pn$1(t,e){return vo(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function yn$1(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;ln$1&&(ln$1=false,pn$1(i,o)&&pn$1(s,l)&&!hn$1)||Ei(n,()=>{if(!r)return void Bo(null);if(!_o(n,i,s))return;let c=$r();if(hn$1&&wr(c)&&c.isCollapsed()){const t=c.anchor,e=hn$1.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=hn$1.clone(),Bo(c));}if(hn$1=null,wr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const o=ms(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=gn$1,h=zo(),g=false===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)mn$1(c,l,a);else if("text"===r.type)yr(i)||t(141),xn$1(c,i);else if("element"===r.type&&!g){Pi(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();mn$1(t,n,r);}(c,e):mn$1(c,c.format,"");}}else {const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,s=c.isBackward(),a=s?l:o,u=s?o:l,f=s?e:t,d=s?t:e;let h=2047,g=false;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(yr(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=true,h&=e.getFormat(),0===h))break}c.format=g?h:0;}}as(n,re$3,void 0);});}function mn$1(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=true);}function xn$1(t,e){mn$1(t,e.getFormat(),e.getStyle());}function Cn$1(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function Sn$1(e){const n=e.inputType,r=Cn$1(e),i=_i(),o=$r();if("deleteContentBackward"===n){if(null===o){const t=Vr();if(!wr(t))return true;Bo(t.clone());}if(wr(o)){const n=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===en$1&&s<tn$1+30&&i.isComposing()&&n){if(Mo(null),tn$1=0,setTimeout(()=>{Ei(i,()=>{Mo(null);});},30),wr(o)){const e=o.anchor.getNode();e.markDirty(),yr(e)||t(142),xn$1(o,e);}}else {Mo(null),e.preventDefault();const t=o.anchor.getNode(),r=t.getTextContent(),s=t.canInsertTextAfter(),l=0===o.anchor.offset&&o.focus.offset===r.length;let c=f&&n&&!l&&s;if(c&&o.isCollapsed()&&(c=!Li(ls(o.anchor,true))),!c){as(i,ue$2,true);const t=$r();f&&wr(t)&&t.isCollapsed()&&(hn$1=t,setTimeout(()=>hn$1=null));}}return true}}var s;if(!wr(o))return true;const l=e.data;null!==rn$1&&Vo(false,i,rn$1),o.dirty&&null===rn$1||!o.isCollapsed()||Ki(o.anchor.getNode())||null===r||o.applyDOMRange(r),rn$1=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===l)e.preventDefault(),as(i,fe$3,false);else if(l===P$3)e.preventDefault(),as(i,de$2,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t);}else null!=l&&_n$1(o,r,l,e.timeStamp,true)?(e.preventDefault(),as(i,he$2,l)):rn$1=l;return nn$1=e.timeStamp,true}switch(e.preventDefault(),n){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":as(i,he$2,e);break;case "insertFromComposition":Mo(null),as(i,he$2,e);break;case "insertLineBreak":Mo(null),as(i,fe$3,false);break;case "insertParagraph":Mo(null),an$1&&!c?(an$1=false,as(i,fe$3,false)):as(i,de$2,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":as(i,ge$3,e);break;case "deleteByComposition":(function(t,e){return t!==e||Pi(t)||Pi(e)||!Co(t)||!Co(e)})(d,h)&&as(i,_e$2,e);break;case "deleteByDrag":case "deleteByCut":as(i,_e$2,e);break;case "deleteContent":as(i,ue$2,false);break;case "deleteWordBackward":as(i,pe$2,true);break;case "deleteWordForward":as(i,pe$2,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":as(i,ye$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":as(i,ye$1,false);break;case "formatStrikeThrough":as(i,me$2,"strikethrough");break;case "formatBold":as(i,me$2,"bold");break;case "formatItalic":as(i,me$2,"italic");break;case "formatUnderline":as(i,me$2,"underline");break;case "historyUndo":as(i,xe$1,void 0);break;case "historyRedo":as(i,Ce$1,void 0);}return true}function vn$1(t){if(Ps(t.target)&&ho(t.target))return true;const e=_i(),n=$r(),r=t.data,i=Cn$1(t);if(null!=r&&wr(n)&&_n$1(n,i,r,t.timeStamp,false)){un$1&&(Nn$1(e,r),un$1=false);const i=n.anchor.getNode(),l=Es(ms(e));if(null===l)return true;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s$1&&!n.isCollapsed()&&yr(i)&&null!==l.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+u)===$o(l.anchorNode)||as(e,he$2,r);const d=r.length;o$1&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d),f&&e.isComposing()&&(tn$1=0,Mo(null));}else {Vo(false,e,null!==r?r:void 0),un$1&&(Nn$1(e,r||void 0),un$1=false);}return function(){di();const t=_i();et$2(t);}(),true}function kn(t){const e=_i(),n=$r();if(wr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();Mo(r.key),gs(qn),(t.timeStamp<tn$1+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||yr(i)&&i.getStyle()!==n.style)&&as(e,he$2,D$5);}return true}function Tn$1(t){return Nn$1(_i(),t.data),gs(Hn),true}function Nn$1(t,e){const n=t._compositionKey;if(Mo(null),null!==n&&null!=e){if(""===e){const e=Po(n),r=To(t.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&yr(e)){const n=Es(ms(t));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Yo(e,r.nodeValue,i,o,true);}return}if("\n"===e[e.length-1]){const e=$r();if(wr(e)||Or(e)){if(wr(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type);}return void as(t,Ee$2,null)}}}Vo(true,t,e);}function bn$1(t){const e=_i();if(null==t.key)return true;if(fn$1){if(ts(t))return Ei(e,()=>{Nn$1(e,dn$1);}),fn$1=false,dn$1="",true;fn$1=false,dn$1="";}if(function(t){return Xo(t,"ArrowRight",{shiftKey:"any"})}(t))as(e,ve$1,t);else if(function(t){return Xo(t,"ArrowRight",Qo)}(t))as(e,ke$3,t);else if(function(t){return Xo(t,"ArrowLeft",{shiftKey:"any"})}(t))as(e,Te$1,t);else if(function(t){return Xo(t,"ArrowLeft",Qo)}(t))as(e,Ne$2,t);else if(function(t){return Xo(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))as(e,be$2,t);else if(function(t){return Xo(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))as(e,we$1,t);else if(function(t){return Xo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))an$1=true,as(e,Ee$2,t);else if(function(t){return " "===t.key}(t))as(e,Oe$2,t);else if(function(t){return i&&Xo(t,"o",{ctrlKey:true})}(t))t.preventDefault(),an$1=true,as(e,fe$3,true);else if(function(t){return Xo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))an$1=false,as(e,Ee$2,t);else if(function(t){return Xo(t,"Backspace",{shiftKey:"any"})||i&&Xo(t,"h",{ctrlKey:true})}(t))ts(t)?as(e,Me$2,t):(t.preventDefault(),as(e,ue$2,true));else if(function(t){return "Escape"===t.key}(t))as(e,Ae$2,t);else if(function(t){return Xo(t,"Delete",{})||i&&Xo(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),as(e,ue$2,false)):as(e,Pe$2,t);else if(function(t){return Xo(t,"Backspace",Zo)}(t))t.preventDefault(),as(e,pe$2,true);else if(function(t){return Xo(t,"Delete",Zo)}(t))t.preventDefault(),as(e,pe$2,false);else if(function(t){return i&&Xo(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),as(e,ye$1,true);else if(function(t){return i&&(Xo(t,"Delete",{metaKey:true})||Xo(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),as(e,ye$1,false);else if(function(t){return Xo(t,"b",Qo)}(t))t.preventDefault(),as(e,me$2,"bold");else if(function(t){return Xo(t,"u",Qo)}(t))t.preventDefault(),as(e,me$2,"underline");else if(function(t){return Xo(t,"i",Qo)}(t))t.preventDefault(),as(e,me$2,"italic");else if(function(t){return Xo(t,"Tab",{shiftKey:"any"})}(t))as(e,De$2,t);else if(function(t){return Xo(t,"z",Qo)}(t))t.preventDefault(),as(e,xe$1,void 0);else if(function(t){if(i)return Xo(t,"z",{metaKey:true,shiftKey:true});return Xo(t,"y",{ctrlKey:true})||Xo(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),as(e,Ce$1,void 0);else {const n=e._editorState._selection;null===n||wr(n)?es(t)&&(t.preventDefault(),as(e,Ue$2,t)):!function(t){return Xo(t,"c",Qo)}(t)?!function(t){return Xo(t,"x",Qo)}(t)?es(t)&&(t.preventDefault(),as(e,Ue$2,t)):(t.preventDefault(),as(e,je$2,t)):(t.preventDefault(),as(e,Je$2,t));}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(Xe$2,t),true}function wn$1(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const En$1=new Map;function On$1(t){const e=Os(t.target);if(null===e)return;const n=yo(e.anchorNode);if(null===n)return;cn$1&&(cn$1=false,Ei(n,()=>{const r=Vr(),i=e.anchorNode;if(Ps(i)||vo(i)){Bo(Ur(r,e,n,t));}}));const r=jo(n),i=r[r.length-1],o=i._key,s=En$1.get(o),l=s||i;l!==n&&yn$1(e,l,false),yn$1(e,n,true),n!==i?En$1.set(o,n):s&&En$1.delete(o);}function Mn$1(t){t._lexicalHandled=true;}function An$1(t){return true===t._lexicalHandled}function Dn(e){const n=on$1.get(e);if(void 0===n)return void 0;const r=sn$1.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),on$1.delete(e),sn$1.set(n,i),0===i&&n.removeEventListener("selectionchange",On$1);const o=mo(e);po(o)?(!function(t){if(null!==t._parentEditor){const e=jo(t),n=e[e.length-1]._key;En$1.get(n)===t&&En$1.delete(n);}else En$1.delete(t._key);}(o),e.__lexicalEditor=null):o&&t(198);const s=wn$1(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[];}function Fn$1(t,e,n){di();const r=t.__key,i=t.getParent();if(null===i)return;const o=function(t){const e=$r();if(!wr(e)||!Pi(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();ps(i,t)&&n.set(t.__key,0,"element");ps(o,t)&&r.set(t.__key,0,"element");return e}(t);let s=false;if(wr(o)&&e){const e=o.anchor,n=o.focus;e.key===r&&(Hr(e,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true),n.key===r&&(Hr(n,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true);}else Or(o)&&e&&t.isSelected()&&t.selectPrevious();if(wr(o)&&e&&!s){const e=t.getIndexWithinParent();Eo(t),Yr(o,i,e,-1);}else Eo(t);n||Ss(i)||i.canBeEmpty()||!i.isEmpty()||Fn$1(i,e),e&&o&&Ki(i)&&i.isEmpty()&&i.selectEnd();}function Ln(t){return t}const In=Symbol.for("ephemeral");function Kn$1(t){return t[In]||false}class zn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=qs(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name);}$config(){return {}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this));}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode());}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:true,enumerable:false,value:void 0,writable:true}),wo(this,t);}getType(){return this.__type}isInline(){t(137,this.constructor.name);}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return true;const e=Po(t);if(null===e)break;t=e.__parent;}return false}isSelected(t){const e=t||$r();if(null==e)return false;const n=e.getNodes().some(t=>t.__key===this.__key);if(yr(this))return n;if(wr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(Li(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:Po(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(Ss(n))return Pi(e)||e===this&&Li(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Po(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Po(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Pi(this)?this:this.getParent(),n=Pi(t)?t:t.getParent(),r=e&&n?Ml(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ml(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===wl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=Ml(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=Pi(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);o=u;}return n||r.reverse(),r}isDirty(){const t=_i()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(Kn$1(this))return this;const e=Po(this.__key);return null===e&&t(113),e}getWritable(){if(Kn$1(this))return this;di();const t=gi(),e=_i(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=$r();if(null!==s&&s.setCachedNodes(null),o.has(r))return Oo(i),i;const l=Js(i);return o.add(r),Oo(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of ft$2(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return (n.__state||i)&&ut$1(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){Fn$1(this,true,t);}replace(e,n){di();let r=$r();null!==r&&(r=r.clone()),Ts(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;Eo(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(Fn$1(i,false,true),null===u)c.__first=s;else {u.getWritable().__next=s;}if(l.__prev=d,null===f)c.__last=s;else {f.getWritable().__prev=s;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Pi(this)&&Pi(l)||t(139),this.getChildren().forEach(t=>{l.append(t);})),wr(r)){Bo(r);const t=r.anchor,e=r.focus;t.key===o&&Nr(t,l),e.key===o&&Nr(e,l);}return Ao()===o&&Mo(s),l}insertAfter(t,e=true){di(),Ts(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=$r();let s=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(Eo(r),wr(o)){const t=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&wr(o)){const t=this.getIndexWithinParent();Yr(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){di(),Ts(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;Eo(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===o)s.__first=i;else {o.getWritable().__next=i;}s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=$r();if(e&&wr(a)){Yr(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Vi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){di();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Pi(n))return n.select();if(!yr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){di();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Pi(n))return n.select(0,0);if(!yr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}const Rn$1="historic",Bn="history-push",Wn="history-merge",Jn="paste",jn="collaboration",$n$1="skip-scroll-into-view",Vn="skip-dom-selection",Yn="skip-selection-focus",qn="composition-start",Hn="composition-end";class Gn extends zn{static getType(){return "linebreak"}static clone(t){return new Gn(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&Is(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&tr(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&tr(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&Is(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&tr(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&tr(r))return true}return false}(t)?null:{conversion:Xn,priority:0}}}static importJSON(t){return Qn().updateFromJSON(t)}}function Xn(t){return {node:Qn()}}function Qn(){return ks(new Gn)}function Zn(t){return t instanceof Gn}function tr(t){return vo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function er(t,e){return 16&e?"code":e&k$3?"mark":32&e?"sub":64&e?"sup":null}function nr(t,e){return 1&e?"strong":2&e?"em":"span"}function rr(t,e,n,r,i){const o=r.classList;let s=rs(i,"base");void 0!==s&&o.add(...s),s=rs(i,"underlineStrikethrough");let l=false;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=true,c||o.add(...s)):c&&o.remove(...s));for(const t in z$6){const r=z$6[t];if(s=rs(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s);}else e&r&&o.remove(...s);}}function ir(t,e,n){const r=e.firstChild,i=n.isComposing(),s=t+(i?A$2:"");if(null==r)e.textContent=s;else {const t=r.nodeValue;if(t!==s)if(i||o$1){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;o+i<n&&o+i<r&&t[n-o-1]===e[r-o-1];)o++;return [i,n-i-o,e.slice(i,r-o)]}(t,s);0!==n&&r.deleteData(e,n),r.insertData(e,i);}else r.nodeValue=s;}}function or(t,e,n,r,i,o){ir(i,t,e);const s=o.theme.text;void 0!==s&&rr(0,0,r,t,s);}function sr(t,e){const n=document.createElement(e);return n.appendChild(t),n}class lr extends zn{__text;__format;__style;__mode;__detail;static getType(){return "text"}static clone(t){return new lr(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail;}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0;}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return j$6[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Ao()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return !!(1&this.getLatest().__detail)}isUnmergeable(){return !!(2&this.getLatest().__detail)}hasFormat(t){const e=z$6[t];return 0!==(this.getFormat()&e)}isSimpleText(){return "text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return No(this.getLatest().__format,t,e)}canHaveFormat(){return true}isInline(){return true}createDOM(t,e){const n=this.__format,r=er(0,n),i=nr(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l));or(l,this,0,n,this.__text,t);const c=this.__style;return ""!==c&&(s.style.cssText=c),s}updateDOM(e,n,r){const i=this.__text,o=e.__format,s=this.__format,l=er(0,o),c=er(0,s),a=nr(0,o),u=nr(0,s);if((null===l?a:l)!==(null===c?u:c))return true;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const o=document.createElement(u);return or(o,this,0,s,i,r),n.replaceChild(o,e),false}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),ir(i,f,this);const d=r.theme.text;void 0!==d&&o!==s&&rr(0,o,s,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),false}static importDOM(){return {"#text":()=>({conversion:dr,priority:0}),b:()=>({conversion:ar,priority:0}),code:()=>({conversion:_r,priority:0}),em:()=>({conversion:_r,priority:0}),i:()=>({conversion:_r,priority:0}),mark:()=>({conversion:_r,priority:0}),s:()=>({conversion:_r,priority:0}),span:()=>({conversion:cr,priority:0}),strong:()=>({conversion:_r,priority:0}),sub:()=>({conversion:_r,priority:0}),sup:()=>({conversion:_r,priority:0}),u:()=>({conversion:_r,priority:0})}}static importJSON(t){return pr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Ps(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=sr(n,"b")),this.hasFormat("italic")&&(n=sr(n,"i")),this.hasFormat("strikethrough")&&(n=sr(n,"s")),this.hasFormat("underline")&&(n=sr(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?z$6[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?R$4[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=No(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=J$3[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){di();let n=t,r=e;const i=$r(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!wr(i))return Br(s,n,s,r,"text","text");{const t=Ao();t!==i.anchor.key&&t!==i.focus.key||Mo(s),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=$r();if(r&&wr(c)){const e=t+s;c.setTextNodeRange(i,e,i,e);}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){di();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=Ao(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;e<o&&r<=l;r++){const i=t[r];i>e&&(s.push(n.slice(e,i)),e=i);}const c=s.length;if(1===c)return [e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=$r();if(wr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=pr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=pt$4(e,f),_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=pr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=pt$4(e,n);const o=n.__key;i===r&&Mo(o),x.push(n);}const C=p?p.offset:null,S=y?y.offset:null;let v=0;for(const t of x){if(!p&&!y)break;const e=v+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=v&&(p.set(t.getKey(),C-v,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&Oo(e);null!==n&&Oo(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),wr(m)&&Yr(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;Ao()===i&&Mo(r);const l=$r();if(wr(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Gr(t,n,r,e,s),null!==o&&o.key===i&&Gr(o,n,r,e,s);}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function cr(t){return {forChild:mr(t.style),node:null}}function ar(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:mr(e.style,n?void 0:"bold"),node:null}}const ur=new WeakMap;function fr(t){if(!Ps(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function dr(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=ur.get(n))&&!fr(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)ur.set(r[t],i);return i}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(Qn()):"\t"===n?e.push(Cr()):""!==n&&e.push(pr(n));}return {node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return {node:null};if(" "===r[0]){let t=n,e=true;for(;null!==t&&null!==(t=hr(t,false));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=hr(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:pr(r)}}function hr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,Ps(n)){const t=n.style.display;if(""===t&&!Ls(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(vo(n))return n;if("BR"===n.nodeName)return null}}const gr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function _r(t){const e=gr[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:mr(t.style,e),node:null}}function pr(t=""){return ks(new lr(t))}function yr(t){return t instanceof lr}function mr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>yr(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class xr extends lr{static getType(){return "tab"}static clone(t){return new xr(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=rs(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return Cr().updateFromJSON(t)}setTextContent(t){return "\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function Cr(){return ks(new xr)}function Sr(t){return t instanceof xr}class vr{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return bl(Bl(Al(this,"next")),Bl(Al(t,"next")))<0}getNode(){const e=Po(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,o=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,fi()||(Ao()===o&&Mo(t),null!==i&&(i.setCachedNodes(null),i.dirty=true)));}}function kr(t,e,n){return new vr(t,e,n)}function Tr(t,e){let n=e.__key,r=t.offset,i="element";if(yr(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t);}else if(!Pi(e)){const t=e.getNextSibling();if(yr(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function Nr(t,e){if(Pi(e)){const n=e.getLastDescendant();Pi(n)||yr(n)?Tr(t,n):Tr(t,e);}else Tr(t,e);}class br{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!Or(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new br(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(yr(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove();}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Po(t);null!==e&&n.push(e);}return fi()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if(($r()||Vr())===this&&t[0]){const e=dl(t[0],"next");Dl(Tl(e,e));}for(const e of t)e.remove();}}function wr(t){return t instanceof Er}class Er{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){return !!wr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,o=new Set;for(const n of t)if(cl(n)){const{origin:t}=n;0===e.length?i.add(t):(o.add(t),e.push(t));}else {const{origin:t}=n;Pi(t)&&o.has(t)||e.push(t);}r&&e.push(r.caret.origin);if(ll(t.focus)&&Pi(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=pl(t.focus.origin,"previous");cl(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=ml(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!Pi(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=Bl(t.anchor),r=Bl(t.anchor.getFlipped()),i=t=>ol(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o);}return e}(jl(Ll(this),"next"));return fi()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=Ar(this);let c="",a=true;for(let u=0;u<t.length;u++){const f=t[u];if(Pi(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=false,yr(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=o?t.slice(s):t.slice(l):f===n&&(t=o?t.slice(0,l):t.slice(0,s)),c+=t;}else !Li(f)&&!Zn(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent());}return c}applyDOMRange(t){const e=_i(),n=e.getEditorState()._selection,r=zr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,true),this.focus.set(o.key,o.offset,o.type,true),Ct$3(this);}clone(){const t=this.anchor,e=this.focus;return new Er(kr(t.key,t.offset,t.type),kr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=No(this.format,t,null),this.dirty=true;}setFormat(t){this.format=t,this.dirty=true;}setStyle(t){this.style=t,this.dirty=true;}hasFormat(t){const e=z$6[t];return 0!==(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(Qn()):"\t"===r?n.push(Cr()):n.push(pr(r));}this.insertNodes(n);}insertText(e){const n=this.anchor,r=this.focus,i=this.format,o=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const i=t.getNode(),o=i.getChildAtIndex(t.offset),s=pr();if(s.setFormat(n),s.setStyle(r),Yi(o))o.splice(0,0,[s]);else {const t=Ki(i)?Vi().append(s):s;null===o?i.append(t):o.insertBefore(t);}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text");}(s,l,i,o),"element"===l.type&&Pl(l,Bl(Al(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];yr(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(So(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(yr(t)&&t.canInsertTextBefore()&&!So(t)||(t=pr(),t.setFormat(i),t.setStyle(o),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(So(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(yr(t)&&!So(t)||(t=pr(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=pr(d.getTextContent());t.setFormat(i),d.replace(t),d=t;}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Pi(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Kr(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(Co(d)){const t=pr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===o){if(Sr(d)){const t=pr(e);return t.setFormat(i),t.setStyle(o),t.select(),void d.replace(t)}}else {if(""!==d.getTextContent()){const t=pr(e);if(t.setFormat(i),t.setStyle(o),t.select(),0===c)d.insertBefore(t,false);else {const[e]=d.splitText(c);e.insertAfter(t,false);}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(i),d.setStyle(o);}const r=a-c;d=d.spliceText(c,r,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length));}else {const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=Pi(d)?d:d.getParentOrThrow();let r=Pi(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow();}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(yr(_)&&!Co(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=pr(_.getTextContent());_.replace(t),_=t;}Ki(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key);}else {const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove();}else t.add(_.__key);const o=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=o.length-1;t>=0;t--){const e=o[t];if(e.is(d)||Pi(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(Co(d))if(c===h)d.select();else {const t=pr(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove();}}}removeText(){const t=$r()===this;Fl(this,Rl(Ll(this))),t&&$r()!==this&&Bo(this);}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Mo(null);const n=this.getNodes(),r=[];for(const t of n)yr(t)&&r.push(t);const i=e=>{n.forEach(n=>{if(Pi(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}});},o=r.length;if(0===o)return this.toggleFormat(t),Mo(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(So(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||So(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||So(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=$r();return wr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Gs(n,Ks),i=e[e.length-1];if(Pi(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=ni(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some(t=>(Pi(t)||Li(t))&&!t.isInline())){Pi(r)||t(211,n.constructor.name,n.getType());const o=ni(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Vi();let n=null;for(let r=0;r<t.length;r++){const i=t[r],o=Zn(i);if(o||Li(i)&&i.isInline()||Pi(i)&&i.isInline()||yr(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),o))continue;null!==n&&n.append(i);}else e.append(i),n=null;}return e}(e),s=o.getLastDescendant(),l=o.getChildren(),c=!Pi(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;Pi(f=u)&&Ks(f)&&!f.isEmpty()&&Pi(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Pi(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n){const r=n.getParentOrThrow().getLastChild();let i=n;const o=[n];for(;i!==r;)i.getNextSibling()||t(140),i=i.getNextSibling(),o.push(i);let s=e;for(const t of o)s=s.insertAfter(t);}(r,u));const d=Gs(s,Ks);c&&Pi(d)&&(c.canMergeWhenEmpty()||Ks(a))&&(d.append(...c.getChildren()),c.remove()),Pi(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=Pi(r)?r.getLastChild():null;Zn(h)&&d!==r&&h.remove();}insertParagraph(){if("root"===this.anchor.key){const t=Vi();return zo().splice(this.anchor.offset,0,[t]),t.select(),t}const e=ni(this),n=Gs(this.anchor.getNode(),Ks);Pi(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=n.insertNewAfter(this,false);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(t){const e=Qn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n);}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[i,o]=Ar(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[o,i]:[i,o];if(0===e)return [];if(1===e){if(yr(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return [n]}if(yr(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),yr(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"));}return t}modify(t,e,n){if(ii(this,t,e,n))return;const r="move"===t,i=_i(),o=Es(ms(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===s||!Pi(c)||c.isInline()||c.canBeEmpty()||ws(s,i,l),this.dirty){let t=us(i,this.anchor.key),e=us(i,this.focus.key);"text"===this.anchor.type&&(t=To(t)),"text"===this.focus.type&&(e=To(e)),t&&e&&Xr(o,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(o,t,e?"backward":"forward",n),o.rangeCount>0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=Ki(n)?n:Cs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let s=false;for(let t=0;t<n.length;t++){const e=n[t];ps(e,i)?r.push(e):s=true;}if(s&&r.length>0)if(e){const t=r[0];Pi(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];Pi(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,o,true);}(this);}}"lineboundary"===n&&ii(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Pi(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Pi(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=vl(Al(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(cl(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Pi(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Bl(e);Fl(this,Tl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(ll(e)){if(Pi(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(Li(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Pi(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=Jr();t.add(e.origin.getKey()),Bo(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Fl(this,Tl(!e.origin.isEmpty()&&n.isEmpty()?Il(dl(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&Pr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void Fr(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void Fr(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t<o,l=s?t:o,c=s?o:t,a=c-1;if(l!==a){(function(t){return !(Jo(t)||Dr(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type));}}}(this,t);}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&Ki(t.getParent())&&null===t.getPreviousSibling()&&Pr(this,t);}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText();}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word");}this.isCollapsed()?this.deleteCharacter(t):this.removeText();}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return [this.anchor,this.focus]}}function Or(t){return t instanceof br}function Mr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function Ar(t){const e=t.getStartEndPoints();if(null===e)return [0,0];const[n,r]=e;return "element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Mr(n),Mr(r)]}function Pr(t,e){for(let n=e;n;n=n.getParent()){if(Pi(n)){if(n.collapseAtStart(t))return true;if(Ss(n))break}if(n.getPreviousSibling())break}return false}const Dr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return ()=>false})();function Fr(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;t<o;t++){const r=t===o-1;if(l=s,s+=i[t].length,e&&s===n||s>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function Lr(e,n,r,i){let o,s=n;if(Ps(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;s===a&&(l=true,s=a-1);let f=c[s],d=false;if(f===u)f=c[s+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--;}}if(o=Wo(f),yr(o))s=gl(o,l?"next":"previous");else {let c=Wo(e);if(null===c)return null;if(Pi(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Pi(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Pi(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Pi(f)?f:f.getParentOrThrow()),s=0;}yr(f)?(o=f,c=null,s=gl(f,l?"next":"previous")):f!==c&&l&&!d&&(Pi(c)||t(216),s=Math.min(c.getChildrenSize(),s+1));}else {const t=c.getIndexWithinParent();s=0===n&&Li(c)&&Wo(e)===c?t:t+1,c=c.getParentOrThrow();}if(Pi(c))return kr(c.__key,s,"element")}}else o=Wo(e);return yr(o)?kr(o.__key,gl(o,s,"clamp"),"text"):null}function Ir(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&Pi(o)&&o.isInline()){const e=o.getPreviousSibling();yr(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else Pi(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):yr(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&Pi(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Pi(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();yr(e)&&t.set(e.__key,0,"text");}}}function Kr(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);Ir(t,n,r),Ir(e,!n,r),r&&e.set(t.key,t.offset,t.type);}}function zr(t,e,n,r,i,o){if(null===t||null===n||!_o(i,t,n))return null;const s=Lr(t,e,wr(o)?o.anchor:null,i);if(null===s)return null;const l=Lr(n,r,wr(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Wo(t),r=Wo(n);if(Li(e)&&Li(r))return null}return Kr(s,l),[s,l]}function Rr(t){return Pi(t)&&!t.isInline()}function Br(t,e,n,r,i,o){const s=gi(),l=new Er(kr(t,e,i),kr(n,r,o),0,"");return l.dirty=true,s._selection=l,l}function Wr(){const t=kr("root",0,"element"),e=kr("root",0,"element");return new Er(t,e,0,"")}function Jr(){return new br(new Set)}function jr(t,e){return Ur(null,t,e,null)}function Ur(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!Y$4&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(wr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&wr(t)&&!_o(n,a,u))return t.clone();const h=zr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;let p=0,y="";if(wr(t)){const e=t.anchor;if(g.key===e.key)p=t.format,y=t.style;else {const t=g.getNode();yr(t)?(p=t.getFormat(),y=t.getStyle()):Pi(t)&&(p=t.getTextFormat(),y=t.getTextStyle());}}return new Er(g,_,p,y)}function $r(){return gi()._selection}function Vr(){return _i()._editorState._selection}function Yr(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),o.set(c,n,"element"),qr(t);}}else {const s=t.isBackward(),l=s?o:i,a=l.getNode(),u=s?i:o,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element");}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element");}}qr(t);}function qr(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!Pi(o))return;const t=o.getChildrenSize(),i=n>=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(yr(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text");}return}if(Pi(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(yr(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(Pi(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(yr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}function Hr(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,yr(r)?(s=r.getTextContentSize(),l="text"):Pi(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,yr(i)?l="text":Pi(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"));}function Gr(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Xr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Qr(t,e,n){const r=us(t,e.getKey());if(Pi(e)){const t=e.getDOMSlot(r);return [t.element,n+t.getFirstChildOffset()]}return [r,n]}function Zr(t,e,n,r,i,s,l){const c=r.anchorNode,a=r.focusNode,u=r.anchorOffset,f=r.focusOffset,d=document.activeElement;if(i.has(jn)&&d!==s||null!==d&&go(d))return;if(!wr(e))return void(null!==t&&_o(n,c,a)&&r.removeAllRanges());const h=e.anchor,g=e.focus,_=h.getNode(),p=g.getNode(),[y,m]=Qr(n,_,h.offset),[x,C]=Qr(n,p,g.offset),S=e.format,v=e.style,k=e.isCollapsed();let T=y,N=x,b=false;var w,E,O,M,A;if(("text"===h.type?(T=To(y),b=_.getFormat()!==S||_.getStyle()!==v):wr(t)&&"text"===t.anchor.type&&(b=true),"text"===g.type&&(N=To(x)),null!==T&&null!==N)&&(k&&(null===t||b||wr(t)&&(t.format!==S||t.style!==v))&&(w=S,E=v,O=m,M=h.key,A=performance.now(),gn$1=[w,E,O,M,A]),u!==m||f!==C||c!==T||a!==N||"Range"===r.type&&k||(null!==d&&s.contains(d)||i.has(Yn)||s.focus({preventScroll:true}),"element"===h.type))){if(Xr(r,T,m,N,C),!o$1||!e.isCollapsed()||null===s||i.has(Yn)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:true}),!i.has($n$1)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=wr(e)&&"element"===e.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=ds(n),i=ys(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e){l=0,c=ms(t).innerHeight;const e=i.getComputedStyle(r.documentElement),n=parseFloat(e.scrollPaddingTop),o=parseFloat(e.scrollPaddingBottom);isFinite(n)&&(l+=n),isFinite(o)&&(c-=o);}else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(o<l?n=-(l-o):s>c&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e;}if(e)break;a=fs(a);}}(n,e,s);}}ln$1=true;}}function ti(t){let e=$r()||Vr();null===e&&(e=zo().selectEnd()),e.insertNodes(t);}function ni(e){let n=e;e.isCollapsed()||n.removeText();const r=$r();wr(r)&&(n=r),wr(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!Ks(o);){const t=o;if([o,s]=ri(o,s),t.is(o))break}return s}function ri(t,e){const n=t.getParent();if(!n){const t=Vi();return zo().append(t),t.select(),[zo(),0]}if(yr(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!Pi(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new Er(kr(t.__key,e,"element"),kr(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function ii(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const o=Al(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!Wl(c)){for(const t of c){a=false;const{origin:e}=t;if(!Li(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of vl(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(cl(t))t.origin.isInline()||(c=t);else {if(Pi(t.origin))continue;Li(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===o)return false;if(l&&!s&&Li(c.origin)&&c.origin.isKeyboardSelectable()){const t=Jr();return t.add(c.origin.getKey()),Bo(t),true}return c=Bl(c),l&&Pl(t.anchor,c),Pl(t.focus,c),a||!s}let oi=null,si=null,li=false,ci=false,ai=0;const ui={characterData:true,childList:true,subtree:true};function fi(){return li||null!==oi&&oi._readOnly}function di(){li&&t(13);}function hi(){ai>99&&t(14);}function gi(){return null===oi&&t(195,pi()),oi}function _i(){return null===si&&t(196,pi()),si}function pi(){let t=0;const e=new Set,n=io.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=mo(r);if(po(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function yi(){return si}function mi(t,e,n){const r=e.__type,i=ao(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t<s&&(o[t](e),e.isAttached());t++);}function xi(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Ci(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t);}function Si(t){return vi(t,_i()._nodes)}function vi(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const o=i.klass;e.type!==o.getType()&&t(18,o.name);const s=o.importJSON(e),l=e.children;if(Pi(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=vi(l[t],n);s.append(e);}return s}function ki(t,e,n){const r=oi,i=li,o=si;oi=e,li=true,si=t;try{return n()}finally{oi=r,li=i,si=o;}}function Ti(t,e){const n=t._pendingEditorState,r=t._rootElement,i=t._headless||null===r;if(null===n)return;const o=t._editorState,s=o._selection,l=n._selection,c=0!==t._dirtyType,a=oi,u=li,f=si,d=t._updating,h=t._observer;let g=null;if(t._pendingEditorState=null,t._editorState=n,!i&&c&&null!==h){si=t,oi=n,li=false,t._updating=true;try{const e=t._dirtyType,r=t._dirtyElements,i=t._dirtyLeaves;h.disconnect(),g=te$5(o,n,t,e,r,i);}catch(e){if(e instanceof Error&&t._onError(e),ci)throw e;return Zi(t,null,r,n),nt$1(t),t._dirtyType=2,ci=true,Ti(t,o),void(ci=false)}finally{h.observe(r,ui),t._updating=d,oi=a,li=u,si=f;}}n._readOnly||(n._readOnly=true);const _=t._dirtyLeaves,p=t._dirtyElements,y=t._normalizedNodes,m=t._updateTags,x=t._deferred;c&&(t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=Io(t)),delete r[o]);}(t,n);const C=i?null:Es(ms(t));if(t._editable&&null!==C&&(c||null===l||l.dirty||!l.is(s))&&null!==r&&!m.has(Vn)){si=t,oi=n;try{if(null!==h&&h.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&ws(e,t,r),Zr(s,l,t,C,m,r);}!function(t,e,n){let r=t._blockCursorElement;if(wr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,c=null;if(s===o.getChildrenSize()){bs(o.getChildAtIndex(s-1))&&(l=!0);}else {const e=o.getChildAtIndex(s);if(null!==e&&bs(e)){const n=e.getPreviousSibling();(null===n||bs(n))&&(l=!0,c=t.getElementByKey(e.__key));}}if(l){const n=t.getElementByKey(o.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=tc(r);r=e.blockCursor=t;}void 0!==r&&n.classList.add(...r);}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&ws(r,t,e);}(t,r,l);}finally{null!==h&&h.observe(r,ui),si=f,oi=a;}}null!==g&&function(t,e,n,r,i){const o=Array.from(t._listeners.mutation),s=o.length;for(let t=0;t<s;t++){const[s,l]=o[t];for(const t of l){const o=e.get(t);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n});}}}(t,g,m,_,o),wr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(re$3,void 0);const S=t._pendingDecorators;null!==S&&(t._decorators=S,t._pendingDecorators=null,Ni("decorator",t,true,S)),function(t,e,n){const r=Ko(e),i=Ko(n);r!==i&&Ni("textcontent",t,true,i);}(t,e||o,n),Ni("update",t,true,{dirtyElements:p,dirtyLeaves:_,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:e||o,tags:m}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=true;try{for(let t=0;t<e.length;t++)e[t]();}finally{t._updating=n;}}}(t,x),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;wi(t,e,r);}}}(t);}function Ni(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=e._listeners[t],i=Array.from(n);for(const[t,e]of i){e&&e();const i=t(...r);n.has(t)?n.set(t,i):i&&i();}}finally{e._updating=i;}}function bi(e,n){const r=e._updates;let i=n||false;for(;0!==r.length;){const n=r.shift();if(n){const[r,o]=n,s=e._pendingEditorState;let l;void 0!==o&&(l=o.onUpdate,o.skipTransforms&&(i=true),o.discrete&&(null===s&&t(191),s._flushSync=true),l&&e._deferred.push(l),Ci(e,o.tag)),null==s?wi(e,r,o):r();}}return i}function wi(e,n,r){const i=e._updateTags;let o,s=false,l=false;void 0!==r&&(o=r.onUpdate,Ci(e,r.tag),s=r.skipTransforms||false,l=r.discrete||false),o&&e._deferred.push(o);const c=e._editorState;let a=e._pendingEditorState,u=false;(null===a||a._readOnly)&&(a=e._pendingEditorState=zi(a||c),u=true),a._flushSync=l;const f=oi,d=li,h=si,g=e._updating;oi=a,li=false,e._updating=true,si=e;const _=e._headless||null===e.getRootElement();so(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Es(ms(t));return wr(n)||null==n?Ur(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),s=bi(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(wr(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r);}}}(a,e),0!==e._dirtyType&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);yr(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&xt$3(e);}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,o=Ao(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);yr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&xt$3(r),void 0!==r&&xi(r,o)&&mi(e,r,s),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){ai++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&xi(c,o)&&mi(e,c,s);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,ai++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),bi(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(Pi(e)&&V$6(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)));}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(wr(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else Or(o)&&0===o._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ti(e)}finally{oi=f,li=d,si=h,e._updating=g,ai=0;}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,Ti(e)):u&&fo(()=>{Ti(e);}):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function Ei(t,e,n){si===t&&void 0===n?e():wi(t,e,n);}class Oi{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new Oi(this.element,t,this.after)}withAfter(t){return new Oi(this.element,this.before,t)}withElement(t){return this.element===t?this:new Oi(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(d$1||c||l);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=Mi(e,n);i.push(r);const o=Mi(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<o.length;t++){const e=i[t],n=o[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return [t.getParentOrThrow(),s]}}function Mi(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class Ai extends zn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return W$5[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=_i()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(yr(e)&&t.push(e),Pi(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Pi(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;Pi(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Pi(t)&&t.getLastDescendant()||t||null}const r=e[t];return Pi(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Po(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Po(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++;}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),Pi(i)&&r!==n-1&&!i.isInline()&&(t+=P$3);}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),Pi(i)&&r!==n-1&&!i.isInline()&&(t+=2);}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=B$3[t];return 0!==(this.getFormat()&e)}return false}hasTextFormat(t){const e=z$6[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return No(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){di();const n=$r();let r=t,i=e;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(yr(t)||Pi(t))return t.select(0,0)}else if(!(void 0!==t&&t!==o||void 0!==e&&e!==o)){const t=this.getLastChild();if(yr(t)||Pi(t))return t.select()} void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return wr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=true,n):Br(s,r,s,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(t=>t.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?B$3[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){Kn$1(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling());}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;Eo(e.getWritable()),c.push(r),e=n;}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,Eo(n);const r=e.__key;if(null===d)o.__first=r,n.__prev=null;else {const t=d.getWritable();t.__next=r,n.__prev=t.__key;}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e;}if(e+n===i){if(null!==d){d.getWritable().__next=null,o.__last=d.__key;}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key;}else t.__prev=null;}if(o.__size=f,c.length){const t=$r();if(wr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:i}=t;Di(r,e,n)&&Hr(r,r.getNode(),this,u,a),Di(i,e,n)&&Hr(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||Ss(this)||this.remove();}}return o}getDOMSlot(t){return new Oi(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ps(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0===e&&""===n||Ss(this)||this.getChildren().some(yr)||(0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function Pi(t){return t instanceof Ai}function Di(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class Fi extends zn{decorate(t,e){return null}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function Li(t){return t instanceof Fi}class Ii extends Ai{__cachedText;static getType(){return "root"}static clone(){return new Ii}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !fi()&&0!==_i()._dirtyType||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)Pi(e)||Li(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return zo().updateFromJSON(t)}collapseAtStart(){return true}}function Ki(t){return t instanceof Ii}function zi(t){return new Ji(new Map(t._nodeMap))}function Ri(){return new Ji(new Map([["root",new Ii]]))}function Bi(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Pi(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t<o.length;t++){const e=Bi(o[t]);i.push(e);}}return n}function Wi(t){return t instanceof Ji}class Ji{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=false,this._readOnly=false;}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return ki(e&&e.editor||null,this,t)}clone(t){const e=new Ji(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=true,e}toJSON(){return ki(null,this,()=>({root:Bi(zo())}))}}class ji extends Ai{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Ui extends Ai{static getType(){return "paragraph"}static clone(t){return new Ui(t.__key)}createDOM(t){const e=document.createElement("p"),n=rs(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:$i,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ps(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Vi().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(yr);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle());}return t}insertNewAfter(t,e){const n=Vi();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||yr(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function $i(t){const e=Vi();if(t.style&&(e.setFormat(t.style.textAlign),Us(t,e)),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in B$3&&e.setFormat(n);}return {node:e}}function Vi(){return ks(new Ui)}function Yi(t){return t instanceof Ui}const qi=0,Hi=1,Gi=2,Xi=3,Qi=4;function Zi(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=Ri(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const o=t._observer;null!==o&&(o.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function to(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=qs(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t);}if(t){const n=t.$transform;n&&e.add(n),r=t.extends;}else {const t=Object.getPrototypeOf(r);r=t.prototype instanceof zn&&t!==zn?t:void 0;}}return e}function eo(t){const e=t||{},n=yi(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||false,s=Ri(),l=e.namespace||(null!==i?i._config.namespace:Uo()),c=e.editorState,a=[Ii,lr,Gn,xr,Ui,ji,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null;}qs(e);const i=e.getType(),o=to(e);h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:ct$1(a[t]),transforms:o});}}const g=new io(s,i,h,{disableEvents:o,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);});};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),function(t){t.registerCommand(se$4,Sn$1,qi),t.registerCommand(le$4,vn$1,qi),t.registerCommand(ce$4,kn,qi),t.registerCommand(ae$3,Tn$1,qi),t.registerCommand(Se$1,bn$1,qi);}(g),g}function no(t,e){const n=t.get(e);t.delete(e),n&&n();}function ro(t,e,n){return t.set(e,n),no.bind(null,t,e)}class io{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Uo(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){return ro(this._listeners.update,t)}registerEditableListener(t){return ro(this._listeners.editable,t)}registerDecoratorListener(t){return ro(this._listeners.decorator,t)}registerTextContentListener(t){return ro(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return rc(ro(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0);}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=i.get(e);void 0===o&&t(36,String(e));const s=o[r];return s.add(n),()=>{s.delete(n),o.every(t=>0===t.size)&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Ws(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=Ws(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=Po(e);t&&t.markDirty();}},null===t._pendingEditorState?{tag:Wn}:void 0);}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return as(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=rs(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Zi(this,e,t,r),null!==e&&(this._config.disableEvents||Dn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=ys(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,nt$1(this),this._updateTags.add(Wn),Ti(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;on$1.set(t,n);const r=sn$1.get(n)??0;r<1&&n.addEventListener("selectionchange",On$1),sn$1.set(n,r+1),t.__lexicalEditor=e;const i=wn$1(t);for(let n=0;n<Ze$1.length;n++){const[r,o]=Ze$1[n],s="function"==typeof o?t=>{An$1(t)||(Mn$1(t),(e.isEditable()||"click"===r)&&o(t,e));}:t=>{if(An$1(t))return;Mn$1(t);const n=e.isEditable();switch(r){case "cut":return n&&as(e,je$2,t);case "copy":return as(e,Je$2,t);case "paste":return n&&as(e,ge$3,t);case "dragstart":return n&&as(e,Re$1,t);case "dragover":return n&&as(e,Be$2,t);case "dragend":return n&&as(e,We$2,t);case "focus":return n&&as(e,He$2,t);case "blur":return n&&as(e,Ge$1,t);case "drop":return n&&as(e,Ke$2,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s);});}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Wn),Ti(this);Ni("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=zi(e),r._selection=e._selection?e._selection.clone():null),et$2(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),Ti(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",false),this._compositionKey=null,null!=s&&o.add(s),this._updating||Ti(this);}parseEditorState(t,e){return function(t,e,n){const r=Ri(),i=oi,o=li,s=si,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,oi=r,li=false,si=e,so(null);try{const i=e._nodes;vi(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,oi=i,li=o,si=s;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return Ti(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):wi(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ei(this,()=>{const r=$r(),i=zo();null!==r?r.dirty||Bo(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),gs("focus"),_s(()=>{n.removeAttribute("autocapitalize"),t&&t();});}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Es(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ni("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}io.version="0.42.0+prod.esm";let oo=null;function so(t){oo=t;}let lo=1;function ao(e,n){const r=uo(e,n);return void 0===r&&t(30,n),r}function uo(t,e){return t._nodes.get(e)}const fo="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function ho(t){return Li(Lo(t))}function go(t){const e=document.activeElement;if(!Ps(e))return false;const n=e.nodeName;return Li(Lo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==mo(e))}function _o(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!go(e)&&yo(e)===t}catch(t){return false}}function po(t){return t instanceof io}function yo(t){let e=t;for(;null!=e;){const t=mo(e);if(po(t))return t;e=fs(e);}return null}function mo(t){return t?t.__lexicalEditor:null}function xo(t){return I$4.test(t)?"rtl":K$4.test(t)?"ltr":null}function Co(t){return Sr(t)||t.isToken()}function So(t){return Co(t)||t.isSegmented()}function vo(t){return Ds(t)&&3===t.nodeType}function ko(t){return Ds(t)&&9===t.nodeType}function To(t){let e=t;for(;null!=e;){if(vo(e))return e;e=e.firstChild;}return null}function No(t,e,n){const r=z$6[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function bo(t){return yr(t)||Zn(t)||Li(t)}function wo(t,e){const n=function(){const t=oo;return oo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);di(),hi();const r=_i(),i=gi(),o=""+lo++;i._nodeMap.set(o,t),Pi(t)?r._dirtyElements.set(o,true):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,t.__key=o;}function Eo(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function Oo(e){hi(),Kn$1(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=gi(),o=_i(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(r,s,l);const c=n.__key;o._dirtyType=1,Pi(e)?l.set(c,true):o._dirtyLeaves.add(c);}function Mo(t){di();const e=_i(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Po(n);null!==t&&t.getWritable();}if(null!==t){const e=Po(t);null!==e&&e.getWritable();}}}function Ao(){if(fi())return null;return _i()._compositionKey}function Po(t,e){const n=(e||gi())._nodeMap.get(t);return void 0===n?null:n}function Do(t,e){const n=Fo(t,_i());return void 0!==n?Po(n,e):null}function Fo(t,e){return t[`__lexicalKey_${e._key}`]}function Lo(t,e){let n=t;for(;null!=n;){const t=Do(n,e);if(null!==t)return t;n=fs(n);}return null}function Io(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Ko(t){return t.read(()=>zo().getTextContent())}function zo(){return Ro(gi())}function Ro(t){return t._nodeMap.get("root")}function Bo(t){di();const e=gi();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function Wo(t){const e=_i(),n=function(t,e){let n=t;for(;null!=n;){const t=Fo(n,e);if(void 0!==t)return t;n=fs(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?Po("root"):null}return Po(n)}function Jo(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function jo(t){const e=[];for(let n=t;null!==n;n=n._updating?null:n._parentEditor)e.push(n);return e}function Uo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function $o(t){return vo(t)?t.nodeValue:null}function Vo(t,e,n){const r=Es(ms(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=$o(i);const r=Lo(i);if(null!==e&&yr(r)){if((e===A$2||e===D$5)&&n){const t=n.length;e=n,o=t,s=t;}null!==e&&Yo(r,e,o,s,t);}}}function Yo(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let a=e;if((s||i)&&(e.endsWith(A$2)&&(a=e.slice(0,-A$2.length)),i)){const t=D$5;let e;for(;-1!==(e=a.indexOf(t));)a=a.slice(0,e)+a.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length));}const u=o.getTextContent();if(i||a!==u){if(""===a){if(Mo(null),l||c||d$1)o.remove();else {const t=_i();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove();});},20);}return}const e=o.getParent(),i=Vr(),u=o.getTextContentSize(),f=Ao(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||wr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=$r();if(!wr(g)||null===n||null===r)return void qo(o,a,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=pr(o.getTextContent());o.replace(t),o=t;}qo(o,a,g);}}}function qo(t,e,n){if(t.setTextContent(e),wr(n)){const e=t.getKey();for(const r of ["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===e&&(i.offset=gl(t,i.offset,"clamp"));}}}function Ho(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Go(t,e){return Ho(t,e,"altKey")&&Ho(t,e,"ctrlKey")&&Ho(t,e,"shiftKey")&&Ho(t,e,"metaKey")}function Xo(t,e,n){if(!Go(t,n))return false;if(t.key.toLowerCase()===e.toLowerCase())return true;if(e.length>1)return false;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return false;const r="Key"+e.toUpperCase();return t.code===r}const Qo={ctrlKey:!i,metaKey:i},Zo={altKey:i,ctrlKey:!i};function ts(t){return "Backspace"===t.key}function es(t){return Xo(t,"a",Qo)}function ns(t){const e=zo();if(wr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),Ct$3(t),t}{const t=e.select(0,e.getChildrenSize());return Bo(Ct$3(t)),t}}function rs(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=tc(i);return n[e]=t,t}return i}function is(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o);}function ss(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function ls(t,e){const n=t.offset;if("element"===t.type){return ss(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?ss(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function cs(t){const e=ms(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function as(t,e,n){return function(t,e,n){const r=jo(t);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o],l=s._commands.get(e);if(void 0!==l){const e=l[i];if(void 0!==e){const r=Array.from(e),i=r.length;let o=false;if(Ei(s,()=>{for(let e=0;e<i;e++)if(r[e](n,t))return void(o=true)}),o)return o}}}return false}(t,e,n)}function us(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function fs(t){const e=t.assignedSlot||t.parentElement;return Fs(e)?e.host:e}function ds(t){return ko(t)?t:Ps(t)?t.ownerDocument:null}function hs(t){return _i()._updateTags.has(t)}function gs(t){di();_i()._updateTags.add(t);}function _s(t){di();_i()._deferred.push(t);}function ps(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return true;n=n.getParent();}return false}function ys(t){const e=ds(t);return e?e.defaultView:null}function ms(e){const n=e._window;return null===n&&t(78),n}function xs(t){return Pi(t)&&t.isInline()||Li(t)&&t.isInline()}function Cs(t){let e=t.getParentOrThrow();for(;null!==e;){if(Ss(e))return e;e=e.getParentOrThrow();}return e}function Ss(t){return Ki(t)||Pi(t)&&t.isShadowRoot()}function vs(t,e=false){const n=t.constructor.clone(t);return wo(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function ks(e){const n=_i(),r=e.getType(),i=uo(n,r);void 0===i&&t(200,e.constructor.name,r);const{replace:o,replaceWithKlass:s}=i;if(null!==o){const n=o(e),i=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function Ts(e,n){!Ki(e.getParent())||Pi(n)||Li(n)||t(99);}function Ns(e){const n=Po(e);return null===n&&t(63,e),n}function bs(t){return (Li(t)||Pi(t)&&!t.canBeEmpty())&&!t.isInline()}function ws(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t);}function Es(t){return n?(t||window).getSelection():null}function Os(t){const e=ys(t);return e?e.getSelection():null}function Ms(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Ss(e)&&t(102);const i=e=>{const n=e.getParentOrThrow(),o=Ss(n),s=e!==r||o?vs(e):e;if(o)return Pi(e)&&Pi(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,o]=i(n),l=e.getNextSiblings();return o.append(s,...l),[t,r,s]}},[o,s]=i(r);return [o,s]}function As(t){return Ps(t)&&"A"===t.tagName}function Ps(t){return Ds(t)&&1===t.nodeType}function Ds(t){return "object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function Fs(t){return Ds(t)&&11===t.nodeType}function Ls(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function Is(t){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==t.nodeName.match(e)}function Ks(t){if(Li(t)&&!t.isInline())return true;if(!Pi(t)||Ss(t))return false;const e=t.getFirstChild(),n=null===e||Zn(e)||yr(e)||e.isInline();return !t.isInline()&&false!==t.canBeEmpty()&&n}function zs(){return _i()}const Rs=new WeakMap,Bs=new Map;function Ws(e){if(!e._readOnly&&e.isEmpty())return Bs;e._readOnly||t(192);let n=Rs.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r);}return e}(e),Rs.set(e,n)),n}function Js(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function js(t){return (e=Js(t))[In]=true,e;var e;}function Us(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r);}function $s(t){t.__lexicalUnmanaged=true;}function Vs(t){return true===t.__lexicalUnmanaged}function Ys(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==zn[e]}function qs(e){const n=$$4 in e.prototype?e.prototype[$$4]():void 0,r=function(e){if(!(e===zn||e.prototype instanceof zn)){let n="<unknown>",r="<unknown>";try{n=e.getType();}catch(t){}try{io.version&&(r=JSON.parse(io.version));}catch(t){}t(290,e.name,n,r);}return e===Fi||e===Ai||e===zn}(e),i=!r&&Ys(e,"getType")?e.getType():void 0;let o,s=i;if(n)if(i)o=n[i];else for(const[t,e]of Object.entries(n))s=t,o=e;if(!r&&s&&(Ys(e,"getType")||(e.getType=()=>s),Ys(e,"clone")||(e.clone=t=>(so(t),new e)),Ys(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!Ys(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t);}return {ownNodeConfig:o,ownNodeType:s}}function Hs(t){const e=zs();di();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const Gs=(t,e)=>{let n=t;for(;null!=n&&!Ki(n);){if(e(n))return n;n=n.getParent();}return null},Xs={next:"previous",previous:"next"};class Qs{origin;constructor(t){this.origin=t;}[Symbol.iterator](){return Nl({hasNext:ll,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return dl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return dl(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e);}for(const e of i){if(l.size>0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else {const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else o.insert(e);o=dl(e,this.direction);}for(const t of l.values())t.remove();return this}}class Zs extends Qs{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:pl(t,this.direction)}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=el(this.direction);return dl(this.getNodeAtCaret(),t)||pl(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Zs&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const tl={root:Ki,shadowRoot:Ss};function el(t){return Xs[t]}function nl(t,e="root"){return tl[e](t)?null:t}class rl extends Qs{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:dl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Pi(this.origin)?pl(this.origin,this.direction):null}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=el(this.direction);return dl(this.getNodeAtCaret(),t)||pl(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof rl&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof rl||t instanceof il)&&this.direction===t.direction&&this.origin.is(t.origin)}}class il extends Qs{type="text";offset;constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:hl(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){return hl(this.origin,el(this.direction),this.offset)}isSamePointCaret(t){return t instanceof il&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof rl||t instanceof il)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return dl(this.origin,this.direction)}}function ol(t){return t instanceof il}function ll(t){return t instanceof rl}function cl(t){return t instanceof Zs}const al={next:class extends il{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends il{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},ul={next:class extends rl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends rl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},fl={next:class extends Zs{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Zs{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function dl(t,e){return t?new ul[e](t):null}function hl(t,e,n){return t?new al[e](t,gl(t,n)):null}function gl(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return (o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function _l(t,e){return new Cl(t,e)}function pl(t,e){return Pi(t)?new fl[e](t):null}function yl(t){return t&&t.getChildCaret()||t}function ml(t){return t&&yl(t.getAdjacentCaret())}class xl{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new xl(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return ol(e)?function(t,e){const{direction:n,origin:r}=t,i=gl(r,"focus"===e?el(n):n);return _l(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [_l(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=ol(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ol(n),i=e=>e.isSameNodeCaret(n)?null:ml(e)||e.getParentCaret(t);return Nl({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Cl{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return hl(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function vl(t){return Tl(t,dl(zo(),t.direction))}function kl(t){return Tl(t,t)}function Tl(e,n){return e.direction!==n.direction&&t(265),new xl(e,n,e.direction)}function Nl(t){const{initial:e,hasNext:n,step:r,map:i}=t;let o=e;return {[Symbol.iterator](){return this},next(){if(!n(o))return {done:true,value:void 0};const t={done:false,value:i(o)};return o=r(o),t}}}function bl(e,n){const r=Ml(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case "same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case "ancestor":return "child"===e.type?-1:1;case "descendant":return "child"===n.type?1:-1;case "branch":return wl(r)}}function wl(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let o=e,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return -1;if(s.__key===r)return 1}return null===o?1:-1}function El(t,e){return e.is(t)}function Ol(t){return Pi(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ml(e,n){if(e.is(n))return {commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Ol(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,o]=Ol(n);i;o=i,i=i.getParent()){const s=r.get(i);if(void 0!==s)return null===s?(El(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===o?(El(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((Pi(s)||El(e,s))&&(Pi(o)||El(n,o))&&i.is(s.getParent())&&i.is(o.getParent())||t(278),{a:s,b:o,commonAncestor:i,type:"branch"})}return null}function Al(e,n){const{type:r,key:i,offset:o}=e,s=Ns(e.key);return "text"===r?(yr(s)||t(266,s.getType(),i),hl(s,n,o)):(Pi(s)||t(267,s.getType(),i),Ul(s,e.offset,n))}function Pl(e,n){const{origin:r,direction:i}=n,o="next"===i;ol(n)?e.set(r.getKey(),n.offset,"text"):ll(n)?yr(r)?e.set(r.getKey(),gl(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(cl(n)&&Pi(r)||t(268),e.set(r.getKey(),o?0:r.getChildrenSize(),"element"));}function Dl(t){const e=$r(),n=wr(e)?e:Wr();return Fl(n,t),Bo(n),n}function Fl(t,e){Pl(t.anchor,e.anchor),Pl(t.focus,e.focus);}function Ll(t){const{anchor:e,focus:n}=t,r=Al(e,"next"),i=Al(n,"next"),o=bl(r,i)<=0?"next":"previous";return Tl(Jl(r,o),Jl(i,o))}function Il(t){const{direction:e,origin:n}=t,r=dl(n,el(e)).getNodeAtCaret();return r?dl(r,e):pl(n.getParentOrThrow(),e)}function Kl(t,e="root"){const n=[t];for(let r=cl(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Il(r));return n}function zl(t){return !!t&&t.origin.isAttached()}function Rl(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let o=n;const s=jl(e,i),l=Kl(s.anchor,r),c=Kl(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(cl(t))a.add(t.origin.getKey());else if(ll(t)){const{origin:e}=t;Pi(e)&&!a.has(e.getKey())||u.push(e);}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Il(dl(e,i)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===o||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){o="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=pr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=hl(n,i,e.offset);}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped());}}let f,d;for(const t of l)if(zl(t)){f=Bl(t);break}for(const t of c)if(zl(t)){d=Bl(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let c;for(c=0;c<l&&o[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(Ss(i))return;!n&&e(i)&&(n=i);}return n},u=a(o,Ks),f=u&&a(s,t=>n.has(t.getKey())&&Ks(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;pl(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(true);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(true);}}const g=[f,d,...l,...c].find(zl);if(g){return kl(Jl(Bl(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)));}function Bl(t){const e=function(t){let e=t;for(;cl(e);){const t=ml(e);if(!cl(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(yr(e.origin))return ol(e)?e:hl(e.origin,n,n);const r=e.getAdjacentCaret();return ll(r)&&yr(r.origin)?hl(r.origin,n,el(n)):e}function Wl(t){return ol(t)&&t.offset!==gl(t.origin,t.direction)}function Jl(t,e){return t.direction===e?t:t.getFlipped()}function jl(t,e){return t.direction===e?t:Tl(Jl(t.focus,e),Jl(t.anchor,e))}function Ul(t,e,n){let r=pl(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t;}return Jl(r,n)}function $l(t,e="root"){let n=0,r=t,i=ml(r);for(;null===i;){if(n--,i=r.getParentCaret(e),!i)return null;r=i,i=ml(r);}return i&&[i,n]}function Vl(e){const{origin:n,offset:r,direction:i}=e;if(r===gl(n,i))return e.getSiblingCaret();if(r===gl(n,el(i)))return Il(e.getSiblingCaret());const[o]=n.splitText(r);return yr(o)||t(281),Jl(dl(o,"next"),i)}function Yl(t,e){return true}function ql(t,{$copyElementNode:e=vs,$splitTextPointCaretNext:n=Vl,rootMode:r="shadowRoot",$shouldSplit:i=Yl}={}){if(ol(t))return n(t);const o=t.getParentCaret(r);if(o){const{origin:n}=o;if(cl(t)&&(!n.canBeEmpty()||!i(n,"first")))return Il(o);const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||n.canBeEmpty()&&i(n,"last"))&&o.insert(e(n).splice(0,0,r));}return o}function Hl(t){return t}function Gl(...t){return t}function Ql(t){return t}function Zl(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return {...t,...e};return t}function tc(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function ec(t,...e){const n=tc(...e);n.length>0&&t.classList.add(...n);}function nc(t,...e){const n=tc(...e);n.length>0&&t.classList.remove(...n);}function rc(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}
|
|
6207
|
+
function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o$1=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s$1=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a$1=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a$1&&u,d$1=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u,h$1=0,g$1=1,_$3=2,k$3=128,N$3=1,b$5=2,w$5=3,E$5=4,O$5=5,M$7=6,A$2=l||c||d$1?"\xa0":"\u200b",P$3="\n\n",D$5=o$1?"\xa0":A$2,F$5="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",L$5="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",I$4=new RegExp("^[^"+L$5+"]*["+F$5+"]"),K$4=new RegExp("^[^"+F$5+"]*["+L$5+"]"),z$6={bold:1,capitalize:1024,code:16,highlight:k$3,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},R$4={directionless:1,unmergeable:2},B$3={center:2,end:6,justify:4,left:1,right:3,start:5},W$5={[b$5]:"center",[M$7]:"end",[E$5]:"justify",[N$3]:"left",[w$5]:"right",[O$5]:"start"},J$3={normal:0,segmented:2,token:1},j$6={[h$1]:"normal",[_$3]:"segmented",[g$1]:"token"},$$4="$config";function V$6(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Pi(s)&&V$6(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling();}}let Y$4=false,q$6=0;function H$5(t){q$6=t.timeStamp;}function G$4(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==Fo(t,n)}function X$4(t,e,n){const r=Es(ms(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&Yo(e,s,i,o,false);}function Q$5(t,e,n){if(wr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return vo(e)&&n.isAttached()}function Z$4(t,e,n,r){for(let i=t;i&&!Vs(i);i=fs(i)){const t=Fo(i,e);if(void 0!==t){const e=Po(t,n);if(e)return Li(e)||!Ps(i)?void 0:[i,e]}else if(i===r)return [r,Ro(n)]}}function tt$2(t,e,n){Y$4=true;const r=performance.now()-q$6>100;try{Ei(t,()=>{const i=$r()||function(t){return t.getEditorState().read(()=>{const t=$r();return null!==t?t.clone():null})}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=Z$4(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&yr(y)&&vo(g)&&Q$5(i,g,y)&&X$4(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],i=Do(r),s=r.parentNode;if(null!=s&&r!==a&&null===i&&!G$4(r,s,t)){if(o$1){const t=(Ps(r)?r.innerText:null)||r.nodeValue;t&&(f+=t);}s.removeChild(r);}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(G$4(r,g,t)||a===r)&&(g.appendChild(r),e++);}r!==e&&s.set(p,y);}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],o=n.parentNode;null==o||"BR"!==n.nodeName||G$4(n,i,t)||o.removeChild(n);}}n.takeRecords();}null!==i&&(u&&Bo(i),o$1&&cs(t)&&i.insertRawText(f));});}finally{Y$4=false;}}function et$2(t){const e=t._observer;if(null!==e){tt$2(t,e.takeRecords(),e);}}function nt$1(t){!function(t){0===q$6&&ms(t).addEventListener("textInput",H$5,true);}(t),t._observer=new MutationObserver((e,n)=>{tt$2(t,e,n);});}let rt$2 = class rt{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||ht$5).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||false;}};function it$2(t,e){return new rt$2(t,e)}function ot$2(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function lt$2(t,e,n){let r;if(di(),"function"==typeof n){const i=t.getLatest(),o=ot$2(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return ut$1(i).updateFromKnown(e,r),i}function ct$1(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=qs(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t);}}return {flatKeys:n,sharedConfigMap:e}}let at$2 = class at{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(o,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return dt$3(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new at(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o);}return r}(e.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=dt$3(i)),this.size++),r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);}};function ut$1(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new at$2(e,ft$2(e));return e.__state=n,n}function ft$2(t){return t.__state?t.__state.sharedNodeState:ao(zs(),t.getType()).sharedNodeState}function dt$3(t){if(t)for(const e in t)return t}function ht$5(t){return t}function gt$2(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return true}return false}function _t$4(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return true}return false}function pt$4(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function yt$3(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set;return !(t&>$2(n,t,e)||e&>$2(n,e,t)||t&&_t$4(n,t,e)||e&&_t$4(n,e,t))}(c,a))}function mt$4(t,e){const n=t.mergeWithSibling(e),r=_i()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function xt$3(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&yr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(yt$3(e,r)){r=mt$4(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&yr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(yt$3(r,n)){r=mt$4(r,n);break}break}n.remove();}}else r.remove();}function Ct$3(t){return St$3(t.anchor),St$3(t.focus),t}function St$3(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),yr(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!Pi(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let vt$3,kt$4,Tt$4,Nt$3,bt$3,wt$4,Et$2,Ot$3,Mt$4,At$3,Pt$3="",Dt$4=null,Ft$4=null,Lt$5=false,It$3=false;function Kt$4(t,e){const n=Et$2.get(t);if(null!==e){const n=ee$5(t);n.parentNode===e&&e.removeChild(n);}if(Ot$3.has(t)||kt$4._keyToDOMMap.delete(t),Pi(n)){const t=Ht$4(n,Et$2);zt$3(t,0,t.length-1,null);} void 0!==n&&is(At$3,Tt$4,Nt$3,n,"destroyed");}function zt$3(t,e,n,r){for(let i=e;i<=n;++i){const e=t[i];void 0!==e&&Kt$4(e,r);}}function Rt$3(t,e){t.setProperty("text-align",e);}const Bt$4="40px";function Wt$3(t,e){const n=vt$3.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}if(0===e)return void t.style.setProperty("padding-inline-start","");const r=getComputedStyle(kt$4._rootElement||t).getPropertyValue("--lexical-indent-base-value")||Bt$4;t.style.setProperty("padding-inline-start",`calc(${e} * ${r})`);}function Jt$4(t,e){const n=t.style;0===e?Rt$3(n,""):1===e?Rt$3(n,"left"):2===e?Rt$3(n,"center"):3===e?Rt$3(n,"right"):4===e?Rt$3(n,"justify"):5===e?Rt$3(n,"start"):6===e&&Rt$3(n,"end");}function jt$4(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(Ki(t))return null;const n=t.getParentOrThrow();return Ki(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir");}function Ut$3(e,n){const r=Ot$3.get(e);void 0===r&&t(60);const i=r.createDOM(vt$3,kt$4);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,kt$4),yr(r)?i.setAttribute("data-lexical-text","true"):Li(r)&&i.setAttribute("data-lexical-decorator","true"),Pi(r)){const t=r.__indent,e=r.__size;if(jt$4(i,r),0!==t&&Wt$3(i,t),0!==e){const t=e-1;$t$2(Ht$4(r,Ot$3),r,0,t,r.getDOMSlot(i));}const n=r.__format;0!==n&&Jt$4(i,n),r.isInline()||Yt$3(null,r,i);}else {const t=r.getTextContent();if(Li(r)){const t=r.decorate(kt$4,vt$3);null!==t&&Xt$3(e,t),i.contentEditable="false";}Pt$3+=t;}return null!==n&&n.insertChild(i),is(At$3,Tt$4,Nt$3,r,"created"),i}function $t$2(t,e,n,r,i){const o=Pt$3;Pt$3="";let s=n;for(;s<=r;++s){Ut$3(t[s],i);const e=Ot$3.get(t[s]);null!==e&&yr(e)?null===Dt$4&&(Dt$4=e.getFormat(),Ft$4=e.getStyle()):Pi(e)&&s<r&&!e.isInline()&&(Pt$3+=P$3);}i.element.__lexicalTextContent=Pt$3,Pt$3=o+Pt$3;}function Vt$3(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Zn(t)?"line-break":Li(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Yt$3(t,e,n){const r=Vt$3(t,Et$2),i=Vt$3(e,Ot$3);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function qt$3(e,n,r){var i;Dt$4=null,Ft$4=null,function(e,n,r){const i=Pt$3,o=e.__size,s=n.__size;Pt$3="";const l=r.element;if(1===o&&1===s){const t=e.__first,r=n.__first;if(t===r)Gt$3(t,l);else {const e=ee$5(t),n=Ut$3(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const o=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw i}Kt$4(t,null);}const i=Ot$3.get(r);yr(i)&&null===Dt$4&&(Dt$4=i.getFormat(),Ft$4=i.getStyle());}else {const i=Ht$4(e,Et$2),c=Ht$4(n,Ot$3);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&$t$2(c,0,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;zt$3(i,0,o-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=Qt$3(Gt$3(r,o.element)),f++,d++;else {if(void 0===a&&(a=Zt$3(n,d)),void 0===c)c=Zt$3(e,f);else if(!c.has(t)){f++;continue}if(!a.has(t)){u=Qt$3(ee$5(t)),Kt$4(t,o.element),f++,c.delete(t);continue}if(c.has(r)){const t=us(kt$4,r);t!==u&&o.withBefore(u).insertChild(t),u=Qt$3(Gt$3(r,o.element)),f++,d++;}else Ut$3(r,o.withBefore(u)),d++;}const i=Ot$3.get(r);null!==i&&yr(i)?null===Dt$4&&(Dt$4=i.getFormat(),Ft$4=i.getStyle()):Pi(i)&&d<=l&&!i.isInline()&&(Pt$3+=P$3);}const h=f>s,g=d>l;if(h&&!g){const t=n[l+1],e=void 0===t?null:kt$4.getElementByKey(t);$t$2(n,0,d,l,o.withBefore(e));}else g&&!h&&zt$3(e,f,s,o.element);}(0,i,c,o,s,r);}l.__lexicalTextContent=Pt$3,Pt$3=i+Pt$3;}(e,n,n.getDOMSlot(r)),i=n,null==Dt$4||Dt$4===i.__textFormat||It$3||i.setTextFormat(Dt$4),function(t){null==Ft$4||Ft$4===t.__textStyle||It$3||t.setTextStyle(Ft$4);}(n);}function Ht$4(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function Gt$3(e,n){const r=Et$2.get(e);let i=Ot$3.get(e);void 0!==r&&void 0!==i||t(61);const o=Lt$5||wt$4.has(e)||bt$3.has(e),s=us(kt$4,e);if(r===i&&!o){let t;if(Pi(r)){const e=s.__lexicalTextContent;"string"==typeof e?t=e:(t=r.getTextContent(),s.__lexicalTextContent=t);}else t=r.getTextContent();return Pt$3+=t,s}if(r!==i&&o&&is(At$3,Tt$4,Nt$3,i,"updated"),i.updateDOM(r,s,vt$3)){const r=Ut$3(e,null);return null===n&&t(62),n.replaceChild(r,s),Kt$4(e,null),r}if(Pi(r)){Pi(i)||t(334,e);const n=i.__indent;(Lt$5||n!==r.__indent)&&Wt$3(s,n);const l=i.__format;if((Lt$5||l!==r.__format)&&Jt$4(s,l),o)qt$3(r,i,s),Ki(i)||i.isInline()||Yt$3(r,i,s);else {const t=s.__lexicalTextContent;let e;"string"==typeof t?e=t:(e=r.getTextContent(),s.__lexicalTextContent=e),Pt$3+=e;}if((Lt$5||i.__dir!==r.__dir)&&(jt$4(s,i),Ki(i)&&!Lt$5))for(const t of i.getChildren())if(Pi(t)){jt$4(us(kt$4,t.getKey()),t);}}else {const t=i.getTextContent();if(Li(i)){const t=i.decorate(kt$4,vt$3);null!==t&&Xt$3(e,t);}Pt$3+=t;}if(!It$3&&Ki(i)&&i.__cachedText!==Pt$3){const t=i.getWritable();t.__cachedText=Pt$3,i=t;}return s}function Xt$3(t,e){let n=kt$4._pendingDecorators;const r=kt$4._decorators;if(null===n){if(r[t]===e)return;n=Io(kt$4);}n[t]=e;}function Qt$3(t){let e=t.nextSibling;return null!==e&&e===kt$4._blockCursorElement&&(e=e.nextSibling),e}function Zt$3(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function te$5(t,e,n,r,i,o){Pt$3="",Lt$5=2===r,kt$4=n,vt$3=n._config,Tt$4=n._nodes,Nt$3=kt$4._listeners.mutation,bt$3=i,wt$4=o,Et$2=t._nodeMap,Ot$3=e._nodeMap,It$3=e._readOnly,Mt$4=new Map(n._keyToDOMMap);const s=new Map;return At$3=s,Gt$3("root",null),kt$4=void 0,Tt$4=void 0,bt$3=void 0,wt$4=void 0,Et$2=void 0,Ot$3=void 0,vt$3=void 0,Mt$4=void 0,At$3=void 0,s}function ee$5(e){const n=Mt$4.get(e);return void 0===n&&t(75,e),n}function ne$5(t){return {type:t}}const re$3=ne$5("SELECTION_CHANGE_COMMAND"),ie$4=ne$5("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),oe$5=ne$5("CLICK_COMMAND"),se$4=ne$5("BEFORE_INPUT_COMMAND"),le$4=ne$5("INPUT_COMMAND"),ce$4=ne$5("COMPOSITION_START_COMMAND"),ae$3=ne$5("COMPOSITION_END_COMMAND"),ue$2=ne$5("DELETE_CHARACTER_COMMAND"),fe$3=ne$5("INSERT_LINE_BREAK_COMMAND"),de$2=ne$5("INSERT_PARAGRAPH_COMMAND"),he$2=ne$5("CONTROLLED_TEXT_INSERTION_COMMAND"),ge$3=ne$5("PASTE_COMMAND"),_e$2=ne$5("REMOVE_TEXT_COMMAND"),pe$2=ne$5("DELETE_WORD_COMMAND"),ye$1=ne$5("DELETE_LINE_COMMAND"),me$2=ne$5("FORMAT_TEXT_COMMAND"),xe$1=ne$5("UNDO_COMMAND"),Ce$1=ne$5("REDO_COMMAND"),Se$1=ne$5("KEYDOWN_COMMAND"),ve$1=ne$5("KEY_ARROW_RIGHT_COMMAND"),ke$3=ne$5("MOVE_TO_END"),Te$1=ne$5("KEY_ARROW_LEFT_COMMAND"),Ne$2=ne$5("MOVE_TO_START"),be$2=ne$5("KEY_ARROW_UP_COMMAND"),we$1=ne$5("KEY_ARROW_DOWN_COMMAND"),Ee$2=ne$5("KEY_ENTER_COMMAND"),Oe$2=ne$5("KEY_SPACE_COMMAND"),Me$2=ne$5("KEY_BACKSPACE_COMMAND"),Ae$2=ne$5("KEY_ESCAPE_COMMAND"),Pe$2=ne$5("KEY_DELETE_COMMAND"),De$2=ne$5("KEY_TAB_COMMAND"),Fe$1=ne$5("INSERT_TAB_COMMAND"),Le$3=ne$5("INDENT_CONTENT_COMMAND"),Ie$2=ne$5("OUTDENT_CONTENT_COMMAND"),Ke$2=ne$5("DROP_COMMAND"),ze$2=ne$5("FORMAT_ELEMENT_COMMAND"),Re$1=ne$5("DRAGSTART_COMMAND"),Be$2=ne$5("DRAGOVER_COMMAND"),We$2=ne$5("DRAGEND_COMMAND"),Je$2=ne$5("COPY_COMMAND"),je$2=ne$5("CUT_COMMAND"),Ue$2=ne$5("SELECT_ALL_COMMAND"),$e$2=ne$5("CLEAR_EDITOR_COMMAND"),Ve$2=ne$5("CLEAR_HISTORY_COMMAND"),Ye$1=ne$5("CAN_REDO_COMMAND"),qe$2=ne$5("CAN_UNDO_COMMAND"),He$2=ne$5("FOCUS_COMMAND"),Ge$1=ne$5("BLUR_COMMAND"),Xe$2=ne$5("KEY_MODIFIER_COMMAND"),Qe$1=Object.freeze({}),Ze$1=[["keydown",function(t,e){if(tn$1=t.timeStamp,en$1=t.key,e.isComposing())return;as(e,Se$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ds(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&Ei(e,()=>{ho(n)||(cn$1=true);});}],["compositionstart",function(t,e){as(e,ce$4,t);}],["compositionend",function(t,e){o$1?un$1=true:c||!l&&!d$1?as(e,ae$3,t):(fn$1=true,dn$1=t.data);}],["input",function(t,e){t.stopPropagation(),Ei(e,()=>{e.dispatchCommand(le$4,t);},{event:t}),rn$1=null;}],["click",function(t,e){Ei(e,()=>{const n=$r(),r=Es(ms(e)),i=Vr();if(r)if(wr(n)){const e=n.anchor,o=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!Ki(o)&&1===zo().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(o!==n.focus.getNode()){const t=Gs(o,t=>Pi(t)&&!t.isInline());Pi(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Ps(n)||vo(n)){Bo(Ur(i,r,e,t));}}as(e,oe$5,t);});}],["cut",Qe$1],["copy",Qe$1],["dragstart",Qe$1],["dragover",Qe$1],["dragend",Qe$1],["paste",Qe$1],["focus",Qe$1],["blur",Qe$1],["drop",Qe$1]];s$1&&Ze$1.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||o$1&&cs(e))return;if("insertCompositionText"===n)return;as(e,se$4,t);}(t,e)]);let tn$1=0,en$1=null,nn$1=0,rn$1=null;const on$1=new WeakMap,sn$1=new WeakMap;let ln$1=false,cn$1=false,an$1=false,un$1=false,fn$1=false,dn$1="",hn$1=null,gn$1=[0,"",0,"root",0];function _n$1(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=_i(),u=Es(ms(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!yr(c)||(!i&&(!s$1||nn$1<r+50)||c.isDirty()&&g<2||Jo(n))&&o.offset!==l.offset&&!c.isComposing()||So(c)||c.isDirty()&&g>1||(i||!s$1)&&null!==h&&!c.isComposing()&&f!==To(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==t.format||c.getStyle()!==t.style)||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=Co(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (yr(e)||Pi(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function pn$1(t,e){return vo(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function yn$1(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;ln$1&&(ln$1=false,pn$1(i,o)&&pn$1(s,l)&&!hn$1)||Ei(n,()=>{if(!r)return void Bo(null);if(!_o(n,i,s))return;let c=$r();if(hn$1&&wr(c)&&c.isCollapsed()){const t=c.anchor,e=hn$1.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=hn$1.clone(),Bo(c));}if(hn$1=null,wr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const o=ms(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=gn$1,h=zo(),g=false===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)mn$1(c,l,a);else if("text"===r.type)yr(i)||t(141),xn$1(c,i);else if("element"===r.type&&!g){Pi(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();mn$1(t,n,r);}(c,e):mn$1(c,c.format,"");}}else {const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,s=c.isBackward(),a=s?l:o,u=s?o:l,f=s?e:t,d=s?t:e;let h=2047,g=false;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(yr(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=true,h&=e.getFormat(),0===h))break}c.format=g?h:0;}}as(n,re$3,void 0);});}function mn$1(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=true);}function xn$1(t,e){mn$1(t,e.getFormat(),e.getStyle());}function Cn$1(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function Sn$1(e){const n=e.inputType,r=Cn$1(e),i=_i(),o=$r();if("deleteContentBackward"===n){if(null===o){const t=Vr();if(!wr(t))return true;Bo(t.clone());}if(wr(o)){const n=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===en$1&&s<tn$1+30&&i.isComposing()&&n){if(Mo(null),tn$1=0,setTimeout(()=>{Ei(i,()=>{Mo(null);});},30),wr(o)){const e=o.anchor.getNode();e.markDirty(),yr(e)||t(142),xn$1(o,e);}}else {Mo(null),e.preventDefault();const t=o.anchor.getNode(),r=t.getTextContent(),s=t.canInsertTextAfter(),l=0===o.anchor.offset&&o.focus.offset===r.length;let c=f&&n&&!l&&s;if(c&&o.isCollapsed()&&(c=!Li(ls(o.anchor,true))),!c){as(i,ue$2,true);const t=$r();f&&wr(t)&&t.isCollapsed()&&(hn$1=t,setTimeout(()=>hn$1=null));}}return true}}var s;if(!wr(o))return true;const l=e.data;null!==rn$1&&Vo(false,i,rn$1),o.dirty&&null===rn$1||!o.isCollapsed()||Ki(o.anchor.getNode())||null===r||o.applyDOMRange(r),rn$1=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===l)e.preventDefault(),as(i,fe$3,false);else if(l===P$3)e.preventDefault(),as(i,de$2,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t);}else null!=l&&_n$1(o,r,l,e.timeStamp,true)?(e.preventDefault(),as(i,he$2,l)):rn$1=l;return nn$1=e.timeStamp,true}switch(e.preventDefault(),n){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":as(i,he$2,e);break;case "insertFromComposition":Mo(null),as(i,he$2,e);break;case "insertLineBreak":Mo(null),as(i,fe$3,false);break;case "insertParagraph":Mo(null),an$1&&!c?(an$1=false,as(i,fe$3,false)):as(i,de$2,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":as(i,ge$3,e);break;case "deleteByComposition":(function(t,e){return t!==e||Pi(t)||Pi(e)||!Co(t)||!Co(e)})(d,h)&&as(i,_e$2,e);break;case "deleteByDrag":case "deleteByCut":as(i,_e$2,e);break;case "deleteContent":as(i,ue$2,false);break;case "deleteWordBackward":as(i,pe$2,true);break;case "deleteWordForward":as(i,pe$2,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":as(i,ye$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":as(i,ye$1,false);break;case "formatStrikeThrough":as(i,me$2,"strikethrough");break;case "formatBold":as(i,me$2,"bold");break;case "formatItalic":as(i,me$2,"italic");break;case "formatUnderline":as(i,me$2,"underline");break;case "historyUndo":as(i,xe$1,void 0);break;case "historyRedo":as(i,Ce$1,void 0);}return true}function vn$1(t){if(Ps(t.target)&&ho(t.target))return true;const e=_i(),n=$r(),r=t.data,i=Cn$1(t);if(null!=r&&wr(n)&&_n$1(n,i,r,t.timeStamp,false)){un$1&&(Nn$1(e,r),un$1=false);const i=n.anchor.getNode(),l=Es(ms(e));if(null===l)return true;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s$1&&!n.isCollapsed()&&yr(i)&&null!==l.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+u)===$o(l.anchorNode)||as(e,he$2,r);const d=r.length;o$1&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d),f&&e.isComposing()&&(tn$1=0,Mo(null));}else {Vo(false,e,null!==r?r:void 0),un$1&&(Nn$1(e,r||void 0),un$1=false);}return function(){di();const t=_i();et$2(t);}(),true}function kn(t){const e=_i(),n=$r();if(wr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();Mo(r.key),gs(qn),(t.timeStamp<tn$1+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||yr(i)&&i.getStyle()!==n.style)&&as(e,he$2,D$5);}return true}function Tn$1(t){return Nn$1(_i(),t.data),gs(Hn),true}function Nn$1(t,e){const n=t._compositionKey;if(Mo(null),null!==n&&null!=e){if(""===e){const e=Po(n),r=To(t.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&yr(e)){const n=Es(ms(t));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Yo(e,r.nodeValue,i,o,true);}return}if("\n"===e[e.length-1]){const e=$r();if(wr(e)||Or(e)){if(wr(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type);}return void as(t,Ee$2,null)}}}Vo(true,t,e);}function bn$1(t){const e=_i();if(null==t.key)return true;if(fn$1){if(ts(t))return Ei(e,()=>{Nn$1(e,dn$1);}),fn$1=false,dn$1="",true;fn$1=false,dn$1="";}if(function(t){return Xo(t,"ArrowRight",{shiftKey:"any"})}(t))as(e,ve$1,t);else if(function(t){return Xo(t,"ArrowRight",Qo)}(t))as(e,ke$3,t);else if(function(t){return Xo(t,"ArrowLeft",{shiftKey:"any"})}(t))as(e,Te$1,t);else if(function(t){return Xo(t,"ArrowLeft",Qo)}(t))as(e,Ne$2,t);else if(function(t){return Xo(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))as(e,be$2,t);else if(function(t){return Xo(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))as(e,we$1,t);else if(function(t){return Xo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))an$1=true,as(e,Ee$2,t);else if(function(t){return " "===t.key}(t))as(e,Oe$2,t);else if(function(t){return i&&Xo(t,"o",{ctrlKey:true})}(t))t.preventDefault(),an$1=true,as(e,fe$3,true);else if(function(t){return Xo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))an$1=false,as(e,Ee$2,t);else if(function(t){return Xo(t,"Backspace",{shiftKey:"any"})||i&&Xo(t,"h",{ctrlKey:true})}(t))ts(t)?as(e,Me$2,t):(t.preventDefault(),as(e,ue$2,true));else if(function(t){return "Escape"===t.key}(t))as(e,Ae$2,t);else if(function(t){return Xo(t,"Delete",{})||i&&Xo(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),as(e,ue$2,false)):as(e,Pe$2,t);else if(function(t){return Xo(t,"Backspace",Zo)}(t))t.preventDefault(),as(e,pe$2,true);else if(function(t){return Xo(t,"Delete",Zo)}(t))t.preventDefault(),as(e,pe$2,false);else if(function(t){return i&&Xo(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),as(e,ye$1,true);else if(function(t){return i&&(Xo(t,"Delete",{metaKey:true})||Xo(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),as(e,ye$1,false);else if(function(t){return Xo(t,"b",Qo)}(t))t.preventDefault(),as(e,me$2,"bold");else if(function(t){return Xo(t,"u",Qo)}(t))t.preventDefault(),as(e,me$2,"underline");else if(function(t){return Xo(t,"i",Qo)}(t))t.preventDefault(),as(e,me$2,"italic");else if(function(t){return Xo(t,"Tab",{shiftKey:"any"})}(t))as(e,De$2,t);else if(function(t){return Xo(t,"z",Qo)}(t))t.preventDefault(),as(e,xe$1,void 0);else if(function(t){if(i)return Xo(t,"z",{metaKey:true,shiftKey:true});return Xo(t,"y",{ctrlKey:true})||Xo(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),as(e,Ce$1,void 0);else {const n=e._editorState._selection;null===n||wr(n)?es(t)&&(t.preventDefault(),as(e,Ue$2,t)):!function(t){return Xo(t,"c",Qo)}(t)?!function(t){return Xo(t,"x",Qo)}(t)?es(t)&&(t.preventDefault(),as(e,Ue$2,t)):(t.preventDefault(),as(e,je$2,t)):(t.preventDefault(),as(e,Je$2,t));}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(Xe$2,t),true}function wn$1(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const En$1=new Map;function On$1(t){const e=Os(t.target);if(null===e)return;const n=yo(e.anchorNode);if(null===n)return;cn$1&&(cn$1=false,Ei(n,()=>{const r=Vr(),i=e.anchorNode;if(Ps(i)||vo(i)){Bo(Ur(r,e,n,t));}}));const r=jo(n),i=r[r.length-1],o=i._key,s=En$1.get(o),l=s||i;l!==n&&yn$1(e,l,false),yn$1(e,n,true),n!==i?En$1.set(o,n):s&&En$1.delete(o);}function Mn$1(t){t._lexicalHandled=true;}function An$1(t){return true===t._lexicalHandled}function Dn(e){const n=on$1.get(e);if(void 0===n)return void 0;const r=sn$1.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),on$1.delete(e),sn$1.set(n,i),0===i&&n.removeEventListener("selectionchange",On$1);const o=mo(e);po(o)?(!function(t){if(null!==t._parentEditor){const e=jo(t),n=e[e.length-1]._key;En$1.get(n)===t&&En$1.delete(n);}else En$1.delete(t._key);}(o),e.__lexicalEditor=null):o&&t(198);const s=wn$1(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[];}function Fn$1(t,e,n){di();const r=t.__key,i=t.getParent();if(null===i)return;const o=function(t){const e=$r();if(!wr(e)||!Pi(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();ps(i,t)&&n.set(t.__key,0,"element");ps(o,t)&&r.set(t.__key,0,"element");return e}(t);let s=false;if(wr(o)&&e){const e=o.anchor,n=o.focus;e.key===r&&(Hr(e,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true),n.key===r&&(Hr(n,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true);}else Or(o)&&e&&t.isSelected()&&t.selectPrevious();if(wr(o)&&e&&!s){const e=t.getIndexWithinParent();Eo(t),Yr(o,i,e,-1);}else Eo(t);n||Ss(i)||i.canBeEmpty()||!i.isEmpty()||Fn$1(i,e),e&&o&&Ki(i)&&i.isEmpty()&&i.selectEnd();}function Ln(t){return t}const In=Symbol.for("ephemeral");function Kn$1(t){return t[In]||false}class zn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=qs(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name);}$config(){return {}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this));}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode());}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:true,enumerable:false,value:void 0,writable:true}),wo(this,t);}getType(){return this.__type}isInline(){t(137,this.constructor.name);}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return true;const e=Po(t);if(null===e)break;t=e.__parent;}return false}isSelected(t){const e=t||$r();if(null==e)return false;const n=e.getNodes().some(t=>t.__key===this.__key);if(yr(this))return n;if(wr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(Li(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:Po(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(Ss(n))return Pi(e)||e===this&&Li(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Po(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Po(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Pi(this)?this:this.getParent(),n=Pi(t)?t:t.getParent(),r=e&&n?Ml(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ml(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===wl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=Ml(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=Pi(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);o=u;}return n||r.reverse(),r}isDirty(){const t=_i()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(Kn$1(this))return this;const e=Po(this.__key);return null===e&&t(113),e}getWritable(){if(Kn$1(this))return this;di();const t=gi(),e=_i(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=$r();if(null!==s&&s.setCachedNodes(null),o.has(r))return Oo(i),i;const l=Js(i);return o.add(r),Oo(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of ft$2(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return (n.__state||i)&&ut$1(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){Fn$1(this,true,t);}replace(e,n){di();let r=$r();null!==r&&(r=r.clone()),Ts(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;Eo(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(Fn$1(i,false,true),null===u)c.__first=s;else {u.getWritable().__next=s;}if(l.__prev=d,null===f)c.__last=s;else {f.getWritable().__prev=s;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Pi(this)&&Pi(l)||t(139),this.getChildren().forEach(t=>{l.append(t);})),wr(r)){Bo(r);const t=r.anchor,e=r.focus;t.key===o&&Nr(t,l),e.key===o&&Nr(e,l);}return Ao()===o&&Mo(s),l}insertAfter(t,e=true){di(),Ts(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=$r();let s=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(Eo(r),wr(o)){const t=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&wr(o)){const t=this.getIndexWithinParent();Yr(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){di(),Ts(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;Eo(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===o)s.__first=i;else {o.getWritable().__next=i;}s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=$r();if(e&&wr(a)){Yr(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Vi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){di();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Pi(n))return n.select();if(!yr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){di();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Pi(n))return n.select(0,0);if(!yr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}const Rn$1="historic",Bn="history-push",Wn="history-merge",Jn="paste",jn="collaboration",$n$1="skip-scroll-into-view",Vn="skip-dom-selection",Yn="skip-selection-focus",qn="composition-start",Hn="composition-end";class Gn extends zn{static getType(){return "linebreak"}static clone(t){return new Gn(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&Is(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&tr(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&tr(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&Is(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&tr(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&tr(r))return true}return false}(t)?null:{conversion:Xn,priority:0}}}static importJSON(t){return Qn().updateFromJSON(t)}}function Xn(t){return {node:Qn()}}function Qn(){return ks(new Gn)}function Zn(t){return t instanceof Gn}function tr(t){return vo(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function er(t,e){return 16&e?"code":e&k$3?"mark":32&e?"sub":64&e?"sup":null}function nr(t,e){return 1&e?"strong":2&e?"em":"span"}function rr(t,e,n,r,i){const o=r.classList;let s=rs(i,"base");void 0!==s&&o.add(...s),s=rs(i,"underlineStrikethrough");let l=false;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=true,c||o.add(...s)):c&&o.remove(...s));for(const t in z$6){const r=z$6[t];if(s=rs(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s);}else e&r&&o.remove(...s);}}function ir(t,e,n){const r=e.firstChild,i=n.isComposing(),s=t+(i?A$2:"");if(null==r)e.textContent=s;else {const t=r.nodeValue;if(t!==s)if(i||o$1){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;o+i<n&&o+i<r&&t[n-o-1]===e[r-o-1];)o++;return [i,n-i-o,e.slice(i,r-o)]}(t,s);0!==n&&r.deleteData(e,n),r.insertData(e,i);}else r.nodeValue=s;}}function or(t,e,n,r,i,o){ir(i,t,e);const s=o.theme.text;void 0!==s&&rr(0,0,r,t,s);}function sr(t,e){const n=document.createElement(e);return n.appendChild(t),n}class lr extends zn{__text;__format;__style;__mode;__detail;static getType(){return "text"}static clone(t){return new lr(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail;}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0;}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return j$6[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Ao()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return !!(1&this.getLatest().__detail)}isUnmergeable(){return !!(2&this.getLatest().__detail)}hasFormat(t){const e=z$6[t];return 0!==(this.getFormat()&e)}isSimpleText(){return "text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return No(this.getLatest().__format,t,e)}canHaveFormat(){return true}isInline(){return true}createDOM(t,e){const n=this.__format,r=er(0,n),i=nr(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l));or(l,this,0,n,this.__text,t);const c=this.__style;return ""!==c&&(s.style.cssText=c),s}updateDOM(e,n,r){const i=this.__text,o=e.__format,s=this.__format,l=er(0,o),c=er(0,s),a=nr(0,o),u=nr(0,s);if((null===l?a:l)!==(null===c?u:c))return true;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const o=document.createElement(u);return or(o,this,0,s,i,r),n.replaceChild(o,e),false}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),ir(i,f,this);const d=r.theme.text;void 0!==d&&o!==s&&rr(0,o,s,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),false}static importDOM(){return {"#text":()=>({conversion:dr,priority:0}),b:()=>({conversion:ar,priority:0}),code:()=>({conversion:_r,priority:0}),em:()=>({conversion:_r,priority:0}),i:()=>({conversion:_r,priority:0}),mark:()=>({conversion:_r,priority:0}),s:()=>({conversion:_r,priority:0}),span:()=>({conversion:cr,priority:0}),strong:()=>({conversion:_r,priority:0}),sub:()=>({conversion:_r,priority:0}),sup:()=>({conversion:_r,priority:0}),u:()=>({conversion:_r,priority:0})}}static importJSON(t){return pr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Ps(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=sr(n,"b")),this.hasFormat("italic")&&(n=sr(n,"i")),this.hasFormat("strikethrough")&&(n=sr(n,"s")),this.hasFormat("underline")&&(n=sr(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?z$6[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?R$4[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=No(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=J$3[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){di();let n=t,r=e;const i=$r(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!wr(i))return Br(s,n,s,r,"text","text");{const t=Ao();t!==i.anchor.key&&t!==i.focus.key||Mo(s),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=$r();if(r&&wr(c)){const e=t+s;c.setTextNodeRange(i,e,i,e);}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){di();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=Ao(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;e<o&&r<=l;r++){const i=t[r];i>e&&(s.push(n.slice(e,i)),e=i);}const c=s.length;if(1===c)return [e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=$r();if(wr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=pr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=pt$4(e,f),_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=pr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=pt$4(e,n);const o=n.__key;i===r&&Mo(o),x.push(n);}const C=p?p.offset:null,S=y?y.offset:null;let v=0;for(const t of x){if(!p&&!y)break;const e=v+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=v&&(p.set(t.getKey(),C-v,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&Oo(e);null!==n&&Oo(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),wr(m)&&Yr(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;Ao()===i&&Mo(r);const l=$r();if(wr(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Gr(t,n,r,e,s),null!==o&&o.key===i&&Gr(o,n,r,e,s);}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function cr(t){return {forChild:mr(t.style),node:null}}function ar(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:mr(e.style,n?void 0:"bold"),node:null}}const ur=new WeakMap;function fr(t){if(!Ps(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function dr(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=ur.get(n))&&!fr(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)ur.set(r[t],i);return i}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(Qn()):"\t"===n?e.push(Cr()):""!==n&&e.push(pr(n));}return {node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return {node:null};if(" "===r[0]){let t=n,e=true;for(;null!==t&&null!==(t=hr(t,false));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=hr(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:pr(r)}}function hr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,Ps(n)){const t=n.style.display;if(""===t&&!Ls(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(vo(n))return n;if("BR"===n.nodeName)return null}}const gr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function _r(t){const e=gr[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:mr(t.style,e),node:null}}function pr(t=""){return ks(new lr(t))}function yr(t){return t instanceof lr}function mr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>yr(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class xr extends lr{static getType(){return "tab"}static clone(t){return new xr(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=rs(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return Cr().updateFromJSON(t)}setTextContent(t){return "\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function Cr(){return ks(new xr)}function Sr(t){return t instanceof xr}class vr{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return bl(Bl(Al(this,"next")),Bl(Al(t,"next")))<0}getNode(){const e=Po(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,o=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,fi()||(Ao()===o&&Mo(t),null!==i&&(i.setCachedNodes(null),i.dirty=true)));}}function kr(t,e,n){return new vr(t,e,n)}function Tr(t,e){let n=e.__key,r=t.offset,i="element";if(yr(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t);}else if(!Pi(e)){const t=e.getNextSibling();if(yr(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function Nr(t,e){if(Pi(e)){const n=e.getLastDescendant();Pi(n)||yr(n)?Tr(t,n):Tr(t,e);}else Tr(t,e);}class br{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!Or(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new br(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(yr(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove();}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Po(t);null!==e&&n.push(e);}return fi()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if(($r()||Vr())===this&&t[0]){const e=dl(t[0],"next");Dl(Tl(e,e));}for(const e of t)e.remove();}}function wr(t){return t instanceof Er}class Er{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){return !!wr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,o=new Set;for(const n of t)if(cl(n)){const{origin:t}=n;0===e.length?i.add(t):(o.add(t),e.push(t));}else {const{origin:t}=n;Pi(t)&&o.has(t)||e.push(t);}r&&e.push(r.caret.origin);if(ll(t.focus)&&Pi(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=pl(t.focus.origin,"previous");cl(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=ml(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!Pi(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=Bl(t.anchor),r=Bl(t.anchor.getFlipped()),i=t=>ol(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o);}return e}(jl(Ll(this),"next"));return fi()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=Ar(this);let c="",a=true;for(let u=0;u<t.length;u++){const f=t[u];if(Pi(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=false,yr(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=o?t.slice(s):t.slice(l):f===n&&(t=o?t.slice(0,l):t.slice(0,s)),c+=t;}else !Li(f)&&!Zn(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent());}return c}applyDOMRange(t){const e=_i(),n=e.getEditorState()._selection,r=zr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,true),this.focus.set(o.key,o.offset,o.type,true),Ct$3(this);}clone(){const t=this.anchor,e=this.focus;return new Er(kr(t.key,t.offset,t.type),kr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=No(this.format,t,null),this.dirty=true;}setFormat(t){this.format=t,this.dirty=true;}setStyle(t){this.style=t,this.dirty=true;}hasFormat(t){const e=z$6[t];return 0!==(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(Qn()):"\t"===r?n.push(Cr()):n.push(pr(r));}this.insertNodes(n);}insertText(e){const n=this.anchor,r=this.focus,i=this.format,o=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const i=t.getNode(),o=i.getChildAtIndex(t.offset),s=pr();if(s.setFormat(n),s.setStyle(r),Yi(o))o.splice(0,0,[s]);else {const t=Ki(i)?Vi().append(s):s;null===o?i.append(t):o.insertBefore(t);}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text");}(s,l,i,o),"element"===l.type&&Pl(l,Bl(Al(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];yr(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(So(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(yr(t)&&t.canInsertTextBefore()&&!So(t)||(t=pr(),t.setFormat(i),t.setStyle(o),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(So(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(yr(t)&&!So(t)||(t=pr(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=pr(d.getTextContent());t.setFormat(i),d.replace(t),d=t;}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Pi(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Kr(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(Co(d)){const t=pr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===o){if(Sr(d)){const t=pr(e);return t.setFormat(i),t.setStyle(o),t.select(),void d.replace(t)}}else {if(""!==d.getTextContent()){const t=pr(e);if(t.setFormat(i),t.setStyle(o),t.select(),0===c)d.insertBefore(t,false);else {const[e]=d.splitText(c);e.insertAfter(t,false);}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(i),d.setStyle(o);}const r=a-c;d=d.spliceText(c,r,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length));}else {const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=Pi(d)?d:d.getParentOrThrow();let r=Pi(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow();}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(yr(_)&&!Co(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=pr(_.getTextContent());_.replace(t),_=t;}Ki(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key);}else {const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove();}else t.add(_.__key);const o=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=o.length-1;t>=0;t--){const e=o[t];if(e.is(d)||Pi(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(Co(d))if(c===h)d.select();else {const t=pr(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove();}}}removeText(){const t=$r()===this;Fl(this,Rl(Ll(this))),t&&$r()!==this&&Bo(this);}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Mo(null);const n=this.getNodes(),r=[];for(const t of n)yr(t)&&r.push(t);const i=e=>{n.forEach(n=>{if(Pi(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}});},o=r.length;if(0===o)return this.toggleFormat(t),Mo(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(So(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||So(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||So(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=$r();return wr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Gs(n,Ks),i=e[e.length-1];if(Pi(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=ni(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some(t=>(Pi(t)||Li(t))&&!t.isInline())){Pi(r)||t(211,n.constructor.name,n.getType());const o=ni(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Vi();let n=null;for(let r=0;r<t.length;r++){const i=t[r],o=Zn(i);if(o||Li(i)&&i.isInline()||Pi(i)&&i.isInline()||yr(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),o))continue;null!==n&&n.append(i);}else e.append(i),n=null;}return e}(e),s=o.getLastDescendant(),l=o.getChildren(),c=!Pi(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;Pi(f=u)&&Ks(f)&&!f.isEmpty()&&Pi(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Pi(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n){const r=n.getParentOrThrow().getLastChild();let i=n;const o=[n];for(;i!==r;)i.getNextSibling()||t(140),i=i.getNextSibling(),o.push(i);let s=e;for(const t of o)s=s.insertAfter(t);}(r,u));const d=Gs(s,Ks);c&&Pi(d)&&(c.canMergeWhenEmpty()||Ks(a))&&(d.append(...c.getChildren()),c.remove()),Pi(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=Pi(r)?r.getLastChild():null;Zn(h)&&d!==r&&h.remove();}insertParagraph(){if("root"===this.anchor.key){const t=Vi();return zo().splice(this.anchor.offset,0,[t]),t.select(),t}const e=ni(this),n=Gs(this.anchor.getNode(),Ks);Pi(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=n.insertNewAfter(this,false);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(t){const e=Qn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n);}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[i,o]=Ar(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[o,i]:[i,o];if(0===e)return [];if(1===e){if(yr(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return [n]}if(yr(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),yr(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"));}return t}modify(t,e,n){if(ii(this,t,e,n))return;const r="move"===t,i=_i(),o=Es(ms(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===s||!Pi(c)||c.isInline()||c.canBeEmpty()||ws(s,i,l),this.dirty){let t=us(i,this.anchor.key),e=us(i,this.focus.key);"text"===this.anchor.type&&(t=To(t)),"text"===this.focus.type&&(e=To(e)),t&&e&&Xr(o,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(o,t,e?"backward":"forward",n),o.rangeCount>0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=Ki(n)?n:Cs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let s=false;for(let t=0;t<n.length;t++){const e=n[t];ps(e,i)?r.push(e):s=true;}if(s&&r.length>0)if(e){const t=r[0];Pi(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];Pi(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,o,true);}(this);}}"lineboundary"===n&&ii(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Pi(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Pi(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=vl(Al(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(cl(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Pi(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Bl(e);Fl(this,Tl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(ll(e)){if(Pi(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(Li(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Pi(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=Jr();t.add(e.origin.getKey()),Bo(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return Fl(this,Tl(!e.origin.isEmpty()&&n.isEmpty()?Il(dl(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&Pr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void Fr(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void Fr(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t<o,l=s?t:o,c=s?o:t,a=c-1;if(l!==a){(function(t){return !(Jo(t)||Dr(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type));}}}(this,t);}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&Ki(t.getParent())&&null===t.getPreviousSibling()&&Pr(this,t);}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText();}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word");}this.isCollapsed()?this.deleteCharacter(t):this.removeText();}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return [this.anchor,this.focus]}}function Or(t){return t instanceof br}function Mr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function Ar(t){const e=t.getStartEndPoints();if(null===e)return [0,0];const[n,r]=e;return "element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Mr(n),Mr(r)]}function Pr(t,e){for(let n=e;n;n=n.getParent()){if(Pi(n)){if(n.collapseAtStart(t))return true;if(Ss(n))break}if(n.getPreviousSibling())break}return false}const Dr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return ()=>false})();function Fr(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;t<o;t++){const r=t===o-1;if(l=s,s+=i[t].length,e&&s===n||s>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function Lr(e,n,r,i){let o,s=n;if(Ps(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;s===a&&(l=true,s=a-1);let f=c[s],d=false;if(f===u)f=c[s+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--;}}if(o=Wo(f),yr(o))s=gl(o,l?"next":"previous");else {let c=Wo(e);if(null===c)return null;if(Pi(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Pi(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Pi(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Pi(f)?f:f.getParentOrThrow()),s=0;}yr(f)?(o=f,c=null,s=gl(f,l?"next":"previous")):f!==c&&l&&!d&&(Pi(c)||t(216),s=Math.min(c.getChildrenSize(),s+1));}else {const t=c.getIndexWithinParent();s=0===n&&Li(c)&&Wo(e)===c?t:t+1,c=c.getParentOrThrow();}if(Pi(c))return kr(c.__key,s,"element")}}else o=Wo(e);return yr(o)?kr(o.__key,gl(o,s,"clamp"),"text"):null}function Ir(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&Pi(o)&&o.isInline()){const e=o.getPreviousSibling();yr(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else Pi(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):yr(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&Pi(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Pi(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();yr(e)&&t.set(e.__key,0,"text");}}}function Kr(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);Ir(t,n,r),Ir(e,!n,r),r&&e.set(t.key,t.offset,t.type);}}function zr(t,e,n,r,i,o){if(null===t||null===n||!_o(i,t,n))return null;const s=Lr(t,e,wr(o)?o.anchor:null,i);if(null===s)return null;const l=Lr(n,r,wr(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Wo(t),r=Wo(n);if(Li(e)&&Li(r))return null}return Kr(s,l),[s,l]}function Rr(t){return Pi(t)&&!t.isInline()}function Br(t,e,n,r,i,o){const s=gi(),l=new Er(kr(t,e,i),kr(n,r,o),0,"");return l.dirty=true,s._selection=l,l}function Wr(){const t=kr("root",0,"element"),e=kr("root",0,"element");return new Er(t,e,0,"")}function Jr(){return new br(new Set)}function jr(t,e){return Ur(null,t,e,null)}function Ur(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!Y$4&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(wr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&wr(t)&&!_o(n,a,u))return t.clone();const h=zr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;let p=0,y="";if(wr(t)){const e=t.anchor;if(g.key===e.key)p=t.format,y=t.style;else {const t=g.getNode();yr(t)?(p=t.getFormat(),y=t.getStyle()):Pi(t)&&(p=t.getTextFormat(),y=t.getTextStyle());}}return new Er(g,_,p,y)}function $r(){return gi()._selection}function Vr(){return _i()._editorState._selection}function Yr(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),o.set(c,n,"element"),qr(t);}}else {const s=t.isBackward(),l=s?o:i,a=l.getNode(),u=s?i:o,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element");}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element");}}qr(t);}function qr(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!Pi(o))return;const t=o.getChildrenSize(),i=n>=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(yr(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text");}return}if(Pi(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(yr(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(Pi(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(yr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}function Hr(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,yr(r)?(s=r.getTextContentSize(),l="text"):Pi(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,yr(i)?l="text":Pi(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"));}function Gr(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Xr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Qr(t,e,n){const r=us(t,e.getKey());if(Pi(e)){const t=e.getDOMSlot(r);return [t.element,n+t.getFirstChildOffset()]}return [r,n]}function Zr(t,e,n,r,i,s,l){const c=r.anchorNode,a=r.focusNode,u=r.anchorOffset,f=r.focusOffset,d=document.activeElement;if(i.has(jn)&&d!==s||null!==d&&go(d))return;if(!wr(e))return void(null!==t&&_o(n,c,a)&&r.removeAllRanges());const h=e.anchor,g=e.focus,_=h.getNode(),p=g.getNode(),[y,m]=Qr(n,_,h.offset),[x,C]=Qr(n,p,g.offset),S=e.format,v=e.style,k=e.isCollapsed();let T=y,N=x,b=false;var w,E,O,M,A;if(("text"===h.type?(T=To(y),b=_.getFormat()!==S||_.getStyle()!==v):wr(t)&&"text"===t.anchor.type&&(b=true),"text"===g.type&&(N=To(x)),null!==T&&null!==N)&&(k&&(null===t||b||wr(t)&&(t.format!==S||t.style!==v))&&(w=S,E=v,O=m,M=h.key,A=performance.now(),gn$1=[w,E,O,M,A]),u!==m||f!==C||c!==T||a!==N||"Range"===r.type&&k||(null!==d&&s.contains(d)||i.has(Yn)||s.focus({preventScroll:true}),"element"===h.type))){if(Xr(r,T,m,N,C),!o$1||!e.isCollapsed()||null===s||i.has(Yn)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:true}),!i.has($n$1)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=wr(e)&&"element"===e.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=ds(n),i=ys(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e){l=0,c=ms(t).innerHeight;const e=i.getComputedStyle(r.documentElement),n=parseFloat(e.scrollPaddingTop),o=parseFloat(e.scrollPaddingBottom);isFinite(n)&&(l+=n),isFinite(o)&&(c-=o);}else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(o<l?n=-(l-o):s>c&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e;}if(e)break;a=fs(a);}}(n,e,s);}}ln$1=true;}}function ti(t){let e=$r()||Vr();null===e&&(e=zo().selectEnd()),e.insertNodes(t);}function ni(e){let n=e;e.isCollapsed()||n.removeText();const r=$r();wr(r)&&(n=r),wr(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!Ks(o);){const t=o;if([o,s]=ri(o,s),t.is(o))break}return s}function ri(t,e){const n=t.getParent();if(!n){const t=Vi();return zo().append(t),t.select(),[zo(),0]}if(yr(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!Pi(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new Er(kr(t.__key,e,"element"),kr(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function ii(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const o=Al(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!Wl(c)){for(const t of c){a=false;const{origin:e}=t;if(!Li(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of vl(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(cl(t))t.origin.isInline()||(c=t);else {if(Pi(t.origin))continue;Li(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===o)return false;if(l&&!s&&Li(c.origin)&&c.origin.isKeyboardSelectable()){const t=Jr();return t.add(c.origin.getKey()),Bo(t),true}return c=Bl(c),l&&Pl(t.anchor,c),Pl(t.focus,c),a||!s}let oi=null,si=null,li=false,ci=false,ai=0;const ui={characterData:true,childList:true,subtree:true};function fi(){return li||null!==oi&&oi._readOnly}function di(){li&&t(13);}function hi(){ai>99&&t(14);}function gi(){return null===oi&&t(195,pi()),oi}function _i(){return null===si&&t(196,pi()),si}function pi(){let t=0;const e=new Set,n=io.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=mo(r);if(po(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function yi(){return si}function mi(t,e,n){const r=e.__type,i=ao(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t<s&&(o[t](e),e.isAttached());t++);}function xi(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Ci(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t);}function Si(t){return vi(t,_i()._nodes)}function vi(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const o=i.klass;e.type!==o.getType()&&t(18,o.name);const s=o.importJSON(e),l=e.children;if(Pi(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=vi(l[t],n);s.append(e);}return s}function ki(t,e,n){const r=oi,i=li,o=si;oi=e,li=true,si=t;try{return n()}finally{oi=r,li=i,si=o;}}function Ti(t,e){const n=t._pendingEditorState,r=t._rootElement,i=t._headless||null===r;if(null===n)return;const o=t._editorState,s=o._selection,l=n._selection,c=0!==t._dirtyType,a=oi,u=li,f=si,d=t._updating,h=t._observer;let g=null;if(t._pendingEditorState=null,t._editorState=n,!i&&c&&null!==h){si=t,oi=n,li=false,t._updating=true;try{const e=t._dirtyType,r=t._dirtyElements,i=t._dirtyLeaves;h.disconnect(),g=te$5(o,n,t,e,r,i);}catch(e){if(e instanceof Error&&t._onError(e),ci)throw e;return Zi(t,null,r,n),nt$1(t),t._dirtyType=2,ci=true,Ti(t,o),void(ci=false)}finally{h.observe(r,ui),t._updating=d,oi=a,li=u,si=f;}}n._readOnly||(n._readOnly=true);const _=t._dirtyLeaves,p=t._dirtyElements,y=t._normalizedNodes,m=t._updateTags,x=t._deferred;c&&(t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=Io(t)),delete r[o]);}(t,n);const C=i?null:Es(ms(t));if(t._editable&&null!==C&&(c||null===l||l.dirty||!l.is(s))&&null!==r&&!m.has(Vn)){si=t,oi=n;try{if(null!==h&&h.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&ws(e,t,r),Zr(s,l,t,C,m,r);}!function(t,e,n){let r=t._blockCursorElement;if(wr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,c=null;if(s===o.getChildrenSize()){bs(o.getChildAtIndex(s-1))&&(l=!0);}else {const e=o.getChildAtIndex(s);if(null!==e&&bs(e)){const n=e.getPreviousSibling();(null===n||bs(n))&&(l=!0,c=t.getElementByKey(e.__key));}}if(l){const n=t.getElementByKey(o.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=tc(r);r=e.blockCursor=t;}void 0!==r&&n.classList.add(...r);}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&ws(r,t,e);}(t,r,l);}finally{null!==h&&h.observe(r,ui),si=f,oi=a;}}null!==g&&function(t,e,n,r,i){const o=Array.from(t._listeners.mutation),s=o.length;for(let t=0;t<s;t++){const[s,l]=o[t];for(const t of l){const o=e.get(t);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n});}}}(t,g,m,_,o),wr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(re$3,void 0);const S=t._pendingDecorators;null!==S&&(t._decorators=S,t._pendingDecorators=null,Ni("decorator",t,true,S)),function(t,e,n){const r=Ko(e),i=Ko(n);r!==i&&Ni("textcontent",t,true,i);}(t,e||o,n),Ni("update",t,true,{dirtyElements:p,dirtyLeaves:_,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:e||o,tags:m}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=true;try{for(let t=0;t<e.length;t++)e[t]();}finally{t._updating=n;}}}(t,x),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;wi(t,e,r);}}}(t);}function Ni(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=e._listeners[t],i=Array.from(n);for(const[t,e]of i){e&&e();const i=t(...r);n.has(t)?n.set(t,i):i&&i();}}finally{e._updating=i;}}function bi(e,n){const r=e._updates;let i=n||false;for(;0!==r.length;){const n=r.shift();if(n){const[r,o]=n,s=e._pendingEditorState;let l;void 0!==o&&(l=o.onUpdate,o.skipTransforms&&(i=true),o.discrete&&(null===s&&t(191),s._flushSync=true),l&&e._deferred.push(l),Ci(e,o.tag)),null==s?wi(e,r,o):r();}}return i}function wi(e,n,r){const i=e._updateTags;let o,s=false,l=false;void 0!==r&&(o=r.onUpdate,Ci(e,r.tag),s=r.skipTransforms||false,l=r.discrete||false),o&&e._deferred.push(o);const c=e._editorState;let a=e._pendingEditorState,u=false;(null===a||a._readOnly)&&(a=e._pendingEditorState=zi(a||c),u=true),a._flushSync=l;const f=oi,d=li,h=si,g=e._updating;oi=a,li=false,e._updating=true,si=e;const _=e._headless||null===e.getRootElement();so(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=Es(ms(t));return wr(n)||null==n?Ur(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),s=bi(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(wr(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r);}}}(a,e),0!==e._dirtyType&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);yr(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&xt$3(e);}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,o=Ao(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);yr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&xt$3(r),void 0!==r&&xi(r,o)&&mi(e,r,s),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){ai++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&xi(c,o)&&mi(e,c,s);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,ai++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),bi(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(Pi(e)&&V$6(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)));}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(wr(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else Or(o)&&0===o._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ti(e)}finally{oi=f,li=d,si=h,e._updating=g,ai=0;}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,Ti(e)):u&&fo(()=>{Ti(e);}):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function Ei(t,e,n){si===t&&void 0===n?e():wi(t,e,n);}class Oi{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new Oi(this.element,t,this.after)}withAfter(t){return new Oi(this.element,this.before,t)}withElement(t){return this.element===t?this:new Oi(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(d$1||c||l);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=Mi(e,n);i.push(r);const o=Mi(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<o.length;t++){const e=i[t],n=o[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return [t.getParentOrThrow(),s]}}function Mi(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class Ai extends zn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return W$5[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=_i()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(yr(e)&&t.push(e),Pi(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Pi(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;Pi(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Pi(t)&&t.getLastDescendant()||t||null}const r=e[t];return Pi(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Po(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Po(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++;}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),Pi(i)&&r!==n-1&&!i.isInline()&&(t+=P$3);}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),Pi(i)&&r!==n-1&&!i.isInline()&&(t+=2);}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=B$3[t];return 0!==(this.getFormat()&e)}return false}hasTextFormat(t){const e=z$6[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return No(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){di();const n=$r();let r=t,i=e;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(yr(t)||Pi(t))return t.select(0,0)}else if(!(void 0!==t&&t!==o||void 0!==e&&e!==o)){const t=this.getLastChild();if(yr(t)||Pi(t))return t.select()} void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return wr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=true,n):Br(s,r,s,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(t=>t.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?B$3[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){Kn$1(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling());}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;Eo(e.getWritable()),c.push(r),e=n;}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,Eo(n);const r=e.__key;if(null===d)o.__first=r,n.__prev=null;else {const t=d.getWritable();t.__next=r,n.__prev=t.__key;}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e;}if(e+n===i){if(null!==d){d.getWritable().__next=null,o.__last=d.__key;}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key;}else t.__prev=null;}if(o.__size=f,c.length){const t=$r();if(wr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:i}=t;Di(r,e,n)&&Hr(r,r.getNode(),this,u,a),Di(i,e,n)&&Hr(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||Ss(this)||this.remove();}}return o}getDOMSlot(t){return new Oi(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ps(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0===e&&""===n||Ss(this)||this.getChildren().some(yr)||(0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function Pi(t){return t instanceof Ai}function Di(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class Fi extends zn{decorate(t,e){return null}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function Li(t){return t instanceof Fi}class Ii extends Ai{__cachedText;static getType(){return "root"}static clone(){return new Ii}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !fi()&&0!==_i()._dirtyType||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)Pi(e)||Li(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return zo().updateFromJSON(t)}collapseAtStart(){return true}}function Ki(t){return t instanceof Ii}function zi(t){return new Ji(new Map(t._nodeMap))}function Ri(){return new Ji(new Map([["root",new Ii]]))}function Bi(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Pi(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t<o.length;t++){const e=Bi(o[t]);i.push(e);}}return n}function Wi(t){return t instanceof Ji}class Ji{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=false,this._readOnly=false;}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return ki(e&&e.editor||null,this,t)}clone(t){const e=new Ji(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=true,e}toJSON(){return ki(null,this,()=>({root:Bi(zo())}))}}class ji extends Ai{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Ui extends Ai{static getType(){return "paragraph"}static clone(t){return new Ui(t.__key)}createDOM(t){const e=document.createElement("p"),n=rs(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:$i,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Ps(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Vi().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(yr);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle());}return t}insertNewAfter(t,e){const n=Vi();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||yr(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function $i(t){const e=Vi();if(t.style&&(e.setFormat(t.style.textAlign),Us(t,e)),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in B$3&&e.setFormat(n);}return {node:e}}function Vi(){return ks(new Ui)}function Yi(t){return t instanceof Ui}const qi=0,Hi=1,Gi=2,Xi=3,Qi=4;function Zi(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=Ri(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const o=t._observer;null!==o&&(o.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function to(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=qs(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t);}if(t){const n=t.$transform;n&&e.add(n),r=t.extends;}else {const t=Object.getPrototypeOf(r);r=t.prototype instanceof zn&&t!==zn?t:void 0;}}return e}function eo(t){const e=t||{},n=yi(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||false,s=Ri(),l=e.namespace||(null!==i?i._config.namespace:Uo()),c=e.editorState,a=[Ii,lr,Gn,xr,Ui,ji,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null;}qs(e);const i=e.getType(),o=to(e);h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:ct$1(a[t]),transforms:o});}}const g=new io(s,i,h,{disableEvents:o,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);});};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),function(t){t.registerCommand(se$4,Sn$1,qi),t.registerCommand(le$4,vn$1,qi),t.registerCommand(ce$4,kn,qi),t.registerCommand(ae$3,Tn$1,qi),t.registerCommand(Se$1,bn$1,qi);}(g),g}function no(t,e){const n=t.get(e);t.delete(e),n&&n();}function ro(t,e,n){return t.set(e,n),no.bind(null,t,e)}class io{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Uo(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){return ro(this._listeners.update,t)}registerEditableListener(t){return ro(this._listeners.editable,t)}registerDecoratorListener(t){return ro(this._listeners.decorator,t)}registerTextContentListener(t){return ro(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return rc(ro(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0);}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=i.get(e);void 0===o&&t(36,String(e));const s=o[r];return s.add(n),()=>{s.delete(n),o.every(t=>0===t.size)&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Ws(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=Ws(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=Po(e);t&&t.markDirty();}},null===t._pendingEditorState?{tag:Wn}:void 0);}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return as(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=rs(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Zi(this,e,t,r),null!==e&&(this._config.disableEvents||Dn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=ys(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,nt$1(this),this._updateTags.add(Wn),Ti(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;on$1.set(t,n);const r=sn$1.get(n)??0;r<1&&n.addEventListener("selectionchange",On$1),sn$1.set(n,r+1),t.__lexicalEditor=e;const i=wn$1(t);for(let n=0;n<Ze$1.length;n++){const[r,o]=Ze$1[n],s="function"==typeof o?t=>{An$1(t)||(Mn$1(t),(e.isEditable()||"click"===r)&&o(t,e));}:t=>{if(An$1(t))return;Mn$1(t);const n=e.isEditable();switch(r){case "cut":return n&&as(e,je$2,t);case "copy":return as(e,Je$2,t);case "paste":return n&&as(e,ge$3,t);case "dragstart":return n&&as(e,Re$1,t);case "dragover":return n&&as(e,Be$2,t);case "dragend":return n&&as(e,We$2,t);case "focus":return n&&as(e,He$2,t);case "blur":return n&&as(e,Ge$1,t);case "drop":return n&&as(e,Ke$2,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s);});}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Wn),Ti(this);Ni("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=zi(e),r._selection=e._selection?e._selection.clone():null),et$2(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),Ti(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",false),this._compositionKey=null,null!=s&&o.add(s),this._updating||Ti(this);}parseEditorState(t,e){return function(t,e,n){const r=Ri(),i=oi,o=li,s=si,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,oi=r,li=false,si=e,so(null);try{const i=e._nodes;vi(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,oi=i,li=o,si=s;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return Ti(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):wi(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ei(this,()=>{const r=$r(),i=zo();null!==r?r.dirty||Bo(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),gs("focus"),_s(()=>{n.removeAttribute("autocapitalize"),t&&t();});}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=Es(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ni("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}io.version="0.42.0+prod.esm";let oo=null;function so(t){oo=t;}let lo=1;function ao(e,n){const r=uo(e,n);return void 0===r&&t(30,n),r}function uo(t,e){return t._nodes.get(e)}const fo="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function ho(t){return Li(Lo(t))}function go(t){const e=document.activeElement;if(!Ps(e))return false;const n=e.nodeName;return Li(Lo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==mo(e))}function _o(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!go(e)&&yo(e)===t}catch(t){return false}}function po(t){return t instanceof io}function yo(t){let e=t;for(;null!=e;){const t=mo(e);if(po(t))return t;e=fs(e);}return null}function mo(t){return t?t.__lexicalEditor:null}function xo(t){return I$4.test(t)?"rtl":K$4.test(t)?"ltr":null}function Co(t){return Sr(t)||t.isToken()}function So(t){return Co(t)||t.isSegmented()}function vo(t){return Ds(t)&&3===t.nodeType}function ko(t){return Ds(t)&&9===t.nodeType}function To(t){let e=t;for(;null!=e;){if(vo(e))return e;e=e.firstChild;}return null}function No(t,e,n){const r=z$6[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function bo(t){return yr(t)||Zn(t)||Li(t)}function wo(t,e){const n=function(){const t=oo;return oo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);di(),hi();const r=_i(),i=gi(),o=""+lo++;i._nodeMap.set(o,t),Pi(t)?r._dirtyElements.set(o,true):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,t.__key=o;}function Eo(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function Oo(e){hi(),Kn$1(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=gi(),o=_i(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(r,s,l);const c=n.__key;o._dirtyType=1,Pi(e)?l.set(c,true):o._dirtyLeaves.add(c);}function Mo(t){di();const e=_i(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Po(n);null!==t&&t.getWritable();}if(null!==t){const e=Po(t);null!==e&&e.getWritable();}}}function Ao(){if(fi())return null;return _i()._compositionKey}function Po(t,e){const n=(e||gi())._nodeMap.get(t);return void 0===n?null:n}function Do(t,e){const n=Fo(t,_i());return void 0!==n?Po(n,e):null}function Fo(t,e){return t[`__lexicalKey_${e._key}`]}function Lo(t,e){let n=t;for(;null!=n;){const t=Do(n,e);if(null!==t)return t;n=fs(n);}return null}function Io(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Ko(t){return t.read(()=>zo().getTextContent())}function zo(){return Ro(gi())}function Ro(t){return t._nodeMap.get("root")}function Bo(t){di();const e=gi();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function Wo(t){const e=_i(),n=function(t,e){let n=t;for(;null!=n;){const t=Fo(n,e);if(void 0!==t)return t;n=fs(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?Po("root"):null}return Po(n)}function Jo(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function jo(t){const e=[];for(let n=t;null!==n;n=n._updating?null:n._parentEditor)e.push(n);return e}function Uo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function $o(t){return vo(t)?t.nodeValue:null}function Vo(t,e,n){const r=Es(ms(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=$o(i);const r=Lo(i);if(null!==e&&yr(r)){if((e===A$2||e===D$5)&&n){const t=n.length;e=n,o=t,s=t;}null!==e&&Yo(r,e,o,s,t);}}}function Yo(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let a=e;if((s||i)&&(e.endsWith(A$2)&&(a=e.slice(0,-A$2.length)),i)){const t=D$5;let e;for(;-1!==(e=a.indexOf(t));)a=a.slice(0,e)+a.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length));}const u=o.getTextContent();if(i||a!==u){if(""===a){if(Mo(null),l||c||d$1)o.remove();else {const t=_i();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove();});},20);}return}const e=o.getParent(),i=Vr(),u=o.getTextContentSize(),f=Ao(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||wr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=$r();if(!wr(g)||null===n||null===r)return void qo(o,a,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=pr(o.getTextContent());o.replace(t),o=t;}qo(o,a,g);}}}function qo(t,e,n){if(t.setTextContent(e),wr(n)){const e=t.getKey();for(const r of ["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===e&&(i.offset=gl(t,i.offset,"clamp"));}}}function Ho(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Go(t,e){return Ho(t,e,"altKey")&&Ho(t,e,"ctrlKey")&&Ho(t,e,"shiftKey")&&Ho(t,e,"metaKey")}function Xo(t,e,n){if(!Go(t,n))return false;if(t.key.toLowerCase()===e.toLowerCase())return true;if(e.length>1)return false;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return false;const r="Key"+e.toUpperCase();return t.code===r}const Qo={ctrlKey:!i,metaKey:i},Zo={altKey:i,ctrlKey:!i};function ts(t){return "Backspace"===t.key}function es(t){return Xo(t,"a",Qo)}function ns(t){const e=zo();if(wr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),Ct$3(t),t}{const t=e.select(0,e.getChildrenSize());return Bo(Ct$3(t)),t}}function rs(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=tc(i);return n[e]=t,t}return i}function is(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o);}function ss(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function ls(t,e){const n=t.offset;if("element"===t.type){return ss(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?ss(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function cs(t){const e=ms(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function as(t,e,n){return function(t,e,n){const r=jo(t);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o],l=s._commands.get(e);if(void 0!==l){const e=l[i];if(void 0!==e){const r=Array.from(e),i=r.length;let o=false;if(Ei(s,()=>{for(let e=0;e<i;e++)if(r[e](n,t))return void(o=true)}),o)return o}}}return false}(t,e,n)}function us(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function fs(t){const e=t.assignedSlot||t.parentElement;return Fs(e)?e.host:e}function ds(t){return ko(t)?t:Ps(t)?t.ownerDocument:null}function hs(t){return _i()._updateTags.has(t)}function gs(t){di();_i()._updateTags.add(t);}function _s(t){di();_i()._deferred.push(t);}function ps(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return true;n=n.getParent();}return false}function ys(t){const e=ds(t);return e?e.defaultView:null}function ms(e){const n=e._window;return null===n&&t(78),n}function xs(t){return Pi(t)&&t.isInline()||Li(t)&&t.isInline()}function Cs(t){let e=t.getParentOrThrow();for(;null!==e;){if(Ss(e))return e;e=e.getParentOrThrow();}return e}function Ss(t){return Ki(t)||Pi(t)&&t.isShadowRoot()}function vs(t,e=false){const n=t.constructor.clone(t);return wo(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function ks(e){const n=_i(),r=e.getType(),i=uo(n,r);void 0===i&&t(200,e.constructor.name,r);const{replace:o,replaceWithKlass:s}=i;if(null!==o){const n=o(e),i=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function Ts(e,n){!Ki(e.getParent())||Pi(n)||Li(n)||t(99);}function Ns(e){const n=Po(e);return null===n&&t(63,e),n}function bs(t){return (Li(t)||Pi(t)&&!t.canBeEmpty())&&!t.isInline()}function ws(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t);}function Es(t){return n?(t||window).getSelection():null}function Os(t){const e=ys(t);return e?e.getSelection():null}function Ms(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),Ss(e)&&t(102);const i=e=>{const n=e.getParentOrThrow(),o=Ss(n),s=e!==r||o?vs(e):e;if(o)return Pi(e)&&Pi(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,o]=i(n),l=e.getNextSiblings();return o.append(s,...l),[t,r,s]}},[o,s]=i(r);return [o,s]}function As(t){return Ps(t)&&"A"===t.tagName}function Ps(t){return Ds(t)&&1===t.nodeType}function Ds(t){return "object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function Fs(t){return Ds(t)&&11===t.nodeType}function Ls(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function Is(t){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==t.nodeName.match(e)}function Ks(t){if(Li(t)&&!t.isInline())return true;if(!Pi(t)||Ss(t))return false;const e=t.getFirstChild(),n=null===e||Zn(e)||yr(e)||e.isInline();return !t.isInline()&&false!==t.canBeEmpty()&&n}function zs(){return _i()}const Rs=new WeakMap,Bs=new Map;function Ws(e){if(!e._readOnly&&e.isEmpty())return Bs;e._readOnly||t(192);let n=Rs.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r);}return e}(e),Rs.set(e,n)),n}function Js(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function js(t){return (e=Js(t))[In]=true,e;var e;}function Us(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r);}function $s(t){t.__lexicalUnmanaged=true;}function Vs(t){return true===t.__lexicalUnmanaged}function Ys(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==zn[e]}function qs(e){const n=$$4 in e.prototype?e.prototype[$$4]():void 0,r=function(e){if(!(e===zn||e.prototype instanceof zn)){let n="<unknown>",r="<unknown>";try{n=e.getType();}catch(t){}try{io.version&&(r=JSON.parse(io.version));}catch(t){}t(290,e.name,n,r);}return e===Fi||e===Ai||e===zn}(e),i=!r&&Ys(e,"getType")?e.getType():void 0;let o,s=i;if(n)if(i)o=n[i];else for(const[t,e]of Object.entries(n))s=t,o=e;if(!r&&s&&(Ys(e,"getType")||(e.getType=()=>s),Ys(e,"clone")||(e.clone=t=>(so(t),new e)),Ys(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!Ys(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t);}return {ownNodeConfig:o,ownNodeType:s}}function Hs(t){const e=zs();di();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const Gs=(t,e)=>{let n=t;for(;null!=n&&!Ki(n);){if(e(n))return n;n=n.getParent();}return null},Xs={next:"previous",previous:"next"};class Qs{origin;constructor(t){this.origin=t;}[Symbol.iterator](){return Nl({hasNext:ll,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return dl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return dl(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e);}for(const e of i){if(l.size>0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else {const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else o.insert(e);o=dl(e,this.direction);}for(const t of l.values())t.remove();return this}}class Zs extends Qs{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:pl(t,this.direction)}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=el(this.direction);return dl(this.getNodeAtCaret(),t)||pl(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Zs&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const tl={root:Ki,shadowRoot:Ss};function el(t){return Xs[t]}function nl(t,e="root"){return tl[e](t)?null:t}class rl extends Qs{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:dl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Pi(this.origin)?pl(this.origin,this.direction):null}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=el(this.direction);return dl(this.getNodeAtCaret(),t)||pl(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof rl&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof rl||t instanceof il)&&this.direction===t.direction&&this.origin.is(t.origin)}}class il extends Qs{type="text";offset;constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:hl(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return dl(nl(this.getParentAtCaret(),t),this.direction)}getFlipped(){return hl(this.origin,el(this.direction),this.offset)}isSamePointCaret(t){return t instanceof il&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof rl||t instanceof il)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return dl(this.origin,this.direction)}}function ol(t){return t instanceof il}function ll(t){return t instanceof rl}function cl(t){return t instanceof Zs}const al={next:class extends il{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends il{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},ul={next:class extends rl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends rl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},fl={next:class extends Zs{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Zs{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function dl(t,e){return t?new ul[e](t):null}function hl(t,e,n){return t?new al[e](t,gl(t,n)):null}function gl(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return (o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function _l(t,e){return new Cl(t,e)}function pl(t,e){return Pi(t)?new fl[e](t):null}function yl(t){return t&&t.getChildCaret()||t}function ml(t){return t&&yl(t.getAdjacentCaret())}class xl{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new xl(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return ol(e)?function(t,e){const{direction:n,origin:r}=t,i=gl(r,"focus"===e?el(n):n);return _l(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [_l(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=ol(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ol(n),i=e=>e.isSameNodeCaret(n)?null:ml(e)||e.getParentCaret(t);return Nl({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Cl{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return hl(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function vl(t){return Tl(t,dl(zo(),t.direction))}function kl(t){return Tl(t,t)}function Tl(e,n){return e.direction!==n.direction&&t(265),new xl(e,n,e.direction)}function Nl(t){const{initial:e,hasNext:n,step:r,map:i}=t;let o=e;return {[Symbol.iterator](){return this},next(){if(!n(o))return {done:true,value:void 0};const t={done:false,value:i(o)};return o=r(o),t}}}function bl(e,n){const r=Ml(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case "same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case "ancestor":return "child"===e.type?-1:1;case "descendant":return "child"===n.type?1:-1;case "branch":return wl(r)}}function wl(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let o=e,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return -1;if(s.__key===r)return 1}return null===o?1:-1}function El(t,e){return e.is(t)}function Ol(t){return Pi(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ml(e,n){if(e.is(n))return {commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Ol(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,o]=Ol(n);i;o=i,i=i.getParent()){const s=r.get(i);if(void 0!==s)return null===s?(El(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===o?(El(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((Pi(s)||El(e,s))&&(Pi(o)||El(n,o))&&i.is(s.getParent())&&i.is(o.getParent())||t(278),{a:s,b:o,commonAncestor:i,type:"branch"})}return null}function Al(e,n){const{type:r,key:i,offset:o}=e,s=Ns(e.key);return "text"===r?(yr(s)||t(266,s.getType(),i),hl(s,n,o)):(Pi(s)||t(267,s.getType(),i),Ul(s,e.offset,n))}function Pl(e,n){const{origin:r,direction:i}=n,o="next"===i;ol(n)?e.set(r.getKey(),n.offset,"text"):ll(n)?yr(r)?e.set(r.getKey(),gl(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(cl(n)&&Pi(r)||t(268),e.set(r.getKey(),o?0:r.getChildrenSize(),"element"));}function Dl(t){const e=$r(),n=wr(e)?e:Wr();return Fl(n,t),Bo(n),n}function Fl(t,e){Pl(t.anchor,e.anchor),Pl(t.focus,e.focus);}function Ll(t){const{anchor:e,focus:n}=t,r=Al(e,"next"),i=Al(n,"next"),o=bl(r,i)<=0?"next":"previous";return Tl(Jl(r,o),Jl(i,o))}function Il(t){const{direction:e,origin:n}=t,r=dl(n,el(e)).getNodeAtCaret();return r?dl(r,e):pl(n.getParentOrThrow(),e)}function Kl(t,e="root"){const n=[t];for(let r=cl(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Il(r));return n}function zl(t){return !!t&&t.origin.isAttached()}function Rl(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let o=n;const s=jl(e,i),l=Kl(s.anchor,r),c=Kl(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(cl(t))a.add(t.origin.getKey());else if(ll(t)){const{origin:e}=t;Pi(e)&&!a.has(e.getKey())||u.push(e);}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Il(dl(e,i)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===o||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){o="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=pr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=hl(n,i,e.offset);}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped());}}let f,d;for(const t of l)if(zl(t)){f=Bl(t);break}for(const t of c)if(zl(t)){d=Bl(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let c;for(c=0;c<l&&o[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(Ss(i))return;!n&&e(i)&&(n=i);}return n},u=a(o,Ks),f=u&&a(s,t=>n.has(t.getKey())&&Ks(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;pl(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(true);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(true);}}const g=[f,d,...l,...c].find(zl);if(g){return kl(Jl(Bl(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)));}function Bl(t){const e=function(t){let e=t;for(;cl(e);){const t=ml(e);if(!cl(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(yr(e.origin))return ol(e)?e:hl(e.origin,n,n);const r=e.getAdjacentCaret();return ll(r)&&yr(r.origin)?hl(r.origin,n,el(n)):e}function Wl(t){return ol(t)&&t.offset!==gl(t.origin,t.direction)}function Jl(t,e){return t.direction===e?t:t.getFlipped()}function jl(t,e){return t.direction===e?t:Tl(Jl(t.focus,e),Jl(t.anchor,e))}function Ul(t,e,n){let r=pl(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t;}return Jl(r,n)}function $l(t,e="root"){let n=0,r=t,i=ml(r);for(;null===i;){if(n--,i=r.getParentCaret(e),!i)return null;r=i,i=ml(r);}return i&&[i,n]}function Vl(e){const{origin:n,offset:r,direction:i}=e;if(r===gl(n,i))return e.getSiblingCaret();if(r===gl(n,el(i)))return Il(e.getSiblingCaret());const[o]=n.splitText(r);return yr(o)||t(281),Jl(dl(o,"next"),i)}function Yl(t,e){return true}function ql(t,{$copyElementNode:e=vs,$splitTextPointCaretNext:n=Vl,rootMode:r="shadowRoot",$shouldSplit:i=Yl}={}){if(ol(t))return n(t);const o=t.getParentCaret(r);if(o){const{origin:n}=o;if(cl(t)&&(!n.canBeEmpty()||!i(n,"first")))return Il(o);const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||n.canBeEmpty()&&i(n,"last"))&&o.insert(e(n).splice(0,0,r));}return o}function Hl(t){return t}function Gl(...t){return t}function Ql(t){return t}function Zl(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return {...t,...e};return t}function tc(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function ec(t,...e){const n=tc(...e);n.length>0&&t.classList.add(...n);}function nc(t,...e){const n=tc(...e);n.length>0&&t.classList.remove(...n);}function rc(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}
|
|
6208
6208
|
|
|
6209
6209
|
/**
|
|
6210
6210
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -6214,7 +6214,7 @@ function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSe
|
|
|
6214
6214
|
*
|
|
6215
6215
|
*/
|
|
6216
6216
|
|
|
6217
|
-
function K$3(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const E$4=new Map;function F$4(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,o]=e.split(/:([^]+)/);n&&o&&(t[n.trim()]=o.trim());}return t}function b$4(e){let t=E$4.get(e);return void 0===t&&(t=F$4(e),E$4.set(e,t)),t}function R$3(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function z$5(e){const n=zs().getElementByKey(e.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function O$
|
|
6217
|
+
function K$3(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const E$4=new Map;function F$4(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,o]=e.split(/:([^]+)/);n&&o&&(t[n.trim()]=o.trim());}return t}function b$4(e){let t=E$4.get(e);return void 0===t&&(t=F$4(e),E$4.set(e,t)),t}function R$3(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function z$5(e){const n=zs().getElementByKey(e.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function O$4(e){return z$5(Ki(e)?e:e.getParentOrThrow())}function A$1(e){const t=O$4(e);return null!==t&&"rtl"===t.direction}function M$6(e,t,n="self"){const o=e.getStartEndPoints();if(t.isSelected(e)&&!So(t)&&null!==o){const[l,r]=o,s=e.isBackward(),i=l.getNode(),u=r.getNode(),g=t.is(i),a=t.is(u);if(g||a){const[o,l]=Ar(e),r=i.is(u),g=t.is(s?u:i),a=t.is(s?i:u);let d,p=0;if(r)p=o>l?l:o,d=o>l?o:l;else if(g){p=s?l:o,d=void 0;}else if(a){p=0,d=s?o:l;}const h=t.__text.slice(p,d);h!==t.__text&&("clone"===n&&(t=js(t)),t.__text=h);}}return t}function _$2(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return Pi(t)||K$3(177),e.offset===t.getChildrenSize()}function $$3(e){const t=e.getStyle(),n=F$4(t);E$4.set(t,n);}function D$4(t,n){(wr(t)?t.isCollapsed():yr(t)||Pi(t))||K$3(280);const o=b$4(wr(t)?t.style:yr(t)?t.getStyle():t.getTextStyle()),r=Object.entries(n).reduce((e,[n,l])=>("function"==typeof l?e[n]=l(o[n],t):null===l?delete e[n]:e[n]=l,e),{...o}),s=R$3(r);wr(t)||yr(t)?t.setStyle(s):t.setTextStyle(s),E$4.set(s,r);}function U$2(e,t){if(wr(e)&&e.isCollapsed()){D$4(e,t);const n=e.anchor.getNode();Pi(n)&&n.isEmpty()&&D$4(n,t);}j$5(e=>{D$4(e,t);});const n=e.getNodes();if(n.length>0){const e=new Set;for(const o of n){if(!Pi(o)||!o.canBeEmpty()||0!==o.getChildrenSize())continue;const n=o.getKey();e.has(n)||(e.add(n),D$4(o,t));}}}function j$5(t){const n=$r();if(!n)return;const i=new Map,c=e=>i.get(e.getKey())||[0,e.getTextContentSize()];if(wr(n))for(const e of Ll(n).getTextSlices())e&&i.set(e.caret.origin.getKey(),e.getSliceIndices());const f=n.getNodes();for(const n of f){if(!yr(n)||!n.canHaveFormat())continue;const[o,l]=c(n);if(l!==o)if(So(n)||0===o&&l===n.getTextContentSize())t(n);else {t(n.splitText(o,l)[0===o?0:1]);}}wr(n)&&"text"===n.anchor.type&&"text"===n.focus.type&&n.anchor.key===n.focus.key&&H$4(n);}function H$4(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:l,type:r}=t;t.set(n.key,n.offset,n.type),n.set(o,l,r);}}function V$5(e,t){const n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o);}function W$4(e,t,n=V$5){if(null===e)return;const l=e.getStartEndPoints(),r=new Map;let s=null;if(l){const[e,t]=l;s=Wr(),s.anchor.set(e.key,e.offset,e.type),s.focus.set(t.key,t.offset,t.type);const n=Gs(e.getNode(),Ks),o=Gs(t.getNode(),Ks);Pi(n)&&r.set(n.getKey(),n),Pi(o)&&r.set(o.getKey(),o);}for(const t of e.getNodes())if(Pi(t)&&Ks(t))r.set(t.getKey(),t);else if(null===l){const e=Gs(t,Ks);Pi(e)&&r.set(e.getKey(),e);}for(const[e,o]of r){const l=t();n(o,l),o.replace(l,true),s&&(e===s.anchor.key&&s.anchor.set(l.getKey(),s.anchor.offset,s.anchor.type),e===s.focus.key&&s.focus.set(l.getKey(),s.focus.offset,s.focus.type));}s&&e.is($r())&&Bo(s);}function Q$4(e){const t=Y$3(e);return null!==t&&"vertical-rl"===t.writingMode}function Y$3(e){const t=e.anchor.getNode();return Pi(t)?z$5(t):O$4(t)}function Z$3(e,t){let n=Q$4(e)?!t:t;te$4(e)&&(n=!n);const o=Al(e.focus,n?"previous":"next");if(Wl(o))return false;for(const e of vl(o)){if(cl(e))return !e.origin.isInline();if(!Pi(e.origin)){if(Li(e.origin))return true;break}}return false}function ee$4(e,t,n,o){e.modify(t?"extend":"move",n,o);}function te$4(e){const t=Y$3(e);return null!==t&&"rtl"===t.direction}function ne$4(e,t,n){const o=te$4(e);let l;l=Q$4(e)||o?!n:n,ee$4(e,t,l,"character");}function oe$4(e,t,n){const o=b$4(e.getStyle());return null!==o&&o[t]||n}function le$3(t,n,o=""){let r=null;const s=t.getNodes(),i=t.anchor,c=t.focus,f=t.isBackward(),u=f?c.offset:i.offset,g=f?c.getNode():i.getNode();if(wr(t)&&t.isCollapsed()&&""!==t.style){const e=b$4(t.style);if(null!==e&&n in e)return e[n]}for(let t=0;t<s.length;t++){const l=s[t];if((0===t||0!==u||!l.is(g))&&yr(l)){const e=oe$4(l,n,o);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?o:r}
|
|
6218
6218
|
|
|
6219
6219
|
const ALLOWED_HTML_ATTRIBUTES = [ "class", "contenteditable", "href", "src", "style", "title" ];
|
|
6220
6220
|
|
|
@@ -6301,6 +6301,64 @@ class ListenerBin {
|
|
|
6301
6301
|
}
|
|
6302
6302
|
}
|
|
6303
6303
|
|
|
6304
|
+
function createElement(name, properties, content = "") {
|
|
6305
|
+
const element = document.createElement(name);
|
|
6306
|
+
for (const [ key, value ] of Object.entries(properties || {})) {
|
|
6307
|
+
if (key in element) {
|
|
6308
|
+
element[key] = value;
|
|
6309
|
+
} else if (value !== null && value !== undefined) {
|
|
6310
|
+
element.setAttribute(key, value);
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
if (content) {
|
|
6314
|
+
element.innerHTML = content;
|
|
6315
|
+
}
|
|
6316
|
+
return element
|
|
6317
|
+
}
|
|
6318
|
+
|
|
6319
|
+
function parseHtml(html) {
|
|
6320
|
+
const parser = new DOMParser();
|
|
6321
|
+
return parser.parseFromString(html, "text/html")
|
|
6322
|
+
}
|
|
6323
|
+
|
|
6324
|
+
function createAttachmentFigure(contentType, isPreviewable, fileName) {
|
|
6325
|
+
const extension = fileName ? fileName.split(".").pop().toLowerCase() : "unknown";
|
|
6326
|
+
return createElement("figure", {
|
|
6327
|
+
className: `attachment attachment--${isPreviewable ? "preview" : "file"} attachment--${extension}`,
|
|
6328
|
+
"data-content-type": contentType
|
|
6329
|
+
})
|
|
6330
|
+
}
|
|
6331
|
+
|
|
6332
|
+
function isPreviewableImage(contentType) {
|
|
6333
|
+
return contentType.startsWith("image/") && !contentType.includes("svg")
|
|
6334
|
+
}
|
|
6335
|
+
|
|
6336
|
+
function dispatch(element, eventName, detail = null, cancelable = false) {
|
|
6337
|
+
return element.dispatchEvent(new CustomEvent(eventName, { bubbles: true, detail, cancelable }))
|
|
6338
|
+
}
|
|
6339
|
+
|
|
6340
|
+
function addBlockSpacing(doc) {
|
|
6341
|
+
const blocks = doc.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *");
|
|
6342
|
+
for (const block of blocks) {
|
|
6343
|
+
const spacer = doc.createElement("p");
|
|
6344
|
+
spacer.appendChild(doc.createElement("br"));
|
|
6345
|
+
block.before(spacer);
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
|
|
6349
|
+
function generateDomId(prefix) {
|
|
6350
|
+
const randomPart = Math.random().toString(36).slice(2, 10);
|
|
6351
|
+
return `${prefix}-${randomPart}`
|
|
6352
|
+
}
|
|
6353
|
+
|
|
6354
|
+
function extractPlainTextFromHtml(innerHtml = "") {
|
|
6355
|
+
return parseHtml(innerHtml).body.textContent.trim()
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
function isActiveAndVisible(element) {
|
|
6359
|
+
return element && !element.disabled && element.checkVisibility()
|
|
6360
|
+
}
|
|
6361
|
+
|
|
6304
6362
|
function handleRollingTabIndex(elements, event) {
|
|
6305
6363
|
const previousActiveElement = document.activeElement;
|
|
6306
6364
|
|
|
@@ -6384,10 +6442,6 @@ class NextElementFinder {
|
|
|
6384
6442
|
}
|
|
6385
6443
|
}
|
|
6386
6444
|
|
|
6387
|
-
function isActiveAndVisible(element) {
|
|
6388
|
-
return element && !element.disabled && element.checkVisibility()
|
|
6389
|
-
}
|
|
6390
|
-
|
|
6391
6445
|
var ToolbarIcons = {
|
|
6392
6446
|
"bold":
|
|
6393
6447
|
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -6661,7 +6715,8 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6661
6715
|
}
|
|
6662
6716
|
|
|
6663
6717
|
#handleEditorFocus = () => {
|
|
6664
|
-
this.#focusableItems
|
|
6718
|
+
const firstVisible = this.#focusableItems.find(isActiveAndVisible);
|
|
6719
|
+
if (firstVisible) firstVisible.tabIndex = 0;
|
|
6665
6720
|
}
|
|
6666
6721
|
|
|
6667
6722
|
#handleEditorBlur = () => {
|
|
@@ -6754,12 +6809,6 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6754
6809
|
}
|
|
6755
6810
|
}
|
|
6756
6811
|
|
|
6757
|
-
#toolbarIsOverflowing() {
|
|
6758
|
-
// Safari can report inconsistent clientWidth values on more than 100% window zoom level,
|
|
6759
|
-
// that was affecting the toolbar overflow calculation. We're adding +1 to get around this issue.
|
|
6760
|
-
return (this.scrollWidth - this.#overflow.clientWidth) > this.clientWidth + 1
|
|
6761
|
-
}
|
|
6762
|
-
|
|
6763
6812
|
#refreshToolbarOverflow = () => {
|
|
6764
6813
|
this.#resetToolbarOverflow();
|
|
6765
6814
|
this.#compactMenu();
|
|
@@ -6772,29 +6821,46 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6772
6821
|
this.#overflowMenu.toggleAttribute("disabled", !isOverflowing);
|
|
6773
6822
|
}
|
|
6774
6823
|
|
|
6824
|
+
// Separates layout reads from DOM writes to avoid forced reflows during init.
|
|
6825
|
+
// Measures every button's right edge in a single read pass, figures out which
|
|
6826
|
+
// buttons overflow using math, and then moves them in a single write pass.
|
|
6827
|
+
// The previous implementation interleaved `scrollWidth`/`clientWidth` reads with
|
|
6828
|
+
// `prepend()` writes inside a loop, forcing one full browser reflow per button.
|
|
6775
6829
|
#compactMenu() {
|
|
6776
|
-
const buttons = this.#buttons
|
|
6777
|
-
|
|
6830
|
+
const buttons = this.#buttons;
|
|
6831
|
+
if (buttons.length === 0) return
|
|
6778
6832
|
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6833
|
+
const availableWidth = this.clientWidth + 1; // +1 for Safari zoom rounding
|
|
6834
|
+
const buttonRightEdges = buttons.map(button => button.offsetLeft + button.offsetWidth);
|
|
6835
|
+
|
|
6836
|
+
let firstOverflowing = -1;
|
|
6837
|
+
for (let i = 0; i < buttons.length; i++) {
|
|
6838
|
+
if (buttonRightEdges[i] > availableWidth) {
|
|
6839
|
+
firstOverflowing = i;
|
|
6785
6840
|
break
|
|
6786
6841
|
}
|
|
6787
6842
|
}
|
|
6843
|
+
|
|
6844
|
+
if (firstOverflowing === -1) return
|
|
6845
|
+
|
|
6846
|
+
// Move one extra button to reserve space for the overflow control, which is
|
|
6847
|
+
// `display: none` until we show it — matching the previous implementation's
|
|
6848
|
+
// "move one more after it stops overflowing" behaviour.
|
|
6849
|
+
const overflowIndex = Math.max(0, firstOverflowing - 1);
|
|
6850
|
+
const overflowButtons = buttons.slice(overflowIndex).reverse();
|
|
6851
|
+
for (const button of overflowButtons) {
|
|
6852
|
+
this.#overflowMenu.prepend(button);
|
|
6853
|
+
}
|
|
6788
6854
|
}
|
|
6789
6855
|
|
|
6790
6856
|
#resetToolbarOverflow() {
|
|
6791
6857
|
const items = Array.from(this.#overflowMenu.children);
|
|
6792
6858
|
items.sort((a, b) => this.#itemPosition(b) - this.#itemPosition(a));
|
|
6793
6859
|
|
|
6794
|
-
|
|
6860
|
+
for (const item of items) {
|
|
6795
6861
|
const nextItem = this.querySelector(`[data-position="${this.#itemPosition(item) + 1}"]`) ?? this.#overflow;
|
|
6796
6862
|
this.insertBefore(item, nextItem);
|
|
6797
|
-
}
|
|
6863
|
+
}
|
|
6798
6864
|
}
|
|
6799
6865
|
|
|
6800
6866
|
#itemPosition(item) {
|
|
@@ -6960,7 +7026,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6960
7026
|
*
|
|
6961
7027
|
*/
|
|
6962
7028
|
|
|
6963
|
-
function k$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const $$2="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,I$3=$$2&&"documentMode"in document?document.documentMode:null;!(!$$2||!("InputEvent"in window)||I$3)&&"getTargetRanges"in new window.InputEvent("input");function dt$2(t,e){return Array.from(mt$3(t))}function mt$3(t,e){return vt$2("next",t)}function ht$4(t,e){const n=$l(dl(t,e));return n&&n[0]}function vt$2(t,e,n){const o=zo(),i=e||o,s=Pi(i)?pl(i,t):dl(i,t),f=wt$3(i),d=ht$4(i,t);let g=f;return Nl({hasNext:t=>null!==t,initial:s,map:t=>({depth:g,node:t.origin}),step:t=>{if(t.isSameNodeCaret(d))return null;cl(t)&&g++;const e=$l(t);return !e||e[0].isSameNodeCaret(d)?null:(g+=e[1],e[0])}})}function wt$3(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function St$2(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function Ct$2(t){const e=Gs(t,t=>Pi(t)&&!t.isInline());return Pi(e)||k$2(4,t.__key),e}function bt$2(t){const e=$r()||Vr();let r;if(wr(e))r=Al(e.focus,"next");else {if(null!=e){const t=e.getNodes(),n=t[t.length-1];n&&(r=dl(n,"next"));}r=r||pl(zo(),"previous").getFlipped().insert(Vi());}const i=Lt$4(t,r),s=ml(i),u=cl(s)?Bl(s):i;return Dl(kl(u)),t.getLatest()}function Lt$4(t,e,n){let o=Jl(e,"next");for(let t=o;t;t=ql(t,n))o=t;return ol(o)&&k$2(283),o.insert(t.isInline()?Vi().append(t):t),Jl(dl(t.getLatest(),"next"),e.direction)}function Rt$2(t,e){const n=e();return t.replace(n),n.append(t),n}function Mt$3(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Bt$3(t){const e=$r();if(!wr(e))return false;const i=new Set,l=e.getNodes();for(let e=0;e<l.length;e++){const n=l[e],o=n.getKey();if(i.has(o))continue;const u=Gs(n,t=>Pi(t)&&!t.isInline());if(null===u)continue;const c=u.getKey();u.canIndent()&&!i.has(c)&&(i.add(c),t(u));}return i.size>0}function _t$3(t,e){pl(t,"next").insert(e);}function It$2(t,e){return Ot$2(t,e,null)}function Ot$2(t,e,n){let o=false;for(const i of Ht$3(t))e(i)?null!==n&&n(i):(o=true,Pi(i)&&Ot$2(i,e,n||(t=>i.insertAfter(t))),i.remove());return o}function Dt$3(t,e){const n=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(e(t))n.push(t);else if(Pi(t))for(const e of Ht$3(t))o.push(e);return n}function Ft$3(t){return jt$3(pl(t,"next"))}function Ht$3(t){return jt$3(pl(t,"previous"))}function jt$3(t){return Nl({hasNext:ll,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}
|
|
7029
|
+
function k$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const $$2="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,I$3=$$2&&"documentMode"in document?document.documentMode:null,O$3=$$2&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);!(!$$2||!("InputEvent"in window)||I$3)&&"getTargetRanges"in new window.InputEvent("input");const rt$1=O$3;function dt$2(t,e){return Array.from(mt$3(t))}function mt$3(t,e){return vt$2("next",t)}function ht$4(t,e){const n=$l(dl(t,e));return n&&n[0]}function vt$2(t,e,n){const o=zo(),i=e||o,s=Pi(i)?pl(i,t):dl(i,t),f=wt$3(i),d=ht$4(i,t);let g=f;return Nl({hasNext:t=>null!==t,initial:s,map:t=>({depth:g,node:t.origin}),step:t=>{if(t.isSameNodeCaret(d))return null;cl(t)&&g++;const e=$l(t);return !e||e[0].isSameNodeCaret(d)?null:(g+=e[1],e[0])}})}function wt$3(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function St$2(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function Ct$2(t){const e=Gs(t,t=>Pi(t)&&!t.isInline());return Pi(e)||k$2(4,t.__key),e}function bt$2(t){const e=$r()||Vr();let r;if(wr(e))r=Al(e.focus,"next");else {if(null!=e){const t=e.getNodes(),n=t[t.length-1];n&&(r=dl(n,"next"));}r=r||pl(zo(),"previous").getFlipped().insert(Vi());}const i=Lt$4(t,r),s=ml(i),u=cl(s)?Bl(s):i;return Dl(kl(u)),t.getLatest()}function Lt$4(t,e,n){let o=Jl(e,"next");for(let t=o;t;t=ql(t,n))o=t;return ol(o)&&k$2(283),o.insert(t.isInline()?Vi().append(t):t),Jl(dl(t.getLatest(),"next"),e.direction)}function Rt$2(t,e){const n=e();return t.replace(n),n.append(t),n}function Mt$3(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Bt$3(t){const e=$r();if(!wr(e))return false;const i=new Set,l=e.getNodes();for(let e=0;e<l.length;e++){const n=l[e],o=n.getKey();if(i.has(o))continue;const u=Gs(n,t=>Pi(t)&&!t.isInline());if(null===u)continue;const c=u.getKey();u.canIndent()&&!i.has(c)&&(i.add(c),t(u));}return i.size>0}function _t$3(t,e){pl(t,"next").insert(e);}function It$2(t,e){return Ot$2(t,e,null)}function Ot$2(t,e,n){let o=false;for(const i of Ht$3(t))e(i)?null!==n&&n(i):(o=true,Pi(i)&&Ot$2(i,e,n||(t=>i.insertAfter(t))),i.remove());return o}function Dt$3(t,e){const n=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(e(t))n.push(t);else if(Pi(t))for(const e of Ht$3(t))o.push(e);return n}function Ft$3(t){return jt$3(pl(t,"next"))}function Ht$3(t){return jt$3(pl(t,"previous"))}function jt$3(t){return Nl({hasNext:ll,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}
|
|
6964
7030
|
|
|
6965
7031
|
/**
|
|
6966
7032
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -7082,60 +7148,6 @@ const o=M$2,a=U$1,L$1=ge$1;
|
|
|
7082
7148
|
|
|
7083
7149
|
function K$1(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o):n[t]=[o]);}return n}function q$1(t){const e=K$1(t,t=>t.type);return {element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const G$1=/[!-/:-@[-`{-~\s]/;function X$1(t){return t.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number(e)))}function lt$1(t){return yr(t)&&!t.hasFormat("code")}function dt(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const pt$1=/^(\s*)(\d{1,})\.\s/,ht$1=/^(\s*)[-*+]\s/,mt$1=/^(#{1,6})\s/,Ct=/^>\s/,Tt$1=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,yt$1=/^[ \t]*`{3,}$/,wt$1=it$2("mdListMarker",{parse:t=>"string"==typeof t&&/^[-*+]$/.test(t)?t:"-",resetOnCopyNode:true}),Nt=it$2("mdCodeFence",{parse:t=>"string"==typeof t&&/^`{3,}$/.test(t)?t:"```",resetOnCopyNode:true}),Ft$1=t=>(e,n,o,r)=>{const s=t(o);s.append(...n),e.replace(s),r||s.select(0,0);};const Lt$1=t=>(e,n,o,r)=>{const s=e.getPreviousSibling(),i=e.getNextSibling(),l=ae$2("check"===t?"x"===o[3]:void 0),c=o[0].trim()[0],a="bullet"!==t&&"check"!==t||c!==wt$1.parse(c)?void 0:c;if(_e$1(i)&&i.getListType()===t){a&<$2(i,wt$1,a);const t=i.getFirstChild();null!==t?t.insertBefore(l):i.append(l),e.remove();}else if(_e$1(s)&&s.getListType()===t)a&<$2(s,wt$1,a),s.append(l),e.remove();else {const n=me$1(t,"number"===t?Number(o[2]):void 0);a&<$2(n,wt$1,a),n.append(l),e.replace(n);}l.append(...n),r||l.select(0,0);const f=function(t){const e=t.match(/\t/g),n=t.match(/ /g);let o=0;return e&&(o+=e.length),n&&(o+=Math.floor(n.length/4)),o}(o[1]);f&&l.setIndent(f);},kt$1=(t,e,n)=>{const o=[],r=t.getChildren();let s=0;for(const i of r)if(ue$1(i)){if(1===i.getChildrenSize()){const t=i.getFirstChild();if(_e$1(t)){o.push(kt$1(t,e,n+1));continue}}const r=" ".repeat(4*n),l=t.getListType(),c=ot$2(t,wt$1),a="number"===l?`${t.getStart()+s}. `:"check"===l?`${c} [${i.getChecked()?"x":" "}] `:c+" ";o.push(r+a+e(i)),s++;}return o.join("\n")},Rt$1={dependencies:[Pt$2],export:(t,e)=>{if(!It$1(t))return null;const n=Number(t.getTag().slice(1));return "#".repeat(n)+" "+e(t)},regExp:mt$1,replace:Ft$1(t=>{const e="h"+t[1].length;return Mt$2(e)}),type:"element"},Mt$1={dependencies:[Et$1],export:(t,e)=>{if(!Ot$1(t))return null;const n=e(t).split("\n"),o=[];for(const t of n)o.push("> "+t);return o.join("\n")},regExp:Ct,replace:(t,e,n,o)=>{if(o){const n=t.getPreviousSibling();if(Ot$1(n))return n.splice(n.getChildrenSize(),0,[Qn(),...e]),void t.remove()}const r=Ft$2();r.append(...e),t.replace(r),o||r.select(0,0);},type:"element"},Bt$1={dependencies:[F$2],export:t=>{if(!k$1(t))return null;const e=t.getTextContent();let n=ot$2(t,Nt);if(e.indexOf(n)>-1){const t=e.match(/`{3,}/g);if(t){const e=Math.max(...t.map(t=>t.length));n="`".repeat(e+1);}}return n+(t.getLanguage()||"")+(e?"\n"+e:"")+"\n"+n},handleImportAfterStartMatch:({lines:t,rootNode:e,startLineIndex:n,startMatch:o})=>{const r=o[1],s=r.trim().length,i=t[n],l=o.index+r.length,c=i.slice(l),a=new RegExp(`\`{${s},}$`);if(a.test(c)){const t=c.match(a),r=c.slice(0,c.lastIndexOf(t[0])),s=[...o];return s[2]="",Bt$1.replace(e,null,s,t,[r],true),[true,n]}const f=new RegExp(`^[ \\t]*\`{${s},}$`);for(let r=n+1;r<t.length;r++){const s=t[r];if(f.test(s)){const l=s.match(f),c=t.slice(n+1,r),a=i.slice(o[0].length);return a.length>0&&c.unshift(a),Bt$1.replace(e,null,o,l,c,true),[true,r]}}const u=t.slice(n+1),g=i.slice(o[0].length);return g.length>0&&u.unshift(g),Bt$1.replace(e,null,o,null,u,true),[true,t.length-1]},regExpEnd:{optional:true,regExp:yt$1},regExpStart:Tt$1,replace:(t,e,n,o,r,s)=>{let i,c;const a=n[1]?n[1].trim():"```",f=n[2]||void 0;if(!e&&r){if(1===r.length)o?(i=J$1(f),c=r[0]):(i=J$1(f),c=r[0].startsWith(" ")?r[0].slice(1):r[0]);else {for(i=J$1(f),r.length>0&&(0===r[0].trim().length?r.shift():r[0].startsWith(" ")&&(r[0]=r[0].slice(1)));r.length>0&&!r[r.length-1].length;)r.pop();c=r.join("\n");}lt$2(i,Nt,a);const e=pr(c);i.append(e),t.append(i);}else e&&Ft$1(t=>J$1(t?t[2]:void 0))(t,e,n,s);},type:"multiline-element"},_t$1={dependencies:[ge$2,oe$2],export:(t,e)=>_e$1(t)?kt$1(t,e,0):null,regExp:ht$1,replace:Lt$1("bullet"),type:"element"},jt$1={dependencies:[ge$2,oe$2],export:(t,e)=>_e$1(t)?kt$1(t,e,0):null,regExp:pt$1,replace:Lt$1("number"),type:"element"},At$1={format:["code"],tag:"`",type:"text-format"},Pt$1={format:["highlight"],tag:"==",type:"text-format"},zt$1={format:["bold","italic"],tag:"***",type:"text-format"},Ut$1={format:["bold","italic"],intraword:false,tag:"___",type:"text-format"},Wt$1={format:["bold"],tag:"**",type:"text-format"},Dt$1={format:["bold"],intraword:false,tag:"__",type:"text-format"},Kt$1={format:["strikethrough"],tag:"~~",type:"text-format"},qt$1={format:["italic"],tag:"*",type:"text-format"},Gt$1={format:["italic"],intraword:false,tag:"_",type:"text-format"},Ht$1={dependencies:[M$5],export:(t,e,n)=>{if(!$$1(t)||H$2(t))return null;const o=e(t);let r=t.getTitle();null!=r&&(r=r.replace(/([\\"])/g,"\\$1"));return r?`[${o}](${t.getURL()} "${r}")`:`[${o}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{if(Gs(t,$$1))return;const[,n,o,r]=e,s=null!=o?X$1(o):void 0,i=null!=r?X$1(r):void 0,c=K$2(s,{title:i}),a=n.split("[").length-1,f=n.split("]").length-1;let u=n,g="";if(a<f)return;if(a>f){const t=n.split("[");g="["+t[0],u=t.slice(1).join("[");}const d=pr(u);return d.setFormat(t.getFormat()),c.append(d),t.replace(c),g&&c.insertBefore(pr(g)),d},trigger:")",type:"text-match"},Jt$1=[Rt$1,Mt$1,_t$1,jt$1],Qt$1=[Bt$1],Vt$1=[At$1,zt$1,Ut$1,Wt$1,Dt$1,Pt$1,qt$1,Gt$1,Kt$1],Xt$1=[Ht$1],Yt$1=[...Jt$1,...Qt$1,...Vt$1,...Xt$1];function Zt$1(t,e,n,o,r){const s=t.getParent();if(!Ss(s)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(!r&&" "!==i[n-1])return false;for(const{regExpStart:s,replace:l,regExpEnd:c}of o){if(c&&!("optional"in c)||c&&"optional"in c&&!c.optional)continue;const o=i.match(s);if(o){const s=r||o[0].endsWith(" ")?n:n-1;if(o[0].length!==s)continue;const i=e.getNextSiblings(),[c,a]=e.splitText(n);if(false!==l(t,a?[a,...i]:i,o,null,null,false))return c.remove(),true}}return false}function te(t,e,n){const o=n.length;for(let r=e;r>=o;r--){const e=r-o;if(ee(t,e,n,0,o)&&" "!==t[e+o])return e}return -1}function ee(t,e,n,o,r){for(let s=0;s<r;s++)if(t[e+s]!==n[o+s])return false;return true}function ne(t,n=Yt$1){const o=q$1(n),r=K$1(o.textFormat,({tag:t})=>t[t.length-1]),l=K$1(o.textMatch,({trigger:t})=>t);for(const e of n){const n=e.type;if("element"===n||"text-match"===n||"multiline-element"===n){const n=e.dependencies;for(const e of n)t.hasNode(e)||dt(173,e.getType());}}const c=(t,n,c)=>{(function(t,e,n,o){const r=t.getParent();if(!Ss(r)||t.getFirstChild()!==e)return false;const s=e.getTextContent();if(" "!==s[n-1])return false;for(const{regExp:r,replace:i}of o){const o=s.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[s,l]=e.splitText(n);if(false!==i(t,l?[l,...r]:r,o,false))return s.remove(),true}}return false})(t,n,c,o.element)||Zt$1(t,n,c,o.multilineElement)||function(t,e,n){let o=t.getTextContent();const r=n[o[e-1]];if(null==r)return false;e<o.length&&(o=o.slice(0,e));for(const e of r){if(!e.replace||!e.regExp)continue;const n=o.match(e.regExp);if(null===n)continue;const r=n.index||0,s=r+n[0].length;let i;return 0===r?[i]=t.splitText(s):[,i]=t.splitText(r,s),i.selectNext(0,0),e.replace(i,n),true}return false}(n,c,l)||function(t,n,o){const r=t.getTextContent(),l=n-1,c=r[l],a=o[c];if(!a)return false;for(const n of a){const{tag:o}=n,a=o.length,f=l-a+1;if(a>1&&!ee(r,f,o,0,a))continue;if(" "===r[f-1])continue;const u=r[l+1];if(false===n.intraword&&u&&!G$1.test(u))continue;const g=t;let d=g,p=te(r,f,o),h=d;for(;p<0&&(h=h.getPreviousSibling())&&!Zn(h);)if(yr(h)){if(h.hasFormat("code"))continue;const t=h.getTextContent();d=h,p=te(t,t.length,o);}if(p<0)continue;if(d===g&&p+a===f)continue;const x=d.getTextContent();if(p>0&&x[p-1]===c)continue;const m=x[p-1];if(false===n.intraword&&m&&!G$1.test(m))continue;const T=g.getTextContent(),y=T.slice(0,f)+T.slice(l+1);g.setTextContent(y);const E=d===g?y:x;d.setTextContent(E.slice(0,p)+E.slice(p+a));const I=$r(),S=Wr();Bo(S);const b=l-a*(d===g?2:1)+1;S.anchor.set(d.__key,p,"text"),S.focus.set(g.__key,b,"text");for(const t of n.format)S.hasFormat(t)||S.formatText(t);S.anchor.set(S.focus.key,S.focus.offset,S.focus.type);for(const t of n.format)S.hasFormat(t)&&S.toggleFormat(t);return wr(I)&&(S.format=I.format),true}}(n,c,r);};return rc(t.registerUpdateListener(({tags:n,dirtyLeaves:o,editorState:r,prevEditorState:s})=>{if(n.has(jn)||n.has(Rn$1))return;if(t.isComposing())return;const l=r.read($r),a=s.read($r);if(!wr(a)||!wr(l)||!l.isCollapsed()||l.is(a))return;const f=l.anchor.key,u=l.anchor.offset,g=r._nodeMap.get(f);!yr(g)||!o.has(f)||1!==u&&u>a.anchor.offset+1||t.update(()=>{if(!lt$1(g))return;const t=g.getParent();null===t||k$1(t)||c(t,g,l.anchor.offset);});}),t.registerCommand(Ee$2,t=>{if(null!==t&&t.shiftKey)return false;const n=$r();if(!wr(n)||!n.isCollapsed())return false;const r=n.anchor.offset,s=n.anchor.getNode();if(!yr(s)||!lt$1(s))return false;const l=s.getParent();if(null===l||k$1(l))return false;return r===s.getTextContent().length&&(!!Zt$1(l,s,r,o.multilineElement,true)&&(null!==t&&t.preventDefault(),true))},Hi))}
|
|
7084
7150
|
|
|
7085
|
-
function createElement(name, properties, content = "") {
|
|
7086
|
-
const element = document.createElement(name);
|
|
7087
|
-
for (const [ key, value ] of Object.entries(properties || {})) {
|
|
7088
|
-
if (key in element) {
|
|
7089
|
-
element[key] = value;
|
|
7090
|
-
} else if (value !== null && value !== undefined) {
|
|
7091
|
-
element.setAttribute(key, value);
|
|
7092
|
-
}
|
|
7093
|
-
}
|
|
7094
|
-
if (content) {
|
|
7095
|
-
element.innerHTML = content;
|
|
7096
|
-
}
|
|
7097
|
-
return element
|
|
7098
|
-
}
|
|
7099
|
-
|
|
7100
|
-
function parseHtml(html) {
|
|
7101
|
-
const parser = new DOMParser();
|
|
7102
|
-
return parser.parseFromString(html, "text/html")
|
|
7103
|
-
}
|
|
7104
|
-
|
|
7105
|
-
function createAttachmentFigure(contentType, isPreviewable, fileName) {
|
|
7106
|
-
const extension = fileName ? fileName.split(".").pop().toLowerCase() : "unknown";
|
|
7107
|
-
return createElement("figure", {
|
|
7108
|
-
className: `attachment attachment--${isPreviewable ? "preview" : "file"} attachment--${extension}`,
|
|
7109
|
-
"data-content-type": contentType
|
|
7110
|
-
})
|
|
7111
|
-
}
|
|
7112
|
-
|
|
7113
|
-
function isPreviewableImage(contentType) {
|
|
7114
|
-
return contentType.startsWith("image/") && !contentType.includes("svg")
|
|
7115
|
-
}
|
|
7116
|
-
|
|
7117
|
-
function dispatch(element, eventName, detail = null, cancelable = false) {
|
|
7118
|
-
return element.dispatchEvent(new CustomEvent(eventName, { bubbles: true, detail, cancelable }))
|
|
7119
|
-
}
|
|
7120
|
-
|
|
7121
|
-
function addBlockSpacing(doc) {
|
|
7122
|
-
const blocks = doc.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *");
|
|
7123
|
-
for (const block of blocks) {
|
|
7124
|
-
const spacer = doc.createElement("p");
|
|
7125
|
-
spacer.appendChild(doc.createElement("br"));
|
|
7126
|
-
block.before(spacer);
|
|
7127
|
-
}
|
|
7128
|
-
}
|
|
7129
|
-
|
|
7130
|
-
function generateDomId(prefix) {
|
|
7131
|
-
const randomPart = Math.random().toString(36).slice(2, 10);
|
|
7132
|
-
return `${prefix}-${randomPart}`
|
|
7133
|
-
}
|
|
7134
|
-
|
|
7135
|
-
function extractPlainTextFromHtml(innerHtml = "") {
|
|
7136
|
-
return parseHtml(innerHtml).body.textContent.trim()
|
|
7137
|
-
}
|
|
7138
|
-
|
|
7139
7151
|
class HorizontalDividerNode extends Fi {
|
|
7140
7152
|
static getType() {
|
|
7141
7153
|
return "horizontal_divider"
|
|
@@ -7904,26 +7916,38 @@ class StyleCanonicalizer {
|
|
|
7904
7916
|
|
|
7905
7917
|
#resolveCannonicalValue(value) {
|
|
7906
7918
|
let index = this.#computedAllowedValues.indexOf(value);
|
|
7907
|
-
index
|
|
7919
|
+
if (index === -1) {
|
|
7920
|
+
index = this.#computedAllowedValues.indexOf(computeStyleValues(this._property, [ value ])[0]);
|
|
7921
|
+
}
|
|
7908
7922
|
return index === -1 ? null : this._allowedValues[index]
|
|
7909
7923
|
}
|
|
7910
7924
|
|
|
7911
7925
|
get #computedAllowedValues() {
|
|
7912
|
-
return this._computedAllowedValues ||= this._allowedValues
|
|
7913
|
-
value => getComputedStyleForProperty(this._property, value)
|
|
7914
|
-
)
|
|
7926
|
+
return this._computedAllowedValues ||= computeStyleValues(this._property, this._allowedValues)
|
|
7915
7927
|
}
|
|
7916
7928
|
}
|
|
7917
7929
|
|
|
7918
|
-
|
|
7919
|
-
|
|
7930
|
+
// Separates DOM writes from layout reads to avoid forced reflows. All resolver
|
|
7931
|
+
// elements are built inside a fragment, attached once, then read in a single pass.
|
|
7932
|
+
// Reading `getComputedStyle` after a write forces the browser to recompute layout,
|
|
7933
|
+
// so interleaving writes and reads inside a loop turns one reflow into N.
|
|
7934
|
+
function computeStyleValues(property, values) {
|
|
7935
|
+
const fragment = document.createDocumentFragment();
|
|
7936
|
+
|
|
7937
|
+
const elements = values.map(value => {
|
|
7938
|
+
const element = createElement("span", { style: `display: none; ${property}: ${value};` });
|
|
7939
|
+
fragment.appendChild(element);
|
|
7940
|
+
return element
|
|
7941
|
+
});
|
|
7942
|
+
|
|
7943
|
+
document.body.appendChild(fragment);
|
|
7920
7944
|
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
element.remove();
|
|
7945
|
+
const computed = elements.map(element =>
|
|
7946
|
+
window.getComputedStyle(element).getPropertyValue(property)
|
|
7947
|
+
);
|
|
7925
7948
|
|
|
7926
|
-
|
|
7949
|
+
elements.forEach(element => element.remove());
|
|
7950
|
+
return computed
|
|
7927
7951
|
}
|
|
7928
7952
|
|
|
7929
7953
|
class LexxyExtension {
|
|
@@ -8541,7 +8565,9 @@ class CommandDispatcher {
|
|
|
8541
8565
|
const selection = $r();
|
|
8542
8566
|
if (!wr(selection)) return
|
|
8543
8567
|
|
|
8544
|
-
|
|
8568
|
+
const anchorNode = selection.anchor.getNode();
|
|
8569
|
+
|
|
8570
|
+
if (selection.isCollapsed() && !St$2(anchorNode, M$5)) {
|
|
8545
8571
|
const autoLinkNode = j$3(url);
|
|
8546
8572
|
const textNode = pr(url);
|
|
8547
8573
|
autoLinkNode.append(textNode);
|
|
@@ -8921,14 +8947,24 @@ function normalizeFilteredText(string) {
|
|
|
8921
8947
|
.normalize("NFD").replace(/[\u0300-\u036f]/g, "") // Remove diacritics
|
|
8922
8948
|
}
|
|
8923
8949
|
|
|
8924
|
-
function
|
|
8925
|
-
|
|
8950
|
+
function filterMatchPosition(text, potentialMatch) {
|
|
8951
|
+
const normalizedText = normalizeFilteredText(text);
|
|
8952
|
+
const normalizedMatch = normalizeFilteredText(potentialMatch);
|
|
8953
|
+
|
|
8954
|
+
if (!normalizedMatch) return 0
|
|
8955
|
+
|
|
8956
|
+
const match = normalizedText.match(new RegExp(`(?:^|\\b)${escapeForRegExp(normalizedMatch)}`));
|
|
8957
|
+
return match ? match.index : -1
|
|
8926
8958
|
}
|
|
8927
8959
|
|
|
8928
8960
|
function upcaseFirst(string) {
|
|
8929
8961
|
return string.charAt(0).toUpperCase() + string.slice(1)
|
|
8930
8962
|
}
|
|
8931
8963
|
|
|
8964
|
+
function escapeForRegExp(string) {
|
|
8965
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
8966
|
+
}
|
|
8967
|
+
|
|
8932
8968
|
// Parses a value that may arrive as a boolean or as a string (e.g. from DOM
|
|
8933
8969
|
// getAttribute) into a proper boolean. Ensures "false" doesn't evaluate as truthy.
|
|
8934
8970
|
function parseBoolean(value) {
|
|
@@ -12919,6 +12955,10 @@ class FormatEscapeExtension extends LexxyExtension {
|
|
|
12919
12955
|
return this.editorElement.supportsRichText
|
|
12920
12956
|
}
|
|
12921
12957
|
|
|
12958
|
+
get allowedElements() {
|
|
12959
|
+
return [ { tag: "li", attributes: [ "value" ] } ]
|
|
12960
|
+
}
|
|
12961
|
+
|
|
12922
12962
|
get lexicalExtension() {
|
|
12923
12963
|
return Hl({
|
|
12924
12964
|
name: "lexxy/format-escape",
|
|
@@ -12992,6 +13032,65 @@ function $handleArrowDownInCodeBlock(event) {
|
|
|
12992
13032
|
return false
|
|
12993
13033
|
}
|
|
12994
13034
|
|
|
13035
|
+
class LinkOpenerExtension extends LexxyExtension {
|
|
13036
|
+
get enabled() {
|
|
13037
|
+
return this.editorElement.supportsRichText
|
|
13038
|
+
}
|
|
13039
|
+
|
|
13040
|
+
get lexicalExtension() {
|
|
13041
|
+
return Hl({
|
|
13042
|
+
name: "lexxy/link-opener",
|
|
13043
|
+
register: () => {
|
|
13044
|
+
return rc(
|
|
13045
|
+
registerEventListener(window, "keydown", this.#update.bind(this)),
|
|
13046
|
+
registerEventListener(window, "keyup", this.#update.bind(this)),
|
|
13047
|
+
registerEventListener(window, "blur", this.#disable.bind(this)),
|
|
13048
|
+
registerEventListener(window, "focus", this.#refresh.bind(this))
|
|
13049
|
+
)
|
|
13050
|
+
}
|
|
13051
|
+
})
|
|
13052
|
+
}
|
|
13053
|
+
|
|
13054
|
+
#update(event) {
|
|
13055
|
+
if (this.#isModified(event)) {
|
|
13056
|
+
this.#enable();
|
|
13057
|
+
} else {
|
|
13058
|
+
this.#disable();
|
|
13059
|
+
}
|
|
13060
|
+
}
|
|
13061
|
+
|
|
13062
|
+
#refresh() {
|
|
13063
|
+
// Chrome dispatches events without modifier keys *for a while* after changing tabs
|
|
13064
|
+
setTimeout(() => {
|
|
13065
|
+
window.addEventListener("mousemove", this.#update.bind(this), { once: true });
|
|
13066
|
+
}, 200);
|
|
13067
|
+
}
|
|
13068
|
+
|
|
13069
|
+
#isModified(event) {
|
|
13070
|
+
return rt$1 ? event.metaKey : event.ctrlKey
|
|
13071
|
+
}
|
|
13072
|
+
|
|
13073
|
+
#enable() {
|
|
13074
|
+
for (const anchor of this.#anchors) {
|
|
13075
|
+
anchor.setAttribute("contenteditable", "false");
|
|
13076
|
+
anchor.setAttribute("target", "_blank");
|
|
13077
|
+
anchor.setAttribute("rel", "noopener noreferrer");
|
|
13078
|
+
}
|
|
13079
|
+
}
|
|
13080
|
+
|
|
13081
|
+
#disable() {
|
|
13082
|
+
for (const anchor of this.#anchors) {
|
|
13083
|
+
anchor.removeAttribute("contenteditable");
|
|
13084
|
+
anchor.removeAttribute("target");
|
|
13085
|
+
anchor.removeAttribute("rel");
|
|
13086
|
+
}
|
|
13087
|
+
}
|
|
13088
|
+
|
|
13089
|
+
get #anchors() {
|
|
13090
|
+
return this.editorElement.editorContentElement?.querySelectorAll("a") ?? []
|
|
13091
|
+
}
|
|
13092
|
+
}
|
|
13093
|
+
|
|
12995
13094
|
class LexicalEditorElement extends HTMLElement {
|
|
12996
13095
|
static formAssociated = true
|
|
12997
13096
|
static debug = false
|
|
@@ -13096,7 +13195,8 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
13096
13195
|
TrixContentExtension,
|
|
13097
13196
|
TablesExtension,
|
|
13098
13197
|
AttachmentsExtension,
|
|
13099
|
-
FormatEscapeExtension
|
|
13198
|
+
FormatEscapeExtension,
|
|
13199
|
+
LinkOpenerExtension
|
|
13100
13200
|
]
|
|
13101
13201
|
}
|
|
13102
13202
|
|
|
@@ -13346,7 +13446,9 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
13346
13446
|
}
|
|
13347
13447
|
|
|
13348
13448
|
#handleTurboBeforeCache = (event) => {
|
|
13349
|
-
this
|
|
13449
|
+
if (!this.closest("[data-turbo-permanent]")) {
|
|
13450
|
+
this.#reset();
|
|
13451
|
+
}
|
|
13350
13452
|
}
|
|
13351
13453
|
|
|
13352
13454
|
#synchronizeWithChanges() {
|
|
@@ -13619,19 +13721,30 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
13619
13721
|
]
|
|
13620
13722
|
}
|
|
13621
13723
|
|
|
13724
|
+
// Builds one resolver element per CSS value inside a hidden container, attaches
|
|
13725
|
+
// the container in a single DOM write, then reads all computed values in one pass
|
|
13726
|
+
// — triggering at most one forced reflow. The previous implementation interleaved
|
|
13727
|
+
// setProperty/getComputedStyle/removeProperty on the same element, forcing a style
|
|
13728
|
+
// recalc on every iteration during editor initialization.
|
|
13622
13729
|
#resolveColors(property, cssValues) {
|
|
13623
|
-
const
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
return { name: cssValue, value }
|
|
13730
|
+
const container = document.createElement("span");
|
|
13731
|
+
container.style.display = "none";
|
|
13732
|
+
|
|
13733
|
+
const resolvers = cssValues.map(cssValue => {
|
|
13734
|
+
const element = document.createElement("span");
|
|
13735
|
+
element.style.setProperty(property, cssValue);
|
|
13736
|
+
container.appendChild(element);
|
|
13737
|
+
return { element, name: cssValue }
|
|
13632
13738
|
});
|
|
13633
13739
|
|
|
13634
|
-
|
|
13740
|
+
this.appendChild(container);
|
|
13741
|
+
|
|
13742
|
+
const resolved = resolvers.map(({ element, name }) => ({
|
|
13743
|
+
name,
|
|
13744
|
+
value: window.getComputedStyle(element).getPropertyValue(property)
|
|
13745
|
+
}));
|
|
13746
|
+
|
|
13747
|
+
container.remove();
|
|
13635
13748
|
return resolved
|
|
13636
13749
|
}
|
|
13637
13750
|
|
|
@@ -13821,7 +13934,7 @@ class LinkDropdown extends ToolbarDropdown {
|
|
|
13821
13934
|
get #selectedLinkUrl() {
|
|
13822
13935
|
return this.editor.getEditorState().read(() => {
|
|
13823
13936
|
const linkNode = this.editorElement.selection.nearestNodeOfType(M$5);
|
|
13824
|
-
return linkNode?.
|
|
13937
|
+
return linkNode?.getURL() ?? ""
|
|
13825
13938
|
})
|
|
13826
13939
|
}
|
|
13827
13940
|
}
|
|
@@ -13985,21 +14098,41 @@ class LocalFilterSource extends BaseSource {
|
|
|
13985
14098
|
}
|
|
13986
14099
|
|
|
13987
14100
|
#buildListItemsFromPromptItems(promptItems, filter) {
|
|
13988
|
-
const listItems = [];
|
|
13989
14101
|
this.promptItemByListItem = new WeakMap();
|
|
13990
14102
|
|
|
13991
|
-
|
|
13992
|
-
|
|
14103
|
+
if (!filter) {
|
|
14104
|
+
return this.#buildAllListItems(promptItems)
|
|
14105
|
+
}
|
|
13993
14106
|
|
|
14107
|
+
const matches = [];
|
|
14108
|
+
for (const promptItem of promptItems) {
|
|
13994
14109
|
const searchableText = promptItem.getAttribute("search");
|
|
13995
|
-
|
|
13996
|
-
if (
|
|
13997
|
-
|
|
13998
|
-
this.promptItemByListItem.set(listItem, promptItem);
|
|
13999
|
-
listItems.push(listItem);
|
|
14110
|
+
const position = filterMatchPosition(searchableText, filter);
|
|
14111
|
+
if (position >= 0) {
|
|
14112
|
+
matches.push({ promptItem, position });
|
|
14000
14113
|
}
|
|
14001
14114
|
}
|
|
14002
14115
|
|
|
14116
|
+
matches.sort((a, b) => a.position - b.position);
|
|
14117
|
+
|
|
14118
|
+
const listItems = [];
|
|
14119
|
+
for (const { promptItem } of matches) {
|
|
14120
|
+
if (listItems.length >= MAX_RENDERED_SUGGESTIONS$1) break
|
|
14121
|
+
const listItem = this.buildListItemElementFor(promptItem);
|
|
14122
|
+
this.promptItemByListItem.set(listItem, promptItem);
|
|
14123
|
+
listItems.push(listItem);
|
|
14124
|
+
}
|
|
14125
|
+
return listItems
|
|
14126
|
+
}
|
|
14127
|
+
|
|
14128
|
+
#buildAllListItems(promptItems) {
|
|
14129
|
+
const listItems = [];
|
|
14130
|
+
for (const promptItem of promptItems) {
|
|
14131
|
+
if (listItems.length >= MAX_RENDERED_SUGGESTIONS$1) break
|
|
14132
|
+
const listItem = this.buildListItemElementFor(promptItem);
|
|
14133
|
+
this.promptItemByListItem.set(listItem, promptItem);
|
|
14134
|
+
listItems.push(listItem);
|
|
14135
|
+
}
|
|
14003
14136
|
return listItems
|
|
14004
14137
|
}
|
|
14005
14138
|
}
|