@fgbg/mdocs 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-skills/changelog/SKILL.md +18 -0
- package/dist/server/routes/assets.routes.js +9 -4
- package/dist/server/routes/assets.routes.js.map +1 -1
- package/dist/server/routes/assets.routes.upload.test.js +1 -0
- package/dist/server/routes/assets.routes.upload.test.js.map +1 -1
- package/dist/web/assets/{AgentChatPanel-C8TMWDuE.js → AgentChatPanel-Bt38gm3b.js} +2 -2
- package/dist/web/assets/{AgentSkillFormCard-yk7PWF0W.js → AgentSkillFormCard-CtfWIf7Y.js} +1 -1
- package/dist/web/assets/AiWriteWorkbench-Boie5E_-.js +7 -0
- package/dist/web/assets/{DiagramEditor-NtNY3sZL-Bw4wHaBD.js → DiagramEditor-NtNY3sZL-CZy-tmEe.js} +1 -1
- package/dist/web/assets/DocumentEditor-1A6lpvV-.js +26 -0
- package/dist/web/assets/{MergeView-royv5YkB.js → MergeView-Dip0aW7s.js} +1 -1
- package/dist/web/assets/PlaygroundPage-C4X6Lj-Q.js +8 -0
- package/dist/web/assets/{SettingsPage-D8HfepZ8.js → SettingsPage-nlnmzNZK.js} +1 -1
- package/dist/web/assets/{Toolbar-BDJ6WABq.js → Toolbar-BHLX-ug4.js} +2 -2
- package/dist/web/assets/{VisitorPickerModal-DPKIoySi.js → VisitorPickerModal-BPyEWlQo.js} +1 -1
- package/dist/web/assets/{copy-UwfRYkpI.js → copy-BE64wQqi.js} +1 -1
- package/dist/web/assets/diagram-CT58wBdU.js +5772 -0
- package/dist/web/assets/{editor-ONzd_YnO.js → editor-CL03se2B.js} +1 -1
- package/dist/web/assets/{index-4TuRcE3b.js → index-BkKvQv2F.js} +24 -24
- package/dist/web/assets/index-DKshvHIN.css +1 -0
- package/dist/web/assets/{meta2d-D3b5RRN8.js → meta2d-1-g23JOU.js} +1 -1
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-D1J2-XNv.js → meta2dEngine-BD2XbzaV-z-eR7E_V.js} +1 -1
- package/dist/web/assets/{motion-DddvD-ez.js → motion-DX3HNq_4.js} +2 -2
- package/dist/web/assets/{plus-CiGwts52.js → plus-ECzYbQfA.js} +1 -1
- package/dist/web/assets/react-GP8hKHRA.js +2122 -0
- package/dist/web/assets/react-vendor-BuABiQkA.js +242 -0
- package/dist/web/assets/ui-BQStT3dY.js +3116 -0
- package/dist/web/index.html +6 -6
- package/package.json +2 -2
- package/dist/web/assets/AiWriteWorkbench-ChCJt24m.js +0 -7
- package/dist/web/assets/DocumentEditor-B3Dsq02C.js +0 -26
- package/dist/web/assets/PlaygroundPage-B-_1l4Ix.js +0 -8
- package/dist/web/assets/diagram--gCCJK__.js +0 -6257
- package/dist/web/assets/index-C4ESYs7f.css +0 -1
- package/dist/web/assets/react-B99eF5mm.js +0 -2377
- package/dist/web/assets/react-vendor-BJFXgntS.js +0 -242
- package/dist/web/assets/ui-BHvBMRFE.js +0 -3126
|
@@ -13,4 +13,4 @@ var du=Object.defineProperty;var hu=(n,e,t)=>e in n?du(n,e,{enumerable:!0,config
|
|
|
13
13
|
`?c.insertParagraph():u===" "?c.insertNodes([Mn()]):c.insertText(u)}}}else e.insertRawText(s)}function Ol(n,e,t){n.dispatchCommand(ga,{nodes:e,selection:t})||(t.insertNodes(e),function(r){if(E(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=Xt(o,"previous");if(s)if(oe(s))i=s.origin;else{const l=$e(s,vt(ct(),"next").getFlipped());for(const a of l){if(F(a.origin)){i=a.origin;break}if(b(a.origin)&&!a.origin.isInline())break}}if(i&&F(i)){const l=i.getFormat(),a=i.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}}(t))}function Bc(n,e,t,r=[]){let o=e===null||t.isSelected(e);const i=b(t)&&t.excludeFromCopy("html");let s=t;e!==null&&F(s)&&(s=vc(e,s,"clone"));const l=b(s)?s.getChildren():[],a=function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&eo(58,f.name),b(c)){const d=u.children;Array.isArray(d)||eo(59,f.name)}return u}(s);F(s)&&s.getTextContentSize()===0&&(o=!1);for(let c=0;c<l.length;c++){const u=l[c],f=Bc(n,e,u,a.children);!o&&b(t)&&f&&t.extractWithChild(u,e,"clone")&&(o=!0)}if(o&&!i)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return o}function Bd(n,e){const t=[],r=ct().getChildren();for(let o=0;o<r.length;o++)Bc(n,e,r[o],t);return{namespace:n._config.namespace,nodes:t}}function Jd(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=vf(r);F(o)&&nd(o),e.push(o)}return e}let fn=null;async function vi(n,e,t){if(fn!==null)return!1;if(e!==null)return new Promise((c,u)=>{n.update(()=>{c(Al(n,e,t))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=wt(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(i.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise((c,u)=>{const f=n.registerCommand(ao,d=>(Te(d,ClipboardEvent)&&(f(),fn!==null&&(o.clearTimeout(fn),fn=null),c(Al(n,d,t))),!0),Nf);fn=o.setTimeout(()=>{f(),fn=null,c(!1)},50),i.execCommand("copy"),l.remove()})}function Al(n,e,t){if(t===void 0){const o=wt(n._window),i=M();if(!i||i.isCollapsed()||!o)return!1;const s=o.anchorNode,l=o.focusNode;if(s!==null&&l!==null&&!dr(n,s,l))return!1;t=Hc(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Hd(r,t),!0)}const Jc=[["text/html",zd],["application/x-lexical-editor",Wd]];function Hc(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Dn();for(const[r,o]of Jc){const i=o(t,n);i!==null&&(e[r]=i)}}return e}function Hd(n,e){for(const[t]of Jc)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const ps=/^(\d+(?:\.\d+)?)px$/,lt={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class ln extends At{constructor(t=lt.NO_STATUS,r=1,o,i){super(i);x(this,"__colSpan");x(this,"__rowSpan");x(this,"__headerState");x(this,"__width");x(this,"__backgroundColor");x(this,"__verticalAlign");this.__colSpan=r,this.__rowSpan=1,this.__headerState=t,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}static getType(){return"tablecell"}static clone(t){return new ln(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__rowSpan=t.__rowSpan,this.__backgroundColor=t.__backgroundColor,this.__verticalAlign=t.__verticalAlign,this.__colSpan=t.__colSpan,this.__headerState=t.__headerState,this.__width=t.__width}static importDOM(){return{td:t=>({conversion:Ml,priority:0}),th:t=>({conversion:Ml,priority:0})}}static importJSON(t){return qt().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan||1).setRowSpan(t.rowSpan||1).setWidth(t.width||void 0).setBackgroundColor(t.backgroundColor||null).setVerticalAlign(t.verticalAlign||void 0)}createDOM(t){const r=document.createElement(this.getTag());return this.__width&&(r.style.width=`${this.__width}px`),this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(r.style.backgroundColor=this.__backgroundColor),bi(this.__verticalAlign)&&(r.style.verticalAlign=this.__verticalAlign),pt(r,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),r}exportDOM(t){const r=super.exportDOM(t);if(nt(r.element)){const o=r.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return r}exportJSON(){return{...super.exportJSON(),...bi(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(t){const r=this.getWritable();return r.__colSpan=t,r}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(t){const r=this.getWritable();return r.__rowSpan=t,r}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(t,r=lt.BOTH){const o=this.getWritable();return o.__headerState=t&r|o.__headerState&~r,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(t){const r=this.getWritable();return r.__width=t,r}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(t){const r=this.getWritable();return r.__backgroundColor=t,r}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(t){const r=this.getWritable();return r.__verticalAlign=t||void 0,r}toggleHeaderStyle(t){const r=this.getWritable();return(r.__headerState&t)===t?r.__headerState-=t:r.__headerState+=t,r}hasHeaderState(t){return(this.getHeaderStyles()&t)===t}hasHeader(){return this.getLatest().__headerState!==lt.NO_STATUS}updateDOM(t){return t.__headerState!==this.__headerState||t.__width!==this.__width||t.__colSpan!==this.__colSpan||t.__rowSpan!==this.__rowSpan||t.__backgroundColor!==this.__backgroundColor||t.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function bi(n){return n==="middle"||n==="bottom"}function Ml(n){const e=n,t=n.nodeName.toLowerCase();let r;ps.test(e.style.width)&&(r=parseFloat(e.style.width));let o=lt.NO_STATUS;t==="th"&&(o=e.getAttribute("scope")==="col"?lt.COLUMN:lt.ROW);const i=qt(o,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const l=e.style.verticalAlign;bi(l)&&(i.__verticalAlign=l);const a=e.style,c=(a&&a.textDecoration||"").split(" "),u=a.fontWeight==="700"||a.fontWeight==="bold",f=c.includes("line-through"),d=a.fontStyle==="italic",g=c.includes("underline");return{after:h=>{const p=[];let _=null;const m=()=>{if(_){const y=_.getFirstChild();Jt(y)&&_.getChildrenSize()===1&&y.remove()}};for(const y of h)$f(y)||F(y)||Jt(y)?(F(y)&&(u&&y.toggleFormat("bold"),f&&y.toggleFormat("strikethrough"),d&&y.toggleFormat("italic"),g&&y.toggleFormat("underline")),_?_.append(y):(_=H().append(y),p.push(_))):(p.push(y),m(),_=null);return m(),p.length===0&&p.push(H()),p},node:i}}function qt(n=lt.NO_STATUS,e=1,t){return Ht(new ln(n,e,t))}function L(n){return n instanceof ln}const Ud=R("INSERT_TABLE_COMMAND");function D(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class _r extends At{constructor(t,r){super(r);x(this,"__height");this.__height=t}static getType(){return"tablerow"}static clone(t){return new _r(t.__height,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__height=t.__height}static importDOM(){return{tr:t=>({conversion:jd,priority:0})}}static importJSON(t){return ir().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHeight(t.height)}exportJSON(){const t=this.getHeight();return{...super.exportJSON(),...t===void 0?void 0:{height:t}}}createDOM(t){const r=document.createElement("tr");return this.__height&&(r.style.height=`${this.__height}px`),pt(r,t.theme.tableRow),r}extractWithChild(t,r,o){return o==="html"}isShadowRoot(){return!0}setHeight(t){const r=this.getWritable();return r.__height=t,r}getHeight(){return this.getLatest().__height}updateDOM(t){return t.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function jd(n){const e=n;let t;return ps.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>Oc(r,L),node:ir(t)}}function ir(n){return Ht(new _r(n))}function rt(n){return n instanceof _r}const _s=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Vd=_s&&"documentMode"in document?document.documentMode:null,Fl=_s&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function Yd(n,e,t=!0){const r=ys();for(let o=0;o<n;o++){const i=ir();for(let s=0;s<e;s++){let l=lt.NO_STATUS;typeof t=="object"?(o===0&&t.rows&&(l|=lt.ROW),s===0&&t.columns&&(l|=lt.COLUMN)):t&&(o===0&&(l|=lt.ROW),s===0&&(l|=lt.COLUMN));const a=qt(l),c=H();c.append(st()),a.append(c),i.append(a)}r.append(i)}return r}function sg(n){const e=B(n,t=>L(t));return L(e)?e:null}function Uc(n){const e=B(n,t=>rt(t));if(rt(e))return e;throw new Error("Expected table cell to be inside of table row.")}function jc(n){const e=B(n,t=>ot(t));if(ot(e))return e;throw new Error("Expected table cell to be inside of table.")}function lg(n){const e=Uc(n);return jc(e).getChildren().findIndex(t=>t.is(e))}function ag(n){return Uc(n).getChildren().findIndex(e=>e.is(n))}_s&&"InputEvent"in window&&!Vd&&new window.InputEvent("input");const wi=(n,e)=>n===lt.BOTH||n===e?e:lt.NO_STATUS;function cg(n=!0){const e=M();E(e)||j(e)||D(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=_t(t),[i,,s]=_t(r),[,l,a]=bt(s,i,o),{startRow:c}=a,{startRow:u}=l;return n?Ni(c+o.__rowSpan>u+i.__rowSpan?o:i,!0):Ni(u<c?i:o,!1)}function Ni(n,e=!0){const[,,t]=_t(n),[r,o]=bt(t,n,n),i=r[0].length,{startRow:s}=o;let l=null;if(e){const a=s+n.__rowSpan-1,c=r[a],u=ir();for(let d=0;d<i;d++){const{cell:g,startRow:h}=c[d];if(h+g.__rowSpan-1<=a){const p=c[d].cell.__headerState,_=wi(p,lt.COLUMN);u.append(qt(_).append(H()))}else g.setRowSpan(g.__rowSpan+1)}const f=t.getChildAtIndex(a);rt(f)||D(256),f.insertAfter(u),l=u}else{const a=s,c=r[a],u=ir();for(let d=0;d<i;d++){const{cell:g,startRow:h}=c[d];if(h===a){const p=c[d].cell.__headerState,_=wi(p,lt.COLUMN);u.append(qt(_).append(H()))}else g.setRowSpan(g.__rowSpan+1)}const f=t.getChildAtIndex(a);rt(f)||D(257),f.insertBefore(u),l=u}return l}function ug(n=!0){const e=M();E(e)||j(e)||D(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=_t(t),[i,,s]=_t(r),[,l,a]=bt(s,i,o),{startColumn:c}=a,{startColumn:u}=l;return n?Ti(c+o.__colSpan>u+i.__colSpan?o:i,!0):Ti(u<c?i:o,!1)}function Ti(n,e=!0,t=!0){const[,,r]=_t(n),[o,i]=bt(r,n,n),s=o.length,{startColumn:l}=i,a=e?l+n.__colSpan-1:l-1,c=r.getFirstChild();rt(c)||D(120);let u=null;function f(h=lt.NO_STATUS){const p=qt(h).append(H());return u===null&&(u=p),p}let d=c;t:for(let h=0;h<s;h++){if(h!==0){const N=d.getNextSibling();rt(N)||D(121),d=N}const p=o[h],_=p[a<0?0:a].cell.__headerState,m=wi(_,lt.ROW);if(a<0){ms(d,f(m));continue}const{cell:y,startColumn:C,startRow:v}=p[a];if(C+y.__colSpan-1<=a){let N=y,S=v,T=a;for(;S!==h&&N.__rowSpan>1;){if(T-=y.__colSpan,!(T>=0)){d.append(f(m));continue t}{const{cell:k,startRow:w}=p[T];N=k,S=w}}N.insertAfter(f(m))}else y.setColSpan(y.__colSpan+1)}u!==null&&t&&sr(u);const g=r.getColWidths();if(g){const h=[...g],p=a<0?0:a,_=h[p];h.splice(p,0,_),r.setColWidths(h)}return u}function fg(){const n=M();E(n)||j(n)||D(188);const[e,t]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,o]=_t(e),[i]=_t(t),[s,l,a]=bt(o,r,i),{startRow:c}=l,{startRow:u}=a,f=u+i.__rowSpan-1;if(s.length===f-c+1)return void o.remove();const d=s[0].length,g=s[f+1],h=o.getChildAtIndex(f+1);for(let p=f;p>=c;p--){for(let m=d-1;m>=0;m--){const{cell:y,startRow:C,startColumn:v}=s[p][m];if(v===m){if(C<c||C+y.__rowSpan-1>f){const N=Math.max(C,c),S=Math.min(y.__rowSpan+C-1,f),T=N<=S?S-N+1:0;y.setRowSpan(y.__rowSpan-T)}if(C>=c&&C+y.__rowSpan-1>f&&p===f){h===null&&D(122);let N=null;for(let S=0;S<m;S++){const T=g[S],k=T.cell;T.startRow===p+1&&(N=k),k.__colSpan>1&&(S+=k.__colSpan-1)}N===null?ms(h,y):N.insertAfter(y)}}}const _=o.getChildAtIndex(p);rt(_)||D(206,String(p)),_.remove()}if(g!==void 0){const{cell:p}=g[0];sr(p)}else{const p=s[c-1],{cell:_}=p[0];sr(_)}}function dg(){const n=M();E(n)||j(n)||D(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=_t(e),[i]=_t(t),[s,l,a]=bt(o,r,i),{startColumn:c}=l,{startRow:u,startColumn:f}=a,d=Math.min(c,f),g=Math.max(c+r.__colSpan-1,f+i.__colSpan-1),h=g-d+1;if(s[0].length===g-d+1)return o.selectPrevious(),void o.remove();const p=s.length;for(let C=0;C<p;C++)for(let v=d;v<=g;v++){const{cell:N,startColumn:S}=s[C][v];if(S<d){if(v===d){const T=d-S;N.setColSpan(N.__colSpan-Math.min(h,N.__colSpan-T))}}else if(S+N.__colSpan-1>g){if(v===g){const T=g-S+1;N.setColSpan(N.__colSpan-T)}}else N.remove()}const _=s[u],m=c>f?_[c+r.__colSpan]:_[f+i.__colSpan];if(m!==void 0){const{cell:C}=m;sr(C)}else{const C=f<c?_[f-1]:_[c-1],{cell:v}=C;sr(v)}const y=o.getColWidths();if(y){const C=[...y];C.splice(d,h),o.setColWidths(C)}}function sr(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function ms(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function qd(n){if(n.length===0)return null;const e=jc(n[0]),[t]=me(e,null,null);let r=1/0,o=-1/0,i=1/0,s=-1/0;const l=new Set;for(const g of t)for(const h of g){if(!h||!h.cell)continue;const p=h.cell.getKey();if(!l.has(p)&&n.some(_=>_.is(h.cell))){l.add(p);const _=h.startRow,m=h.startColumn,y=h.cell.__rowSpan||1,C=h.cell.__colSpan||1;r=Math.min(r,_),o=Math.max(o,_+y-1),i=Math.min(i,m),s=Math.max(s,m+C-1)}}if(r===1/0||i===1/0)return null;const a=o-r+1,c=s-i+1,u=t[r][i];if(!u.cell)return null;const f=u.cell;f.setColSpan(c),f.setRowSpan(a);const d=new Set([f.getKey()]);for(let g=r;g<=o;g++)for(let h=i;h<=s;h++){const p=t[g][h];if(!p.cell)continue;const _=p.cell,m=_.getKey();d.has(m)||(d.add(m),Xd(_)||f.append(..._.getChildren()),_.remove())}return f.getChildrenSize()===0&&f.append(H()),f}function Xd(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!fr(e)||!e.isEmpty())}function hg(){const n=M();E(n)||j(n)||D(188);const e=n.anchor.getNode(),t=B(e,L);return L(t)||D(148),Vc(t)}function Vc(n){const[e,t,r]=_t(n),o=e.__colSpan,i=e.__rowSpan;if(o===1&&i===1)return;const[s,l]=bt(r,e,e),{startColumn:a,startRow:c}=l,u=e.__headerState<.COLUMN,f=Array.from({length:o},(h,p)=>{let _=u;for(let m=0;_!==0&&m<s.length;m++)_&=s[m][p+a].cell.__headerState;return _}),d=e.__headerState<.ROW,g=Array.from({length:i},(h,p)=>{let _=d;for(let m=0;_!==0&&m<s[0].length;m++)_&=s[p+c][m].cell.__headerState;return _});if(o>1){for(let h=1;h<o;h++)e.insertAfter(qt(f[h]|g[0]).append(H()));e.setColSpan(1)}if(i>1){let h;for(let p=1;p<i;p++){const _=c+p,m=s[_];h=(h||t).getNextSibling(),rt(h)||D(125);let y=null;for(let C=0;C<a;C++){const v=m[C],N=v.cell;v.startRow===_&&(y=N),N.__colSpan>1&&(C+=N.__colSpan-1)}if(y===null)for(let C=o-1;C>=0;C--)ms(h,qt(f[C]|g[p]).append(H()));else for(let C=o-1;C>=0;C--)y.insertAfter(qt(f[C]|g[p]).append(H()))}e.setRowSpan(1)}}function bt(n,e,t){const[r,o,i]=me(n,e,t);return o===null&&D(207),i===null&&D(208),[r,o,i]}function me(n,e,t){const r=[];let o=null,i=null;function s(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];rt(c)||D(209);const u=s(a);for(let f=c.getFirstChild(),d=0;f!=null;f=f.getNextSibling()){for(L(f)||D(147);u[d]!==void 0;)d++;const g={cell:f,startColumn:d,startRow:a},{__rowSpan:h,__colSpan:p}=f;for(let _=0;_<h&&!(a+_>=l.length);_++){const m=s(a+_);for(let y=0;y<p;y++)m[d+y]=g}e!==null&&o===null&&e.is(f)&&(o=g),t!==null&&i===null&&t.is(f)&&(i=g)}}return[r,o,i]}function _t(n){let e;if(n instanceof ln)e=n;else if("__type"in n){const o=B(n,L);L(o)||D(148),e=o}else{const o=B(n.getNode(),L);L(o)||D(148),e=o}const t=e.getParent();rt(t)||D(149);const r=t.getParent();return ot(r)||D(210),[e,t,r]}function no(n,e,t){let r,o=Math.min(e.startColumn,t.startColumn),i=Math.min(e.startRow,t.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const f=u.startColumn+u.cell.__colSpan-1,d=u.startRow+u.cell.__rowSpan-1,g=u.startColumn<=s&&f>=o,h=u.startRow<=l&&d>=i;if(g&&h){const p=Math.min(o,u.startColumn),_=Math.max(s,f),m=Math.min(i,u.startRow),y=Math.max(l,d);p===o&&_===s&&m===i&&y===l||(o=p,s=_,i=m,l=y,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:o,minRow:i}}function $l(n){const[e,,t]=_t(n),r=t.getChildren(),o=r.length,i=r[0].getChildren().length,s=new Array(o);for(let l=0;l<o;l++)s[l]=new Array(i);for(let l=0;l<o;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;s[l][c];)c++;const f=a[u],d=f.__rowSpan||1,g=f.__colSpan||1;for(let h=0;h<d;h++)for(let p=0;p<g;p++)s[l+h][c+p]=f;if(e===f)return{colSpan:g,columnIndex:c,rowIndex:l,rowSpan:d};c+=g}}return null}function Pl(n){const[[e,t,r,o],[i,s,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),f=B(u,L);L(f)||D(238,c,u.getKey(),u.getType());const d=f.getParent();rt(d)||D(239,c);const g=d.getParent();return ot(g)||D(240,c),[u,f,d,g]});return o.is(a)||D(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:o,focusCell:s,focusNode:i,focusRow:l,focusTable:a}}let Yc=class qc{constructor(e,t,r){x(this,"tableKey");x(this,"anchor");x(this,"focus");x(this,"_cachedNodes");x(this,"dirty");this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=tt(this.tableKey),t=tt(this.anchor.key),r=tt(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return j(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new qc(this.tableKey,Dt(this.anchor.key,this.anchor.offset,this.anchor.type),Dt(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(L).forEach(o=>{const i=o.getFirstChild();fr(i)&&(t|=i.getTextFormat())});const r=Me[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();b(t)||D(151),Zn(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Pl(this),r=$l(e);r===null&&D(153);const o=$l(t);o===null&&D(155);const i=Math.min(r.columnIndex,o.columnIndex),s=Math.max(r.columnIndex+r.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(r.rowIndex,o.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(l,a),toX:Math.max(i,s),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:o}=Pl(this),i=o.getParents()[1];if(i!==t){if(t.isParentOf(o)){const _=i.getParent();_==null&&D(159),this.set(this.tableKey,o.getKey(),_.getKey())}else{const _=t.getParent();_==null&&D(158),this.set(this.tableKey,_.getKey(),o.getKey())}return this.getNodes()}const[s,l,a]=bt(t,r,o),{minColumn:c,maxColumn:u,minRow:f,maxRow:d}=no(s,l,a),g=new Map([[t.getKey(),t]]);let h=null;for(let _=f;_<=d;_++)for(let m=c;m<=u;m++){const{cell:y}=s[_][m],C=y.getParent();rt(C)||D(160),C!==h&&(g.set(C.getKey(),C),h=C),g.has(y.getKey())||Qd(y,v=>{g.set(v.getKey(),v)})}const p=Array.from(g.values());return Fn()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter(r=>L(r));let t="";for(let r=0;r<e.length;r++){const o=e[r],i=o.__parent,s=(e[r+1]||{}).__parent;t+=o.getTextContent()+(s!==i?`
|
|
14
14
|
`:" ")}return t}};function j(n){return n instanceof Yc}function Gd(){const n=Dt("root",0,"element"),e=Dt("root",0,"element");return new Yc("root",n,e)}function ki(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=M(),o=j(r)?r.clone():Gd();return o.set(n.getKey(),e.getKey(),t.getKey()),o}function Qd(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const o=r.pop();o===void 0?t.pop():e(o)!==!1&&b(o)&&t.push(o.getChildren())}}function Xc(n,e=Dn()){const t=tt(n);ot(t)||D(231,n);const r=en(t,e.getElementByKey(n));return r===null&&D(232,n),{tableElement:r,tableNode:t}}let Zd=class{constructor(){x(this,"observers");x(this,"nextFocus");x(this,"shouldCheckSelectionForTable");this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}},th=class{constructor(e,t){x(this,"focusX");x(this,"focusY");x(this,"listenersToRemove");x(this,"table");x(this,"isHighlightingCells");x(this,"anchorX");x(this,"anchorY");x(this,"tableNodeKey");x(this,"anchorCell");x(this,"focusCell");x(this,"anchorCellNodeKey");x(this,"focusCellNodeKey");x(this,"editor");x(this,"tableSelection");x(this,"hasHijackedSelectionStyles");x(this,"isSelecting");x(this,"pointerType");x(this,"abortController");x(this,"listenerOptions");this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach(e=>e()),this.listenersToRemove.clear()}$lookup(){return Xc(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver(t=>{this.editor.getEditorState().read(()=>{let r=!1;for(let s=0;s<t.length;s++){const l=t[s].target.nodeName;if(l==="TABLE"||l==="TBODY"||l==="THEAD"||l==="TR"){r=!0;break}}if(!r)return;const{tableNode:o,tableElement:i}=this.$lookup();this.table=wn(o,i)},{editor:this.editor})});this.editor.getEditorState().read(()=>{const{tableNode:t,tableElement:r}=this.$lookup();this.table=wn(t,r),e.observe(r,{attributes:!0,childList:!0,subtree:!0})},{editor:this.editor})}$clearHighlight(e=!0){const t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:r,tableElement:o}=this.$lookup();Tr(t,wn(r,o),null),e&&M()!==null&&(et(null),t.dispatchCommand(pe,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();ye(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();pt(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&D(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Tr(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){const e=wt(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const r=this.editor,{tableNode:o}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(t||this.anchorX!==i||this.anchorY!==s||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&i===this.focusX&&s===this.focusY)return!1;if(this.focusX=i,this.focusY=s,this.isHighlightingCells){const l=Oi(o,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let a=l;if(a===null&&t&&(a=o.getCellNodeFromCords(i,s,this.table)),a!==null){const c=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=a.getKey(),this.tableSelection=ki(o,c,a),et(this.tableSelection),r.dispatchCommand(pe,void 0),Tr(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?tt(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return e===null&&D(234),e}$getFocusTableCell(){return this.focusCellNodeKey?tt(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return e===null&&D(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),r=Oi(t,e.elem);if(r!==null){const o=r.getKey();this.tableSelection!=null?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),o,o)):this.tableSelection=ki(t,r,r),this.anchorCellNodeKey=o}}$formatCells(e){const t=M();j(t)||D(236);const r=fo(),o=r.anchor,i=r.focus,s=t.getNodes().filter(L);s.length>0||D(237);const l=s[0].getFirstChild(),a=fr(l)?l.getFormatFlags(e,null):null;s.forEach(c=>{o.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),r.formatText(e,a)}),et(t),this.editor.dispatchCommand(pe,void 0)}$clearText(){const{editor:e}=this,t=tt(this.tableNodeKey);if(!ot(t))throw new Error("Expected TableNode.");const r=M();j(r)||D(253);const o=r.getNodes().filter(L),i=t.getFirstChild(),s=t.getLastChild();if(o.length>0&&i!==null&&s!==null&&rt(i)&&rt(s)&&o[0]===i.getFirstChild()&&o[o.length-1]===s.getLastChild()){t.selectPrevious();const l=t.getParent();return t.remove(),void(at(l)&&l.isEmpty()&&e.dispatchCommand(Ye,void 0))}o.forEach(l=>{if(b(l)){const a=H(),c=st();a.append(c),l.append(a),l.getChildren().forEach(u=>{u!==a&&u.remove()})}}),Tr(e,this.table,null),et(null),e.dispatchCommand(pe,void 0)}};const bn="__lexicalTableSelection";function yn(n){return nt(n)&&n.nodeName==="TABLE"}function en(n,e){if(!e)return e;const t=yn(e)?e:n.getDOMSlot(e).element;return t.nodeName!=="TABLE"&&D(245,e.nodeName),t}function So(n){return n._window}function lr(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;L(t)&&(r=t)}return null}const eh=[[Bi,"down"],[Wi,"up"],[zi,"backward"],[Ii,"forward"]],nh=[Nn,qe,Ee],rh=[Ji,Ui];function oh(n,e){const t=n.getRootElement(),r=n._window;if(!t||!r)return()=>{};const o=i=>{const s=i.target;if(i.button!==0||!se(s)||!t.contains(s))return;const l=function(a){const c=ro(a);if(c===null)return null;let u=c.elem;for(;u!=null;){if(u.nodeName==="TABLE"&&bn in u&&u[bn])return{cellElement:c,tableElement:u,tableObserver:u[bn]};u=u.parentNode}return null}(s);n.update(()=>{if(j(M())){for(const[f]of e.observers.values())f.$clearHighlight(!1);et(null),n.dispatchCommand(pe,void 0)}if(!l)return;const{tableObserver:a,tableElement:c,cellElement:u}=l;(function(f,d,g,h,p,_){const m=f._window;if(!m)return;const y=N=>{if(p.isSelecting)return;p.isSelecting=!0,N!==null&&p.anchorCell===null&&f.update(()=>{p.$setAnchorCellForSelection(N)});const S=()=>{p.isSelecting=!1,m.removeEventListener("pointerup",S),m.removeEventListener("pointermove",T)},T=k=>{if(!($=>!(1&~$.buttons))(k)&&p.isSelecting)return p.isSelecting=!1,m.removeEventListener("pointerup",S),void m.removeEventListener("pointermove",T);if(!se(k.target))return;let w=null;const A=!(Fl||h.contains(k.target));if(A)w=Rl(h,k.target);else for(const $ of document.elementsFromPoint(k.clientX,k.clientY))if(w=Rl(h,$),w)break;if(w){const $=w;p.anchorCell===null&&f.update(()=>{p.$setAnchorCellForSelection($)}),p.focusCell!==null&&w.elem===p.focusCell.elem||(_.setNextFocus({focusCell:w,override:A,tableKey:p.tableNodeKey}),f.dispatchCommand(pe,void 0))}};m.addEventListener("pointerup",S,p.listenerOptions),m.addEventListener("pointermove",T,p.listenerOptions)};p.pointerType=d.pointerType;const C=Xn(p.tableNodeKey),v=Lt();if(Fl&&d.shiftKey&&fe(v,C)&&(E(v)||j(v))){const N=v.anchor.getNode(),S=lr(C,v.anchor.getNode());S?(p.$setAnchorCellForSelection(We(p,S)),p.$setFocusCellForSelection(g),ge(d)):(C.isBefore(N)?C.selectStart():C.selectEnd()).anchor.set(v.anchor.key,v.anchor.offset,v.anchor.type)}else d.pointerType!=="touch"&&p.$setAnchorCellForSelection(g);y(g)})(n,i,u,c,a,e)})};return r.addEventListener("pointerdown",o),()=>{r.removeEventListener("pointerdown",o)}}function ih(n,e,t,r,o){const i=t.getRootElement(),s=So(t);i!==null&&s!==null||D(246);const l=new th(t,n.getKey()),a=en(n,e);(function(d,g){Dl(d)!==null&&D(205),d[bn]=g})(a,l),l.listenersToRemove.add(()=>function(d,g){Dl(d)===g&&delete d[bn]}(a,l));const c=d=>{d.detail>=3&&se(d.target)&&ro(d.target)!==null&&d.preventDefault()};a.addEventListener("mousedown",c,l.listenerOptions),l.listenersToRemove.add(()=>{a.removeEventListener("mousedown",c)});for(const[d,g]of eh)l.listenersToRemove.add(t.registerCommand(d,h=>Zc(t,h,g,n,l,o),Wt));l.listenersToRemove.add(t.registerCommand(Hi,d=>{const g=M();if(j(g)){const h=lr(n,g.focus.getNode());if(h!==null)return ge(d),h.selectEnd(),!0}return!1},Wt));const u=d=>()=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$clearText(),!0;if(E(g)){if(!L(lr(n,g.anchor.getNode())))return!1;const h=g.anchor.getNode(),p=g.focus.getNode(),_=n.isParentOf(h),m=n.isParentOf(p);if(_&&!m||m&&!_)return l.$clearText(),!0;const y=B(g.anchor.getNode(),v=>b(v)),C=y&&B(y,v=>b(v)&&L(v.getParent()));if(!b(C)||!b(y))return!1;if(d===qe&&C.getPreviousSibling()===null)return!0}return!1};for(const d of nh)l.listenersToRemove.add(t.registerCommand(d,u(d),Wt));const f=d=>{const g=M();if(!j(g)&&!E(g))return!1;const h=n.isParentOf(g.anchor.getNode());if(h!==n.isParentOf(g.focus.getNode())){const p=h?"anchor":"focus",_=h?"focus":"anchor",{key:m,offset:y,type:C}=g[_];return n[g[p].isBefore(g[_])?"selectPrevious":"selectNext"]()[_].set(m,y,C),!1}return!!fe(g,n)&&!!j(g)&&(d&&(d.preventDefault(),d.stopPropagation()),l.$clearText(),!0)};for(const d of rh)l.listenersToRemove.add(t.registerCommand(d,f,Wt));return l.listenersToRemove.add(t.registerCommand(co,d=>{const g=M();if(g){if(!j(g)&&!E(g))return!1;vi(t,Te(d,ClipboardEvent)?d:null,Hc(g));const h=f(d);return E(g)?(g.removeText(),!0):h}return!1},Wt)),l.listenersToRemove.add(t.registerCommand(_e,d=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$formatCells(d),!0;if(E(g)){const h=B(g.anchor.getNode(),p=>L(p));if(!L(h))return!1}return!1},Wt)),l.listenersToRemove.add(t.registerCommand(va,d=>{const g=M();if(!j(g)||!fe(g,n))return!1;const h=g.anchor.getNode(),p=g.focus.getNode();if(!L(h)||!L(p))return!1;if(function(k,w){if(j(k)){const A=k.anchor.getNode(),$=k.focus.getNode();if(w&&A&&$){const[K]=bt(w,A,$);return A.getKey()===K[0][0].cell.getKey()&&$.getKey()===K[K.length-1].at(-1).cell.getKey()}}return!1}(g,n))return n.setFormat(d),!0;const[_,m,y]=bt(n,h,p),C=Math.max(m.startRow+m.cell.__rowSpan-1,y.startRow+y.cell.__rowSpan-1),v=Math.max(m.startColumn+m.cell.__colSpan-1,y.startColumn+y.cell.__colSpan-1),N=Math.min(m.startRow,y.startRow),S=Math.min(m.startColumn,y.startColumn),T=new Set;for(let k=N;k<=C;k++)for(let w=S;w<=v;w++){const A=_[k][w].cell;if(T.has(A))continue;T.add(A),A.setFormat(d);const $=A.getChildren();for(let K=0;K<$.length;K++){const I=$[K];b(I)&&!I.isInline()&&I.setFormat(d)}}return!0},Wt)),l.listenersToRemove.add(t.registerCommand(Be,d=>{const g=M();if(!fe(g,n))return!1;if(j(g))return l.$clearHighlight(),!1;if(E(g)){const h=B(g.anchor.getNode(),p=>L(p));if(!L(h))return!1;if(typeof d=="string"){const p=Kl(t,g,n);if(p)return Ll(p,n,[st(d)]),!0}}return!1},Wt)),r&&l.listenersToRemove.add(t.registerCommand(ji,d=>{const g=M();if(!E(g)||!g.isCollapsed()||!fe(g,n))return!1;const h=Jn(g.anchor.getNode());return!(h===null||!n.is(En(h)))&&(ge(d),function(p,_){const m=_==="next"?"getNextSibling":"getPreviousSibling",y=_==="next"?"getFirstChild":"getLastChild",C=p[m]();if(b(C))return C.selectEnd();const v=B(p,rt);v===null&&D(247);for(let S=v[m]();rt(S);S=S[m]()){const T=S[y]();if(b(T))return T.selectEnd()}const N=B(v,ot);N===null&&D(248),_==="next"?N.selectNext():N.selectPrevious()}(h,d.shiftKey?"previous":"next"),!0)},Wt)),l.listenersToRemove.add(t.registerCommand(Na,d=>n.isSelected(),Wt)),l.listenersToRemove.add(t.registerCommand(Ye,()=>{const d=M();if(!E(d)||!d.isCollapsed()||!fe(d,n))return!1;const g=Kl(t,d,n);return!!g&&(Ll(g,n),!0)},Wt)),l}function sh(n,e){const t=M(),r=Lt(),o=n.getAndClearNextFocus();if(o!==null){const{tableKey:l,focusCell:a}=o,c=n.observers.get(l);c||D(335,l);const[u]=c;if(j(t)&&t.tableKey===u.tableNodeKey)return(a.x!==u.focusX||a.y!==u.focusY)&&(u.$setFocusCellForSelection(a),!0);if(u.anchorCell!==null&&u.anchorCellNodeKey!==null&&a.elem!==u.anchorCell.elem&&u.tableSelection!==null)return u.$setFocusCellForSelection(a,!0),!0}const i=n.getAndClearShouldCheckSelectionForTable();if(i&&E(r)&&E(t)&&t.isCollapsed()){const l=Xn(i),a=t.anchor.getNode(),c=l.getFirstChild(),u=Jn(a);if(u!==null&&rt(c)){const f=c.getFirstChild();if(L(f)&&l.is(B(u,d=>d.is(l)||d.is(f))))return f.selectStart(),!0}}j(t)&&function(l,a){const c=So(l),u=Lt();if(!a.is(u))return;const f=Xn(a.tableKey),d=wt(c);if(d&&d.anchorNode&&d.focusNode){const g=Rt(d.focusNode),h=g&&!f.isParentOf(g),p=Rt(d.anchorNode),_=p&&f.isParentOf(p);if(h&&_&&d.rangeCount>0){const m=mf(d,l);m&&(m.anchor.set(f.getKey(),a.isBackward()?f.getChildrenSize():0,"element"),d.removeAllRanges(),et(m))}}}(e,t),E(t)&&function(l,a){const c=Lt(),{anchor:u,focus:f}=l,d=u.getNode(),g=f.getNode(),h=Jn(d),p=Jn(g),_=h?En(h):null,m=p?En(p):null,y=l.isBackward(),C=h&&p&&_&&m&&_.is(m),v=m&&(!_||_.isParentOf(m)),N=_&&(!m||m.isParentOf(_));if(v){const S=l.clone(),[T]=bt(m,p,p),k=T[0][0].cell,w=T[T.length-1].at(-1).cell;S.focus.set(y?k.getKey():w.getKey(),y?0:w.getChildrenSize(),"element"),et(S)}else if(N){const S=l.clone(),[T]=bt(_,h,h),k=T[0][0].cell,w=T[T.length-1].at(-1).cell;S.anchor.set(y?w.getKey():k.getKey(),y?w.getChildrenSize():0,"element"),et(S)}else if(C){const S=a.observers.get(_.getKey());S||D(335,_.getKey());const[T]=S;if(h.is(p)||(T.$setAnchorCellForSelection(We(T,h)),T.$setFocusCellForSelection(We(T,p),!0)),T.pointerType==="touch"&&T.isSelecting&&l.isCollapsed()&&E(c)&&c.isCollapsed()){const k=Jn(c.anchor.getNode());k&&!k.is(p)&&(T.$setAnchorCellForSelection(We(T,k)),T.$setFocusCellForSelection(We(T,p),!0),T.pointerType=null)}}}(t,n);const s=n.observers.entries().map(([l,[a]])=>({tableNode:Xn(l),tableObserver:a})).toArray();for(const{tableNode:l,tableObserver:a}of s)lh(e,l,a);return!1}function lh(n,e,t){const r=M(),o=Lt();r&&!r.is(o)&&(j(r)||j(o))&&t.tableSelection&&!t.tableSelection.is(o)&&(j(r)&&r.tableKey===t.tableNodeKey?t.$updateTableTableSelection(r):!j(r)&&j(o)&&o.tableKey===t.tableNodeKey&&t.$updateTableTableSelection(null)),t.hasHijackedSelectionStyles&&!e.isSelected()?function(i,s){s.$enableHighlightStyle(),Ei(s.table,l=>{const a=l.elem;l.highlighted=!1,Qc(i,l),a.getAttribute("style")||a.removeAttribute("style")})}(n,t):!t.hasHijackedSelectionStyles&&e.isSelected()&&function(i,s){s.$disableHighlightStyle(),Ei(s.table,l=>{l.highlighted=!0,Gc(i,l)})}(n,t)}function Dl(n){return n[bn]||null}function ro(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function Rl(n,e){if(!n.contains(e))return null;let t=null;for(let r=e;r!=null;r=r.parentNode){if(r===n)return t;const o=r.nodeName;o!=="TD"&&o!=="TH"||(t=r._cell||null)}return null}function wn(n,e){const t=[],r={columns:0,domRows:t,rows:0};let o=en(n,e).querySelector("tr"),i=0,s=0;for(t.length=0;o!=null;){const l=o.nodeName;if(l==="TD"||l==="TH"){const u={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:i,y:s};o._cell=u;let f=t[s];f===void 0&&(f=t[s]=[]),f[i]=u}else{const u=o.firstChild;if(u!=null){o=u;continue}}const a=o.nextSibling;if(a!=null){i++,o=a;continue}const c=o.parentNode;if(c!=null){const u=c.nextSibling;if(u==null)break;s++,i=0,o=u}}return r.columns=i+1,r.rows=s+1,r}function Tr(n,e,t){const r=new Set(t?t.getNodes():[]);Ei(e,(o,i)=>{const s=o.elem;r.has(i)?(o.highlighted=!0,Gc(n,o)):(o.highlighted=!1,Qc(n,o),s.getAttribute("style")||s.removeAttribute("style"))})}function Ei(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const o=t[r];if(o)for(let i=0;i<o.length;i++){const s=o[i];if(!s)continue;const l=Rt(s.elem);l!==null&&e(s,l,{x:i,y:r})}}}const ah=(n,e,t,r,o)=>{const i=o==="forward";switch(o){case"backward":case"forward":return t!==(i?n.table.columns-1:0)?Er(e.getCellNodeFromCordsOrThrow(t+(i?1:-1),r,n.table),i):r!==(i?n.table.rows-1:0)?Er(e.getCellNodeFromCordsOrThrow(i?0:n.table.columns-1,r+(i?1:-1),n.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?Er(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?Er(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}};function Ho(n,e){let t,r;if(e.startColumn===n.minColumn)t="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==n.maxColumn)return null;t="maxColumn"}if(e.startRow===n.minRow)r="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==n.maxRow)return null;r="maxRow"}return[t,r]}function kr([n,e]){return[n==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function dn(n,e,[t,r]){const o=e[r],i=n[o];i===void 0&&D(250,r,String(o));const s=e[t],l=i[s];return l===void 0&&D(250,t,String(s)),l}function ch(n,e,t,r,o){const i=no(e,t,r),s=function(S,T){const{minColumn:k,maxColumn:w,minRow:A,maxRow:$}=T;let K=1,I=1,z=1,G=1;const dt=S[A],Mt=S[$];for(let ut=k;ut<=w;ut++)K=Math.max(K,dt[ut].cell.__rowSpan),G=Math.max(G,Mt[ut].cell.__rowSpan);for(let ut=A;ut<=$;ut++)I=Math.max(I,S[ut][k].cell.__colSpan),z=Math.max(z,S[ut][w].cell.__colSpan);return{bottomSpan:G,leftSpan:I,rightSpan:z,topSpan:K}}(e,i),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,f=function(S,T){const k=Ho(S,T);return k===null&&D(249,T.cell.getKey()),k}(i,t),[d,g]=kr(f);let h=i[d],p=i[g];o==="forward"?h+=d==="maxColumn"?1:a:o==="backward"?h-=d==="minColumn"?1:u:o==="down"?p+=g==="maxRow"?1:l:o==="up"&&(p-=g==="minRow"?1:c);const _=e[p];if(_===void 0)return!1;const m=_[h];if(m===void 0)return!1;const[y,C]=function(S,T,k){const w=no(S,T,k),A=Ho(w,T);if(A)return[dn(S,w,A),dn(S,w,kr(A))];const $=Ho(w,k);if($)return[dn(S,w,kr($)),dn(S,w,$)];const K=["minColumn","minRow"];return[dn(S,w,K),dn(S,w,kr(K))]}(e,t,m),v=We(n,y.cell),N=We(n,C.cell);return n.$setAnchorCellForSelection(v),n.$setFocusCellForSelection(N,!0),!0}function fe(n,e){if(E(n)||j(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function Er(n,e){e?n.selectStart():n.selectEnd()}function Gc(n,e){const t=e.elem,r=n._config.theme;L(Rt(t))||D(131),pt(t,r.tableCellSelected)}function Qc(n,e){const t=e.elem;L(Rt(t))||D(131);const r=n._config.theme;ye(t,r.tableCellSelected)}function Jn(n){const e=B(n,L);return L(e)?e:null}function En(n){const e=B(n,ot);return ot(e)?e:null}function uh(n,e,t,r,o,i,s){const l=Xt(t.focus,o?"previous":"next");if(fs(l))return!1;let a=l;for(const _ of or(l).iterNodeCarets("shadowRoot")){if(!Fe(_)||!b(_.origin))return!1;a=_}const c=a.getParentAtCaret();if(!L(c))return!1;const u=c,f=function(_){for(const m of or(_).iterNodeCarets("root")){const{origin:y}=m;if(L(y)){if(Ot(m))return vt(y,_.direction)}else if(!rt(y))break}return null}(it(u,a.direction)),d=B(u,ot);if(!d||!d.is(i))return!1;const g=n.getElementByKey(u.getKey()),h=ro(g);if(!g||!h)return!1;const p=fh(n,d);if(s.table=p,f)if(r==="extend"){const _=ro(n.getElementByKey(f.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(_,!0)}else{const _=kt(f);jt(t.anchor,_),jt(t.focus,_)}else if(r==="extend")s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{const _=function(m){const y=tn(m);return Ot(y)?kt(y):m}(it(d,l.direction));jt(t.anchor,_),jt(t.focus,_)}return ge(e),!0}function Zc(n,e,t,r,o,i){if((t==="up"||t==="down")&&function(l){const a=l.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=M();if(!fe(s,r)){if(E(s)){if(t==="backward"){if(s.focus.offset>0)return!1;const l=function(c){for(let u=c,f=c;f!==null;u=f,f=f.getParent())if(b(f)){if(f!==u&&f.getFirstChild()!==u)return null;if(!f.isInline())return f}return null}(s.focus.getNode());if(!l)return!1;const a=l.getPreviousSibling();return!!ot(a)&&(ge(e),e.shiftKey?s.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const l=s.focus.getNode();if(!s.isCollapsed()&&(t==="up"&&!s.isBackward()||t==="down"&&s.isBackward())){let a=B(l,g=>ot(g));if(L(a)&&(a=B(a,ot)),a!==r||!a)return!1;const c=t==="down"?a.getNextSibling():a.getPreviousSibling();if(!c)return!1;let u=0;t==="up"&&b(c)&&(u=c.getChildrenSize());let f=c;t==="up"&&b(c)&&(f=c.getLastChild()||c,u=F(f)?f.getTextContentSize():0);const d=s.clone();return d.focus.set(f.getKey(),u,F(f)?"text":"element"),et(d),ge(e),!0}if(Et(l)){const a=t==="up"?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(a&&lr(r,a)!==null){const c=r.getFirstDescendant(),u=r.getLastDescendant();if(!c||!u)return!1;const[f]=_t(c),[d]=_t(u),g=r.getCordsFromCellNode(f,o.table),h=r.getCordsFromCellNode(d,o.table),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table),_=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table);return o.$setAnchorCellForSelection(p),o.$setFocusCellForSelection(_,!0),!0}return!1}{let a=B(l,u=>b(u)&&!u.isInline());if(L(a)&&(a=B(a,ot)),!a)return!1;const c=t==="down"?a.getNextSibling():a.getPreviousSibling();if(ot(c)&&o.tableNodeKey===c.getKey()){const u=c.getFirstDescendant(),f=c.getLastDescendant();if(!u||!f)return!1;const[d]=_t(u),[g]=_t(f),h=s.clone();return h.focus.set((t==="up"?d:g).getKey(),t==="up"?0:g.getChildrenSize(),"element"),ge(e),et(h),!0}}}}return t==="down"&&Ai(n)&&i.setShouldCheckSelectionForTable(r.getKey()),!1}if(E(s)){if(t==="backward"||t==="forward")return uh(n,e,s,e.shiftKey?"extend":"move",t==="backward",r,o);if(s.isCollapsed()){const{anchor:l,focus:a}=s,c=B(l.getNode(),L),u=B(a.getNode(),L);if(!L(c)||!c.is(u))return!1;const f=En(c);if(f!==r&&f!=null){const y=en(f,n.getElementByKey(f.getKey()));if(y!=null)return o.table=wn(f,y),Zc(n,e,t,f,o,i)}const d=n.getElementByKey(c.__key),g=n.getElementByKey(l.key);if(g==null||d==null)return!1;let h;if(l.type==="element")h=g.getBoundingClientRect();else{const y=wt(So(n));if(y===null||y.rangeCount===0)return!1;h=y.getRangeAt(0).getBoundingClientRect()}const p=t==="up"?c.getFirstChild():c.getLastChild();if(p==null)return!1;const _=n.getElementByKey(p.__key);if(_==null)return!1;const m=_.getBoundingClientRect();if(t==="up"?m.top>h.top-h.height:h.bottom+h.height>m.bottom){ge(e);const y=r.getCordsFromCellNode(c,o.table);if(!e.shiftKey)return ah(o,r,y.x,y.y,t);{const C=r.getDOMCellFromCordsOrThrow(y.x,y.y,o.table);o.$setAnchorCellForSelection(C),o.$setFocusCellForSelection(C,!0)}return!0}}}else if(j(s)){const{anchor:l,focus:a}=s,c=B(l.getNode(),L),u=B(a.getNode(),L),[f]=s.getNodes();ot(f)||D(251);const d=en(f,n.getElementByKey(f.getKey()));if(!L(c)||!L(u)||!ot(f)||d==null)return!1;o.$updateTableTableSelection(s);const g=wn(f,d),h=r.getCordsFromCellNode(c,g),p=r.getDOMCellFromCordsOrThrow(h.x,h.y,g);if(o.$setAnchorCellForSelection(p),ge(e),e.shiftKey){const[_,m,y]=bt(r,c,u);return ch(o,_,m,y,t)}return u.selectEnd(),!0}return!1}function ge(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Ll(n,e,t){const r=H();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function Kl(n,e,t){const r=t.getParent();if(!r)return;const o=wt(So(n));if(!o)return;const i=o.anchorNode,s=n.getElementByKey(r.getKey()),l=en(t,n.getElementByKey(t.getKey()));if(!i||!s||!l||!s.contains(i)||l.contains(i))return;const a=B(e.anchor.getNode(),y=>L(y));if(!a)return;const c=B(a,y=>ot(y));if(!ot(c)||!c.is(t))return;const[u,f]=bt(t,a,a),d=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:h,startColumn:p}=f,_=h===d.startRow&&p===d.startColumn,m=h===g.startRow&&p===g.startColumn;return _?"first":m?"last":void 0}function We(n,e){const{tableNode:t}=n.$lookup(),r=t.getCordsFromCellNode(e,n.table);return t.getDOMCellFromCordsOrThrow(r.x,r.y,n.table)}function Oi(n,e,t){return lr(n,Rt(e,t))}function Il(n,e,t){const r=n.querySelector("colgroup");if(!r)return;const o=[];for(let i=0;i<e;i++){const s=document.createElement("col"),l=t&&t[i];l&&(s.style.width=`${l}px`),o.push(s)}r.replaceChildren(...o)}function zl(n,e,t){if(!e.theme.tableAlignment)return;const r=[],o=[];for(const i of["center","right"]){const s=e.theme.tableAlignment[i];s&&(i===t?o:r).push(s)}ye(n,...r),pt(n,...o)}const tu=new WeakSet;function Ai(n=Dn()){return tu.has(n)}function _g(n,e){tu.add(n)}class nn extends At{constructor(t){super(t);x(this,"__rowStriping");x(this,"__frozenColumnCount");x(this,"__frozenRowCount");x(this,"__colWidths");this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(t){const r=this.getWritable();return r.__colWidths=t,r}static clone(t){return new nn(t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__colWidths=t.__colWidths,this.__rowStriping=t.__rowStriping,this.__frozenColumnCount=t.__frozenColumnCount,this.__frozenRowCount=t.__frozenRowCount}static importDOM(){return{table:t=>({conversion:dh,priority:1})}}static importJSON(t){return ys().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setRowStriping(t.rowStriping||!1).setFrozenColumns(t.frozenColumnCount||0).setFrozenRows(t.frozenRowCount||0).setColWidths(t.colWidths)}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(t,r,o){return o==="html"}getDOMSlot(t){const r=yn(t)?t:t.querySelector("table");return yn(r)||D(229),super.getDOMSlot(t).withElement(r).withAfter(r.querySelector("colgroup"))}createDOM(t,r){const o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);const i=document.createElement("colgroup");if(o.appendChild(i),Kf(i),pt(o,t.theme.table),this.updateTableElement(null,o,t),Ai(r)){const s=document.createElement("div"),l=t.theme.tableScrollableWrapper;return l?pt(s,l):s.style.cssText="overflow-x: auto;",s.appendChild(o),this.updateTableWrapper(null,s,o,t),s}return o}updateTableWrapper(t,r,o,i){this.__frozenColumnCount!==(t?t.__frozenColumnCount:0)&&function(s,l,a,c){c>0?(pt(s,a.theme.tableFrozenColumn),l.setAttribute("data-lexical-frozen-column","true")):(ye(s,a.theme.tableFrozenColumn),l.removeAttribute("data-lexical-frozen-column"))}(r,o,i,this.__frozenColumnCount),this.__frozenRowCount!==(t?t.__frozenRowCount:0)&&function(s,l,a,c){c>0?(pt(s,a.theme.tableFrozenRow),l.setAttribute("data-lexical-frozen-row","true")):(ye(s,a.theme.tableFrozenRow),l.removeAttribute("data-lexical-frozen-row"))}(r,o,i,this.__frozenRowCount)}updateTableElement(t,r,o){this.__style!==(t?t.__style:"")&&(r.style.cssText=this.__style),this.__rowStriping!==(!!t&&t.__rowStriping)&&function(l,a,c){c?(pt(l,a.theme.tableRowStriping),l.setAttribute("data-lexical-row-striping","true")):(ye(l,a.theme.tableRowStriping),l.removeAttribute("data-lexical-row-striping"))}(r,o,this.__rowStriping);const i=t?t.getColumnCount():0,s=t?t.__colWidths:void 0;this.getColumnCount()===i&&this.getColWidths()===s||Il(r,this.getColumnCount(),this.getColWidths()),zl(r,o,this.getFormatType())}updateDOM(t,r,o){const i=this.getDOMSlot(r).element;return r===i===Ai()||(nt(s=r)&&s.nodeName==="DIV"&&this.updateTableWrapper(t,r,i,o),this.updateTableElement(t,i,o),!1);var s}scaleDOMColWidths(t,r){const o=this.getColWidths();o&&Il(this.getDOMSlot(t).element,this.getColumnCount(),o.map(i=>i*r))}exportDOM(t){const r=super.exportDOM(t),{element:o}=r;return{after:i=>{if(r.after&&(i=r.after(i)),!yn(i)&&nt(i)&&(i=i.querySelector("table")),!yn(i))return null;zl(i,t._config,this.getFormatType());const[s]=me(this,null,null),l=new Map;for(const f of s)for(const d of f){const g=d.cell.getKey();l.has(g)||l.set(g,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const a=new Set;for(const f of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=f.getAttribute("data-temporary-table-cell-lexical-key");if(d){const g=l.get(d);if(f.removeAttribute("data-temporary-table-cell-lexical-key"),g){l.delete(d);for(let h=0;h<g.colSpan;h++)a.add(h+g.startColumn)}}}const c=i.querySelector(":scope > colgroup");if(c){const f=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,g)=>a.has(g));c.replaceChildren(...f)}const u=i.querySelectorAll(":scope > tr");if(u.length>0){const f=document.createElement("tbody");for(const d of u)f.appendChild(d);i.append(f)}return i},element:!yn(o)&&nt(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(t,r){const{rows:o,domRows:i}=r;for(let s=0;s<o;s++){const l=i[s];if(l!=null)for(let a=0;a<l.length;a++){const c=l[a];if(c==null)continue;const{elem:u}=c,f=Oi(this,u);if(f!==null&&t.is(f))return{x:a,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(t,r,o){const{domRows:i}=o,s=i[r];if(s==null)return null;const l=s[t<s.length?t:s.length-1];return l??null}getDOMCellFromCordsOrThrow(t,r,o){const i=this.getDOMCellFromCords(t,r,o);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(t,r,o){const i=this.getDOMCellFromCords(t,r,o);if(i==null)return null;const s=Rt(i.elem);return L(s)?s:null}getCellNodeFromCordsOrThrow(t,r,o){const i=this.getCellNodeFromCords(t,r,o);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(t){const r=this.getWritable();return r.__rowStriping=t,r}setFrozenColumns(t){const r=this.getWritable();return r.__frozenColumnCount=t,r}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(t){const r=this.getWritable();return r.__frozenRowCount=t,r}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const t=this.getFirstChild();if(!t)return 0;let r=0;return t.getChildren().forEach(o=>{L(o)&&(r+=o.getColSpan())}),r}}function fh(n,e){const t=n.getElementByKey(e.getKey());return t===null&&D(230),wn(e,t)}function dh(n){const e=ys();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const o of t.querySelectorAll(":scope > col")){let i=o.style.width||"";if(!ps.test(i)&&(i=o.getAttribute("width")||"",!/^\d+$/.test(i))){r=void 0;break}r.push(parseFloat(i))}r&&e.setColWidths(r)}return{after:r=>Oc(r,rt),node:e}}function ys(){return Ht(new nn)}function ot(n){return n instanceof nn}function hh(n){rt(n.getParent())?n.isEmpty()&&n.append(H()):n.remove()}function gh(n){ot(n.getParent())?kc(n,L):n.remove()}function ph(n){kc(n,rt);const[e]=me(n,null,null),t=e.reduce((s,l)=>Math.max(s,l.length),0),r=n.getChildren();for(let s=0;s<e.length;++s){const l=r[s];if(!l)continue;rt(l)||D(254,l.constructor.name,l.getType());const a=e[s].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=qt();u.append(H()),l.append(u)}}const o=n.getColWidths(),i=n.getColumnCount();if(o&&o.length!==i){let s;if(i<o.length)s=o.slice(0,i);else if(o.length>0){const l=o[o.length-1];s=[...o,...Array(i-o.length).fill(l)]}n.setColWidths(s)}}function _h(n){if(n.detail<3||!se(n.target))return!1;const e=Rt(n.target);if(e===null)return!1;const t=B(e,r=>b(r)&&!r.isInline());return t===null?!1:!!L(t.getParent())&&(t.select(0),!0)}function mh(){const n=M();if(!E(n))return!1;const e=En(n.anchor.getNode());if(e===null)return!1;const t=ct();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=me(e,null,null);if(r.length===0||r[0].length===0)return!1;const o=r[0][0];if(!o||!o.cell)return!1;const i=r[r.length-1],s=i[i.length-1];if(!s||!s.cell)return!1;const l=ki(e,o.cell,s.cell);return et(l),!0}function mg(n){return n.registerNodeTransform(ln,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){const[,,t]=_t(e),[r]=bt(t,e,e),o=r.length,i=r[0].length;let s=t.getFirstChild();rt(s)||D(175);const l=[];for(let a=0;a<o;a++){a!==0&&(s=s.getNextSibling(),rt(s)||D(175));let c=null;for(let u=0;u<i;u++){const f=r[a][u],d=f.cell;if(f.startRow===a&&f.startColumn===u)c=d,l.push(d);else if(d.getColSpan()>1||d.getRowSpan()>1){L(d)||D(176);const g=qt(d.__headerState);c!==null?c.insertAfter(g):Cd(s,g)}}}for(const a of l)a.setColSpan(1),a.setRowSpan(1)}})}function yg(n,e=!0){const t=new Zd,r=(o,i,s)=>{const l=en(o,s),a=ih(o,l,n,e,t);t.observers.set(i,[a,l])};return De(oh(n,t),n.registerCommand(pe,()=>sh(t,n),Wt),n.registerMutationListener(nn,o=>{n.getEditorState().read(()=>{for(const[i,s]of o){const l=t.observers.get(i);if(s==="created"||s==="updated"){const{tableNode:a,tableElement:c}=Xc(i);l===void 0?r(a,i,c):c!==l[1]&&(l[0].removeListeners(),t.observers.delete(i),r(a,i,c))}else s==="destroyed"&&l!==void 0&&(l[0].removeListeners(),t.observers.delete(i))}},{editor:n})},{skipInitialization:!1}),()=>{for(const[,[o]]of t.observers)o.removeListeners()})}function Cg(n,e){n.hasNodes([nn])||D(255);const{hasNestedTables:t=Mc(!1)}={};return De(n.registerCommand(Ud,r=>function({rows:o,columns:i,includeHeaders:s},l){const a=M()||Lt();if(!a||!E(a)||!l&&En(a.anchor.getNode()))return!1;const c=Yd(Number(o),Number(i),s);md(c);const u=c.getFirstDescendant();return F(u)&&u.select(),!0}(r,t.peek()),W),n.registerCommand(ga,(r,o)=>n===o&&function(i,s){const{nodes:l,selection:a}=i;if(!l.some(f=>ot(f)||ud(f).some(d=>ot(d.node))))return!1;const c=j(a),u=E(a);return u&&B(a.anchor.getNode(),f=>L(f))!==null&&B(a.focus.getNode(),f=>L(f))!==null||c?l.length===1&&ot(l[0])?function(f,d){const g=d.getStartEndPoints(),h=j(d);if(g===null)return!1;const[p,_]=g,[m,y,C]=_t(p),v=B(_.getNode(),V=>L(V));if(!(L(m)&&L(v)&&rt(y)&&ot(C)))return!1;const[N,S,T]=bt(C,m,v),[k]=me(f,null,null),w=N.length,A=w>0?N[0].length:0;let $=S.startRow,K=S.startColumn,I=k.length,z=I>0?k[0].length:0;if(h){const V=no(N,S,T),St=V.maxRow-V.minRow+1,xt=V.maxColumn-V.minColumn+1;$=V.minRow,K=V.minColumn,I=Math.min(I,St),z=Math.min(z,xt)}let G=!1;const dt=Math.min(w,$+I)-1,Mt=Math.min(A,K+z)-1,ut=new Set;for(let V=$;V<=dt;V++)for(let St=K;St<=Mt;St++){const xt=N[V][St];ut.has(xt.cell.getKey())||xt.cell.__rowSpan===1&&xt.cell.__colSpan===1||(Vc(xt.cell),ut.add(xt.cell.getKey()),G=!0)}let[Nt]=me(C.getWritable(),null,null);const be=I-w+$;for(let V=0;V<be;V++)Ni(Nt[w-1][0].cell);const Ln=z-A+K;for(let V=0;V<Ln;V++)Ti(Nt[0][A-1].cell,!0,!1);[Nt]=me(C.getWritable(),null,null);for(let V=$;V<$+I;V++)for(let St=K;St<K+z;St++){const xt=V-$,we=St-K,It=k[xt][we];if(It.startRow!==xt||It.startColumn!==we)continue;const Qt=It.cell;if(Qt.__rowSpan!==1||Qt.__colSpan!==1){const zt=[],cu=Math.min(V+Qt.__rowSpan,$+I)-1,uu=Math.min(St+Qt.__colSpan,K+z)-1;for(let To=V;To<=cu;To++)for(let ko=St;ko<=uu;ko++){const fu=Nt[To][ko];zt.push(fu.cell)}qd(zt),G=!0}const{cell:Zt}=Nt[V][St],te=Qt.getBackgroundColor();te!=null&&Zt.setBackgroundColor(te);const Le=Zt.getChildren();Qt.getChildren().forEach(zt=>{F(zt)&&H().append(zt),Zt.append(zt)}),Le.forEach(zt=>zt.remove())}if(h&&G){const[V]=me(C.getWritable(),null,null);V[S.startRow][S.startColumn].cell.selectEnd()}return!0}(l[0],a):!(u&&s.peek()&&!function(f){return!!(j(f)&&!f.focus.getNode().is(f.anchor.getNode())||E(f)&&L(f.anchor.getNode())&&!f.anchor.getNode().is(f.focus.getNode()))}(a)):!1}(r,t),W),n.registerCommand(jr,mh,_n),n.registerCommand(Di,_h,W),n.registerNodeTransform(nn,ph),n.registerNodeTransform(_r,gh),n.registerNodeTransform(ln,hh))}function Sg(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const o=n.getRootElement();if(document.activeElement!==o)return;const i=r.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){const l=s.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,f,d,g]=a;n.update(()=>{const h=M();if(E(h)){const p=h.anchor;let _=p.getNode(),m=0,y=0;if(F(_)&&c>=0&&u>=0&&(m=c,y=c+u,h.setTextNodeRange(_,m,_,y)),m===y&&f===""||(h.insertRawText(f),_=p.getNode()),F(_)){m=d,y=d+g;const C=_.getTextContentSize();m=m>C?C:m,y=y>C?C:y,h.setTextNodeRange(_,m,_,y)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Wl(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const an=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,yh=an&&"documentMode"in document?document.documentMode:null,Ch=an&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Sh=!(!an||!("InputEvent"in window)||yh)&&"getTargetRanges"in new window.InputEvent("input"),xh=an&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Bl=an&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vh=an&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bh=an&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ch&&!vh,Jl=R("DRAG_DROP_PASTE_FILE");class xo extends At{static getType(){return"quote"}static clone(e){return new xo(e.__key)}createDOM(e){const t=document.createElement("blockquote");return pt(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:wh,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(nt(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){return eu().updateFromJSON(e)}insertNewAfter(e,t){const r=H(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,t),r}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function eu(){return Ht(new xo)}function xg(n){return n instanceof xo}class vo extends At{constructor(t="h1",r){super(r);x(this,"__tag");this.__tag=t}static getType(){return"heading"}static clone(t){return new vo(t.__tag,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__tag=t.__tag}getTag(){return this.getLatest().__tag}setTag(t){const r=this.getWritable();return r.__tag=t,r}createDOM(t){const r=this.__tag,o=document.createElement(r),i=t.theme.heading;if(i!==void 0){const s=i[r];pt(o,s)}return o}updateDOM(t,r,o){return t.__tag!==this.__tag}static importDOM(){return{h1:t=>({conversion:hn,priority:0}),h2:t=>({conversion:hn,priority:0}),h3:t=>({conversion:hn,priority:0}),h4:t=>({conversion:hn,priority:0}),h5:t=>({conversion:hn,priority:0}),h6:t=>({conversion:hn,priority:0}),p:t=>{const r=t.firstChild;return r!==null&&Hl(r)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Hl(t)?{conversion:r=>({node:Hn("h1")}),priority:3}:null}}exportDOM(t){const{element:r}=super.exportDOM(t);if(nt(r)){this.isEmpty()&&r.append(document.createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}static importJSON(t){return Hn(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,r=!0){const o=t?t.anchor.offset:0,i=this.getLastDescendant(),s=!i||t&&t.anchor.key===i.getKey()&&o===i.getTextContentSize()||!t?H():Hn(this.getTag()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&t){const a=H();a.select(),this.replace(a,!0)}return s}collapseAtStart(){const t=this.isEmpty()?H():Hn(this.getTag());return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}extractWithChild(){return!0}}function Hl(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function hn(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Hn(e),n.style!==null&&(ls(n,t),t.setFormat(n.style.textAlign))),{node:t}}function wh(n){const e=eu();return n.style!==null&&(e.setFormat(n.style.textAlign),ls(n,e)),{node:e}}function Hn(n="h1"){return Ht(new vo(n))}function vg(n){return n instanceof vo}function Or(n){let e=null;if(Te(n,DragEvent)?e=n.dataTransfer:Te(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function Ul(n){const e=Rt(n);return Y(e)}function Uo(n){for(const e of["lowercase","uppercase","capitalize"])n.hasFormat(e)&&n.toggleFormat(e)}function bg(n){return De(n.registerCommand(Di,e=>{const t=M();return!!Ft(t)&&(t.clear(),!0)},W),n.registerCommand(Ee,e=>{const t=M();return E(t)?(t.deleteCharacter(e),!0):!!Ft(t)&&(t.deleteNodes(),!0)},W),n.registerCommand(Nn,e=>{const t=M();return!!E(t)&&(t.deleteWord(e),!0)},W),n.registerCommand(qe,e=>{const t=M();return!!E(t)&&(t.deleteLine(e),!0)},W),n.registerCommand(Be,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)El(r,t,n);else if(E(t)){const o=e.data;return o&&t.insertText(o),!0}}return!0},W),n.registerCommand(oi,()=>{const e=M();return!!E(e)&&(e.removeText(),!0)},W),n.registerCommand(_e,e=>{const t=M();return!!E(t)&&(t.formatText(e),!0)},W),n.registerCommand(va,e=>{const t=M();if(!E(t)&&!Ft(t))return!1;const r=t.getNodes();for(const o of r){const i=B(o,s=>b(s)&&!s.isInline());i!==null&&i.setFormat(e)}return!0},W),n.registerCommand(Sn,e=>{const t=M();return!!E(t)&&(t.insertLineBreak(e),!0)},W),n.registerCommand(Ye,()=>{const e=M();return!!E(e)&&(e.insertParagraph(),!0)},W),n.registerCommand(Hu,()=>{const e=Mn(),t=M();return E(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Cf([e]),!0},W),n.registerCommand(Uu,()=>Sl(e=>{const t=e.getIndent();e.setIndent(t+1)}),W),n.registerCommand(Fs,()=>Sl(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),W),n.registerCommand(Wi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}else if(E(t)){const r=gi(t.focus,!0);if(!e.shiftKey&&Y(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},W),n.registerCommand(Bi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}else if(E(t)){if(function(o){const i=o.focus;return i.key==="root"&&i.offset===ct().getChildrenSize()}(t))return e.preventDefault(),!0;const r=gi(t.focus,!1);if(!e.shiftKey&&Y(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},W),n.registerCommand(zi,e=>{const t=M();if(Ft(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),ml(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!E(t))return!1;if(yl(t,!0)){const r=e.shiftKey;return e.preventDefault(),Cl(t,r,!0),!0}return!1},W),n.registerCommand(Ii,e=>{const t=M();if(Ft(t)){const o=t.getNodes();if(o.length>0)return e.preventDefault(),ml(o[0])?o[0].selectPrevious():o[0].selectNext(0,0),!0}if(!E(t))return!1;const r=e.shiftKey;return!!yl(t,!1)&&(e.preventDefault(),Cl(t,r,!1),!0)},W),n.registerCommand(Ji,e=>{if(Ul(e.target))return!1;const t=M();if(E(t)){if(function(r){if(!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;const i=o.getNode();if(at(i))return!1;const s=_d(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))}(t))return e.preventDefault(),n.dispatchCommand(Fs,void 0);if(Bl&&navigator.language==="ko-KR")return!1}else if(!Ft(t))return!1;return e.preventDefault(),n.dispatchCommand(Ee,!0)},W),n.registerCommand(Ui,e=>{if(Ul(e.target))return!1;const t=M();return!(!E(t)&&!Ft(t))&&(e.preventDefault(),n.dispatchCommand(Ee,!1))},W),n.registerCommand(Ur,e=>{const t=M();if(!E(t))return!1;if(Uo(t),e!==null){if((Bl||xh||bh)&&Sh)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(Sn,!1)}return n.dispatchCommand(Ye,void 0)},W),n.registerCommand(Hi,()=>{const e=M();return!!E(e)&&(n.blur(),!0)},W),n.registerCommand(xa,e=>{const[,t]=Or(e);if(t.length>0){const o=Wl(e.clientX,e.clientY);if(o!==null){const{offset:i,node:s}=o,l=Rt(s);if(l!==null){const a=fo();if(F(l))a.anchor.set(l.getKey(),i,"text"),a.focus.set(l.getKey(),i,"text");else{const u=l.getParentOrThrow().getKey(),f=l.getIndexWithinParent()+1;a.anchor.set(u,f,"element"),a.focus.set(u,f,"element")}const c=Zn(a);et(c)}n.dispatchCommand(Jl,t)}return e.preventDefault(),!0}const r=M();return!!E(r)},W),n.registerCommand(ba,e=>{const[t]=Or(e),r=M();return!(t&&!E(r))},W),n.registerCommand(wa,e=>{const[t]=Or(e),r=M();if(t&&!E(r))return!1;const o=Wl(e.clientX,e.clientY);if(o!==null){const i=Rt(o.node);Y(i)&&e.preventDefault()}return!0},W),n.registerCommand(jr,()=>(Mf(),!0),W),n.registerCommand(ao,e=>(vi(n,Te(e,ClipboardEvent)?e:null),!0),W),n.registerCommand(co,e=>(async function(t,r){await vi(r,Te(t,ClipboardEvent)?t:null),r.update(()=>{const o=M();E(o)?o.removeText():Ft(o)&&o.getNodes().forEach(i=>i.remove())})}(e,n),!0),W),n.registerCommand(Ri,e=>{const[,t,r]=Or(e);return t.length>0&&!r?(n.dispatchCommand(Jl,t),!0):se(e.target)&&Zi(e.target)?!1:M()!==null&&(function(o,i){o.preventDefault(),i.update(()=>{const s=M(),l=Te(o,InputEvent)||Te(o,KeyboardEvent)?null:o.clipboardData;l!=null&&s!==null&&El(l,s,i)},{tag:of})}(e,n),!0)},W),n.registerCommand(Sa,e=>{const t=M();return E(t)&&Uo(t),!1},W),n.registerCommand(ji,e=>{const t=M();return E(t)&&Uo(t),!1},W))}function ke(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Mi(n){let e=1,t=n.getParent();for(;t!=null;){if(U(t)){const r=t.getParent();if(J(r)){e++,t=r.getParent();continue}ke(40)}return e}return e}function Fi(n){let e=n.getParent();J(e)||ke(40);let t=e;for(;t!==null;)t=t.getParent(),J(t)&&(e=t);return e}function nu(n){let e=[];const t=n.getChildren().filter(U);for(let r=0;r<t.length;r++){const o=t[r],i=o.getFirstChild();J(i)?e=e.concat(nu(i)):e.push(o)}return e}function ne(n){return U(n)&&J(n.getFirstChild())}function jl(n){return Rn().append(n)}function ru(n,e){return U(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Vl(n){const e=M();if(e!==null){let t=e.getNodes();if(E(e)){const o=e.getStartEndPoints();o===null&&ke(143);const[i]=o,s=i.getNode(),l=s.getParent();if(Et(s)){const a=s.getFirstChild();if(a)t=a.selectStart().getNodes();else{const c=H();s.append(c),t=c.select().getNodes()}}else if(ru(s,t)){const a=Ue(n);if(Et(l)){s.replace(a);const c=Rn();b(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),a.append(c)}else if(U(s)){const c=s.getParentOrThrow();rn(a,c.getChildren()),c.replace(a)}return}}const r=new Set;for(let o=0;o<t.length;o++){const i=t[o];if(b(i)&&i.isEmpty()&&!U(i)&&!r.has(i.getKey())){Yl(i,n);continue}let s=nc(i)?i.getParent():U(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(J(s)){if(!r.has(l)){const a=Ue(n);rn(a,s.getChildren()),s.replace(a),r.add(l)}break}{const a=s.getParent();if(Et(a)&&!r.has(l)){r.add(l),Yl(s,n);break}s=a}}}}}function rn(n,e){n.splice(n.getChildrenSize(),0,e)}function Yl(n,e){if(J(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),o=Rn();let i;if(rn(o,n.getChildren()),J(t)&&e===t.getListType())t.append(o),J(r)&&e===r.getListType()&&(rn(t,r.getChildren()),r.remove()),i=t;else if(J(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=Ue(e);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=M();return E(s)&&(i.getKey()===s.anchor.key&&s.anchor.set(o.getKey(),s.anchor.offset,"element"),i.getKey()===s.focus.key&&s.focus.set(o.getKey(),s.focus.offset,"element")),n.remove(),i}function Cs(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&ne(t)&&ne(r)&&(Cs(t.getFirstChild(),r.getFirstChild()),r.remove());const o=e.getChildren();o.length>0&&n.append(...o),e.remove()}function Nh(){const n=M();if(E(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(ru(r,t))e.add(Fi(r));else for(let o=0;o<t.length;o++){const i=t[o];if(nc(i)){const s=pd(i,bo);s!=null&&e.add(Fi(s))}}for(const o of e){let i=o;const s=nu(o);for(const l of s){const a=H().setTextStyle(n.style).setTextFormat(n.format);rn(a,l.getChildren()),i.insertAfter(a),i=a,l.__key===n.anchor.key&&jt(n.anchor,kt(vt(a,"next"))),l.__key===n.focus.key&&jt(n.focus,kt(vt(a,"next"))),l.remove()}o.remove()}}}function ou(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())U(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),J(r.getFirstChild())||t++)}function Th(n){const e=new Set;if(ne(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(ne(r)&&ne(o)){const i=o.getFirstChild();if(J(i)){i.append(n);const s=r.getFirstChild();J(s)&&(rn(i,s.getChildren()),r.remove(),e.add(r.getKey()))}}else if(ne(r)){const i=r.getFirstChild();if(J(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(ne(o)){const i=o.getFirstChild();J(i)&&i.append(n)}else if(J(t)){const i=$t(n),s=$t(t);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):t.append(i)}}function kh(n){if(ne(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(J(t?t.getParent():void 0)&&U(t)&&J(e)){const r=e?e.getFirstChild():void 0,o=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(o))t.insertAfter(n),e.isEmpty()&&t.remove();else{const i=$t(n),s=$t(e);i.append(s),n.getPreviousSiblings().forEach(c=>s.append(c));const l=$t(n),a=$t(e);l.append(a),rn(a,n.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(n)}}}function Eh(n=!1){const e=M();if(!E(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();let r=null;if(U(t)&&t.getChildrenSize()===0)r=t;else if(F(t)){const c=t.getParent();U(c)&&c.getChildren().every(u=>F(u)&&u.getTextContent().trim()==="")&&(r=c)}if(r===null)return!1;const o=Fi(r),i=r.getParent();J(i)||ke(40);const s=i.getParent();let l;if(Et(s))l=H(),o.insertAfter(l);else{if(!U(s))return!1;l=$t(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const a=r.getNextSiblings();if(a.length>0){const c=n?function(f,d){return f.getStart()+d.getIndexWithinParent()}(i,r):1,u=$t(i).setStart(c);if(U(l)){const f=$t(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...a)}return function(c){let u=c;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!U(f)&&!J(f))break;u=f}u.remove()}(r),!0}class bo extends At{constructor(t=1,r=void 0,o){super(o);x(this,"__value");x(this,"__checked");this.__value=t===void 0?1:t,this.__checked=r}$config(){return this.config("listitem",{$transform:t=>{if(t.__checked==null)return;const r=t.getParent();J(r)&&r.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0)},extends:At,importDOM:{li:()=>({conversion:Oh,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked}createDOM(t){const r=document.createElement("li");return this.updateListItemDOM(null,r,t),r}updateListItemDOM(t,r,o){(function(l,a,c){const u=a.getParent();!J(u)||u.getListType()!=="check"||J(a.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),c&&a.__checked===c.__checked||l.setAttribute("aria-checked",a.getChecked()?"true":"false"))})(r,this,t),r.value=this.__value,function(l,a,c){const u=[],f=[],d=a.list,g=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),g!==void 0&&u.push(...Pe(g)),d){const p=c.getParent(),_=J(p)&&p.getListType()==="check",m=c.getChecked();_&&!m||f.push(d.listitemUnchecked),_&&m||f.push(d.listitemChecked),_&&u.push(m?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const p=Pe(h);c.getChildren().some(_=>J(_))?u.push(...p):f.push(...p)}f.length>0&&ye(l,...f),u.length>0&&pt(l,...u)}(r,o.theme,this);const i=t?t.__style:"",s=this.__style;i!==s&&(s===""?r.removeAttribute("style"):r.style.cssText=s),function(l,a,c){const u=_l(a.__textStyle);for(const f in u)l.style.setProperty(`--listitem-marker-${f}`,u[f]);if(c)for(const f in _l(c.__textStyle))f in u||l.style.removeProperty(`--listitem-marker-${f}`)}(r,this,t)}updateDOM(t,r,o){const i=r;return this.updateListItemDOM(t,i,o),!1}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const r=this.createDOM(t._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let r=0;r<t.length;r++){const o=t[r];if(b(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(t,r){if(U(t))return super.replace(t);this.setIndent(0);const o=this.getParentOrThrow();if(!J(o))return t;if(o.__first===this.getKey())o.insertBefore(t);else if(o.__last===this.getKey())o.insertAfter(t);else{const i=$t(o);let s=this.getNextSibling();for(;s;){const l=s;s=s.getNextSibling(),i.append(l)}o.insertAfter(t),t.insertAfter(i)}return r&&(b(t)||ke(139),this.getChildren().forEach(i=>{t.append(i)})),this.remove(),o.getChildrenSize()===0&&o.remove(),t}insertAfter(t,r=!0){const o=this.getParentOrThrow();if(J(o)||ke(39),U(t))return super.insertAfter(t,r);const i=this.getNextSiblings();if(o.insertAfter(t,r),i.length!==0){const s=$t(o);i.forEach(l=>s.append(l)),t.insertAfter(s,r)}return t}remove(t){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(t),r&&o&&ne(r)&&ne(o)&&(Cs(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(t){super.resetOnCopyNodeFrom(t),t.getChecked()&&this.setChecked(!1)}insertNewAfter(t,r=!0){const o=$t(this);return this.insertAfter(o,r),o}collapseAtStart(t){const r=H();this.getChildren().forEach(l=>r.append(l));const o=this.getParentOrThrow(),i=o.getParentOrThrow(),s=U(i);if(o.getChildrenSize()===1)if(s)o.remove(),i.select();else{o.insertBefore(r),o.remove();const l=t.anchor,a=t.focus,c=r.getKey();l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element")}else o.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(t){const r=this.getWritable();return r.__value=t,r}getChecked(){const t=this.getLatest();let r;const o=this.getParent();return J(o)&&(r=o.getListType()),r==="check"?!!t.__checked:void 0}setChecked(t){const r=this.getWritable();return r.__checked=t,r}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(t===null||!this.isAttached())return this.getLatest().__indent;let r=t.getParentOrThrow(),o=0;for(;U(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(t){typeof t!="number"&&ke(117),(t=Math.floor(t))>=0||ke(199);let r=this.getIndent();for(;r!==t;)r<t?(Th(this),r++):(kh(this),r--);return this}canInsertAfter(t){return U(t)}canReplaceWith(t){return U(t)}canMergeWith(t){return U(t)||fr(t)}extractWithChild(t,r){if(!E(r))return!1;const o=r.anchor.getNode(),i=r.focus.getNode();return this.isParentOf(o)&&this.isParentOf(i)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Ue("bullet")}canMergeWhenEmpty(){return!0}}function Oh(n){if(n.classList.contains("task-list-item")){for(const t of n.children)if(t.tagName==="INPUT")return ql(t)}if(n.classList.contains("joplin-checkbox")){for(const t of n.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&t.children[0].tagName==="INPUT")return ql(t.children[0])}const e=n.getAttribute("aria-checked");return{node:Rn(e==="true"||e!=="false"&&void 0)}}function ql(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:Rn(n.hasAttribute("checked"))}}function Rn(n){return Ht(new bo(void 0,n))}function U(n){return n instanceof bo}class Ss extends At{constructor(t="number",r=1,o){super(o);x(this,"__tag");x(this,"__start");x(this,"__listType");const i=Mh[t]||t;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:t=>{(function(r){const o=r.getNextSibling();J(o)&&r.getListType()===o.getListType()&&Cs(r,o)})(t),ou(t)},extends:At,importDOM:{ol:()=>({conversion:Gl,priority:0}),ul:()=>({conversion:Gl,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start}getTag(){return this.getLatest().__tag}setListType(t){const r=this.getWritable();return r.__listType=t,r.__tag=t==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const r=this.getWritable();return r.__start=t,r}createDOM(t,r){const o=this.__tag,i=document.createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,Xl(i,t.theme,this),i}updateDOM(t,r,o){return t.__tag!==this.__tag||t.__listType!==this.__listType||(Xl(r,o.theme,this),t.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const r=this.createDOM(t._config,t);return nt(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(t,r,o){const i=o.find(U)??this.getChildren().find(U),s=i?()=>$t(i):Rn;let l=o;for(let a=0;a<o.length;a++){const c=o[a];U(c)||(l===o&&(l=[...o]),l[a]=s().append(!b(c)||J(c)||c.isInline()?c:st(c.getTextContent())))}return super.splice(t,r,l)}extractWithChild(t){return U(t)}}function Xl(n,e,t){const r=[],o=[],i=e.list;if(i!==void 0){const s=i[`${t.__tag}Depth`]||[],l=Mi(t)-1,a=l%s.length,c=s[a],u=i[t.__tag];let f;const d=i.nested,g=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),g!==void 0&&t.__listType==="check"&&r.push(g),c!==void 0){r.push(...Pe(c));for(let h=0;h<s.length;h++)h!==a&&o.push(t.__tag+h)}if(f!==void 0){const h=Pe(f);l>1?r.push(...h):o.push(...h)}}o.length>0&&ye(n,...o),r.length>0&&pt(n,...r)}function Ah(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t];if(U(r)){e.push(r);const o=r.getChildren();o.length>1&&o.forEach(i=>{J(i)&&e.push(jl(i))})}else e.push(jl(r))}return e}function Gl(n){const e=n.nodeName.toLowerCase();let t=null;return e==="ol"?t=Ue("number",n.start):e==="ul"&&(t=function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const o of r.childNodes)if(nt(o)&&o.hasAttribute("aria-checked"))return!0;return!1}(n)?Ue("check"):Ue("bullet")),{after:Ah,node:t}}const Mh={ol:"number",ul:"bullet"};function Ue(n="number",e=1){return Ht(new Ss(n,e))}function J(n){return n instanceof Ss}const Fh=R("UPDATE_LIST_START_COMMAND"),$h=R("INSERT_UNORDERED_LIST_COMMAND"),Ph=R("INSERT_ORDERED_LIST_COMMAND"),Dh=R("REMOVE_LIST_COMMAND");function wg(n,e){return De(n.registerCommand(Ph,()=>(Vl("number"),!0),_n),n.registerCommand(Fh,t=>{const{listNodeKey:r,newStart:o}=t,i=tt(r);return!!J(i)&&(i.getListType()==="number"&&(i.setStart(o),ou(i)),!0)},_n),n.registerCommand($h,()=>(Vl("bullet"),!0),_n),n.registerCommand(Dh,()=>(Nh(),!0),_n),n.registerCommand(Ye,()=>Eh(!1),_n),n.registerNodeTransform(bo,t=>{const r=t.getFirstChild();if(r){if(F(r)){const o=r.getStyle(),i=r.getFormat();t.getTextStyle()!==o&&t.setTextStyle(o),t.getTextFormat()!==i&&t.setTextFormat(i)}}else{const o=M();E(o)&&(o.style!==t.getTextStyle()||o.format!==t.getTextFormat())&&o.isCollapsed()&&t.is(o.anchor.getNode())&&t.setTextStyle(o.style).setTextFormat(o.format)}}),n.registerNodeTransform(xe,t=>{const r=t.getParent();if(U(r)&&t.is(r.getFirstChild())){const o=t.getStyle(),i=t.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function Ng(n){const e=t=>{const r=t.getParent();if(J(t.getFirstChild())||!J(r))return;const o=B(t,i=>U(i)&&J(i.getParent())&&U(i.getPreviousSibling()));if(o===null&&t.getIndent()>0)t.setIndent(0);else if(U(o)){const i=o.getPreviousSibling();if(U(i)){const s=function(a){let c=a,u=c.getFirstChild();for(;J(u);){const f=u.getLastChild();if(!U(f))break;c=f,u=c.getFirstChild()}return c}(i),l=s.getParent();if(J(l)){const a=Mi(l);a+1<Mi(r)&&t.setIndent(a)}}}};return n.registerNodeTransform(Ss,t=>{const r=[t];for(;r.length>0;){const o=r.shift();if(J(o)){for(const i of o.getChildren())if(U(i)){e(i);const s=i.getFirstChild();J(s)&&r.push(s)}}}})}function iu(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function su(n,e){let t=n;for(let r=it(n,e);r&&(de(r.origin)||cr(r.origin));r=r.getAdjacentCaret())t=r.origin;return t}function Rh(n){return su(n,"previous")}function Lh(n){return su(n,"next")}function Tg(n,e){let t=null,r=null,o=n,i=e,s=n.getTextContent();for(;;){if(i===0){if(o=o.getPreviousSibling(),o===null)break;if(de(o)||cr(o)||Jt(o)||iu(167),Jt(o)){t={node:o,offset:1};break}i=Math.max(0,o.getTextContentSize()-1),s=o.getTextContent()}else i--;const a=s[i];de(o)&&a!==" "&&(r={node:o,offset:i})}if(r!==null)return r;let l=null;if(e<n.getTextContentSize())de(n)&&(l=n.getTextContent()[e]);else{const a=n.getNextSibling();de(a)&&(l=a.getTextContent()[0])}if(l!==null&&l!==" ")return t;{const a=function(c,u){let f=c,d=u,g=c.getTextContent(),h=c.getTextContentSize();for(;;){if(!de(f)||d===h){if(f=f.getNextSibling(),f===null||Jt(f))return null;de(f)&&(d=0,g=f.getTextContent(),h=f.getTextContentSize())}if(de(f)){if(g[d]!==" ")return{node:f,offset:d};d++}}}(n,e);return a!==null?a:t}}function kg(n){const e=Lh(n);return Jt(e)&&iu(168),e}const Eg="javascript";function lu(n,e){for(const t of n.childNodes){if(nt(t)&&t.tagName===e)return!0;lu(t,e)}return!1}const Un="data-language",Wn="data-highlight-language",Ar="data-theme";class wo extends At{constructor(t,r){super(r);x(this,"__language");x(this,"__theme");x(this,"__isSyntaxHighlightSupported");this.__language=t||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}static getType(){return"code"}static clone(t){return new wo(t.__language,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported}createDOM(t){const r=document.createElement("code");pt(r,t.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Un,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Wn,o));const i=this.getTheme();i&&r.setAttribute(Ar,i);const s=this.getStyle();return s&&r.setAttribute("style",s),r}updateDOM(t,r,o){const i=this.__language,s=t.__language;i?i!==s&&r.setAttribute(Un,i):s&&r.removeAttribute(Un);const l=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(Wn,i):r.removeAttribute(Wn):l&&i&&r.setAttribute(Wn,i);const a=this.__theme,c=t.__theme;a?a!==c&&r.setAttribute(Ar,a):c&&r.removeAttribute(Ar);const u=this.__style,f=t.__style;return u?u!==f&&r.setAttribute("style",u):f&&r.removeAttribute("style"),!1}exportDOM(t){const r=document.createElement("pre");pt(r,t._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Un,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(Wn,o));const i=this.getTheme();i&&r.setAttribute(Ar,i);const s=this.getStyle();return s&&r.setAttribute("style",s),{element:r}}static importDOM(){return{code:t=>t.textContent!=null&&(/\r?\n/.test(t.textContent)||lu(t,"BR"))?{conversion:Ql,priority:1}:null,div:()=>({conversion:Ih,priority:1}),pre:()=>({conversion:Ql,priority:0}),table:t=>jo(t)?{conversion:zh,priority:3}:null,td:t=>{const r=t,o=r.closest("table");return r.classList.contains("js-file-line")||o&&jo(o)?{conversion:Zl,priority:3}:null},tr:t=>{const r=t.closest("table");return r&&jo(r)?{conversion:Zl,priority:3}:null}}}static importJSON(t){return mr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,r=!0){const o=this.getChildren(),i=o.length;if(i>=2&&o[i-1].getTextContent()===`
|
|
15
15
|
`&&o[i-2].getTextContent()===`
|
|
16
|
-
`&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===i){o[i-1].remove(),o[i-2].remove();const c=H();return this.insertAfter(c,r),c}const{anchor:s,focus:l}=t,a=(s.isBefore(l)?s:l).getNode();if(F(a)){let c=Rh(a);const u=[];for(;;)if(cr(c))u.push(Mn()),c=c.getNextSibling();else{if(!de(c))break;{let m=0;const y=c.getTextContent(),C=c.getTextContentSize();for(;m<C&&y[m]===" ";)m++;if(m!==0&&u.push(au(" ".repeat(m))),m!==C)break;c=c.getNextSibling()}}const f=a.splitText(s.offset)[0],d=s.offset===0?0:1,g=f.getIndexWithinParent()+d,h=a.getParentOrThrow(),p=[Ce(),...u];h.splice(g,0,p);const _=u[u.length-1];_?_.select():s.offset===0?f.selectPrevious():f.getNextSibling().selectNext(0,0)}if(Kh(a)){const{offset:c}=t.anchor;a.splice(c,0,[Ce()]),a.select(c+1,c+1)}return null}canIndent(){return!1}collapseAtStart(){const t=H();return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}setLanguage(t){const r=this.getWritable();return r.__language=t||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const r=this.getWritable();return r.__isSyntaxHighlightSupported=t,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const r=this.getWritable();return r.__theme=t||void 0,r}getTheme(){return this.getLatest().__theme}}function mr(n,e){return zf(wo).setLanguage(n).setTheme(e)}function Kh(n){return n instanceof wo}function Ql(n){return{node:mr(n.getAttribute(Un))}}function Ih(n){const e=n,t=ta(e);return t||function(r){let o=r.parentElement;for(;o!==null;){if(ta(o))return!0;o=o.parentElement}return!1}(e)?{node:t?mr():null}:{node:null}}function zh(){return{node:mr()}}function Zl(){return{node:null}}function ta(n){return n.style.fontFamily.match("monospace")!==null}function jo(n){return n.classList.contains("js-file-line-container")}class No extends xe{constructor(t="",r,o){super(t,o);x(this,"__highlightType");this.__highlightType=r}static getType(){return"code-highlight"}static clone(t){return new No(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__highlightType=t.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const r=this.getWritable();return r.__highlightType=t||void 0,r}canHaveFormat(){return!1}createDOM(t){const r=super.createDOM(t),o=Vo(t.theme,this.__highlightType);return pt(r,o),r}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=Vo(o.theme,t.__highlightType),l=Vo(o.theme,this.__highlightType);return s!==l&&(s&&ye(r,s),l&&pt(r,l)),i}static importJSON(t){return au().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return mr()}}function Vo(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function au(n="",e){return Ht(new No(n,e))}function de(n){return n instanceof No}export{M as $,At as A,et as B,Zn as C,Ri as D,Ur as E,Va as F,B as G,_n as H,ao as I,Ba as J,Hd as K,Y as L,Ji as M,ji as N,Ft as O,tt as P,Nf as Q,j as R,Ca as S,zi as T,Hi as U,H as V,Vn as W,Wt as X,fr as Y,Wi as Z,Hc as _,pt as a,mc as a$,Bi as a0,W as a1,fi as a2,rf as a3,Vl as a4,U as a5,J as a6,Zh as a7,de as a8,Cf as a9,
|
|
16
|
+
`&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===i){o[i-1].remove(),o[i-2].remove();const c=H();return this.insertAfter(c,r),c}const{anchor:s,focus:l}=t,a=(s.isBefore(l)?s:l).getNode();if(F(a)){let c=Rh(a);const u=[];for(;;)if(cr(c))u.push(Mn()),c=c.getNextSibling();else{if(!de(c))break;{let m=0;const y=c.getTextContent(),C=c.getTextContentSize();for(;m<C&&y[m]===" ";)m++;if(m!==0&&u.push(au(" ".repeat(m))),m!==C)break;c=c.getNextSibling()}}const f=a.splitText(s.offset)[0],d=s.offset===0?0:1,g=f.getIndexWithinParent()+d,h=a.getParentOrThrow(),p=[Ce(),...u];h.splice(g,0,p);const _=u[u.length-1];_?_.select():s.offset===0?f.selectPrevious():f.getNextSibling().selectNext(0,0)}if(Kh(a)){const{offset:c}=t.anchor;a.splice(c,0,[Ce()]),a.select(c+1,c+1)}return null}canIndent(){return!1}collapseAtStart(){const t=H();return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}setLanguage(t){const r=this.getWritable();return r.__language=t||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const r=this.getWritable();return r.__isSyntaxHighlightSupported=t,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const r=this.getWritable();return r.__theme=t||void 0,r}getTheme(){return this.getLatest().__theme}}function mr(n,e){return zf(wo).setLanguage(n).setTheme(e)}function Kh(n){return n instanceof wo}function Ql(n){return{node:mr(n.getAttribute(Un))}}function Ih(n){const e=n,t=ta(e);return t||function(r){let o=r.parentElement;for(;o!==null;){if(ta(o))return!0;o=o.parentElement}return!1}(e)?{node:t?mr():null}:{node:null}}function zh(){return{node:mr()}}function Zl(){return{node:null}}function ta(n){return n.style.fontFamily.match("monospace")!==null}function jo(n){return n.classList.contains("js-file-line-container")}class No extends xe{constructor(t="",r,o){super(t,o);x(this,"__highlightType");this.__highlightType=r}static getType(){return"code-highlight"}static clone(t){return new No(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__highlightType=t.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const r=this.getWritable();return r.__highlightType=t||void 0,r}canHaveFormat(){return!1}createDOM(t){const r=super.createDOM(t),o=Vo(t.theme,this.__highlightType);return pt(r,o),r}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=Vo(o.theme,t.__highlightType),l=Vo(o.theme,this.__highlightType);return s!==l&&(s&&ye(r,s),l&&pt(r,l)),i}static importJSON(t){return au().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return mr()}}function Vo(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function au(n="",e){return Ht(new No(n,e))}function de(n){return n instanceof No}export{M as $,At as A,et as B,Zn as C,Ri as D,Ur as E,Va as F,B as G,_n as H,ao as I,Ba as J,Hd as K,Y as L,Ji as M,ji as N,Ft as O,tt as P,Nf as Q,j as R,Ca as S,zi as T,Hi as U,H as V,Vn as W,Wt as X,fr as Y,Wi as Z,Hc as _,pt as a,mc as a$,Bi as a0,W as a1,fi as a2,rf as a3,Vl as a4,U as a5,J as a6,Zh as a7,de as a8,Cf as a9,Ki as aA,Li as aB,_e as aC,tg as aD,pe as aE,ga as aF,og as aG,jh as aH,Xt as aI,oe as aJ,$e as aK,vt as aL,tc as aM,Be as aN,wt as aO,wo as aP,No as aQ,Hu as aR,Mn as aS,Uu as aT,Fs as aU,Ju as aV,Bu as aW,Rh as aX,Lh as aY,Dt as aZ,_c as a_,Di as aa,vo as ab,xo as ac,Ce as ad,eu as ae,vg as af,Hn as ag,bg as ah,ad as ai,Sg as aj,Dd as ak,Sn as al,Ye as am,di as an,Jt as ao,vf as ap,Rt as aq,Et as ar,ng as as,Bh as at,Jh as au,Hh as av,Vh as aw,Yh as ax,Uh as ay,Xh as az,Gh as b,kt as b0,it as b1,Ze as b2,cr as b3,Tg as b4,kg as b5,Eg as b6,au as b7,Ss as b8,bo as b9,Yd as bA,md as bB,lg as bC,rt as bD,lf as bE,me as bF,cg as bG,ug as bH,fg as bI,dg as bJ,lt as bK,ag as bL,rg as bM,_d as bN,ro as bO,_t as bP,qd as bQ,hg as bR,An as bS,mr as bT,fh as bU,yr as bV,Cr as bW,wg as ba,Ng as bb,xa as bc,Jl as bd,nn as be,_r as bf,ln as bg,mg as bh,_g as bi,Cg as bj,yg as bk,sg as bl,jc as bm,en as bn,Dl as bo,Xc as bp,ye as bq,at as br,pd as bs,Ue as bt,Ph as bu,$h as bv,Rn as bw,Df as bx,Lt as by,En as bz,b as c,nt as d,Ga as e,L as f,ot as g,xg as h,eg as i,Rd as j,Ht as k,xe as l,fo as m,R as n,Gd as o,st as p,Af as q,De as r,sf as s,Qh as t,ui as u,Ii as v,E as w,Kh as x,F as y,ct as z};
|