sykpcomposer 1.19.80 → 1.19.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ImageComponent-ab673021.js → ImageComponent-cbbc75a7.js} +3 -3
- package/dist/{ImageComponent-ab673021.js.map → ImageComponent-cbbc75a7.js.map} +1 -1
- package/dist/{InlineImageComponent-0c629a95.js → InlineImageComponent-87535012.js} +3 -3
- package/dist/{InlineImageComponent-0c629a95.js.map → InlineImageComponent-87535012.js.map} +1 -1
- package/dist/{LexicalNestedComposer.prod-0cf0c291.js → LexicalNestedComposer.prod-18ab5af3.js} +2 -2
- package/dist/{LexicalNestedComposer.prod-0cf0c291.js.map → LexicalNestedComposer.prod-18ab5af3.js.map} +1 -1
- package/dist/{PollComponent-8900bdf7.js → PollComponent-91e26c75.js} +2 -2
- package/dist/{PollComponent-8900bdf7.js.map → PollComponent-91e26c75.js.map} +1 -1
- package/dist/{index-559cce1f.js → index-27f0705b.js} +7 -9
- package/dist/index-27f0705b.js.map +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-559cce1f.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -51,7 +51,7 @@ Check the top-level render call using <`+me+">.")}return Je}}function qt(Ae,Je){
|
|
|
51
51
|
`||i===`\r
|
|
52
52
|
`?l.insertParagraph():i===" "?l.insertNodes([lc()]):l.insertText(i)}}}else t.insertRawText(r)}function J_(c,t,n){c.dispatchCommand(pv,{nodes:t,selection:n})||n.insertNodes(t)}function V_(c,t,n,e=[]){let a=t===null||n.isSelected(t);const r=kt(n)&&n.excludeFromCopy("html");let o=n;if(t!==null){let i=Vb(n);i=Wt(i)&&t!==null?Kb(t,i):i,o=i}const s=kt(o)?o.getChildren():[],l=function(i){const u=i.exportJSON(),d=i.constructor;if(u.type!==d.getType()&&pp(58,d.name),kt(i)){const p=u.children;Array.isArray(p)||pp(59,d.name)}return u}(o);if(Wt(o)){const i=o.__text;i.length>0?l.text=i:a=!1}for(let i=0;i<s.length;i++){const u=s[i],d=V_(c,t,u,l.children);!a&&kt(n)&&d&&n.extractWithChild(u,t,"clone")&&(a=!0)}if(a&&!r)e.push(l);else if(Array.isArray(l.children))for(let i=0;i<l.children.length;i++){const u=l.children[i];e.push(u)}return a}function P2(c,t){const n=[],e=Un().getChildren();for(let a=0;a<e.length;a++)V_(c,t,e[a],n);return{namespace:c._config.namespace,nodes:n}}function I2(c){const t=[];for(let n=0;n<c.length;n++){const e=c[n],a=zk(e);Wt(a)&&Jk(a),t.push(a)}return t}let yc=null;async function K_(c,t){if(yc!==null)return!1;if(t!==null)return new Promise((s,l)=>{c.update(()=>{s(G_(c,t))})});const n=c.getRootElement(),e=c._window==null?window.document:c._window.document,a=H_(c._window);if(n===null||a===null)return!1;const r=e.createElement("span");r.style.cssText="position: fixed; top: -1000px;",r.append(e.createTextNode("#")),n.append(r);const o=new Range;return o.setStart(r,0),o.setEnd(r,1),a.removeAllRanges(),a.addRange(o),new Promise((s,l)=>{const i=c.registerCommand(Ru,u=>($s(u,ClipboardEvent)&&(i(),yc!==null&&(window.clearTimeout(yc),yc=null),s(G_(c,u))),!0),zo);yc=window.setTimeout(()=>{i(),yc=null,s(!1)},50),e.execCommand("copy"),r.remove()})}function G_(c,t){const n=H_(c._window);if(!n)return!1;const e=n.anchorNode,a=n.focusNode;if(e!==null&&a!==null&&!Bu(c,e,a))return!1;t.preventDefault();const r=t.clipboardData,o=jt();if(r===null||o===null)return!1;const s=$_(c),l=A2(c);let i="";return o!==null&&(i=o.getTextContent()),s!==null&&r.setData("text/html",s),l!==null&&r.setData("application/x-lexical-editor",l),r.setData("text/plain",i),!0}function Y_(c,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(c,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(c,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const vc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,M2=vc&&"documentMode"in document?document.documentMode:null,D2=!(!vc||!("InputEvent"in window)||M2)&&"getTargetRanges"in new window.InputEvent("input"),R2=vc&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),L2=vc&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F2=vc&&/^(?=.*Chrome).*/i.test(navigator.userAgent),B2=vc&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!F2,km=fo();class ad extends to{static getType(){return"quote"}static clone(t){return new ad(t.__key)}constructor(t){super(t)}createDOM(t){const n=document.createElement("blockquote");return no(n,t.theme.quote),n}updateDOM(t,n){return!1}static importDOM(){return{blockquote:t=>({conversion:U2,priority:0})}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&ys(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const a=this.getDirection();a&&(n.dir=a)}return{element:n}}static importJSON(t){const n=Z_();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){const e=In(),a=this.getDirection();return e.setDirection(a),this.insertAfter(e,n),e}collapseAtStart(){const t=In();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}}function Z_(){return Hr(new ad)}function z2(c){return c instanceof ad}class ld extends to{static getType(){return"heading"}static clone(t){return new ld(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){const n=this.__tag,e=document.createElement(n),a=t.theme.heading;if(a!==void 0){const r=a[n];no(e,r)}return e}updateDOM(t,n){return!1}static importDOM(){return{h1:t=>({conversion:bc,priority:0}),h2:t=>({conversion:bc,priority:0}),h3:t=>({conversion:bc,priority:0}),h4:t=>({conversion:bc,priority:0}),h5:t=>({conversion:bc,priority:0}),h6:t=>({conversion:bc,priority:0}),p:t=>{const n=t.firstChild;return n!==null&&X_(n)?{conversion:()=>({node:null}),priority:3}:null},span:t=>X_(t)?{conversion:n=>({node:Sl("h1")}),priority:3}:null}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&ys(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const a=this.getDirection();a&&(n.dir=a)}return{element:n}}static importJSON(t){const n=Sl(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){const e=t?t.anchor.offset:0,a=e!==this.getTextContentSize()&&t?Sl(this.getTag()):In(),r=this.getDirection();if(a.setDirection(r),this.insertAfter(a,n),e===0&&!this.isEmpty()&&t){const o=In();o.select(),this.replace(o,!0)}return a}collapseAtStart(){const t=this.isEmpty()?In():Sl(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}}function X_(c){return c.nodeName.toLowerCase()==="span"&&c.style.fontSize==="26pt"}function bc(c){const t=c.nodeName.toLowerCase();let n=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(n=Sl(t),c.style!==null&&n.setFormat(c.style.textAlign)),{node:n}}function U2(c){const t=Z_();return c.style!==null&&t.setFormat(c.style.textAlign),{node:t}}function Sl(c){return Hr(new ld(c))}function hp(c){return c instanceof ld}function gp(c){let t=null;if($s(c,DragEvent)?t=c.dataTransfer:$s(c,ClipboardEvent)&&(t=c.clipboardData),t===null)return[!1,[],!1];const n=t.types,e=n.includes("Files"),a=n.includes("text/html")||n.includes("text/plain");return[e,Array.from(t.files),a]}function Q_(c){const t=jt();if(!Et(t))return!1;const n=new Set,e=t.getNodes();for(let a=0;a<e.length;a++){const r=e[a],o=r.getKey();if(n.has(o))continue;const s=tr(r,i=>kt(i)&&!i.isInline());if(s===null)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),c(s))}return n.size>0}function mp(c){const t=po(c);return vr(t)}function H2(c){return br(c.registerCommand(ya,t=>{const n=jt();return!!dr(n)&&(n.clear(),!0)},0),c.registerCommand(Vi,t=>{const n=jt();return!!Et(n)&&(n.deleteCharacter(t),!0)},kn),c.registerCommand(hl,t=>{const n=jt();return!!Et(n)&&(n.deleteWord(t),!0)},kn),c.registerCommand(wa,t=>{const n=jt();return!!Et(n)&&(n.deleteLine(t),!0)},kn),c.registerCommand(ba,t=>{const n=jt();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const e=t.dataTransfer;if(e!=null)W_(e,n,c);else if(Et(n)){const a=t.data;return a&&n.insertText(a),!0}}return!0},kn),c.registerCommand(bf,()=>{const t=jt();return!!Et(t)&&(t.removeText(),!0)},kn),c.registerCommand(Vr,t=>{const n=jt();return!!Et(n)&&(n.formatText(t),!0)},kn),c.registerCommand(gl,t=>{const n=jt();if(!Et(n)&&!dr(n))return!1;const e=n.getNodes();for(const a of e){const r=tr(a,o=>kt(o)&&!o.isInline());r!==null&&r.setFormat(t)}return!0},kn),c.registerCommand(va,t=>{const n=jt();return!!Et(n)&&(n.insertLineBreak(t),!0)},kn),c.registerCommand(pl,()=>{const t=jt();return!!Et(t)&&(t.insertParagraph(),!0)},kn),c.registerCommand($j,()=>(es([lc()]),!0),kn),c.registerCommand(gv,()=>Q_(t=>{const n=t.getIndent();t.setIndent(n+1)}),kn),c.registerCommand(mv,()=>Q_(t=>{const n=t.getIndent();n>0&&t.setIndent(n-1)}),kn),c.registerCommand(Mu,t=>{const n=jt();if(dr(n)&&!mp(t.target)){const e=n.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Et(n)){const e=qu(n.focus,!0);if(!t.shiftKey&&vr(e)&&!e.isIsolated()&&!e.isInline())return e.selectPrevious(),t.preventDefault(),!0}return!1},kn),c.registerCommand(Du,t=>{const n=jt();if(dr(n)){const e=n.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Et(n)){if(function(a){const r=a.focus;return r.key==="root"&&r.offset===Un().getChildrenSize()}(n))return t.preventDefault(),!0;const e=qu(n.focus,!1);if(!t.shiftKey&&vr(e)&&!e.isIsolated()&&!e.isInline())return e.selectNext(),t.preventDefault(),!0}return!1},kn),c.registerCommand(wf,t=>{const n=jt();if(dr(n)){const e=n.getNodes();if(e.length>0)return t.preventDefault(),e[0].selectPrevious(),!0}if(!Et(n))return!1;if(ip(n,!0)){const e=t.shiftKey;return t.preventDefault(),sp(n,e,!0),!0}return!1},kn),c.registerCommand(_f,t=>{const n=jt();if(dr(n)&&!mp(t.target)){const a=n.getNodes();if(a.length>0)return t.preventDefault(),a[0].selectNext(0,0),!0}if(!Et(n))return!1;const e=t.shiftKey;return!!ip(n,!1)&&(t.preventDefault(),sp(n,e,!1),!0)},kn),c.registerCommand(Ki,t=>{if(mp(t.target))return!1;const n=jt();if(!Et(n))return!1;t.preventDefault();const{anchor:e}=n,a=e.getNode();return n.isCollapsed()&&e.offset===0&&!Bo(a)&&um(a).getIndent()>0?c.dispatchCommand(mv,void 0):c.dispatchCommand(Vi,!0)},kn),c.registerCommand(Gi,t=>{if(mp(t.target))return!1;const n=jt();return!!Et(n)&&(t.preventDefault(),c.dispatchCommand(Vi,!1))},kn),c.registerCommand(Rs,t=>{const n=jt();if(!Et(n))return!1;if(t!==null){if((L2||R2||B2)&&D2)return!1;if(t.preventDefault(),t.shiftKey)return c.dispatchCommand(va,!1)}return c.dispatchCommand(pl,void 0)},kn),c.registerCommand(Ls,()=>{const t=jt();return!!Et(t)&&(c.blur(),!0)},kn),c.registerCommand(Sf,t=>{const[,n]=gp(t);if(n.length>0){const a=Y_(t.clientX,t.clientY);if(a!==null){const{offset:r,node:o}=a,s=po(o);if(s!==null){const l=Xu();if(Wt(s))l.anchor.set(s.getKey(),r,"text"),l.focus.set(s.getKey(),r,"text");else{const u=s.getParentOrThrow().getKey(),d=s.getIndexWithinParent()+1;l.anchor.set(u,d,"element"),l.focus.set(u,d,"element")}const i=Eg(l);Cr(i)}c.dispatchCommand(km,n)}return t.preventDefault(),!0}const e=jt();return!!Et(e)},kn),c.registerCommand(Xl,t=>{const[n]=gp(t),e=jt();return!(n&&!Et(e))},kn),c.registerCommand(ug,t=>{const[n]=gp(t),e=jt();if(n&&!Et(e))return!1;const a=Y_(t.clientX,t.clientY);if(a!==null){const r=po(a.node);vr(r)&&t.preventDefault()}return!0},kn),c.registerCommand(Ef,()=>(qv(),!0),kn),c.registerCommand(Ru,t=>(K_(c,$s(t,ClipboardEvent)?t:null),!0),kn),c.registerCommand(Lu,t=>(async function(n,e){await K_(e,$s(n,ClipboardEvent)?n:null),e.update(()=>{const a=jt();Et(a)?a.removeText():dr(a)&&a.getNodes().forEach(r=>r.remove())})}(t,c),!0),kn),c.registerCommand(_a,t=>{const[,n,e]=gp(t);return n.length>0&&!e?(c.dispatchCommand(km,n),!0):Cg(t.target)?!1:jt()!==null&&(function(a,r){a.preventDefault(),r.update(()=>{const o=jt(),s=$s(a,InputEvent)||$s(a,KeyboardEvent)?null:a.clipboardData;s!=null&&o!==null&&W_(s,o,r)},{tag:"paste"})}(t,c),!0)},kn))}const e1=/^(\d+(?:\.\d+)?)px$/,Lr={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class rs extends to{static getType(){return"tablecell"}static clone(t){const n=new rs(t.__headerState,t.__colSpan,t.__width,t.__key);return n.__rowSpan=t.__rowSpan,n.__backgroundColor=t.__backgroundColor,n}static importDOM(){return{td:t=>({conversion:t1,priority:0}),th:t=>({conversion:t1,priority:0})}}static importJSON(t){const n=t.colSpan||1,e=t.rowSpan||1,a=_i(t.headerState,n,t.width||void 0);return a.__rowSpan=e,a.__backgroundColor=t.backgroundColor||null,a}constructor(t=Lr.NO_STATUS,n=1,e,a){super(a),this.__colSpan=n,this.__rowSpan=1,this.__headerState=t,this.__width=e,this.__backgroundColor=null}createDOM(t){const n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),no(n,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),n}exportDOM(t){const{element:n}=super.exportDOM(t);if(n){const e=n;e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign="top",e.style.textAlign="start";const a=this.getBackgroundColor();a!==null?e.style.backgroundColor=a:this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return{element:n}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(t){return this.getWritable().__colSpan=t,this}getRowSpan(){return this.__rowSpan}setRowSpan(t){return this.getWritable().__rowSpan=t,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(t){return this.getWritable().__headerState=t,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(t){return this.getWritable().__width=t,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(t){this.getWritable().__backgroundColor=t}toggleHeaderStyle(t){const n=this.getWritable();return(n.__headerState&t)===t?n.__headerState-=t:n.__headerState+=t,n}hasHeaderState(t){return(this.getHeaderStyles()&t)===t}hasHeader(){return this.getLatest().__headerState!==Lr.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}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function t1(c){const t=c,n=c.nodeName.toLowerCase();let e;e1.test(t.style.width)&&(e=parseFloat(t.style.width));const a=_i(n==="th"?Lr.ROW:Lr.NO_STATUS,t.colSpan,e);a.__rowSpan=t.rowSpan;const r=t.style.backgroundColor;r!==""&&(a.__backgroundColor=r);const o=t.style,s=o.textDecoration.split(" "),l=o.fontWeight==="700"||o.fontWeight==="bold",i=s.includes("line-through"),u=o.fontStyle==="italic",d=s.includes("underline");return{after:p=>(p.length===0&&p.push(In()),p),forChild:(p,f)=>{if(vn(f)&&!kt(p)){const h=In();return vs(p)&&p.getTextContent()===`
|
|
53
53
|
`?null:(Wt(p)&&(l&&p.toggleFormat("bold"),i&&p.toggleFormat("strikethrough"),u&&p.toggleFormat("italic"),d&&p.toggleFormat("underline")),h.append(p),h)}return p},node:a}}function _i(c,t=1,n){return Hr(new rs(c,t,n))}function vn(c){return c instanceof rs}const $2=fo();class El extends to{static getType(){return"tablerow"}static clone(t){return new El(t.__height,t.__key)}static importDOM(){return{tr:t=>({conversion:q2,priority:0})}}static importJSON(t){return Cl(t.height)}constructor(t,n){super(n),this.__height=t}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(t){const n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),no(n,t.theme.tableRow),n}isShadowRoot(){return!0}setHeight(t){return this.getWritable().__height=t,this.__height}getHeight(){return this.getLatest().__height}updateDOM(t){return t.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function q2(c){const t=c;let n;return e1.test(t.style.height)&&(n=parseFloat(t.style.height)),{node:Cl(n)}}function Cl(c){return Hr(new El(c))}function Mr(c){return c instanceof El}function W2(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var or=W2(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const J2=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function n1(c,t,n=!0){const e=wp();for(let a=0;a<c;a++){const r=Cl();for(let o=0;o<t;o++){let s=Lr.NO_STATUS;typeof n=="object"?(a===0&&n.rows&&(s|=Lr.ROW),o===0&&n.columns&&(s|=Lr.COLUMN)):n&&(a===0&&(s|=Lr.ROW),o===0&&(s|=Lr.COLUMN));const l=_i(s),i=In();i.append(Qn()),l.append(i),r.append(l)}e.append(r)}return e}function V2(c){const t=tr(c,n=>vn(n));return vn(t)?t:null}function r1(c){const t=tr(c,n=>Mr(n));if(Mr(t))return t;throw new Error("Expected table cell to be inside of table row.")}function Pa(c){const t=tr(c,n=>jr(n));if(jr(t))return t;throw new Error("Expected table cell to be inside of table.")}function o1(c){const t=r1(c);return Pa(t).getChildren().findIndex(n=>n.is(t))}function Tm(c){return r1(c).getChildren().findIndex(t=>t.is(c))}const Om=(c,t)=>c===Lr.BOTH||c===t?t:Lr.NO_STATUS;function K2(c=!0){const t=jt();Et(t)||ur(t)||or(118);const n=t.focus.getNode(),[e,,a]=Ao(n),[r,o]=os(a,e,e),s=r[0].length,{startRow:l}=o;if(c){const i=l+e.__rowSpan-1,u=r[i],d=Cl();for(let f=0;f<s;f++){const{cell:h,startRow:m}=u[f];if(m+h.__rowSpan-1<=i){const g=u[f].cell.__headerState,b=Om(g,Lr.COLUMN);d.append(_i(b).append(In()))}else h.setRowSpan(h.__rowSpan+1)}const p=a.getChildAtIndex(i);Mr(p)||or(145),p.insertAfter(d)}else{const i=r[l],u=Cl();for(let p=0;p<s;p++){const{cell:f,startRow:h}=i[p];if(h===l){const m=i[p].cell.__headerState,g=Om(m,Lr.COLUMN);u.append(_i(g).append(In()))}else f.setRowSpan(f.__rowSpan+1)}const d=a.getChildAtIndex(l);Mr(d)||or(145),d.insertBefore(u)}}function G2(c=!0){const t=jt();Et(t)||ur(t)||or(118);const n=t.anchor.getNode(),e=t.focus.getNode(),[a]=Ao(n),[r,,o]=Ao(e),[s,l,i]=os(o,r,a),u=s.length,d=c?Math.max(l.startColumn,i.startColumn):Math.min(l.startColumn,i.startColumn),p=c?d+r.__colSpan-1:d-1,f=o.getFirstChild();Mr(f)||or(120);let h=null;function m(b=Lr.NO_STATUS){const v=_i(b).append(In());return h===null&&(h=v),v}let g=f;e:for(let b=0;b<u;b++){if(b!==0){const S=g.getNextSibling();Mr(S)||or(121),g=S}const v=s[b],_=v[p<0?0:p].cell.__headerState,x=Om(_,Lr.ROW);if(p<0){Nm(g,m(x));continue}const{cell:E,startColumn:w,startRow:y}=v[p];if(w+E.__colSpan-1<=p){let S=E,C=y,T=p;for(;C!==b&&S.__rowSpan>1;){if(T-=E.__colSpan,!(T>=0)){g.append(m(x));continue e}{const{cell:F,startRow:B}=v[T];S=F,C=B}}S.insertAfter(m(x))}else E.setColSpan(E.__colSpan+1)}h!==null&&cd(h)}function Y2(){const c=jt();Et(c)||ur(c)||or(118);const t=c.anchor.getNode(),n=c.focus.getNode(),[e,,a]=Ao(t),[r]=Ao(n),[o,s,l]=os(a,e,r),{startRow:i}=s,{startRow:u}=l,d=u+r.__rowSpan-1;if(o.length===d-i+1)return void a.remove();const p=o[0].length,f=o[d+1],h=a.getChildAtIndex(d+1);for(let m=d;m>=i;m--){for(let b=p-1;b>=0;b--){const{cell:v,startRow:_,startColumn:x}=o[m][b];if(x===b&&(m===i&&_<i&&v.setRowSpan(v.__rowSpan-(_-i)),_>=i&&_+v.__rowSpan-1>d))if(v.setRowSpan(v.__rowSpan-(d-_+1)),h===null&&or(122),b===0)Nm(h,v);else{const{cell:E}=f[b-1];E.insertAfter(v)}}const g=a.getChildAtIndex(m);Mr(g)||or(123,String(m)),g.remove()}if(f!==void 0){const{cell:m}=f[0];cd(m)}else{const m=o[i-1],{cell:g}=m[0];cd(g)}}function Z2(){const c=jt();Et(c)||ur(c)||or(118);const t=c.anchor.getNode(),n=c.focus.getNode(),[e,,a]=Ao(t),[r]=Ao(n),[o,s,l]=os(a,e,r),{startColumn:i}=s,{startRow:u,startColumn:d}=l,p=Math.min(i,d),f=Math.max(i+e.__colSpan-1,d+r.__colSpan-1),h=f-p+1;if(o[0].length===f-p+1)return a.selectPrevious(),void a.remove();const m=o.length;for(let v=0;v<m;v++)for(let _=p;_<=f;_++){const{cell:x,startColumn:E}=o[v][_];if(E<p){if(_===p){const w=p-E;x.setColSpan(x.__colSpan-Math.min(h,x.__colSpan-w))}}else if(E+x.__colSpan-1>f){if(_===f){const w=f-E+1;x.setColSpan(x.__colSpan-w)}}else x.remove()}const g=o[u],b=i>d?g[i+e.__colSpan]:g[d+r.__colSpan];if(b!==void 0){const{cell:v}=b;cd(v)}else{const v=d<i?g[d-1]:g[i-1],{cell:_}=v;cd(_)}}function cd(c){const t=c.getFirstDescendant();t==null?c.selectStart():t.getParentOrThrow().selectStart()}function Nm(c,t){const n=c.getFirstChild();n!==null?n.insertBefore(t):c.append(t)}function X2(){const c=jt();Et(c)||ur(c)||or(118);const t=c.anchor.getNode(),[n,e,a]=Ao(t),r=n.__colSpan,o=n.__rowSpan;if(r>1){for(let s=1;s<r;s++)n.insertAfter(_i(Lr.NO_STATUS));n.setColSpan(1)}if(o>1){const[s,l]=os(a,n,n),{startColumn:i,startRow:u}=l;let d;for(let p=1;p<o;p++){const f=u+p,h=s[f];d=(d||e).getNextSibling(),Mr(d)||or(125);let m=null;for(let g=0;g<i;g++){const b=h[g],v=b.cell;b.startRow===f&&(m=v),v.__colSpan>1&&(g+=v.__colSpan-1)}if(m===null)for(let g=0;g<r;g++)Nm(d,_i(Lr.NO_STATUS));else for(let g=0;g<r;g++)m.insertAfter(_i(Lr.NO_STATUS))}n.setRowSpan(1)}}function os(c,t,n){const[e,a,r]=i1(c,t,n);return a===null&&or(110),r===null&&or(111),[e,a,r]}function i1(c,t,n){const e=[];let a=null,r=null;function o(i,u,d){const p={cell:d,startColumn:u,startRow:i},f=d.__rowSpan,h=d.__colSpan;for(let m=0;m<f;m++){e[i+m]===void 0&&(e[i+m]=[]);for(let g=0;g<h;g++)e[i+m][u+g]=p}t!==null&&t.is(d)&&(a=p),n!==null&&n.is(d)&&(r=p)}function s(i,u){return e[i]===void 0||e[i][u]===void 0}const l=c.getChildren();for(let i=0;i<l.length;i++){const u=l[i];Mr(u)||or(146);const d=u.getChildren();let p=0;for(const f of d){for(vn(f)||or(147);!s(i,p);)p++;o(i,p,f),p+=f.__colSpan}}return[e,a,r]}function Ao(c){let t;if(c instanceof rs)t=c;else if("__type"in c){const a=tr(c,vn);vn(a)||or(148),t=a}else{const a=tr(c.getNode(),vn);vn(a)||or(148),t=a}const n=t.getParent();Mr(n)||or(149);const e=n.getParent();return jr(e)||or(150),[t,n,e]}function s1(c){const[t,,n]=Ao(c),e=n.getChildren(),a=e.length,r=e[0].getChildren().length,o=new Array(a);for(let s=0;s<a;s++)o[s]=new Array(r);for(let s=0;s<a;s++){const l=e[s].getChildren();let i=0;for(let u=0;u<l.length;u++){for(;o[s][i];)i++;const d=l[u],p=d.__rowSpan||1,f=d.__colSpan||1;for(let h=0;h<p;h++)for(let m=0;m<f;m++)o[s+h][i+m]=d;if(t===d)return{colSpan:f,columnIndex:i,rowIndex:s,rowSpan:p};i+=f}}return null}class yp{constructor(t,n,e){this.anchor=n,this.focus=e,n._selection=this,e._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=t}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!ur(t)&&this.tableKey===t.tableKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)}set(t,n,e){this.dirty=!0,this.tableKey=t,this.anchor.key=n,this.focus.key=e,this._cachedNodes=null}clone(){return new yp(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const n=this.focus.getNode();kt(n)||or(151),Eg(n.select(0,n.getChildrenSize())).insertNodes(t)}getShape(){const t=Bn(this.anchor.key);vn(t)||or(152);const n=s1(t);n===null&&or(153);const e=Bn(this.focus.key);vn(e)||or(154);const a=s1(e);a===null&&or(155);const r=Math.min(n.columnIndex,a.columnIndex),o=Math.max(n.columnIndex,a.columnIndex),s=Math.min(n.rowIndex,a.rowIndex),l=Math.max(n.rowIndex,a.rowIndex);return{fromX:Math.min(r,o),fromY:Math.min(s,l),toX:Math.max(r,o),toY:Math.max(s,l)}}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const n=this.anchor.getNode(),e=this.focus.getNode(),a=tr(n,vn),r=tr(e,vn);vn(a)||or(152),vn(r)||or(154);const o=a.getParent();Mr(o)||or(156);const s=o.getParent();jr(s)||or(157);const l=r.getParents()[1];if(l!==s){if(s.isParentOf(r)){const y=l.getParent();y==null&&or(159),this.set(this.tableKey,r.getKey(),y.getKey())}else{const y=s.getParent();y==null&&or(158),this.set(this.tableKey,y.getKey(),r.getKey())}return this.getNodes()}const[i,u,d]=os(s,a,r);let p=Math.min(u.startColumn,d.startColumn),f=Math.min(u.startRow,d.startRow),h=Math.max(u.startColumn+u.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),m=Math.max(u.startRow+u.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),g=p,b=f,v=p,_=f;function x(y){const{cell:S,startColumn:C,startRow:T}=y;p=Math.min(p,C),f=Math.min(f,T),h=Math.max(h,C+S.__colSpan-1),m=Math.max(m,T+S.__rowSpan-1)}for(;p<g||f<b||h>v||m>_;){if(p<g){const y=_-b,S=g-1;for(let C=0;C<=y;C++)x(i[b+C][S]);g=S}if(f<b){const y=v-g,S=b-1;for(let C=0;C<=y;C++)x(i[S][g+C]);b=S}if(h>v){const y=_-b,S=v+1;for(let C=0;C<=y;C++)x(i[b+C][S]);v=S}if(m>_){const y=v-g,S=_+1;for(let C=0;C<=y;C++)x(i[S][g+C]);_=S}}const E=[s];let w=null;for(let y=f;y<=m;y++)for(let S=p;S<=h;S++){const{cell:C}=i[y][S],T=C.getParent();Mr(T)||or(160),T!==w&&E.push(T),E.push(C,...Q2(C)),w=T}return cc()||(this._cachedNodes=E),E}getTextContent(){const t=this.getNodes();let n="";for(let e=0;e<t.length;e++)n+=t[e].getTextContent();return n}}function ur(c){return c instanceof yp}function vp(){const c=Mi("root",0,"element"),t=Mi("root",0,"element");return new yp("root",c,t)}function Q2(c){const t=[],n=[c];for(;n.length>0;){const e=n.pop();e===void 0&&or(112),kt(e)&&n.unshift(...e.getChildren()),e!==c&&t.push(e)}return t}class eT{constructor(t,n){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=t,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.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(t=>t())}trackTable(){const t=new MutationObserver(n=>{this.editor.update(()=>{let e=!1;for(let r=0;r<n.length;r++){const o=n[r].target.nodeName;if(o==="TABLE"||o==="TBODY"||o==="THEAD"||o==="TR"){e=!0;break}}if(!e)return;const a=this.editor.getElementByKey(this.tableNodeKey);if(!a)throw new Error("Expected to find TableElement in DOM");this.table=ud(a)})});this.editor.update(()=>{const n=this.editor.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");this.table=ud(n),t.observe(n,{childList:!0,subtree:!0})})}clearHighlight(){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(),t.update(()=>{if(!jr(Bn(this.tableNodeKey)))throw new Error("Expected TableNode.");const n=t.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");const e=ud(n);bp(t,e,null),Cr(null),t.dispatchCommand(yi,void 0)})}enableHighlightStyle(){const t=this.editor;t.update(()=>{const n=t.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");fc(n,t._config.theme.tableSelection),n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const t=this.editor;t.update(()=>{const n=t.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");no(n,t._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(t){if(t!==null&&t.tableKey===this.tableNodeKey){const n=this.editor;this.tableSelection=t,this.isHighlightingCells=!0,this.disableHighlightStyle(),bp(n,this.table,this.tableSelection)}else t==null?this.clearHighlight():(this.tableNodeKey=t.tableKey,this.updateTableTableSelection(t))}setFocusCellForSelection(t,n=!1){const e=this.editor;e.update(()=>{const a=Bn(this.tableNodeKey);if(!jr(a))throw new Error("Expected TableNode.");if(!e.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const r=t.x,o=t.y;if(this.focusCell=t,this.anchorCell!==null){const s=l1(e._window);s&&s.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===r&&this.anchorY===o&&!n){if(r===this.focusX&&o===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=r,this.focusY=o,this.isHighlightingCells){const s=po(t.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&vn(s)&&a.is(_c(s))){const l=s.getKey();this.tableSelection=this.tableSelection.clone()||vp(),this.focusCellNodeKey=l,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Cr(this.tableSelection),e.dispatchCommand(yi,void 0),bp(e,this.table,this.tableSelection)}}})}setAnchorCellForSelection(t){this.isHighlightingCells=!1,this.anchorCell=t,this.anchorX=t.x,this.anchorY=t.y,this.editor.update(()=>{const n=po(t.elem);if(vn(n)){const e=n.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():vp(),this.anchorCellNodeKey=e}})}formatCells(t){this.editor.update(()=>{const n=jt();ur(n)||or(11);const e=Xu(),a=e.anchor,r=e.focus;n.getNodes().forEach(o=>{vn(o)&&o.getTextContentSize()!==0&&(a.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),e.formatText(t))}),Cr(n),this.editor.dispatchCommand(yi,void 0)})}clearText(){const t=this.editor;t.update(()=>{const n=Bn(this.tableNodeKey);if(!jr(n))throw new Error("Expected TableNode.");const e=jt();ur(e)||or(11);const a=e.getNodes().filter(vn);a.length!==this.table.columns*this.table.rows?(a.forEach(r=>{if(kt(r)){const o=In(),s=Qn();o.append(s),r.append(o),r.getChildren().forEach(l=>{l!==o&&l.remove()})}}),bp(t,this.table,null),Cr(null),t.dispatchCommand(yi,void 0)):(n.selectPrevious(),n.remove(),Un().selectStart())})}}const a1="__lexicalTableSelection",l1=c=>J2?(c||window).getSelection():null;function tT(c,t,n,e){const a=n.getRootElement();if(a===null)throw new Error("No root element.");const r=new eT(n,c.getKey()),o=n._window||window;(function(d,p){d[a1]=p})(t,r);const s=()=>{const d=()=>{r.isSelecting=!1,o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",p)},p=f=>{setTimeout(()=>{if(1&~f.buttons&&r.isSelecting)return r.isSelecting=!1,o.removeEventListener("mouseup",d),void o.removeEventListener("mousemove",p);const h=Am(f.target);h===null||r.anchorX===h.x&&r.anchorY===h.y||(f.preventDefault(),r.setFocusCellForSelection(h))},0)};return{onMouseMove:p,onMouseUp:d}};t.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!o)return;const p=Am(d.target);p!==null&&(jl(d),r.setAnchorCellForSelection(p));const{onMouseUp:f,onMouseMove:h}=s();r.isSelecting=!0,o.addEventListener("mouseup",f),o.addEventListener("mousemove",h)},0)});const l=d=>{d.button===0&&n.update(()=>{const p=jt(),f=d.target;ur(p)&&p.tableKey===r.tableNodeKey&&a.contains(f)&&r.clearHighlight()})};o.addEventListener("mousedown",l),r.listenersToRemove.add(()=>o.removeEventListener("mousedown",l)),r.listenersToRemove.add(n.registerCommand(Du,d=>dd(n,d,"down",c,r),ts)),r.listenersToRemove.add(n.registerCommand(Mu,d=>dd(n,d,"up",c,r),ts)),r.listenersToRemove.add(n.registerCommand(wf,d=>dd(n,d,"backward",c,r),ts)),r.listenersToRemove.add(n.registerCommand(_f,d=>dd(n,d,"forward",c,r),ts)),r.listenersToRemove.add(n.registerCommand(Ls,d=>{const p=jt();if(ur(p)){const f=tr(p.focus.getNode(),vn);if(vn(f))return jl(d),f.selectEnd(),!0}return!1},ts)),[hl,wa,Vi].forEach(d=>{r.listenersToRemove.add(n.registerCommand(d,(p=>()=>{const f=jt();if(!Ia(f,c))return!1;if(ur(f))return r.clearText(),!0;if(Et(f)){const h=tr(f.anchor.getNode(),E=>vn(E));if(!vn(h))return!1;const m=f.anchor.getNode(),g=f.focus.getNode(),b=c.isParentOf(m),v=c.isParentOf(g);if(b&&!v||v&&!b)return r.clearText(),!0;const _=tr(f.anchor.getNode(),E=>kt(E)),x=_&&tr(_,E=>kt(E)&&vn(E.getParent()));if(!kt(x)||!kt(_))return!1;if(p===wa&&x.getPreviousSibling()===null)return!0}return!1})(d),zo))});const i=d=>{const p=jt();if(!Ia(p,c)){const f=p?p.getNodes():null;if(f){const h=f.find(m=>jr(m)&&m.getKey()===r.tableNodeKey);if(jr(h)){const m=h.getParent();if(!m)return!1;const g=h.getNextSibling()||h.getPreviousSibling();h.remove(),g?g.selectStart():m.selectStart()}}return!0}if(ur(p))return d.preventDefault(),d.stopPropagation(),r.clearText(),!0;if(Et(p)){const f=tr(p.anchor.getNode(),h=>vn(h));if(!vn(f))return!1}return!1};function u(d){const p=c.getCordsFromCellNode(d,r.table);return c.getDOMCellFromCordsOrThrow(p.x,p.y,r.table)}return r.listenersToRemove.add(n.registerCommand(Ki,i,zo)),r.listenersToRemove.add(n.registerCommand(Gi,i,zo)),r.listenersToRemove.add(n.registerCommand(Vr,d=>{const p=jt();if(!Ia(p,c))return!1;if(ur(p))return r.formatCells(d),!0;if(Et(p)){const f=tr(p.anchor.getNode(),h=>vn(h));if(!vn(f))return!1}return!1},zo)),r.listenersToRemove.add(n.registerCommand(gl,d=>{const p=jt();if(!ur(p)||!Ia(p,c))return!1;const f=p.anchor.getNode(),h=p.focus.getNode();if(!vn(f)||!vn(h))return!1;const[m,g,b]=os(c,f,h),v=Math.max(g.startRow,b.startRow),_=Math.max(g.startColumn,b.startColumn),x=Math.min(g.startRow,b.startRow),E=Math.min(g.startColumn,b.startColumn);for(let w=x;w<=v;w++)for(let y=E;y<=_;y++){const S=m[w][y].cell;S.setFormat(d);const C=S.getChildren();for(let T=0;T<C.length;T++){const F=C[T];kt(F)&&!F.isInline()&&F.setFormat(d)}}return!0},zo)),r.listenersToRemove.add(n.registerCommand(ba,d=>{const p=jt();if(!Ia(p,c))return!1;if(ur(p))return r.clearHighlight(),!1;if(Et(p)){const f=tr(p.anchor.getNode(),h=>vn(h));if(!vn(f))return!1;if(typeof d=="string"){const h=h1(n,p,c);if(h)return p1(h,c,[Qn(d)]),!0}}return!1},zo)),e&&r.listenersToRemove.add(n.registerCommand(xf,d=>{const p=jt();if(!Et(p)||!p.isCollapsed()||!Ia(p,c))return!1;const f=Mm(p.anchor.getNode());if(f===null)return!1;jl(d);const h=c.getCordsFromCellNode(f,r.table);return u1(r,c,h.x,h.y,d.shiftKey?"backward":"forward"),!0},zo)),r.listenersToRemove.add(n.registerCommand(dg,d=>c.isSelected(),ts)),r.listenersToRemove.add(n.registerCommand(pv,d=>{const{nodes:p,selection:f}=d,h=f.getStartEndPoints(),m=ur(f),g=Et(f)&&tr(f.anchor.getNode(),P=>vn(P))!==null&&tr(f.focus.getNode(),P=>vn(P))!==null||m;if(p.length!==1||!jr(p[0])||!g||h===null)return!1;const[b]=h,v=p[0],_=v.getChildren(),x=v.getFirstChildOrThrow().getChildrenSize(),E=v.getChildrenSize(),w=tr(b.getNode(),P=>vn(P)),y=w&&tr(w,P=>Mr(P)),S=y&&tr(y,P=>jr(P));if(!vn(w)||!Mr(y)||!jr(S))return!1;const C=y.getIndexWithinParent(),T=Math.min(S.getChildrenSize()-1,C+E-1),F=w.getIndexWithinParent(),B=Math.min(y.getChildrenSize()-1,F+x-1),M=Math.min(F,B),L=Math.min(C,T),A=Math.max(F,B),j=Math.max(C,T),N=S.getChildren();let R,O,z=0;for(let P=L;P<=j;P++){const $=N[P];if(!Mr($))return!1;const J=_[z];if(!Mr(J))return!1;const K=$.getChildren(),D=J.getChildren();let q=0;for(let W=M;W<=A;W++){const H=K[W];if(!vn(H))return!1;const Z=D[q];if(!vn(Z))return!1;P===L&&W===M?R=H.getKey():P===j&&W===A&&(O=H.getKey());const G=H.getChildren();Z.getChildren().forEach(Q=>{Wt(Q)&&In().append(Q),H.append(Q)}),G.forEach(Q=>Q.remove()),q++}z++}if(R&&O){const P=vp();P.set(p[0].getKey(),R,O),Cr(P)}return!0},zo)),r.listenersToRemove.add(n.registerCommand(yi,()=>{const d=jt(),p=Oa();if(Et(d)){const{anchor:f,focus:h}=d,m=f.getNode(),g=h.getNode(),b=Mm(m),v=Mm(g),_=!(!b||!c.is(_c(b))),x=!(!v||!c.is(_c(v))),E=_!==x,w=_&&x,y=d.isBackward();if(E){const S=d.clone();if(x){const[C]=os(c,v,v),T=C[0][0].cell,F=C[C.length-1].at(-1).cell;S.focus.set(y?T.getKey():F.getKey(),y?T.getChildrenSize():F.getChildrenSize(),"element")}else S.anchor.set(c.getParentOrThrow().getKey(),y?c.getIndexWithinParent()+1:c.getIndexWithinParent(),"element");Cr(S),c1(n,r)}else w&&(b.is(v)||(r.setAnchorCellForSelection(u(b)),r.setFocusCellForSelection(u(v),!0),r.isSelecting||setTimeout(()=>{const{onMouseUp:S,onMouseMove:C}=s();r.isSelecting=!0,o.addEventListener("mouseup",S),o.addEventListener("mousemove",C)},0)))}else if(d&&ur(d)&&d.is(p)&&d.tableKey===c.getKey()){const f=l1(n._window);if(f&&f.anchorNode&&f.focusNode){const h=po(f.focusNode),m=h&&!c.is(_c(h)),g=po(f.anchorNode),b=g&&c.is(_c(g));if(m&&b&&f.rangeCount>0){const v=Rk(f,n);v&&(v.anchor.set(c.getKey(),d.isBackward()?c.getChildrenSize():0,"element"),f.removeAllRanges(),Cr(v))}}}return d&&!d.is(p)&&(ur(d)||ur(p))&&r.tableSelection&&!r.tableSelection.is(p)?(ur(d)&&d.tableKey===r.tableNodeKey?r.updateTableTableSelection(d):!ur(d)&&ur(p)&&p.tableKey===r.tableNodeKey&&r.updateTableTableSelection(null),!1):(r.hasHijackedSelectionStyles&&!c.isSelected()?function(f,h){h.enableHighlightStyle(),Pm(h.table,m=>{const g=m.elem;m.highlighted=!1,f1(f,m),g.getAttribute("style")||g.removeAttribute("style")})}(n,r):!r.hasHijackedSelectionStyles&&c.isSelected()&&c1(n,r),!1)},zo)),r.listenersToRemove.add(n.registerCommand(pl,()=>{const d=jt();if(!Et(d)||!d.isCollapsed()||!Ia(d,c))return!1;const p=h1(n,d,c);return!!p&&(p1(p,c),!0)},zo)),r}function nT(c){return c[a1]}function Am(c){let t=c;for(;t!=null;){const n=t.nodeName;if(n==="TD"||n==="TH"){const e=t._cell;return e===void 0?null:e}t=t.parentNode}return null}function ud(c){const t=[],n={columns:0,domRows:t,rows:0};let e=c.firstChild,a=0,r=0;for(t.length=0;e!=null;){const o=e.nodeName;if(o==="TD"||o==="TH"){const i={elem:e,hasBackgroundColor:e.style.backgroundColor!=="",highlighted:!1,x:a,y:r};e._cell=i;let u=t[r];u===void 0&&(u=t[r]=[]),u[a]=i}else{const i=e.firstChild;if(i!=null){e=i;continue}}const s=e.nextSibling;if(s!=null){a++,e=s;continue}const l=e.parentNode;if(l!=null){const i=l.nextSibling;if(i==null)break;r++,a=0,e=i}}return n.columns=a+1,n.rows=r+1,n}function bp(c,t,n){const e=new Set(n?n.getNodes():[]);Pm(t,(a,r)=>{const o=a.elem;e.has(r)?(a.highlighted=!0,d1(c,a)):(a.highlighted=!1,f1(c,a),o.getAttribute("style")||o.removeAttribute("style"))})}function Pm(c,t){const{domRows:n}=c;for(let e=0;e<n.length;e++){const a=n[e];if(a)for(let r=0;r<a.length;r++){const o=a[r];if(!o)continue;const s=po(o.elem);s!==null&&t(o,s,{x:r,y:e})}}}function c1(c,t){t.disableHighlightStyle(),Pm(t.table,n=>{n.highlighted=!0,d1(c,n)})}const u1=(c,t,n,e,a)=>{const r=a==="forward";switch(a){case"backward":case"forward":return n!==(r?c.table.columns-1:0)?_p(t.getCellNodeFromCordsOrThrow(n+(r?1:-1),e,c.table),r):e!==(r?c.table.rows-1:0)?_p(t.getCellNodeFromCordsOrThrow(r?0:c.table.columns-1,e+(r?1:-1),c.table),r):r?t.selectNext():t.selectPrevious(),!0;case"up":return e!==0?_p(t.getCellNodeFromCordsOrThrow(n,e-1,c.table),!1):t.selectPrevious(),!0;case"down":return e!==c.table.rows-1?_p(t.getCellNodeFromCordsOrThrow(n,e+1,c.table),!0):t.selectNext(),!0;default:return!1}},rT=(c,t,n,e,a)=>{const r=a==="forward";switch(a){case"backward":case"forward":return n!==(r?c.table.columns-1:0)&&c.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n+(r?1:-1),e,c.table)),!0;case"up":return e!==0&&(c.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,e-1,c.table)),!0);case"down":return e!==c.table.rows-1&&(c.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,e+1,c.table)),!0);default:return!1}};function Ia(c,t){if(Et(c)||ur(c)){const n=t.isParentOf(c.anchor.getNode()),e=t.isParentOf(c.focus.getNode());return n&&e}return!1}function _p(c,t){t?c.selectStart():c.selectEnd()}const Im="172,206,247";function d1(c,t){const n=t.elem,e=po(n);vn(e)||or(131),e.getBackgroundColor()===null?n.style.setProperty("background-color",`rgb(${Im})`):n.style.setProperty("background-image",`linear-gradient(to right, rgba(${Im},0.85), rgba(${Im},0.85))`),n.style.setProperty("caret-color","transparent")}function f1(c,t){const n=t.elem,e=po(n);vn(e)||or(131),e.getBackgroundColor()===null&&n.style.removeProperty("background-color"),n.style.removeProperty("background-image"),n.style.removeProperty("caret-color")}function Mm(c){const t=tr(c,vn);return vn(t)?t:null}function _c(c){const t=tr(c,jr);return jr(t)?t:null}function dd(c,t,n,e,a){if((n==="up"||n==="down")&&function(o){const s=o.getRootElement();return s?s.hasAttribute("aria-controls")&&s.getAttribute("aria-controls")==="typeahead-menu":!1}(c))return!1;const r=jt();if(!Ia(r,e)){if(Et(r)){if(r.isCollapsed()&&n==="backward"){const o=r.anchor.type,s=r.anchor.offset;if(o!=="element"&&(o!=="text"||s!==0))return!1;const l=r.anchor.getNode();if(!l)return!1;const i=tr(l,d=>kt(d)&&!d.isInline());if(!i)return!1;const u=i.getPreviousSibling();return!(!u||!jr(u))&&(jl(t),u.selectEnd(),!0)}if(t.shiftKey&&(n==="up"||n==="down")){const o=r.anchor.getNode();if(Qr(o)){const s=r.getNodes()[0];if(s){const l=tr(s,vn);if(l&&e.isParentOf(l)){const i=e.getFirstDescendant(),u=e.getLastDescendant();if(!i||!u)return!1;const[d]=Ao(i),[p]=Ao(u),f=e.getCordsFromCellNode(d,a.table),h=e.getCordsFromCellNode(p,a.table),m=e.getDOMCellFromCordsOrThrow(f.x,f.y,a.table),g=e.getDOMCellFromCordsOrThrow(h.x,h.y,a.table);return a.setAnchorCellForSelection(m),a.setFocusCellForSelection(g,!0),!0}}return!1}{const s=tr(o,i=>kt(i)&&!i.isInline());if(!s)return!1;const l=n==="down"?s.getNextSibling():s.getPreviousSibling();if(jr(l)&&a.tableNodeKey===l.getKey()){const i=l.getFirstDescendant(),u=l.getLastDescendant();if(!i||!u)return!1;const[d]=Ao(i),[p]=Ao(u),f=r.clone();return f.focus.set((n==="up"?d:p).getKey(),n==="up"?0:p.getChildrenSize(),"element"),Cr(f),!0}}}}return!1}if(Et(r)&&r.isCollapsed()){const{anchor:o,focus:s}=r,l=tr(o.getNode(),vn),i=tr(s.getNode(),vn);if(!vn(l)||!l.is(i))return!1;const u=_c(l);if(u!==e&&u!=null){const b=c.getElementByKey(u.getKey());if(b!=null)return a.table=ud(b),dd(c,t,n,u,a)}if(n==="backward"||n==="forward"){const b=o.type,v=o.offset,_=o.getNode();if(!_)return!1;const x=r.getNodes();return(x.length!==1||!vr(x[0]))&&!!function(E,w,y,S){return function(C,T,F){return C==="element"&&(F==="backward"?T.getPreviousSibling()===null:T.getNextSibling()===null)}(E,y,S)||function(C,T,F,B){const M=tr(F,A=>kt(A)&&!A.isInline());if(!M)return!1;const L=B==="backward"?T===0:T===F.getTextContentSize();return C==="text"&&L&&(B==="backward"?M.getPreviousSibling()===null:M.getNextSibling()===null)}(E,w,y,S)}(b,v,_,n)&&function(E,w,y,S){const C=tr(w,vn);if(!vn(C))return!1;const[T,F]=os(y,C,C);if(!function(M,L,A){const j=M[0][0],N=M[M.length-1][M[0].length-1],{startColumn:R,startRow:O}=L;return A==="backward"?R===j.startColumn&&O===j.startRow:R===N.startColumn&&O===N.startRow}(T,F,S))return!1;const B=function(M,L,A){const j=tr(M,R=>kt(R)&&!R.isInline());if(!j)return;const N=L==="backward"?j.getPreviousSibling():j.getNextSibling();return N&&jr(N)?N:L==="backward"?A.getPreviousSibling():A.getNextSibling()}(w,S,y);return!B||jr(B)?!1:(jl(E),S==="backward"?B.selectEnd():B.selectStart(),!0)}(t,_,e,n)}const d=c.getElementByKey(l.__key),p=c.getElementByKey(o.key);if(p==null||d==null)return!1;let f;if(o.type==="element")f=p.getBoundingClientRect();else{const b=window.getSelection();if(b===null||b.rangeCount===0)return!1;f=b.getRangeAt(0).getBoundingClientRect()}const h=n==="up"?l.getFirstChild():l.getLastChild();if(h==null)return!1;const m=c.getElementByKey(h.__key);if(m==null)return!1;const g=m.getBoundingClientRect();if(n==="up"?g.top>f.top-f.height:f.bottom+f.height>g.bottom){jl(t);const b=e.getCordsFromCellNode(l,a.table);if(!t.shiftKey)return u1(a,e,b.x,b.y,n);{const v=e.getDOMCellFromCordsOrThrow(b.x,b.y,a.table);a.setAnchorCellForSelection(v),a.setFocusCellForSelection(v,!0)}return!0}}else if(ur(r)){const{anchor:o,focus:s}=r,l=tr(o.getNode(),vn),i=tr(s.getNode(),vn),[u]=r.getNodes(),d=c.getElementByKey(u.getKey());if(!vn(l)||!vn(i)||!jr(u)||d==null)return!1;a.updateTableTableSelection(r);const p=ud(d),f=e.getCordsFromCellNode(l,p),h=e.getDOMCellFromCordsOrThrow(f.x,f.y,p);if(a.setAnchorCellForSelection(h),jl(t),t.shiftKey){const m=e.getCordsFromCellNode(i,p);return rT(a,u,m.x,m.y,n)}return i.selectEnd(),!0}return!1}function jl(c){c.preventDefault(),c.stopImmediatePropagation(),c.stopPropagation()}function p1(c,t,n){const e=In();c==="first"?t.insertBefore(e):t.insertAfter(e),e.append(...n||[]),e.selectEnd()}function h1(c,t,n){const e=n.getParent();if(!e)return;const a=c.getElementByKey(e.getKey());if(!a)return;const r=window.getSelection();if(!r||r.anchorNode!==a)return;const o=tr(t.anchor.getNode(),g=>vn(g));if(!o)return;const s=tr(o,g=>jr(g));if(!jr(s)||!s.is(n))return;const[l,i]=os(n,o,o),u=l[0][0],d=l[l.length-1][l[0].length-1],{startRow:p,startColumn:f}=i,h=p===u.startRow&&f===u.startColumn,m=p===d.startRow&&f===d.startColumn;return h?"first":m?"last":void 0}class xs extends to{static getType(){return"table"}static clone(t){return new xs(t.__key)}static importDOM(){return{table:t=>({conversion:oT,priority:1})}}static importJSON(t){return wp()}constructor(t){super(t)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(t,n){const e=document.createElement("table");return no(e,t.theme.table),e}updateDOM(){return!1}exportDOM(t){return{...super.exportDOM(t),after:n=>{if(n){const e=n.cloneNode(),a=document.createElement("colgroup"),r=document.createElement("tbody");ys(n)&&r.append(...n.children);const o=this.getFirstChildOrThrow();if(!Mr(o))throw new Error("Expected to find row node.");const s=o.getChildrenSize();for(let l=0;l<s;l++){const i=document.createElement("col");a.append(i)}return e.replaceChildren(a,r),e}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(t,n){const{rows:e,domRows:a}=n;for(let r=0;r<e;r++){const o=a[r];if(o==null)continue;const s=o.findIndex(l=>{if(!l)return;const{elem:i}=l;return po(i)===t});if(s!==-1)return{x:s,y:r}}throw new Error("Cell not found in table.")}getDOMCellFromCords(t,n,e){const{domRows:a}=e,r=a[n];if(r==null)return null;const o=r[t];return o??null}getDOMCellFromCordsOrThrow(t,n,e){const a=this.getDOMCellFromCords(t,n,e);if(!a)throw new Error("Cell not found at cords.");return a}getCellNodeFromCords(t,n,e){const a=this.getDOMCellFromCords(t,n,e);if(a==null)return null;const r=po(a.elem);return vn(r)?r:null}getCellNodeFromCordsOrThrow(t,n,e){const a=this.getCellNodeFromCords(t,n,e);if(!a)throw new Error("Node at cords not TableCellNode.");return a}canSelectBefore(){return!0}canIndent(){return!1}}function oT(c){return{node:wp()}}function wp(){return Hr(new xs)}function jr(c){return c instanceof xs}function iT(c){const t=c.open!==void 0?c.open:!0;return{node:g1(t)}}class fd extends to{constructor(n,e){super(e);qn(this,"__open");this.__open=n}static getType(){return"collapsible-container"}static clone(n){return new fd(n.__open,n.__key)}createDOM(n,e){const a=document.createElement("details");return a.classList.add("Collapsible__container"),a.open=this.__open,a.addEventListener("toggle",()=>{e.getEditorState().read(()=>this.getOpen())!==a.open&&e.update(()=>this.toggleOpen())}),a}updateDOM(n,e){return n.__open!==this.__open&&(e.open=this.__open),!1}static importDOM(){return{details:n=>({conversion:iT,priority:1})}}static importJSON(n){return g1(n.open)}exportDOM(){const n=document.createElement("details");return n.setAttribute("open",this.__open.toString()),{element:n}}exportJSON(){return{...super.exportJSON(),open:this.__open,type:"collapsible-container",version:1}}setOpen(n){const e=this.getWritable();e.__open=n}getOpen(){return this.getLatest().__open}toggleOpen(){this.setOpen(!this.getOpen())}}function g1(c){return new fd(c)}function sT(c){return c instanceof fd}function aT(c){return{node:m1()}}class pd extends to{static getType(){return"collapsible-content"}static clone(t){return new pd(t.__key)}createDOM(t){const n=document.createElement("div");return n.classList.add("Collapsible__content"),n}updateDOM(t,n){return!1}static importDOM(){return{div:t=>t.hasAttribute("data-lexical-collapsible-content")?{conversion:aT,priority:2}:null}}exportDOM(){const t=document.createElement("div");return t.setAttribute("data-lexical-collapsible-content","true"),{element:t}}static importJSON(t){return m1()}isShadowRoot(){return!0}exportJSON(){return{...super.exportJSON(),type:"collapsible-content",version:1}}}function m1(){return new pd}function lT(c){return c instanceof pd}function cT(c){return{node:y1()}}class xp extends to{static getType(){return"collapsible-title"}static clone(t){return new xp(t.__key)}createDOM(t,n){const e=document.createElement("summary");return e.classList.add("Collapsible__title"),e}updateDOM(t,n){return!1}static importDOM(){return{summary:t=>({conversion:cT,priority:1})}}static importJSON(t){return y1()}exportDOM(){return{element:document.createElement("summary")}}exportJSON(){return{...super.exportJSON(),type:"collapsible-title",version:1}}collapseAtStart(t){return this.getParentOrThrow().insertBefore(this),!0}insertNewAfter(t,n=!0){const e=this.getParentOrThrow();if(!sT(e))throw new Error("CollapsibleTitleNode expects to be child of CollapsibleContainerNode");if(e.getOpen()){const a=this.getNextSibling();if(!lT(a))throw new Error("CollapsibleTitleNode expects to have CollapsibleContentNode sibling");const r=a.getFirstChild();if(kt(r))return r;{const o=In();return a.append(o),o}}else{const a=In();return e.insertAfter(a,n),a}}}function y1(){return new xp}class hd extends eo{constructor(n,e,a){super(e,a);qn(this,"__className");this.__className=n}static getType(){return"emoji"}static clone(n){return new hd(n.__className,n.__text,n.__key)}createDOM(n){const e=document.createElement("span"),a=super.createDOM(n);return e.className=this.__className,a.className="emoji-inner",e.appendChild(a),e}updateDOM(n,e,a){const r=e.firstChild;return r===null?!0:(super.updateDOM(n,r,a),!1)}static importJSON(n){const e=v1(n.className,n.text);return e.setFormat(n.format),e.setDetail(n.detail),e.setMode(n.mode),e.setStyle(n.style),e}exportJSON(){return{...super.exportJSON(),className:this.getClassName(),type:"emoji"}}getClassName(){return this.getLatest().__className}}function v1(c,t){const n=new hd(c,t).setMode("token");return Hr(n)}let Dm=class extends Hs{constructor(t,n){super(n),this.__format=t||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(t){this.getWritable().__format=t}isInline(){return!1}};function Rm(c){return c instanceof Dm}function b1({children:c,format:t,nodeKey:n,className:e}){const[a]=Sn(),[r,o,s]=mc(n),l=ge.useRef(null),i=ge.useCallback(u=>{if(r&&dr(jt())){u.preventDefault();const d=Bn(n);if(vr(d))return d.remove(),!0}return!1},[r,n]);return ge.useEffect(()=>br(a.registerCommand(gl,u=>{if(r){const d=jt();if(dr(d)){const p=Bn(n);Rm(p)&&p.setFormat(u)}else if(Et(d)){const p=d.getNodes();for(const f of p)Rm(f)?f.setFormat(u):um(f).setFormat(u)}return!0}return!1},Gn),a.registerCommand(ya,u=>u.target===l.current&&(u.preventDefault(),u.shiftKey||s(),o(!r),!0),Gn),a.registerCommand(Gi,i,Gn),a.registerCommand(Ki,i,Gn)),[s,a,r,n,i,o]),ce.jsx("div",{className:[e.base,r?e.focus:null].filter(Boolean).join(" "),ref:l,style:{textAlign:t||void 0},children:c})}function uT({className:c,format:t,nodeKey:n,documentID:e}){return ce.jsx(b1,{className:c,format:t,nodeKey:n,children:ce.jsx("iframe",{width:"560",height:"315",src:`https://www.figma.com/embed?embed_host=lexical&url= https://www.figma.com/file/${e}`,allowFullScreen:!0})})}class Sp extends Dm{constructor(n,e,a){super(e,a);qn(this,"__id");this.__id=n}static getType(){return"figma"}static clone(n){return new Sp(n.__id,n.__format,n.__key)}static importJSON(n){const e=dT(n.documentID);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),documentID:this.__id,type:"figma",version:1}}updateDOM(){return!1}getId(){return this.__id}getTextContent(n,e){return`https://www.figma.com/file/${this.__id}`}decorate(n,e){const a=e.theme.embedBlock||{},r={base:a.base||"",focus:a.focus||""};return ce.jsx(uT,{className:r,format:this.__format,nodeKey:this.getKey(),documentID:this.__id})}}function dT(c){return new Sp(c)}const fT=ir.lazy(()=>Promise.resolve().then(()=>K3));function pT(c){const t=c;if(t.src.startsWith("file:///"))return null;const{alt:n,src:e,width:a,height:r}=t;return{node:wc({altText:n,height:r,src:e,width:a})}}let Ep=class Ij extends Hs{constructor(n,e,a,r,o,s,l,i,u){super(u);qn(this,"__src");qn(this,"__altText");qn(this,"__width");qn(this,"__height");qn(this,"__maxWidth");qn(this,"__showCaption");qn(this,"__caption");qn(this,"__captionsEnabled");this.__src=n,this.__altText=e,this.__maxWidth=a,this.__width=r||"inherit",this.__height=o||"inherit",this.__showCaption=s||!1,this.__caption=l||tp(),this.__captionsEnabled=i||i===void 0}static getType(){return"image"}static clone(n){return new Ij(n.__src,n.__altText,n.__maxWidth,n.__width,n.__height,n.__showCaption,n.__caption,n.__captionsEnabled,n.__key)}static importJSON(n){const{altText:e,height:a,width:r,maxWidth:o,caption:s,src:l,showCaption:i}=n,u=wc({altText:e,height:a,maxWidth:o,showCaption:i,src:l,width:r}),d=u.__caption,p=d.parseEditorState(s.editorState);return p&&!p.isEmpty()&&d.setEditorState(p),u}exportDOM(){const n=document.createElement("img");return n.setAttribute("src",this.__src),n.setAttribute("alt",this.__altText),n.setAttribute("width",this.__width.toString()),n.setAttribute("height",this.__height.toString()),{element:n}}static importDOM(){return{img:n=>({conversion:pT,priority:0})}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,maxWidth:this.__maxWidth,showCaption:this.__showCaption,src:this.getSrc(),type:"image",version:1,width:this.__width==="inherit"?0:this.__width}}setWidthAndHeight(n,e){const a=this.getWritable();a.__width=n,a.__height=e}setShowCaption(n){const e=this.getWritable();e.__showCaption=n}createDOM(n){const e=document.createElement("span"),r=n.theme.image;return r!==void 0&&(e.className=r),e}updateDOM(){return!1}getSrc(){return this.__src}setSrc(n){const e=this.getWritable();e.__src=n}getAltText(){return this.__altText}decorate(){return ce.jsx(ge.Suspense,{fallback:null,children:ce.jsx(fT,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,captionsEnabled:this.__captionsEnabled,resizable:!0})})}};function wc({altText:c,height:t,maxWidth:n,captionsEnabled:e,src:a,width:r,showCaption:o,caption:s,key:l}){return Hr(new Ep(a,c,n,r,t,o,s,e,l))}function xc(c){return c instanceof Ep}const hT=ir.lazy(()=>Promise.resolve().then(()=>sD));function gT(c){if(c instanceof HTMLImageElement){const{alt:t,src:n,width:e,height:a}=c;return{node:_1({altText:t,height:a,src:n,width:e})}}return null}let Lm=class Mj extends Hs{constructor(n,e,a,r,o,s,l,i){super(i);qn(this,"__src");qn(this,"__altText");qn(this,"__width");qn(this,"__height");qn(this,"__showCaption");qn(this,"__caption");qn(this,"__position");this.__src=n,this.__altText=e,this.__width=r||"inherit",this.__height=o||"inherit",this.__showCaption=s||!1,this.__caption=l||tp(),this.__position=a}static getType(){return"inline-image"}static clone(n){return new Mj(n.__src,n.__altText,n.__position,n.__width,n.__height,n.__showCaption,n.__caption,n.__key)}static importJSON(n){const{altText:e,height:a,width:r,caption:o,src:s,showCaption:l,position:i}=n,u=_1({altText:e,height:a,position:i,showCaption:l,src:s,width:r}),d=u.__caption,p=d.parseEditorState(o.editorState);return p.isEmpty()||d.setEditorState(p),u}static importDOM(){return{img:n=>({conversion:gT,priority:0})}}exportDOM(){const n=document.createElement("img");return n.setAttribute("src",this.__src),n.setAttribute("alt",this.__altText),n.setAttribute("width",this.__width.toString()),n.setAttribute("height",this.__height.toString()),{element:n}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,position:this.__position,showCaption:this.__showCaption,src:this.getSrc(),type:"inline-image",version:1,width:this.__width==="inherit"?0:this.__width}}getSrc(){return this.__src}getAltText(){return this.__altText}setAltText(n){const e=this.getWritable();e.__altText=n}setWidthAndHeight(n,e){const a=this.getWritable();a.__width=n,a.__height=e}getShowCaption(){return this.__showCaption}setShowCaption(n){const e=this.getWritable();e.__showCaption=n}getPosition(){return this.__position}setPosition(n){const e=this.getWritable();e.__position=n}update(n){const e=this.getWritable(),{altText:a,showCaption:r,position:o}=n;a!==void 0&&(e.__altText=a),r!==void 0&&(e.__showCaption=r),o!==void 0&&(e.__position=o)}createDOM(n){const e=document.createElement("span"),a=`${n.theme.inlineImage} position-${this.__position}`;return a!==void 0&&(e.className=a),e}updateDOM(n,e,a){const r=this.__position;if(r!==n.__position){const o=`${a.theme.inlineImage} position-${r}`;o!==void 0&&(e.className=o)}return!1}decorate(){return ce.jsx(ge.Suspense,{fallback:null,children:ce.jsx(hT,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,position:this.__position})})}};function _1({altText:c,position:t,height:n,src:e,width:a,showCaption:r,caption:o,key:s}){return Hr(new Lm(e,c,t,a,n,r,o,s))}function mT(c){return c instanceof Lm}class Sc extends eo{static getType(){return"keyword"}static clone(t){return new Sc(t.__text,t.__key)}static importJSON(t){const n=w1(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:"keyword",version:1}}createDOM(t){const n=super.createDOM(t);return n.style.cursor="default",n.className="keyword",n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}isTextEntity(){return!0}}function w1(c){return new Sc(c)}function yT(c){const n=window.getComputedStyle(c).getPropertyValue("grid-template-columns");return n?{node:x1(n)}:null}class Cp extends to{constructor(n,e){super(e);qn(this,"__templateColumns");this.__templateColumns=n}static getType(){return"layout-container"}static clone(n){return new Cp(n.__templateColumns,n.__key)}createDOM(n){const e=document.createElement("div");return e.style.gridTemplateColumns=this.__templateColumns,typeof n.theme.layoutContainer=="string"&&no(e,n.theme.layoutContainer),e}exportDOM(){const n=document.createElement("div");return n.style.gridTemplateColumns=this.__templateColumns,n.setAttribute("data-lexical-layout-container","true"),{element:n}}updateDOM(n,e){return n.__templateColumns!==this.__templateColumns&&(e.style.gridTemplateColumns=this.__templateColumns),!1}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-layout-container")?{conversion:yT,priority:2}:null}}static importJSON(n){return x1(n.templateColumns)}isShadowRoot(){return!0}canBeEmpty(){return!1}exportJSON(){return{...super.exportJSON(),templateColumns:this.__templateColumns,type:"layout-container",version:1}}getTemplateColumns(){return this.getLatest().__templateColumns}setTemplateColumns(n){this.getWritable().__templateColumns=n}}function x1(c){return new Cp(c)}class jp extends to{static getType(){return"layout-item"}static clone(t){return new jp(t.__key)}createDOM(t){const n=document.createElement("div");return typeof t.theme.layoutItem=="string"&&no(n,t.theme.layoutItem),n}updateDOM(){return!1}static importDOM(){return{}}static importJSON(){return vT()}isShadowRoot(){return!0}exportJSON(){return{...super.exportJSON(),type:"layout-item",version:1}}}function vT(){return new jp}function bT(c){const t=c.textContent;return t!==null?{node:Fm(t)}:null}const _T="background-color: rgba(24, 119, 232, 0.2)";class gd extends eo{constructor(n,e,a){super(e??n,a);qn(this,"__mention");this.__mention=n}static getType(){return"mention"}static clone(n){return new gd(n.__mention,n.__text,n.__key)}static importJSON(n){const e=Fm(n.mentionName);return e.setTextContent(n.text),e.setFormat(n.format),e.setDetail(n.detail),e.setMode(n.mode),e.setStyle(n.style),e}exportJSON(){return{...super.exportJSON(),mentionName:this.__mention,type:"mention",version:1}}createDOM(n){const e=super.createDOM(n);return e.style.cssText=_T,e.className="mention",e}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-mention","true"),n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-mention")?{conversion:bT,priority:1}:null}}isTextEntity(){return!0}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Fm(c){const t=new gd(c);return t.setMode("segmented").toggleDirectionless(),Hr(t)}const MD="";function wT({nodeKey:c}){const[t]=Sn(),[n,e,a]=mc(c),r=ge.useCallback(o=>{if(o.preventDefault(),n&&dr(jt())){const s=Bn(c);if(ST(s))return s.remove(),!0}return!1},[n,c]);return ge.useEffect(()=>br(t.registerCommand(ya,o=>{const s=t.getElementByKey(c);return o.target===s?(o.shiftKey||a(),e(!n),!0):!1},Gn),t.registerCommand(Gi,r,Gn),t.registerCommand(Ki,r,Gn)),[a,t,n,c,r,e]),ge.useEffect(()=>{const o=t.getElementByKey(c);o!==null&&(o.className=n?"selected":"")},[t,n,c]),null}class md extends Hs{static getType(){return"page-break"}static clone(t){return new md(t.__key)}static importJSON(t){return S1()}static importDOM(){return{figure:t=>t.getAttribute("type")!==this.getType()?null:{conversion:xT,priority:ts}}}exportJSON(){return{type:this.getType(),version:1}}createDOM(){const t=document.createElement("figure");return t.style.pageBreakAfter="always",t.setAttribute("type",this.getType()),t}getTextContent(){return`
|
|
54
|
-
`}isInline(){return!1}updateDOM(){return!1}decorate(){return ce.jsx(wT,{nodeKey:this.__key})}}function xT(){return{node:S1()}}function S1(){return new md}function ST(c){return c instanceof md}const ET=ir.lazy(()=>Promise.resolve().then(()=>uD));function CT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function jT(c=""){return{text:c,uid:CT(),votes:[]}}function E1(c,t,n){return{text:t,uid:c.uid,votes:n||Array.from(c.votes)}}function kT(c){const t=c.getAttribute("data-lexical-poll-question"),n=c.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:C1(t,JSON.parse(n))}:null}let Bm=class Dj extends Hs{constructor(n,e,a){super(a);qn(this,"__question");qn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new Dj(n.__question,n.__options,n.__key)}static importJSON(n){const e=C1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),a=Array.from(e.__options);a.push(n),e.__options=a}deleteOption(n){const e=this.getWritable(),a=Array.from(e.__options),r=a.indexOf(n);a.splice(r,1),e.__options=a}setOptionText(n,e){const a=this.getWritable(),r=E1(n,e),o=Array.from(a.__options),s=o.indexOf(n);o[s]=r,a.__options=o}toggleVote(n,e){const a=this.getWritable(),r=n.votes,o=Array.from(r),s=r.indexOf(e);s===-1?o.push(e):o.splice(s,1);const l=E1(n,n.text,o),i=Array.from(a.__options),u=i.indexOf(n);i[u]=l,a.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:kT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return ce.jsx(ge.Suspense,{fallback:null,children:ce.jsx(ET,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function C1(c,t){return new Bm(c,t)}function j1(c){return c instanceof Bm}const TT="https://platform.twitter.com/widgets.js";function OT(c){const t=c.getAttribute("data-lexical-tweet-id");return t?{node:T1(t)}:null}let k1=!0;function NT({className:c,format:t,loadingComponent:n,nodeKey:e,onError:a,onLoad:r,tweetID:o}){const s=ge.useRef(null),l=ge.useRef(""),[i,u]=ge.useState(!1),d=ge.useCallback(async()=>{try{await window.twttr.widgets.createTweet(o,s.current),u(!1),k1=!1,r&&r()}catch(p){a&&a(String(p))}},[a,r,o]);return ge.useEffect(()=>{var p;if(o!==l.current){if(u(!0),k1){const f=document.createElement("script");f.src=TT,f.async=!0,(p=document.body)==null||p.appendChild(f),f.onload=d,a&&(f.onerror=a)}else d();l&&(l.current=o)}},[d,a,o]),ce.jsxs(b1,{className:c,format:t,nodeKey:e,children:[i?n:null,ce.jsx("div",{style:{display:"inline-block",width:"550px"},ref:s})]})}class kp extends Dm{constructor(n,e,a){super(e,a);qn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new kp(n.__id,n.__format,n.__key)}static importJSON(n){const e=T1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:OT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const a=e.theme.embedBlock||{},r={base:a.base||"",focus:a.focus||""};return ce.jsx(NT,{className:r,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function T1(c){return new kp(c)}class yd extends Hs{constructor(n,e,a){super(a);qn(this,"__referencedElementId");qn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new yd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),requestAnimationFrame(()=>{const o=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);o?(o.scrollIntoView({behavior:"smooth",block:"center"}),o.classList.add("reference-highlight"),setTimeout(()=>{o.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)o.focus(),o.setSelectionRange(o.value.length,o.value.length);else if(o.isContentEditable){o.focus();const s=document.createRange(),l=window.getSelection();s.selectNodeContents(o),s.collapse(!1),l==null||l.removeAllRanges(),l==null||l.addRange(s)}else o.setAttribute("tabindex","-1"),o.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)})});const a=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return a&&new MutationObserver(()=>{const o=a.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(l=>{l.textContent!==o&&(l.textContent=o||"")})}).observe(a,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,a){const r=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(r){const o=r.textContent;e.textContent!==o&&(e.textContent=o||"")}return!1}decorate(n,e){return ce.jsx(ce.Fragment,{})}static importJSON(n){return O1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){const e={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:n.style,id:n.codox_metadata.referencedElementId};return console.log("[DEMO DEBUG][ReferenceNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:e}),new yd(e.id,e.text)}}function O1(c,t){return new yd(c,t)}class kl extends eo{static getType(){return"dividerText"}static clone(t){return new kl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:void 0,version:0,detail:0,format:0,mode:"normal",style:"",text:""}}static importJSON(t){return new kl(t.text)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new kl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON(),n={type:"text",text:t.text||"_______________________________",format:t.format,style:`color:${t.color||""};background-color:${t.backgroundColor||""};`,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:n,originalJsonNode:t}),n}static fromCodoxNode(t){let n="",e="";t.style.split(";").forEach(r=>{r.startsWith("color:")&&(n=r.split(":")[1]),r.startsWith("background-color:")&&(e=r.split(":")[1])});const a={type:t.codox_metadata.type,text:t.text,format:t.format,mode:t.mode,detail:t.detail,version:t.version,style:"",id:t.codox_metadata.id,color:n,backgroundColor:e};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:t,originalJsonNode:a}),a}}function N1(){return new kl}function zm(c){return c instanceof kl}const A1=fo();function Um(c){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;c>=t[e];)n+=e,c-=t[e];return n}function P1(){const[c]=Sn(),t=(a,r)=>{r(a),kt(a)&&a.getChildren().forEach(o=>t(o,r))},n=()=>{c.update(()=>{const a=Un(),r=[];t(a,s=>{Hm(s)&&r.push(s)});let o=!1;for(let s=0;s<r.length;s++)if(r[s].getNumber()!==s+1){o=!0;break}o&&r.forEach((s,l)=>{const i=l+1;s.setNumber(i);const u=s.getContentKey(),d=Bn(u);if(Rr(d)){const p=d.getFirstChild();if(Wt(p)){const f=p.getTextContent(),h=f.replace(/^\[[^\]]*\]/,`[${Um(i)}]`);h!==f&&p.setTextContent(h)}}})})},e=()=>{c.update(()=>{var b;const a=Un(),r=jt(),o=PT(0);r&&r.insertNodes([o]);const s=In(),l=Qn("[?] ");s.append(l),a.append(s),o.setContentKey(s.getKey());const i=[];t(a,v=>{Hm(v)&&i.push(v)});const d=i.map(v=>v.getContentKey()).map(v=>Bn(v)).filter(v=>v!==null);d==null||d.forEach(v=>{v&&a.append(v)});let p=!1;if(a.getChildren().forEach(v=>{if(Rr(v)){const _=v.getFirstChild();if((_&&zm(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&(p=!0,!zm(_)&&_.getTextContent().includes("_______________________________"))){const x=N1();_.replace(x)}}}),!p&&(d==null?void 0:d.length)>0){const v=In();v.append(N1()),(b=d[0])==null||b.insertBefore(v)}const f=[];if(a.getChildren().forEach(v=>{if(Rr(v)){const _=v.getFirstChild();(_&&zm(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&f.push(v)}}),f.length>1)for(let v=1;v<f.length;v++)f[v].remove();const h=[];t(a,v=>{Hm(v)&&h.push(v)}),h.forEach((v,_)=>{const x=_+1;v.setNumber(x);const E=v.getContentKey(),w=Bn(E);if(Rr(w)){const y=w.getFirstChild();if(Wt(y)){const S=y.getTextContent(),C=S.replace(/^\[[^\]]*\]/,`[${Um(x)}]`);C!==S&&y.setTextContent(C)}}});const m=l.getTextContentSize(),g=Xu();g.anchor.set(l.getKey(),m,"text"),g.focus.set(l.getKey(),m,"text"),Cr(g),setTimeout(()=>{const v=c.getElementByKey(s.getKey());v&&v.scrollIntoView({behavior:"smooth",block:"end"})},100)})};return ge.useEffect(()=>{const a=c.registerCommand(A1,()=>(e(),!0),0);return c.update(()=>{setTimeout(n,100)}),a},[c]),null}class Tl extends eo{constructor(n,e,a,r){super(a||`[${n}]`,r);qn(this,"__number");qn(this,"__contentKey");this.__number=n,this.__contentKey=e}static getType(){return"endnote"}static clone(n){return new Tl(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){return new Tl(n.number,n.contentKey,n.text,n.key)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:""}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Um(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:AT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON(),e={type:"quote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="",a="";const r={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e,backgroundColor:a};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:r}),r}}function AT(c){var e;const t=(e=c.textContent)==null?void 0:e.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1;return{node:new Tl(n)}}function PT(c,t){return new Tl(c,t||"")}function Hm(c){return c instanceof Tl}class Ws extends eo{constructor(n,e,a,r){super(n,r);qn(this,"__color");qn(this,"__id");this.__color=e,this.__id=a}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new Ws(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,a){const r=super.updateDOM(n,e,a);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),r}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new Ws(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(r=>{r.startsWith("color:")&&(e=r.split(":")[1])});const a={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:a}),a}}const I1=[gc,ld,id,od,ad,hm,xs,rs,El,up,ym,rd,pc,D_,Bm,Ep,Lm,gd,hd,Sc,Cm,kp,Sp,fd,pd,xp,md,Cp,jp,yd,Tl,Ws,Na,kl],DD="";function $m(...c){return c.filter(Boolean).join(" ")}function Di({"data-test-id":c,children:t,className:n,onClick:e,disabled:a,small:r,title:o}){return ce.jsx("button",{disabled:a,className:$m("Button__root",a&&"Button__disabled",r&&"Button__small",n),onClick:e,title:o,"aria-label":o,...c&&{"data-test-id":c},children:t})}const RD="";function Tp({"data-test-id":c,children:t}){return ce.jsx("div",{className:"DialogActions","data-test-id":c,children:t})}const LD="";function Ec({label:c,value:t,onChange:n,placeholder:e="","data-test-id":a,type:r="text"}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:c}),ce.jsx("input",{type:r,className:"Input__input",placeholder:e,value:t,onChange:o=>{n(o.target.value)},"data-test-id":a})]})}const IT=ge.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function M1({children:c}){const[t,n]=ge.useState({cellEditorConfig:null,cellEditorPlugins:null});return ce.jsx(IT.Provider,{value:ge.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,a)=>{n({cellEditorConfig:e,cellEditorPlugins:a})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:c})}function MT({activeEditor:c,onClose:t}){const[n,e]=ge.useState("5"),[a,r]=ge.useState("5"),[o,s]=ge.useState(""),[l,i]=ge.useState(!0);ge.useState(!0);let u=Number(localStorage.getItem("tableCount"))||1;ge.useEffect(()=>{const f=Number(n),h=Number(a);f&&f>0&&f<=500&&h&&h>0&&h<=50?i(!1):i(!0)},[n,a]);const d=()=>{c.update(()=>{const h=Un().getChildren().filter(jr);if(h.length===0){console.warn("No tables found in the document!");return}const m=h.map(g=>{let b=o;const v=g.getPreviousSibling();if(v&&Rr(v)){const _=v.getChildren().filter(x=>x.getType()==="text");_.length>1&&(b=_[1].getTextContent())}return{caption:b,content:g.getChildren().map(_=>_.getChildren().map(x=>x.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(m))})},p=()=>{if(!n||!a)return;const f=u;c.update(()=>{const h=In();h.setFormat("left");const m=new Ws(`Table ${f}:`,"black",`table_caption_${Math.random()}`);m.setStyle("font-weight: bold; margin-right: 8px;");const g=o.trim()===""?".":o,b=Qn(g);b.setStyle(o?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),h.getChildren().forEach(x=>x.remove());const v=vi();h.append(m),h.append(b),h.append(v),es([h]);const _=n1(Number(n),Number(a),!0);if(!_){console.error("Failed to create TableNode");return}es([_]),console.log("Table inserted successfully!")}),c.update(()=>{const m=Un().getChildren().filter(jr);let g=1;m.forEach(b=>{const v=b.getPreviousSibling(),_=b.getNextSibling();if(_&&Rr(_)&&_.getChildren().forEach(x=>{x.getTextContent().startsWith("Table")&&x.remove()}),v&&Rr(v)){v.getChildren().forEach(w=>{w.getTextContent().startsWith("Table")&&w.remove()});const x=`Table ${g}:`,E=new Ws(x,"black",`table_caption_${g}`);if(v){const w=v.getFirstChild();w!==null?w.insertBefore(E):v.append(E)}}else{const x=`Table ${g}:`,E=In();E.setFormat("left");const w=new Ws(x,"black",`table_caption_${g}`);w.setStyle("font-weight: bold; margin-right: 5px;");const y=o.trim()===""?"Caption text here":o,S=Qn(y);S.setStyle("color: black; font-style: italic; font-weight: normal;"),E.append(w),E.append(Qn(" ")),E.append(S),b.insertBefore(E)}g++})}),u++,localStorage.setItem("tableCount",u.toString()),setTimeout(()=>{d()},50),t==null||t()};return ce.jsxs(ce.Fragment,{children:[ce.jsx(Ec,{placeholder:"# of rows (1-500)",label:"Rows",onChange:e,value:n,type:"number"}),ce.jsx(Ec,{placeholder:"# of columns (1-50)",label:"Columns",onChange:r,value:a,type:"number"}),ce.jsx(Ec,{placeholder:"Enter table caption",label:"Table",value:o,onChange:s}),ce.jsx(Tp,{children:ce.jsx(Di,{disabled:l,onClick:p,children:"Confirm"})})]})}const FD="",qm={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Op({defaultSelection:c}){const[t]=Sn();return ge.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:c})},[c,t]),null}function Wm(){return Un().getTextContent()}function Jm(c,t=!0){if(c)return!1;let n=Wm();return t&&(n=n.trim()),n===""}function DT(c){if(!Jm(c,!1))return!1;const t=Un().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const a=t[e];if(vr(a))return!1;if(kt(a)){if(!Rr(a)||a.__indent!==0)return!1;const r=a.getChildren(),o=r.length;for(let s=0;s<o;s++){const l=r[e];if(!Wt(l))return!1}}}return!0}function D1(c){return()=>DT(c)}function RT(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var LT=RT(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function FT(c,t,n,e){const a=o=>o instanceof n,r=o=>{const s=Qn(o.getTextContent());s.setFormat(o.getFormat()),o.replace(s)};return[c.registerNodeTransform(eo,o=>{if(!o.isSimpleText())return;let s,l=o.getPreviousSibling(),i=o.getTextContent(),u=o;if(Wt(l)){const p=l.getTextContent(),f=t(p+i);if(a(l)){if(f===null||(h=>h.getLatest().__mode)(l)!==0)return void r(l);{const h=f.end-p.length;if(h>0){const m=p+i.slice(0,h);if(l.select(),l.setTextContent(m),h===i.length)o.remove();else{const g=i.slice(h);o.setTextContent(g)}return}}}else if(f===null||f.start<p.length)return}let d=0;for(;;){s=t(i);let p,f=s===null?"":i.slice(s.end);if(i=f,f===""){const m=u.getNextSibling();if(Wt(m)){f=u.getTextContent()+m.getTextContent();const g=t(f);if(g===null)return void(a(m)?r(m):m.markDirty());if(g.start!==0)return}}if(s===null)return;if(s.start===0&&Wt(l)&&l.isTextEntity()){d+=s.end;continue}s.start===0?[p,u]=u.splitText(s.end):[,p,u]=u.splitText(s.start+d,s.end+d),p===void 0&<(165,"nodeToReplace");const h=e(p);if(h.setFormat(p.getFormat()),p.replace(h),u==null)return;d=0,l=h}}),c.registerNodeTransform(n,o=>{const s=o.getTextContent(),l=t(s);if(l===null||l.start!==0)return void r(o);if(s.length>l.end)return void o.splitText(l.end);const i=o.getPreviousSibling();Wt(i)&&i.isTextEntity()&&(r(i),r(o));const u=o.getNextSibling();Wt(u)&&u.isTextEntity()&&(r(u),a(o)&&r(o))})]}function R1(c,t,n){const[e]=Sn();ge.useEffect(()=>br(...FT(e,c,t,n)),[n,e,c,t])}const BT=new RegExp(function(){const{alpha:c,alphanumeric:t,hashChars:n}=function(){const a=String.fromCharCode,r="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ-ก-ฺเ-๎ᄀ-ᇿ-ㆅꥠ-가-ힰ-ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+a(173824)+"-"+a(177983)+a(177984)+"-"+a(178207)+a(194560)+"-"+a(195103)+"〃々〻";return{alpha:r,alphanumeric:r+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+c+"]")+e+"*)"}(),"i");function L1(){const[c]=Sn();ge.useEffect(()=>{if(!c.hasNodes([up]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[c]);const t=ge.useCallback(e=>v_(e.getTextContent()),[]),n=ge.useCallback(e=>{const a=BT.exec(e);if(a===null)return null;const r=a[3].length+1,o=a.index+a[1].length;return{end:o+r,start:o}},[]);return R1(n,up,t),null}function F1(){const[c]=Sn();return ge.useEffect(()=>{if(!c.hasNodes([id,od]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[c]),function(t){ge.useEffect(()=>br(t.registerCommand(N_,()=>(x_(t,"number"),!0),Gn),t.registerCommand(O_,()=>(x_(t,"bullet"),!0),Gn),t.registerCommand(A_,()=>(y2(t),!0),Gn),t.registerCommand(pl,()=>!!_2(),Gn)),[t])}(c),null}const zT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;function UT(c){return{initialValueFn:()=>c.isEditable(),subscribe:t=>c.registerEditableListener(t)}}function Vm(){return function(c){const[t]=Sn(),n=ge.useMemo(()=>c(t),[t,c]),e=ge.useRef(n.initialValueFn()),[a,r]=ge.useState(e.current);return zT(()=>{const{initialValueFn:o,subscribe:s}=n,l=o();return e.current!==l&&(e.current=l,r(l)),s(i=>{e.current=i,r(i)})},[n,c]),a}(UT)}function B1(c){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const a=c.getRootElement();if(document.activeElement!==a)return;const r=e.data;if(typeof r=="string"){let o;try{o=JSON.parse(r)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const s=o.payload;if(s&&s.functionId==="makeChanges"){const l=s.args;if(l){const[i,u,d,p,f,h]=l;c.update(()=>{const m=jt();if(Et(m)){const g=m.anchor;let b=g.getNode(),v=0,_=0;if(Wt(b)&&i>=0&&u>=0&&(v=i,_=i+u,m.setTextNodeRange(b,v,b,_)),v===_&&d===""||(m.insertRawText(d),b=g.getNode()),Wt(b)){v=p,_=p+f;const x=b.getTextContentSize();v=v>x?x:v,_=_>x?x:_,m.setTextNodeRange(b,v,b,_)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const Km=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;function z1(c){return c.getEditorState().read(D1(c.isComposing()))}function Np({contentEditable:c,placeholder:t,ErrorBoundary:n}){const[e]=Sn(),a=function(r,o){const[s,l]=ge.useState(()=>r.getDecorators());return Km(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{l(i)})}),[r]),ge.useEffect(()=>{l(r.getDecorators())},[r]),ge.useMemo(()=>{const i=[],u=Object.keys(s);for(let d=0;d<u.length;d++){const p=u[d],f=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(ge.Suspense,{fallback:null,children:s[p]})}),h=r.getElementByKey(p);h!==null&&i.push(so.createPortal(f,h,p))}return i},[o,s,r])}(e,n);return function(r){Km(()=>br(H2(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[c,ce.jsx(HT,{content:t}),a]})}function HT({content:c}){const[t]=Sn(),n=function(a){const[r,o]=ge.useState(()=>z1(a));return Km(()=>{function s(){const l=z1(a);o(l)}return s(),br(a.registerUpdateListener(()=>{s()}),a.registerEditableListener(()=>{s()}))},[a]),r}(t),e=Vm();return n?typeof c=="function"?c(e):c:null}function $T(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var Ap=$T(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function U1({hasCellMerge:c=!0,hasCellBackgroundColor:t=!0,hasTabHandler:n=!0}){const[e]=Sn();return ge.useEffect(()=>(e.hasNodes([xs,rs,El])||Ap(10),br(e.registerCommand($2,({columns:a,rows:r,includeHeaders:o})=>{const s=n1(Number(r),Number(a),o);wl(s);const l=s.getFirstDescendant();return Wt(l)&&l.select(),!0},kn),e.registerNodeTransform(xs,a=>{const[r]=i1(a,null,null),o=r.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<r.length;++s){const l=r[s].length;if(l===o)continue;const i=r[s][l-1].cell;for(let u=l;u<o;++u){const d=_i(0);d.append(In()),i!==null?i.insertAfter(d):r_(i,d)}}}))),[e]),ge.useEffect(()=>{const a=new Map,r=s=>{const l=s.getKey(),i=e.getElementByKey(l);if(i&&!a.has(l)){const u=tT(s,i,e,n);a.set(l,u)}};e.getEditorState().read(()=>{const s=Wv(xs);for(const l of s)jr(l)&&r(l)});const o=e.registerMutationListener(xs,s=>{for(const[l,i]of s)if(i==="created")e.getEditorState().read(()=>{const u=Bn(l);jr(u)&&r(u)});else if(i==="destroyed"){const u=a.get(l);u!==void 0&&(u.removeListeners(),a.delete(l))}});return()=>{o();for(const[,s]of a)s.removeListeners()}},[e,n]),ge.useEffect(()=>{if(!c)return e.registerNodeTransform(rs,a=>{if(a.getColSpan()>1||a.getRowSpan()>1){const[,,r]=Ao(a),[o]=os(r,a,a),s=o.length,l=o[0].length;let i=r.getFirstChild();Mr(i)||Ap(175);const u=[];for(let d=0;d<s;d++){d!==0&&(i=i.getNextSibling(),Mr(i)||Ap(175));let p=null;for(let f=0;f<l;f++){const h=o[d][f],m=h.cell;if(h.startRow===d&&h.startColumn===f)p=m,u.push(m);else if(m.getColSpan()>1||m.getRowSpan()>1){vn(m)||Ap(176);const g=_i(m.__headerState);p!==null?p.insertAfter(g):r_(i,g)}}}for(const d of u)d.setColSpan(1),d.setRowSpan(1)}})},[e,c]),ge.useEffect(()=>{if(!t)return e.registerNodeTransform(rs,a=>{a.getBackgroundColor()!==null&&a.setBackgroundColor(null)})},[e,t,c]),null}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;let WT=class{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}};const H1=c=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),c.scrollIntoView({block:"nearest"})};function $1(c,t){const n=c.getBoundingClientRect(),e=t.getBoundingClientRect();return n.top>e.top&&n.top<e.bottom}function JT(c,t,n,e){const[a]=Sn();ge.useEffect(()=>{if(t!=null&&c!=null){const r=a.getRootElement(),o=r!=null?function(d,p){let f=getComputedStyle(d);const h=f.position==="absolute",m=/(auto|scroll)/;if(f.position==="fixed")return document.body;for(let g=d;g=g.parentElement;)if(f=getComputedStyle(g),(!h||f.position!=="static")&&m.test(f.overflow+f.overflowY+f.overflowX))return g;return document.body}(r):document.body;let s=!1,l=$1(t,o);const i=function(){s||(window.requestAnimationFrame(function(){n(),s=!1}),s=!0);const d=$1(t,o);d!==l&&(l=d,e!=null&&e(d))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",i,{capture:!0,passive:!0}),u.observe(t),()=>{u.unobserve(t),window.removeEventListener("resize",n),document.removeEventListener("scroll",i,!0)}}},[t,a,e,n,c])}const q1=fo();function VT({close:c,editor:t,anchorElementRef:n,resolution:e,options:a,menuRenderFn:r,onSelectOption:o,shouldSplitNodeWithQuery:s=!1,commandPriority:l=Gn}){const[i,u]=ge.useState(null),d=e.match&&e.match.matchingString;ge.useEffect(()=>{u(0)},[d]);const p=ge.useCallback(h=>{t.update(()=>{const m=e.match!=null&&s?function(g){const b=jt();if(!Et(b)||!b.isCollapsed())return null;const v=b.anchor;if(v.type!=="text")return null;const _=v.getNode();if(!_.isSimpleText())return null;const x=v.offset,E=_.getTextContent().slice(0,x),w=g.replaceableString.length,y=x-function(C,T,F){let B=F;for(let M=B;M<=T.length;M++)C.substr(-M)===T.substr(0,M)&&(B=M);return B}(E,g.matchingString,w);if(y<0)return null;let S;return y===0?[S]=_.splitText(x):[,S]=_.splitText(y,x),S}(e.match):null;o(h,m,c,e.match?e.match.matchingString:"")})},[t,s,e.match,o,c]),f=ge.useCallback(h=>{const m=t.getRootElement();m!==null&&(m.setAttribute("aria-activedescendant","typeahead-item-"+h),u(h))},[t]);return ge.useEffect(()=>()=>{const h=t.getRootElement();h!==null&&h.removeAttribute("aria-activedescendant")},[t]),qT(()=>{a===null?u(null):i===null&&f(0)},[a,i,f]),ge.useEffect(()=>br(t.registerCommand(q1,({option:h})=>!(!h.ref||h.ref.current==null)&&(H1(h.ref.current),!0),l)),[t,f,l]),ge.useEffect(()=>br(t.registerCommand(Du,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==a.length-1?i+1:0;f(g);const b=a[g];b.ref!=null&&b.ref.current&&t.dispatchCommand(q1,{index:g,option:b}),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Mu,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==0?i-1:a.length-1;f(g);const b=a[g];b.ref!=null&&b.ref.current&&H1(b.ref.current),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Ls,h=>{const m=h;return m.preventDefault(),m.stopImmediatePropagation(),c(),!0},l),t.registerCommand(xf,h=>{const m=h;return a!==null&&i!==null&&a[i]!=null&&(m.preventDefault(),m.stopImmediatePropagation(),p(a[i]),!0)},l),t.registerCommand(Rs,h=>a!==null&&i!==null&&a[i]!=null&&(h!==null&&(h.preventDefault(),h.stopImmediatePropagation()),p(a[i]),!0),l)),[p,c,t,a,i,f,l]),r(n,ge.useMemo(()=>({options:a,selectOptionAndCleanUp:p,selectedIndex:i,setHighlightedIndex:u}),[p,i,a]),e.match?e.match.matchingString:"")}function KT({options:c,nodeKey:t,onClose:n,onOpen:e,onSelectOption:a,menuRenderFn:r,anchorClassName:o,commandPriority:s=Gn,parent:l}){const[i]=Sn(),[u,d]=ge.useState(null),p=function(g,b,v,_=document.body){const[x]=Sn(),E=ge.useRef(document.createElement("div")),w=ge.useCallback(()=>{E.current.style.top=E.current.style.bottom;const S=x.getRootElement(),C=E.current,T=C.firstChild;if(S!==null&&g!==null){const{left:F,top:B,width:M,height:L}=g.getRect(),A=E.current.offsetHeight;if(C.style.top=`${B+window.pageYOffset+A+3}px`,C.style.left=`${F+window.pageXOffset}px`,C.style.height=`${L}px`,C.style.width=`${M}px`,T!==null){T.style.top=`${B}`;const j=T.getBoundingClientRect(),N=j.height,R=j.width,O=S.getBoundingClientRect();F+R>O.right&&(C.style.left=`${O.right-R+window.pageXOffset}px`),(B+N>window.innerHeight||B+N>O.bottom)&&B-O.top>N+L&&(C.style.top=B-N+window.pageYOffset-L+"px")}C.isConnected||(v!=null&&(C.className=v),C.setAttribute("aria-label","Typeahead menu"),C.setAttribute("id","typeahead-menu"),C.setAttribute("role","listbox"),C.style.display="block",C.style.position="absolute",_.append(C)),E.current=C,S.setAttribute("aria-controls","typeahead-menu")}},[x,g,v,_]);ge.useEffect(()=>{const S=x.getRootElement();if(g!==null)return w(),()=>{S!==null&&S.removeAttribute("aria-controls");const C=E.current;C!==null&&C.isConnected&&C.remove()}},[x,w,g]);const y=ge.useCallback(S=>{g!==null&&(S||b(null))},[g,b]);return JT(g,E.current,w,y),E}(u,d,o,l),f=ge.useCallback(()=>{d(null),n!=null&&u!==null&&n()},[n,u]),h=ge.useCallback(g=>{d(g),e!=null&&u===null&&e(g)},[e,u]),m=ge.useCallback(()=>{t?i.update(()=>{const g=Bn(t),b=i.getElementByKey(t);var v;g!=null&&b!=null&&u==null&&(v=()=>h({getRect:()=>b.getBoundingClientRect()}),ir.startTransition?ir.startTransition(v):v())}):t==null&&u!=null&&f()},[f,i,t,h,u]);return ge.useEffect(()=>{m()},[m,t]),ge.useEffect(()=>{if(t!=null)return i.registerUpdateListener(({dirtyElements:g})=>{g.get(t)&&m()})},[i,m,t]),u===null||i===null?null:ce.jsx(VT,{close:f,resolution:u,editor:i,anchorElementRef:p,options:c,menuRenderFn:r,onSelectOption:a,commandPriority:s})}const GT=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,YT=fo();let W1=class extends WT{constructor(t,n){super(t),this.title=t,this.onSelect=n.onSelect.bind(this)}};function ZT({embedConfigs:c,onOpenEmbedModalForConfig:t,getMenuOptions:n,menuRenderFn:e,menuCommandPriority:a=Gn}){const[r]=Sn(),[o,s]=ge.useState(null),[l,i]=ge.useState(null),u=ge.useCallback(()=>{s(null),i(null)},[]),d=ge.useCallback(m=>{r.getEditorState().read(async function(){const g=Bn(m);if(Qo(g))for(let b=0;b<c.length;b++){const v=c[b];await Promise.resolve(v.parseUrl(g.__url))!=null&&(i(v),s(g.getKey()))}})},[r,c]);ge.useEffect(()=>br(...[pc,rd].map(m=>r.registerMutationListener(m,(...g)=>((b,{updateTags:v,dirtyLeaves:_})=>{for(const[x,E]of b)E==="created"&&v.has("paste")&&_.size<=3?d(x):x===o&&u()})(...g)))),[d,r,c,o,u]),ge.useEffect(()=>r.registerCommand(YT,m=>{const g=c.find(({type:b})=>b===m);return!!g&&(t(g),!0)},kn),[r,c,t]);const p=ge.useCallback(async function(){if(l!=null&&o!=null){const m=r.getEditorState().read(()=>{const g=Bn(o);return Qo(g)?g:null});if(Qo(m)){const g=await Promise.resolve(l.parseUrl(m.__url));g!=null&&r.update(()=>{jt()||m.selectEnd(),l.insertNode(r,g),m.isAttached()&&m.remove()})}}},[l,r,o]),f=ge.useMemo(()=>l!=null&&o!=null?n(l,p,u):[],[l,p,n,o,u]),h=ge.useCallback((m,g,b)=>{r.update(()=>{m.onSelect(g),b()})},[r]);return o!=null?ce.jsx(KT,{nodeKey:o,onClose:u,onSelectOption:h,options:f,menuRenderFn:e,commandPriority:a}):null}const BD="";function XT({onClose:c,children:t,title:n,closeOnClickOutside:e}){const a=ge.useRef(null);return ge.useEffect(()=>{a.current!==null&&a.current.focus()},[]),ge.useEffect(()=>{let r=null;const o=i=>{i.key==="Escape"&&c()},s=i=>{const u=i.target;a.current!==null&&!a.current.contains(u)&&e&&c()},l=a.current;return l!==null&&(r=l.parentElement,r!==null&&r.addEventListener("click",s)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),r!==null&&(r==null||r.removeEventListener("click",s))}},[e,c]),ce.jsx("div",{className:"Modal__overlay",role:"dialog",children:ce.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:a,children:[ce.jsx("h2",{className:"Modal__title",children:n}),ce.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:c,children:"X"}),ce.jsx("div",{className:"Modal__content",children:t})]})})}function QT({onClose:c,children:t,title:n,closeOnClickOutside:e=!1}){return so.createPortal(ce.jsx(XT,{onClose:c,title:n,closeOnClickOutside:e,children:t}),document.body)}function Ma(){const[c,t]=ge.useState(null),n=ge.useCallback(()=>{t(null)},[]),e=ge.useMemo(()=>{if(c===null)return null;const{title:r,content:o,closeOnClickOutside:s}=c;return ce.jsx(QT,{onClose:n,title:r,closeOnClickOutside:s,children:o})},[c,n]),a=ge.useCallback((r,o,s=!1)=>{t({closeOnClickOutside:s,content:o(n),title:r})},[n]);return[e,a]}const eO=fo(),tO=fo(),nO=fo(),rO={contentName:"Youtube Video",exampleUrl:"https://www.youtube.com/watch?v=jNQXAC9IVRw",icon:ce.jsx("i",{className:"icon youtube"}),insertNode:(c,t)=>{c.dispatchCommand(nO,t.id)},keywords:["youtube","video"],parseUrl:async c=>{const t=/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/.exec(c),n=t&&(t==null?void 0:t[2].length)===11?t[2]:null;return n!=null?{id:n,url:c}:null},type:"youtube-video"},oO=[{contentName:"Tweet",exampleUrl:"https://twitter.com/jack/status/20",icon:ce.jsx("i",{className:"icon tweet"}),insertNode:(c,t)=>{c.dispatchCommand(tO,t.id)},keywords:["tweet","twitter"],parseUrl:c=>{const t=/^https:\/\/(twitter|x)\.com\/(#!\/)?(\w+)\/status(es)*\/(\d+)/.exec(c);return t!=null?{id:t[5],url:t[1]}:null},type:"tweet"},rO,{contentName:"Figma Document",exampleUrl:"https://www.figma.com/file/LKQ4FJ4bTnCSjedbRpk931/Sample-File",icon:ce.jsx("i",{className:"icon figma"}),insertNode:(c,t)=>{c.dispatchCommand(eO,t.id)},keywords:["figma","figma.com","mock-up"],parseUrl:c=>{const t=/https:\/\/([\w.-]+\.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/.exec(c);return t!=null?{id:t[3],url:t[0]}:null},type:"figma"}];function iO({index:c,isSelected:t,onClick:n,onMouseEnter:e,option:a}){let r="item";return t&&(r+=" selected"),ce.jsx("li",{tabIndex:-1,className:r,ref:a.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+c,onMouseEnter:e,onClick:n,children:ce.jsx("span",{className:"text",children:a.title})},a.key)}function sO({options:c,selectedItemIndex:t,onOptionClick:n,onOptionMouseEnter:e}){return ce.jsx("div",{className:"typeahead-popover",children:ce.jsx("ul",{children:c.map((a,r)=>ce.jsx(iO,{index:r,isSelected:t===r,onClick:()=>n(a,r),onMouseEnter:()=>e(r),option:a},a.key))})})}const aO=(c,t)=>{let n;return e=>{window.clearTimeout(n),n=window.setTimeout(()=>{c(e)},t)}};function lO({embedConfig:c,onClose:t}){const[n,e]=ge.useState(""),[a]=Sn(),[r,o]=ge.useState(null),s=ge.useMemo(()=>aO(i=>{const u=GT.exec(i);c!=null&&i!=null&&u!=null?Promise.resolve(c.parseUrl(i)).then(d=>{o(d)}):r!=null&&o(null)},200),[c,r]),l=()=>{r!=null&&(c.insertNode(a,r),t())};return ce.jsxs("div",{style:{width:"600px"},children:[ce.jsx("div",{className:"Input__wrapper",children:ce.jsx("input",{type:"text",className:"Input__input",placeholder:c.exampleUrl,value:n,"data-test-id":`${c.type}-embed-modal-url`,onChange:i=>{const{value:u}=i.target;e(u),s(u)}})}),ce.jsx(Tp,{children:ce.jsx(Di,{disabled:!r,onClick:l,"data-test-id":`${c.type}-embed-modal-submit-btn`,children:"Embed"})})]})}function J1(){const[c,t]=Ma(),n=a=>{t(`Embed ${a.contentName}`,r=>ce.jsx(lO,{embedConfig:a,onClose:r}))},e=(a,r,o)=>[new W1("Dismiss",{onSelect:o}),new W1(`Embed ${a.contentName}`,{onSelect:r})];return ce.jsxs(ce.Fragment,{children:[c,ce.jsx(ZT,{embedConfigs:oO,onOpenEmbedModalForConfig:n,getMenuOptions:e,menuRenderFn:(a,{selectedIndex:r,options:o,selectOptionAndCleanUp:s,setHighlightedIndex:l})=>a.current?yf.createPortal(ce.jsx("div",{className:"typeahead-popover auto-embed-menu",style:{marginLeft:a.current.style.width,width:200},children:ce.jsx(sO,{options:o,selectedItemIndex:r,onOptionClick:(i,u)=>{l(u),s(i)},onOptionMouseEnter:i=>{l(i)}})}),a.current):null})]})}function cO(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var uO=cO(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function V1(c,t=n=>n){return n=>{const e=c.exec(n);return e===null?null:{index:e.index,length:e[0].length,text:e[0],url:t(e[0])}}}function K1(c,t){for(let n=0;n<t.length;n++){const e=t[n](c);if(e)return e}return null}const dO=/[.,;\s]/;function Pp(c){return dO.test(c)}function G1(c){return Pp(c[c.length-1])}function Gm(c){return Pp(c[0])}function Y1(c){let t=c.getPreviousSibling();return kt(t)&&(t=t.getLastDescendant()),t===null||vs(t)||Wt(t)&&G1(t.getTextContent())}function Z1(c){let t=c.getNextSibling();return kt(t)&&(t=t.getFirstDescendant()),t===null||vs(t)||Wt(t)&&Gm(t.getTextContent())}function fO(c,t,n,e){return(c>0?Pp(n[c-1]):Y1(e[0]))?t<n.length?Pp(n[t]):Z1(e[e.length-1]):!1}function pO(c,t,n){const e=[],a=[],r=[];let o=0,s=0;const l=[...c];for(;l.length>0;){const i=l[0],u=i.getTextContent().length,d=s;s+u<=t?(e.push(i),o+=u):d>=n?r.push(i):a.push(i),s+=u,l.shift()}return[o,e,a,r]}function hO(c,t,n,e){const a=_m(e.url,e.attributes);if(c.length===1){let r,o=c[0];t===0?[r,o]=o.splitText(n):[,r,o]=o.splitText(t,n);const s=Qn(e.text);return s.setFormat(r.getFormat()),s.setDetail(r.getDetail()),s.setStyle(r.getStyle()),a.append(s),r.replace(a),o}if(c.length>1){const r=c[0];let o,s=r.getTextContent().length;t===0?o=r:[,o]=r.splitText(t);const l=[];let i;for(let f=1;f<c.length;f++){const h=c[f],m=h.getTextContent().length,g=s;if(g<n)if(s+m<=n)l.push(h);else{const[b,v]=h.splitText(n-g);l.push(b),i=v}s+=m}const u=jt(),d=u?u.getNodes().find(Wt):void 0,p=Qn(o.getTextContent());return p.setFormat(o.getFormat()),p.setDetail(o.getDetail()),p.setStyle(o.getStyle()),a.append(p,...l),d&&d===o&&(Et(u)?p.select(u.anchor.offset,u.focus.offset):dr(u)&&p.select(0,p.getTextContent().length)),o.replace(a),i}}function Ym(c,t,n){const e=c.getChildren(),a=e.length;for(let l=0;l<a;l++){const i=e[l];if(!Wt(i)||!i.isSimpleText())return Ip(c),void n(null,c.getURL())}const r=c.getTextContent(),o=K1(r,t);if(o===null||o.text!==r||!Y1(c)||!Z1(c))return Ip(c),void n(null,c.getURL());const s=c.getURL();if(s!==o.url&&(c.setURL(o.url),n(o.url,s)),o.attributes){const l=c.getRel();l!==o.attributes.rel&&(c.setRel(o.attributes.rel||null),n(o.attributes.rel||null,l));const i=c.getTarget();i!==o.attributes.target&&(c.setTarget(o.attributes.target||null),n(o.attributes.target||null,i))}}function Ip(c){const t=c.getChildren();for(let n=t.length-1;n>=0;n--)c.insertAfter(t[n]);return c.remove(),t.map(n=>n.getLatest())}function gO(c,t,n){ge.useEffect(()=>{c.hasNodes([rd])||uO(77);const e=(a,r)=>{n&&n(a,r)};return br(c.registerNodeTransform(eo,a=>{const r=a.getParentOrThrow(),o=a.getPreviousSibling();if(hc(r)&&!r.getIsUnlinked())Ym(r,t,e);else if(!Qo(r)){if(a.isSimpleText()&&(Gm(a.getTextContent())||!hc(o))){const s=function(l){const i=[l];let u=l.getNextSibling();for(;u!==null&&Wt(u)&&u.isSimpleText()&&(i.push(u),!/[\s]/.test(u.getTextContent()));)u=u.getNextSibling();return i}(a);(function(l,i,u){let d=[...l];const p=d.map(g=>g.getTextContent()).join("");let f,h=p,m=0;for(;(f=K1(h,i))&&f!==null;){const g=f.index,b=g+f.length;if(fO(m+g,m+b,p,d)){const[v,,_,x]=pO(d,m+g,m+b),E=hO(_,m+g-v,m+b-v,f);d=E?[E,...x]:x,u(f.url,null),m=0}else m+=b;h=h.substring(b)}})(s,t,e)}(function(s,l,i){const u=s.getPreviousSibling(),d=s.getNextSibling(),p=s.getTextContent();!hc(u)||u.getIsUnlinked()||Gm(p)&&!/^\.[a-zA-Z0-9]{1,}/.test(p)||(u.append(s),Ym(u,l,i),i(null,u.getURL())),!hc(d)||d.getIsUnlinked()||G1(p)||(Ip(d),Ym(d,l,i),i(null,d.getURL()))})(a,t,e)}}),c.registerCommand(Aa,a=>{const r=jt();return a!==null||!Et(r)||r.extract().forEach(o=>{const s=o.getParent();if(hc(s))return s.setIsUnlinked(!s.getIsUnlinked()),s.markDirty(),!0}),!1},Gn))},[c,t,n])}function mO({matchers:c,onChange:t}){const[n]=Sn();return gO(n,c,t),null}const yO=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,vO=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,bO=[V1(yO,c=>c.startsWith("http")?c:`https://${c}`),V1(vO,c=>`mailto:${c}`)];function X1(){return ce.jsx(mO,{matchers:bO})}function _O({accept:c,label:t,onChange:n,"data-test-id":e}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:t}),ce.jsx("input",{type:"file",accept:c,className:"Input__input",onChange:a=>n(a.target.files),"data-test-id":e})]})}const Cc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wO=c=>Cc?(c||window).getSelection():null,Mp=fo();function xO({onClick:c}){const[t,n]=ge.useState(""),[e,a]=ge.useState(""),r=t==="",o=s=>{const l=new FileReader;l.onload=function(){return typeof l.result=="string"&&n(l.result),""},s!==null&&l.readAsDataURL(s[0])};return ce.jsxs(ce.Fragment,{children:[ce.jsx(_O,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),ce.jsx(Ec,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:a,value:e,"data-test-id":"image-modal-alt-text-input"}),ce.jsx(Tp,{children:ce.jsx(Di,{"data-test-id":"image-modal-file-upload-btn",disabled:r,onClick:()=>c({altText:e,src:t}),children:"Confirm"})})]})}function SO({activeEditor:c,onClose:t,captionsEnabled:n}){const[e,a]=ge.useState("file"),r=ge.useRef(!1);ge.useEffect(()=>{r.current=!1;const s=l=>{r.current=l.altKey};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[c]);const o=s=>{c.dispatchCommand(Mp,s),console.log("line 202 imageplugin insert image"),t()};return ce.jsx(ce.Fragment,{children:e==="file"&&ce.jsx(xO,{onClick:o})})}function EO(c,t,n){c.preventDefault();const e=c.clipboardData;if(!e)return!1;const a=e.items;if(!a||a.length===0)return!1;let r=!1,o=!1;const s=a.length>1?a[1]:a[0];let l=1;if(l===1){if(l=2,s.type==="text/html"&&!r){const i=e.getData("text/html"),d=new DOMParser().parseFromString(i,"text/html").querySelector("img");d&&d.src&&(fetch(d.src).then(p=>p.blob()).then(p=>{const f=new File([p],"pasted-image.png",{type:"image/png"});Q1(f,t)}).catch(p=>console.error("Error fetching pasted image:",p)),r=!0)}else if(s.type.startsWith("image/")&&!r){const i=s.getAsFile();i&&(Q1(i,t),r=!0)}else if(s.type.startsWith("text")&&!o){const i=e.getData("text/plain");CO(i,t),o=!0}}return!(!r&&!o)}function Q1(c,t){const n=new FileReader;n.onload=()=>{const e=n.result,r={altText:c.name,src:e};t.update(()=>{const i=`Figure ${Un().getChildren().filter(m=>Wt(m)&&m.getTextContent().startsWith("Figure")).length+1}`;Qn(i).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;");const d=wc({...r,figureLabel:i}),p=In();p.setFormat("left"),vi(),Qn(".").setStyle("color: black; font-style: italic; font-weight: bold;"),p.append(d),es([p]),Qr(d.getParentOrThrow())&&dm(d,In).selectEnd(),t.update(()=>{const g=Un().getChildren().filter(v=>Rr(v));let b=1;g.forEach(v=>{const _=v.getChildren().find(E=>E.getTextContent().startsWith("Figure")),x=`Figure ${b}:`;if(_){const E=new Ws(x,"black",`Image_caption_307_${Math.random()}`);_.replace(E),b++}})})})},n.readAsDataURL(c)}function CO(c,t){t.update(()=>{const r=`Text ${Un().getChildren().filter(d=>Wt(d)&&d.getTextContent().startsWith("Text")).length+1}`;Qn(r).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;"),Qn(c);const s=In();s.setFormat("left");const l=vi();Qn(".").setStyle("color: black; font-style: italic; font-weight: bold;"),s.append(l),es([s]),t.update(()=>{const p=Un().getChildren().filter(h=>Rr(h));let f=1;p.forEach(h=>{const m=h.getChildren().find(b=>b.getTextContent().startsWith("Text")),g=`Text ${f}:`;if(m){const b=Qn(g);m.replace(b),f++}})})})}function ew({captionsEnabled:c=!0}){const[t]=Sn(),[n,e]=ge.useState("");return ge.useEffect(()=>{if(!t.hasNodes([Ep]))throw new Error("ImagesPlugin: ImageNode not registered on editor");let a=0;return br(t.registerCommand(Mp,r=>{if(a+=1,c){Qn(`Figure ${a}:`).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;");const s=wc({...r}),l=In();l.setFormat("left"),vi();const i=n.trim()===""?".":n;Qn(i).setStyle(i?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),l.append(s),es([l]),Qr(s.getParentOrThrow())&&dm(s,In).selectEnd()}else{const o=wc(r),s=In();s.setFormat("left");const l=vi();s.append(o,l),es([s]),Qr(o.getParentOrThrow())&&dm(o,In).selectEnd()}return t.update(()=>{const s=Un().getChildren().filter(i=>Rr(i));let l=1;s.forEach((i,u)=>{const d=i.getChildren().find(f=>f.getTextContent().startsWith("Figure")),p=`Figure ${l}:`;if(d){const f=new Ws(p,"black",`Image_caption_307_${Math.random()}`);d.replace(f),l++}})}),!0},kn),t.registerCommand(Xl,r=>kO(r),ts),t.registerCommand(ug,r=>TO(r),Gn),t.registerCommand(Sf,r=>OO(r,t),ts),t.registerCommand(_a,r=>EO(r,t),ts))},[c,t]),null}const jO="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",tw=document.createElement("img");tw.src=jO;function kO(c){const t=Zm();if(!t)return!1;const n=c.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(tw,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:t.__altText,caption:t.__caption,height:t.__height,key:t.getKey(),maxWidth:t.__maxWidth,showCaption:t.__showCaption,src:t.__src,width:t.__width},type:"image"})),!0):!1}function TO(c){return Zm()?(nw(c)||c.preventDefault(),!0):!1}function OO(c,t){const n=Zm();if(!n)return!1;const e=NO(c);if(!e)return!1;if(c.preventDefault(),nw(c)){const a=AO(c);n.remove();const r=Xu();a!=null&&r.applyDOMRange(a),Cr(r),t.dispatchCommand(Mp,e)}return!0}function Zm(){const c=jt();if(!dr(c))return null;const n=c.getNodes()[0];return xc(n)?n:null}function NO(c){var a;const t=(a=c.dataTransfer)==null?void 0:a.getData("application/x-lexical-drag");if(!t)return null;const{type:n,data:e}=JSON.parse(t);return n!=="image"?null:e}function nw(c){const t=c.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function AO(c){let t;const n=c.target,e=n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView,a=wO(e);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(c.clientX,c.clientY);else if(c.rangeParent&&a!==null)a.collapse(c.rangeParent,c.rangeOffset||0),t=a.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}const rw=["image/","image/heic","image/heif","image/gif","image/webp"];function ow(){const[c]=Sn();return ge.useEffect(()=>c.registerCommand(km,t=>((async()=>{const n=await e2(t,[rw].flatMap(e=>e));for(const{file:e,result:a}of n)e_(e,rw)&&c.dispatchCommand(Mp,{altText:e.name,src:a})})(),!0),Gn),[c]),null}const PO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;let iw=class{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}};const sw=c=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),c.scrollIntoView({block:"nearest"})};function aw(c,t){const n=c.getBoundingClientRect(),e=t.getBoundingClientRect();return n.top>e.top&&n.top<e.bottom}function IO(c,t,n,e){const[a]=Sn();ge.useEffect(()=>{if(t!=null&&c!=null){const r=a.getRootElement(),o=r!=null?function(d,p){let f=getComputedStyle(d);const h=f.position==="absolute",m=/(auto|scroll)/;if(f.position==="fixed")return document.body;for(let g=d;g=g.parentElement;)if(f=getComputedStyle(g),(!h||f.position!=="static")&&m.test(f.overflow+f.overflowY+f.overflowX))return g;return document.body}(r):document.body;let s=!1,l=aw(t,o);const i=function(){s||(window.requestAnimationFrame(function(){n(),s=!1}),s=!0);const d=aw(t,o);d!==l&&(l=d,e!=null&&e(d))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",i,{capture:!0,passive:!0}),u.observe(t),()=>{u.unobserve(t),window.removeEventListener("resize",n),document.removeEventListener("scroll",i,!0)}}},[t,a,e,n,c])}const lw=fo();function MO({close:c,editor:t,anchorElementRef:n,resolution:e,options:a,menuRenderFn:r,onSelectOption:o,shouldSplitNodeWithQuery:s=!1,commandPriority:l=Gn}){const[i,u]=ge.useState(null),d=e.match&&e.match.matchingString;ge.useEffect(()=>{u(0)},[d]);const p=ge.useCallback(h=>{t.update(()=>{const m=e.match!=null&&s?function(g){const b=jt();if(!Et(b)||!b.isCollapsed())return null;const v=b.anchor;if(v.type!=="text")return null;const _=v.getNode();if(!_.isSimpleText())return null;const x=v.offset,E=_.getTextContent().slice(0,x),w=g.replaceableString.length,y=x-function(C,T,F){let B=F;for(let M=B;M<=T.length;M++)C.substr(-M)===T.substr(0,M)&&(B=M);return B}(E,g.matchingString,w);if(y<0)return null;let S;return y===0?[S]=_.splitText(x):[,S]=_.splitText(y,x),S}(e.match):null;o(h,m,c,e.match?e.match.matchingString:"")})},[t,s,e.match,o,c]),f=ge.useCallback(h=>{const m=t.getRootElement();m!==null&&(m.setAttribute("aria-activedescendant","typeahead-item-"+h),u(h))},[t]);return ge.useEffect(()=>()=>{const h=t.getRootElement();h!==null&&h.removeAttribute("aria-activedescendant")},[t]),PO(()=>{a===null?u(null):i===null&&f(0)},[a,i,f]),ge.useEffect(()=>br(t.registerCommand(lw,({option:h})=>!(!h.ref||h.ref.current==null)&&(sw(h.ref.current),!0),l)),[t,f,l]),ge.useEffect(()=>br(t.registerCommand(Du,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==a.length-1?i+1:0;f(g);const b=a[g];b.ref!=null&&b.ref.current&&t.dispatchCommand(lw,{index:g,option:b}),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Mu,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==0?i-1:a.length-1;f(g);const b=a[g];b.ref!=null&&b.ref.current&&sw(b.ref.current),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Ls,h=>{const m=h;return m.preventDefault(),m.stopImmediatePropagation(),c(),!0},l),t.registerCommand(xf,h=>{const m=h;return a!==null&&i!==null&&a[i]!=null&&(m.preventDefault(),m.stopImmediatePropagation(),p(a[i]),!0)},l),t.registerCommand(Rs,h=>a!==null&&i!==null&&a[i]!=null&&(h!==null&&(h.preventDefault(),h.stopImmediatePropagation()),p(a[i]),!0),l)),[p,c,t,a,i,f,l]),r(n,ge.useMemo(()=>({options:a,selectOptionAndCleanUp:p,selectedIndex:i,setHighlightedIndex:u}),[p,i,a]),e.match?e.match.matchingString:"")}const DO=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function cw(c,{minLength:t=1,maxLength:n=75}){return ge.useCallback(e=>{const a=new RegExp("(^|\\s|\\()(["+c+"]((?:"+("[^"+c+DO+"\\s]")+"){0,"+n+"}))$").exec(e);if(a!==null){const r=a[1],o=a[3];if(o.length>=t)return{leadOffset:a.index+r.length,matchingString:o,replaceableString:a[2]}}return null},[n,t,c])}function uw({options:c,onQueryChange:t,onSelectOption:n,onOpen:e,onClose:a,menuRenderFn:r,triggerFn:o,anchorClassName:s,commandPriority:l=Gn,parent:i}){const[u]=Sn(),[d,p]=ge.useState(null),f=function(g,b,v,_=document.body){const[x]=Sn(),E=ge.useRef(document.createElement("div")),w=ge.useCallback(()=>{E.current.style.top=E.current.style.bottom;const S=x.getRootElement(),C=E.current,T=C.firstChild;if(S!==null&&g!==null){const{left:F,top:B,width:M,height:L}=g.getRect(),A=E.current.offsetHeight;if(C.style.top=`${B+window.pageYOffset+A+3}px`,C.style.left=`${F+window.pageXOffset}px`,C.style.height=`${L}px`,C.style.width=`${M}px`,T!==null){T.style.top=`${B}`;const j=T.getBoundingClientRect(),N=j.height,R=j.width,O=S.getBoundingClientRect();F+R>O.right&&(C.style.left=`${O.right-R+window.pageXOffset}px`),(B+N>window.innerHeight||B+N>O.bottom)&&B-O.top>N+L&&(C.style.top=B-N+window.pageYOffset-L+"px")}C.isConnected||(v!=null&&(C.className=v),C.setAttribute("aria-label","Typeahead menu"),C.setAttribute("id","typeahead-menu"),C.setAttribute("role","listbox"),C.style.display="block",C.style.position="absolute",_.append(C)),E.current=C,S.setAttribute("aria-controls","typeahead-menu")}},[x,g,v,_]);ge.useEffect(()=>{const S=x.getRootElement();if(g!==null)return w(),()=>{S!==null&&S.removeAttribute("aria-controls");const C=E.current;C!==null&&C.isConnected&&C.remove()}},[x,w,g]);const y=ge.useCallback(S=>{g!==null&&(S||b(null))},[g,b]);return IO(g,E.current,w,y),E}(d,p,s,i),h=ge.useCallback(()=>{p(null),a!=null&&d!==null&&a()},[a,d]),m=ge.useCallback(g=>{p(g),e!=null&&d===null&&e(g)},[e,d]);return ge.useEffect(()=>{const g=u.registerUpdateListener(()=>{u.getEditorState().read(()=>{const b=u._window||window,v=b.document.createRange(),_=jt(),x=function(y){let S=null;return y.getEditorState().read(()=>{const C=jt();Et(C)&&(S=function(T){const F=T.anchor;if(F.type!=="text")return null;const B=F.getNode();if(!B.isSimpleText())return null;const M=F.offset;return B.getTextContent().slice(0,M)}(C))}),S}(u);if(!Et(_)||!_.isCollapsed()||x===null||v===null)return void h();const E=o(x,u);if(t(E?E.matchingString:null),E!==null&&!function(y,S){return S===0&&y.getEditorState().read(()=>{const C=jt();if(Et(C)){const T=C.anchor.getNode().getPreviousSibling();return Wt(T)&&T.isTextEntity()}return!1})}(u,E.leadOffset)&&function(S,C,T){const F=T.getSelection();if(F===null||!F.isCollapsed)return!1;const B=F.anchorNode,M=S,L=F.anchorOffset;if(B==null||L==null)return!1;try{C.setStart(B,M),C.setEnd(B,L)}catch{return!1}return!0}(E.leadOffset,v,b)!==null)return w=()=>m({getRect:()=>v.getBoundingClientRect(),match:E}),void(ir.startTransition?ir.startTransition(w):w());var w;h()})});return()=>{g()}},[u,o,t,d,h,m]),d===null||u===null?null:ce.jsx(MO,{close:h,resolution:d,editor:u,anchorElementRef:f,options:c,menuRenderFn:r,shouldSplitNodeWithQuery:!0,onSelectOption:n,commandPriority:l})}class RO extends iw{constructor(n,e,a){super(n);qn(this,"title");qn(this,"emoji");qn(this,"keywords");this.title=n,this.emoji=e,this.keywords=a.keywords||[]}}function LO({index:c,isSelected:t,onClick:n,onMouseEnter:e,option:a}){let r="item";return t&&(r+=" selected"),ce.jsx("li",{tabIndex:-1,className:r,ref:a.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+c,onMouseEnter:e,onClick:n,children:ce.jsxs("span",{className:"text",children:[a.emoji," ",a.title]})},a.key)}const FO=10;function dw(){const[c]=Sn(),[t,n]=ge.useState(null),[e,a]=ge.useState([]);ge.useEffect(()=>{Promise.resolve().then(()=>dD).then(i=>a(i.default))},[]);const r=ge.useMemo(()=>e!=null?e.map(({emoji:i,aliases:u,tags:d})=>new RO(u[0],i,{keywords:[...u,...d]})):[],[e]),o=cw(":",{minLength:0}),s=ge.useMemo(()=>r.filter(i=>t!=null?new RegExp(t,"gi").exec(i.title)||i.keywords!=null?i.keywords.some(u=>new RegExp(t,"gi").exec(u)):!1:r).slice(0,FO),[r,t]),l=ge.useCallback((i,u,d)=>{c.update(()=>{const p=jt();!Et(p)||i==null||(u&&u.remove(),p.insertNodes([Qn(i.emoji)]),d())})},[c]);return ce.jsx(uw,{onQueryChange:n,onSelectOption:l,triggerFn:o,options:s,menuRenderFn:(i,{selectedIndex:u,selectOptionAndCleanUp:d,setHighlightedIndex:p})=>i.current==null||s.length===0?null:i.current&&s.length?yf.createPortal(ce.jsx("div",{className:"typeahead-popover emoji-menu",children:ce.jsx("ul",{children:s.map((f,h)=>ce.jsx("div",{children:ce.jsx(LO,{index:h,isSelected:u===h,onClick:()=>{p(h),d(f)},onMouseEnter:()=>{p(h)},option:f})},f.key))})}),i.current):null})}const fw=new Map([[":)",["emoji happysmile","🙂"]],[":D",["emoji veryhappysmile","😀"]],[":(",["emoji unhappysmile","🙁"]],["<3",["emoji heart","❤"]],["🙂",["emoji happysmile","🙂"]],["😀",["emoji veryhappysmile","😀"]],["🙁",["emoji unhappysmile","🙁"]],["❤",["emoji heart","❤"]]]);function BO(c){const t=c.getTextContent();for(let n=0;n<t.length;n++){const e=fw.get(t[n])||fw.get(t.slice(n,n+2));if(e!==void 0){const[a,r]=e;let o;n===0?[o]=c.splitText(n+2):[,o]=c.splitText(n,n+2);const s=v1(a,r);return o.replace(s),s}}return null}function zO(c){let t=c;for(;t!==null;){if(!t.isSimpleText())return;t=BO(t)}}function UO(c){ge.useEffect(()=>{if(!c.hasNodes([hd]))throw new Error("EmojisPlugin: EmojiNode not registered on editor");return c.registerNodeTransform(eo,zO)},[c])}function pw(){const[c]=Sn();return UO(c),null}const HO=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function hw(){const[c]=Sn();ge.useEffect(()=>{if(!c.hasNodes([Sc]))throw new Error("KeywordsPlugin: KeywordNode not registered on editor")},[c]);const t=ge.useCallback(e=>w1(e.getTextContent()),[]),n=ge.useCallback(e=>{const a=HO.exec(e);if(a===null)return null;const r=a[2].length,o=a.index+a[1].length;return{end:o+r,start:o}},[]);return R1(n,Sc,t),null}function $O({validateUrl:c}){const[t]=Sn();return ge.useEffect(()=>{if(!t.hasNodes([pc]))throw new Error("LinkPlugin: LinkNode not registered on editor");return br(t.registerCommand(Aa,n=>{if(n===null)return wm(n),!0;if(typeof n=="string")return!(c!==void 0&&!c(n))&&(wm(n),!0);{const{url:e,target:a,rel:r,title:o}=n;return wm(e,{rel:r,target:a,title:o}),!0}},Gn),c!==void 0?t.registerCommand(_a,n=>{const e=jt();if(!Et(e)||e.isCollapsed()||!$s(n,ClipboardEvent))return!1;const a=n;if(a.clipboardData===null)return!1;const r=a.clipboardData.getData("text");return!!c(r)&&!e.getNodes().some(o=>kt(o))&&(t.dispatchCommand(Aa,r),n.preventDefault(),!0)},Gn):()=>{})},[t,c]),null}const qO=new Set(["http:","https:","mailto:","sms:","tel:"]);function gw(c){try{const t=new URL(c);if(!qO.has(t.protocol))return"about:blank"}catch{return c}return c}const WO=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function JO(c){return c==="https://"||WO.test(c)}function Xm(){return ce.jsx($O,{validateUrl:JO})}function VO(c){const t=c.getNodes();return t.length===0?new Set([c.anchor.getNode().getParentOrThrow(),c.focus.getNode().getParentOrThrow()]):new Set(t.map(n=>kt(n)?n:n.getParentOrThrow()))}function KO(c){const t=jt();if(!Et(t))return!1;const n=VO(t);let e=0;for(const a of n)if(sr(a))e=Math.max(xm(a)+1,e);else if(qr(a)){const r=a.getParent();if(!sr(r))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");e=Math.max(xm(r)+1,e)}return e<=c}function mw({maxDepth:c}){const[t]=Sn();return ge.useEffect(()=>t.registerCommand(gv,()=>!KO(c??7),zo),[t,c]),null}const GO=1,YO=100;let yw=0,vw=!1;function ZO(){window.addEventListener("keydown",c=>{c.key==="Tab"&&(yw=c.timeStamp)},!0)}function bw(){const[c]=Sn();return ge.useEffect(()=>(vw||(ZO(),vw=!0),c.registerCommand(dg,t=>{const n=jt();return Et(n)&&yw+YO>t.timeStamp&&Cr(n.clone()),!1},GO)),[c]),null}const HD="";let Qm=!1;const XO=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],vd=214,_w=150;function QO({color:c,onChange:t}){const[n,e]=ge.useState(jc("hex",c)),[a,r]=ge.useState(c),o=ge.useRef(null),s=ge.useMemo(()=>({x:n.hsv.s/100*vd,y:(100-n.hsv.v)/100*_w}),[n.hsv.s,n.hsv.v]),l=ge.useMemo(()=>({x:n.hsv.h/360*vd}),[n.hsv]),i=p=>{if(r(p),/^#[0-9A-Fa-f]{6}$/i.test(p)){const f=jc("hex",p);e(f)}},u=({x:p,y:f})=>{const h={...n.hsv,s:p/vd*100,v:100-f/_w*100},m=jc("hsv",h);e(m),r(m.hex)},d=({x:p})=>{const f={...n.hsv,h:p/vd*360},h=jc("hsv",f);e(h),r(h.hex)};return ge.useEffect(()=>{o.current!==null&&t&&(t(n.hex,Qm),r(n.hex))},[n,t]),ge.useEffect(()=>{if(c===void 0)return;const p=jc("hex",c);e(p),r(p.hex)},[c]),ce.jsxs("div",{className:"color-picker-wrapper",style:{width:vd},ref:o,children:[ce.jsx(Ec,{label:"Hex",onChange:i,value:a}),ce.jsx("div",{className:"color-picker-basic-color",children:XO.map(p=>ce.jsx("button",{className:p===n.hex?" active":"",style:{backgroundColor:p},onClick:()=>{r(p),e(jc("hex",p))}},p))}),ce.jsx(ww,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:u,children:ce.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:s.x,top:s.y}})}),ce.jsx(ww,{className:"color-picker-hue",onChange:d,children:ce.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:l.x}})}),ce.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function ww({className:c,style:t,onChange:n,children:e}){const a=ge.useRef(null),r=ge.useRef(!1),o=l=>{if(a.current){const{current:i}=a,{width:u,height:d,left:p,top:f}=i.getBoundingClientRect(),h=xw(l.clientX-p,u,0),m=xw(l.clientY-f,d,0);n({x:h,y:m})}},s=l=>{if(l.button!==0)return;o(l);const i=d=>{r.current=!0,Qm=!0,o(d)},u=d=>{r.current&&(Qm=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",u,!1),o(d),r.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",u,!1)};return ce.jsx("div",{ref:a,className:c,style:t,onMouseDown:s,children:e})}function xw(c,t,n){return c>t?t:c<n?n:c}function Sw(c){if(c.startsWith("#")){if(c.length===4||c.length===5)return c=c.split("").map((t,n)=>n?t+t:"#").join(""),c;if(c.length===7||c.length===9)return c}else{const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("2d context not supported or canvas already initialized");return t.fillStyle=c,t.fillStyle}return"#000000"}function Ew(c){const t=(c.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,e,a,r)=>"#"+e+e+a+a+r+r).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:t[2],g:t[1],r:t[0]}}function ey({r:c,g:t,b:n}){c/=255,t/=255,n/=255;const e=Math.max(c,t,n),a=e-Math.min(c,t,n),r=a?(e===c?(t-n)/a+(t<n?6:0):e===t?2+(n-c)/a:4+(c-t)/a)*60:0,o=e?a/e*100:0,s=e*100;return{h:r,s:o,v:s}}function eN({h:c,s:t,v:n}){t/=100,n/=100;const e=~~(c/60),a=c/60-e,r=n*(1-t),o=n*(1-t*a),s=n*(1-t*(1-a)),l=e%6,i=Math.round([n,o,r,r,s,n][l]*255),u=Math.round([s,n,n,o,r,r][l]*255);return{b:Math.round([r,r,s,n,n,o][l]*255),g:u,r:i}}function Cw({b:c,g:t,r:n}){return"#"+[n,t,c].map(e=>e.toString(16).padStart(2,"0")).join("")}function jc(c,t){let n=Sw("#121212"),e=Ew(n),a=ey(e);return c==="hex"?(n=Sw(t),e=Ew(n),a=ey(e)):c==="rgb"?(e=t,n=Cw(e),a=ey(e)):c==="hsv"&&(a=t,e=eN(a),n=Cw(e)),{hex:n,hsv:a,rgb:e}}function tN(c,t,...n){if(!c)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function ty(c){const t=c.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function nN(c){const t=c.getNodes(),n=[];let e=null,a=null,r=0;for(let o=0;o<t.length;o++){const s=t[o];if(vn(s)){const l=s.getParentOrThrow();if(tN(Mr(l),"Expected CellNode to have a RowNode parent"),e!==l){if(a!==null&&r!==a)return!1;e!==null&&(a=r),e=l,r=0}const i=s.__colSpan;for(let u=0;u<i;u++)n[r+u]===void 0&&(n[r+u]=0),n[r+u]+=s.__rowSpan;r+=i}}return(a===null||r===a)&&n.every(o=>o===n[0])}function rN(){const c=jt();if(Et(c)&&!c.isCollapsed()||ur(c)&&!c.anchor.is(c.focus)||!Et(c)&&!ur(c))return!1;const[t]=Ao(c.anchor);return t.__colSpan>1||t.__rowSpan>1}function jw(c){if(c.getChildrenSize()!==1)return!1;const t=c.getFirstChildOrThrow();return!(!Rr(t)||!t.isEmpty())}function oN(c){const t=c.getLastDescendant();Wt(t)?t.select():kt(t)?t.selectEnd():t!==null&&t.selectNext()}function kw(c){return c.getEditorState().read(()=>{const t=jt();if(Et(t)||ur(t)){const[n]=Ao(t.anchor);if(vn(n))return n.getBackgroundColor()}return null})}function iN({onClose:c,tableCellNode:t,setIsMenuOpen:n,contextRef:e,cellMerge:a,showColorPickerModal:r}){const[o]=Sn(),s=ge.useRef(null),[l,i]=ge.useState(t),[u,d]=ge.useState({columns:1,rows:1}),[p,f]=ge.useState(!1),[h,m]=ge.useState(!1),[g,b]=ge.useState(()=>kw(o)||"");ge.useEffect(()=>o.registerMutationListener(rs,L=>{L.get(l.getKey())==="updated"&&(o.getEditorState().read(()=>{i(l.getLatest())}),b(kw(o)||""))}),[o,l]),ge.useEffect(()=>{o.getEditorState().read(()=>{const L=jt();if(ur(L)){const A=ty(L);d(ty(L)),f(nN(L)&&(A.columns>1||A.rows>1))}m(rN())})},[o]),ge.useEffect(()=>{const L=e.current,A=s.current,j=o.getRootElement();if(L!=null&&A!=null&&j!=null){const N=j.getBoundingClientRect(),R=L.getBoundingClientRect();A.style.opacity="1";const O=A.getBoundingClientRect(),z=5;let P=R.right+z;if(P+O.width>window.innerWidth||P+O.width>N.right){const J=R.left-O.width-z;P=(J<0?z:J)+window.pageXOffset}A.style.left=`${P+window.pageXOffset}px`;let $=R.top;if($+O.height>window.innerHeight){const J=R.bottom-O.height;$=(J<0?z:J)+window.pageYOffset}A.style.top=`${$+ +window.pageYOffset}px`}},[e,s,o]),ge.useEffect(()=>{function L(A){s.current!=null&&e.current!=null&&!s.current.contains(A.target)&&!e.current.contains(A.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);const v=ge.useCallback(()=>{o.update(()=>{if(l.isAttached()){const A=Pa(l),j=o.getElementByKey(A.getKey());if(!j)throw new Error("Expected to find tableElement in DOM");const N=nT(j);N!==null&&N.clearHighlight(),A.markDirty(),i(l.getLatest())}Un().selectStart()})},[o,l]),_=()=>{o.update(()=>{const L=jt();if(ur(L)){const{columns:A,rows:j}=ty(L),N=L.getNodes();let R=null;for(let O=0;O<N.length;O++){const z=N[O];if(vn(z))if(R===null){z.setColSpan(A).setRowSpan(j),R=z;const P=jw(z);let $;P&&Rr($=z.getFirstChild())&&$.remove()}else vn(R)&&(jw(z)||R.append(...z.getChildren()),z.remove())}R!==null&&(R.getChildrenSize()===0&&R.append(In()),oN(R)),c()}})},x=()=>{o.update(()=>{X2()})},E=ge.useCallback(L=>{o.update(()=>{K2(L),c()})},[o,c]),w=ge.useCallback(L=>{o.update(()=>{for(let A=0;A<u.columns;A++)G2(L);c()})},[o,c,u.columns]),y=ge.useCallback(()=>{o.update(()=>{Y2(),c()})},[o,c]),S=ge.useCallback(()=>{o.update(()=>{Pa(l).remove(),v(),c()})},[o,l,v,c]),C=ge.useCallback(()=>{o.update(()=>{Z2(),c()})},[o,c]),T=ge.useCallback(()=>{o.update(()=>{const L=Pa(l),A=o1(l),j=L.getChildren();if(A>=j.length||A<0)throw new Error("Expected table cell to be inside of table row.");const N=j[A];if(!Mr(N))throw new Error("Expected table row");N.getChildren().forEach(R=>{if(!vn(R))throw new Error("Expected table cell");R.toggleHeaderStyle(Lr.ROW)}),v(),c()})},[o,l,v,c]),F=ge.useCallback(()=>{o.update(()=>{const L=Pa(l),A=Tm(l),j=L.getChildren(),N=Math.max(...j.map(R=>R.getChildren().length));if(A>=N||A<0)throw new Error("Expected table cell to be inside of table row.");for(let R=0;R<j.length;R++){const O=j[R];if(!Mr(O))throw new Error("Expected table row");const z=O.getChildren();if(A>=z.length)continue;const P=z[A];if(!vn(P))throw new Error("Expected table cell");P.toggleHeaderStyle(Lr.COLUMN)}v(),c()})},[o,l,v,c]),B=ge.useCallback(L=>{o.update(()=>{const A=jt();if(Et(A)||ur(A)){const[j]=Ao(A.anchor);if(vn(j)&&j.setBackgroundColor(L),ur(A)){const N=A.getNodes();for(let R=0;R<N.length;R++){const O=N[R];vn(O)&&O.setBackgroundColor(L)}}}})},[o]);let M=null;return a&&(p?M=ce.jsx("button",{type:"button",className:"item",onClick:()=>_(),"data-test-id":"table-merge-cells",children:"Merge cells"}):h&&(M=ce.jsx("button",{type:"button",className:"item",onClick:()=>x(),"data-test-id":"table-unmerge-cells",children:"Unmerge cells"}))),so.createPortal(ce.jsxs("div",{className:"dropdown",ref:s,onClick:L=>{L.stopPropagation()},children:[M,ce.jsx("button",{type:"button",className:"item",onClick:()=>r("Cell background color",()=>ce.jsx(QO,{color:g,onChange:B})),"data-test-id":"table-background-color",children:ce.jsx("span",{className:"text",children:"Background color"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>E(!1),"data-test-id":"table-insert-row-above",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","above"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>E(!0),"data-test-id":"table-insert-row-below",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","below"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!1),"data-test-id":"table-insert-column-before",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!0),"data-test-id":"table-insert-column-after",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>C(),"data-test-id":"table-delete-columns",children:ce.jsx("span",{className:"text",children:"Delete column"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>y(),"data-test-id":"table-delete-rows",children:ce.jsx("span",{className:"text",children:"Delete row"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(),"data-test-id":"table-delete",children:ce.jsx("span",{className:"text",children:"Delete table"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>T(),children:ce.jsxs("span",{className:"text",children:[(l.__headerState&Lr.ROW)===Lr.ROW?"Remove":"Add"," ","row header"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>F(),"data-test-id":"table-column-header",children:ce.jsxs("span",{className:"text",children:[(l.__headerState&Lr.COLUMN)===Lr.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function sN({anchorElem:c,cellMerge:t}){const[n]=Sn(),e=ge.useRef(null),a=ge.useRef(null),[r,o]=ge.useState(!1),[s,l]=ge.useState(null),[i,u]=Ma(),d=ge.useCallback(()=>{const f=e.current,h=jt(),m=window.getSelection(),g=document.activeElement;if(h==null||f==null){l(null);return}const b=n.getRootElement();if(Et(h)&&b!==null&&m!==null&&b.contains(m.anchorNode)){const v=V2(h.anchor.getNode());if(v==null){l(null);return}if(n.getElementByKey(v.getKey())==null){l(null);return}l(v)}else g||l(null)},[n]);ge.useEffect(()=>n.registerUpdateListener(()=>{n.getEditorState().read(()=>{d()})})),ge.useEffect(()=>{const f=e.current;if(f!=null&&s!=null){const h=n.getElementByKey(s.getKey());if(h!=null){const m=h.getBoundingClientRect(),g=f.getBoundingClientRect(),b=c.getBoundingClientRect(),v=m.top-b.top+4,_=m.right-g.width-10-b.left;f.style.opacity="1",f.style.transform=`translate(${_}px, ${v}px)`}else f.style.opacity="0",f.style.transform="translate(-10000px, -10000px)"}},[e,s,n,c]);const p=ge.useRef(s);return ge.useEffect(()=>{p.current!==s&&o(!1),p.current=s},[p,s]),ce.jsx("div",{className:"table-cell-action-button-container",ref:e,children:s!=null&&ce.jsxs(ce.Fragment,{children:[ce.jsx("button",{type:"button",className:"table-cell-action-button chevron-down",onClick:f=>{f.stopPropagation(),o(!r)},ref:a,children:ce.jsx("i",{className:"chevron-down"})}),i,r&&ce.jsx(iN,{contextRef:a,setIsMenuOpen:o,onClose:()=>o(!1),tableCellNode:s,cellMerge:t,showColorPickerModal:u})]})})}function Tw({anchorElem:c=document.body,cellMerge:t=!1}){const n=Vm();return so.createPortal(n?ce.jsx(sN,{anchorElem:c,cellMerge:t}):null,c)}const $D="",aN=33,lN=50;function cN({editor:c}){const t=ge.useRef(null),n=ge.useRef(null),e=ge.useRef(null),a=ge.useRef(null),[r,o]=ge.useState(null),[s,l]=ge.useState(null),[i,u]=ge.useState(!1),[d,p]=ge.useState(null);ge.useEffect(()=>c.registerCommand(yi,E=>{const w=jt(),y=ur(w);return i!==y&&u(y),!1},ts));const f=ge.useCallback(()=>{l(null),t.current=null,p(null),a.current=null,e.current=null},[]);ge.useEffect(()=>{const E=w=>{setTimeout(()=>{const y=w.target;if(d){o({x:w.clientX,y:w.clientY});return}if(!(n.current&&n.current.contains(y))&&t.current!==y){t.current=y;const S=Am(y);S&&s!==S?c.update(()=>{const C=po(S.elem);if(!C)return;const T=Pa(C),F=c.getElementByKey(T.getKey());if(!F){console.error("TableCellResizer: Table element not found.");return}t.current=y,e.current=F.getBoundingClientRect(),l(S)}):S==null&&f()}},0)};return document.addEventListener("mousemove",E),()=>{document.removeEventListener("mousemove",E)}},[s,d,c,f]);const h=E=>E==="bottom",m=ge.useCallback(E=>{if(!s){console.error("TableCellResizer: Expected active cell.");return}c.update(()=>{const w=po(s.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Pa(w),S=o1(w),C=y.getChildren();if(S>=C.length||S<0){console.error("Expected table cell to be inside of table row.");return}const T=C[S];if(!Mr(T)){console.error("Expected table row");return}T.setHeight(E)})},[s,c]),g=ge.useCallback(E=>{if(!s){console.error("TableCellResizer: Expected active cell.");return}c.update(()=>{const w=po(s.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Pa(w),S=Tm(w),C=y.getChildren();for(let T=0;T<C.length;T++){const F=C[T];if(!Mr(F)){console.error("Expected table row");return}const B=F.getChildren(),A=B.map(N=>N.getColSpan()).reduce((N,R)=>{const O=N[N.length-1]??0;return N.push(O+R),N},[]).findIndex(N=>N>S);if(A>=B.length||A<0){console.error("Expected table cell to be inside of table row.");return}const j=B[A];if(!vn(j)){console.error("Expected table cell");return}j.setWidth(E)}})},[s,c]),b=ge.useCallback(E=>{const w=y=>{if(y.preventDefault(),y.stopPropagation(),!s){console.error("TableCellResizer: Expected active cell.");return}if(a.current){const{x:S,y:C}=a.current;if(s===null)return;if(h(E)){const T=s.elem.getBoundingClientRect().height,F=Math.abs(y.clientY-C),B=E==="bottom"&&C>y.clientY;m(Math.max(B?T-F:F+T,aN))}else{const T=getComputedStyle(s.elem);let F=s.elem.clientWidth;F-=parseFloat(T.paddingLeft)+parseFloat(T.paddingRight);const B=Math.abs(y.clientX-S),M=E==="right"&&S>y.clientX;g(Math.max(M?F-B:B+F,lN))}f(),document.removeEventListener("mouseup",w)}};return w},[s,f,g,m]),v=ge.useCallback(E=>w=>{if(w.preventDefault(),w.stopPropagation(),!s){console.error("TableCellResizer: Expected active cell.");return}a.current={x:w.clientX,y:w.clientY},o(a.current),p(E),document.addEventListener("mouseup",b(E))},[s,b]),x=ge.useCallback(()=>{if(s){const{height:E,width:w,top:y,left:S}=s.elem.getBoundingClientRect(),C={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+S}px`,top:`${window.pageYOffset+y+E}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.pageXOffset+S+w}px`,top:`${window.pageYOffset+y}px`,width:"10px"}},T=e.current;return d&&r&&T&&(h(d)?(C[d].left=`${window.pageXOffset+T.left}px`,C[d].top=`${window.pageYOffset+r.y}px`,C[d].height="3px",C[d].width=`${T.width}px`):(C[d].top=`${window.pageYOffset+T.top}px`,C[d].left=`${window.pageXOffset+r.x}px`,C[d].width="3px",C[d].height=`${T.height}px`),C[d].backgroundColor="#adf"),C}return{bottom:null,left:null,right:null,top:null}},[s,d,r])();return ce.jsx("div",{ref:n,children:s!=null&&!i&&ce.jsxs(ce.Fragment,{children:[ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:x.right||void 0,onMouseDown:v("right")}),ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:x.bottom||void 0,onMouseDown:v("bottom")})]})})}function Ow({isEditable:c=!0}){const[t]=Sn();return ge.useMemo(()=>c?so.createPortal(ce.jsx(cN,{editor:t}),document.body):null,[t,c])}const Nw=ir.createContext(null),Aw=4;function _o({children:c,className:t,onClick:n,title:e}){const a=ge.useRef(null),r=ir.useContext(Nw);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=r;return ge.useEffect(()=>{a&&a.current&&o(a)},[a,o]),ce.jsx("button",{className:t,onClick:n,ref:a,title:e,type:"button",children:c})}function uN({children:c,dropDownRef:t,onClose:n}){const[e,a]=ge.useState(),[r,o]=ge.useState(),s=ge.useCallback(u=>{a(d=>d?[...d,u]:[u])},[a]),l=u=>{if(!e)return;const d=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(d)&&u.preventDefault(),d==="Escape"||d==="Tab"?n():d==="ArrowUp"?o(p=>{if(!p)return e[0];const f=e.indexOf(p)-1;return e[f===-1?e.length-1:f]}):d==="ArrowDown"&&o(p=>p?e[e.indexOf(p)+1]:e[0])},i=ge.useMemo(()=>({registerItem:s}),[s]);return ge.useEffect(()=>{e&&!r&&o(e[0]),r&&r.current&&r.current.focus()},[e,r]),ce.jsx(Nw.Provider,{value:i,children:ce.jsx("div",{className:"dropdown",ref:t,onKeyDown:l,children:c})})}function bd({disabled:c=!1,buttonLabel:t,buttonAriaLabel:n,buttonClassName:e,buttonIconClassName:a,children:r,stopCloseOnClickSelf:o}){const s=ge.useRef(null),l=ge.useRef(null),[i,u]=ge.useState(!1),d=()=>{u(!1),l&&l.current&&l.current.focus()};return ge.useEffect(()=>{const p=l.current,f=s.current;if(i&&p!==null&&f!==null){const{top:h,left:m}=p.getBoundingClientRect();f.style.top=`${h+p.offsetHeight+Aw}px`,f.style.left=`${Math.min(m,window.innerWidth-f.offsetWidth-20)}px`}},[s,l,i]),ge.useEffect(()=>{const p=l.current;if(p!==null&&i){const f=h=>{const m=h.target;o&&s.current&&s.current.contains(m)||p.contains(m)||u(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}}},[s,l,i,o]),ge.useEffect(()=>{const p=()=>{if(i){const f=l.current,h=s.current;if(f!==null&&h!==null){const{top:m}=f.getBoundingClientRect(),g=m+f.offsetHeight+Aw;g!==h.getBoundingClientRect().top&&(h.style.top=`${g}px`)}}};return document.addEventListener("scroll",p),()=>{document.removeEventListener("scroll",p)}},[l,s,i]),ce.jsxs(ce.Fragment,{children:[ce.jsxs("button",{type:"button",disabled:c,"aria-label":n||t,className:e,onClick:()=>u(!i),ref:l,children:[a&&ce.jsx("span",{className:a}),t&&ce.jsx("span",{className:"text dropdown-button-text",children:t}),ce.jsx("i",{className:"chevron-down"})]}),i&&so.createPortal(ce.jsx(uN,{dropDownRef:s,onClose:d,children:r}),document.body)]})}function Pw(c){const t=c.anchor,n=c.focus,e=c.anchor.getNode(),a=c.focus.getNode();return e===a?e:c.isBackward()?Gb(n)?e:a:Gb(t)?e:a}const Iw=8,Mw=72,Da={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},dN=({selectionFontSize:c,disabled:t,editor:n,blockType:e,styleConfig:a,isenterPressed:r,currentElementClick:o,currentElementSelect:s})=>{const[l,i]=ir.useState(c),[u,d]=ir.useState(e),[p,f]=ir.useState("");ir.useState([]),ir.useState("");const{heading:h}=a||{},m=x=>{x&&x.title&&n.update(()=>{if(n.isEditable()){const E=jt();E&&lm(E,x)}})},g=x=>{i(x.target.value)},b=()=>{const x=Number(l);if(!isNaN(x)){const E=Math.min(Math.max(x,Iw),Mw);i(String(E)),m({"font-size":`${E}px`})}},v=x=>{var w,y,S,C,T;f(x),n.update(()=>{const F=jt();Et(F)&&Kk(F,()=>Sl(x))});let E=null;if(h)switch(x){case"h1":E=((w=h.find(F=>F.title==="Heading1"))==null?void 0:w.fontSize)??56;break;case"h2":E=((y=h.find(F=>F.title==="Heading2"))==null?void 0:y.fontSize)??14;break;case"h3":E=((S=h.find(F=>F.title==="Heading3"))==null?void 0:S.fontSize)??12;break;case"h4":E=((C=h.find(F=>F.title==="Heading4"))==null?void 0:C.fontSize)??12;break;case"h5":E=((T=h.find(F=>F.title==="Heading5"))==null?void 0:T.fontSize)??12;break;case"paragraph":E=11;break;default:E=11}i(E),f(x),d(x)},_=()=>{i("11")};return ir.useEffect(()=>{_()},[r]),ir.useEffect(()=>{const x=()=>{n.update(()=>{const E=jt();if(E!==null){const y=E.getNodes()[0];if(!Wt(y)){const S=y.getType();S in Da&&d(S)}}})};return n.registerUpdateListener(x),()=>{n.registerUpdateListener(x)}},[n]),ir.useEffect(()=>{var x,E,w,y,S;switch(o.tagName){case"P":d("paragraph"),i("11");break;case"H1":d("h1");const C=((x=a.heading.find(L=>L.title==="Heading1"))==null?void 0:x.fontSize)??"16";i(C);break;case"H2":d("h2");const T=((E=a.heading.find(L=>L.title==="Heading2"))==null?void 0:E.fontSize)??"14";i(T);break;case"H3":d("h3");const F=((w=a.heading.find(L=>L.title==="Heading3"))==null?void 0:w.fontSize)??"12";i(F);break;case"H4":d("h4");const B=((y=a.heading.find(L=>L.title==="Heading4"))==null?void 0:y.fontSize)??"12";i(B);break;case"H5":d("h5");const M=((S=a.heading.find(L=>L.title==="Heading5"))==null?void 0:S.fontSize)??"12";i(M);break;default:d("paragraph"),i("11");break}},[o]),ir.useEffect(()=>{var E,w,y,S,C;if(!s){i("11"),d("paragraph");return}switch(s.trim()){case"P":i("11"),d("paragraph");break;case"h1":d("h1");const T=((E=a.heading.find(A=>A.title==="Heading1"))==null?void 0:E.fontSize)??"16";i(T);break;case"h2":d("h2");const F=((w=a.heading.find(A=>A.title==="Heading2"))==null?void 0:w.fontSize)??"14";i(F);break;case"h3":d("h3");const B=((y=a.heading.find(A=>A.title==="Heading3"))==null?void 0:y.fontSize)??"12";i(B);break;case"h4":d("h4");const M=((S=a.heading.find(A=>A.title==="Heading4"))==null?void 0:S.fontSize)??"12";i(M);break;case"h5":d("h5");const L=((C=a.heading.find(A=>A.title==="Heading5"))==null?void 0:C.fontSize)??"12";i(L);break;default:d("paragraph"),i("11");break}},[s]),ce.jsxs(ce.Fragment,{children:[a&&a.heading?ce.jsxs(bd,{disabled:t,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+u,buttonLabel:Da[u],children:[ce.jsxs(_o,{className:`item ${u==="paragraph"?"active":""}`,onClick:()=>v("paragraph"),children:[ce.jsx("i",{className:"icon paragraph"}),ce.jsx("span",{className:"text",children:Da.paragraph})]}),a.heading&&a.heading.find(x=>x.title==="Heading1")&&ce.jsxs(_o,{className:`item ${u==="h1"?"active":""}`,onClick:()=>v("h1"),children:[ce.jsx("i",{className:"icon h1"}),ce.jsx("span",{className:"text",children:Da.h1})]}),a.heading&&a.heading.find(x=>x.title==="Heading2")&&ce.jsxs(_o,{className:`item ${u==="h2"?"active":""}`,onClick:()=>v("h2"),children:[ce.jsx("i",{className:"icon h2"}),ce.jsx("span",{className:"text",children:Da.h2})]}),a.heading&&a.heading.find(x=>x.title==="Heading3")&&ce.jsxs(_o,{className:`item ${u==="h3"?"active":""}`,onClick:()=>v("h3"),children:[ce.jsx("i",{className:"icon h3"}),ce.jsx("span",{className:"text",children:Da.h3})]}),a.heading&&a.heading.find(x=>x.title==="Heading4")&&ce.jsxs(_o,{className:`item ${u==="h4"?"active":""}`,onClick:()=>v("h4"),children:[ce.jsx("i",{className:"icon h4"}),ce.jsx("span",{className:"text",children:Da.h4})]}),a.heading&&a.heading.find(x=>x.title==="Heading5")&&ce.jsxs(_o,{className:`item ${u==="h5"?"active":""}`,onClick:()=>v("h5"),children:[ce.jsx("i",{className:"icon h5"}),ce.jsx("span",{className:"text",children:Da.h5})]})]}):"",ce.jsx("input",{title:"Font Size",type:"number",value:l,disabled:t,readOnly:!0,className:"toolbar-item font-size-input input-font-size-value",min:Iw,max:Mw,onChange:g,onBlur:b})]})},fN=Cc&&"documentMode"in document?document.documentMode:null,Ra=Cc&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);Cc&&"InputEvent"in window&&!fN&&"getTargetRanges"in new window.InputEvent("input");const pN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMi41NTM1IDE2LjUwNjFDMTIuNDExNCAxNi42NjE1IDEyLjIxMDYgMTYuNzUgMTIgMTYuNzVDMTEuNzg5NCAxNi43NSAxMS41ODg2IDE2LjY2MTUgMTEuNDQ2NSAxNi41MDYxTDcuNDQ2NDggMTIuMTMxMUM3LjE2Njk4IDExLjgyNTQgNy4xODgyMiAxMS4zNTEgNy40OTM5MiAxMS4wNzE1QzcuNzk5NjMgMTAuNzkyIDguMjc0MDIgMTAuODEzMiA4LjU1MzUyIDExLjExODlMMTEuMjUgMTQuMDY4MlYzQzExLjI1IDIuNTg1NzkgMTEuNTg1OCAyLjI1IDEyIDIuMjVDMTIuNDE0MiAyLjI1IDEyLjc1IDIuNTg1NzkgMTIuNzUgM1YxNC4wNjgyTDE1LjQ0NjUgMTEuMTE4OUMxNS43MjYgMTAuODEzMiAxNi4yMDA0IDEwLjc5MiAxNi41MDYxIDExLjA3MTVDMTYuODExOCAxMS4zNTEgMTYuODMzIDExLjgyNTQgMTYuNTUzNSAxMi4xMzExTDEyLjU1MzUgMTYuNTA2MVoiIGZpbGw9IiMxQzI3NEMiLz4NCjxwYXRoIGQ9Ik0zLjc1IDE1QzMuNzUgMTQuNTg1OCAzLjQxNDIyIDE0LjI1IDMgMTQuMjVDMi41ODU3OSAxNC4yNSAyLjI1IDE0LjU4NTggMi4yNSAxNVYxNS4wNTQ5QzIuMjQ5OTggMTYuNDIyNSAyLjI0OTk2IDE3LjUyNDggMi4zNjY1MiAxOC4zOTE4QzIuNDg3NTQgMTkuMjkxOSAyLjc0NjQzIDIwLjA0OTcgMy4zNDgzNSAyMC42NTE2QzMuOTUwMjcgMjEuMjUzNiA0LjcwODE0IDIxLjUxMjUgNS42MDgyNSAyMS42MzM1QzYuNDc1MjIgMjEuNzUgNy41Nzc1NCAyMS43NSA4Ljk0NTEzIDIxLjc1SDE1LjA1NDlDMTYuNDIyNSAyMS43NSAxNy41MjQ4IDIxLjc1IDE4LjM5MTggMjEuNjMzNUMxOS4yOTE5IDIxLjUxMjUgMjAuMDQ5NyAyMS4yNTM2IDIwLjY1MTcgMjAuNjUxNkMyMS4yNTM2IDIwLjA0OTcgMjEuNTEyNSAxOS4yOTE5IDIxLjYzMzUgMTguMzkxOEMyMS43NSAxNy41MjQ4IDIxLjc1IDE2LjQyMjUgMjEuNzUgMTUuMDU0OVYxNUMyMS43NSAxNC41ODU4IDIxLjQxNDIgMTQuMjUgMjEgMTQuMjVDMjAuNTg1OCAxNC4yNSAyMC4yNSAxNC41ODU4IDIwLjI1IDE1QzIwLjI1IDE2LjQzNTQgMjAuMjQ4NCAxNy40MzY1IDIwLjE0NjkgMTguMTkxOUMyMC4wNDgyIDE4LjkyNTcgMTkuODY3OCAxOS4zMTQyIDE5LjU5MSAxOS41OTFDMTkuMzE0MiAxOS44Njc4IDE4LjkyNTcgMjAuMDQ4MiAxOC4xOTE5IDIwLjE0NjlDMTcuNDM2NSAyMC4yNDg0IDE2LjQzNTQgMjAuMjUgMTUgMjAuMjVIOUM3LjU2NDU5IDIwLjI1IDYuNTYzNDcgMjAuMjQ4NCA1LjgwODEyIDIwLjE0NjlDNS4wNzQzNSAyMC4wNDgyIDQuNjg1NzcgMTkuODY3OCA0LjQwOTAxIDE5LjU5MUM0LjEzMjI1IDE5LjMxNDIgMy45NTE4IDE4LjkyNTcgMy44NTMxNSAxOC4xOTE5QzMuNzUxNTkgMTcuNDM2NSAzLjc1IDE2LjQzNTQgMy43NSAxNVoiIGZpbGw9IiMxQzI3NEMiLz4NCjwvc3ZnPg==";var Dw={exports:{}};(function(c,t){(function(n,e){e()})(ma,function(){function n(i,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function e(i,u,d){var p=new XMLHttpRequest;p.open("GET",i),p.responseType="blob",p.onload=function(){l(p.response,u,d)},p.onerror=function(){console.error("could not download file")},p.send()}function a(i){var u=new XMLHttpRequest;u.open("HEAD",i,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(u)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ma=="object"&&ma.global===ma?ma:void 0,s=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!s?function(i,u,d){var p=o.URL||o.webkitURL,f=document.createElement("a");u=u||i.name||"download",f.download=u,f.rel="noopener",typeof i=="string"?(f.href=i,f.origin===location.origin?r(f):a(f.href)?e(i,u,d):r(f,f.target="_blank")):(f.href=p.createObjectURL(i),setTimeout(function(){p.revokeObjectURL(f.href)},4e4),setTimeout(function(){r(f)},0))}:"msSaveOrOpenBlob"in navigator?function(i,u,d){if(u=u||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(n(i,d),u);else if(a(i))e(i,u,d);else{var p=document.createElement("a");p.href=i,p.target="_blank",setTimeout(function(){r(p)})}}:function(i,u,d,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof i=="string")return e(i,u,d);var f=i.type==="application/octet-stream",h=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||f&&h||s)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var _=g.result;_=m?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=_:location=_,p=null},g.readAsDataURL(i)}else{var b=o.URL||o.webkitURL,v=b.createObjectURL(i);p?p.location=v:location.href=v,p=null,setTimeout(function(){b.revokeObjectURL(v)},4e4)}});o.saveAs=l.saveAs=l,c.exports=l})})(Dw);var hN=Dw.exports;function gN(c){const t=document.createElement("div");return t.innerHTML=c,t.querySelectorAll("*").forEach(e=>{let a="";if(e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){a+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=a.trim();const o=document.createElement("i");o.innerHTML=e.innerHTML,r.appendChild(o),e.innerHTML="",e.appendChild(r)}else if(e.classList.contains("PlaygroundEditorTheme__textBold")&&e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){a+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=a.trim();const o=document.createElement("i"),s=document.createElement("strong");s.innerHTML=e.innerHTML,o.appendChild(s),r.appendChild(o),e.innerHTML="",e.appendChild(r)}else{if(e.classList.contains("PlaygroundEditorTheme__textStrikethrough")&&(a+="text-decoration: line-through; "),e.classList.contains("PlaygroundEditorTheme__textUnderlineStrikethrough")&&(a+="text-decoration: line-through underline; "),e.classList.contains("PlaygroundEditorTheme__textBold")){const r=document.createElement("strong");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textItalic")){const r=document.createElement("i");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textUnderline")){const r=document.createElement("u");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(a){const r=document.createElement("span");r.style.cssText=a.trim(),r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}}}),t.innerHTML}function mN(c){const t=document.createElement("div");t.innerHTML=c;const n=t.querySelectorAll(".PlaygroundEditorTheme__table");return n.length===0?c:(n.forEach(e=>{e.style.width="100%",e.style.border="1px solid black",e.querySelectorAll("tr").forEach(r=>{r.style.border="1px solid black";const o=r.querySelectorAll("td, th"),l=100/o.length+"%";o.forEach(i=>{i.style.width=l,i.style.height="20px",i.style.border="1px solid black",i.innerHTML.trim()||(i.style.width=l,i.style.height="20px",i.innerHTML=" ");const u=i.querySelectorAll(".PlaygroundEditorTheme__textUnderline"),d=i.querySelectorAll(".PlaygroundEditorTheme__textStrikethrough");u.forEach(p=>{p.style.textDecoration="underline"}),d.forEach(p=>{p.style.textDecoration="line-through"}),i.classList.contains("PlaygroundEditorTheme__tableCellHeader")&&(i.style.fontWeight="bold")})})}),t.innerHTML)}function Rw(c){return c=c.replace(/<br\s*\/?>/g,""),c.includes("Crop")&&(c=c.replace(/Crop/g,"")),c}var Lw={exports:{}};/*!
|
|
54
|
+
`}isInline(){return!1}updateDOM(){return!1}decorate(){return ce.jsx(wT,{nodeKey:this.__key})}}function xT(){return{node:S1()}}function S1(){return new md}function ST(c){return c instanceof md}const ET=ir.lazy(()=>Promise.resolve().then(()=>uD));function CT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function jT(c=""){return{text:c,uid:CT(),votes:[]}}function E1(c,t,n){return{text:t,uid:c.uid,votes:n||Array.from(c.votes)}}function kT(c){const t=c.getAttribute("data-lexical-poll-question"),n=c.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:C1(t,JSON.parse(n))}:null}let Bm=class Dj extends Hs{constructor(n,e,a){super(a);qn(this,"__question");qn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new Dj(n.__question,n.__options,n.__key)}static importJSON(n){const e=C1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),a=Array.from(e.__options);a.push(n),e.__options=a}deleteOption(n){const e=this.getWritable(),a=Array.from(e.__options),r=a.indexOf(n);a.splice(r,1),e.__options=a}setOptionText(n,e){const a=this.getWritable(),r=E1(n,e),o=Array.from(a.__options),s=o.indexOf(n);o[s]=r,a.__options=o}toggleVote(n,e){const a=this.getWritable(),r=n.votes,o=Array.from(r),s=r.indexOf(e);s===-1?o.push(e):o.splice(s,1);const l=E1(n,n.text,o),i=Array.from(a.__options),u=i.indexOf(n);i[u]=l,a.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:kT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return ce.jsx(ge.Suspense,{fallback:null,children:ce.jsx(ET,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function C1(c,t){return new Bm(c,t)}function j1(c){return c instanceof Bm}const TT="https://platform.twitter.com/widgets.js";function OT(c){const t=c.getAttribute("data-lexical-tweet-id");return t?{node:T1(t)}:null}let k1=!0;function NT({className:c,format:t,loadingComponent:n,nodeKey:e,onError:a,onLoad:r,tweetID:o}){const s=ge.useRef(null),l=ge.useRef(""),[i,u]=ge.useState(!1),d=ge.useCallback(async()=>{try{await window.twttr.widgets.createTweet(o,s.current),u(!1),k1=!1,r&&r()}catch(p){a&&a(String(p))}},[a,r,o]);return ge.useEffect(()=>{var p;if(o!==l.current){if(u(!0),k1){const f=document.createElement("script");f.src=TT,f.async=!0,(p=document.body)==null||p.appendChild(f),f.onload=d,a&&(f.onerror=a)}else d();l&&(l.current=o)}},[d,a,o]),ce.jsxs(b1,{className:c,format:t,nodeKey:e,children:[i?n:null,ce.jsx("div",{style:{display:"inline-block",width:"550px"},ref:s})]})}class kp extends Dm{constructor(n,e,a){super(e,a);qn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new kp(n.__id,n.__format,n.__key)}static importJSON(n){const e=T1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:OT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const a=e.theme.embedBlock||{},r={base:a.base||"",focus:a.focus||""};return ce.jsx(NT,{className:r,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function T1(c){return new kp(c)}class yd extends Hs{constructor(n,e,a){super(a);qn(this,"__referencedElementId");qn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new yd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),requestAnimationFrame(()=>{const o=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);o?(o.scrollIntoView({behavior:"smooth",block:"center"}),o.classList.add("reference-highlight"),setTimeout(()=>{o.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement)o.focus(),o.setSelectionRange(o.value.length,o.value.length);else if(o.isContentEditable){o.focus();const s=document.createRange(),l=window.getSelection();s.selectNodeContents(o),s.collapse(!1),l==null||l.removeAllRanges(),l==null||l.addRange(s)}else o.setAttribute("tabindex","-1"),o.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)})});const a=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return a&&new MutationObserver(()=>{const o=a.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(l=>{l.textContent!==o&&(l.textContent=o||"")})}).observe(a,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,a){const r=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(r){const o=r.textContent;e.textContent!==o&&(e.textContent=o||"")}return!1}decorate(n,e){return ce.jsx(ce.Fragment,{})}static importJSON(n){return O1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){const e={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:n.style,id:n.codox_metadata.referencedElementId};return console.log("[DEMO DEBUG][ReferenceNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:e}),new yd(e.id,e.text)}}function O1(c,t){return new yd(c,t)}class kl extends eo{static getType(){return"dividerText"}static clone(t){return new kl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:void 0,version:0,detail:0,format:0,mode:"normal",style:"",text:""}}static importJSON(t){return new kl(t.text)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new kl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON(),n={type:"quote",text:"_______________________________",format:t.format,style:`color:${t.color||""};background-color:${t.backgroundColor||""};`,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:n,originalJsonNode:t}),n}static fromCodoxNode(t){let n="",e="";const a={type:t.codox_metadata.type,text:t.text,format:t.format,mode:t.mode,detail:t.detail,version:t.version,style:"",id:t.codox_metadata.id,color:n,backgroundColor:e};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:t,originalJsonNode:a}),a}}function N1(){return new kl}function zm(c){return c instanceof kl}const A1=fo();function Um(c){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;c>=t[e];)n+=e,c-=t[e];return n}function P1(){const[c]=Sn(),t=(a,r)=>{r(a),kt(a)&&a.getChildren().forEach(o=>t(o,r))},n=()=>{c.update(()=>{const a=Un(),r=[];t(a,s=>{Hm(s)&&r.push(s)});let o=!1;for(let s=0;s<r.length;s++)if(r[s].getNumber()!==s+1){o=!0;break}o&&r.forEach((s,l)=>{const i=l+1;s.setNumber(i);const u=s.getContentKey(),d=Bn(u);if(Rr(d)){const p=d.getFirstChild();if(Wt(p)){const f=p.getTextContent(),h=f.replace(/^\[[^\]]*\]/,`[${Um(i)}]`);h!==f&&p.setTextContent(h)}}})})},e=()=>{c.update(()=>{var b;const a=Un(),r=jt(),o=PT(0);r&&r.insertNodes([o]);const s=In(),l=Qn("[?] ");s.append(l),a.append(s),o.setContentKey(s.getKey());const i=[];t(a,v=>{Hm(v)&&i.push(v)});const d=i.map(v=>v.getContentKey()).map(v=>Bn(v)).filter(v=>v!==null);d==null||d.forEach(v=>{v&&a.append(v)});let p=!1;if(a.getChildren().forEach(v=>{if(Rr(v)){const _=v.getFirstChild();if((_&&zm(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&(p=!0,!zm(_)&&_.getTextContent().includes("_______________________________"))){const x=N1();_.replace(x)}}}),!p&&(d==null?void 0:d.length)>0){const v=In();v.append(N1()),(b=d[0])==null||b.insertBefore(v)}const f=[];if(a.getChildren().forEach(v=>{if(Rr(v)){const _=v.getFirstChild();(_&&zm(_)||_&&Wt(_)&&_.getTextContent().includes("_______________________________"))&&f.push(v)}}),f.length>1)for(let v=1;v<f.length;v++)f[v].remove();const h=[];t(a,v=>{Hm(v)&&h.push(v)}),h.forEach((v,_)=>{const x=_+1;v.setNumber(x);const E=v.getContentKey(),w=Bn(E);if(Rr(w)){const y=w.getFirstChild();if(Wt(y)){const S=y.getTextContent(),C=S.replace(/^\[[^\]]*\]/,`[${Um(x)}]`);C!==S&&y.setTextContent(C)}}});const m=l.getTextContentSize(),g=Xu();g.anchor.set(l.getKey(),m,"text"),g.focus.set(l.getKey(),m,"text"),Cr(g),setTimeout(()=>{const v=c.getElementByKey(s.getKey());v&&v.scrollIntoView({behavior:"smooth",block:"end"})},100)})};return ge.useEffect(()=>{const a=c.registerCommand(A1,()=>(e(),!0),0);return c.update(()=>{setTimeout(n,100)}),a},[c]),null}class Tl extends eo{constructor(n,e,a,r){super(a||`[${n}]`,r);qn(this,"__number");qn(this,"__contentKey");this.__number=n,this.__contentKey=e}static getType(){return"endnote"}static clone(n){return new Tl(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){return new Tl(n.number,n.contentKey,n.text,n.key)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:""}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Um(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:AT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON(),e={type:"quote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="",a="";const r={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e,backgroundColor:a};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:r}),r}}function AT(c){var e;const t=(e=c.textContent)==null?void 0:e.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1;return{node:new Tl(n)}}function PT(c,t){return new Tl(c,t||"")}function Hm(c){return c instanceof Tl}class Ws extends eo{constructor(n,e,a,r){super(n,r);qn(this,"__color");qn(this,"__id");this.__color=e,this.__id=a}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new Ws(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,a){const r=super.updateDOM(n,e,a);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),r}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new Ws(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(r=>{r.startsWith("color:")&&(e=r.split(":")[1])});const a={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:a}),a}}const I1=[gc,ld,id,od,ad,hm,xs,rs,El,up,ym,rd,pc,D_,Bm,Ep,Lm,gd,hd,Sc,Cm,kp,Sp,fd,pd,xp,md,Cp,jp,yd,Tl,Ws,Na,kl],DD="";function $m(...c){return c.filter(Boolean).join(" ")}function Di({"data-test-id":c,children:t,className:n,onClick:e,disabled:a,small:r,title:o}){return ce.jsx("button",{disabled:a,className:$m("Button__root",a&&"Button__disabled",r&&"Button__small",n),onClick:e,title:o,"aria-label":o,...c&&{"data-test-id":c},children:t})}const RD="";function Tp({"data-test-id":c,children:t}){return ce.jsx("div",{className:"DialogActions","data-test-id":c,children:t})}const LD="";function Ec({label:c,value:t,onChange:n,placeholder:e="","data-test-id":a,type:r="text"}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:c}),ce.jsx("input",{type:r,className:"Input__input",placeholder:e,value:t,onChange:o=>{n(o.target.value)},"data-test-id":a})]})}const IT=ge.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function M1({children:c}){const[t,n]=ge.useState({cellEditorConfig:null,cellEditorPlugins:null});return ce.jsx(IT.Provider,{value:ge.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,a)=>{n({cellEditorConfig:e,cellEditorPlugins:a})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:c})}function MT({activeEditor:c,onClose:t}){const[n,e]=ge.useState("5"),[a,r]=ge.useState("5"),[o,s]=ge.useState(""),[l,i]=ge.useState(!0);ge.useState(!0);let u=Number(localStorage.getItem("tableCount"))||1;ge.useEffect(()=>{const f=Number(n),h=Number(a);f&&f>0&&f<=500&&h&&h>0&&h<=50?i(!1):i(!0)},[n,a]);const d=()=>{c.update(()=>{const h=Un().getChildren().filter(jr);if(h.length===0){console.warn("No tables found in the document!");return}const m=h.map(g=>{let b=o;const v=g.getPreviousSibling();if(v&&Rr(v)){const _=v.getChildren().filter(x=>x.getType()==="text");_.length>1&&(b=_[1].getTextContent())}return{caption:b,content:g.getChildren().map(_=>_.getChildren().map(x=>x.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(m))})},p=()=>{if(!n||!a)return;const f=u;c.update(()=>{const h=In();h.setFormat("left");const m=new Ws(`Table ${f}:`,"black",`table_caption_${Math.random()}`);m.setStyle("font-weight: bold; margin-right: 8px;");const g=o.trim()===""?".":o,b=Qn(g);b.setStyle(o?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),h.getChildren().forEach(x=>x.remove());const v=vi();h.append(m),h.append(b),h.append(v),es([h]);const _=n1(Number(n),Number(a),!0);if(!_){console.error("Failed to create TableNode");return}es([_]),console.log("Table inserted successfully!")}),c.update(()=>{const m=Un().getChildren().filter(jr);let g=1;m.forEach(b=>{const v=b.getPreviousSibling(),_=b.getNextSibling();if(_&&Rr(_)&&_.getChildren().forEach(x=>{x.getTextContent().startsWith("Table")&&x.remove()}),v&&Rr(v)){v.getChildren().forEach(w=>{w.getTextContent().startsWith("Table")&&w.remove()});const x=`Table ${g}:`,E=new Ws(x,"black",`table_caption_${g}`);if(v){const w=v.getFirstChild();w!==null?w.insertBefore(E):v.append(E)}}else{const x=`Table ${g}:`,E=In();E.setFormat("left");const w=new Ws(x,"black",`table_caption_${g}`);w.setStyle("font-weight: bold; margin-right: 5px;");const y=o.trim()===""?"Caption text here":o,S=Qn(y);S.setStyle("color: black; font-style: italic; font-weight: normal;"),E.append(w),E.append(Qn(" ")),E.append(S),b.insertBefore(E)}g++})}),u++,localStorage.setItem("tableCount",u.toString()),setTimeout(()=>{d()},50),t==null||t()};return ce.jsxs(ce.Fragment,{children:[ce.jsx(Ec,{placeholder:"# of rows (1-500)",label:"Rows",onChange:e,value:n,type:"number"}),ce.jsx(Ec,{placeholder:"# of columns (1-50)",label:"Columns",onChange:r,value:a,type:"number"}),ce.jsx(Ec,{placeholder:"Enter table caption",label:"Table",value:o,onChange:s}),ce.jsx(Tp,{children:ce.jsx(Di,{disabled:l,onClick:p,children:"Confirm"})})]})}const FD="",qm={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Op({defaultSelection:c}){const[t]=Sn();return ge.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:c})},[c,t]),null}function Wm(){return Un().getTextContent()}function Jm(c,t=!0){if(c)return!1;let n=Wm();return t&&(n=n.trim()),n===""}function DT(c){if(!Jm(c,!1))return!1;const t=Un().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const a=t[e];if(vr(a))return!1;if(kt(a)){if(!Rr(a)||a.__indent!==0)return!1;const r=a.getChildren(),o=r.length;for(let s=0;s<o;s++){const l=r[e];if(!Wt(l))return!1}}}return!0}function D1(c){return()=>DT(c)}function RT(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var LT=RT(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function FT(c,t,n,e){const a=o=>o instanceof n,r=o=>{const s=Qn(o.getTextContent());s.setFormat(o.getFormat()),o.replace(s)};return[c.registerNodeTransform(eo,o=>{if(!o.isSimpleText())return;let s,l=o.getPreviousSibling(),i=o.getTextContent(),u=o;if(Wt(l)){const p=l.getTextContent(),f=t(p+i);if(a(l)){if(f===null||(h=>h.getLatest().__mode)(l)!==0)return void r(l);{const h=f.end-p.length;if(h>0){const m=p+i.slice(0,h);if(l.select(),l.setTextContent(m),h===i.length)o.remove();else{const g=i.slice(h);o.setTextContent(g)}return}}}else if(f===null||f.start<p.length)return}let d=0;for(;;){s=t(i);let p,f=s===null?"":i.slice(s.end);if(i=f,f===""){const m=u.getNextSibling();if(Wt(m)){f=u.getTextContent()+m.getTextContent();const g=t(f);if(g===null)return void(a(m)?r(m):m.markDirty());if(g.start!==0)return}}if(s===null)return;if(s.start===0&&Wt(l)&&l.isTextEntity()){d+=s.end;continue}s.start===0?[p,u]=u.splitText(s.end):[,p,u]=u.splitText(s.start+d,s.end+d),p===void 0&<(165,"nodeToReplace");const h=e(p);if(h.setFormat(p.getFormat()),p.replace(h),u==null)return;d=0,l=h}}),c.registerNodeTransform(n,o=>{const s=o.getTextContent(),l=t(s);if(l===null||l.start!==0)return void r(o);if(s.length>l.end)return void o.splitText(l.end);const i=o.getPreviousSibling();Wt(i)&&i.isTextEntity()&&(r(i),r(o));const u=o.getNextSibling();Wt(u)&&u.isTextEntity()&&(r(u),a(o)&&r(o))})]}function R1(c,t,n){const[e]=Sn();ge.useEffect(()=>br(...FT(e,c,t,n)),[n,e,c,t])}const BT=new RegExp(function(){const{alpha:c,alphanumeric:t,hashChars:n}=function(){const a=String.fromCharCode,r="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ-ก-ฺเ-๎ᄀ-ᇿ-ㆅꥠ-가-ힰ-ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+a(173824)+"-"+a(177983)+a(177984)+"-"+a(178207)+a(194560)+"-"+a(195103)+"〃々〻";return{alpha:r,alphanumeric:r+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+c+"]")+e+"*)"}(),"i");function L1(){const[c]=Sn();ge.useEffect(()=>{if(!c.hasNodes([up]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[c]);const t=ge.useCallback(e=>v_(e.getTextContent()),[]),n=ge.useCallback(e=>{const a=BT.exec(e);if(a===null)return null;const r=a[3].length+1,o=a.index+a[1].length;return{end:o+r,start:o}},[]);return R1(n,up,t),null}function F1(){const[c]=Sn();return ge.useEffect(()=>{if(!c.hasNodes([id,od]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[c]),function(t){ge.useEffect(()=>br(t.registerCommand(N_,()=>(x_(t,"number"),!0),Gn),t.registerCommand(O_,()=>(x_(t,"bullet"),!0),Gn),t.registerCommand(A_,()=>(y2(t),!0),Gn),t.registerCommand(pl,()=>!!_2(),Gn)),[t])}(c),null}const zT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;function UT(c){return{initialValueFn:()=>c.isEditable(),subscribe:t=>c.registerEditableListener(t)}}function Vm(){return function(c){const[t]=Sn(),n=ge.useMemo(()=>c(t),[t,c]),e=ge.useRef(n.initialValueFn()),[a,r]=ge.useState(e.current);return zT(()=>{const{initialValueFn:o,subscribe:s}=n,l=o();return e.current!==l&&(e.current=l,r(l)),s(i=>{e.current=i,r(i)})},[n,c]),a}(UT)}function B1(c){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const a=c.getRootElement();if(document.activeElement!==a)return;const r=e.data;if(typeof r=="string"){let o;try{o=JSON.parse(r)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const s=o.payload;if(s&&s.functionId==="makeChanges"){const l=s.args;if(l){const[i,u,d,p,f,h]=l;c.update(()=>{const m=jt();if(Et(m)){const g=m.anchor;let b=g.getNode(),v=0,_=0;if(Wt(b)&&i>=0&&u>=0&&(v=i,_=i+u,m.setTextNodeRange(b,v,b,_)),v===_&&d===""||(m.insertRawText(d),b=g.getNode()),Wt(b)){v=p,_=p+f;const x=b.getTextContentSize();v=v>x?x:v,_=_>x?x:_,m.setTextNodeRange(b,v,b,_)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const Km=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;function z1(c){return c.getEditorState().read(D1(c.isComposing()))}function Np({contentEditable:c,placeholder:t,ErrorBoundary:n}){const[e]=Sn(),a=function(r,o){const[s,l]=ge.useState(()=>r.getDecorators());return Km(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{l(i)})}),[r]),ge.useEffect(()=>{l(r.getDecorators())},[r]),ge.useMemo(()=>{const i=[],u=Object.keys(s);for(let d=0;d<u.length;d++){const p=u[d],f=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(ge.Suspense,{fallback:null,children:s[p]})}),h=r.getElementByKey(p);h!==null&&i.push(so.createPortal(f,h,p))}return i},[o,s,r])}(e,n);return function(r){Km(()=>br(H2(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[c,ce.jsx(HT,{content:t}),a]})}function HT({content:c}){const[t]=Sn(),n=function(a){const[r,o]=ge.useState(()=>z1(a));return Km(()=>{function s(){const l=z1(a);o(l)}return s(),br(a.registerUpdateListener(()=>{s()}),a.registerEditableListener(()=>{s()}))},[a]),r}(t),e=Vm();return n?typeof c=="function"?c(e):c:null}function $T(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var Ap=$T(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function U1({hasCellMerge:c=!0,hasCellBackgroundColor:t=!0,hasTabHandler:n=!0}){const[e]=Sn();return ge.useEffect(()=>(e.hasNodes([xs,rs,El])||Ap(10),br(e.registerCommand($2,({columns:a,rows:r,includeHeaders:o})=>{const s=n1(Number(r),Number(a),o);wl(s);const l=s.getFirstDescendant();return Wt(l)&&l.select(),!0},kn),e.registerNodeTransform(xs,a=>{const[r]=i1(a,null,null),o=r.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<r.length;++s){const l=r[s].length;if(l===o)continue;const i=r[s][l-1].cell;for(let u=l;u<o;++u){const d=_i(0);d.append(In()),i!==null?i.insertAfter(d):r_(i,d)}}}))),[e]),ge.useEffect(()=>{const a=new Map,r=s=>{const l=s.getKey(),i=e.getElementByKey(l);if(i&&!a.has(l)){const u=tT(s,i,e,n);a.set(l,u)}};e.getEditorState().read(()=>{const s=Wv(xs);for(const l of s)jr(l)&&r(l)});const o=e.registerMutationListener(xs,s=>{for(const[l,i]of s)if(i==="created")e.getEditorState().read(()=>{const u=Bn(l);jr(u)&&r(u)});else if(i==="destroyed"){const u=a.get(l);u!==void 0&&(u.removeListeners(),a.delete(l))}});return()=>{o();for(const[,s]of a)s.removeListeners()}},[e,n]),ge.useEffect(()=>{if(!c)return e.registerNodeTransform(rs,a=>{if(a.getColSpan()>1||a.getRowSpan()>1){const[,,r]=Ao(a),[o]=os(r,a,a),s=o.length,l=o[0].length;let i=r.getFirstChild();Mr(i)||Ap(175);const u=[];for(let d=0;d<s;d++){d!==0&&(i=i.getNextSibling(),Mr(i)||Ap(175));let p=null;for(let f=0;f<l;f++){const h=o[d][f],m=h.cell;if(h.startRow===d&&h.startColumn===f)p=m,u.push(m);else if(m.getColSpan()>1||m.getRowSpan()>1){vn(m)||Ap(176);const g=_i(m.__headerState);p!==null?p.insertAfter(g):r_(i,g)}}}for(const d of u)d.setColSpan(1),d.setRowSpan(1)}})},[e,c]),ge.useEffect(()=>{if(!t)return e.registerNodeTransform(rs,a=>{a.getBackgroundColor()!==null&&a.setBackgroundColor(null)})},[e,t,c]),null}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;let WT=class{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}};const H1=c=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),c.scrollIntoView({block:"nearest"})};function $1(c,t){const n=c.getBoundingClientRect(),e=t.getBoundingClientRect();return n.top>e.top&&n.top<e.bottom}function JT(c,t,n,e){const[a]=Sn();ge.useEffect(()=>{if(t!=null&&c!=null){const r=a.getRootElement(),o=r!=null?function(d,p){let f=getComputedStyle(d);const h=f.position==="absolute",m=/(auto|scroll)/;if(f.position==="fixed")return document.body;for(let g=d;g=g.parentElement;)if(f=getComputedStyle(g),(!h||f.position!=="static")&&m.test(f.overflow+f.overflowY+f.overflowX))return g;return document.body}(r):document.body;let s=!1,l=$1(t,o);const i=function(){s||(window.requestAnimationFrame(function(){n(),s=!1}),s=!0);const d=$1(t,o);d!==l&&(l=d,e!=null&&e(d))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",i,{capture:!0,passive:!0}),u.observe(t),()=>{u.unobserve(t),window.removeEventListener("resize",n),document.removeEventListener("scroll",i,!0)}}},[t,a,e,n,c])}const q1=fo();function VT({close:c,editor:t,anchorElementRef:n,resolution:e,options:a,menuRenderFn:r,onSelectOption:o,shouldSplitNodeWithQuery:s=!1,commandPriority:l=Gn}){const[i,u]=ge.useState(null),d=e.match&&e.match.matchingString;ge.useEffect(()=>{u(0)},[d]);const p=ge.useCallback(h=>{t.update(()=>{const m=e.match!=null&&s?function(g){const b=jt();if(!Et(b)||!b.isCollapsed())return null;const v=b.anchor;if(v.type!=="text")return null;const _=v.getNode();if(!_.isSimpleText())return null;const x=v.offset,E=_.getTextContent().slice(0,x),w=g.replaceableString.length,y=x-function(C,T,F){let B=F;for(let M=B;M<=T.length;M++)C.substr(-M)===T.substr(0,M)&&(B=M);return B}(E,g.matchingString,w);if(y<0)return null;let S;return y===0?[S]=_.splitText(x):[,S]=_.splitText(y,x),S}(e.match):null;o(h,m,c,e.match?e.match.matchingString:"")})},[t,s,e.match,o,c]),f=ge.useCallback(h=>{const m=t.getRootElement();m!==null&&(m.setAttribute("aria-activedescendant","typeahead-item-"+h),u(h))},[t]);return ge.useEffect(()=>()=>{const h=t.getRootElement();h!==null&&h.removeAttribute("aria-activedescendant")},[t]),qT(()=>{a===null?u(null):i===null&&f(0)},[a,i,f]),ge.useEffect(()=>br(t.registerCommand(q1,({option:h})=>!(!h.ref||h.ref.current==null)&&(H1(h.ref.current),!0),l)),[t,f,l]),ge.useEffect(()=>br(t.registerCommand(Du,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==a.length-1?i+1:0;f(g);const b=a[g];b.ref!=null&&b.ref.current&&t.dispatchCommand(q1,{index:g,option:b}),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Mu,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==0?i-1:a.length-1;f(g);const b=a[g];b.ref!=null&&b.ref.current&&H1(b.ref.current),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Ls,h=>{const m=h;return m.preventDefault(),m.stopImmediatePropagation(),c(),!0},l),t.registerCommand(xf,h=>{const m=h;return a!==null&&i!==null&&a[i]!=null&&(m.preventDefault(),m.stopImmediatePropagation(),p(a[i]),!0)},l),t.registerCommand(Rs,h=>a!==null&&i!==null&&a[i]!=null&&(h!==null&&(h.preventDefault(),h.stopImmediatePropagation()),p(a[i]),!0),l)),[p,c,t,a,i,f,l]),r(n,ge.useMemo(()=>({options:a,selectOptionAndCleanUp:p,selectedIndex:i,setHighlightedIndex:u}),[p,i,a]),e.match?e.match.matchingString:"")}function KT({options:c,nodeKey:t,onClose:n,onOpen:e,onSelectOption:a,menuRenderFn:r,anchorClassName:o,commandPriority:s=Gn,parent:l}){const[i]=Sn(),[u,d]=ge.useState(null),p=function(g,b,v,_=document.body){const[x]=Sn(),E=ge.useRef(document.createElement("div")),w=ge.useCallback(()=>{E.current.style.top=E.current.style.bottom;const S=x.getRootElement(),C=E.current,T=C.firstChild;if(S!==null&&g!==null){const{left:F,top:B,width:M,height:L}=g.getRect(),A=E.current.offsetHeight;if(C.style.top=`${B+window.pageYOffset+A+3}px`,C.style.left=`${F+window.pageXOffset}px`,C.style.height=`${L}px`,C.style.width=`${M}px`,T!==null){T.style.top=`${B}`;const j=T.getBoundingClientRect(),N=j.height,R=j.width,O=S.getBoundingClientRect();F+R>O.right&&(C.style.left=`${O.right-R+window.pageXOffset}px`),(B+N>window.innerHeight||B+N>O.bottom)&&B-O.top>N+L&&(C.style.top=B-N+window.pageYOffset-L+"px")}C.isConnected||(v!=null&&(C.className=v),C.setAttribute("aria-label","Typeahead menu"),C.setAttribute("id","typeahead-menu"),C.setAttribute("role","listbox"),C.style.display="block",C.style.position="absolute",_.append(C)),E.current=C,S.setAttribute("aria-controls","typeahead-menu")}},[x,g,v,_]);ge.useEffect(()=>{const S=x.getRootElement();if(g!==null)return w(),()=>{S!==null&&S.removeAttribute("aria-controls");const C=E.current;C!==null&&C.isConnected&&C.remove()}},[x,w,g]);const y=ge.useCallback(S=>{g!==null&&(S||b(null))},[g,b]);return JT(g,E.current,w,y),E}(u,d,o,l),f=ge.useCallback(()=>{d(null),n!=null&&u!==null&&n()},[n,u]),h=ge.useCallback(g=>{d(g),e!=null&&u===null&&e(g)},[e,u]),m=ge.useCallback(()=>{t?i.update(()=>{const g=Bn(t),b=i.getElementByKey(t);var v;g!=null&&b!=null&&u==null&&(v=()=>h({getRect:()=>b.getBoundingClientRect()}),ir.startTransition?ir.startTransition(v):v())}):t==null&&u!=null&&f()},[f,i,t,h,u]);return ge.useEffect(()=>{m()},[m,t]),ge.useEffect(()=>{if(t!=null)return i.registerUpdateListener(({dirtyElements:g})=>{g.get(t)&&m()})},[i,m,t]),u===null||i===null?null:ce.jsx(VT,{close:f,resolution:u,editor:i,anchorElementRef:p,options:c,menuRenderFn:r,onSelectOption:a,commandPriority:s})}const GT=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,YT=fo();let W1=class extends WT{constructor(t,n){super(t),this.title=t,this.onSelect=n.onSelect.bind(this)}};function ZT({embedConfigs:c,onOpenEmbedModalForConfig:t,getMenuOptions:n,menuRenderFn:e,menuCommandPriority:a=Gn}){const[r]=Sn(),[o,s]=ge.useState(null),[l,i]=ge.useState(null),u=ge.useCallback(()=>{s(null),i(null)},[]),d=ge.useCallback(m=>{r.getEditorState().read(async function(){const g=Bn(m);if(Qo(g))for(let b=0;b<c.length;b++){const v=c[b];await Promise.resolve(v.parseUrl(g.__url))!=null&&(i(v),s(g.getKey()))}})},[r,c]);ge.useEffect(()=>br(...[pc,rd].map(m=>r.registerMutationListener(m,(...g)=>((b,{updateTags:v,dirtyLeaves:_})=>{for(const[x,E]of b)E==="created"&&v.has("paste")&&_.size<=3?d(x):x===o&&u()})(...g)))),[d,r,c,o,u]),ge.useEffect(()=>r.registerCommand(YT,m=>{const g=c.find(({type:b})=>b===m);return!!g&&(t(g),!0)},kn),[r,c,t]);const p=ge.useCallback(async function(){if(l!=null&&o!=null){const m=r.getEditorState().read(()=>{const g=Bn(o);return Qo(g)?g:null});if(Qo(m)){const g=await Promise.resolve(l.parseUrl(m.__url));g!=null&&r.update(()=>{jt()||m.selectEnd(),l.insertNode(r,g),m.isAttached()&&m.remove()})}}},[l,r,o]),f=ge.useMemo(()=>l!=null&&o!=null?n(l,p,u):[],[l,p,n,o,u]),h=ge.useCallback((m,g,b)=>{r.update(()=>{m.onSelect(g),b()})},[r]);return o!=null?ce.jsx(KT,{nodeKey:o,onClose:u,onSelectOption:h,options:f,menuRenderFn:e,commandPriority:a}):null}const BD="";function XT({onClose:c,children:t,title:n,closeOnClickOutside:e}){const a=ge.useRef(null);return ge.useEffect(()=>{a.current!==null&&a.current.focus()},[]),ge.useEffect(()=>{let r=null;const o=i=>{i.key==="Escape"&&c()},s=i=>{const u=i.target;a.current!==null&&!a.current.contains(u)&&e&&c()},l=a.current;return l!==null&&(r=l.parentElement,r!==null&&r.addEventListener("click",s)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),r!==null&&(r==null||r.removeEventListener("click",s))}},[e,c]),ce.jsx("div",{className:"Modal__overlay",role:"dialog",children:ce.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:a,children:[ce.jsx("h2",{className:"Modal__title",children:n}),ce.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:c,children:"X"}),ce.jsx("div",{className:"Modal__content",children:t})]})})}function QT({onClose:c,children:t,title:n,closeOnClickOutside:e=!1}){return so.createPortal(ce.jsx(XT,{onClose:c,title:n,closeOnClickOutside:e,children:t}),document.body)}function Ma(){const[c,t]=ge.useState(null),n=ge.useCallback(()=>{t(null)},[]),e=ge.useMemo(()=>{if(c===null)return null;const{title:r,content:o,closeOnClickOutside:s}=c;return ce.jsx(QT,{onClose:n,title:r,closeOnClickOutside:s,children:o})},[c,n]),a=ge.useCallback((r,o,s=!1)=>{t({closeOnClickOutside:s,content:o(n),title:r})},[n]);return[e,a]}const eO=fo(),tO=fo(),nO=fo(),rO={contentName:"Youtube Video",exampleUrl:"https://www.youtube.com/watch?v=jNQXAC9IVRw",icon:ce.jsx("i",{className:"icon youtube"}),insertNode:(c,t)=>{c.dispatchCommand(nO,t.id)},keywords:["youtube","video"],parseUrl:async c=>{const t=/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/.exec(c),n=t&&(t==null?void 0:t[2].length)===11?t[2]:null;return n!=null?{id:n,url:c}:null},type:"youtube-video"},oO=[{contentName:"Tweet",exampleUrl:"https://twitter.com/jack/status/20",icon:ce.jsx("i",{className:"icon tweet"}),insertNode:(c,t)=>{c.dispatchCommand(tO,t.id)},keywords:["tweet","twitter"],parseUrl:c=>{const t=/^https:\/\/(twitter|x)\.com\/(#!\/)?(\w+)\/status(es)*\/(\d+)/.exec(c);return t!=null?{id:t[5],url:t[1]}:null},type:"tweet"},rO,{contentName:"Figma Document",exampleUrl:"https://www.figma.com/file/LKQ4FJ4bTnCSjedbRpk931/Sample-File",icon:ce.jsx("i",{className:"icon figma"}),insertNode:(c,t)=>{c.dispatchCommand(eO,t.id)},keywords:["figma","figma.com","mock-up"],parseUrl:c=>{const t=/https:\/\/([\w.-]+\.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/.exec(c);return t!=null?{id:t[3],url:t[0]}:null},type:"figma"}];function iO({index:c,isSelected:t,onClick:n,onMouseEnter:e,option:a}){let r="item";return t&&(r+=" selected"),ce.jsx("li",{tabIndex:-1,className:r,ref:a.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+c,onMouseEnter:e,onClick:n,children:ce.jsx("span",{className:"text",children:a.title})},a.key)}function sO({options:c,selectedItemIndex:t,onOptionClick:n,onOptionMouseEnter:e}){return ce.jsx("div",{className:"typeahead-popover",children:ce.jsx("ul",{children:c.map((a,r)=>ce.jsx(iO,{index:r,isSelected:t===r,onClick:()=>n(a,r),onMouseEnter:()=>e(r),option:a},a.key))})})}const aO=(c,t)=>{let n;return e=>{window.clearTimeout(n),n=window.setTimeout(()=>{c(e)},t)}};function lO({embedConfig:c,onClose:t}){const[n,e]=ge.useState(""),[a]=Sn(),[r,o]=ge.useState(null),s=ge.useMemo(()=>aO(i=>{const u=GT.exec(i);c!=null&&i!=null&&u!=null?Promise.resolve(c.parseUrl(i)).then(d=>{o(d)}):r!=null&&o(null)},200),[c,r]),l=()=>{r!=null&&(c.insertNode(a,r),t())};return ce.jsxs("div",{style:{width:"600px"},children:[ce.jsx("div",{className:"Input__wrapper",children:ce.jsx("input",{type:"text",className:"Input__input",placeholder:c.exampleUrl,value:n,"data-test-id":`${c.type}-embed-modal-url`,onChange:i=>{const{value:u}=i.target;e(u),s(u)}})}),ce.jsx(Tp,{children:ce.jsx(Di,{disabled:!r,onClick:l,"data-test-id":`${c.type}-embed-modal-submit-btn`,children:"Embed"})})]})}function J1(){const[c,t]=Ma(),n=a=>{t(`Embed ${a.contentName}`,r=>ce.jsx(lO,{embedConfig:a,onClose:r}))},e=(a,r,o)=>[new W1("Dismiss",{onSelect:o}),new W1(`Embed ${a.contentName}`,{onSelect:r})];return ce.jsxs(ce.Fragment,{children:[c,ce.jsx(ZT,{embedConfigs:oO,onOpenEmbedModalForConfig:n,getMenuOptions:e,menuRenderFn:(a,{selectedIndex:r,options:o,selectOptionAndCleanUp:s,setHighlightedIndex:l})=>a.current?yf.createPortal(ce.jsx("div",{className:"typeahead-popover auto-embed-menu",style:{marginLeft:a.current.style.width,width:200},children:ce.jsx(sO,{options:o,selectedItemIndex:r,onOptionClick:(i,u)=>{l(u),s(i)},onOptionMouseEnter:i=>{l(i)}})}),a.current):null})]})}function cO(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var uO=cO(function(c){const t=new URLSearchParams;t.append("code",c);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${c}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function V1(c,t=n=>n){return n=>{const e=c.exec(n);return e===null?null:{index:e.index,length:e[0].length,text:e[0],url:t(e[0])}}}function K1(c,t){for(let n=0;n<t.length;n++){const e=t[n](c);if(e)return e}return null}const dO=/[.,;\s]/;function Pp(c){return dO.test(c)}function G1(c){return Pp(c[c.length-1])}function Gm(c){return Pp(c[0])}function Y1(c){let t=c.getPreviousSibling();return kt(t)&&(t=t.getLastDescendant()),t===null||vs(t)||Wt(t)&&G1(t.getTextContent())}function Z1(c){let t=c.getNextSibling();return kt(t)&&(t=t.getFirstDescendant()),t===null||vs(t)||Wt(t)&&Gm(t.getTextContent())}function fO(c,t,n,e){return(c>0?Pp(n[c-1]):Y1(e[0]))?t<n.length?Pp(n[t]):Z1(e[e.length-1]):!1}function pO(c,t,n){const e=[],a=[],r=[];let o=0,s=0;const l=[...c];for(;l.length>0;){const i=l[0],u=i.getTextContent().length,d=s;s+u<=t?(e.push(i),o+=u):d>=n?r.push(i):a.push(i),s+=u,l.shift()}return[o,e,a,r]}function hO(c,t,n,e){const a=_m(e.url,e.attributes);if(c.length===1){let r,o=c[0];t===0?[r,o]=o.splitText(n):[,r,o]=o.splitText(t,n);const s=Qn(e.text);return s.setFormat(r.getFormat()),s.setDetail(r.getDetail()),s.setStyle(r.getStyle()),a.append(s),r.replace(a),o}if(c.length>1){const r=c[0];let o,s=r.getTextContent().length;t===0?o=r:[,o]=r.splitText(t);const l=[];let i;for(let f=1;f<c.length;f++){const h=c[f],m=h.getTextContent().length,g=s;if(g<n)if(s+m<=n)l.push(h);else{const[b,v]=h.splitText(n-g);l.push(b),i=v}s+=m}const u=jt(),d=u?u.getNodes().find(Wt):void 0,p=Qn(o.getTextContent());return p.setFormat(o.getFormat()),p.setDetail(o.getDetail()),p.setStyle(o.getStyle()),a.append(p,...l),d&&d===o&&(Et(u)?p.select(u.anchor.offset,u.focus.offset):dr(u)&&p.select(0,p.getTextContent().length)),o.replace(a),i}}function Ym(c,t,n){const e=c.getChildren(),a=e.length;for(let l=0;l<a;l++){const i=e[l];if(!Wt(i)||!i.isSimpleText())return Ip(c),void n(null,c.getURL())}const r=c.getTextContent(),o=K1(r,t);if(o===null||o.text!==r||!Y1(c)||!Z1(c))return Ip(c),void n(null,c.getURL());const s=c.getURL();if(s!==o.url&&(c.setURL(o.url),n(o.url,s)),o.attributes){const l=c.getRel();l!==o.attributes.rel&&(c.setRel(o.attributes.rel||null),n(o.attributes.rel||null,l));const i=c.getTarget();i!==o.attributes.target&&(c.setTarget(o.attributes.target||null),n(o.attributes.target||null,i))}}function Ip(c){const t=c.getChildren();for(let n=t.length-1;n>=0;n--)c.insertAfter(t[n]);return c.remove(),t.map(n=>n.getLatest())}function gO(c,t,n){ge.useEffect(()=>{c.hasNodes([rd])||uO(77);const e=(a,r)=>{n&&n(a,r)};return br(c.registerNodeTransform(eo,a=>{const r=a.getParentOrThrow(),o=a.getPreviousSibling();if(hc(r)&&!r.getIsUnlinked())Ym(r,t,e);else if(!Qo(r)){if(a.isSimpleText()&&(Gm(a.getTextContent())||!hc(o))){const s=function(l){const i=[l];let u=l.getNextSibling();for(;u!==null&&Wt(u)&&u.isSimpleText()&&(i.push(u),!/[\s]/.test(u.getTextContent()));)u=u.getNextSibling();return i}(a);(function(l,i,u){let d=[...l];const p=d.map(g=>g.getTextContent()).join("");let f,h=p,m=0;for(;(f=K1(h,i))&&f!==null;){const g=f.index,b=g+f.length;if(fO(m+g,m+b,p,d)){const[v,,_,x]=pO(d,m+g,m+b),E=hO(_,m+g-v,m+b-v,f);d=E?[E,...x]:x,u(f.url,null),m=0}else m+=b;h=h.substring(b)}})(s,t,e)}(function(s,l,i){const u=s.getPreviousSibling(),d=s.getNextSibling(),p=s.getTextContent();!hc(u)||u.getIsUnlinked()||Gm(p)&&!/^\.[a-zA-Z0-9]{1,}/.test(p)||(u.append(s),Ym(u,l,i),i(null,u.getURL())),!hc(d)||d.getIsUnlinked()||G1(p)||(Ip(d),Ym(d,l,i),i(null,d.getURL()))})(a,t,e)}}),c.registerCommand(Aa,a=>{const r=jt();return a!==null||!Et(r)||r.extract().forEach(o=>{const s=o.getParent();if(hc(s))return s.setIsUnlinked(!s.getIsUnlinked()),s.markDirty(),!0}),!1},Gn))},[c,t,n])}function mO({matchers:c,onChange:t}){const[n]=Sn();return gO(n,c,t),null}const yO=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,vO=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,bO=[V1(yO,c=>c.startsWith("http")?c:`https://${c}`),V1(vO,c=>`mailto:${c}`)];function X1(){return ce.jsx(mO,{matchers:bO})}function _O({accept:c,label:t,onChange:n,"data-test-id":e}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:t}),ce.jsx("input",{type:"file",accept:c,className:"Input__input",onChange:a=>n(a.target.files),"data-test-id":e})]})}const Cc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wO=c=>Cc?(c||window).getSelection():null,Mp=fo();function xO({onClick:c}){const[t,n]=ge.useState(""),[e,a]=ge.useState(""),r=t==="",o=s=>{const l=new FileReader;l.onload=function(){return typeof l.result=="string"&&n(l.result),""},s!==null&&l.readAsDataURL(s[0])};return ce.jsxs(ce.Fragment,{children:[ce.jsx(_O,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),ce.jsx(Ec,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:a,value:e,"data-test-id":"image-modal-alt-text-input"}),ce.jsx(Tp,{children:ce.jsx(Di,{"data-test-id":"image-modal-file-upload-btn",disabled:r,onClick:()=>c({altText:e,src:t}),children:"Confirm"})})]})}function SO({activeEditor:c,onClose:t,captionsEnabled:n}){const[e,a]=ge.useState("file"),r=ge.useRef(!1);ge.useEffect(()=>{r.current=!1;const s=l=>{r.current=l.altKey};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[c]);const o=s=>{c.dispatchCommand(Mp,s),console.log("line 202 imageplugin insert image"),t()};return ce.jsx(ce.Fragment,{children:e==="file"&&ce.jsx(xO,{onClick:o})})}function EO(c,t,n){c.preventDefault();const e=c.clipboardData;if(!e)return!1;const a=e.items;if(!a||a.length===0)return!1;let r=!1,o=!1;const s=a.length>1?a[1]:a[0];let l=1;if(l===1){if(l=2,s.type==="text/html"&&!r){const i=e.getData("text/html"),d=new DOMParser().parseFromString(i,"text/html").querySelector("img");d&&d.src&&(fetch(d.src).then(p=>p.blob()).then(p=>{const f=new File([p],"pasted-image.png",{type:"image/png"});Q1(f,t)}).catch(p=>console.error("Error fetching pasted image:",p)),r=!0)}else if(s.type.startsWith("image/")&&!r){const i=s.getAsFile();i&&(Q1(i,t),r=!0)}else if(s.type.startsWith("text")&&!o){const i=e.getData("text/plain");CO(i,t),o=!0}}return!(!r&&!o)}function Q1(c,t){const n=new FileReader;n.onload=()=>{const e=n.result,r={altText:c.name,src:e};t.update(()=>{const i=`Figure ${Un().getChildren().filter(m=>Wt(m)&&m.getTextContent().startsWith("Figure")).length+1}`;Qn(i).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;");const d=wc({...r,figureLabel:i}),p=In();p.setFormat("left"),vi(),Qn(".").setStyle("color: black; font-style: italic; font-weight: bold;"),p.append(d),es([p]),Qr(d.getParentOrThrow())&&dm(d,In).selectEnd(),t.update(()=>{const g=Un().getChildren().filter(v=>Rr(v));let b=1;g.forEach(v=>{const _=v.getChildren().find(E=>E.getTextContent().startsWith("Figure")),x=`Figure ${b}:`;if(_){const E=new Ws(x,"black",`Image_caption_307_${Math.random()}`);_.replace(E),b++}})})})},n.readAsDataURL(c)}function CO(c,t){t.update(()=>{const r=`Text ${Un().getChildren().filter(d=>Wt(d)&&d.getTextContent().startsWith("Text")).length+1}`;Qn(r).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;"),Qn(c);const s=In();s.setFormat("left");const l=vi();Qn(".").setStyle("color: black; font-style: italic; font-weight: bold;"),s.append(l),es([s]),t.update(()=>{const p=Un().getChildren().filter(h=>Rr(h));let f=1;p.forEach(h=>{const m=h.getChildren().find(b=>b.getTextContent().startsWith("Text")),g=`Text ${f}:`;if(m){const b=Qn(g);m.replace(b),f++}})})})}function ew({captionsEnabled:c=!0}){const[t]=Sn(),[n,e]=ge.useState("");return ge.useEffect(()=>{if(!t.hasNodes([Ep]))throw new Error("ImagesPlugin: ImageNode not registered on editor");let a=0;return br(t.registerCommand(Mp,r=>{if(a+=1,c){Qn(`Figure ${a}:`).setStyle("font-weight: bold; display: block; text-align: center; margin-top: 5px; font-size: 14px;");const s=wc({...r}),l=In();l.setFormat("left"),vi();const i=n.trim()===""?".":n;Qn(i).setStyle(i?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),l.append(s),es([l]),Qr(s.getParentOrThrow())&&dm(s,In).selectEnd()}else{const o=wc(r),s=In();s.setFormat("left");const l=vi();s.append(o,l),es([s]),Qr(o.getParentOrThrow())&&dm(o,In).selectEnd()}return t.update(()=>{const s=Un().getChildren().filter(i=>Rr(i));let l=1;s.forEach((i,u)=>{const d=i.getChildren().find(f=>f.getTextContent().startsWith("Figure")),p=`Figure ${l}:`;if(d){const f=new Ws(p,"black",`Image_caption_307_${Math.random()}`);d.replace(f),l++}})}),!0},kn),t.registerCommand(Xl,r=>kO(r),ts),t.registerCommand(ug,r=>TO(r),Gn),t.registerCommand(Sf,r=>OO(r,t),ts),t.registerCommand(_a,r=>EO(r,t),ts))},[c,t]),null}const jO="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",tw=document.createElement("img");tw.src=jO;function kO(c){const t=Zm();if(!t)return!1;const n=c.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(tw,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:t.__altText,caption:t.__caption,height:t.__height,key:t.getKey(),maxWidth:t.__maxWidth,showCaption:t.__showCaption,src:t.__src,width:t.__width},type:"image"})),!0):!1}function TO(c){return Zm()?(nw(c)||c.preventDefault(),!0):!1}function OO(c,t){const n=Zm();if(!n)return!1;const e=NO(c);if(!e)return!1;if(c.preventDefault(),nw(c)){const a=AO(c);n.remove();const r=Xu();a!=null&&r.applyDOMRange(a),Cr(r),t.dispatchCommand(Mp,e)}return!0}function Zm(){const c=jt();if(!dr(c))return null;const n=c.getNodes()[0];return xc(n)?n:null}function NO(c){var a;const t=(a=c.dataTransfer)==null?void 0:a.getData("application/x-lexical-drag");if(!t)return null;const{type:n,data:e}=JSON.parse(t);return n!=="image"?null:e}function nw(c){const t=c.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function AO(c){let t;const n=c.target,e=n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView,a=wO(e);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(c.clientX,c.clientY);else if(c.rangeParent&&a!==null)a.collapse(c.rangeParent,c.rangeOffset||0),t=a.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}const rw=["image/","image/heic","image/heif","image/gif","image/webp"];function ow(){const[c]=Sn();return ge.useEffect(()=>c.registerCommand(km,t=>((async()=>{const n=await e2(t,[rw].flatMap(e=>e));for(const{file:e,result:a}of n)e_(e,rw)&&c.dispatchCommand(Mp,{altText:e.name,src:a})})(),!0),Gn),[c]),null}const PO=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ge.useLayoutEffect:ge.useEffect;let iw=class{constructor(t){this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}};const sw=c=>{const t=document.getElementById("typeahead-menu");if(!t)return;const n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),c.scrollIntoView({block:"nearest"})};function aw(c,t){const n=c.getBoundingClientRect(),e=t.getBoundingClientRect();return n.top>e.top&&n.top<e.bottom}function IO(c,t,n,e){const[a]=Sn();ge.useEffect(()=>{if(t!=null&&c!=null){const r=a.getRootElement(),o=r!=null?function(d,p){let f=getComputedStyle(d);const h=f.position==="absolute",m=/(auto|scroll)/;if(f.position==="fixed")return document.body;for(let g=d;g=g.parentElement;)if(f=getComputedStyle(g),(!h||f.position!=="static")&&m.test(f.overflow+f.overflowY+f.overflowX))return g;return document.body}(r):document.body;let s=!1,l=aw(t,o);const i=function(){s||(window.requestAnimationFrame(function(){n(),s=!1}),s=!0);const d=aw(t,o);d!==l&&(l=d,e!=null&&e(d))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",i,{capture:!0,passive:!0}),u.observe(t),()=>{u.unobserve(t),window.removeEventListener("resize",n),document.removeEventListener("scroll",i,!0)}}},[t,a,e,n,c])}const lw=fo();function MO({close:c,editor:t,anchorElementRef:n,resolution:e,options:a,menuRenderFn:r,onSelectOption:o,shouldSplitNodeWithQuery:s=!1,commandPriority:l=Gn}){const[i,u]=ge.useState(null),d=e.match&&e.match.matchingString;ge.useEffect(()=>{u(0)},[d]);const p=ge.useCallback(h=>{t.update(()=>{const m=e.match!=null&&s?function(g){const b=jt();if(!Et(b)||!b.isCollapsed())return null;const v=b.anchor;if(v.type!=="text")return null;const _=v.getNode();if(!_.isSimpleText())return null;const x=v.offset,E=_.getTextContent().slice(0,x),w=g.replaceableString.length,y=x-function(C,T,F){let B=F;for(let M=B;M<=T.length;M++)C.substr(-M)===T.substr(0,M)&&(B=M);return B}(E,g.matchingString,w);if(y<0)return null;let S;return y===0?[S]=_.splitText(x):[,S]=_.splitText(y,x),S}(e.match):null;o(h,m,c,e.match?e.match.matchingString:"")})},[t,s,e.match,o,c]),f=ge.useCallback(h=>{const m=t.getRootElement();m!==null&&(m.setAttribute("aria-activedescendant","typeahead-item-"+h),u(h))},[t]);return ge.useEffect(()=>()=>{const h=t.getRootElement();h!==null&&h.removeAttribute("aria-activedescendant")},[t]),PO(()=>{a===null?u(null):i===null&&f(0)},[a,i,f]),ge.useEffect(()=>br(t.registerCommand(lw,({option:h})=>!(!h.ref||h.ref.current==null)&&(sw(h.ref.current),!0),l)),[t,f,l]),ge.useEffect(()=>br(t.registerCommand(Du,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==a.length-1?i+1:0;f(g);const b=a[g];b.ref!=null&&b.ref.current&&t.dispatchCommand(lw,{index:g,option:b}),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Mu,h=>{const m=h;if(a!==null&&a.length&&i!==null){const g=i!==0?i-1:a.length-1;f(g);const b=a[g];b.ref!=null&&b.ref.current&&sw(b.ref.current),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),t.registerCommand(Ls,h=>{const m=h;return m.preventDefault(),m.stopImmediatePropagation(),c(),!0},l),t.registerCommand(xf,h=>{const m=h;return a!==null&&i!==null&&a[i]!=null&&(m.preventDefault(),m.stopImmediatePropagation(),p(a[i]),!0)},l),t.registerCommand(Rs,h=>a!==null&&i!==null&&a[i]!=null&&(h!==null&&(h.preventDefault(),h.stopImmediatePropagation()),p(a[i]),!0),l)),[p,c,t,a,i,f,l]),r(n,ge.useMemo(()=>({options:a,selectOptionAndCleanUp:p,selectedIndex:i,setHighlightedIndex:u}),[p,i,a]),e.match?e.match.matchingString:"")}const DO=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function cw(c,{minLength:t=1,maxLength:n=75}){return ge.useCallback(e=>{const a=new RegExp("(^|\\s|\\()(["+c+"]((?:"+("[^"+c+DO+"\\s]")+"){0,"+n+"}))$").exec(e);if(a!==null){const r=a[1],o=a[3];if(o.length>=t)return{leadOffset:a.index+r.length,matchingString:o,replaceableString:a[2]}}return null},[n,t,c])}function uw({options:c,onQueryChange:t,onSelectOption:n,onOpen:e,onClose:a,menuRenderFn:r,triggerFn:o,anchorClassName:s,commandPriority:l=Gn,parent:i}){const[u]=Sn(),[d,p]=ge.useState(null),f=function(g,b,v,_=document.body){const[x]=Sn(),E=ge.useRef(document.createElement("div")),w=ge.useCallback(()=>{E.current.style.top=E.current.style.bottom;const S=x.getRootElement(),C=E.current,T=C.firstChild;if(S!==null&&g!==null){const{left:F,top:B,width:M,height:L}=g.getRect(),A=E.current.offsetHeight;if(C.style.top=`${B+window.pageYOffset+A+3}px`,C.style.left=`${F+window.pageXOffset}px`,C.style.height=`${L}px`,C.style.width=`${M}px`,T!==null){T.style.top=`${B}`;const j=T.getBoundingClientRect(),N=j.height,R=j.width,O=S.getBoundingClientRect();F+R>O.right&&(C.style.left=`${O.right-R+window.pageXOffset}px`),(B+N>window.innerHeight||B+N>O.bottom)&&B-O.top>N+L&&(C.style.top=B-N+window.pageYOffset-L+"px")}C.isConnected||(v!=null&&(C.className=v),C.setAttribute("aria-label","Typeahead menu"),C.setAttribute("id","typeahead-menu"),C.setAttribute("role","listbox"),C.style.display="block",C.style.position="absolute",_.append(C)),E.current=C,S.setAttribute("aria-controls","typeahead-menu")}},[x,g,v,_]);ge.useEffect(()=>{const S=x.getRootElement();if(g!==null)return w(),()=>{S!==null&&S.removeAttribute("aria-controls");const C=E.current;C!==null&&C.isConnected&&C.remove()}},[x,w,g]);const y=ge.useCallback(S=>{g!==null&&(S||b(null))},[g,b]);return IO(g,E.current,w,y),E}(d,p,s,i),h=ge.useCallback(()=>{p(null),a!=null&&d!==null&&a()},[a,d]),m=ge.useCallback(g=>{p(g),e!=null&&d===null&&e(g)},[e,d]);return ge.useEffect(()=>{const g=u.registerUpdateListener(()=>{u.getEditorState().read(()=>{const b=u._window||window,v=b.document.createRange(),_=jt(),x=function(y){let S=null;return y.getEditorState().read(()=>{const C=jt();Et(C)&&(S=function(T){const F=T.anchor;if(F.type!=="text")return null;const B=F.getNode();if(!B.isSimpleText())return null;const M=F.offset;return B.getTextContent().slice(0,M)}(C))}),S}(u);if(!Et(_)||!_.isCollapsed()||x===null||v===null)return void h();const E=o(x,u);if(t(E?E.matchingString:null),E!==null&&!function(y,S){return S===0&&y.getEditorState().read(()=>{const C=jt();if(Et(C)){const T=C.anchor.getNode().getPreviousSibling();return Wt(T)&&T.isTextEntity()}return!1})}(u,E.leadOffset)&&function(S,C,T){const F=T.getSelection();if(F===null||!F.isCollapsed)return!1;const B=F.anchorNode,M=S,L=F.anchorOffset;if(B==null||L==null)return!1;try{C.setStart(B,M),C.setEnd(B,L)}catch{return!1}return!0}(E.leadOffset,v,b)!==null)return w=()=>m({getRect:()=>v.getBoundingClientRect(),match:E}),void(ir.startTransition?ir.startTransition(w):w());var w;h()})});return()=>{g()}},[u,o,t,d,h,m]),d===null||u===null?null:ce.jsx(MO,{close:h,resolution:d,editor:u,anchorElementRef:f,options:c,menuRenderFn:r,shouldSplitNodeWithQuery:!0,onSelectOption:n,commandPriority:l})}class RO extends iw{constructor(n,e,a){super(n);qn(this,"title");qn(this,"emoji");qn(this,"keywords");this.title=n,this.emoji=e,this.keywords=a.keywords||[]}}function LO({index:c,isSelected:t,onClick:n,onMouseEnter:e,option:a}){let r="item";return t&&(r+=" selected"),ce.jsx("li",{tabIndex:-1,className:r,ref:a.setRefElement,role:"option","aria-selected":t,id:"typeahead-item-"+c,onMouseEnter:e,onClick:n,children:ce.jsxs("span",{className:"text",children:[a.emoji," ",a.title]})},a.key)}const FO=10;function dw(){const[c]=Sn(),[t,n]=ge.useState(null),[e,a]=ge.useState([]);ge.useEffect(()=>{Promise.resolve().then(()=>dD).then(i=>a(i.default))},[]);const r=ge.useMemo(()=>e!=null?e.map(({emoji:i,aliases:u,tags:d})=>new RO(u[0],i,{keywords:[...u,...d]})):[],[e]),o=cw(":",{minLength:0}),s=ge.useMemo(()=>r.filter(i=>t!=null?new RegExp(t,"gi").exec(i.title)||i.keywords!=null?i.keywords.some(u=>new RegExp(t,"gi").exec(u)):!1:r).slice(0,FO),[r,t]),l=ge.useCallback((i,u,d)=>{c.update(()=>{const p=jt();!Et(p)||i==null||(u&&u.remove(),p.insertNodes([Qn(i.emoji)]),d())})},[c]);return ce.jsx(uw,{onQueryChange:n,onSelectOption:l,triggerFn:o,options:s,menuRenderFn:(i,{selectedIndex:u,selectOptionAndCleanUp:d,setHighlightedIndex:p})=>i.current==null||s.length===0?null:i.current&&s.length?yf.createPortal(ce.jsx("div",{className:"typeahead-popover emoji-menu",children:ce.jsx("ul",{children:s.map((f,h)=>ce.jsx("div",{children:ce.jsx(LO,{index:h,isSelected:u===h,onClick:()=>{p(h),d(f)},onMouseEnter:()=>{p(h)},option:f})},f.key))})}),i.current):null})}const fw=new Map([[":)",["emoji happysmile","🙂"]],[":D",["emoji veryhappysmile","😀"]],[":(",["emoji unhappysmile","🙁"]],["<3",["emoji heart","❤"]],["🙂",["emoji happysmile","🙂"]],["😀",["emoji veryhappysmile","😀"]],["🙁",["emoji unhappysmile","🙁"]],["❤",["emoji heart","❤"]]]);function BO(c){const t=c.getTextContent();for(let n=0;n<t.length;n++){const e=fw.get(t[n])||fw.get(t.slice(n,n+2));if(e!==void 0){const[a,r]=e;let o;n===0?[o]=c.splitText(n+2):[,o]=c.splitText(n,n+2);const s=v1(a,r);return o.replace(s),s}}return null}function zO(c){let t=c;for(;t!==null;){if(!t.isSimpleText())return;t=BO(t)}}function UO(c){ge.useEffect(()=>{if(!c.hasNodes([hd]))throw new Error("EmojisPlugin: EmojiNode not registered on editor");return c.registerNodeTransform(eo,zO)},[c])}function pw(){const[c]=Sn();return UO(c),null}const HO=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function hw(){const[c]=Sn();ge.useEffect(()=>{if(!c.hasNodes([Sc]))throw new Error("KeywordsPlugin: KeywordNode not registered on editor")},[c]);const t=ge.useCallback(e=>w1(e.getTextContent()),[]),n=ge.useCallback(e=>{const a=HO.exec(e);if(a===null)return null;const r=a[2].length,o=a.index+a[1].length;return{end:o+r,start:o}},[]);return R1(n,Sc,t),null}function $O({validateUrl:c}){const[t]=Sn();return ge.useEffect(()=>{if(!t.hasNodes([pc]))throw new Error("LinkPlugin: LinkNode not registered on editor");return br(t.registerCommand(Aa,n=>{if(n===null)return wm(n),!0;if(typeof n=="string")return!(c!==void 0&&!c(n))&&(wm(n),!0);{const{url:e,target:a,rel:r,title:o}=n;return wm(e,{rel:r,target:a,title:o}),!0}},Gn),c!==void 0?t.registerCommand(_a,n=>{const e=jt();if(!Et(e)||e.isCollapsed()||!$s(n,ClipboardEvent))return!1;const a=n;if(a.clipboardData===null)return!1;const r=a.clipboardData.getData("text");return!!c(r)&&!e.getNodes().some(o=>kt(o))&&(t.dispatchCommand(Aa,r),n.preventDefault(),!0)},Gn):()=>{})},[t,c]),null}const qO=new Set(["http:","https:","mailto:","sms:","tel:"]);function gw(c){try{const t=new URL(c);if(!qO.has(t.protocol))return"about:blank"}catch{return c}return c}const WO=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function JO(c){return c==="https://"||WO.test(c)}function Xm(){return ce.jsx($O,{validateUrl:JO})}function VO(c){const t=c.getNodes();return t.length===0?new Set([c.anchor.getNode().getParentOrThrow(),c.focus.getNode().getParentOrThrow()]):new Set(t.map(n=>kt(n)?n:n.getParentOrThrow()))}function KO(c){const t=jt();if(!Et(t))return!1;const n=VO(t);let e=0;for(const a of n)if(sr(a))e=Math.max(xm(a)+1,e);else if(qr(a)){const r=a.getParent();if(!sr(r))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");e=Math.max(xm(r)+1,e)}return e<=c}function mw({maxDepth:c}){const[t]=Sn();return ge.useEffect(()=>t.registerCommand(gv,()=>!KO(c??7),zo),[t,c]),null}const GO=1,YO=100;let yw=0,vw=!1;function ZO(){window.addEventListener("keydown",c=>{c.key==="Tab"&&(yw=c.timeStamp)},!0)}function bw(){const[c]=Sn();return ge.useEffect(()=>(vw||(ZO(),vw=!0),c.registerCommand(dg,t=>{const n=jt();return Et(n)&&yw+YO>t.timeStamp&&Cr(n.clone()),!1},GO)),[c]),null}const HD="";let Qm=!1;const XO=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],vd=214,_w=150;function QO({color:c,onChange:t}){const[n,e]=ge.useState(jc("hex",c)),[a,r]=ge.useState(c),o=ge.useRef(null),s=ge.useMemo(()=>({x:n.hsv.s/100*vd,y:(100-n.hsv.v)/100*_w}),[n.hsv.s,n.hsv.v]),l=ge.useMemo(()=>({x:n.hsv.h/360*vd}),[n.hsv]),i=p=>{if(r(p),/^#[0-9A-Fa-f]{6}$/i.test(p)){const f=jc("hex",p);e(f)}},u=({x:p,y:f})=>{const h={...n.hsv,s:p/vd*100,v:100-f/_w*100},m=jc("hsv",h);e(m),r(m.hex)},d=({x:p})=>{const f={...n.hsv,h:p/vd*360},h=jc("hsv",f);e(h),r(h.hex)};return ge.useEffect(()=>{o.current!==null&&t&&(t(n.hex,Qm),r(n.hex))},[n,t]),ge.useEffect(()=>{if(c===void 0)return;const p=jc("hex",c);e(p),r(p.hex)},[c]),ce.jsxs("div",{className:"color-picker-wrapper",style:{width:vd},ref:o,children:[ce.jsx(Ec,{label:"Hex",onChange:i,value:a}),ce.jsx("div",{className:"color-picker-basic-color",children:XO.map(p=>ce.jsx("button",{className:p===n.hex?" active":"",style:{backgroundColor:p},onClick:()=>{r(p),e(jc("hex",p))}},p))}),ce.jsx(ww,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:u,children:ce.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:s.x,top:s.y}})}),ce.jsx(ww,{className:"color-picker-hue",onChange:d,children:ce.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:l.x}})}),ce.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function ww({className:c,style:t,onChange:n,children:e}){const a=ge.useRef(null),r=ge.useRef(!1),o=l=>{if(a.current){const{current:i}=a,{width:u,height:d,left:p,top:f}=i.getBoundingClientRect(),h=xw(l.clientX-p,u,0),m=xw(l.clientY-f,d,0);n({x:h,y:m})}},s=l=>{if(l.button!==0)return;o(l);const i=d=>{r.current=!0,Qm=!0,o(d)},u=d=>{r.current&&(Qm=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",u,!1),o(d),r.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",u,!1)};return ce.jsx("div",{ref:a,className:c,style:t,onMouseDown:s,children:e})}function xw(c,t,n){return c>t?t:c<n?n:c}function Sw(c){if(c.startsWith("#")){if(c.length===4||c.length===5)return c=c.split("").map((t,n)=>n?t+t:"#").join(""),c;if(c.length===7||c.length===9)return c}else{const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("2d context not supported or canvas already initialized");return t.fillStyle=c,t.fillStyle}return"#000000"}function Ew(c){const t=(c.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,e,a,r)=>"#"+e+e+a+a+r+r).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:t[2],g:t[1],r:t[0]}}function ey({r:c,g:t,b:n}){c/=255,t/=255,n/=255;const e=Math.max(c,t,n),a=e-Math.min(c,t,n),r=a?(e===c?(t-n)/a+(t<n?6:0):e===t?2+(n-c)/a:4+(c-t)/a)*60:0,o=e?a/e*100:0,s=e*100;return{h:r,s:o,v:s}}function eN({h:c,s:t,v:n}){t/=100,n/=100;const e=~~(c/60),a=c/60-e,r=n*(1-t),o=n*(1-t*a),s=n*(1-t*(1-a)),l=e%6,i=Math.round([n,o,r,r,s,n][l]*255),u=Math.round([s,n,n,o,r,r][l]*255);return{b:Math.round([r,r,s,n,n,o][l]*255),g:u,r:i}}function Cw({b:c,g:t,r:n}){return"#"+[n,t,c].map(e=>e.toString(16).padStart(2,"0")).join("")}function jc(c,t){let n=Sw("#121212"),e=Ew(n),a=ey(e);return c==="hex"?(n=Sw(t),e=Ew(n),a=ey(e)):c==="rgb"?(e=t,n=Cw(e),a=ey(e)):c==="hsv"&&(a=t,e=eN(a),n=Cw(e)),{hex:n,hsv:a,rgb:e}}function tN(c,t,...n){if(!c)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function ty(c){const t=c.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function nN(c){const t=c.getNodes(),n=[];let e=null,a=null,r=0;for(let o=0;o<t.length;o++){const s=t[o];if(vn(s)){const l=s.getParentOrThrow();if(tN(Mr(l),"Expected CellNode to have a RowNode parent"),e!==l){if(a!==null&&r!==a)return!1;e!==null&&(a=r),e=l,r=0}const i=s.__colSpan;for(let u=0;u<i;u++)n[r+u]===void 0&&(n[r+u]=0),n[r+u]+=s.__rowSpan;r+=i}}return(a===null||r===a)&&n.every(o=>o===n[0])}function rN(){const c=jt();if(Et(c)&&!c.isCollapsed()||ur(c)&&!c.anchor.is(c.focus)||!Et(c)&&!ur(c))return!1;const[t]=Ao(c.anchor);return t.__colSpan>1||t.__rowSpan>1}function jw(c){if(c.getChildrenSize()!==1)return!1;const t=c.getFirstChildOrThrow();return!(!Rr(t)||!t.isEmpty())}function oN(c){const t=c.getLastDescendant();Wt(t)?t.select():kt(t)?t.selectEnd():t!==null&&t.selectNext()}function kw(c){return c.getEditorState().read(()=>{const t=jt();if(Et(t)||ur(t)){const[n]=Ao(t.anchor);if(vn(n))return n.getBackgroundColor()}return null})}function iN({onClose:c,tableCellNode:t,setIsMenuOpen:n,contextRef:e,cellMerge:a,showColorPickerModal:r}){const[o]=Sn(),s=ge.useRef(null),[l,i]=ge.useState(t),[u,d]=ge.useState({columns:1,rows:1}),[p,f]=ge.useState(!1),[h,m]=ge.useState(!1),[g,b]=ge.useState(()=>kw(o)||"");ge.useEffect(()=>o.registerMutationListener(rs,L=>{L.get(l.getKey())==="updated"&&(o.getEditorState().read(()=>{i(l.getLatest())}),b(kw(o)||""))}),[o,l]),ge.useEffect(()=>{o.getEditorState().read(()=>{const L=jt();if(ur(L)){const A=ty(L);d(ty(L)),f(nN(L)&&(A.columns>1||A.rows>1))}m(rN())})},[o]),ge.useEffect(()=>{const L=e.current,A=s.current,j=o.getRootElement();if(L!=null&&A!=null&&j!=null){const N=j.getBoundingClientRect(),R=L.getBoundingClientRect();A.style.opacity="1";const O=A.getBoundingClientRect(),z=5;let P=R.right+z;if(P+O.width>window.innerWidth||P+O.width>N.right){const J=R.left-O.width-z;P=(J<0?z:J)+window.pageXOffset}A.style.left=`${P+window.pageXOffset}px`;let $=R.top;if($+O.height>window.innerHeight){const J=R.bottom-O.height;$=(J<0?z:J)+window.pageYOffset}A.style.top=`${$+ +window.pageYOffset}px`}},[e,s,o]),ge.useEffect(()=>{function L(A){s.current!=null&&e.current!=null&&!s.current.contains(A.target)&&!e.current.contains(A.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);const v=ge.useCallback(()=>{o.update(()=>{if(l.isAttached()){const A=Pa(l),j=o.getElementByKey(A.getKey());if(!j)throw new Error("Expected to find tableElement in DOM");const N=nT(j);N!==null&&N.clearHighlight(),A.markDirty(),i(l.getLatest())}Un().selectStart()})},[o,l]),_=()=>{o.update(()=>{const L=jt();if(ur(L)){const{columns:A,rows:j}=ty(L),N=L.getNodes();let R=null;for(let O=0;O<N.length;O++){const z=N[O];if(vn(z))if(R===null){z.setColSpan(A).setRowSpan(j),R=z;const P=jw(z);let $;P&&Rr($=z.getFirstChild())&&$.remove()}else vn(R)&&(jw(z)||R.append(...z.getChildren()),z.remove())}R!==null&&(R.getChildrenSize()===0&&R.append(In()),oN(R)),c()}})},x=()=>{o.update(()=>{X2()})},E=ge.useCallback(L=>{o.update(()=>{K2(L),c()})},[o,c]),w=ge.useCallback(L=>{o.update(()=>{for(let A=0;A<u.columns;A++)G2(L);c()})},[o,c,u.columns]),y=ge.useCallback(()=>{o.update(()=>{Y2(),c()})},[o,c]),S=ge.useCallback(()=>{o.update(()=>{Pa(l).remove(),v(),c()})},[o,l,v,c]),C=ge.useCallback(()=>{o.update(()=>{Z2(),c()})},[o,c]),T=ge.useCallback(()=>{o.update(()=>{const L=Pa(l),A=o1(l),j=L.getChildren();if(A>=j.length||A<0)throw new Error("Expected table cell to be inside of table row.");const N=j[A];if(!Mr(N))throw new Error("Expected table row");N.getChildren().forEach(R=>{if(!vn(R))throw new Error("Expected table cell");R.toggleHeaderStyle(Lr.ROW)}),v(),c()})},[o,l,v,c]),F=ge.useCallback(()=>{o.update(()=>{const L=Pa(l),A=Tm(l),j=L.getChildren(),N=Math.max(...j.map(R=>R.getChildren().length));if(A>=N||A<0)throw new Error("Expected table cell to be inside of table row.");for(let R=0;R<j.length;R++){const O=j[R];if(!Mr(O))throw new Error("Expected table row");const z=O.getChildren();if(A>=z.length)continue;const P=z[A];if(!vn(P))throw new Error("Expected table cell");P.toggleHeaderStyle(Lr.COLUMN)}v(),c()})},[o,l,v,c]),B=ge.useCallback(L=>{o.update(()=>{const A=jt();if(Et(A)||ur(A)){const[j]=Ao(A.anchor);if(vn(j)&&j.setBackgroundColor(L),ur(A)){const N=A.getNodes();for(let R=0;R<N.length;R++){const O=N[R];vn(O)&&O.setBackgroundColor(L)}}}})},[o]);let M=null;return a&&(p?M=ce.jsx("button",{type:"button",className:"item",onClick:()=>_(),"data-test-id":"table-merge-cells",children:"Merge cells"}):h&&(M=ce.jsx("button",{type:"button",className:"item",onClick:()=>x(),"data-test-id":"table-unmerge-cells",children:"Unmerge cells"}))),so.createPortal(ce.jsxs("div",{className:"dropdown",ref:s,onClick:L=>{L.stopPropagation()},children:[M,ce.jsx("button",{type:"button",className:"item",onClick:()=>r("Cell background color",()=>ce.jsx(QO,{color:g,onChange:B})),"data-test-id":"table-background-color",children:ce.jsx("span",{className:"text",children:"Background color"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>E(!1),"data-test-id":"table-insert-row-above",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","above"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>E(!0),"data-test-id":"table-insert-row-below",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","below"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!1),"data-test-id":"table-insert-column-before",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!0),"data-test-id":"table-insert-column-after",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>C(),"data-test-id":"table-delete-columns",children:ce.jsx("span",{className:"text",children:"Delete column"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>y(),"data-test-id":"table-delete-rows",children:ce.jsx("span",{className:"text",children:"Delete row"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(),"data-test-id":"table-delete",children:ce.jsx("span",{className:"text",children:"Delete table"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>T(),children:ce.jsxs("span",{className:"text",children:[(l.__headerState&Lr.ROW)===Lr.ROW?"Remove":"Add"," ","row header"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>F(),"data-test-id":"table-column-header",children:ce.jsxs("span",{className:"text",children:[(l.__headerState&Lr.COLUMN)===Lr.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function sN({anchorElem:c,cellMerge:t}){const[n]=Sn(),e=ge.useRef(null),a=ge.useRef(null),[r,o]=ge.useState(!1),[s,l]=ge.useState(null),[i,u]=Ma(),d=ge.useCallback(()=>{const f=e.current,h=jt(),m=window.getSelection(),g=document.activeElement;if(h==null||f==null){l(null);return}const b=n.getRootElement();if(Et(h)&&b!==null&&m!==null&&b.contains(m.anchorNode)){const v=V2(h.anchor.getNode());if(v==null){l(null);return}if(n.getElementByKey(v.getKey())==null){l(null);return}l(v)}else g||l(null)},[n]);ge.useEffect(()=>n.registerUpdateListener(()=>{n.getEditorState().read(()=>{d()})})),ge.useEffect(()=>{const f=e.current;if(f!=null&&s!=null){const h=n.getElementByKey(s.getKey());if(h!=null){const m=h.getBoundingClientRect(),g=f.getBoundingClientRect(),b=c.getBoundingClientRect(),v=m.top-b.top+4,_=m.right-g.width-10-b.left;f.style.opacity="1",f.style.transform=`translate(${_}px, ${v}px)`}else f.style.opacity="0",f.style.transform="translate(-10000px, -10000px)"}},[e,s,n,c]);const p=ge.useRef(s);return ge.useEffect(()=>{p.current!==s&&o(!1),p.current=s},[p,s]),ce.jsx("div",{className:"table-cell-action-button-container",ref:e,children:s!=null&&ce.jsxs(ce.Fragment,{children:[ce.jsx("button",{type:"button",className:"table-cell-action-button chevron-down",onClick:f=>{f.stopPropagation(),o(!r)},ref:a,children:ce.jsx("i",{className:"chevron-down"})}),i,r&&ce.jsx(iN,{contextRef:a,setIsMenuOpen:o,onClose:()=>o(!1),tableCellNode:s,cellMerge:t,showColorPickerModal:u})]})})}function Tw({anchorElem:c=document.body,cellMerge:t=!1}){const n=Vm();return so.createPortal(n?ce.jsx(sN,{anchorElem:c,cellMerge:t}):null,c)}const $D="",aN=33,lN=50;function cN({editor:c}){const t=ge.useRef(null),n=ge.useRef(null),e=ge.useRef(null),a=ge.useRef(null),[r,o]=ge.useState(null),[s,l]=ge.useState(null),[i,u]=ge.useState(!1),[d,p]=ge.useState(null);ge.useEffect(()=>c.registerCommand(yi,E=>{const w=jt(),y=ur(w);return i!==y&&u(y),!1},ts));const f=ge.useCallback(()=>{l(null),t.current=null,p(null),a.current=null,e.current=null},[]);ge.useEffect(()=>{const E=w=>{setTimeout(()=>{const y=w.target;if(d){o({x:w.clientX,y:w.clientY});return}if(!(n.current&&n.current.contains(y))&&t.current!==y){t.current=y;const S=Am(y);S&&s!==S?c.update(()=>{const C=po(S.elem);if(!C)return;const T=Pa(C),F=c.getElementByKey(T.getKey());if(!F){console.error("TableCellResizer: Table element not found.");return}t.current=y,e.current=F.getBoundingClientRect(),l(S)}):S==null&&f()}},0)};return document.addEventListener("mousemove",E),()=>{document.removeEventListener("mousemove",E)}},[s,d,c,f]);const h=E=>E==="bottom",m=ge.useCallback(E=>{if(!s){console.error("TableCellResizer: Expected active cell.");return}c.update(()=>{const w=po(s.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Pa(w),S=o1(w),C=y.getChildren();if(S>=C.length||S<0){console.error("Expected table cell to be inside of table row.");return}const T=C[S];if(!Mr(T)){console.error("Expected table row");return}T.setHeight(E)})},[s,c]),g=ge.useCallback(E=>{if(!s){console.error("TableCellResizer: Expected active cell.");return}c.update(()=>{const w=po(s.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Pa(w),S=Tm(w),C=y.getChildren();for(let T=0;T<C.length;T++){const F=C[T];if(!Mr(F)){console.error("Expected table row");return}const B=F.getChildren(),A=B.map(N=>N.getColSpan()).reduce((N,R)=>{const O=N[N.length-1]??0;return N.push(O+R),N},[]).findIndex(N=>N>S);if(A>=B.length||A<0){console.error("Expected table cell to be inside of table row.");return}const j=B[A];if(!vn(j)){console.error("Expected table cell");return}j.setWidth(E)}})},[s,c]),b=ge.useCallback(E=>{const w=y=>{if(y.preventDefault(),y.stopPropagation(),!s){console.error("TableCellResizer: Expected active cell.");return}if(a.current){const{x:S,y:C}=a.current;if(s===null)return;if(h(E)){const T=s.elem.getBoundingClientRect().height,F=Math.abs(y.clientY-C),B=E==="bottom"&&C>y.clientY;m(Math.max(B?T-F:F+T,aN))}else{const T=getComputedStyle(s.elem);let F=s.elem.clientWidth;F-=parseFloat(T.paddingLeft)+parseFloat(T.paddingRight);const B=Math.abs(y.clientX-S),M=E==="right"&&S>y.clientX;g(Math.max(M?F-B:B+F,lN))}f(),document.removeEventListener("mouseup",w)}};return w},[s,f,g,m]),v=ge.useCallback(E=>w=>{if(w.preventDefault(),w.stopPropagation(),!s){console.error("TableCellResizer: Expected active cell.");return}a.current={x:w.clientX,y:w.clientY},o(a.current),p(E),document.addEventListener("mouseup",b(E))},[s,b]),x=ge.useCallback(()=>{if(s){const{height:E,width:w,top:y,left:S}=s.elem.getBoundingClientRect(),C={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+S}px`,top:`${window.pageYOffset+y+E}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.pageXOffset+S+w}px`,top:`${window.pageYOffset+y}px`,width:"10px"}},T=e.current;return d&&r&&T&&(h(d)?(C[d].left=`${window.pageXOffset+T.left}px`,C[d].top=`${window.pageYOffset+r.y}px`,C[d].height="3px",C[d].width=`${T.width}px`):(C[d].top=`${window.pageYOffset+T.top}px`,C[d].left=`${window.pageXOffset+r.x}px`,C[d].width="3px",C[d].height=`${T.height}px`),C[d].backgroundColor="#adf"),C}return{bottom:null,left:null,right:null,top:null}},[s,d,r])();return ce.jsx("div",{ref:n,children:s!=null&&!i&&ce.jsxs(ce.Fragment,{children:[ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:x.right||void 0,onMouseDown:v("right")}),ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:x.bottom||void 0,onMouseDown:v("bottom")})]})})}function Ow({isEditable:c=!0}){const[t]=Sn();return ge.useMemo(()=>c?so.createPortal(ce.jsx(cN,{editor:t}),document.body):null,[t,c])}const Nw=ir.createContext(null),Aw=4;function _o({children:c,className:t,onClick:n,title:e}){const a=ge.useRef(null),r=ir.useContext(Nw);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=r;return ge.useEffect(()=>{a&&a.current&&o(a)},[a,o]),ce.jsx("button",{className:t,onClick:n,ref:a,title:e,type:"button",children:c})}function uN({children:c,dropDownRef:t,onClose:n}){const[e,a]=ge.useState(),[r,o]=ge.useState(),s=ge.useCallback(u=>{a(d=>d?[...d,u]:[u])},[a]),l=u=>{if(!e)return;const d=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(d)&&u.preventDefault(),d==="Escape"||d==="Tab"?n():d==="ArrowUp"?o(p=>{if(!p)return e[0];const f=e.indexOf(p)-1;return e[f===-1?e.length-1:f]}):d==="ArrowDown"&&o(p=>p?e[e.indexOf(p)+1]:e[0])},i=ge.useMemo(()=>({registerItem:s}),[s]);return ge.useEffect(()=>{e&&!r&&o(e[0]),r&&r.current&&r.current.focus()},[e,r]),ce.jsx(Nw.Provider,{value:i,children:ce.jsx("div",{className:"dropdown",ref:t,onKeyDown:l,children:c})})}function bd({disabled:c=!1,buttonLabel:t,buttonAriaLabel:n,buttonClassName:e,buttonIconClassName:a,children:r,stopCloseOnClickSelf:o}){const s=ge.useRef(null),l=ge.useRef(null),[i,u]=ge.useState(!1),d=()=>{u(!1),l&&l.current&&l.current.focus()};return ge.useEffect(()=>{const p=l.current,f=s.current;if(i&&p!==null&&f!==null){const{top:h,left:m}=p.getBoundingClientRect();f.style.top=`${h+p.offsetHeight+Aw}px`,f.style.left=`${Math.min(m,window.innerWidth-f.offsetWidth-20)}px`}},[s,l,i]),ge.useEffect(()=>{const p=l.current;if(p!==null&&i){const f=h=>{const m=h.target;o&&s.current&&s.current.contains(m)||p.contains(m)||u(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}}},[s,l,i,o]),ge.useEffect(()=>{const p=()=>{if(i){const f=l.current,h=s.current;if(f!==null&&h!==null){const{top:m}=f.getBoundingClientRect(),g=m+f.offsetHeight+Aw;g!==h.getBoundingClientRect().top&&(h.style.top=`${g}px`)}}};return document.addEventListener("scroll",p),()=>{document.removeEventListener("scroll",p)}},[l,s,i]),ce.jsxs(ce.Fragment,{children:[ce.jsxs("button",{type:"button",disabled:c,"aria-label":n||t,className:e,onClick:()=>u(!i),ref:l,children:[a&&ce.jsx("span",{className:a}),t&&ce.jsx("span",{className:"text dropdown-button-text",children:t}),ce.jsx("i",{className:"chevron-down"})]}),i&&so.createPortal(ce.jsx(uN,{dropDownRef:s,onClose:d,children:r}),document.body)]})}function Pw(c){const t=c.anchor,n=c.focus,e=c.anchor.getNode(),a=c.focus.getNode();return e===a?e:c.isBackward()?Gb(n)?e:a:Gb(t)?e:a}const Iw=8,Mw=72,Da={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},dN=({selectionFontSize:c,disabled:t,editor:n,blockType:e,styleConfig:a,isenterPressed:r,currentElementClick:o,currentElementSelect:s})=>{const[l,i]=ir.useState(c),[u,d]=ir.useState(e),[p,f]=ir.useState("");ir.useState([]),ir.useState("");const{heading:h}=a||{},m=x=>{x&&x.title&&n.update(()=>{if(n.isEditable()){const E=jt();E&&lm(E,x)}})},g=x=>{i(x.target.value)},b=()=>{const x=Number(l);if(!isNaN(x)){const E=Math.min(Math.max(x,Iw),Mw);i(String(E)),m({"font-size":`${E}px`})}},v=x=>{var w,y,S,C,T;f(x),n.update(()=>{const F=jt();Et(F)&&Kk(F,()=>Sl(x))});let E=null;if(h)switch(x){case"h1":E=((w=h.find(F=>F.title==="Heading1"))==null?void 0:w.fontSize)??56;break;case"h2":E=((y=h.find(F=>F.title==="Heading2"))==null?void 0:y.fontSize)??14;break;case"h3":E=((S=h.find(F=>F.title==="Heading3"))==null?void 0:S.fontSize)??12;break;case"h4":E=((C=h.find(F=>F.title==="Heading4"))==null?void 0:C.fontSize)??12;break;case"h5":E=((T=h.find(F=>F.title==="Heading5"))==null?void 0:T.fontSize)??12;break;case"paragraph":E=11;break;default:E=11}i(E),f(x),d(x)},_=()=>{i("11")};return ir.useEffect(()=>{_()},[r]),ir.useEffect(()=>{const x=()=>{n.update(()=>{const E=jt();if(E!==null){const y=E.getNodes()[0];if(!Wt(y)){const S=y.getType();S in Da&&d(S)}}})};return n.registerUpdateListener(x),()=>{n.registerUpdateListener(x)}},[n]),ir.useEffect(()=>{var x,E,w,y,S;switch(o.tagName){case"P":d("paragraph"),i("11");break;case"H1":d("h1");const C=((x=a.heading.find(L=>L.title==="Heading1"))==null?void 0:x.fontSize)??"16";i(C);break;case"H2":d("h2");const T=((E=a.heading.find(L=>L.title==="Heading2"))==null?void 0:E.fontSize)??"14";i(T);break;case"H3":d("h3");const F=((w=a.heading.find(L=>L.title==="Heading3"))==null?void 0:w.fontSize)??"12";i(F);break;case"H4":d("h4");const B=((y=a.heading.find(L=>L.title==="Heading4"))==null?void 0:y.fontSize)??"12";i(B);break;case"H5":d("h5");const M=((S=a.heading.find(L=>L.title==="Heading5"))==null?void 0:S.fontSize)??"12";i(M);break;default:d("paragraph"),i("11");break}},[o]),ir.useEffect(()=>{var E,w,y,S,C;if(!s){i("11"),d("paragraph");return}switch(s.trim()){case"P":i("11"),d("paragraph");break;case"h1":d("h1");const T=((E=a.heading.find(A=>A.title==="Heading1"))==null?void 0:E.fontSize)??"16";i(T);break;case"h2":d("h2");const F=((w=a.heading.find(A=>A.title==="Heading2"))==null?void 0:w.fontSize)??"14";i(F);break;case"h3":d("h3");const B=((y=a.heading.find(A=>A.title==="Heading3"))==null?void 0:y.fontSize)??"12";i(B);break;case"h4":d("h4");const M=((S=a.heading.find(A=>A.title==="Heading4"))==null?void 0:S.fontSize)??"12";i(M);break;case"h5":d("h5");const L=((C=a.heading.find(A=>A.title==="Heading5"))==null?void 0:C.fontSize)??"12";i(L);break;default:d("paragraph"),i("11");break}},[s]),ce.jsxs(ce.Fragment,{children:[a&&a.heading?ce.jsxs(bd,{disabled:t,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+u,buttonLabel:Da[u],children:[ce.jsxs(_o,{className:`item ${u==="paragraph"?"active":""}`,onClick:()=>v("paragraph"),children:[ce.jsx("i",{className:"icon paragraph"}),ce.jsx("span",{className:"text",children:Da.paragraph})]}),a.heading&&a.heading.find(x=>x.title==="Heading1")&&ce.jsxs(_o,{className:`item ${u==="h1"?"active":""}`,onClick:()=>v("h1"),children:[ce.jsx("i",{className:"icon h1"}),ce.jsx("span",{className:"text",children:Da.h1})]}),a.heading&&a.heading.find(x=>x.title==="Heading2")&&ce.jsxs(_o,{className:`item ${u==="h2"?"active":""}`,onClick:()=>v("h2"),children:[ce.jsx("i",{className:"icon h2"}),ce.jsx("span",{className:"text",children:Da.h2})]}),a.heading&&a.heading.find(x=>x.title==="Heading3")&&ce.jsxs(_o,{className:`item ${u==="h3"?"active":""}`,onClick:()=>v("h3"),children:[ce.jsx("i",{className:"icon h3"}),ce.jsx("span",{className:"text",children:Da.h3})]}),a.heading&&a.heading.find(x=>x.title==="Heading4")&&ce.jsxs(_o,{className:`item ${u==="h4"?"active":""}`,onClick:()=>v("h4"),children:[ce.jsx("i",{className:"icon h4"}),ce.jsx("span",{className:"text",children:Da.h4})]}),a.heading&&a.heading.find(x=>x.title==="Heading5")&&ce.jsxs(_o,{className:`item ${u==="h5"?"active":""}`,onClick:()=>v("h5"),children:[ce.jsx("i",{className:"icon h5"}),ce.jsx("span",{className:"text",children:Da.h5})]})]}):"",ce.jsx("input",{title:"Font Size",type:"number",value:l,disabled:t,readOnly:!0,className:"toolbar-item font-size-input input-font-size-value",min:Iw,max:Mw,onChange:g,onBlur:b})]})},fN=Cc&&"documentMode"in document?document.documentMode:null,Ra=Cc&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);Cc&&"InputEvent"in window&&!fN&&"getTargetRanges"in new window.InputEvent("input");const pN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMi41NTM1IDE2LjUwNjFDMTIuNDExNCAxNi42NjE1IDEyLjIxMDYgMTYuNzUgMTIgMTYuNzVDMTEuNzg5NCAxNi43NSAxMS41ODg2IDE2LjY2MTUgMTEuNDQ2NSAxNi41MDYxTDcuNDQ2NDggMTIuMTMxMUM3LjE2Njk4IDExLjgyNTQgNy4xODgyMiAxMS4zNTEgNy40OTM5MiAxMS4wNzE1QzcuNzk5NjMgMTAuNzkyIDguMjc0MDIgMTAuODEzMiA4LjU1MzUyIDExLjExODlMMTEuMjUgMTQuMDY4MlYzQzExLjI1IDIuNTg1NzkgMTEuNTg1OCAyLjI1IDEyIDIuMjVDMTIuNDE0MiAyLjI1IDEyLjc1IDIuNTg1NzkgMTIuNzUgM1YxNC4wNjgyTDE1LjQ0NjUgMTEuMTE4OUMxNS43MjYgMTAuODEzMiAxNi4yMDA0IDEwLjc5MiAxNi41MDYxIDExLjA3MTVDMTYuODExOCAxMS4zNTEgMTYuODMzIDExLjgyNTQgMTYuNTUzNSAxMi4xMzExTDEyLjU1MzUgMTYuNTA2MVoiIGZpbGw9IiMxQzI3NEMiLz4NCjxwYXRoIGQ9Ik0zLjc1IDE1QzMuNzUgMTQuNTg1OCAzLjQxNDIyIDE0LjI1IDMgMTQuMjVDMi41ODU3OSAxNC4yNSAyLjI1IDE0LjU4NTggMi4yNSAxNVYxNS4wNTQ5QzIuMjQ5OTggMTYuNDIyNSAyLjI0OTk2IDE3LjUyNDggMi4zNjY1MiAxOC4zOTE4QzIuNDg3NTQgMTkuMjkxOSAyLjc0NjQzIDIwLjA0OTcgMy4zNDgzNSAyMC42NTE2QzMuOTUwMjcgMjEuMjUzNiA0LjcwODE0IDIxLjUxMjUgNS42MDgyNSAyMS42MzM1QzYuNDc1MjIgMjEuNzUgNy41Nzc1NCAyMS43NSA4Ljk0NTEzIDIxLjc1SDE1LjA1NDlDMTYuNDIyNSAyMS43NSAxNy41MjQ4IDIxLjc1IDE4LjM5MTggMjEuNjMzNUMxOS4yOTE5IDIxLjUxMjUgMjAuMDQ5NyAyMS4yNTM2IDIwLjY1MTcgMjAuNjUxNkMyMS4yNTM2IDIwLjA0OTcgMjEuNTEyNSAxOS4yOTE5IDIxLjYzMzUgMTguMzkxOEMyMS43NSAxNy41MjQ4IDIxLjc1IDE2LjQyMjUgMjEuNzUgMTUuMDU0OVYxNUMyMS43NSAxNC41ODU4IDIxLjQxNDIgMTQuMjUgMjEgMTQuMjVDMjAuNTg1OCAxNC4yNSAyMC4yNSAxNC41ODU4IDIwLjI1IDE1QzIwLjI1IDE2LjQzNTQgMjAuMjQ4NCAxNy40MzY1IDIwLjE0NjkgMTguMTkxOUMyMC4wNDgyIDE4LjkyNTcgMTkuODY3OCAxOS4zMTQyIDE5LjU5MSAxOS41OTFDMTkuMzE0MiAxOS44Njc4IDE4LjkyNTcgMjAuMDQ4MiAxOC4xOTE5IDIwLjE0NjlDMTcuNDM2NSAyMC4yNDg0IDE2LjQzNTQgMjAuMjUgMTUgMjAuMjVIOUM3LjU2NDU5IDIwLjI1IDYuNTYzNDcgMjAuMjQ4NCA1LjgwODEyIDIwLjE0NjlDNS4wNzQzNSAyMC4wNDgyIDQuNjg1NzcgMTkuODY3OCA0LjQwOTAxIDE5LjU5MUM0LjEzMjI1IDE5LjMxNDIgMy45NTE4IDE4LjkyNTcgMy44NTMxNSAxOC4xOTE5QzMuNzUxNTkgMTcuNDM2NSAzLjc1IDE2LjQzNTQgMy43NSAxNVoiIGZpbGw9IiMxQzI3NEMiLz4NCjwvc3ZnPg==";var Dw={exports:{}};(function(c,t){(function(n,e){e()})(ma,function(){function n(i,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function e(i,u,d){var p=new XMLHttpRequest;p.open("GET",i),p.responseType="blob",p.onload=function(){l(p.response,u,d)},p.onerror=function(){console.error("could not download file")},p.send()}function a(i){var u=new XMLHttpRequest;u.open("HEAD",i,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(u)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ma=="object"&&ma.global===ma?ma:void 0,s=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!s?function(i,u,d){var p=o.URL||o.webkitURL,f=document.createElement("a");u=u||i.name||"download",f.download=u,f.rel="noopener",typeof i=="string"?(f.href=i,f.origin===location.origin?r(f):a(f.href)?e(i,u,d):r(f,f.target="_blank")):(f.href=p.createObjectURL(i),setTimeout(function(){p.revokeObjectURL(f.href)},4e4),setTimeout(function(){r(f)},0))}:"msSaveOrOpenBlob"in navigator?function(i,u,d){if(u=u||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(n(i,d),u);else if(a(i))e(i,u,d);else{var p=document.createElement("a");p.href=i,p.target="_blank",setTimeout(function(){r(p)})}}:function(i,u,d,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof i=="string")return e(i,u,d);var f=i.type==="application/octet-stream",h=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||f&&h||s)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var _=g.result;_=m?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=_:location=_,p=null},g.readAsDataURL(i)}else{var b=o.URL||o.webkitURL,v=b.createObjectURL(i);p?p.location=v:location.href=v,p=null,setTimeout(function(){b.revokeObjectURL(v)},4e4)}});o.saveAs=l.saveAs=l,c.exports=l})})(Dw);var hN=Dw.exports;function gN(c){const t=document.createElement("div");return t.innerHTML=c,t.querySelectorAll("*").forEach(e=>{let a="";if(e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){a+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=a.trim();const o=document.createElement("i");o.innerHTML=e.innerHTML,r.appendChild(o),e.innerHTML="",e.appendChild(r)}else if(e.classList.contains("PlaygroundEditorTheme__textBold")&&e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){a+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=a.trim();const o=document.createElement("i"),s=document.createElement("strong");s.innerHTML=e.innerHTML,o.appendChild(s),r.appendChild(o),e.innerHTML="",e.appendChild(r)}else{if(e.classList.contains("PlaygroundEditorTheme__textStrikethrough")&&(a+="text-decoration: line-through; "),e.classList.contains("PlaygroundEditorTheme__textUnderlineStrikethrough")&&(a+="text-decoration: line-through underline; "),e.classList.contains("PlaygroundEditorTheme__textBold")){const r=document.createElement("strong");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textItalic")){const r=document.createElement("i");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textUnderline")){const r=document.createElement("u");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(a){const r=document.createElement("span");r.style.cssText=a.trim(),r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}}}),t.innerHTML}function mN(c){const t=document.createElement("div");t.innerHTML=c;const n=t.querySelectorAll(".PlaygroundEditorTheme__table");return n.length===0?c:(n.forEach(e=>{e.style.width="100%",e.style.border="1px solid black",e.querySelectorAll("tr").forEach(r=>{r.style.border="1px solid black";const o=r.querySelectorAll("td, th"),l=100/o.length+"%";o.forEach(i=>{i.style.width=l,i.style.height="20px",i.style.border="1px solid black",i.innerHTML.trim()||(i.style.width=l,i.style.height="20px",i.innerHTML=" ");const u=i.querySelectorAll(".PlaygroundEditorTheme__textUnderline"),d=i.querySelectorAll(".PlaygroundEditorTheme__textStrikethrough");u.forEach(p=>{p.style.textDecoration="underline"}),d.forEach(p=>{p.style.textDecoration="line-through"}),i.classList.contains("PlaygroundEditorTheme__tableCellHeader")&&(i.style.fontWeight="bold")})})}),t.innerHTML)}function Rw(c){return c=c.replace(/<br\s*\/?>/g,""),c.includes("Crop")&&(c=c.replace(/Crop/g,"")),c}var Lw={exports:{}};/*!
|
|
55
55
|
* jQuery JavaScript Library v3.7.1
|
|
56
56
|
* https://jquery.com/
|
|
57
57
|
*
|