const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D6IAaLlq.js","assets/index-Csef3-wA.js","assets/ImageContext-NjyqLydw.js","assets/Icon-o1TUwOIX.js"])))=>i.map(i=>d[i]); var yd=Object.defineProperty;var Nd=(t,e,r)=>e in t?yd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Lt=(t,e,r)=>Nd(t,typeof e!="symbol"?e+"":e,r);import{m as Ql,g as E,G as he,fp as vd,r as A,as as xd,eM as Ed,_ as Td,j as $,I as H,ac as mi,w as Sd,aC as wd,aA as Od,aJ as $d,aN as es,fq as Md,af as ts,a4 as Rd,aE as Dd,bE as Xi,b as rs,H as Ad,K as kd,eA as Id,Z as Pd,R as Ld,b7 as bd,aG as zd,aD as Fd}from"./index-Csef3-wA.js";import{i as Bd}from"./Icon-o1TUwOIX.js";const wg=Ql((t,e,r)=>({root:{display:"flex",alignItems:"center",backgroundColor:E.white,border:`2px solid ${E.gray.normal}`,borderRadius:24,height:50,width:"100%",padding:"0px 13px",transition:he.transition("background-color, border-color"),[t.breakpoints.up("sm")]:{maxWidth:285},[`&:hover:not(.${r.disabled}):not(:hover)`]:{borderColor:E.gray.dark},[`&.${r.focus}`]:{borderColor:E.primary.blue},[`&.${r.disabled}`]:{backgroundColor:E.secondary.lightBlue},[`&.${r.error}`]:{borderColor:E.red}},inputText:{flex:1,border:0,padding:0,outline:0,height:20,minWidth:0,marginRight:12,paddingLeft:4,fontFamily:[vd,"sans-serif"].join(),fontSize:15,lineHeight:"21px",textTransform:"uppercase","&:disabled":{backgroundColor:E.secondary.lightBlue}},buttonColor:{flexShrink:0,width:24,height:24,fontSize:0,borderRadius:4,transition:he.transition(),"&:disabled":{cursor:"default"}},inputColor:{width:0,padding:0,border:0,position:"absolute",opacity:0},focus:{},disabled:{},error:{}}),{name:"InputColor"}),Og=Ql((t,e,r)=>({root:{display:"flex"},wrapper:{width:"100%",[`& > .${r.labelWrapper}`]:{marginBottom:10}},label:{color:E.gray.darkest,fontSize:13,lineHeight:"18px",fontWeight:600},avatarLabel:{marginBottom:10},labelWrapper:{display:"flex",alignItems:"center"},simpleImageLabel:{color:E.gray.darkest,fontSize:13,fontWeight:600,marginBottom:10},hintIcon:{marginLeft:3,color:E.gray.darkest,cursor:"pointer",transition:he.transition(),[t.breakpoints.up("md")]:{"&:hover":{color:E.black}},"&.openHint":{color:E.black}},container:{display:"flex",alignItems:"center","&.dropdownArea":{alignItems:"stretch",flexDirection:"column"}},fileWrapper:n=>({backgroundColor:E.white,color:E.gray.dark,cursor:"pointer",border:"2px solid",borderColor:"currentColor",borderRadius:8,width:80,height:80/((n==null?void 0:n.aspectRatio)||1),padding:8,outline:0,position:"relative",transition:he.transition("all"),...n!=null&&n.aspectRatio&&(n==null?void 0:n.aspectRatio)!==1?{padding:0,...he.centerFlex}:{},"&.dragActive, &:active":{color:`${E.black} !important`,[`& .${r.icon}`]:{backgroundColor:E.gray.dark}},"&:not(.disabled):hover, &:not(.disabled):focus":{color:E.gray.darkest,[`& .${r.icon}`]:{backgroundColor:E.gray.darkest}},"&.disabled":{cursor:"not-allowed",backgroundColor:E.secondary.lightBlue,[`& .${r.icon}`]:{backgroundColor:E.gray.dark}},"&.dropdownArea":{height:150,width:"100%",padding:14,fontWeight:600,borderStyle:"dashed",...he.centerFlexC,[t.breakpoints.only("xs")]:{height:"auto",paddingTop:28,paddingBottom:28},"& button":{[t.breakpoints.down("md")]:{width:"100%",maxWidth:200}},"& > p":{fontSize:13,lineHeight:"18px",color:E.gray.dark,"&.top":{marginBottom:16,fontWeight:600},"&.bottom":{marginTop:16,color:E.black,[t.breakpoints.down("md")]:{marginTop:24}}}},"&.large":{width:158,[`& .${r.fileContainer}`]:{width:138}},"&.error":{borderColor:E.red}}),large:{},error:{},fileContainer:n=>({borderRadius:4,width:60,height:60/((n==null?void 0:n.aspectRatio)||1),overflow:"hidden",...he.centerFlex,"& > img":{maxHeight:"100%",maxWidth:"100%"}}),fileEmpty:{backgroundColor:E.secondary.lightBlue,height:"100%",width:"100%",...he.centerFlex},icon:{backgroundColor:E.black,color:E.white,borderRadius:"100%",height:40,position:"absolute",right:-8,top:-8,transition:he.transition("background-color"),width:40,zIndex:8,...he.centerFlex},iconDisabled:{backgroundColor:E.gray.dark},previewDeleteButton:{width:200,[t.breakpoints.down("md")]:{width:144}},previewButton:{width:200,[t.breakpoints.down("md")]:{width:144}},previewDropdownArea:{alignItems:"center",borderRadius:8,backgroundColor:E.secondary.lightBlue,display:"flex",flex:1,justifyContent:"space-between",padding:"21px 34px 21px 26px",width:"100%",position:"relative",[t.breakpoints.only("xs")]:{flexDirection:"column"},"& > *":{zIndex:1}},previewDropdownProgress:{position:"absolute",left:0,top:0,bottom:0,zIndex:0,backgroundColor:he.opacity(E.primary.blue,.25),transition:he.transition()},previewDropdownAreaLeft:{alignItems:"center",display:"flex",[t.breakpoints.only("xs")]:{flexDirection:"column",alignItems:"center"}},previewDropdownAreaIcon:{...he.centerFlex,backgroundColor:E.gray.darkest,borderRadius:"100%",flexShrink:0,height:80,marginRight:20,width:80,[t.breakpoints.only("xs")]:{marginRight:0},"& > svg":{height:80,width:80}},previewDropdownAreaData:{fontWeight:500},previewDropdownAreaDataName:{color:E.black,fontSize:16,fontWeight:600,lineHeight:"22px",wordBreak:"break-all",marginRight:20,display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",[t.breakpoints.only("xs")]:{marginRight:0,marginTop:20,textAlign:"center",fontSize:15}},previewDropdownAreaDataSize:{marginTop:8,color:E.gray.dark,fontSize:13,fontWeight:600,lineHeight:"18px",[t.breakpoints.only("xs")]:{marginTop:4,marginBottom:20}},previewDropdownAreaButton:{minWidth:160,textTransform:"lowercase",borderColor:E.gray.dark,color:E.black,"&:hover":{borderColor:E.gray.darkest,"@media (hover: none)":{borderColor:E.dark}},"&:active":{color:E.black,borderColor:E.black}},previewGroup:{marginTop:16},previewGroupItem:{display:"flex",alignItems:"center",padding:10,backgroundColor:E.white,border:`2px solid ${E.gray.normal}`,borderRadius:0,marginBottom:8,[t.breakpoints.only("xs")]:{padding:8},"&:last-child":{marginBottom:0},"&.error":{borderColor:E.red}},previewGroupItemImage:{flexShrink:0,backgroundColor:E.white,border:`2px solid ${E.gray.normal}`,borderRadius:8,height:64,padding:6,width:64,marginRight:16,[t.breakpoints.only("xs")]:{width:48,height:48,padding:3}},previewGroupItemImageContainer:{borderRadius:4,height:48,width:48,overflow:"hidden",...he.centerFlex,[t.breakpoints.only("xs")]:{width:38,height:38},"& > img":{maxHeight:"100%",maxWidth:"100%"}},previewGroupItemData:{flex:1,overflow:"hidden","& p":{fontWeight:500,"&.name":{color:E.black,fontSize:15,lineHeight:"21px",fontWeight:600,textOverflow:"ellipsis",overflow:"hidden",[t.breakpoints.only("xs")]:{fontSize:13}},"&.size":{marginTop:8,color:E.gray.dark,fontSize:12,fontWeight:600,lineHeight:"17px",[t.breakpoints.only("xs")]:{fontSize:11,lineHeight:"15px",marginTop:0}}}},previewGroupItemDelete:{flexShrink:0,outline:0,height:48,width:48,color:E.red},previewGroupItemSort:{flexShrink:0,outline:0,height:48,width:48,color:E.gray.normal},controls:{flex:1,marginLeft:32,display:"flex",justifyContent:"space-between",[t.breakpoints.only("xs")]:{marginLeft:20,flexDirection:"column",justifyContent:"center","& button + button":{marginTop:10}}},messageError:{color:E.red,margin:0,fontSize:"0.75rem",marginTop:3,lineHeight:1.66},circularProgressRoot:{height:30,top:0,bottom:0},disabled:{},dropdownArea:{},dragActive:{}}),"FormikFields-File");var Kd={},Dn={},ns=A;function Wd(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let is=ns.createContext(null);Dn.LexicalComposerContext=is;Dn.createLexicalComposerContext=function(t,e){let r=null;return t!=null&&(r=t[1]),{getTheme:function(){return e??(r!=null?r.getTheme():null)}}};Dn.useLexicalComposerContext=function(){let t=ns.useContext(is);return t==null&&Wd(8),t};const Hd=Dn;var oe=Hd,Yd=oe,Er=A,Gd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Er.useLayoutEffect:Er.useEffect;function Ud(t){let[e]=Yd.useLexicalComposerContext(),r=Er.useMemo(()=>t(e),[e,t]),n=Er.useRef(r.initialValueFn()),[i,o]=Er.useState(n.current);return Gd(()=>{let{initialValueFn:l,subscribe:s}=r,a=l();return n.current!==a&&(n.current=a,o(a)),s(d=>{n.current=d,o(d)})},[r,t]),i}function Vd(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}var jd=function(){return Ud(Vd)};const Jd=jd;var os=Jd;const $g=xd(os);var Ct={},C={};let An={},ls={},Qt={},Tr={},Ci={},er={},Zi={},yi={},Ar={},kr={},ut={},qi={},Qi={},ss={},as={},ds={},us={},cs={},hs={},gs={},pn={},fs={},ps={},_s={},ms={},Cs={},ys={},Ns={},vs={},xs={},eo={},to={},Ni={},Es={},Ts={},Ss={};function T(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Ge=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xd=Ge&&"documentMode"in document?document.documentMode:null,ue=Ge&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),gt=Ge&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_n=Ge&&"InputEvent"in window&&!Xd?"getTargetRanges"in new window.InputEvent("input"):!1,ro=Ge&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),kn=Ge&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Zd=Ge&&/Android/.test(navigator.userAgent),qd=Ge&&/^(?=.*Chrome).*/i.test(navigator.userAgent),no=Ge&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!qd,In=ro||kn||no?" ":"​",Qd=gt?" ":In,eu=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,tu=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,ht={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},ru={directionless:1,unmergeable:2},Jo={center:2,end:6,justify:4,left:1,right:3,start:5},nu={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},iu={normal:0,segmented:2,token:1},ou={0:"normal",2:"segmented",1:"token"},vi=!1,io=0;function lu(t){io=t.timeStamp}function ri(t,e,r){return e.__lexicalLineBreak===t||t[`__lexicalKey_${r._key}`]!==void 0}function su(t){return t.getEditorState().read(()=>{let e=B();return e!==null?e.clone():null})}function ws(t,e,r){vi=!0;let n=100<performance.now()-io;try{Me(t,()=>{let i=B()||su(t);var o=new Map,l=t.getRootElement(),s=t._editorState,a=t._blockCursorElement;let d=!1,u="";for(var h=0;h<e.length;h++){var c=e[h],g=c.type,f=c.target,p=Kr(f,s);if(!(p===null&&f!==l||J(p))){if(g==="characterData"){if(c=n&&S(p))e:{c=i,g=f;var y=p;if(D(c)){var v=c.anchor.getNode();if(v.is(y)&&c.format!==v.getFormat()){c=!1;break e}}c=g.nodeType===3&&y.isAttached()}c&&(y=Ue(t._window),g=c=null,y!==null&&y.anchorNode===f&&(c=y.anchorOffset,g=y.focusOffset),f=f.nodeValue,f!==null&&uo(p,f,c,g,!1))}else if(g==="childList"){for(d=!0,g=c.addedNodes,y=0;y<g.length;y++){v=g[y];var M=As(v),R=v.parentNode;R==null||v===a||M!==null||v.nodeName==="BR"&&ri(v,R,t)||(gt&&(M=v.innerText||v.nodeValue)&&(u+=M),R.removeChild(v))}if(c=c.removedNodes,g=c.length,0<g){for(y=0,v=0;v<g;v++)R=c[v],(R.nodeName==="BR"&&ri(R,f,t)||a===R)&&(f.appendChild(R),y++);g!==y&&(f===l&&(p=s._nodeMap.get("root")),o.set(f,p))}}}}if(0<o.size)for(let[b,re]of o)if(N(re))for(o=re.getChildrenKeys(),l=b.firstChild,s=0;s<o.length;s++)a=t.getElementByKey(o[s]),a!==null&&(l==null?(b.appendChild(a),l=a):l!==a&&b.replaceChild(a,l),l=l.nextSibling);else S(re)&&re.markDirty();if(o=r.takeRecords(),0<o.length){for(l=0;l<o.length;l++)for(a=o[l],s=a.addedNodes,a=a.target,h=0;h<s.length;h++)p=s[h],f=p.parentNode,f==null||p.nodeName!=="BR"||ri(p,a,t)||f.removeChild(p);r.takeRecords()}i!==null&&(d&&(i.dirty=!0,Ye(i)),gt&&Ls(t)&&i.insertRawText(u))})}finally{vi=!1}}function Os(t){let e=t._observer;if(e!==null){let r=e.takeRecords();ws(t,r,e)}}function $s(t){io===0&&Ln(t).addEventListener("textInput",lu,!0),t._observer=new MutationObserver((e,r)=>{ws(t,e,r)})}function Xo(t,e){let r=t.__mode,n=t.__format;t=t.__style;let i=e.__mode,o=e.__format;return e=e.__style,(r===null||r===i)&&(n===null||n===o)&&(t===null||t===e)}function Zo(t,e){let r=t.mergeWithSibling(e),n=j()._normalizedNodes;return n.add(t.__key),n.add(e.__key),r}function Ms(t){if(t.__text===""&&t.isSimpleText()&&!t.isUnmergeable())t.remove();else{for(var e;(e=t.getPreviousSibling())!==null&&S(e)&&e.isSimpleText()&&!e.isUnmergeable();)if(e.__text==="")e.remove();else{Xo(e,t)&&(t=Zo(e,t));break}for(var r;(r=t.getNextSibling())!==null&&S(r)&&r.isSimpleText()&&!r.isUnmergeable();)if(r.__text==="")r.remove();else{Xo(t,r)&&Zo(t,r);break}}}function Rs(t){return qo(t.anchor),qo(t.focus),t}function qo(t){for(;t.type==="element";){var e=t.getNode(),r=t.offset;if(r===e.getChildrenSize()?(e=e.getChildAtIndex(r-1),r=!0):(e=e.getChildAtIndex(r),r=!1),S(e)){t.set(e.__key,r?e.getTextContentSize():0,"text");break}else if(!N(e))break;t.set(e.__key,r?e.getChildrenSize():0,"element")}}let au=1,du=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function oo(t){let e=document.activeElement;if(e===null)return!1;let r=e.nodeName;return J(Kr(t))&&(r==="INPUT"||r==="TEXTAREA"||e.contentEditable==="true"&&e.__lexicalEditor==null)}function Br(t,e,r){let n=t.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(r)&&e!==null&&!oo(e)&&lo(e)===t}catch{return!1}}function lo(t){for(;t!=null;){let e=t.__lexicalEditor;if(e!=null)return e;t=Pn(t)}return null}function xi(t){return t.isToken()||t.isSegmented()}function mn(t){for(;t!=null;){if(t.nodeType===3)return t;t=t.firstChild}return null}function Ei(t,e,r){let n=ht[e];return r!==null&&(t&n)===(r&n)||(t^=n,e==="subscript"?t&=~ht.superscript:e==="superscript"&&(t&=~ht.subscript)),t}function Ds(t,e){if(e!=null)t.__key=e;else{Ne(),99<br&&T(14),e=j();var r=Ve(),n=""+au++;r._nodeMap.set(n,t),N(t)?e._dirtyElements.set(n,!0):e._dirtyLeaves.add(n),e._cloneNotNeeded.add(n),e._dirtyType=1,t.__key=n}}function wt(t){var e=t.getParent();if(e!==null){let i=t.getWritable();e=e.getWritable();var r=t.getPreviousSibling();if(t=t.getNextSibling(),r===null)if(t!==null){var n=t.getWritable();e.__first=t.__key,n.__prev=null}else e.__first=null;else{if(n=r.getWritable(),t!==null){let o=t.getWritable();o.__prev=n.__key,n.__next=o.__key}else n.__next=null;i.__prev=null}t===null?r!==null?(t=r.getWritable(),e.__last=r.__key,t.__next=null):e.__last=null:(t=t.getWritable(),r!==null?(r=r.getWritable(),r.__next=t.__key,t.__prev=r.__key):t.__prev=null,i.__next=null),e.__size--,i.__parent=null}}function Cn(t){99<br&&T(14);var e=t.getLatest(),r=e.__parent,n=Ve();let i=j(),o=n._nodeMap;if(n=i._dirtyElements,r!==null)e:for(;r!==null;){if(n.has(r))break e;let l=o.get(r);if(l===void 0)break;n.set(r,!1),r=l.__parent}e=e.__key,i._dirtyType=1,N(t)?n.set(e,!0):i._dirtyLeaves.add(e)}function te(t){Ne();var e=j();let r=e._compositionKey;t!==r&&(e._compositionKey=t,r!==null&&(e=ge(r),e!==null&&e.getWritable()),t!==null&&(t=ge(t),t!==null&&t.getWritable()))}function ct(){return ar()?null:j()._compositionKey}function ge(t,e){return t=(e||Ve())._nodeMap.get(t),t===void 0?null:t}function As(t,e){let r=j();return t=t[`__lexicalKey_${r._key}`],t!==void 0?ge(t,e):null}function Kr(t,e){for(;t!=null;){let r=As(t,e);if(r!==null)return r;t=Pn(t)}return null}function ks(t){let e=Object.assign({},t._decorators);return t._pendingDecorators=e}function Qo(t){return t.read(()=>Te().getTextContent())}function uu(t,e){Me(t,()=>{var r=Ve();if(!r.isEmpty())if(e==="root")Te().markDirty();else{r=r._nodeMap;for(let[,n]of r)n.markDirty()}},t._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Te(){return Ve()._nodeMap.get("root")}function Ye(t){Ne();let e=Ve();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Vt(t){var e=j(),r;e:{for(r=t;r!=null;){let n=r[`__lexicalKey_${e._key}`];if(n!==void 0){r=n;break e}r=Pn(r)}r=null}return r===null?(e=e.getRootElement(),t===e?ge("root"):null):ge(r)}function Is(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function so(t){let e=[];for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Ps(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function ao(t,e,r){if(e=Ue(e._window),e!==null){var n=e.anchorNode,{anchorOffset:i,focusOffset:o}=e;if(n!==null&&(e=n.nodeType===3?n.nodeValue:null,n=Kr(n),e!==null&&S(n))){if(e===In&&r){let l=r.length;e=r,o=i=l}e!==null&&uo(n,e,i,o,t)}}}function uo(t,e,r,n,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){let d=o.isComposing(),u=e;if((d||i)&&e[e.length-1]===In&&(u=e.slice(0,-1)),e=o.getTextContent(),i||u!==e)if(u==="")if(te(null),ro||kn||no)o.remove();else{let h=j();setTimeout(()=>{h.update(()=>{o.isAttached()&&o.remove()})},20)}else{i=o.getParent(),e=sr();var l=o.getTextContentSize(),s=ct(),a=o.getKey();o.isToken()||s!==null&&a===s&&!d||D(e)&&(i!==null&&!i.canInsertTextBefore()&&e.anchor.offset===0||e.anchor.key===t.__key&&e.anchor.offset===0&&!o.canInsertTextBefore()&&!d||e.focus.key===t.__key&&e.focus.offset===l&&!o.canInsertTextAfter()&&!d)?o.markDirty():(t=B(),D(t)&&r!==null&&n!==null&&(t.setTextNodeRange(o,r,o,n),o.isSegmented()&&(r=o.getTextContent(),r=de(r),o.replace(r),o=r)),o.setTextContent(u))}}}function cu(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;t=t.anchor.offset;let r=e.getParentOrThrow(),n=e.isToken();return t===0?((t=!e.canInsertTextBefore()||!r.canInsertTextBefore()||n)||(e=e.getPreviousSibling(),t=(S(e)||N(e)&&e.isInline())&&!e.canInsertTextAfter()),t):t===e.getTextContentSize()?!e.canInsertTextAfter()||!r.canInsertTextAfter()||n:!1}function Sr(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let r=t.__lexicalClassNameCache,n=r[e];return n!==void 0?n:(t=t[e],typeof t=="string"?(t=t.split(" "),r[e]=t):t)}function co(t,e,r,n,i){r.size!==0&&(r=n.__type,n=n.__key,e=e.get(r),e===void 0&&T(33,r),r=e.klass,e=t.get(r),e===void 0&&(e=new Map,t.set(r,e)),t=e.get(n),r=t==="destroyed"&&i==="created",(t===void 0||r)&&e.set(n,r?"updated":i))}function el(t,e,r){let n=t.getParent(),i=r;return n!==null&&(e&&r===0?(i=t.getIndexWithinParent(),t=n):e||r!==t.getChildrenSize()||(i=t.getIndexWithinParent()+1,t=n)),t.getChildAtIndex(e?i-1:i)}function Ti(t,e){var r=t.offset;return t.type==="element"?(t=t.getNode(),el(t,e,r)):(t=t.getNode(),e&&r===0||!e&&r===t.getTextContentSize()?(r=e?t.getPreviousSibling():t.getNextSibling(),r===null?el(t.getParentOrThrow(),e,t.getIndexWithinParent()+(e?0:1)):r):null)}function Ls(t){return t=(t=Ln(t).event)&&t.inputType,t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function yn(t){return!Oe(t)&&!t.isLastChild()&&!t.isInline()}function Nn(t,e){return t=t._keyToDOMMap.get(e),t===void 0&&T(75,e),t}function Pn(t){return t=t.assignedSlot||t.parentElement,t!==null&&t.nodeType===11?t.host:t}function vn(t,e){for(t=t.getParent();t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Ln(t){return t=t._window,t===null&&T(78),t}function bs(t){for(t=t.getParentOrThrow();t!==null&&!ft(t);)t=t.getParentOrThrow();return t}function ft(t){return Oe(t)||N(t)&&t.isShadowRoot()}function zs(t){return t=t.constructor.clone(t),Ds(t,null),t}function Wr(t){var e=j();let r=t.constructor.getType();return e=e._nodes.get(r),e===void 0&&T(97),e=e.replace,e!==null?(e=e(t),e instanceof t.constructor||T(98),e):t}function ni(t,e){t=t.getParent(),!Oe(t)||N(e)||J(e)||T(99)}function ii(t){return(J(t)||N(t)&&!t.canBeEmpty())&&!t.isInline()}function Si(t,e,r){r.style.removeProperty("caret-color"),e._blockCursorElement=null,e=t.parentElement,e!==null&&e.removeChild(t)}function Ue(t){return Ge?(t||window).getSelection():null}function tl(t,e){for(;t!==Te()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}function bn(t){return t.nodeType===1}function Wt(t){if(J(t)&&!t.isInline())return!0;if(!N(t)||ft(t))return!1;var e=t.getFirstChild();return e=e===null||Mt(e)||S(e)||e.isInline(),!t.isInline()&&t.canBeEmpty()!==!1&&e}function oi(t,e){for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Fs(t,e,r,n,i,o){for(t=t.getFirstChild();t!==null;){let l=t.__key;t.__parent===e&&(N(t)&&Fs(t,l,r,n,i,o),r.has(l)||o.delete(l),i.push(l)),t=t.getNextSibling()}}function hu(t,e,r,n){t=t._nodeMap,e=e._nodeMap;let i=[];for(let[o]of n){let l=e.get(o);l===void 0||l.isAttached()||(N(l)&&Fs(l,o,t,e,i,n),t.has(o)||n.delete(o),i.push(o))}for(let o of i)e.delete(o);for(let o of r)n=e.get(o),n===void 0||n.isAttached()||(t.has(o)||r.delete(o),e.delete(o))}let ee="",ye="",Qe="",pt,fe,Ir,Bs=!1,ho=!1,zn,cn=null,wi,Oi,$t,_t,$i,Pr;function hn(t,e){let r=$t.get(t);if(e!==null){let n=Di(t);n.parentNode===e&&e.removeChild(n)}_t.has(t)||fe._keyToDOMMap.delete(t),N(r)&&(t=xn(r,$t),Mi(t,0,t.length-1,null)),r!==void 0&&co(Pr,Ir,zn,r,"destroyed")}function Mi(t,e,r,n){for(;e<=r;++e){let i=t[e];i!==void 0&&hn(i,n)}}function Tt(t,e){t.setProperty("text-align",e)}function Ks(t,e){var r=pt.theme.indent;if(typeof r=="string"){let n=t.classList.contains(r);0<e&&!n?t.classList.add(r):1>e&&n&&t.classList.remove(r)}r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||"40px",t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Ws(t,e){t=t.style,e===0?Tt(t,""):e===1?Tt(t,"left"):e===2?Tt(t,"center"):e===3?Tt(t,"right"):e===4?Tt(t,"justify"):e===5?Tt(t,"start"):e===6&&Tt(t,"end")}function gn(t,e,r){let n=_t.get(t);n===void 0&&T(60);let i=n.createDOM(pt,fe);var o=fe._keyToDOMMap;if(i["__lexicalKey_"+fe._key]=t,o.set(t,i),S(n)?i.setAttribute("data-lexical-text","true"):J(n)&&i.setAttribute("data-lexical-decorator","true"),N(n)){if(t=n.__indent,o=n.__size,t!==0&&Ks(i,t),o!==0){--o,t=xn(n,_t);var l=ye;ye="",Ri(t,n,0,o,i,null),Ys(n,i),ye=l}t=n.__format,t!==0&&Ws(i,t),n.isInline()||Hs(null,n,i),yn(n)&&(ee+=` `,Qe+=` `)}else o=n.getTextContent(),J(n)?(l=n.decorate(fe,pt),l!==null&&Gs(t,l),i.contentEditable="false"):S(n)&&(n.isDirectionless()||(ye+=o)),ee+=o,Qe+=o;return e!==null&&(r!=null?e.insertBefore(i,r):(r=e.__lexicalLineBreak,r!=null?e.insertBefore(i,r):e.appendChild(i))),co(Pr,Ir,zn,n,"created"),i}function Ri(t,e,r,n,i,o){let l=ee;for(ee="";r<=n;++r)gn(t[r],i,o);yn(e)&&(ee+=` `),i.__lexicalTextContent=ee,ee=l+ee}function rl(t,e){return t=e.get(t),Mt(t)||J(t)&&t.isInline()}function Hs(t,e,r){t=t!==null&&(t.__size===0||rl(t.__last,$t)),e=e.__size===0||rl(e.__last,_t),t?e||(e=r.__lexicalLineBreak,e!=null&&r.removeChild(e),r.__lexicalLineBreak=null):e&&(e=document.createElement("br"),r.__lexicalLineBreak=e,r.appendChild(e))}function Ys(t,e){var r=e.__lexicalDir;if(e.__lexicalDirTextContent!==ye||r!==cn){let o=ye==="";if(o)var n=cn;else n=ye,n=eu.test(n)?"rtl":tu.test(n)?"ltr":null;if(n!==r){let l=e.classList,s=pt.theme;var i=r!==null?s[r]:void 0;let a=n!==null?s[n]:void 0;i!==void 0&&(typeof i=="string"&&(i=i.split(" "),i=s[r]=i),l.remove(...i)),n===null||o&&n==="ltr"?e.removeAttribute("dir"):(a!==void 0&&(typeof a=="string"&&(r=a.split(" "),a=s[n]=r),a!==void 0&&l.add(...a)),e.dir=n),ho||(t.getWritable().__dir=n)}cn=n,e.__lexicalDirTextContent=ye,e.__lexicalDir=n}}function xn(t,e){let r=[];for(t=t.__first;t!==null;){let n=e.get(t);n===void 0&&T(101),r.push(t),t=n.__next}return r}function _r(t,e){var r=$t.get(t),n=_t.get(t);r!==void 0&&n!==void 0||T(61);var i=Bs||Oi.has(t)||wi.has(t);let o=Nn(fe,t);if(r===n&&!i)return N(r)?(n=o.__lexicalTextContent,n!==void 0&&(ee+=n,Qe+=n),n=o.__lexicalDirTextContent,n!==void 0&&(ye+=n)):(n=r.getTextContent(),S(r)&&!r.isDirectionless()&&(ye+=n),Qe+=n,ee+=n),o;if(r!==n&&i&&co(Pr,Ir,zn,n,"updated"),n.updateDOM(r,o,pt))return n=gn(t,null,null),e===null&&T(62),e.replaceChild(n,o),hn(t,null),n;if(N(r)&&N(n)){if(t=n.__indent,t!==r.__indent&&Ks(o,t),t=n.__format,t!==r.__format&&Ws(o,t),i){t=ye,ye="",i=ee;var l=r.__size,s=n.__size;if(ee="",l===1&&s===1){var a=r.__first;if(e=n.__first,a===e)_r(a,o);else{var d=Di(a);e=gn(e,null,null),o.replaceChild(e,d),hn(a,null)}}else{e=xn(r,$t);var u=xn(n,_t);if(l===0)s!==0&&Ri(u,n,0,s-1,o,null);else if(s===0)l!==0&&(a=o.__lexicalLineBreak==null,Mi(e,0,l-1,a?null:o),a&&(o.textContent=""));else{var h=e;e=u,u=l-1,l=s-1;let g=o.firstChild,f=0;for(s=0;f<=u&&s<=l;){var c=h[f];let p=e[s];if(c===p)g=li(_r(p,o)),f++,s++;else{a===void 0&&(a=new Set(h)),d===void 0&&(d=new Set(e));let y=d.has(c),v=a.has(p);y?(v?(c=Nn(fe,p),c===g?g=li(_r(p,o)):(g!=null?o.insertBefore(c,g):o.appendChild(c),_r(p,o)),f++):gn(p,o,g),s++):(g=li(Di(c)),hn(c,o),f++)}}a=f>u,d=s>l,a&&!d?(a=e[l+1],a=a===void 0?null:fe.getElementByKey(a),Ri(e,n,s,l,o,a)):d&&!a&&Mi(h,f,u,o)}}yn(n)&&(ee+=` `),o.__lexicalTextContent=ee,ee=i+ee,Ys(n,o),ye=t,Oe(n)||n.isInline()||Hs(r,n,o)}yn(n)&&(ee+=` `,Qe+=` `)}else r=n.getTextContent(),J(n)?(i=n.decorate(fe,pt),i!==null&&Gs(t,i)):S(n)&&!n.isDirectionless()&&(ye+=r),ee+=r,Qe+=r;return!ho&&Oe(n)&&n.__cachedText!==Qe&&(n.getWritable().__cachedText=Qe),o}function Gs(t,e){let r=fe._pendingDecorators,n=fe._decorators;if(r===null){if(n[t]===e)return;r=ks(fe)}r[t]=e}function li(t){return t=t.nextSibling,t!==null&&t===fe._blockCursorElement&&(t=t.nextSibling),t}function Di(t){let e=$i.get(t);return e===void 0&&T(75,t),e}let Ze=Object.freeze({}),Ai=[["keydown",Nu],["pointerdown",fu],["compositionstart",Cu],["compositionend",yu],["input",mu],["click",gu],["cut",Ze],["copy",Ze],["dragstart",Ze],["dragover",Ze],["dragend",Ze],["paste",Ze],["focus",Ze],["blur",Ze],["drop",Ze]];_n&&Ai.push(["beforeinput",(t,e)=>_u(t,e)]);let Lr=0,Us=0,Vs=0,Ht=null,wr=0,ki=!1,Ii=!1,Or=!1,mr=!1,js=[0,"",0,"root",0];function Js(t,e,r,n,i){let o=t.anchor,l=t.focus,s=o.getNode();var a=j();let d=Ue(a._window),u=d!==null?d.anchorNode:null,h=o.key;a=a.getElementByKey(h);let c=r.length;return h!==l.key||!S(s)||(!i&&(!_n||Vs<n+50)||s.isDirty()&&2>c||Is(r))&&o.offset!==l.offset&&!s.isComposing()||xi(s)||s.isDirty()&&1<c||(i||!_n)&&a!==null&&!s.isComposing()&&u!==mn(a)||d!==null&&e!==null&&(!e.collapsed||e.startContainer!==d.anchorNode||e.startOffset!==d.anchorOffset)||s.getFormat()!==t.format||s.getStyle()!==t.style||cu(t,s)}function nl(t,e){return t!==null&&t.nodeValue!==null&&t.nodeType===3&&e!==0&&e!==t.nodeValue.length}function il(t,e,r){let{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:l}=t;ki&&(ki=!1,nl(n,i)&&nl(o,l))||Me(e,()=>{if(!r)Ye(null);else if(Br(e,n,o)){var s=B();if(D(s)){var a=s.anchor,d=a.getNode();if(s.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(s.dirty=!0);var u=Ln(e).event;u=u?u.timeStamp:performance.now();let[c,g,f,p,y]=js;var h=Te();if(h=e.isComposing()===!1&&h.getTextContent()==="",u<y+200&&a.offset===f&&a.key===p)s.format=c,s.style=g;else if(a.type==="text"){if(!S(d))throw Error("Point.getNode() must return TextNode when type is text");s.format=d.getFormat(),s.style=d.getStyle()}else a.type!=="element"||h||(s.format=0,s.style="")}else{a=255,d=!1,u=s.getNodes(),h=u.length;for(let c=0;c<h;c++){let g=u[c];if(S(g)&&(d=!0,a&=g.getFormat(),a===0))break}s.format=d?a:0}}x(e,An,void 0)}})}function gu(t,e){Me(e,()=>{let r=B();var n=Ue(e._window);let i=sr();if(n)if(D(r)){let l=r.anchor;var o=l.getNode();l.type==="element"&&l.offset===0&&r.isCollapsed()&&!Oe(o)&&Te().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&r.is(i)?(n.removeAllRanges(),r.dirty=!0):t.detail!==3||r.isCollapsed()||(n=r.focus.getNode(),o!==n&&(N(o)?o.select(0):o.getParentOrThrow().select(0)))}else t.pointerType==="touch"&&(o=n.anchorNode,o!==null&&(o=o.nodeType,o===1||o===3))&&(n=po(i,n,e,t),Ye(n));x(e,ls,t)})}function fu(t,e){let r=t.target;t=t.pointerType,r instanceof Node&&t!=="touch"&&Me(e,()=>{J(Kr(r))||(Ii=!0)})}function Xs(t){return t.getTargetRanges?(t=t.getTargetRanges(),t.length===0?null:t[0]):null}function pu(t,e){return t!==e||N(t)||N(e)||!t.isToken()||!e.isToken()}function _u(t,e){let r=t.inputType,n=Xs(t);r==="deleteCompositionText"||gt&&Ls(e)||r!=="insertCompositionText"&&Me(e,()=>{let i=B();if(r==="deleteContentBackward"){if(i===null){var o=sr();if(!D(o))return;Ye(o.clone())}if(D(i)){if(Zd&&te(i.anchor.key),Us===229&&t.timeStamp<Lr+30&&e.isComposing()&&i.anchor.key===i.focus.key){if(te(null),Lr=0,setTimeout(()=>{Me(e,()=>{te(null)})},30),D(i)){if(o=i.anchor.getNode(),o.markDirty(),i.format=o.getFormat(),!S(o))throw Error("Anchor node must be a TextNode");i.style=o.getStyle()}1>=i.anchor.getNode().getTextContent().length&&(t.preventDefault(),x(e,Qt,!0))}else te(null),t.preventDefault(),x(e,Qt,!0);return}}if(D(i)){o=t.data,Ht!==null&&ao(!1,e,Ht),i.dirty&&Ht===null||!i.isCollapsed()||Oe(i.anchor.getNode())||n===null||i.applyDOMRange(n),Ht=null;var l=i.focus,s=i.anchor.getNode();if(l=l.getNode(),r==="insertText"||r==="insertTranspose")o===` `?(t.preventDefault(),x(e,Tr,!1)):o===` `?(t.preventDefault(),x(e,Ci,void 0)):o==null&&t.dataTransfer?(o=t.dataTransfer.getData("text/plain"),t.preventDefault(),i.insertRawText(o)):o!=null&&Js(i,n,o,t.timeStamp,!0)?(t.preventDefault(),x(e,er,o)):Ht=o,Vs=t.timeStamp;else switch(t.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":x(e,er,t);break;case"insertFromComposition":te(null),x(e,er,t);break;case"insertLineBreak":te(null),x(e,Tr,!1);break;case"insertParagraph":te(null),Or&&!kn?(Or=!1,x(e,Tr,!1)):x(e,Ci,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":x(e,Zi,t);break;case"deleteByComposition":pu(s,l)&&x(e,yi,t);break;case"deleteByDrag":case"deleteByCut":x(e,yi,t);break;case"deleteContent":x(e,Qt,!1);break;case"deleteWordBackward":x(e,Ar,!0);break;case"deleteWordForward":x(e,Ar,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":x(e,kr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":x(e,kr,!1);break;case"formatStrikeThrough":x(e,ut,"strikethrough");break;case"formatBold":x(e,ut,"bold");break;case"formatItalic":x(e,ut,"italic");break;case"formatUnderline":x(e,ut,"underline");break;case"historyUndo":x(e,qi,void 0);break;case"historyRedo":x(e,Qi,void 0)}}})}function mu(t,e){t.stopPropagation(),Me(e,()=>{var r=B(),n=t.data,i=Xs(t);if(n!=null&&D(r)&&Js(r,i,n,t.timeStamp,!1)){mr&&(Pi(e,n),mr=!1);var o=r.anchor,l=o.getNode();if(i=Ue(e._window),i===null)return;let s=o.offset;(o=_n&&!r.isCollapsed()&&S(l)&&i.anchorNode!==null)&&(l=l.getTextContent().slice(0,s)+n+l.getTextContent().slice(s+r.focus.offset),i=i.anchorNode,o=l===(i.nodeType===3?i.nodeValue:null)),o||x(e,er,n),n=n.length,gt&&1<n&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=n),ro||kn||no||!e.isComposing()||(Lr=0,te(null))}else ao(!1,e,n!==null?n:void 0),mr&&(Pi(e,n||void 0),mr=!1);Ne(),r=j(),Os(r)}),Ht=null}function Cu(t,e){Me(e,()=>{let r=B();if(D(r)&&!e.isComposing()){let n=r.anchor,i=r.anchor.getNode();te(n.key),(t.timeStamp<Lr+30||n.type==="element"||!r.isCollapsed()||i.getFormat()!==r.format||S(i)&&i.getStyle()!==r.style)&&x(e,er,Qd)}})}function Pi(t,e){var r=t._compositionKey;if(te(null),r!==null&&e!=null){if(e===""){e=ge(r),t=mn(t.getElementByKey(r)),t!==null&&t.nodeValue!==null&&S(e)&&uo(e,t.nodeValue,null,null,!0);return}if(e[e.length-1]===` `&&(r=B(),D(r))){e=r.focus,r.anchor.set(e.key,e.offset,e.type),x(t,pn,null);return}}ao(!0,t,e)}function yu(t,e){gt?mr=!0:Me(e,()=>{Pi(e,t.data)})}function Nu(t,e){if(Lr=t.timeStamp,Us=t.keyCode,!e.isComposing()){var{keyCode:r,shiftKey:n,ctrlKey:i,metaKey:o,altKey:l}=t;if(!x(e,ss,t)){if(r!==39||i||o||l)if(r!==39||l||n||!i&&!o)if(r!==37||i||o||l)if(r!==37||l||n||!i&&!o)if(r!==38||i||o)if(r!==40||i||o)if(r===13&&n)Or=!0,x(e,pn,t);else if(r===32)x(e,fs,t);else if(ue&&i&&r===79)t.preventDefault(),Or=!0,x(e,Tr,!0);else if(r!==13||n){var s=ue?l||o?!1:r===8||r===72&&i:i||l||o?!1:r===8;s?r===8?x(e,ps,t):(t.preventDefault(),x(e,Qt,!0)):r===27?x(e,_s,t):(s=ue?n||l||o?!1:r===46||r===68&&i:i||l||o?!1:r===46,s?r===46?x(e,ms,t):(t.preventDefault(),x(e,Qt,!1)):r===8&&(ue?l:i)?(t.preventDefault(),x(e,Ar,!0)):r===46&&(ue?l:i)?(t.preventDefault(),x(e,Ar,!1)):ue&&o&&r===8?(t.preventDefault(),x(e,kr,!0)):ue&&o&&r===46?(t.preventDefault(),x(e,kr,!1)):r===66&&!l&&(ue?o:i)?(t.preventDefault(),x(e,ut,"bold")):r===85&&!l&&(ue?o:i)?(t.preventDefault(),x(e,ut,"underline")):r===73&&!l&&(ue?o:i)?(t.preventDefault(),x(e,ut,"italic")):r!==9||l||i||o?r===90&&!n&&(ue?o:i)?(t.preventDefault(),x(e,qi,void 0)):(s=ue?r===90&&o&&n:r===89&&i||r===90&&i&&n,s?(t.preventDefault(),x(e,Qi,void 0)):Yr(e._editorState._selection)?(s=n?!1:r===67?ue?o:i:!1,s?(t.preventDefault(),x(e,eo,t)):(s=n?!1:r===88?ue?o:i:!1,s?(t.preventDefault(),x(e,to,t)):r===65&&(ue?o:i)&&(t.preventDefault(),x(e,Ni,t)))):!gt&&r===65&&(ue?o:i)&&(t.preventDefault(),x(e,Ni,t))):x(e,Cs,t))}else Or=!1,x(e,pn,t);else x(e,gs,t);else x(e,hs,t);else x(e,cs,t);else x(e,us,t);else x(e,ds,t);else x(e,as,t);(i||n||l||o)&&x(e,Ss,t)}}}function Zs(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}let tr=new Map;function qs(t){var e=t.target;let r=Ue(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(r!==null){var n=lo(r.anchorNode);if(n!==null){Ii&&(Ii=!1,Me(n,()=>{var s=sr(),a=r.anchorNode;a!==null&&(a=a.nodeType,a===1||a===3)&&(s=po(s,r,n,t),Ye(s))})),e=so(n),e=e[e.length-1];var i=e._key,o=tr.get(i),l=o||e;l!==n&&il(r,l,!1),il(r,n,!0),n!==e?tr.set(i,n):o&&tr.delete(i)}}}function vu(t,e){wr===0&&t.ownerDocument.addEventListener("selectionchange",qs),wr++,t.__lexicalEditor=e;let r=Zs(t);for(let n=0;n<Ai.length;n++){let[i,o]=Ai[n],l=typeof o=="function"?s=>{s._lexicalHandled!==!0&&(s._lexicalHandled=!0,e.isEditable()&&o(s,e))}:s=>{if(s._lexicalHandled!==!0&&(s._lexicalHandled=!0,e.isEditable()))switch(i){case"cut":return x(e,to,s);case"copy":return x(e,eo,s);case"paste":return x(e,Zi,s);case"dragstart":return x(e,Ns,s);case"dragover":return x(e,vs,s);case"dragend":return x(e,xs,s);case"focus":return x(e,Es,s);case"blur":return x(e,Ts,s);case"drop":return x(e,ys,s)}};t.addEventListener(i,l),r.push(()=>{t.removeEventListener(i,l)})}}function Li(t,e,r){Ne();var n=t.__key;let i=t.getParent();if(i!==null){var o=B();if(D(o)&&N(t)){var{anchor:l,focus:s}=o,a=l.getNode(),d=s.getNode();vn(a,t)&&l.set(t.__key,0,"element"),vn(d,t)&&s.set(t.__key,0,"element")}if(a=o,d=!1,D(a)&&e){o=a.anchor;let u=a.focus;o.key===n&&(Tn(o,t,i,t.getPreviousSibling(),t.getNextSibling()),d=!0),u.key===n&&(Tn(u,t,i,t.getPreviousSibling(),t.getNextSibling()),d=!0)}else Yr(a)&&e&&t.isSelected()&&t.selectPrevious();D(a)&&e&&!d?(n=t.getIndexWithinParent(),wt(t),En(a,i,n,-1)):wt(t),r||ft(i)||i.canBeEmpty()||!i.isEmpty()||Li(i,e),e&&Oe(i)&&i.isEmpty()&&i.selectEnd()}}class Hr{static getType(){T(64,this.name)}static clone(){T(65,this.name)}constructor(e){this.__type=this.constructor.getType(),this.__next=this.__prev=this.__parent=null,Ds(this,e)}getType(){return this.__type}isInline(){throw Error(`LexicalNode: Node ${this.constructor.name} does not implement .isInline().`)}isAttached(){for(var e=this.__key;e!==null;){if(e==="root")return!0;if(e=ge(e),e===null)break;e=e.__parent}return!1}isSelected(e){if(e=e||B(),e==null)return!1;let r=e.getNodes().some(n=>n.__key===this.__key);return S(this)?r:D(e)&&e.anchor.type==="element"&&e.focus.type==="element"&&e.anchor.key===e.focus.key&&e.anchor.offset===e.focus.offset?!1:r}getKey(){return this.__key}getIndexWithinParent(){var e=this.getParent();if(e===null)return-1;e=e.getFirstChild();let r=0;for(;e!==null;){if(this.is(e))return r;r++,e=e.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:ge(e)}getParentOrThrow(){let e=this.getParent();return e===null&&T(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let r=e.getParent();if(ft(r)){if(!N(e))throw Error("Children of root nodes must be elements");return e}e=r}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&T(67,this.__key),e}getParents(){let e=[],r=this.getParent();for(;r!==null;)e.push(r),r=r.getParent();return e}getParentKeys(){let e=[],r=this.getParent();for(;r!==null;)e.push(r.__key),r=r.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:ge(e)}getPreviousSiblings(){let e=[];var r=this.getParent();if(r===null)return e;for(r=r.getFirstChild();r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:ge(e)}getNextSiblings(){let e=[],r=this.getNextSibling();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getCommonAncestor(e){let r=this.getParents();var n=e.getParents();N(this)&&r.unshift(this),N(e)&&n.unshift(e),e=r.length;var i=n.length;if(e===0||i===0||r[e-1]!==n[i-1])return null;for(n=new Set(n),i=0;i<e;i++){let o=r[i];if(n.has(o))return o}return null}is(e){return e==null?!1:this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;var r=this.getCommonAncestor(e);let n=this;for(;;){var i=n.getParentOrThrow();if(i===r){i=n.getIndexWithinParent();break}n=i}for(n=e;;){if(e=n.getParentOrThrow(),e===r){r=n.getIndexWithinParent();break}n=e}return i<r}isParentOf(e){let r=this.__key;if(r===e.__key)return!1;for(;e!==null;){if(e.__key===r)return!0;e=e.getParent()}return!1}getNodesBetween(e){let r=this.isBefore(e),n=[],i=new Set;for(var o=this;;){var l=o.__key;if(i.has(l)||(i.add(l),n.push(o)),o===e)break;if(l=N(o)?r?o.getFirstChild():o.getLastChild():null,l!==null)o=l;else if(l=r?o.getNextSibling():o.getPreviousSibling(),l!==null)o=l;else{if(o=o.getParentOrThrow(),i.has(o.__key)||n.push(o),o===e)break;l=o;do l===null&&T(68),o=r?l.getNextSibling():l.getPreviousSibling(),l=l.getParent(),l!==null&&(o!==null||i.has(l.__key)||n.push(l));while(o===null)}}return r||n.reverse(),n}isDirty(){let e=j()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=ge(this.__key);return e===null&&T(113),e}getWritable(){Ne();var e=Ve(),r=j();e=e._nodeMap;let n=this.__key,i=this.getLatest(),o=i.__parent;r=r._cloneNotNeeded;var l=B();return fo(l)&&l.setCachedNodes(null),r.has(n)?(Cn(i),i):(l=i.constructor.clone(i),l.__parent=o,l.__next=i.__next,l.__prev=i.__prev,N(i)&&N(l)?(l.__first=i.__first,l.__last=i.__last,l.__size=i.__size,l.__indent=i.__indent,l.__format=i.__format,l.__dir=i.__dir):S(i)&&S(l)&&(l.__format=i.__format,l.__style=i.__style,l.__mode=i.__mode,l.__detail=i.__detail),r.add(n),l.__key=n,Cn(l),e.set(n,l),l)}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){T(70)}updateDOM(){T(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){T(72)}static importJSON(){T(18,this.name)}static transform(){return null}remove(e){Li(this,!0,e)}replace(e,r){Ne();var n=B();n!==null&&(n=n.clone()),ni(this,e);let i=this.getLatest(),o=this.__key,l=e.__key,s=e.getWritable();e=this.getParentOrThrow().getWritable();let a=e.__size;wt(s);let d=i.getPreviousSibling(),u=i.getNextSibling(),h=i.__prev,c=i.__next,g=i.__parent;if(Li(i,!1,!0),d===null?e.__first=l:d.getWritable().__next=l,s.__prev=h,u===null?e.__last=l:u.getWritable().__prev=l,s.__next=c,s.__parent=g,e.__size=a,r){if(!N(this)||!N(s))throw Error("includeChildren should only be true for ElementNodes");this.getChildren().forEach(f=>{s.append(f)})}return D(n)&&(Ye(n),r=n.anchor,n=n.focus,r.key===o&&sl(r,s),n.key===o&&sl(n,s)),ct()===o&&te(l),s}insertAfter(e,r=!0){Ne(),ni(this,e);var n=this.getWritable();let i=e.getWritable();var o=i.getParent();let l=B();var s=!1,a=!1;if(o!==null){var d=e.getIndexWithinParent();wt(i),D(l)&&(a=o.__key,s=l.anchor,o=l.focus,s=s.type==="element"&&s.key===a&&s.offset===d+1,a=o.type==="element"&&o.key===a&&o.offset===d+1)}o=this.getNextSibling(),d=this.getParentOrThrow().getWritable();let u=i.__key,h=n.__next;return o===null?d.__last=u:o.getWritable().__prev=u,d.__size++,n.__next=u,i.__next=h,i.__prev=n.__key,i.__parent=n.__parent,r&&D(l)&&(r=this.getIndexWithinParent(),En(l,d,r+1),n=d.__key,s&&l.anchor.set(n,r+2,"element"),a&&l.focus.set(n,r+2,"element")),e}insertBefore(e,r=!0){Ne(),ni(this,e);var n=this.getWritable();let i=e.getWritable(),o=i.__key;wt(i);let l=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=n.__prev,d=this.getIndexWithinParent();return l===null?s.__first=o:l.getWritable().__next=o,s.__size++,n.__prev=o,i.__prev=a,i.__next=n.__key,i.__parent=n.__parent,n=B(),r&&D(n)&&(r=this.getParentOrThrow(),En(n,r,d)),e}isParentRequired(){return!1}createParentElementNode(){return rt()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,r){Ne();let n=this.getPreviousSibling(),i=this.getParentOrThrow();return n===null?i.select(0,0):N(n)?n.select():S(n)?n.select(e,r):(e=n.getIndexWithinParent()+1,i.select(e,e))}selectNext(e,r){Ne();let n=this.getNextSibling(),i=this.getParentOrThrow();return n===null?i.select():N(n)?n.select(0,0):S(n)?n.select(e,r):(e=n.getIndexWithinParent(),i.select(e,e))}markDirty(){this.getWritable()}}function xu(t,e,r){r=r||e.getParentOrThrow().getLastChild();let n=e;for(e=[e];n!==r;){if(!n.getNextSibling())throw Error("insertRangeAfter: lastToInsert must be a later sibling of firstToInsert");n=n.getNextSibling(),e.push(n)}for(let i of e)t=t.insertAfter(i)}class or extends Hr{static getType(){return"linebreak"}static clone(e){return new or(e.__key)}constructor(e){super(e)}getTextContent(){return` `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>{let r=e.parentElement,n,i;return r!==null&&((n=r.firstChild)===e||n.nextSibling===e&&n.nodeType===3&&(n.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)&&((i=r.lastChild)===e||i.previousSibling===e&&i.nodeType===3&&(i.textContent||"").match(/^( |\t|\r?\n)+$/)!==null)?null:{conversion:Eu,priority:0}}}}static importJSON(){return nr()}exportJSON(){return{type:"linebreak",version:1}}}function Eu(){return{node:nr()}}function nr(){return Wr(new or)}function Mt(t){return t instanceof or}function si(t,e){return e&16?"code":e&128?"mark":e&32?"sub":e&64?"sup":null}function ai(t,e){return e&1?"strong":e&2?"em":"span"}function di(t,e,r,n,i){t=n.classList,n=Sr(i,"base"),n!==void 0&&t.add(...n),n=Sr(i,"underlineStrikethrough");let o=!1,l=e&8&&e&4;var s=r&8&&r&4;n!==void 0&&(s?(o=!0,l||t.add(...n)):l&&t.remove(...n));for(let a in ht)s=ht[a],n=Sr(i,a),n!==void 0&&(r&s?!o||a!=="underline"&&a!=="strikethrough"?(!(e&s)||l&&a==="underline"||a==="strikethrough")&&t.add(...n):e&s&&t.remove(...n):e&s&&t.remove(...n))}function ui(t,e,r){let n=e.firstChild;if(r=r.isComposing(),t+=r?In:"",n==null)e.textContent=t;else if(e=n.nodeValue,e!==t)if(r||gt){r=e.length;let i=t.length,o=0,l=0;for(;o<r&&o<i&&e[o]===t[o];)o++;for(;l+o<r&&l+o<i&&e[r-l-1]===t[i-l-1];)l++;t=[o,r-o-l,t.slice(o,i-l)];let[s,a,d]=t;a!==0&&n.deleteData(s,a),n.insertData(s,d)}else n.nodeValue=t}function tn(t,e){return e=document.createElement(e),e.appendChild(t),e}class It extends Hr{static getType(){return"text"}static clone(e){return new It(e.__text,e.__key)}constructor(e,r){super(r),this.__text=e,this.__format=0,this.__style="",this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return ou[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ct()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return(this.getLatest().__detail&1)!==0}isUnmergeable(){return(this.getLatest().__detail&2)!==0}hasFormat(e){return e=ht[e],(this.getFormat()&e)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){let n=this.getLatest().__format;return Ei(n,e,r)}createDOM(e){var r=this.__format,n=si(this,r);let i=ai(this,r),o=document.createElement(n===null?i:n),l=o;return this.hasFormat("code")&&o.setAttribute("spellcheck","false"),n!==null&&(l=document.createElement(i),o.appendChild(l)),n=l,ui(this.__text,n,this),e=e.theme.text,e!==void 0&&di(i,0,r,n,e),r=this.__style,r!==""&&(o.style.cssText=r),o}updateDOM(e,r,n){let i=this.__text;var o=e.__format,l=this.__format,s=si(this,o);let a=si(this,l);var d=ai(this,o);let u=ai(this,l);return(s===null?d:s)!==(a===null?u:a)?!0:s===a&&d!==u?(o=r.firstChild,o==null&&T(48),e=s=document.createElement(u),ui(i,e,this),n=n.theme.text,n!==void 0&&di(u,0,l,e,n),r.replaceChild(s,o),!1):(d=r,a!==null&&s!==null&&(d=r.firstChild,d==null&&T(49)),ui(i,d,this),n=n.theme.text,n!==void 0&&o!==l&&di(u,o,l,d,n),l=this.__style,e.__style!==l&&(r.style.cssText=l),!1)}static importDOM(){return{"#text":()=>({conversion:wu,priority:0}),b:()=>({conversion:Su,priority:0}),code:()=>({conversion:st,priority:0}),em:()=>({conversion:st,priority:0}),i:()=>({conversion:st,priority:0}),s:()=>({conversion:st,priority:0}),span:()=>({conversion:Tu,priority:0}),strong:()=>({conversion:st,priority:0}),sub:()=>({conversion:st,priority:0}),sup:()=>({conversion:st,priority:0}),u:()=>({conversion:st,priority:0})}}static importJSON(e){let r=de(e.text);return r.setFormat(e.format),r.setDetail(e.detail),r.setMode(e.mode),r.setStyle(e.style),r}exportDOM(e){return{element:e}=super.exportDOM(e),e!==null&&bn(e)||T(132),e.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(e=tn(e,"b")),this.hasFormat("italic")&&(e=tn(e,"i")),this.hasFormat("strikethrough")&&(e=tn(e,"s")),this.hasFormat("underline")&&(e=tn(e,"u")),{element:e}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(e){let r=this.getWritable();return r.__format=typeof e=="string"?ht[e]:e,r}setDetail(e){let r=this.getWritable();return r.__detail=typeof e=="string"?ru[e]:e,r}setStyle(e){let r=this.getWritable();return r.__style=e,r}toggleFormat(e){let r=this.getFormat();return e=Ei(r,e,null),this.setFormat(e)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){if(e=iu[e],this.__mode===e)return this;let r=this.getWritable();return r.__mode=e,r}setTextContent(e){if(this.__text===e)return this;let r=this.getWritable();return r.__text=e,r}select(e,r){Ne();let n=B();var i=this.getTextContent();let o=this.__key;if(typeof i=="string"?(i=i.length,e===void 0&&(e=i),r===void 0&&(r=i)):r=e=0,D(n))i=ct(),i!==n.anchor.key&&i!==n.focus.key||te(o),n.setTextNodeRange(this,e,this,r);else return ra(o,e,o,r,"text","text");return n}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,r,n,i){let o=this.getWritable(),l=o.__text,s=n.length,a=e;0>a&&(a=s+a,0>a&&(a=0));let d=B();return i&&D(d)&&(e+=s,d.setTextNodeRange(o,e,o,e)),r=l.slice(0,a)+n+l.slice(a+r),o.__text=r,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Ne();var r=this.getLatest(),n=r.getTextContent(),i=r.__key,o=ct(),l=new Set(e);e=[];for(var s=n.length,a="",d=0;d<s;d++)a!==""&&l.has(d)&&(e.push(a),a=""),a+=n[d];if(a!==""&&e.push(a),l=e.length,l===0)return[];if(e[0]===n)return[r];var u=e[0];n=r.getParentOrThrow(),d=r.getFormat();let h=r.getStyle(),c=r.__detail;s=!1,r.isSegmented()?(a=de(u),a.__format=d,a.__style=h,a.__detail=c,s=!0):(a=r.getWritable(),a.__text=u),r=B(),a=[a],u=u.length;for(let p=1;p<l;p++){var g=e[p],f=g.length;g=de(g).getWritable(),g.__format=d,g.__style=h,g.__detail=c;let y=g.__key;if(f=u+f,D(r)){let v=r.anchor,M=r.focus;v.key===i&&v.type==="text"&&v.offset>u&&v.offset<=f&&(v.key=y,v.offset-=u,r.dirty=!0),M.key===i&&M.type==="text"&&M.offset>u&&M.offset<=f&&(M.key=y,M.offset-=u,r.dirty=!0)}o===i&&te(y),u=f,a.push(g)}return i=this.getPreviousSibling(),o=this.getNextSibling(),i!==null&&Cn(i),o!==null&&Cn(o),i=n.getWritable(),o=this.getIndexWithinParent(),s?(i.splice(o,0,a),this.remove()):i.splice(o,1,a),D(r)&&En(r,n,o,l-1),a}mergeWithSibling(e){var r=e===this.getPreviousSibling();r||e===this.getNextSibling()||T(50);var n=this.__key;let i=e.__key,o=this.__text,l=o.length;ct()===i&&te(n);let s=B();if(D(s)){let a=s.anchor,d=s.focus;a!==null&&a.key===i&&(fl(a,r,n,e,l),s.dirty=!0),d!==null&&d.key===i&&(fl(d,r,n,e,l),s.dirty=!0)}return n=e.__text,this.setTextContent(r?n+o:o+n),r=this.getWritable(),e.remove(),r}isTextEntity(){return!1}}function Tu(t){let e=t.style.fontWeight==="700",r=t.style.textDecoration==="line-through",n=t.style.fontStyle==="italic",i=t.style.textDecoration==="underline",o=t.style.verticalAlign;return{forChild:l=>(S(l)&&(e&&l.toggleFormat("bold"),r&&l.toggleFormat("strikethrough"),n&&l.toggleFormat("italic"),i&&l.toggleFormat("underline"),o==="sub"&&l.toggleFormat("subscript"),o==="super"&&l.toggleFormat("superscript")),l),node:null}}function Su(t){let e=t.style.fontWeight==="normal";return{forChild:r=>(S(r)&&!e&&r.toggleFormat("bold"),r),node:null}}let ol=new WeakMap;function wu(t){t.parentElement===null&&T(129);for(var e=t.textContent||"",r,n=t.parentNode,i=[t];n!==null&&(r=ol.get(n))===void 0&&!(n.nodeName==="PRE"||n.nodeType===1&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre"));)i.push(n),n=n.parentNode;for(r=r===void 0?n:r,n=0;n<i.length;n++)ol.set(i[n],r);if(r!==null){for(e=e.split(/(\r?\n|\t)/),t=[],i=e.length,r=0;r<i;r++)n=e[r],n===` `||n===`\r `?t.push(nr()):n===" "?t.push(Fn()):n!==""&&t.push(de(n));return{node:t}}if(e=e.replace(/\r/g,"").replace(/[ \t\n]+/g," "),e==="")return{node:null};if(e[0]===" "){for(i=t,r=!0;i!==null&&(i=ll(i,!1))!==null;)if(n=i.textContent||"",0<n.length){/[ \t\n]$/.test(n)&&(e=e.slice(1)),r=!1;break}r&&(e=e.slice(1))}if(e[e.length-1]===" "){for(i=!0;t!==null&&(t=ll(t,!0))!==null;)if(0<(t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){i=!1;break}i&&(e=e.slice(0,e.length-1))}return e===""?{node:null}:{node:de(e)}}let Ou=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function ll(t,e){for(;;){for(var r=void 0;(r=e?t.nextSibling:t.previousSibling)===null;)if(t=t.parentElement,t===null)return null;if(t=r,t.nodeType===1&&(r=t.style.display,r===""&&t.nodeName.match(Ou)===null||r!==""&&!r.startsWith("inline")))return null;for(;(r=e?t.firstChild:t.lastChild)!==null;)t=r;if(t.nodeType===3)return t;if(t.nodeName==="BR")return null}}let $u={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function st(t){let e=$u[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:r=>(S(r)&&!r.hasFormat(e)&&r.toggleFormat(e),r),node:null}}function de(t=""){return Wr(new It(t))}function S(t){return t instanceof It}class lr extends It{static getType(){return"tab"}static clone(e){let r=new lr(e.__key);return r.__text=e.__text,r.__format=e.__format,r.__style=e.__style,r}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){let r=Fn();return r.setFormat(e.format),r.setStyle(e.style),r}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){T(126)}setDetail(){T(127)}setMode(){T(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Fn(){return Wr(new lr)}function Qs(t){return t instanceof lr}class Mu{constructor(e,r,n){this._selection=null,this.key=e,this.offset=r,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let r=this.getNode(),n=e.getNode(),i=this.offset;if(e=e.offset,N(r)){var o=r.getDescendantByIndex(i);r=o??r}return N(n)&&(o=n.getDescendantByIndex(e),n=o??n),r===n?i<e:r.isBefore(n)}getNode(){let e=ge(this.key);return e===null&&T(20),e}set(e,r,n){let i=this._selection,o=this.key;this.key=e,this.offset=r,this.type=n,ar()||(ct()===o&&te(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0))}}function ze(t,e,r){return new Mu(t,e,r)}function ci(t,e){let r=e.__key,n=t.offset,i="element";if(S(e))i="text",e=e.getTextContentSize(),n>e&&(n=e);else if(!N(e)){var o=e.getNextSibling();S(o)?(r=o.__key,n=0,i="text"):(o=e.getParent())&&(r=o.__key,n=e.getIndexWithinParent()+1)}t.set(r,n,i)}function sl(t,e){if(N(e)){let r=e.getLastDescendant();N(r)||S(r)?ci(t,r):ci(t,e)}else ci(t,e)}function al(t,e,r,n){let i=t.getNode(),o=i.getChildAtIndex(t.offset),l=de(),s=Oe(i)?rt().append(l):l;l.setFormat(r),l.setStyle(n),o===null?i.append(s):o.insertBefore(s),t.is(e)&&e.set(l.__key,0,"text"),t.set(l.__key,0,"text")}function dt(t,e,r,n){t.key=e,t.offset=r,t.type=n}class go{constructor(e,r){this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return fo(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus):!1}isCollapsed(){return!1}extract(){return this.getNodes()}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return bi(this)}}class Bn{constructor(e){this.dirty=!1,this._nodes=e,this._cachedNodes=null}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Yr(e))return!1;let r=this._nodes,n=e._nodes;return r.size===n.size&&Array.from(r).every(i=>n.has(i))}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Bn(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(e){let r=this.getNodes(),n=r.length;var i=r[n-1];if(S(i))i=i.select();else{let o=i.getIndexWithinParent()+1;i=i.getParentOrThrow().select(o,o)}for(i.insertNodes(e),e=0;e<n;e++)r[e].remove()}getNodes(){var e=this._cachedNodes;if(e!==null)return e;var r=this._nodes;e=[];for(let n of r)r=ge(n),r!==null&&e.push(r);return ar()||(this._cachedNodes=e),e}getTextContent(){let e=this.getNodes(),r="";for(let n=0;n<e.length;n++)r+=e[n].getTextContent();return r}}function D(t){return t instanceof yt}function fo(t){return t instanceof go}class yt extends go{constructor(e,r,n,i){super(e,r),this.format=n,this.style=i}is(e){return D(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var e=this._cachedNodes;if(e!==null)return e;e=this.anchor;var r=this.focus,n=e.isBefore(r),i=n?e:r;n=n?r:e,e=i.getNode(),r=n.getNode();let o=i.offset;return i=n.offset,N(e)&&(n=e.getDescendantByIndex(o),e=n??e),N(r)&&(n=r.getDescendantByIndex(i),n!==null&&n!==e&&r.getChildAtIndex(i)===n&&(n=n.getPreviousSibling()),r=n??r),e=e.is(r)?N(e)&&0<e.getChildrenSize()?[]:[e]:e.getNodesBetween(r),ar()||(this._cachedNodes=e),e}setTextNodeRange(e,r,n,i){dt(this.anchor,e.__key,r,"text"),dt(this.focus,n.__key,i,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let r=e[0],n=e[e.length-1],i=this.anchor,o=this.focus,l=i.isBefore(o),[s,a]=bi(this),d="",u=!0;for(let h=0;h<e.length;h++){let c=e[h];if(N(c)&&!c.isInline())u||(d+=` `),u=!c.isEmpty();else if(u=!1,S(c)){let g=c.getTextContent();c===r?c===n?(i.type!=="element"||o.type!=="element"||o.offset===i.offset)&&(g=s<a?g.slice(s,a):g.slice(a,s)):g=l?g.slice(s):g.slice(a):c===n&&(g=l?g.slice(0,a):g.slice(0,s)),d+=g}else!J(c)&&!Mt(c)||c===n&&this.isCollapsed()||(d+=c.getTextContent())}return d}applyDOMRange(e){let r=j(),n=r.getEditorState()._selection;if(e=ta(e.startContainer,e.startOffset,e.endContainer,e.endOffset,r,n),e!==null){var[i,o]=e;dt(this.anchor,i.key,i.offset,i.type),dt(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}}clone(){let e=this.anchor,r=this.focus;return new yt(ze(e.key,e.offset,e.type),ze(r.key,r.offset,r.type),this.format,this.style)}toggleFormat(e){this.format=Ei(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){return(this.format&ht[e])!==0}insertRawText(e){e=e.split(/(\r?\n|\t)/);let r=[],n=e.length;for(let i=0;i<n;i++){let o=e[i];o===` `||o===`\r `?r.push(nr()):o===" "?r.push(Fn()):r.push(de(o))}this.insertNodes(r)}insertText(e){var r=this.anchor,n=this.focus,i=this.isCollapsed()||r.isBefore(n),o=this.format,l=this.style;i&&r.type==="element"?al(r,n,o,l):i||n.type!=="element"||al(n,r,o,l);var s=this.getNodes(),a=s.length,d=i?n:r;n=(i?r:n).offset;var u=d.offset;r=s[0],S(r)||T(26),i=r.getTextContent().length;var h=r.getParentOrThrow(),c=s[a-1];if(this.isCollapsed()&&n===i&&(r.isSegmented()||r.isToken()||!r.canInsertTextAfter()||!h.canInsertTextAfter()&&r.getNextSibling()===null)){var g=r.getNextSibling();if(S(g)&&g.canInsertTextBefore()&&!xi(g)||(g=de(),g.setFormat(o),h.canInsertTextAfter()?r.insertAfter(g):h.insertAfter(g)),g.select(0,0),r=g,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&n===0&&(r.isSegmented()||r.isToken()||!r.canInsertTextBefore()||!h.canInsertTextBefore()&&r.getPreviousSibling()===null)){if(g=r.getPreviousSibling(),(!S(g)||xi(g))&&(g=de(),g.setFormat(o),h.canInsertTextBefore()?r.insertBefore(g):h.insertBefore(g)),g.select(),r=g,e!==""){this.insertText(e);return}}else if(r.isSegmented()&&n!==i)h=de(r.getTextContent()),h.setFormat(o),r.replace(h),r=h;else if(!(this.isCollapsed()||e===""||(g=c.getParent(),h.canInsertTextBefore()&&h.canInsertTextAfter()&&(!N(g)||g.canInsertTextBefore()&&g.canInsertTextAfter())))){this.insertText(""),ea(this.anchor,this.focus,null),this.insertText(e);return}if(a===1)if(r.isToken())e=de(e),e.select(),r.replace(e);else{if(s=r.getFormat(),a=r.getStyle(),n===u&&(s!==o||a!==l))if(r.getTextContent()==="")r.setFormat(o),r.setStyle(l);else{s=de(e),s.setFormat(o),s.setStyle(l),s.select(),n===0?r.insertBefore(s,!1):([a]=r.splitText(n),a.insertAfter(s,!1)),s.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}else if(Qs(r)){e=de(e),e.setFormat(o),e.setStyle(l),e.select(),r.replace(e);return}r=r.spliceText(n,u-n,e,!0),r.getTextContent()===""?r.remove():this.anchor.type==="text"&&(r.isComposing()?this.anchor.offset-=e.length:(this.format=s,this.style=a))}else{if(o=new Set([...r.getParentKeys(),...c.getParentKeys()]),g=N(r)?r:r.getParentOrThrow(),l=N(c)?c:c.getParentOrThrow(),h=c,!g.is(l)&&l.isInline())do h=l,l=l.getParentOrThrow();while(l.isInline());if(d.type==="text"&&(u!==0||c.getTextContent()==="")||d.type==="element"&&c.getIndexWithinParent()<u)if(S(c)&&!c.isToken()&&u!==c.getTextContentSize()){if(c.isSegmented()){var f=de(c.getTextContent());c.replace(f),c=f}Oe(d.getNode())||d.type!=="text"||(c=c.spliceText(0,u,"")),o.add(c.__key)}else d=c.getParentOrThrow(),d.canBeEmpty()||d.getChildrenSize()!==1?c.remove():d.remove();else o.add(c.__key);for(d=l.getChildren(),u=new Set(s),c=g.is(l),g=g.isInline()&&r.getNextSibling()===null?g:r,f=d.length-1;0<=f;f--){let p=d[f];if(p.is(r)||N(p)&&p.isParentOf(r))break;p.isAttached()&&(!u.has(p)||p.is(h)?c||g.insertAfter(p,!1):p.remove())}if(!c)for(d=l,l=null;d!==null;)u=d.getChildren(),c=u.length,(c===0||u[c-1].is(l))&&(o.delete(d.__key),l=d),d=d.getParent();for(r.isToken()?n===i?r.select():(e=de(e),e.select(),r.replace(e)):(r=r.spliceText(n,i-n,e,!0),r.getTextContent()===""?r.remove():r.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length)),e=1;e<a;e++)r=s[e],o.has(r.__key)||r.remove()}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())this.toggleFormat(e),te(null);else{var r=this.getNodes(),n=[];for(var i of r)S(i)&&n.push(i);var o=n.length;if(o===0)this.toggleFormat(e),te(null);else{i=this.anchor;var l=this.focus,s=this.isBackward();r=s?l:i,i=s?i:l;var a=0,d=n[0];if(l=r.type==="element"?0:r.offset,r.type==="text"&&l===d.getTextContentSize()&&(a=1,d=n[1],l=0),d!=null){s=d.getFormatFlags(e,null);var u=o-1,h=n[u];if(o=i.type==="text"?i.offset:h.getTextContentSize(),d.is(h))l!==o&&(l===0&&o===d.getTextContentSize()?d.setFormat(s):(e=d.splitText(l,o),e=l===0?e[0]:e[1],e.setFormat(s),r.type==="text"&&r.set(e.__key,0,"text"),i.type==="text"&&i.set(e.__key,o-l,"text")),this.format=s);else{l!==0&&([,d]=d.splitText(l),l=0),d.setFormat(s);var c=h.getFormatFlags(e,s);for(0<o&&(o!==h.getTextContentSize()&&([h]=h.splitText(o)),h.setFormat(c)),a+=1;a<u;a++){let g=n[a];if(!g.isToken()){let f=g.getFormatFlags(e,c);g.setFormat(f)}}r.type==="text"&&r.set(d.__key,l,"text"),i.type==="text"&&i.set(h.__key,o,"text"),this.format=s|c}}}}}insertNodes(e){if(e.length!==0){if(this.anchor.key==="root"){this.insertParagraph();var r=B();if(!D(r))throw Error("Expected RangeSelection after insertParagraph");return r.insertNodes(e)}var n=oi(this.anchor.getNode(),Wt);if(r=e[e.length-1],"__language"in n&&N(n))if("__language"in e[0])this.insertText(e[0].getTextContent());else{var i=hi(this);n.splice(i,0,e),r.selectEnd()}else if(e.some(s=>(N(s)||J(s))&&!s.isInline())){r=ku(e),e=r.getLastDescendant();var o=r.getChildren();r=N(n)&&n.isEmpty()?null:this.insertParagraph(),i=o[o.length-1];var l=o[0];if((s=>N(s)&&Wt(s)&&!s.isEmpty()&&N(n)&&(!n.isEmpty()||"__value"in n&&"__checked"in n))(l)){if(!N(n))throw Error("Expected 'firstBlock' to be an ElementNode");n.append(...l.getChildren()),l=o[1]}l&&xu(n,l),o=oi(e,Wt),r&&N(o)&&("__value"in r&&"__checked"in r||Wt(i))&&(o.append(...r.getChildren()),r.remove()),N(n)&&n.isEmpty()&&n.remove(),e.selectEnd(),e=N(n)?n.getLastChild():null,Mt(e)&&o!==n&&e.remove()}else{if(!N(n))throw Error("Expected 'firstBlock' to be an ElementNode");i=hi(this),n.splice(i,0,e),r.selectEnd()}}}insertParagraph(){if(this.anchor.key==="root"){var e=rt();return Te().splice(this.anchor.offset,0,[e]),e.select(),e}var r=hi(this);if(e=oi(this.anchor.getNode(),Wt),!N(e))throw Error("Expected ancestor to be an ElementNode");return r=(r=e.getChildAtIndex(r))?[r,...r.getNextSiblings()]:[],(e=e.insertNewAfter(this,!1))?(e.append(...r),e.selectStart(),e):null}insertLineBreak(e){var r=nr();this.insertNodes([r]),e&&(e=r.getParentOrThrow(),r=r.getIndexWithinParent(),e.select(r,r))}extract(){var e=this.getNodes(),r=e.length,n=r-1,i=this.anchor;let o=this.focus;var l=e[0];let s=e[n],[a,d]=bi(this);return r===0?[]:r===1?S(l)&&!this.isCollapsed()?(e=a>d?d:a,n=l.splitText(e,a>d?a:d),e=e===0?n[0]:n[1],e!=null?[e]:[]):[l]:(r=i.isBefore(o),S(l)&&(i=r?a:d,i===l.getTextContentSize()?e.shift():i!==0&&([,l]=l.splitText(i),e[0]=l)),S(s)&&(l=s.getTextContent().length,r=r?d:a,r===0?e.pop():r!==l&&([s]=s.splitText(r),e[n]=s)),e)}modify(e,r,n){var i=this.focus,o=this.anchor,l=e==="move",s=Ti(i,r);if(J(s)&&!s.isIsolated())l&&s.isKeyboardSelectable()?(r=zi(),r.add(s.__key),Ye(r)):(e=r?s.getPreviousSibling():s.getNextSibling(),S(e)?(s=e.__key,r=r?e.getTextContent().length:0,i.set(s,r,"text"),l&&o.set(s,r,"text")):(n=s.getParentOrThrow(),N(e)?(n=e.__key,s=r?e.getChildrenSize():0):(s=s.getIndexWithinParent(),n=n.__key,r||s++),i.set(n,s,"element"),l&&o.set(n,s,"element")));else if(o=j(),i=Ue(o._window)){var a=o._blockCursorElement,d=o._rootElement;if(d===null||a===null||!N(s)||s.isInline()||s.canBeEmpty()||Si(a,o,d),i.modify(e,r?"backward":"forward",n),0<i.rangeCount&&(s=i.getRangeAt(0),o=this.anchor.getNode(),o=Oe(o)?o:bs(o),this.applyDOMRange(s),this.dirty=!0,!l)){for(l=this.getNodes(),e=[],n=!1,a=0;a<l.length;a++)d=l[a],vn(d,o)?e.push(d):n=!0;n&&0<e.length&&(r?(r=e[0],N(r)?r.selectStart():r.getParentOrThrow().selectStart()):(r=e[e.length-1],N(r)?r.selectEnd():r.getParentOrThrow().selectEnd())),(i.anchorNode!==s.startContainer||i.anchorOffset!==s.startOffset)&&(r=this.focus,l=this.anchor,i=l.key,s=l.offset,o=l.type,dt(l,r.key,r.offset,r.type),dt(r,i,s,o),this._cachedNodes=null)}}}deleteCharacter(e){let r=this.isCollapsed();if(this.isCollapsed()){var n=this.anchor,i=this.focus,o=n.getNode();if(!e&&(n.type==="element"&&N(o)&&n.offset===o.getChildrenSize()||n.type==="text"&&n.offset===o.getTextContentSize())){var l=o.getParent();if(l=o.getNextSibling()||(l===null?null:l.getNextSibling()),N(l)&&l.isShadowRoot())return}if(l=Ti(i,e),J(l)&&!l.isIsolated()){l.isKeyboardSelectable()&&N(o)&&o.getChildrenSize()===0?(o.remove(),e=zi(),e.add(l.__key),Ye(e)):(l.remove(),j().dispatchCommand(An,void 0));return}if(!e&&N(l)&&N(o)&&o.isEmpty()){o.remove(),l.selectStart();return}if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{if(l=i.type==="text"?i.getNode():null,o=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){if(n=i.offset,i=l.getTextContentSize(),l.is(o)||e&&n!==i||!e&&n!==0){ul(l,e,n);return}}else if(o!==null&&o.isSegmented()&&(n=n.offset,i=o.getTextContentSize(),o.is(l)||e&&n!==0||!e&&n!==i)){ul(o,e,n);return}if(o=this.anchor,l=this.focus,n=o.getNode(),i=l.getNode(),n===i&&o.type==="text"&&l.type==="text"){var s=o.offset,a=l.offset;let d=s<a;i=d?s:a,a=d?a:s,s=a-1,i!==s&&(n=n.getTextContent().slice(i,a),Is(n)||(e?l.offset=s:o.offset=s))}}}this.removeText(),e&&!r&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0&&(e=this.anchor.getNode(),e.isEmpty()&&Oe(e.getParent())&&e.getIndexWithinParent()===0&&e.collapseAtStart(this))}deleteLine(e){this.isCollapsed()&&(this.anchor.type==="text"&&this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character")),this.removeText()}deleteWord(e){this.isCollapsed()&&this.modify("extend",e,"word"),this.removeText()}}function Yr(t){return t instanceof Bn}function dl(t){let e=t.offset;return t.type==="text"?e:(t=t.getNode(),e===t.getChildrenSize()?t.getTextContent().length:0)}function bi(t){let e=t.anchor;return t=t.focus,e.type==="element"&&t.type==="element"&&e.key===t.key&&e.offset===t.offset?[0,0]:[dl(e),dl(t)]}function ul(t,e,r){let n=t.getTextContent().split(/(?=\s)/g),i=n.length,o=0,l=0;for(let s=0;s<i;s++){let a=n[s],d=s===i-1;if(l=o,o+=a.length,e&&o===r||o>r||d){n.splice(s,1),d&&(l=void 0);break}}e=n.join("").trim(),e===""?t.remove():(t.setTextContent(e),t.select(l,l))}function cl(t,e,r,n){var i=e;if(t.nodeType===1){let s=!1;var o=t.childNodes,l=o.length;i===l&&(s=!0,i=l-1);let a=o[i];if(l=!1,a===n._blockCursorElement?(a=o[i+1],l=!0):n._blockCursorElement!==null&&i--,n=Vt(a),S(n))i=s?n.getTextContentSize():0;else{if(o=Vt(t),o===null)return null;if(N(o)?(t=o.getChildAtIndex(i),(e=N(t))&&(e=t.getParent(),e=r===null||e===null||!e.canBeEmpty()||e!==r.getNode()),e&&(r=s?t.getLastDescendant():t.getFirstDescendant(),r===null?(o=t,i=0):(t=r,o=N(t)?t:t.getParentOrThrow())),S(t)?(n=t,o=null,i=s?t.getTextContentSize():0):t!==o&&s&&!l&&i++):(i=o.getIndexWithinParent(),i=e===0&&J(o)&&Vt(t)===o?i:i+1,o=o.getParentOrThrow()),N(o))return ze(o.__key,i,"element")}}else n=Vt(t);return S(n)?ze(n.__key,i,"text"):null}function hl(t,e,r){var n=t.offset,i=t.getNode();n===0?(n=i.getPreviousSibling(),i=i.getParent(),e?(r||!e)&&n===null&&N(i)&&i.isInline()&&(e=i.getPreviousSibling(),S(e)&&(t.key=e.__key,t.offset=e.getTextContent().length)):N(n)&&!r&&n.isInline()?(t.key=n.__key,t.offset=n.getChildrenSize(),t.type="element"):S(n)&&(t.key=n.__key,t.offset=n.getTextContent().length)):n===i.getTextContent().length&&(n=i.getNextSibling(),i=i.getParent(),e&&N(n)&&n.isInline()?(t.key=n.__key,t.offset=0,t.type="element"):(r||e)&&n===null&&N(i)&&i.isInline()&&!i.canInsertTextAfter()&&(e=i.getNextSibling(),S(e)&&(t.key=e.__key,t.offset=0)))}function ea(t,e,r){if(t.type==="text"&&e.type==="text"){var n=t.isBefore(e);let i=t.is(e);hl(t,n,i),hl(e,!n,i),i&&(e.key=t.key,e.offset=t.offset,e.type=t.type),n=j(),n.isComposing()&&n._compositionKey!==t.key&&D(r)&&(n=r.anchor,r=r.focus,dt(t,n.key,n.offset,n.type),dt(e,r.key,r.offset,r.type))}}function ta(t,e,r,n,i,o){return t===null||r===null||!Br(i,t,r)||(e=cl(t,e,D(o)?o.anchor:null,i),e===null)||(n=cl(r,n,D(o)?o.focus:null,i),n===null||e.type==="element"&&n.type==="element"&&(t=Vt(t),r=Vt(r),J(t)&&J(r)))?null:(ea(e,n,o),[e,n])}function ra(t,e,r,n,i,o){let l=Ve();return t=new yt(ze(t,e,i),ze(r,n,o),0,""),t.dirty=!0,l._selection=t}function zi(){return new Bn(new Set)}function Ru(t){let e=t.getEditorState()._selection,r=Ue(t._window);return D(e)||e==null?po(e,r,t,null):e.clone()}function po(t,e,r,n){var i=r._window;if(i===null)return null;var o=(i=n||i.event)?i.type:void 0;n=o==="selectionchange",i=!vi&&(n||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let l;if(!D(t)||i){if(e===null)return null;if(i=e.anchorNode,o=e.focusNode,l=e.anchorOffset,e=e.focusOffset,n&&D(t)&&!Br(r,i,o))return t.clone()}else return t.clone();if(r=ta(i,l,o,e,r,t),r===null)return null;let[s,a]=r;return new yt(s,a,D(t)?t.format:0,D(t)?t.style:"")}function B(){return Ve()._selection}function sr(){return j()._editorState._selection}function En(t,e,r,n=1){var i=t.anchor,o=t.focus,l=i.getNode(),s=o.getNode();if(e.is(l)||e.is(s)){if(l=e.__key,t.isCollapsed())e=i.offset,(r<=e&&0<n||r<e&&0>n)&&(r=Math.max(0,e+n),i.set(l,r,"element"),o.set(l,r,"element"),gl(t));else{let d=t.isBackward();s=d?o:i;var a=s.getNode();i=d?i:o,o=i.getNode(),e.is(a)&&(a=s.offset,(r<=a&&0<n||r<a&&0>n)&&s.set(l,Math.max(0,a+n),"element")),e.is(o)&&(e=i.offset,(r<=e&&0<n||r<e&&0>n)&&i.set(l,Math.max(0,e+n),"element"))}gl(t)}}function gl(t){var e=t.anchor,r=e.offset;let n=t.focus;var i=n.offset,o=e.getNode(),l=n.getNode();if(t.isCollapsed())N(o)&&(l=o.getChildrenSize(),l=(i=r>=l)?o.getChildAtIndex(l-1):o.getChildAtIndex(r),S(l)&&(r=0,i&&(r=l.getTextContentSize()),e.set(l.__key,r,"text"),n.set(l.__key,r,"text")));else{if(N(o)){let s=o.getChildrenSize();r=(t=r>=s)?o.getChildAtIndex(s-1):o.getChildAtIndex(r),S(r)&&(o=0,t&&(o=r.getTextContentSize()),e.set(r.__key,o,"text"))}N(l)&&(r=l.getChildrenSize(),i=(e=i>=r)?l.getChildAtIndex(r-1):l.getChildAtIndex(i),S(i)&&(l=0,e&&(l=i.getTextContentSize()),n.set(i.__key,l,"text")))}}function Du(t,e){if(e=e.getEditorState()._selection,t=t._selection,D(t)){var r=t.anchor;let n=t.focus,i;r.type==="text"&&(i=r.getNode(),i.selectionTransform(e,t)),n.type==="text"&&(r=n.getNode(),i!==r&&r.selectionTransform(e,t))}}function Tn(t,e,r,n,i){let o=null,l=0,s=null;n!==null?(o=n.__key,S(n)?(l=n.getTextContentSize(),s="text"):N(n)&&(l=n.getChildrenSize(),s="element")):i!==null&&(o=i.__key,S(i)?s="text":N(i)&&(s="element")),o!==null&&s!==null?t.set(o,l,s):(l=e.getIndexWithinParent(),l===-1&&(l=r.getChildrenSize()),t.set(r.__key,l,"element"))}function fl(t,e,r,n,i){t.type==="text"?(t.key=r,e||(t.offset+=i)):t.offset>n.getIndexWithinParent()&&--t.offset}function na(t){t instanceof Co||(t instanceof Hr?(t=tl(t,jt),jt(t)||T(114)):(t=tl(t.getNode(),jt),jt(t)||T(114)));let e=t.getParent();yo(e)||T(115);let r=e.getParent();return da(r)||T(116),[t,e,r]}function hi(t){t.isCollapsed()||t.removeText();var e=t.anchor;for(t=e.getNode(),e=e.offset;!Wt(t);)[t,e]=Au(t,e);return e}function Au(t,e){var r=t.getParent();if(!r)return r=rt(),Te().append(r),r.select(),[Te(),0];if(S(t)){var n=t.splitText(e);return n.length===0?[r,t.getIndexWithinParent()]:(t=e===0?0:1,t=n[0].getIndexWithinParent()+t,[r,t])}return!N(t)||e===0?[r,t.getIndexWithinParent()]:((n=t.getChildAtIndex(e))&&(e=new yt(ze(t.__key,e,"element"),ze(t.__key,e,"element"),0,""),(e=t.insertNewAfter(e))&&e.append(n,...n.getNextSiblings())),[r,t.getIndexWithinParent()+1])}function ku(t){let e=rt(),r=null;for(let n=0;n<t.length;n++){let i=t[n],o=Mt(i);if(o||J(i)&&i.isInline()||N(i)&&i.isInline()||S(i)||i.isParentRequired()){if(r===null&&(r=i.createParentElementNode(),e.append(r),o))continue;r!==null&&r.append(i)}else e.append(i),r=null}return e}let ne=null,ie=null,Ee=!1,gi=!1,br=0,pl={characterData:!0,childList:!0,subtree:!0};function ar(){return Ee||ne!==null&&ne._readOnly}function Ne(){Ee&&T(13)}function Ve(){return ne===null&&T(15),ne}function j(){return ie===null&&T(16),ie}function _l(t,e,r){var n=e.__type;let i=t._nodes.get(n);for(i===void 0&&T(30,n),t=r.get(n),t===void 0&&(t=Array.from(i.transforms),r.set(n,t)),r=t.length,n=0;n<r&&(t[n](e),e.isAttached());n++);}function Iu(t,e){e=e._dirtyLeaves,t=t._nodeMap;for(let r of e)e=t.get(r),S(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&Ms(e)}function Pu(t,e){let r=e._dirtyLeaves,n=e._dirtyElements;t=t._nodeMap;let i=ct(),o=new Map;var l=r;let s=l.size;for(var a=n,d=a.size;0<s||0<d;){if(0<s){e._dirtyLeaves=new Set;for(let u of l)l=t.get(u),S(l)&&l.isAttached()&&l.isSimpleText()&&!l.isUnmergeable()&&Ms(l),l!==void 0&&l!==void 0&&l.__key!==i&&l.isAttached()&&_l(e,l,o),r.add(u);if(l=e._dirtyLeaves,s=l.size,0<s){br++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(let u of a)a=u[0],d=u[1],(a==="root"||d)&&(l=t.get(a),l!==void 0&&l!==void 0&&l.__key!==i&&l.isAttached()&&_l(e,l,o),n.set(a,d));l=e._dirtyLeaves,s=l.size,a=e._dirtyElements,d=a.size,br++}e._dirtyLeaves=r,e._dirtyElements=n}function _o(t,e){var r=t.type,n=e.get(r);if(n===void 0&&T(17,r),r=n.klass,t.type!==r.getType()&&T(18,r.name),r=r.importJSON(t),t=t.children,N(r)&&Array.isArray(t))for(n=0;n<t.length;n++){let i=_o(t[n],e);r.append(i)}return r}function ml(t,e){let r=ne,n=Ee,i=ie;ne=t,Ee=!0,ie=null;try{return e()}finally{ne=r,Ee=n,ie=i}}function Ot(t,e){let r=t._pendingEditorState,n=t._rootElement,i=t._headless||n===null;if(r!==null){var o=t._editorState,l=o._selection,s=r._selection,a=t._dirtyType!==0,d=ne,u=Ee,h=ie,c=t._updating,g=t._observer,f=null;if(t._pendingEditorState=null,t._editorState=r,!i&&a&&g!==null){ie=t,ne=r,Ee=!1,t._updating=!0;try{let V=t._dirtyType,pe=t._dirtyElements,_e=t._dirtyLeaves;g.disconnect();var p=V,y=pe,v=_e;ye=Qe=ee="",Bs=p===2,cn=null,fe=t,pt=t._config,Ir=t._nodes,zn=fe._listeners.mutation,wi=y,Oi=v,$t=o._nodeMap,_t=r._nodeMap,ho=r._readOnly,$i=new Map(t._keyToDOMMap);let Fe=new Map;Pr=Fe,_r("root",null),Pr=$i=pt=_t=$t=Oi=wi=Ir=fe=void 0,f=Fe}catch(V){if(V instanceof Error&&t._onError(V),gi)throw V;sa(t,null,n,r),$s(t),t._dirtyType=2,gi=!0,Ot(t,o),gi=!1;return}finally{g.observe(n,pl),t._updating=c,ne=d,Ee=u,ie=h}}r._readOnly||(r._readOnly=!0);var M=t._dirtyLeaves,R=t._dirtyElements,b=t._normalizedNodes,re=t._updateTags,K=t._deferred;a&&(t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set);var Le=t._decorators,se=t._pendingDecorators||Le,Nt=r._nodeMap,Je;for(Je in se)Nt.has(Je)||(se===Le&&(se=ks(t)),delete se[Je]);var Se=i?null:Ue(t._window);if(t._editable&&Se!==null&&(a||s===null||s.dirty)){ie=t,ne=r;try{if(g!==null&&g.disconnect(),a||s===null||s.dirty){let V=t._blockCursorElement;V!==null&&Si(V,t,n);e:{let pe=Se.anchorNode,_e=Se.focusNode,Fe=Se.anchorOffset,gr=Se.focusOffset,Re=document.activeElement;if(!(re.has("collaboration")&&Re!==n||Re!==null&&oo(Re)))if(D(s)){var vt=s.anchor,Xe=s.focus,Ko=vt.key,pd=Xe.key,Wo=Nn(t,Ko),Ho=Nn(t,pd),Xr=vt.offset,Yo=Xe.offset,Xn=s.format,Zn=s.style,Go=s.isCollapsed(),hr=Wo,Zr=Ho,qn=!1;if(vt.type==="text"){hr=mn(Wo);let De=vt.getNode();qn=De.getFormat()!==Xn||De.getStyle()!==Zn}else D(l)&&l.anchor.type==="text"&&(qn=!0);if(Xe.type==="text"&&(Zr=mn(Ho)),hr!==null&&Zr!==null){if(Go&&(l===null||qn||D(l)&&(l.format!==Xn||l.style!==Zn))){var _d=performance.now();js=[Xn,Zn,Xr,Ko,_d]}if(Fe===Xr&&gr===Yo&&pe===hr&&_e===Zr&&(Se.type!=="Range"||!Go)&&(Re!==null&&n.contains(Re)||n.focus({preventScroll:!0}),vt.type!=="element"))break e;try{Se.setBaseAndExtent(hr,Xr,Zr,Yo)}catch{}if(!re.has("skip-scroll-into-view")&&s.isCollapsed()&&n!==null&&n===document.activeElement){let De=s instanceof yt&&s.anchor.type==="element"?hr.childNodes[Xr]||null:0<Se.rangeCount?Se.getRangeAt(0):null;if(De!==null){let Ae;if(De instanceof Text){let we=document.createRange();we.selectNode(De),Ae=we.getBoundingClientRect()}else Ae=De.getBoundingClientRect();let lt=n.ownerDocument,xt=lt.defaultView;if(xt!==null)for(var{top:Qn,bottom:ei}=Ae,qr,Qr,ot=n;ot!==null;){let we=ot===lt.body;if(we)qr=0,Qr=Ln(t).innerHeight;else{let en=ot.getBoundingClientRect();qr=en.top,Qr=en.bottom}let Et=0;if(Qn<qr?Et=-(qr-Qn):ei>Qr&&(Et=ei-Qr),Et!==0)if(we)xt.scrollBy(0,Et);else{let en=ot.scrollTop;ot.scrollTop+=Et;let jo=ot.scrollTop-en;Qn-=jo,ei-=jo}if(we)break;ot=Pn(ot)}}}ki=!0}}else l!==null&&Br(t,pe,_e)&&Se.removeAllRanges()}}e:{let V=t._blockCursorElement;if(D(s)&&s.isCollapsed()&&s.anchor.type==="element"&&n.contains(document.activeElement)){let pe=s.anchor,_e=pe.getNode(),Fe=pe.offset,gr=_e.getChildrenSize(),Re=!1,De=null;if(Fe===gr){let Ae=_e.getChildAtIndex(Fe-1);ii(Ae)&&(Re=!0)}else{let Ae=_e.getChildAtIndex(Fe);if(ii(Ae)){let lt=Ae.getPreviousSibling();(lt===null||ii(lt))&&(Re=!0,De=t.getElementByKey(Ae.__key))}}if(Re){let Ae=t.getElementByKey(_e.__key);if(V===null){let lt=t._config.theme,xt=document.createElement("div");xt.contentEditable="false",xt.setAttribute("data-lexical-cursor","true");let we=lt.blockCursor;if(we!==void 0){if(typeof we=="string"){let Et=we.split(" ");we=lt.blockCursor=Et}we!==void 0&&xt.classList.add(...we)}t._blockCursorElement=V=xt}n.style.caretColor="transparent",De===null?Ae.appendChild(V):Ae.insertBefore(V,De);break e}}V!==null&&Si(V,t,n)}g!==null&&g.observe(n,pl)}finally{ie=h,ne=d}}if(f!==null){var md=f;let V=Array.from(t._listeners.mutation),pe=V.length;for(let _e=0;_e<pe;_e++){let[Fe,gr]=V[_e],Re=md.get(gr);Re!==void 0&&Fe(Re,{dirtyLeaves:M,prevEditorState:o,updateTags:re})}}D(s)||s===null||l!==null&&l.is(s)||t.dispatchCommand(An,void 0);var ti=t._pendingDecorators;ti!==null&&(t._decorators=ti,t._pendingDecorators=null,$r("decorator",t,!0,ti));var Cd=Qo(e||o),Uo=Qo(r);if(Cd!==Uo&&$r("textcontent",t,!0,Uo),$r("update",t,!0,{dirtyElements:R,dirtyLeaves:M,editorState:r,normalizedNodes:b,prevEditorState:e||o,tags:re}),t._deferred=[],K.length!==0){let V=t._updating;t._updating=!0;try{for(let pe=0;pe<K.length;pe++)K[pe]()}finally{t._updating=V}}var Vo=t._updates;if(Vo.length!==0){let V=Vo.shift();if(V){let[pe,_e]=V;ia(t,pe,_e)}}}}function $r(t,e,r,...n){let i=e._updating;e._updating=r;try{let o=Array.from(e._listeners[t]);for(t=0;t<o.length;t++)o[t].apply(null,n)}finally{e._updating=i}}function x(t,e,r){if(t._updating===!1||ie!==t){let o=!1;return t.update(()=>{o=x(t,e,r)}),o}let n=so(t);for(let o=4;0<=o;o--)for(let l=0;l<n.length;l++){var i=n[l]._commands.get(e);if(i!==void 0&&(i=i[o],i!==void 0)){i=Array.from(i);let s=i.length;for(let a=0;a<s;a++)if(i[a](r,t)===!0)return!0}}return!1}function Cl(t,e){let r=t._updates;for(e=e||!1;r.length!==0;){var n=r.shift();if(n){let[i,o]=n,l;o!==void 0&&(n=o.onUpdate,l=o.tag,o.skipTransforms&&(e=!0),n&&t._deferred.push(n),l&&t._updateTags.add(l)),i()}}return e}function ia(t,e,r){let n=t._updateTags;var i,o=i=!1;if(r!==void 0){var l=r.onUpdate;i=r.tag,i!=null&&n.add(i),i=r.skipTransforms||!1,o=r.discrete||!1}l&&t._deferred.push(l),r=t._editorState,l=t._pendingEditorState;let s=!1;(l===null||l._readOnly)&&(l=t._pendingEditorState=new Kn(new Map((l||r)._nodeMap)),s=!0),l._flushSync=o,o=ne;let a=Ee,d=ie,u=t._updating;ne=l,Ee=!1,t._updating=!0,ie=t;try{s&&(t._headless?r._selection!=null&&(l._selection=r._selection.clone()):l._selection=Ru(t));let h=t._compositionKey;e(),i=Cl(t,i),Du(l,t),t._dirtyType!==0&&(i?Iu(l,t):Pu(l,t),Cl(t),hu(r,l,t._dirtyLeaves,t._dirtyElements)),h!==t._compositionKey&&(l._flushSync=!0);let c=l._selection;if(D(c)){let g=l._nodeMap,f=c.focus.key;g.get(c.anchor.key)!==void 0&&g.get(f)!==void 0||T(19)}else Yr(c)&&c._nodes.size===0&&(l._selection=null)}catch(h){h instanceof Error&&t._onError(h),t._pendingEditorState=r,t._dirtyType=2,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),Ot(t);return}finally{ne=o,Ee=a,ie=d,t._updating=u,br=0}t._dirtyType!==0||Lu(l,t)?l._flushSync?(l._flushSync=!1,Ot(t)):s&&du(()=>{Ot(t)}):(l._flushSync=!1,s&&(n.clear(),t._deferred=[],t._pendingEditorState=null))}function Me(t,e,r){t._updating?t._updates.push([e,r]):ia(t,e,r)}class oa extends Hr{constructor(e){super(e)}decorate(){T(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function J(t){return t instanceof oa}class Pt extends Hr{constructor(e){super(e),this.__last=this.__first=null,this.__indent=this.__format=this.__size=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return nu[e]||""}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getChildrenKeys(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r.__key),r=r.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=j()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(e)}getAllTextNodes(){let e=[],r=this.getFirstChild();for(;r!==null;){if(S(r)&&e.push(r),N(r)){let n=r.getAllTextNodes();e.push(...n)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;e!==null;){if(N(e)){let r=e.getFirstChild();if(r!==null){e=r;continue}}break}return e}getLastDescendant(){let e=this.getLastChild();for(;e!==null;){if(N(e)){let r=e.getLastChild();if(r!==null){e=r;continue}}break}return e}getDescendantByIndex(e){let r=this.getChildren(),n=r.length;return e>=n?(e=r[n-1],N(e)&&e.getLastDescendant()||e||null):(e=r[e],N(e)&&e.getFirstDescendant()||e||null)}getFirstChild(){let e=this.getLatest().__first;return e===null?null:ge(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&T(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:ge(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&T(96,this.__key),e}getChildAtIndex(e){var r=this.getChildrenSize();let n;if(e<r/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),--r;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="",r=this.getChildren(),n=r.length;for(let i=0;i<n;i++){let o=r[i];e+=o.getTextContent(),N(o)&&i!==n-1&&!o.isInline()&&(e+=` `)}return e}getTextContentSize(){let e=0,r=this.getChildren(),n=r.length;for(let i=0;i<n;i++){let o=r[i];e+=o.getTextContentSize(),N(o)&&i!==n-1&&!o.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){return e!==""?(e=Jo[e],(this.getFormat()&e)!==0):!1}select(e,r){Ne();let n=B(),i=e,o=r;var l=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){if(e=this.getFirstChild(),S(e)||N(e))return e.select(0,0)}else if(!(e!==void 0&&e!==l||r!==void 0&&r!==l)&&(e=this.getLastChild(),S(e)||N(e)))return e.select()}if(i===void 0&&(i=l),o===void 0&&(o=l),l=this.__key,D(n))n.anchor.set(l,i,"element"),n.focus.set(l,o,"element"),n.dirty=!0;else return ra(l,i,l,o,"element","element");return n}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let r=this.getWritable();return r.__dir=e,r}setFormat(e){return this.getWritable().__format=e!==""?Jo[e]:0,this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,r,n){let i=n.length,o=this.getChildrenSize(),l=this.getWritable(),s=l.__key;var a=[],d=[];let u=this.getChildAtIndex(e+r),h=null,c=o-r+i;if(e!==0)if(e===o)h=this.getLastChild();else{var g=this.getChildAtIndex(e);g!==null&&(h=g.getPreviousSibling())}if(0<r){var f=h===null?this.getFirstChild():h.getNextSibling();for(g=0;g<r;g++){f===null&&T(100);var p=f.getNextSibling(),y=f.__key;f=f.getWritable(),wt(f),d.push(y),f=p}}for(g=h,p=0;p<i;p++){y=n[p],g!==null&&y.is(g)&&(h=g=g.getPreviousSibling()),f=y.getWritable(),f.__parent===s&&c--,wt(f);let v=y.__key;g===null?(l.__first=v,f.__prev=null):(g=g.getWritable(),g.__next=v,f.__prev=g.__key),y.__key===s&&T(76),f.__parent=s,a.push(v),g=y}if(e+r===o?g!==null&&(g.getWritable().__next=null,l.__last=g.__key):u!==null&&(e=u.getWritable(),g!==null?(r=g.getWritable(),e.__prev=g.__key,r.__next=u.__key):e.__prev=null),l.__size=c,d.length&&(e=B(),D(e))){d=new Set(d),a=new Set(a);let{anchor:v,focus:M}=e;yl(v,d,a)&&Tn(v,v.getNode(),this,h,u),yl(M,d,a)&&Tn(M,M.getNode(),this,h,u),c!==0||this.canBeEmpty()||ft(this)||this.remove()}return l}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function N(t){return t instanceof Pt}function yl(t,e,r){for(t=t.getNode();t;){let n=t.__key;if(e.has(n)&&!r.has(n))return!0;t=t.getParent()}return!1}class dr extends Pt{static getType(){return"root"}static clone(){return new dr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){T(51)}getTextContent(){let e=this.__cachedText;return!ar()&&j()._dirtyType!==0||e===null?super.getTextContent():e}remove(){T(52)}replace(){T(53)}insertBefore(){T(54)}insertAfter(){T(55)}updateDOM(){return!1}append(...e){for(let r=0;r<e.length;r++){let n=e[r];N(n)||J(n)||T(56)}return super.append(...e)}static importJSON(e){let r=Te();return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Oe(t){return t instanceof dr}function Lu(t,e){if(e=e.getEditorState()._selection,t=t._selection,t!==null){if(t.dirty||!t.is(e))return!0}else if(e!==null)return!0;return!1}function mo(){return new Kn(new Map([["root",new dr]]))}function la(t){let e=t.exportJSON();var r=t.constructor;if(e.type!==r.getType()&&T(130,r.name),N(t)){let n=e.children;for(Array.isArray(n)||T(59,r.name),t=t.getChildren(),r=0;r<t.length;r++){let i=la(t[r]);n.push(i)}}return e}class Kn{constructor(e,r){this._nodeMap=e,this._selection=r||null,this._readOnly=this._flushSync=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e){return ml(this,e)}clone(e){return e=new Kn(this._nodeMap,e===void 0?this._selection:e),e._readOnly=!0,e}toJSON(){return ml(this,()=>({root:la(Te())}))}}class ur extends Pt{static getType(){return"paragraph"}static clone(e){return new ur(e.__key)}createDOM(e){let r=document.createElement("p");return e=Sr(e.theme,"paragraph"),e!==void 0&&r.classList.add(...e),r}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:bu,priority:0})}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&bn(e)){this.isEmpty()&&e.append(document.createElement("br"));var r=this.getFormatType();e.style.textAlign=r,(r=this.getDirection())&&(e.dir=r),r=this.getIndent(),0<r&&(e.style.textIndent=`${20*r}px`)}return{element:e}}static importJSON(e){let r=rt();return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(e,r){e=rt();let n=this.getDirection();return e.setDirection(n),this.insertAfter(e,r),e}collapseAtStart(){let e=this.getChildren();if(e.length===0||S(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function bu(t){let e=rt();return t.style&&(e.setFormat(t.style.textAlign),t=parseInt(t.style.textIndent,10)/20,0<t&&e.setIndent(t)),{node:e}}function rt(){return Wr(new ur)}function sa(t,e,r,n){let i=t._keyToDOMMap;i.clear(),t._editorState=mo(),t._pendingEditorState=n,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null,n=t._observer,n!==null&&(n.disconnect(),t._observer=null),e!==null&&(e.textContent=""),r!==null&&(r.textContent="",i.set("root",r))}function zu(t,e){let r=new Map,n=new Set,i=o=>{Object.keys(o).forEach(l=>{let s=r.get(l);s===void 0&&(s=[],r.set(l,s)),s.push(o[l])})};return t.forEach(o=>{o=o.klass.importDOM!=null?o.klass.importDOM.bind(o.klass):null,o==null||n.has(o)||(n.add(o),o=o(),o!==null&&i(o))}),e&&i(e),r}class Fu{constructor(e,r,n,i,o,l,s){this._parentEditor=r,this._rootElement=null,this._editorState=e,this._compositionKey=this._pendingEditorState=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ps(),this._onError=o,this._htmlConversions=l,this._editable=s,this._headless=r!==null&&r._headless,this._blockCursorElement=this._window=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let r=this._listeners.update;return r.add(e),()=>{r.delete(e)}}registerEditableListener(e){let r=this._listeners.editable;return r.add(e),()=>{r.delete(e)}}registerDecoratorListener(e){let r=this._listeners.decorator;return r.add(e),()=>{r.delete(e)}}registerTextContentListener(e){let r=this._listeners.textcontent;return r.add(e),()=>{r.delete(e)}}registerRootListener(e){let r=this._listeners.root;return e(this._rootElement,null),r.add(e),()=>{e(null,this._rootElement),r.delete(e)}}registerCommand(e,r,n){n===void 0&&T(35);let i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);let o=i.get(e);o===void 0&&T(36,String(e));let l=o[n];return l.add(r),()=>{l.delete(r),o.every(s=>s.size===0)&&i.delete(e)}}registerMutationListener(e,r){this._nodes.get(e.getType())===void 0&&T(37,e.name);let n=this._listeners.mutation;return n.set(r,e),()=>{n.delete(r)}}registerNodeTransformToKlass(e,r){var n=e.getType();return n=this._nodes.get(n),n===void 0&&T(37,e.name),n.transforms.add(r),n}registerNodeTransform(e,r){var n=this.registerNodeTransformToKlass(e,r);let i=[n];return n=n.replaceWithKlass,n!=null&&(n=this.registerNodeTransformToKlass(n,r),i.push(n)),uu(this,e.getType()),()=>{i.forEach(o=>o.transforms.delete(r))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,r){return x(this,e,r)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let r=this._rootElement;if(e!==r){let l=Sr(this._config.theme,"root");var n=this._pendingEditorState||this._editorState;if(this._rootElement=e,sa(this,r,e,n),r!==null){if(!this._config.disableEvents){wr!==0&&(wr--,wr===0&&r.ownerDocument.removeEventListener("selectionchange",qs));var i=r.__lexicalEditor;if(i!=null){if(i._parentEditor!==null){var o=so(i);o=o[o.length-1]._key,tr.get(o)===i&&tr.delete(o)}else tr.delete(i._key);r.__lexicalEditor=null}for(i=Zs(r),o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}l!=null&&r.classList.remove(...l)}e!==null?(n=(n=e.ownerDocument)&&n.defaultView||null,i=e.style,i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=n,this._dirtyType=2,$s(this),this._updateTags.add("history-merge"),Ot(this),this._config.disableEvents||vu(e,this),l!=null&&e.classList.add(...l)):(this._editorState=n,this._window=this._pendingEditorState=null),$r("root",this,!1,e,r)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,r){e.isEmpty()&&T(38),Os(this);let n=this._pendingEditorState,i=this._updateTags;r=r!==void 0?r.tag:null,n===null||n.isEmpty()||(r!=null&&i.add(r),Ot(this)),this._pendingEditorState=e,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,r!=null&&i.add(r),Ot(this)}parseEditorState(e,r){e=typeof e=="string"?JSON.parse(e):e;let n=mo(),i=ne,o=Ee,l=ie,s=this._dirtyElements,a=this._dirtyLeaves,d=this._cloneNotNeeded,u=this._dirtyType;this._dirtyElements=new Map,this._dirtyLeaves=new Set,this._cloneNotNeeded=new Set,this._dirtyType=0,ne=n,Ee=!1,ie=this;try{_o(e.root,this._nodes),r&&r(),n._readOnly=!0}catch(h){h instanceof Error&&this._onError(h)}finally{this._dirtyElements=s,this._dirtyLeaves=a,this._cloneNotNeeded=d,this._dirtyType=u,ne=i,Ee=o,ie=l}return n}update(e,r){Me(this,e,r)}focus(e,r={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),Me(this,()=>{let i=B(),o=Te();i!==null?i.dirty=!0:o.getChildrenSize()!==0&&(r.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){var e=this._rootElement;e!==null&&e.blur(),e=Ue(this._window),e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,$r("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Co extends Pt{constructor(e,r){super(r),this.__colSpan=e,this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}}function jt(t){return t instanceof Co}class aa extends Pt{}function da(t){return t instanceof aa}class ua extends Pt{}function yo(t){return t instanceof ua}C.$INTERNAL_isPointSelection=fo;C.$addUpdateTag=function(t){Ne(),j()._updateTags.add(t)};C.$applyNodeReplacement=Wr;C.$copyNode=zs;C.$createLineBreakNode=nr;C.$createNodeSelection=zi;C.$createParagraphNode=rt;C.$createPoint=ze;C.$createRangeSelection=function(){let t=ze("root",0,"element"),e=ze("root",0,"element");return new yt(t,e,0,"")};C.$createTabNode=Fn;C.$createTextNode=de;C.$getAdjacentNode=Ti;C.$getNearestNodeFromDOMNode=Kr;C.$getNearestRootOrShadowRoot=bs;C.$getNodeByKey=ge;C.$getPreviousSelection=sr;C.$getRoot=Te;C.$getSelection=B;C.$getTextContent=function(){let t=B();return t===null?"":t.getTextContent()};C.$hasAncestor=vn;C.$hasUpdateTag=function(t){return j()._updateTags.has(t)};C.$insertNodes=function(t){let e=B()||sr();e===null&&(e=Te().selectEnd()),e.insertNodes(t)};C.$isBlockElementNode=function(t){return N(t)&&!t.isInline()};C.$isDecoratorNode=J;C.$isElementNode=N;C.$isInlineElementOrDecoratorNode=function(t){return N(t)&&t.isInline()||J(t)&&t.isInline()};C.$isLeafNode=function(t){return S(t)||Mt(t)||J(t)};C.$isLineBreakNode=Mt;C.$isNodeSelection=Yr;C.$isParagraphNode=function(t){return t instanceof ur};C.$isRangeSelection=D;C.$isRootNode=Oe;C.$isRootOrShadowRoot=ft;C.$isTabNode=Qs;C.$isTextNode=S;C.$nodesOfType=function(t){var e=Ve();let r=e._readOnly,n=t.getType();e=e._nodeMap;let i=[];for(let[,o]of e)o instanceof t&&o.__type===n&&(r||o.isAttached())&&i.push(o);return i};C.$normalizeSelection__EXPERIMENTAL=Rs;C.$parseSerializedNode=function(t){return _o(t,j()._nodes)};C.$selectAll=function(){var t=Te();t=t.select(0,t.getChildrenSize()),Ye(Rs(t))};C.$setCompositionKey=te;C.$setSelection=Ye;C.$splitNode=function(t,e){let r=t.getChildAtIndex(e);r==null&&(r=t),ft(t)&&T(102);let n=l=>{const s=l.getParentOrThrow(),a=ft(s),d=l!==r||a?zs(l):l;if(a){if(!N(l)||!N(d))throw Error("Children of a root must be ElementNode");return l.insertAfter(d),[l,d,d]}const[u,h,c]=n(s);return l=l.getNextSiblings(),c.append(d,...l),[u,h,d]},[i,o]=n(r);return[i,o]};C.BLUR_COMMAND=Ts;C.CAN_REDO_COMMAND={};C.CAN_UNDO_COMMAND={};C.CLEAR_EDITOR_COMMAND={};C.CLEAR_HISTORY_COMMAND={};C.CLICK_COMMAND=ls;C.COMMAND_PRIORITY_CRITICAL=4;C.COMMAND_PRIORITY_EDITOR=0;C.COMMAND_PRIORITY_HIGH=3;C.COMMAND_PRIORITY_LOW=1;C.COMMAND_PRIORITY_NORMAL=2;C.CONTROLLED_TEXT_INSERTION_COMMAND=er;C.COPY_COMMAND=eo;C.CUT_COMMAND=to;C.DELETE_CHARACTER_COMMAND=Qt;C.DELETE_LINE_COMMAND=kr;C.DELETE_WORD_COMMAND=Ar;C.DEPRECATED_$computeGridMap=function(t,e,r){let n=[],i=null,o=null;t=t.getChildren();for(let u=0;u<t.length;u++){var l=t[u];yo(l)||T(108);var s=l.getChildren();l=0;for(let h of s){for(jt(h)||T(109);n[u]!==void 0&&n[u][l]!==void 0;)l++;s=u;var a=l,d=h;let c={cell:d,startColumn:a,startRow:s},g=d.__rowSpan,f=d.__colSpan;for(let p=0;p<g;p++){n[s+p]===void 0&&(n[s+p]=[]);for(let y=0;y<f;y++)n[s+p][a+y]=c}e.is(d)&&(i=c),r.is(d)&&(o=c),l+=h.__colSpan}}return i===null&&T(110),o===null&&T(111),[n,i,o]};C.DEPRECATED_$getGridCellNodeRect=function(t){let[e,,r]=na(t);t=r.getChildren();let n=t.length;var i=t[0].getChildren().length;let o=Array(n);for(var l=0;l<n;l++)o[l]=Array(i);for(i=0;i<n;i++){l=t[i].getChildren();let s=0;for(let a=0;a<l.length;a++){for(;o[i][s];)s++;let d=l[a],u=d.__rowSpan||1,h=d.__colSpan||1;for(let c=0;c<u;c++)for(let g=0;g<h;g++)o[i+c][s+g]=d;if(e===d)return{colSpan:h,columnIndex:s,rowIndex:i,rowSpan:u};s+=h}}return null};C.DEPRECATED_$getNodeTriplet=na;C.DEPRECATED_$isGridCellNode=jt;C.DEPRECATED_$isGridNode=da;C.DEPRECATED_$isGridRowNode=yo;C.DEPRECATED_GridCellNode=Co;C.DEPRECATED_GridNode=aa;C.DEPRECATED_GridRowNode=ua;C.DRAGEND_COMMAND=xs;C.DRAGOVER_COMMAND=vs;C.DRAGSTART_COMMAND=Ns;C.DROP_COMMAND=ys;C.DecoratorNode=oa;C.ElementNode=Pt;C.FOCUS_COMMAND=Es;C.FORMAT_ELEMENT_COMMAND={};C.FORMAT_TEXT_COMMAND=ut;C.INDENT_CONTENT_COMMAND={};C.INSERT_LINE_BREAK_COMMAND=Tr;C.INSERT_PARAGRAPH_COMMAND=Ci;C.INSERT_TAB_COMMAND={};C.INTERNAL_PointSelection=go;C.KEY_ARROW_DOWN_COMMAND=gs;C.KEY_ARROW_LEFT_COMMAND=us;C.KEY_ARROW_RIGHT_COMMAND=as;C.KEY_ARROW_UP_COMMAND=hs;C.KEY_BACKSPACE_COMMAND=ps;C.KEY_DELETE_COMMAND=ms;C.KEY_DOWN_COMMAND=ss;C.KEY_ENTER_COMMAND=pn;C.KEY_ESCAPE_COMMAND=_s;C.KEY_MODIFIER_COMMAND=Ss;C.KEY_SPACE_COMMAND=fs;C.KEY_TAB_COMMAND=Cs;C.LineBreakNode=or;C.MOVE_TO_END=ds;C.MOVE_TO_START=cs;C.OUTDENT_CONTENT_COMMAND={};C.PASTE_COMMAND=Zi;C.ParagraphNode=ur;C.REDO_COMMAND=Qi;C.REMOVE_TEXT_COMMAND=yi;C.RootNode=dr;C.SELECTION_CHANGE_COMMAND=An;C.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND={};C.SELECT_ALL_COMMAND=Ni;C.TabNode=lr;C.TextNode=It;C.UNDO_COMMAND=qi;C.createCommand=function(){return{}};C.createEditor=function(t){var e=t||{},r=ie,n=e.theme||{};let i=t===void 0?r:e.parentEditor||null,o=e.disableEvents||!1,l=mo(),s=e.namespace||(i!==null?i._config.namespace:Ps()),a=e.editorState,d=[dr,It,or,lr,ur,...e.nodes||[]],{onError:u,html:h}=e;if(e=e.editable!==void 0?e.editable:!0,t===void 0&&r!==null)t=r._nodes;else for(t=new Map,r=0;r<d.length;r++){let g=d[r],f=null;var c=null;typeof g!="function"&&(c=g,g=c.replace,f=c.with,c=c.withKlass||null);let p=g.getType(),y=g.transform(),v=new Set;y!==null&&v.add(y),t.set(p,{exportDOM:h&&h.export?h.export.get(g):void 0,klass:g,replace:f,replaceWithKlass:c,transforms:v})}return n=new Fu(l,i,t,{disableEvents:o,namespace:s,theme:n},u||console.error,zu(t,h?h.import:void 0),e),a!==void 0&&(n._pendingEditorState=a,n._dirtyType=2),n};C.getNearestEditorFromDOMNode=lo;C.isCurrentlyReadOnlyMode=ar;C.isHTMLAnchorElement=function(t){return bn(t)&&t.tagName==="A"};C.isHTMLElement=bn;C.isSelectionCapturedInDecoratorInput=oo;C.isSelectionWithinEditor=Br;const Bu=C;var O=Bu,Ce=O;function No(t,e=!0){return t?!1:(t=ca(),e&&(t=t.trim()),t==="")}function ca(){return Ce.$getRoot().getTextContent()}function ha(t){if(!No(t,!1))return!1;t=Ce.$getRoot().getChildren();let e=t.length;if(1<e)return!1;for(let n=0;n<e;n++){var r=t[n];if(Ce.$isDecoratorNode(r))return!1;if(Ce.$isElementNode(r)){if(!Ce.$isParagraphNode(r)||r.__indent!==0)return!1;r=r.getChildren();let i=r.length;for(let o=0;o<i;o++)if(!Ce.$isTextNode(r[n]))return!1}}return!0}Ct.$canShowPlaceholder=ha;Ct.$canShowPlaceholderCurry=function(t){return()=>ha(t)};Ct.$findTextIntersectionFromCharacters=function(t,e){var r=t.getFirstChild();t=0;e:for(;r!==null;){if(Ce.$isElementNode(r)){var n=r.getFirstChild();if(n!==null){r=n;continue}}else if(Ce.$isTextNode(r)){if(n=r.getTextContentSize(),t+n>e)return{node:r,offset:e-t};t+=n}if(n=r.getNextSibling(),n!==null)r=n;else{for(r=r.getParent();r!==null;){if(n=r.getNextSibling(),n!==null){r=n;continue e}r=r.getParent()}break}}return null};Ct.$isRootTextContentEmpty=No;Ct.$isRootTextContentEmptyCurry=function(t,e){return()=>No(t,e)};Ct.$rootTextContent=ca;Ct.registerLexicalTextEntity=function(t,e,r,n){let i=l=>{const s=Ce.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},o=t.registerNodeTransform(Ce.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),d=l;if(Ce.$isTextNode(s)){var u=s.getTextContent(),h=e(u+a);if(s instanceof r){if(h===null||s.getLatest().__mode!==0){i(s);return}if(h=h.end-u.length,0<h){d=a.slice(0,h),d=u+d,s.select(),s.setTextContent(d),h===a.length?l.remove():(s=a.slice(h),l.setTextContent(s));return}}else if(h===null||h.start<u.length)return}for(;;){if(l=e(a),a=h=l===null?"":a.slice(l.end),h===""){if(u=d.getNextSibling(),Ce.$isTextNode(u)){if(h=d.getTextContent()+u.getTextContent(),h=e(h),h===null){u instanceof r?i(u):u.markDirty();break}else if(h.start!==0)break}}else if(u=e(h),u!==null&&u.start===0)break;if(l===null)break;if(l.start===0&&Ce.$isTextNode(s)&&s.isTextEntity())continue;let c;if(l.start===0?[c,d]=d.splitText(l.end):[,c,d]=d.splitText(l.start,l.end),l=n(c),l.setFormat(c.getFormat()),c.replace(l),d==null)break}}});return t=t.registerNodeTransform(r,l=>{var s=l.getTextContent();const a=e(s);a===null||a.start!==0?i(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),Ce.$isTextNode(s)&&s.isTextEntity()&&(i(s),i(l)),s=l.getNextSibling(),Ce.$isTextNode(s)&&s.isTextEntity()&&(i(s),l instanceof r&&i(l)))}),[o,t]};const Ku=Ct;var Wu=Ku,X={},le={},w=O;let Sn=new Map;function Nl(t){for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function vl(t){let e=t.parentNode;if(e==null)throw Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function ga(t){let e={};t=t.split(";");for(let r of t)if(r!==""){let[n,i]=r.split(/:([^]+)/);n&&i&&(e[n.trim()]=i.trim())}return e}function wn(t){let e=Sn.get(t);return e===void 0&&(e=ga(t),Sn.set(t,e)),e}function Hu(t){let e="";for(let r in t)r&&(e+=`${r}: ${t[r]};`);return e}function bt(t,e){var r=wn("getStyle"in t?t.getStyle():t.style);e=Object.entries(e).reduce((n,[i,o])=>(o===null?delete n[i]:n[i]=o,n),{...r}),r=Hu(e),t.setStyle(r),Sn.set(r,e)}function fa(t,e){var r=t.getNodes(),n=r.length;if(w.$isRangeSelection(t)){--n;var i=r[0],o=r[n];if(t.isCollapsed()&&w.$isRangeSelection(t))bt(t,e);else{var l=t.anchor,s=t.focus,a=i.getTextContent().length,d=s.offset,u=l.offset,h=l.isBefore(s),c=h?u:d;t=h?d:u;var g=h?l.type:s.type,f=h?s.type:l.type;if(s=h?s.key:l.key,w.$isTextNode(i)&&c===a&&(h=i.getNextSibling(),w.$isTextNode(h)&&(c=u=0,i=h)),r.length===1)w.$isTextNode(i)&&(c=g==="element"?0:u>d?d:u,t=f==="element"?a:u>d?u:d,c!==t&&(c===0&&t===a?(bt(i,e),i.select(c,t)):(r=i.splitText(c,t),r=c===0?r[0]:r[1],bt(r,e),r.select(0,t-c))));else for(w.$isTextNode(i)&&c<i.getTextContentSize()&&(c!==0&&(i=i.splitText(c)[1],c=0,l.set(i.getKey(),c,"text")),bt(i,e)),w.$isTextNode(o)&&(c=o.getTextContent().length,o.__key!==s&&t!==0&&(t=c),t!==c&&([o]=o.splitText(t)),t!==0&&bt(o,e)),t=1;t<n;t++)c=r[t],l=c.getKey(),w.$isTextNode(c)&&l!==i.getKey()&&l!==o.getKey()&&!c.isToken()&&bt(c,e)}}else{for(i=w.$createRangeSelection(),o=i.anchor,c=i.focus,l=0;l<n;l++)a=r[l],w.DEPRECATED_$isGridCellNode(a)&&(o.set(a.getKey(),0,"element"),c.set(a.getKey(),a.getChildrenSize(),"element"),fa(w.$normalizeSelection__EXPERIMENTAL(i),e));w.$setSelection(t)}}function Yu(t){for(;t!==null&&!w.$isRootOrShadowRoot(t);){let e=t.getLatest(),r=t.getParent();e.getChildrenSize()===0&&t.remove(!0),t=r}}function fi(t,e,r,n,i=null){if(e.length!==0){var o=e[0],l=new Map,s=[];o=w.$isElementNode(o)?o:o.getParentOrThrow(),o.isInline()&&(o=o.getParentOrThrow());for(var a=!1;o!==null;){var d=o.getPreviousSibling();if(d!==null){o=d,a=!0;break}if(o=o.getParentOrThrow(),w.$isRootOrShadowRoot(o))break}d=new Set;for(var u=0;u<r;u++){var h=e[u];w.$isElementNode(h)&&h.getChildrenSize()===0&&d.add(h.getKey())}var c=new Set;for(u=0;u<r;u++){h=e[u];var g=h.getParent();if(g!==null&&g.isInline()&&(g=g.getParent()),g!==null&&w.$isLeafNode(h)&&!c.has(h.getKey())){if(h=g.getKey(),l.get(h)===void 0){let f=n();f.setFormat(g.getFormatType()),f.setIndent(g.getIndent()),s.push(f),l.set(h,f),g.getChildren().forEach(p=>{f.append(p),c.add(p.getKey()),w.$isElementNode(p)&&p.getChildrenKeys().forEach(y=>c.add(y))}),Yu(g)}}else if(d.has(h.getKey())){if(!w.$isElementNode(h))throw Error("Expected node in emptyElements to be an ElementNode");g=n(),g.setFormat(h.getFormatType()),g.setIndent(h.getIndent()),s.push(g),h.remove(!0)}}if(i!==null)for(e=0;e<s.length;e++)i.append(s[e]);if(e=null,w.$isRootOrShadowRoot(o))if(a)if(i!==null)o.insertAfter(i);else for(i=s.length-1;0<=i;i--)o.insertAfter(s[i]);else if(a=o.getFirstChild(),w.$isElementNode(a)&&(o=a),a===null)if(i)o.append(i);else for(i=0;i<s.length;i++)a=s[i],o.append(a),e=a;else if(i!==null)a.insertBefore(i);else for(o=0;o<s.length;o++)i=s[o],a.insertBefore(i),e=i;else if(i)o.insertAfter(i);else for(i=s.length-1;0<=i;i--)a=s[i],o.insertAfter(a),e=a;s=w.$getPreviousSelection(),w.$isRangeSelection(s)&&s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()?w.$setSelection(s.clone()):e!==null?e.selectEnd():t.dirty=!0}}function pa(t,e,r,n){t.modify(e?"extend":"move",r,n)}function _a(t){return t=t.anchor.getNode(),(w.$isRootNode(t)?t:t.getParentOrThrow()).getDirection()==="rtl"}function pi(t){if(w.$isDecoratorNode(t)&&!t.isInline())return!0;if(!w.$isElementNode(t)||w.$isRootOrShadowRoot(t))return!1;var e=t.getFirstChild();return e=e===null||w.$isLineBreakNode(e)||w.$isTextNode(e)||e.isInline(),!t.isInline()&&t.canBeEmpty()!==!1&&e}le.$addNodeStyle=function(t){t=t.getStyle();let e=ga(t);Sn.set(t,e)};le.$cloneWithProperties=function(t){let e=t.constructor.clone(t);return e.__parent=t.__parent,e.__next=t.__next,e.__prev=t.__prev,w.$isElementNode(t)&&w.$isElementNode(e)?(e.__first=t.__first,e.__last=t.__last,e.__size=t.__size,e.__format=t.__format,e.__indent=t.__indent,e.__dir=t.__dir,e):(w.$isTextNode(t)&&w.$isTextNode(e)&&(e.__format=t.__format,e.__style=t.__style,e.__mode=t.__mode,e.__detail=t.__detail),e)};le.$getSelectionStyleValueForProperty=function(t,e,r=""){let n=null,i=t.getNodes();var o=t.anchor,l=t.focus,s=t.isBackward();let a=s?l.offset:o.offset;if(o=s?l.getNode():o.getNode(),t.isCollapsed()&&t.style!==""&&(t=wn(t.style),t!==null&&e in t))return t[e];for(t=0;t<i.length;t++){var d=i[t];if((t===0||a!==0||!d.is(o))&&w.$isTextNode(d)){if(l=e,s=r,d=d.getStyle(),d=wn(d),l=d!==null&&d[l]||s,n===null)n=l;else if(n!==l){n="";break}}}return n===null?r:n};le.$isAtNodeEnd=function(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();if(!w.$isElementNode(e))throw Error("isAtNodeEnd: node must be a TextNode or ElementNode");return t.offset===e.getChildrenSize()};le.$isParentElementRTL=_a;le.$moveCaretSelection=pa;le.$moveCharacter=function(t,e,r){let n=_a(t);pa(t,e,r?!n:n,"character")};le.$patchStyleText=fa;le.$selectAll=function(t){let e=t.anchor;t=t.focus;var r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let n=r.getFirstDescendant();r=r.getLastDescendant();let i="element",o="element",l=0;w.$isTextNode(n)?i="text":w.$isElementNode(n)||n===null||(n=n.getParentOrThrow()),w.$isTextNode(r)?(o="text",l=r.getTextContentSize()):w.$isElementNode(r)||r===null||(r=r.getParentOrThrow()),n&&r&&(e.set(n.getKey(),0,i),t.set(r.getKey(),l,o))};le.$setBlocksType=function(t,e){if(t.anchor.key==="root"){e=e();var r=w.$getRoot();(t=r.getFirstChild())?t.replace(e,!0):r.append(e)}else{for(r=t.getNodes(),t=t.anchor.getNode();t!==null&&t.getParent()!==null&&!pi(t);)t=t.getParentOrThrow();for((t=pi(t)?t:null)&&r.indexOf(t)===-1&&r.push(t),t=0;t<r.length;t++){let n=r[t];if(!pi(n))continue;if(!w.$isElementNode(n))throw Error("Expected block node to be an ElementNode");let i=e();i.setFormat(n.getFormatType()),i.setIndent(n.getIndent()),n.replace(i,!0)}}};le.$shouldOverrideDefaultCharacterSelection=function(t,e){return t=w.$getAdjacentNode(t.focus,e),w.$isDecoratorNode(t)&&!t.isIsolated()||w.$isElementNode(t)&&!t.isInline()&&!t.canBeEmpty()};le.$sliceSelectedTextNodeContent=function(t,e){if(e.isSelected(t)&&!e.isSegmented()&&!e.isToken()&&w.$INTERNAL_isPointSelection(t)){var r=t.anchor.getNode(),n=t.focus.getNode(),i=e.is(r),o=e.is(n);if(i||o){i=t.isBackward();let[l,s]=t.getCharacterOffsets();t=r.is(n),o=e.is(i?n:r),n=e.is(i?r:n),r=0;let a;t?(r=l>s?s:l,a=l>s?l:s):o?(r=i?s:l,a=void 0):n&&(i=i?l:s,r=0,a=i),e.__text=e.__text.slice(r,a)}}return e};le.$wrapNodes=function(t,e,r=null){var n=t.getNodes();let i=n.length;var o=t.anchor;if(i===0||i===1&&o.type==="element"&&o.getNode().getChildrenSize()===0){t=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),n=t.getChildren();let s=e();s.setFormat(t.getFormatType()),s.setIndent(t.getIndent()),n.forEach(a=>s.append(a)),r&&(s=r.append(s)),t.replace(s)}else{o=null;var l=[];for(let s=0;s<i;s++){let a=n[s];w.$isRootOrShadowRoot(a)?(fi(t,l,l.length,e,r),l=[],o=a):o===null||o!==null&&w.$hasAncestor(a,o)?l.push(a):(fi(t,l,l.length,e,r),l=[a])}fi(t,l,l.length,e,r)}};le.createDOMRange=function(t,e,r,n,i){let o=e.getKey(),l=n.getKey(),s=document.createRange(),a=t.getElementByKey(o);if(t=t.getElementByKey(l),w.$isTextNode(e)&&(a=Nl(a)),w.$isTextNode(n)&&(t=Nl(t)),e===void 0||n===void 0||a===null||t===null)return null;a.nodeName==="BR"&&([a,r]=vl(a)),t.nodeName==="BR"&&([t,i]=vl(t)),e=a.firstChild,a===t&&e!=null&&e.nodeName==="BR"&&r===0&&i===0&&(i=1);try{s.setStart(a,r),s.setEnd(t,i)}catch{return null}return!s.collapsed||r===i&&o===l||(s.setStart(t,i),s.setEnd(a,r)),s};le.createRectsFromDOMRange=function(t,e){var r=t.getRootElement();if(r===null)return[];t=r.getBoundingClientRect(),r=getComputedStyle(r),r=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),e=Array.from(e.getClientRects());let n=e.length;e.sort((o,l)=>{let s=o.top-l.top;return 3>=Math.abs(s)?o.left-l.left:s});let i;for(let o=0;o<n;o++){let l=e[o],s=l.width+r===t.width;i&&i.top<=l.top&&i.top+i.height>l.top&&i.left+i.width>l.left||s?(e.splice(o--,1),n--):i=l}return e};le.getStyleObjectFromCSS=wn;le.trimTextContentFromAnchor=function(t,e,r){let n=e.getNode();if(w.$isElementNode(n)){var i=n.getDescendantByIndex(e.offset);i!==null&&(n=i)}for(;0<r&&n!==null;){w.$isElementNode(n)&&(i=n.getLastDescendant(),i!==null&&(n=i));var o=n.getPreviousSibling(),l=0;if(o===null){i=n.getParentOrThrow();for(var s=i.getPreviousSibling();s===null;){if(i=i.getParent(),i===null){o=null;break}s=i.getPreviousSibling()}i!==null&&(l=i.isInline()?0:2,o=s)}if(s=n.getTextContent(),s===""&&w.$isElementNode(n)&&!n.isInline()&&(s=` `),i=s.length,!w.$isTextNode(n)||r>=i)s=n.getParent(),n.remove(),s==null||s.getChildrenSize()!==0||w.$isRootNode(s)||s.remove(),r-=i+l,n=o;else{let a=n.getKey();l=t.getEditorState().read(()=>{const u=w.$getNodeByKey(a);return w.$isTextNode(u)&&u.isSimpleText()?u.getTextContent():null}),o=i-r;let d=s.slice(0,o);l!==null&&l!==s?(r=w.$getPreviousSelection(),i=n,n.isSimpleText()?n.setTextContent(l):(i=w.$createTextNode(l),n.replace(i)),w.$isRangeSelection(r)&&r.isCollapsed()&&(r=r.anchor.offset,i.select(r,r))):n.isSimpleText()?(l=e.key===a,s=e.offset,s<r&&(s=i),r=l?s-r:0,i=l?s:o,l&&r===0?([r]=n.splitText(r,i),r.remove()):([,r]=n.splitText(r,i),r.remove())):(r=w.$createTextNode(d),n.replace(r)),r=0}}};const Gu=le;var Rt=Gu,ma=Rt,Y=O;function Uu(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ca(...t){return()=>{t.forEach(e=>e())}}let Vu={attributes:!0,characterData:!0,childList:!0,subtree:!0};function ya(t,e,r){function n(){if(l===null)throw Error("Unexpected null rootDOMNode");if(s===null)throw Error("Unexpected null parentDOMNode");let{left:c,top:g}=l.getBoundingClientRect();var f=s;let p=ma.createRectsFromDOMRange(t,e);u.isConnected||f.append(u),f=!1;for(let M=0;M<p.length;M++){var y=p[M];let R=d[M]||document.createElement("div"),b=R.style;b.position!=="absolute"&&(b.position="absolute",f=!0);var v=`${y.left-c}px`;b.left!==v&&(b.left=v,f=!0),v=`${y.top-g}px`,b.top!==v&&(R.style.top=v,f=!0),v=`${y.width}px`,b.width!==v&&(R.style.width=v,f=!0),y=`${y.height}px`,b.height!==y&&(R.style.height=y,f=!0),R.parentNode!==u&&(u.append(R),f=!0),d[M]=R}for(;d.length>p.length;)d.pop();f&&r(d)}function i(){l=s=null,a!==null&&a.disconnect(),a=null,u.remove();for(let c of d)c.remove();d=[]}function o(){let c=t.getRootElement();if(c===null)return i();let g=c.parentElement;if(!(g instanceof HTMLElement))return i();i(),l=c,s=g,a=new MutationObserver(f=>{let p=t.getRootElement(),y=p&&p.parentElement;if(p!==l||y!==s)return o();for(let v of f)if(!u.contains(v.target))return n()}),a.observe(g,Vu),n()}let l=null,s=null,a=null,d=[],u=document.createElement("div"),h=t.registerRootListener(o);return()=>{h(),i()}}function Na(t,e){for(let r of e)if(t.type.startsWith(r))return!0;return!1}let va=(t,e)=>{for(;t!==Y.$getRoot()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};X.$splitNode=Y.$splitNode;X.isHTMLAnchorElement=Y.isHTMLAnchorElement;X.isHTMLElement=Y.isHTMLElement;X.$dfs=function(t,e){let r=[];t=(t||Y.$getRoot()).getLatest(),e=e||(Y.$isElementNode(t)?t.getLastDescendant():t);for(var n=t,i=0;(n=n.getParent())!==null;)i++;for(n=i;t!==null&&!t.is(e);)if(r.push({depth:n,node:t}),Y.$isElementNode(t)&&0<t.getChildrenSize())t=t.getFirstChild(),n++;else for(i=null;i===null&&t!==null;)i=t.getNextSibling(),i===null?(t=t.getParent(),n--):t=i;return t!==null&&t.is(e)&&r.push({depth:n,node:t}),r};X.$filter=function(t,e){let r=[];for(let n=0;n<t.length;n++){let i=e(t[n]);i!==null&&r.push(i)}return r};X.$findMatchingParent=va;X.$getNearestBlockElementAncestorOrThrow=function(t){let e=va(t,r=>Y.$isElementNode(r)&&!r.isInline());return Y.$isElementNode(e)||Uu(4,t.__key),e};X.$getNearestNodeOfType=function(t,e){for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null};X.$insertFirst=function(t,e){let r=t.getFirstChild();r!==null?r.insertBefore(e):t.append(e)};X.$insertNodeToNearestRoot=function(t){var e=Y.$getSelection()||Y.$getPreviousSelection();if(Y.$isRangeSelection(e)){var{focus:r}=e;if(e=r.getNode(),r=r.offset,Y.$isRootOrShadowRoot(e))r=e.getChildAtIndex(r),r==null?e.append(t):r.insertBefore(t),t.selectNext();else{let n,i;Y.$isTextNode(e)?(n=e.getParentOrThrow(),i=e.getIndexWithinParent(),0<r&&(i+=1,e.splitText(r))):(n=e,i=r),[,e]=Y.$splitNode(n,i),e.insertBefore(t),e.selectStart()}}else e!=null?(e=e.getNodes(),e[e.length-1].getTopLevelElementOrThrow().insertAfter(t)):Y.$getRoot().append(t),e=Y.$createParagraphNode(),t.insertAfter(e),e.select();return t.getLatest()};X.$restoreEditorState=function(t,e){let r=new Map,n=t._pendingEditorState;for(let[i,o]of e._nodeMap){let l=ma.$cloneWithProperties(o);if(Y.$isTextNode(l)){if(!Y.$isTextNode(o))throw Error("Expected node be a TextNode");l.__text=o.__text}r.set(i,l)}n&&(n._nodeMap=r),t._dirtyType=2,t=e._selection,Y.$setSelection(t===null?null:t.clone())};X.$wrapNodeInElement=function(t,e){return e=e(),t.replace(e),e.append(t),e};X.addClassNamesToElement=function(t,...e){e.forEach(r=>{typeof r=="string"&&(r=r.split(" ").filter(n=>n!==""),t.classList.add(...r))})};X.isMimeType=Na;X.markSelection=function(t,e){function r(a){a.read(()=>{var d=Y.$getSelection();if(Y.$isRangeSelection(d)){var{anchor:u,focus:h}=d;d=u.getNode();var c=d.getKey(),g=u.offset,f=h.getNode(),p=f.getKey(),y=h.offset,v=t.getElementByKey(c),M=t.getElementByKey(p);if(c=n===null||v===null||g!==i||c!==n.getKey()||d!==n&&(!(n instanceof Y.TextNode)||d.updateDOM(n,v,t._config)),p=o===null||M===null||y!==l||p!==o.getKey()||f!==o&&(!(o instanceof Y.TextNode)||f.updateDOM(o,M,t._config)),c||p){v=t.getElementByKey(u.getNode().getKey());var R=t.getElementByKey(h.getNode().getKey());if(v!==null&&R!==null&&v.tagName==="SPAN"&&R.tagName==="SPAN"){if(p=document.createRange(),h.isBefore(u)?(c=R,M=h.offset,R=v,v=u.offset):(c=v,M=u.offset,v=h.offset),c=c.firstChild,c===null||(R=R.firstChild,R===null))throw Error("Expected text node to be first child of span");p.setStart(c,M),p.setEnd(R,v),s(),s=ya(t,p,b=>{for(let re of b){let K=re.style;K.background!=="Highlight"&&(K.background="Highlight"),K.color!=="HighlightText"&&(K.color="HighlightText"),K.zIndex!=="-1"&&(K.zIndex="-1"),K.pointerEvents!=="none"&&(K.pointerEvents="none"),K.marginTop!=="-1.5px"&&(K.marginTop="-1.5px"),K.paddingTop!=="4px"&&(K.paddingTop="4px"),K.paddingBottom!=="0px"&&(K.paddingBottom="0px")}e!==void 0&&e(b)})}}n=d,i=g,o=f,l=y}else l=o=i=n=null,s(),s=()=>{}})}let n=null,i=null,o=null,l=null,s=()=>{};return r(t.getEditorState()),Ca(t.registerUpdateListener(({editorState:a})=>r(a)),s,()=>{s()})};X.mediaFileReader=function(t,e){let r=t[Symbol.iterator]();return new Promise((n,i)=>{let o=[],l=()=>{const{done:s,value:a}=r.next();if(s)return n(o);const d=new FileReader;d.addEventListener("error",i),d.addEventListener("load",()=>{const u=d.result;typeof u=="string"&&o.push({file:a,result:u}),l()}),Na(a,e)?d.readAsDataURL(a):l()};l()})};X.mergeRegister=Ca;X.objectKlassEquals=function(t,e){return t!==null?Object.getPrototypeOf(t).constructor.name===e.name:!1};X.positionNodeOnRange=ya;X.registerNestedElementResolver=function(t,e,r,n){return t.registerNodeTransform(e,i=>{e:{for(var o=i.getChildren(),l=0;l<o.length;l++)if(o[l]instanceof e){o=null;break e}for(o=i;o!==null;)if(l=o,o=o.getParent(),o instanceof e){o={child:l,parent:o};break e}o=null}if(o!==null){const{child:s,parent:a}=o;if(s.is(i)){if(n(a,i),i=s.getNextSiblings(),o=i.length,a.insertAfter(s),o!==0){l=r(a),s.insertAfter(l);for(let d=0;d<o;d++)l.append(i[d])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})};X.removeClassNamesFromElement=function(t,...e){e.forEach(r=>{typeof r=="string"&&t.classList.remove(...r.split(" "))})};const ju=X;var Q=ju,xa={},rn=O;xa.registerDragonSupport=function(t){let e=window.location.origin,r=n=>{if(n.origin===e){var i=t.getRootElement();if(document.activeElement===i&&(i=n.data,typeof i=="string")){try{var o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"&&(o=o.payload)&&o.functionId==="makeChanges"&&(o=o.args)){const[l,s,a,d,u]=o;t.update(()=>{const h=rn.$getSelection();if(rn.$isRangeSelection(h)){var c=h.anchor;let g=c.getNode(),f=0,p=0;rn.$isTextNode(g)&&0<=l&&0<=s&&(f=l,p=l+s,h.setTextNodeRange(g,f,g,p)),(f!==p||a!=="")&&(h.insertRawText(a),g=c.getNode()),rn.$isTextNode(g)&&(f=d,p=d+u,c=g.getTextContentSize(),f=f>c?c:f,p=p>c?c:p,h.setTextNodeRange(g,f,g,p)),n.stopImmediatePropagation()}})}}}};return window.addEventListener("message",r,!0),()=>{window.removeEventListener("message",r,!0)}};const Ju=xa;var Xu=Ju,je={},nt={},vo={},xl=Rt,Zu=Q,Jt=O;function Ea(t,e,r,n=null){let i=n!=null?e.isSelected(n):!0,o=Jt.$isElementNode(e)&&e.excludeFromCopy("html");var l=e;n!==null&&(l=xl.$cloneWithProperties(e),l=Jt.$isTextNode(l)&&n!=null?xl.$sliceSelectedTextNodeContent(n,l):l);let s=Jt.$isElementNode(l)?l.getChildren():[];var a=t._nodes.get(l.getType());a=a&&a.exportDOM!==void 0?a.exportDOM(t,l):l.exportDOM(t);let{element:d,after:u}=a;if(!d)return!1;a=document.createDocumentFragment();for(let h=0;h<s.length;h++){let c=s[h],g=Ea(t,c,a,n);!i&&Jt.$isElementNode(e)&&g&&e.extractWithChild(c,n,"html")&&(i=!0)}return i&&!o?(Zu.isHTMLElement(d)&&d.append(a),r.append(d),u&&(t=u.call(l,d))&&d.replaceWith(t)):r.append(a),i}let Ta=new Set(["STYLE","SCRIPT"]);function Sa(t,e,r=new Map,n){let i=[];if(Ta.has(t.nodeName))return i;let o=null;var l,{nodeName:s}=t,a=e._htmlConversions.get(s.toLowerCase());if(s=null,a!==void 0)for(l of a)a=l(t),a!==null&&(s===null||(s.priority||0)<(a.priority||0))&&(s=a);if(s=(l=s!==null?s.conversion:null)?l(t):null,l=null,s!==null){if(l=s.after,a=s.node,o=Array.isArray(a)?a[a.length-1]:a,o!==null){for(var[,d]of r)if(o=d(o,n),!o)break;o&&i.push(...Array.isArray(a)?a:[o])}s.forChild!=null&&r.set(t.nodeName,s.forChild)}for(t=t.childNodes,n=[],d=0;d<t.length;d++)n.push(...Sa(t[d],e,new Map(r),o));return l!=null&&(n=l(n)),o==null?i=i.concat(n):Jt.$isElementNode(o)&&o.append(...n),i}vo.$generateHtmlFromNodes=function(t,e){if(typeof document>"u"||typeof window>"u")throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let r=document.createElement("div"),n=Jt.$getRoot().getChildren();for(let i=0;i<n.length;i++)Ea(t,n[i],r,e);return r.innerHTML};vo.$generateNodesFromDOM=function(t,e){e=e.body?e.body.childNodes:[];let r=[];for(let i=0;i<e.length;i++){var n=e[i];Ta.has(n.nodeName)||(n=Sa(n,t),n!==null&&(r=r.concat(n)))}return r};const qu=vo;var Qu=qu,wa=Qu,Fi=Rt,ec=Q,q=O;function El(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Oa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $a(t){let e=q.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return q.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?"":wa.$generateHtmlFromNodes(t,e)}function Ma(t){let e=q.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return q.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Da(t,e))}function Bi(t,e,r){t.dispatchCommand(q.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,{nodes:e,selection:r})||r.insertNodes(e)}function Ra(t,e,r,n=[]){let i=e!=null?r.isSelected(e):!0,o=q.$isElementNode(r)&&r.excludeFromCopy("html");var l=r;if(e!==null){var s=Fi.$cloneWithProperties(r);l=s=q.$isTextNode(s)&&e!=null?Fi.$sliceSelectedTextNodeContent(e,s):s}let a=q.$isElementNode(l)?l.getChildren():[];var d=l;s=d.exportJSON();var u=d.constructor;for(s.type!==u.getType()&&El(58,u.name),q.$isElementNode(d)&&(Array.isArray(s.children)||El(59,u.name)),q.$isTextNode(l)&&(l=l.__text,0<l.length?s.text=l:i=!1),l=0;l<a.length;l++)d=a[l],u=Ra(t,e,d,s.children),!i&&q.$isElementNode(r)&&u&&r.extractWithChild(d,e,"clone")&&(i=!0);if(i&&!o)n.push(s);else if(Array.isArray(s.children))for(t=0;t<s.children.length;t++)n.push(s.children[t]);return i}function Da(t,e){let r=[],n=q.$getRoot().getChildren();for(let i=0;i<n.length;i++)Ra(t,e,n[i],r);return{namespace:t._config.namespace,nodes:r}}function Aa(t){let e=[];for(let r=0;r<t.length;r++){let n=q.$parseSerializedNode(t[r]);q.$isTextNode(n)&&Fi.$addNodeStyle(n),e.push(n)}return e}let zt=null;function Tl(t,e){var r=Oa?(t._window||window).getSelection():null;if(!r)return!1;var n=r.anchorNode;if(r=r.focusNode,n!==null&&r!==null&&!q.isSelectionWithinEditor(t,n,r)||(e.preventDefault(),e=e.clipboardData,n=q.$getSelection(),e===null||n===null))return!1;r=$a(t),t=Ma(t);let i="";return n!==null&&(i=n.getTextContent()),r!==null&&e.setData("text/html",r),t!==null&&e.setData("application/x-lexical-editor",t),e.setData("text/plain",i),!0}nt.$generateJSONFromSelectedNodes=Da;nt.$generateNodesFromSerializedNodes=Aa;nt.$getHtmlContent=$a;nt.$getLexicalContent=Ma;nt.$insertDataTransferForPlainText=function(t,e){t=t.getData("text/plain")||t.getData("text/uri-list"),t!=null&&e.insertRawText(t)};nt.$insertDataTransferForRichText=function(t,e,r){var n=t.getData("application/x-lexical-editor");if(n)try{let o=JSON.parse(n);if(o.namespace===r._config.namespace&&Array.isArray(o.nodes)){let l=Aa(o.nodes);return Bi(r,l,e)}}catch{}if(n=t.getData("text/html"))try{var i=new DOMParser().parseFromString(n,"text/html");let o=wa.$generateNodesFromDOM(r,i);return Bi(r,o,e)}catch{}if(t=t.getData("text/plain")||t.getData("text/uri-list"),t!=null)if(q.$isRangeSelection(e))for(t=t.split(/(\r?\n|\t)/),t[t.length-1]===""&&t.pop(),r=0;r<t.length;r++)i=t[r],i===` `||i===`\r `?e.insertParagraph():i===" "?e.insertNodes([q.$createTabNode()]):e.insertText(i);else e.insertRawText(t)};nt.$insertGeneratedNodes=Bi;nt.copyToClipboard=async function(t,e){if(zt!==null)return!1;if(e!==null)return new Promise(l=>{t.update(()=>{l(Tl(t,e))})});var r=t.getRootElement();let n=t._window==null?window.document:t._window.document,i=Oa?(t._window||window).getSelection():null;if(r===null||i===null)return!1;let o=n.createElement("span");return o.style.cssText="position: fixed; top: -1000px;",o.append(n.createTextNode("#")),r.append(o),r=new Range,r.setStart(o,0),r.setEnd(o,1),i.removeAllRanges(),i.addRange(r),new Promise(l=>{let s=t.registerCommand(q.COPY_COMMAND,a=>(ec.objectKlassEquals(a,ClipboardEvent)&&(s(),zt!==null&&(window.clearTimeout(zt),zt=null),l(Tl(t,a))),!0),q.COMMAND_PRIORITY_CRITICAL);zt=window.setTimeout(()=>{s(),zt=null,l(!1)},50),n.execCommand("copy"),o.remove()})};const tc=nt;var rc=tc,On=rc,nn=Rt,He=Q,m=O;function Sl(t,e){return typeof document.caretRangeFromPoint<"u"?(t=document.caretRangeFromPoint(t,e),t===null?null:{node:t.startContainer,offset:t.startOffset}):document.caretPositionFromPoint!=="undefined"?(t=document.caretPositionFromPoint(t,e),t===null?null:{node:t.offsetNode,offset:t.offset}):null}let cr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",nc=cr&&"documentMode"in document?document.documentMode:null,ic=cr&&"InputEvent"in window&&!nc?"getTargetRanges"in new window.InputEvent("input"):!1,oc=cr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),lc=cr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,sc=cr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ac=cr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!sc,Ki=m.createCommand("DRAG_DROP_PASTE_FILE"),xo=class ka extends m.ElementNode{static getType(){return"quote"}static clone(e){return new ka(e.__key)}constructor(e){super(e)}createDOM(e){let r=document.createElement("blockquote");return He.addClassNamesToElement(r,e.theme.quote),r}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:dc,priority:0})}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&He.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var r=this.getFormatType();e.style.textAlign=r,(r=this.getDirection())&&(e.dir=r)}return{element:e}}static importJSON(e){let r=Eo();return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,r){e=m.$createParagraphNode();let n=this.getDirection();return e.setDirection(n),this.insertAfter(e,r),e}collapseAtStart(){let e=m.$createParagraphNode();return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}};function Eo(){return m.$applyNodeReplacement(new xo)}let To=class Ia extends m.ElementNode{static getType(){return"heading"}static clone(e){return new Ia(e.__tag,e.__key)}constructor(e,r){super(r),this.__tag=e}getTag(){return this.__tag}createDOM(e){let r=this.__tag,n=document.createElement(r);return e=e.theme.heading,e!==void 0&&He.addClassNamesToElement(n,e[r]),n}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Ft,priority:0}),h2:()=>({conversion:Ft,priority:0}),h3:()=>({conversion:Ft,priority:0}),h4:()=>({conversion:Ft,priority:0}),h5:()=>({conversion:Ft,priority:0}),h6:()=>({conversion:Ft,priority:0}),p:e=>(e=e.firstChild,e!==null&&wl(e)?{conversion:()=>({node:null}),priority:3}:null),span:e=>wl(e)?{conversion:()=>({node:Xt("h1")}),priority:3}:null}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&He.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var r=this.getFormatType();e.style.textAlign=r,(r=this.getDirection())&&(e.dir=r)}return{element:e}}static importJSON(e){let r=Xt(e.tag);return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,r=!0){let n=e?e.anchor.offset:0,i=n!==this.getTextContentSize()&&e?Xt(this.getTag()):m.$createParagraphNode(),o=this.getDirection();return i.setDirection(o),this.insertAfter(i,r),n===0&&!this.isEmpty()&&e&&(e=m.$createParagraphNode(),e.select(),this.replace(e,!0)),i}collapseAtStart(){let e=this.isEmpty()?m.$createParagraphNode():Xt(this.getTag());return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}extractWithChild(){return!0}};function wl(t){return t.nodeName.toLowerCase()==="span"?t.style.fontSize==="26pt":!1}function Ft(t){let e=t.nodeName.toLowerCase(),r=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(r=Xt(e),t.style!==null&&r.setFormat(t.style.textAlign)),{node:r}}function dc(t){let e=Eo();return t.style!==null&&e.setFormat(t.style.textAlign),{node:e}}function Xt(t){return m.$applyNodeReplacement(new To(t))}function uc(t,e){t.preventDefault(),e.update(()=>{let r=m.$getSelection(),n=t instanceof InputEvent||t instanceof KeyboardEvent?null:t.clipboardData;n!=null&&m.$INTERNAL_isPointSelection(r)&&On.$insertDataTransferForRichText(n,r,e)},{tag:"paste"})}async function cc(t,e){await On.copyToClipboard(e,He.objectKlassEquals(t,ClipboardEvent)?t:null),e.update(()=>{let r=m.$getSelection();m.$isRangeSelection(r)?r.removeText():m.$isNodeSelection(r)&&r.getNodes().forEach(n=>n.remove())})}function Cr(t){let e=null;if(t instanceof DragEvent?e=t.dataTransfer:t instanceof ClipboardEvent&&(e=t.clipboardData),e===null)return[!1,[],!1];var r=e.types;return t=r.includes("Files"),r=r.includes("text/html")||r.includes("text/plain"),[t,Array.from(e.files),r]}function Ol(t){var e=m.$getSelection();if(!m.$isRangeSelection(e))return!1;let r=new Set;e=e.getNodes();for(let o=0;o<e.length;o++){var n=e[o],i=n.getKey();r.has(i)||(n=He.$getNearestBlockElementAncestorOrThrow(n),i=n.getKey(),n.canIndent()&&!r.has(i)&&(r.add(i),t(n)))}return 0<r.size}function on(t){return t=m.$getNearestNodeFromDOMNode(t),m.$isDecoratorNode(t)}je.$createHeadingNode=Xt;je.$createQuoteNode=Eo;je.$isHeadingNode=function(t){return t instanceof To};je.$isQuoteNode=function(t){return t instanceof xo};je.DRAG_DROP_PASTE=Ki;je.HeadingNode=To;je.QuoteNode=xo;je.eventFiles=Cr;je.registerRichText=function(t){return He.mergeRegister(t.registerCommand(m.CLICK_COMMAND,()=>{const e=m.$getSelection();return m.$isNodeSelection(e)?(e.clear(),!0):!1},0),t.registerCommand(m.DELETE_CHARACTER_COMMAND,e=>{const r=m.$getSelection();return m.$isRangeSelection(r)?(r.deleteCharacter(e),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.DELETE_WORD_COMMAND,e=>{const r=m.$getSelection();return m.$isRangeSelection(r)?(r.deleteWord(e),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.DELETE_LINE_COMMAND,e=>{const r=m.$getSelection();return m.$isRangeSelection(r)?(r.deleteLine(e),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.CONTROLLED_TEXT_INSERTION_COMMAND,e=>{const r=m.$getSelection();if(typeof e=="string")m.$INTERNAL_isPointSelection(r)&&r.insertText(e);else{if(!m.$INTERNAL_isPointSelection(r))return!1;const n=e.dataTransfer;n!=null?On.$insertDataTransferForRichText(n,r,t):m.$isRangeSelection(r)&&(e=e.data)&&r.insertText(e)}return!0},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.REMOVE_TEXT_COMMAND,()=>{const e=m.$getSelection();return m.$isRangeSelection(e)?(e.removeText(),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.FORMAT_TEXT_COMMAND,e=>{const r=m.$getSelection();return m.$isRangeSelection(r)?(r.formatText(e),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.FORMAT_ELEMENT_COMMAND,e=>{var r=m.$getSelection();if(!m.$isRangeSelection(r)&&!m.$isNodeSelection(r))return!1;r=r.getNodes();for(const n of r)r=He.$findMatchingParent(n,i=>m.$isElementNode(i)&&!i.isInline()),r!==null&&r.setFormat(e);return!0},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.INSERT_LINE_BREAK_COMMAND,e=>{const r=m.$getSelection();return m.$isRangeSelection(r)?(r.insertLineBreak(e),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.INSERT_PARAGRAPH_COMMAND,()=>{const e=m.$getSelection();return m.$isRangeSelection(e)?(e.insertParagraph(),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.INSERT_TAB_COMMAND,()=>(m.$insertNodes([m.$createTabNode()]),!0),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.INDENT_CONTENT_COMMAND,()=>Ol(e=>{const r=e.getIndent();e.setIndent(r+1)}),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.OUTDENT_CONTENT_COMMAND,()=>Ol(e=>{const r=e.getIndent();0<r&&e.setIndent(r-1)}),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ARROW_UP_COMMAND,e=>{var r=m.$getSelection();if(m.$isNodeSelection(r)&&!on(e.target)){if(e=r.getNodes(),0<e.length)return e[0].selectPrevious(),!0}else if(m.$isRangeSelection(r)&&(r=m.$getAdjacentNode(r.focus,!0),!e.shiftKey&&m.$isDecoratorNode(r)&&!r.isIsolated()&&!r.isInline()))return r.selectPrevious(),e.preventDefault(),!0;return!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ARROW_DOWN_COMMAND,e=>{var r=m.$getSelection();if(m.$isNodeSelection(r)){if(e=r.getNodes(),0<e.length)return e[0].selectNext(0,0),!0}else if(m.$isRangeSelection(r)){let n=r.focus;if(n.key==="root"&&n.offset===m.$getRoot().getChildrenSize())return e.preventDefault(),!0;if(r=m.$getAdjacentNode(r.focus,!1),!e.shiftKey&&m.$isDecoratorNode(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ARROW_LEFT_COMMAND,e=>{const r=m.$getSelection();if(m.$isNodeSelection(r)){var n=r.getNodes();if(0<n.length)return e.preventDefault(),n[0].selectPrevious(),!0}return m.$isRangeSelection(r)&&nn.$shouldOverrideDefaultCharacterSelection(r,!0)?(n=e.shiftKey,e.preventDefault(),nn.$moveCharacter(r,n,!0),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ARROW_RIGHT_COMMAND,e=>{const r=m.$getSelection();if(m.$isNodeSelection(r)&&!on(e.target)){var n=r.getNodes();if(0<n.length)return e.preventDefault(),n[0].selectNext(0,0),!0}return m.$isRangeSelection(r)?(n=e.shiftKey,nn.$shouldOverrideDefaultCharacterSelection(r,!1)?(e.preventDefault(),nn.$moveCharacter(r,n,!1),!0):!1):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_BACKSPACE_COMMAND,e=>{if(on(e.target))return!1;const r=m.$getSelection();if(!m.$isRangeSelection(r))return!1;e.preventDefault(),{anchor:e}=r;const n=e.getNode();return r.isCollapsed()&&e.offset===0&&!m.$isRootNode(n)&&0<He.$getNearestBlockElementAncestorOrThrow(n).getIndent()?t.dispatchCommand(m.OUTDENT_CONTENT_COMMAND,void 0):t.dispatchCommand(m.DELETE_CHARACTER_COMMAND,!0)},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_DELETE_COMMAND,e=>{if(on(e.target))return!1;const r=m.$getSelection();return m.$isRangeSelection(r)?(e.preventDefault(),t.dispatchCommand(m.DELETE_CHARACTER_COMMAND,!1)):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ENTER_COMMAND,e=>{const r=m.$getSelection();if(!m.$isRangeSelection(r))return!1;if(e!==null){if((lc||oc||ac)&&ic)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(m.INSERT_LINE_BREAK_COMMAND,!1)}return t.dispatchCommand(m.INSERT_PARAGRAPH_COMMAND,void 0)},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.KEY_ESCAPE_COMMAND,()=>{const e=m.$getSelection();return m.$isRangeSelection(e)?(t.blur(),!0):!1},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.DROP_COMMAND,e=>{const[,r]=Cr(e);if(0<r.length){var n=Sl(e.clientX,e.clientY);if(n!==null){const{offset:o,node:l}=n;var i=m.$getNearestNodeFromDOMNode(l);if(i!==null){if(n=m.$createRangeSelection(),m.$isTextNode(i))n.anchor.set(i.getKey(),o,"text"),n.focus.set(i.getKey(),o,"text");else{const s=i.getParentOrThrow().getKey();i=i.getIndexWithinParent()+1,n.anchor.set(s,i,"element"),n.focus.set(s,i,"element")}n=m.$normalizeSelection__EXPERIMENTAL(n),m.$setSelection(n)}t.dispatchCommand(Ki,r)}return e.preventDefault(),!0}return e=m.$getSelection(),!!m.$isRangeSelection(e)},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.DRAGSTART_COMMAND,e=>{[e]=Cr(e);const r=m.$getSelection();return!(e&&!m.$isRangeSelection(r))},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.DRAGOVER_COMMAND,e=>{var[r]=Cr(e);const n=m.$getSelection();return r&&!m.$isRangeSelection(n)?!1:(r=Sl(e.clientX,e.clientY),r!==null&&(r=m.$getNearestNodeFromDOMNode(r.node),m.$isDecoratorNode(r)&&e.preventDefault()),!0)},m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.SELECT_ALL_COMMAND,()=>(m.$selectAll(),!0),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.COPY_COMMAND,e=>(On.copyToClipboard(t,He.objectKlassEquals(e,ClipboardEvent)?e:null),!0),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.CUT_COMMAND,e=>(cc(e,t),!0),m.COMMAND_PRIORITY_EDITOR),t.registerCommand(m.PASTE_COMMAND,e=>{const[,r,n]=Cr(e);if(0<r.length&&!n)return t.dispatchCommand(Ki,r),!0;if(m.isSelectionCapturedInDecoratorInput(e.target))return!1;const i=m.$getSelection();return m.$INTERNAL_isPointSelection(i)?(uc(e,t),!0):!1},m.COMMAND_PRIORITY_EDITOR))};const hc=je;var gc=hc,Pa=oe,fc=os,Ie=A,pc=Wu,La=Q,$l=Ed,_c=Xu,mc=gc,So=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ie.useLayoutEffect:Ie.useEffect;function Ml(t){return t.getEditorState().read(pc.$canShowPlaceholderCurry(t.isComposing()))}function Cc(t){let[e,r]=Ie.useState(()=>Ml(t));return So(()=>{function n(){let i=Ml(t);r(i)}return n(),La.mergeRegister(t.registerUpdateListener(()=>{n()}),t.registerEditableListener(()=>{n()}))},[t]),e}function yc(t,e){let[r,n]=Ie.useState(()=>t.getDecorators());return So(()=>t.registerDecoratorListener(i=>{$l.flushSync(()=>{n(i)})}),[t]),Ie.useEffect(()=>{n(t.getDecorators())},[t]),Ie.useMemo(()=>{let i=[],o=Object.keys(r);for(let l=0;l<o.length;l++){let s=o[l],a=Ie.createElement(e,{onError:u=>t._onError(u)},Ie.createElement(Ie.Suspense,{fallback:null},r[s])),d=t.getElementByKey(s);d!==null&&i.push($l.createPortal(a,d,s))}return i},[e,r,t])}function Nc(t){So(()=>La.mergeRegister(mc.registerRichText(t),_c.registerDragonSupport(t)),[t])}function vc({content:t}){var[e]=Pa.useLexicalComposerContext();e=Cc(e);let r=fc();return e?typeof t=="function"?t(r):t:null}Kd.RichTextPlugin=function({contentEditable:t,placeholder:e,ErrorBoundary:r}){let[n]=Pa.useLexicalComposerContext();return r=yc(n,r),Nc(n),Ie.createElement(Ie.Fragment,null,t,Ie.createElement(vc,{content:e}),r)};var xc={},Rl=oe,yr=O,$n=A;let ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var Ec=ba?$n.useLayoutEffect:$n.useEffect;let ln={tag:"history-merge"};function Tc(t,e){if(e!==null){if(e===void 0)t.update(()=>{var r=yr.$getRoot();if(r.isEmpty()){let n=yr.$createParagraphNode();r.append(n),r=ba?document.activeElement:null,(yr.$getSelection()!==null||r!==null&&r===t.getRootElement())&&n.select()}},ln);else if(e!==null)switch(typeof e){case"string":let r=t.parseEditorState(e);t.setEditorState(r,ln);break;case"object":t.setEditorState(e,ln);break;case"function":t.update(()=>{yr.$getRoot().isEmpty()&&e(t)},ln)}}}xc.LexicalComposer=function({initialConfig:t,children:e}){let r=$n.useMemo(()=>{const{theme:n,namespace:i,editor__DEPRECATED:o,nodes:l,onError:s,editorState:a,html:d}=t,u=Rl.createLexicalComposerContext(null,n);let h=o||null;if(h===null){const c=yr.createEditor({editable:t.editable,html:d,namespace:i,nodes:l,onError:g=>s(g,c),theme:n});Tc(c,a),h=c}return[h,u]},[]);return Ec(()=>{let n=t.editable,[i]=r;i.setEditable(n!==void 0?n:!0)},[]),$n.createElement(Rl.LexicalComposerContext.Provider,{value:r},e)};var Sc={},wc=oe,Mr=A;function Wi(){return Wi=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e],n;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Wi.apply(this,arguments)}var Oc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Mr.useLayoutEffect:Mr.useEffect;Sc.ContentEditable=function({ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:r,ariaDescribedBy:n,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:d,autoCapitalize:u,className:h,id:c,role:g="textbox",spellCheck:f=!0,style:p,tabIndex:y,"data-testid":v,...M}){let[R]=wc.useLexicalComposerContext(),[b,re]=Mr.useState(!1),K=Mr.useCallback(Le=>{R.setRootElement(Le)},[R]);return Oc(()=>(re(R.isEditable()),R.registerEditableListener(Le=>{re(Le)})),[R]),Mr.createElement("div",Wi({},M,{"aria-activedescendant":b?t:void 0,"aria-autocomplete":b?e:"none","aria-controls":b?r:void 0,"aria-describedby":n,"aria-expanded":b&&g==="combobox"?!!i:void 0,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":b?a:void 0,"aria-readonly":b?void 0:!0,"aria-required":d,autoCapitalize:u,className:h,contentEditable:b,"data-testid":v,id:c,ref:K,role:g,spellCheck:f,style:p,tabIndex:y}))};var Rr=A;function Hi(t,e){return Hi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Hi(t,e)}function $c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Hi(t,e)}function Mc(t,e){return t===void 0&&(t=[]),e===void 0&&(e=[]),t.length!==e.length||t.some(function(r,n){return!Object.is(r,e[n])})}var Dl={error:null},Rc=function(t){function e(){for(var n,i=arguments.length,o=Array(i),l=0;l<i;l++)o[l]=arguments[l];return n=t.call.apply(t,[this].concat(o))||this,n.state=Dl,n.resetErrorBoundary=function(){for(var s,a=arguments.length,d=Array(a),u=0;u<a;u++)d[u]=arguments[u];n.props.onReset==null||(s=n.props).onReset.apply(s,d),n.reset()},n}$c(e,t),e.getDerivedStateFromError=function(n){return{error:n}};var r=e.prototype;return r.reset=function(){this.setState(Dl)},r.componentDidCatch=function(n,i){var o,l;(o=(l=this.props).onError)==null||o.call(l,n,i)},r.componentDidUpdate=function(n,i){var o=this.props.resetKeys;if(this.state.error!==null&&i.error!==null&&Mc(n.resetKeys,o)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,n.resetKeys,o),this.reset()}},r.render=function(){var n=this.state.error,i=this.props,o=i.fallbackRender,l=i.FallbackComponent;if(i=i.fallback,n!==null){if(n={error:n,resetErrorBoundary:this.resetErrorBoundary},Rr.isValidElement(i))return i;if(typeof o=="function")return o(n);if(l)return Rr.createElement(l,n);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(Rr.Component),Mg=function({children:t,onError:e}){return Rr.createElement(Rc,{fallback:Rr.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:e},t)},za={},wo={},Dc=Q,F=O;function Ac(t,e,r,n,i){if(t===null||r.size===0&&n.size===0&&!i)return 0;var o=e._selection,l=t._selection;if(i)return 1;if(!(F.$isRangeSelection(o)&&F.$isRangeSelection(l)&&l.isCollapsed()&&o.isCollapsed()))return 0;i=e._nodeMap;let s=[];for(let a of r)r=i.get(a),r!==void 0&&s.push(r);for(let[a,d]of n)d&&(n=i.get(a),n===void 0||F.$isRootNode(n)||s.push(n));return s.length===0?0:1<s.length?(n=e._nodeMap,e=n.get(o.anchor.key),l=n.get(l.anchor.key),e&&l&&!t._nodeMap.has(e.__key)&&F.$isTextNode(e)&&e.__text.length===1&&o.anchor.offset===1?2:0):(e=s[0],t=t._nodeMap.get(e.__key),!F.$isTextNode(t)||!F.$isTextNode(e)||t.__mode!==e.__mode||(t=t.__text,e=e.__text,t===e)||(o=o.anchor,l=l.anchor,o.key!==l.key||o.type!=="text")?0:(o=o.offset,l=l.offset,t=e.length-t.length,t===1&&l===o-1?2:t===-1&&l===o+1?3:t===-1&&l===o?4:0))}function kc(t,e){let r=Date.now(),n=0;return(i,o,l,s,a,d)=>{let u=Date.now();if(d.has("historic"))return n=0,r=u,2;let h=Ac(i,o,s,a,t.isComposing()),c=(()=>{var g=l===null||l.editor===t,f=d.has("history-push");if(!f&&g&&d.has("history-merge"))return 0;if(i===null)return 1;var p=o._selection;if(!(0<s.size||0<a.size))return p!==null?0:2;if(f===!1&&h!==0&&h===n&&u<r+e&&g)return 0;if(s.size===1){{f=Array.from(s)[0],g=i._nodeMap.get(f),f=o._nodeMap.get(f),p=i._selection;let y=o._selection,v=!1;F.$isRangeSelection(p)&&F.$isRangeSelection(y)&&(v=p.anchor.type==="element"&&p.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"),g=!v&&F.$isTextNode(g)&&F.$isTextNode(f)?g.__type===f.__type&&g.__text===f.__text&&g.__mode===f.__mode&&g.__detail===f.__detail&&g.__style===f.__style&&g.__format===f.__format&&g.__parent===f.__parent:!1}if(g)return 0}return 1})();return r=u,n=h,c}}wo.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}};wo.registerHistory=function(t,e,r){let n=kc(t,r);r=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:d,tags:u})=>{const h=e.current,c=e.redoStack,g=e.undoStack,f=h===null?null:h.editorState;if(h===null||l!==f){if(s=n(s,l,h,a,d,u),s===1)c.length!==0&&(e.redoStack=[],t.dispatchCommand(F.CAN_REDO_COMMAND,!1)),h!==null&&(g.push({...h}),t.dispatchCommand(F.CAN_UNDO_COMMAND,!0));else if(s===2)return;e.current={editor:t,editorState:l}}};let i=Dc.mergeRegister(t.registerCommand(F.UNDO_COMMAND,()=>{let l=e.redoStack,s=e.undoStack;if(s.length!==0){let a=e.current,d=s.pop();a!==null&&(l.push(a),t.dispatchCommand(F.CAN_REDO_COMMAND,!0)),s.length===0&&t.dispatchCommand(F.CAN_UNDO_COMMAND,!1),e.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:"historic"})}return!0},F.COMMAND_PRIORITY_EDITOR),t.registerCommand(F.REDO_COMMAND,()=>{let l=e.redoStack;var s=e.undoStack;if(l.length!==0){let a=e.current;a!==null&&(s.push(a),t.dispatchCommand(F.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&t.dispatchCommand(F.CAN_REDO_COMMAND,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},F.COMMAND_PRIORITY_EDITOR),t.registerCommand(F.CLEAR_EDITOR_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!1),F.COMMAND_PRIORITY_EDITOR),t.registerCommand(F.CLEAR_HISTORY_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,t.dispatchCommand(F.CAN_REDO_COMMAND,!1),t.dispatchCommand(F.CAN_UNDO_COMMAND,!1),!0),F.COMMAND_PRIORITY_EDITOR),t.registerUpdateListener(r)),o=t.registerUpdateListener(r);return()=>{i(),o()}};const Ic=wo;var Pc=Ic,Lc=oe,Yi=Pc,Al=A;function bc(t,e,r=1e3){let n=Al.useMemo(()=>e||Yi.createEmptyHistoryState(),[e]);Al.useEffect(()=>Yi.registerHistory(t,n,r),[r,t,n])}za.createEmptyHistoryState=Yi.createEmptyHistoryState;za.HistoryPlugin=function({externalHistoryState:t}){let[e]=Lc.useLexicalComposerContext();return bc(e,t),null};var zc={},it={},Fa=Q,et=O;let Fc=new Set(["http:","https:","mailto:","sms:","tel:"]),Wn=class Ba extends et.ElementNode{static getType(){return"link"}static clone(e){return new Ba(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,r={},n){super(n);let{target:i=null,rel:o=null,title:l=null}=r;this.__url=e,this.__target=i,this.__rel=o,this.__title=l}createDOM(e){let r=document.createElement("a");return r.href=this.sanitizeUrl(this.__url),this.__target!==null&&(r.target=this.__target),this.__rel!==null&&(r.rel=this.__rel),this.__title!==null&&(r.title=this.__title),Fa.addClassNamesToElement(r,e.theme.link),r}updateDOM(e,r){let n=this.__url,i=this.__target,o=this.__rel,l=this.__title;return n!==e.__url&&(r.href=n),i!==e.__target&&(i?r.target=i:r.removeAttribute("target")),o!==e.__rel&&(o?r.rel=o:r.removeAttribute("rel")),l!==e.__title&&(l?r.title=l:r.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:Bc,priority:1})}}static importJSON(e){let r=zr(e.url,{rel:e.rel,target:e.target,title:e.title});return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}sanitizeUrl(e){try{let r=new URL(e);if(!Fc.has(r.protocol))return"about:blank"}catch{}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,r=!0){return e=zr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),this.insertAfter(e,r),e}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,r){if(!et.$isRangeSelection(r))return!1;e=r.anchor.getNode();let n=r.focus.getNode();return this.isParentOf(e)&&this.isParentOf(n)&&0<r.getTextContent().length}};function Bc(t){let e=null;if(Fa.isHTMLAnchorElement(t)){let r=t.textContent;(r!==null&&r!==""||0<t.children.length)&&(e=zr(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function zr(t,e){return et.$applyNodeReplacement(new Wn(t,e))}function Yt(t){return t instanceof Wn}let Oo=class Ka extends Wn{static getType(){return"autolink"}static clone(e){return new Ka(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}static importJSON(e){let r=Gi(e.url,{rel:e.rel,target:e.target,title:e.title});return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(e,r=!0){return e=this.getParentOrThrow().insertNewAfter(e,r),et.$isElementNode(e)?(r=Gi(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),e.append(r),r):null}};function Gi(t,e){return et.$applyNodeReplacement(new Oo(t,e))}let Kc=et.createCommand("TOGGLE_LINK_COMMAND");function Wc(t,e){for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}it.$createAutoLinkNode=Gi;it.$createLinkNode=zr;it.$isAutoLinkNode=function(t){return t instanceof Oo};it.$isLinkNode=Yt;it.AutoLinkNode=Oo;it.LinkNode=Wn;it.TOGGLE_LINK_COMMAND=Kc;it.toggleLink=function(t,e={}){let{target:r,title:n}=e,i=e.rel===void 0?"noreferrer":e.rel;if(e=et.$getSelection(),et.$isRangeSelection(e))if(e=e.extract(),t===null)e.forEach(o=>{if(o=o.getParent(),Yt(o)){let l=o.getChildren();for(let s=0;s<l.length;s++)o.insertBefore(l[s]);o.remove()}});else{if(e.length===1){let s=Wc(e[0],Yt);if(s!==null){s.setURL(t),r!==void 0&&s.setTarget(r),i!==null&&s.setRel(i),n!==void 0&&s.setTitle(n);return}}let o=null,l=null;e.forEach(s=>{var a=s.getParent();if(a!==l&&a!==null&&(!et.$isElementNode(s)||s.isInline()))if(Yt(a))l=a,a.setURL(t),r!==void 0&&a.setTarget(r),i!==null&&l.setRel(i),n!==void 0&&l.setTitle(n);else if(a.is(o)||(o=a,l=zr(t,{rel:i,target:r,title:n}),Yt(a)?s.getPreviousSibling()===null?a.insertBefore(l):a.insertAfter(l):s.insertBefore(l)),Yt(s)){if(!s.is(l)){if(l!==null){a=s.getChildren();for(let d=0;d<a.length;d++)l.append(a[d])}s.remove()}}else l!==null&&l.append(s)})}};const Hc=it;var Zt=Hc,Bt=Zt,Yc=oe,Gc=Q,Kt=O,Uc=A;zc.LinkPlugin=function({validateUrl:t}){let[e]=Yc.useLexicalComposerContext();return Uc.useEffect(()=>{if(!e.hasNodes([Bt.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return Gc.mergeRegister(e.registerCommand(Bt.TOGGLE_LINK_COMMAND,r=>{if(r===null)return Bt.toggleLink(r),!0;if(typeof r=="string")return t===void 0||t(r)?(Bt.toggleLink(r),!0):!1;let{url:n,target:i,rel:o,title:l}=r;return Bt.toggleLink(n,{rel:o,target:i,title:l}),!0},Kt.COMMAND_PRIORITY_LOW),t!==void 0?e.registerCommand(Kt.PASTE_COMMAND,r=>{let n=Kt.$getSelection();if(!Kt.$isRangeSelection(n)||n.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let i=r.clipboardData.getData("text");return t(i)?n.getNodes().some(o=>Kt.$isElementNode(o))?!1:(e.dispatchCommand(Bt.TOGGLE_LINK_COMMAND,i),r.preventDefault(),!0):!1},Kt.COMMAND_PRIORITY_LOW):()=>{})},[e,t]),null};var Vc={},xe={},L=O,mt=Q;function ir(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Wa(t){let e=1;for(t=t.getParent();t!=null;){if(W(t)){if(t=t.getParent(),k(t)){e++,t=t.getParent();continue}ir(40)}break}return e}function Ui(t){t=t.getParent(),k(t)||ir(40);let e=t;for(;e!==null;)e=e.getParent(),k(e)&&(t=e);return t}function Ha(t){let e=[];t=t.getChildren().filter(W);for(let r=0;r<t.length;r++){let n=t[r],i=n.getFirstChild();k(i)?e=e.concat(Ha(i)):e.push(n)}return e}function Ke(t){return W(t)&&k(t.getFirstChild())}function jc(t){for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!W(t)&&!k(t))break;t=e}t.remove()}function kl(t){return $e().append(t)}function Ya(t,e){return W(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function Dt(t,e){t.splice(t.getChildrenSize(),0,e)}function Il(t,e){if(k(t))return t;let r=t.getPreviousSibling(),n=t.getNextSibling(),i=$e();return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),Dt(i,t.getChildren()),k(r)&&e===r.getListType()?(r.append(i),t.remove(),k(n)&&e===n.getListType()&&(Dt(r,n.getChildren()),n.remove()),r):k(n)&&e===n.getListType()?(n.getFirstChildOrThrow().insertBefore(i),t.remove(),n):(e=ve(e),e.append(i),t.replace(e),me(e),e)}function Ga(t,e){var r=t.getLastChild();let n=e.getFirstChild();r&&n&&Ke(r)&&Ke(n)&&(Ga(r.getFirstChild(),n.getFirstChild()),n.remove()),r=e.getChildren(),0<r.length&&(t.append(...r),me(t)),e.remove()}function me(t,e){if(t=e||t.getChildren(),t!==void 0)for(e=0;e<t.length;e++){let o=t[e];if(W(o)){let l=o.getValue();var r=o,n=r.getParent(),i=1;for(n!=null&&(k(n)?i=n.getStart():ir(44)),r=r.getPreviousSiblings(),n=0;n<r.length;n++){let s=r[n];W(s)&&!k(s.getFirstChild())&&i++}l!==i&&o.setValue(i)}}}function Jc(t){if(!Ke(t)){var e=t.getParent(),r=e?e.getParent():void 0,n=r?r.getParent():void 0;if(k(n)&&W(r)&&k(e)){var i=e?e.getFirstChild():void 0,o=e?e.getLastChild():void 0;if(t.is(i))r.insertBefore(t),e.isEmpty()&&r.remove();else if(t.is(o))r.insertAfter(t),e.isEmpty()&&r.remove();else{var l=e.getListType();i=$e();let s=ve(l);i.append(s),t.getPreviousSiblings().forEach(a=>s.append(a)),o=$e(),l=ve(l),o.append(l),Dt(l,t.getNextSiblings()),r.insertBefore(i),r.insertAfter(o),r.replace(t)}me(e),me(n)}}}let Hn=class Ua extends L.ElementNode{static getType(){return"listitem"}static clone(e){return new Ua(e.__value,e.__checked,e.__key)}constructor(e,r,n){super(n),this.__value=e===void 0?1:e,this.__checked=r}createDOM(e){let r=document.createElement("li"),n=this.getParent();return k(n)&&n.getListType()==="check"&&Ll(r,this,null),r.value=this.__value,Pl(r,e.theme,this),r}updateDOM(e,r,n){let i=this.getParent();return k(i)&&i.getListType()==="check"&&Ll(r,this,e),r.value=this.__value,Pl(r,n.theme,this),!1}static transform(){return e=>{let r=e.getParent();if(k(r)){if(me(r),!W(e))throw Error("node is not a ListItemNode");r.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}}static importDOM(){return{li:()=>({conversion:Xc,priority:0})}}static importJSON(e){let r=$e();return r.setChecked(e.checked),r.setValue(e.value),r.setFormat(e.format),r.setDirection(e.direction),r}exportDOM(e){return e=this.createDOM(e._config),e.style.textAlign=this.getFormatType(),{element:e}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let r=0;r<e.length;r++){let n=e[r];if(L.$isElementNode(n)&&this.canMergeWith(n)){let i=n.getChildren();this.append(...i),n.remove()}else super.append(n)}return this}replace(e,r){if(W(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!k(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let i=ve(n.getListType()),o=this.getNextSibling();for(;o;){let l=o;o=o.getNextSibling(),i.append(l)}n.insertAfter(e),e.insertAfter(i)}if(r){if(!L.$isElementNode(e))throw Error("includeChildren should only be true for ElementNodes");this.getChildren().forEach(i=>{e.append(i)})}return this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,r=!0){var n=this.getParentOrThrow();k(n)||ir(39);var i=this.getNextSiblings();if(W(e))return r=super.insertAfter(e,r),e=e.getParentOrThrow(),k(e)&&me(e),r;if(k(e)){for(n=e,e=e.getChildren(),i=e.length-1;0<=i;i--)n=e[i],this.insertAfter(n,r);return n}if(n.insertAfter(e,r),i.length!==0){let o=ve(n.getListType());i.forEach(l=>o.append(l)),e.insertAfter(o,r)}return e}remove(e){let r=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),r&&n&&Ke(r)&&Ke(n)?(Ga(r.getFirstChild(),n.getFirstChild()),n.remove()):n&&(e=n.getParent(),k(e)&&me(e))}insertNewAfter(e,r=!0){return e=$e(this.__checked==null?void 0:!1),this.insertAfter(e,r),e}collapseAtStart(e){let r=L.$createParagraphNode();this.getChildren().forEach(l=>r.append(l));var n=this.getParentOrThrow(),i=n.getParentOrThrow();let o=W(i);return n.getChildrenSize()===1?o?(n.remove(),i.select()):(n.insertBefore(r),n.remove(),n=e.anchor,e=e.focus,i=r.getKey(),n.type==="element"&&n.getNode().is(this)&&n.set(i,n.offset,"element"),e.type==="element"&&e.getNode().is(this)&&e.set(i,e.offset,"element")):(n.insertBefore(r),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){return this.getLatest().__checked}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var e=this.getParent();if(e===null)return this.getLatest().__indent;e=e.getParentOrThrow();let r=0;for(;W(e);)e=e.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(e){typeof e=="number"&&-1<e||ir(117);let r=this.getIndent();for(;r!==e;)if(r<e){e:{var n=new Set;if(Ke(this)||n.has(this.getKey()))break e;let s=this.getParent();var i=this.getNextSibling(),o=this.getPreviousSibling();if(Ke(i)&&Ke(o)){if(o=o.getFirstChild(),k(o)){o.append(this);var l=i.getFirstChild();k(l)&&(l=l.getChildren(),Dt(o,l),i.remove(),n.add(i.getKey())),me(o)}}else Ke(i)?(i=i.getFirstChild(),k(i)&&(n=i.getFirstChild(),n!==null&&n.insertBefore(this),me(i))):Ke(o)?(i=o.getFirstChild(),k(i)&&(i.append(this),me(i))):k(s)&&(n=$e(),l=ve(s.getListType()),n.append(l),l.append(this),o?o.insertAfter(n):i?i.insertBefore(n):s.append(n),me(l));k(s)&&me(s)}r++}else Jc(this),r--;return this}insertBefore(e){if(W(e)){let r=this.getParentOrThrow();if(k(r)){let n=this.getNextSiblings();me(r,n)}}return super.insertBefore(e)}canInsertAfter(e){return W(e)}canReplaceWith(e){return W(e)}canMergeWith(e){return L.$isParagraphNode(e)||W(e)}extractWithChild(e,r){if(!L.$isRangeSelection(r))return!1;e=r.anchor.getNode();let n=r.focus.getNode();return this.isParentOf(e)&&this.isParentOf(n)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return ve("bullet")}};function Pl(t,e,r){let n=[],i=[];var o=(e=e.list)?e.listitem:void 0;if(e&&e.nested)var l=e.nested.listitem;if(o!==void 0&&(o=o.split(" "),n.push(...o)),e){o=r.getParent(),o=k(o)&&o.getListType()==="check";let s=r.getChecked();o&&!s||i.push(e.listitemUnchecked),o&&s||i.push(e.listitemChecked),o&&n.push(s?e.listitemChecked:e.listitemUnchecked)}l!==void 0&&(l=l.split(" "),r.getChildren().some(s=>k(s))?n.push(...l):i.push(...l)),0<i.length&&mt.removeClassNamesFromElement(t,...i),0<n.length&&mt.addClassNamesToElement(t,...n)}function Ll(t,e,r){k(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),r&&e.__checked===r.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Xc(t){return t=mt.isHTMLElement(t)&&t.getAttribute("aria-checked")==="true",{node:$e(t)}}function $e(t){return L.$applyNodeReplacement(new Hn(void 0,t))}function W(t){return t instanceof Hn}let $o=class Va extends L.ElementNode{static getType(){return"list"}static clone(e){return new Va(e.__listType||Fl[e.__tag],e.__start,e.__key)}constructor(e,r,n){super(n),this.__listType=e=Fl[e]||e,this.__tag=e==="number"?"ol":"ul",this.__start=r}getTag(){return this.__tag}setListType(e){let r=this.getWritable();r.__listType=e,r.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e){let r=document.createElement(this.__tag);return this.__start!==1&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,bl(r,e.theme,this),r}updateDOM(e,r,n){return e.__tag!==this.__tag?!0:(bl(r,n.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:zl,priority:0}),ul:()=>({conversion:zl,priority:0})}}static importJSON(e){let r=ve(e.listType,e.start);return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportDOM(e){return{element:e}=super.exportDOM(e),e&&mt.isHTMLElement(e)&&(this.__start!==1&&e.setAttribute("start",String(this.__start)),this.__listType==="check"&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let n=0;n<e.length;n++){var r=e[n];if(W(r))super.append(r);else{let i=$e();k(r)||L.$isElementNode(r)&&(r=L.$createTextNode(r.getTextContent())),i.append(r),super.append(i)}}return me(this),this}extractWithChild(e){return W(e)}};function bl(t,e,r){let n=[],i=[];var o=e.list;if(o!==void 0){let s=o[`${r.__tag}Depth`]||[];e=Wa(r)-1;let a=e%s.length;var l=s[a];let d=o[r.__tag],u;if(o=o.nested,o!==void 0&&o.list&&(u=o.list),d!==void 0&&n.push(d),l!==void 0)for(l=l.split(" "),n.push(...l),l=0;l<s.length;l++)l!==a&&i.push(r.__tag+l);u!==void 0&&(r=u.split(" "),1<e?n.push(...r):i.push(...r))}0<i.length&&mt.removeClassNamesFromElement(t,...i),0<n.length&&mt.addClassNamesToElement(t,...n)}function Zc(t){let e=[];for(let n=0;n<t.length;n++){var r=t[n];W(r)?(e.push(r),r=r.getChildren(),1<r.length&&r.forEach(i=>{k(i)&&e.push(kl(i))})):e.push(kl(r))}return e}function zl(t){let e=t.nodeName.toLowerCase(),r=null;return e==="ol"?r=ve("number",t.start):e==="ul"&&(r=mt.isHTMLElement(t)&&t.getAttribute("__lexicallisttype")==="check"?ve("check"):ve("bullet")),{after:Zc,node:r}}let Fl={ol:"number",ul:"bullet"};function ve(t,e=1){return L.$applyNodeReplacement(new $o(t,e))}function k(t){return t instanceof $o}let qc=L.createCommand("INSERT_UNORDERED_LIST_COMMAND"),Qc=L.createCommand("INSERT_ORDERED_LIST_COMMAND"),eh=L.createCommand("INSERT_CHECK_LIST_COMMAND"),th=L.createCommand("REMOVE_LIST_COMMAND");xe.$createListItemNode=$e;xe.$createListNode=ve;xe.$getListDepth=Wa;xe.$handleListInsertParagraph=function(){var t=L.$getSelection();if(!L.$isRangeSelection(t)||!t.isCollapsed()||(t=t.anchor.getNode(),!W(t)||t.getChildrenSize()!==0))return!1;var e=Ui(t),r=t.getParent();k(r)||ir(40);let n=r.getParent(),i;if(L.$isRootOrShadowRoot(n))i=L.$createParagraphNode(),e.insertAfter(i);else if(W(n))i=$e(),n.insertAfter(i);else return!1;if(i.select(),e=t.getNextSiblings(),0<e.length){let o=ve(r.getListType());L.$isParagraphNode(i)?i.insertAfter(o):(r=$e(),r.append(o),i.insertAfter(r)),e.forEach(l=>{l.remove(),o.append(l)})}return jc(t),!0};xe.$isListItemNode=W;xe.$isListNode=k;xe.INSERT_CHECK_LIST_COMMAND=eh;xe.INSERT_ORDERED_LIST_COMMAND=Qc;xe.INSERT_UNORDERED_LIST_COMMAND=qc;xe.ListItemNode=Hn;xe.ListNode=$o;xe.REMOVE_LIST_COMMAND=th;xe.insertList=function(t,e){t.update(()=>{var r=L.$getSelection();if(L.$INTERNAL_isPointSelection(r)){var n=r.getNodes();r=r.anchor.getNode();var i=r.getParent();if(Ya(r,n))n=ve(e),L.$isRootOrShadowRoot(i)?(r.replace(n),i=$e(),L.$isElementNode(r)&&(i.setFormat(r.getFormatType()),i.setIndent(r.getIndent())),n.append(i)):W(r)&&(r=r.getParentOrThrow(),Dt(n,r.getChildren()),r.replace(n));else for(r=new Set,i=0;i<n.length;i++){var o=n[i];if(L.$isElementNode(o)&&o.isEmpty()&&!W(o)&&!r.has(o.getKey()))Il(o,e);else if(L.$isLeafNode(o))for(o=o.getParent();o!=null;){let s=o.getKey();if(k(o)){if(!r.has(s)){var l=ve(e);Dt(l,o.getChildren()),o.replace(l),me(l),r.add(s)}break}else{if(l=o.getParent(),L.$isRootOrShadowRoot(l)&&!r.has(s)){r.add(s),Il(o,e);break}o=l}}}}})};xe.removeList=function(t){t.update(()=>{let e=L.$getSelection();if(L.$isRangeSelection(e)){var r=new Set,n=e.getNodes(),i=e.anchor.getNode();if(Ya(i,n))r.add(Ui(i));else for(i=0;i<n.length;i++){var o=n[i];L.$isLeafNode(o)&&(o=mt.$getNearestNodeOfType(o,Hn),o!=null&&r.add(Ui(o)))}for(let l of r){r=l,n=Ha(l);for(let s of n)n=L.$createParagraphNode(),Dt(n,s.getChildren()),r.insertAfter(n),r=n,s.__key===e.anchor.key&&e.anchor.set(n.getKey(),0,"element"),s.__key===e.focus.key&&e.focus.set(n.getKey(),0,"element"),s.remove();l.remove()}}})};const rh=xe;var nh=rh,qe=nh,ih=oe,ja=A,oh=Q,fr=O;function lh(t){ja.useEffect(()=>oh.mergeRegister(t.registerCommand(qe.INSERT_ORDERED_LIST_COMMAND,()=>(qe.insertList(t,"number"),!0),fr.COMMAND_PRIORITY_LOW),t.registerCommand(qe.INSERT_UNORDERED_LIST_COMMAND,()=>(qe.insertList(t,"bullet"),!0),fr.COMMAND_PRIORITY_LOW),t.registerCommand(qe.REMOVE_LIST_COMMAND,()=>(qe.removeList(t),!0),fr.COMMAND_PRIORITY_LOW),t.registerCommand(fr.INSERT_PARAGRAPH_COMMAND,()=>!!qe.$handleListInsertParagraph(),fr.COMMAND_PRIORITY_LOW)),[t])}Vc.ListPlugin=function(){let[t]=ih.useLexicalComposerContext();return ja.useEffect(()=>{if(!t.hasNodes([qe.ListNode,qe.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),lh(t),null};var Ja={},sh=oe,Bl=Q,We=O,ah=A;function dh(t){var e=t.getNodes();if(0<Bl.$filter(e,r=>We.$isBlockElementNode(r)&&r.canIndent()?r:null).length)return!0;if(e=t.anchor,t=t.focus,t=t.isBefore(e)?t:e,e=t.getNode(),e=Bl.$getNearestBlockElementAncestorOrThrow(e),e.canIndent()){e=e.getKey();let r=We.$createRangeSelection();if(r.anchor.set(e,0,"element"),r.focus.set(e,0,"element"),r=We.$normalizeSelection__EXPERIMENTAL(r),r.anchor.is(t))return!0}return!1}function Xa(t){return t.registerCommand(We.KEY_TAB_COMMAND,e=>{let r=We.$getSelection();return We.$isRangeSelection(r)?(e.preventDefault(),e=dh(r)?e.shiftKey?We.OUTDENT_CONTENT_COMMAND:We.INDENT_CONTENT_COMMAND:We.INSERT_TAB_COMMAND,t.dispatchCommand(e,void 0)):!1},We.COMMAND_PRIORITY_EDITOR)}Ja.TabIndentationPlugin=function(){let[t]=sh.useLexicalComposerContext();return ah.useEffect(()=>Xa(t)),null};Ja.registerTabIndentation=Xa;var uh={},ch=oe,Kl=A,hh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Kl.useLayoutEffect:Kl.useEffect;uh.OnChangePlugin=function({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[n]=ch.useLexicalComposerContext();return hh(()=>{if(r)return n.registerUpdateListener(({editorState:i,dirtyElements:o,dirtyLeaves:l,prevEditorState:s,tags:a})=>{e&&o.size===0&&l.size===0||t&&a.has("history-merge")||s.isEmpty()||r(i,n,a)})},[n,t,e,r]),null};const gh=A.lazy(()=>Td(()=>import("./index-D6IAaLlq.js"),__vite__mapDeps([0,1,2,3])));function fh(t){if(t instanceof HTMLImageElement){const{alt:e,src:r,width:n,height:i}=t;return{node:Mo({altText:e,height:i,src:r,width:n})}}return null}class Gr extends O.DecoratorNode{constructor(r,n,i,o,l,s){super(s);Lt(this,"__src");Lt(this,"__altText");Lt(this,"__width");Lt(this,"__height");Lt(this,"__maxWidth");this.__src=r,this.__altText=n,this.__maxWidth=i,this.__width=o||"inherit",this.__height=l||"inherit"}static getType(){return"image"}static clone(r){return new Gr(r.__src,r.__altText,r.__maxWidth,r.__width,r.__height,r.__key)}static importJSON(r){const{altText:n,height:i,width:o,maxWidth:l,src:s}=r;return Mo({altText:n,height:i,maxWidth:l,src:s,width:o})}exportDOM(){const r=document.createElement("img");return r.setAttribute("src",this.__src),r.setAttribute("alt",this.__altText),r.setAttribute("width",this.__width.toString()),r.setAttribute("height",this.__height.toString()),{element:r}}static importDOM(){return{img:()=>({conversion:fh,priority:0})}}exportJSON(){return{altText:this.getAltText(),height:this.__height==="inherit"?0:this.__height,maxWidth:this.__maxWidth,src:this.getSrc(),type:"image",version:1,width:this.__width==="inherit"?0:this.__width}}setWidthAndHeight(r,n){const i=this.getWritable();i.__width=r,i.__height=n}createDOM(r){const n=document.createElement("span"),{theme:i}=r,o=i.image;return o!==void 0&&(n.className=o),n}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}decorate(){return $.jsx(A.Suspense,{fallback:null,children:$.jsx(gh,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),resizable:!0})})}}function Mo({altText:t,height:e,maxWidth:r=600,src:n,width:i,key:o}){return n.startsWith("data:")?null:O.$applyNodeReplacement(new Gr(n,t,r,i,e,o))}function ph(t){return t instanceof Gr}const _h=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mh=t=>_h?(t||window).getSelection():null,Za=O.createCommand("INSERT_IMAGE_COMMAND");function Rg({captionsEnabled:t}){const[e]=oe.useLexicalComposerContext();return A.useEffect(()=>{if(!e.hasNodes([Gr]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Q.mergeRegister(e.registerCommand(Za,r=>{const n=Mo(r);return O.$insertNodes([n]),O.$isRootOrShadowRoot(n.getParentOrThrow())&&Q.$wrapNodeInElement(n,O.$createParagraphNode).selectEnd(),!0},O.COMMAND_PRIORITY_EDITOR),e.registerCommand(O.DRAGSTART_COMMAND,r=>yh(r),O.COMMAND_PRIORITY_HIGH),e.registerCommand(O.DRAGOVER_COMMAND,r=>Nh(r),O.COMMAND_PRIORITY_LOW),e.registerCommand(O.DROP_COMMAND,r=>vh(r,e),O.COMMAND_PRIORITY_HIGH))},[t,e]),null}const Ch="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",qa=document.createElement("img");qa.src=Ch;function yh(t){const e=Ro();if(!e)return!1;const{dataTransfer:r}=t;return r?(r.setData("text/plain","_"),r.setDragImage(qa,0,0),r.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.__altText,caption:e.__caption,height:e.__height,key:e.getKey(),maxWidth:e.__maxWidth,showCaption:e.__showCaption,src:e.__src,width:e.__width},type:"image"})),!0):!1}function Nh(t){return Ro()?(Qa(t)||t.preventDefault(),!0):!1}function vh(t,e){const r=Ro();if(!r)return!1;const n=xh(t);if(!n)return!1;if(t.preventDefault(),Qa(t)){const i=Eh(t);r.remove();const o=O.$createRangeSelection();i!=null&&o.applyDOMRange(i),O.$setSelection(o),e.dispatchCommand(Za,n)}return!0}function Ro(){const t=O.$getSelection();if(!O.$isNodeSelection(t))return null;const r=t.getNodes()[0];return ph(r)?r:null}function xh(t){var i;const e=(i=t.dataTransfer)==null?void 0:i.getData("application/x-lexical-drag");if(!e)return null;const{type:r,data:n}=JSON.parse(e);return r!=="image"?null:n}function Qa(t){const{target:e}=t;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.editor-image")&&e.parentElement&&e.parentElement.closest("div.editor-inner"))}function Eh(t){let e;const{target:r}=t,n=r==null?null:r.nodeType===9?r.defaultView:r.ownerDocument.defaultView,i=mh(n);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&i!==null)i.collapse(t.rangeParent,t.rangeOffset||0),e=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}const Dg={Container:H(mi("div",["editable","error"]))(({editable:t,error:e})=>({border:t?`2px solid ${e?E.red:E.gray.normal}`:"none",borderRadius:24,width:"100%"}),"Editor-Container"),Content:H(mi("div",["editable","lite"]))(({editable:t,lite:e})=>({position:"relative",textAlign:"left",cursor:"text",display:"block",lineHeight:1.7,"& .ContentEditable__root":{minHeight:t?e?120:400:"unset",resize:"none",fontSize:15,caretColor:"rgb(5, 5, 5)",position:"relative",tabSize:1,outline:0,padding:t?"15px 30px":0},"& .image-control-wrapper--resizing":{touchAction:"none"},"& hr":{padding:"2px 2px",border:"none",margin:"1em 0",cursor:"pointer","&:after":{content:'""',display:"block",height:2,backgroundColor:"#ccc",lineHeight:"2px"},"&.selected":{outline:`2px solid ${E.primary.blue}`,userSelect:"none"}},"& .Editor":{"&__ltr":{textAlign:"left"},"&__rtl":{textAlign:"right"},"&__paragraph":{margin:0,position:"relative"},"&__quote":{margin:0,marginLeft:20,marginBottom:10,fontSize:15,color:"rgb(101, 103, 107)",borderLeftColor:"rgb(206, 208, 212)",borderLeftWidth:4,borderLeftStyle:"solid",paddingLeft:16},"&__h1":{fontSize:28,fontWeight:400,margin:0},"&__h2":{fontSize:20,fontWeight:700,margin:0},"&__h3":{fontSize:18,margin:0},"&__h4":{fontSize:16,margin:0},"&__textBold":{fontWeight:"bold"},"&__textItalic":{fontStyle:"italic"},"&__textUnderline":{textDecoration:"underline"},"&__textStrikethrough":{textDecoration:"line-through"},"&__textUnderlineStrikethrough":{textDecoration:"underline line-through"},"&__textSubscript":{fontSize:"0.8em",verticalAlign:"sub !important"},"&__textSuperscript":{fontSize:"0.8em",verticalAlign:"super"},"&__link":{color:"rgb(33, 111, 219)",textDecoration:"none"},"&__link:hover":{textDecoration:"underline",cursor:t?"inherit":"pointer"},"&__table":{borderCollapse:"collapse",borderSpacing:0,maxWidth:"100%",overflowY:"scroll",tableLayout:"fixed",width:"calc(100% - 25px)",margin:"30px 0",backgroundRepeat:"no-repeat",backgroundSize:"cover"},"&__tableSelected":{outline:"2px solid rgb(60, 132, 244)"},"&__tableCell":{border:"1px solid #bbb",minWidth:75,verticalAlign:"top",textAlign:"start",padding:"6px 8px",position:"relative",cursor:"default",outline:"none"},"&__tableCellSortedIndicator":{display:"block",opacity:.5,position:"absolute",bottom:0,left:0,width:"100%",height:4,backgroundColor:"#999"},"&__tableCellResizer":{position:"absolute",right:-4,height:"100%",width:8,cursor:"ew-resize",zIndex:10,top:0},"&__tableCellHeader":{backgroundColor:"var(--header-background-color, #f2f3f5)",textAlign:"start"},"&__tableCellSelected":{backgroundColor:"#c9dbf0"},"&__tableCellPrimarySelected":{border:"2px solid rgb(60, 132, 244)",display:"block",height:"calc(100% - 2px)",position:"absolute",width:"calc(100% - 2px)",left:-1,top:-1,zIndex:2},"&__tableCellEditing":{boxShadow:"0 0 5px rgba(0, 0, 0, 0.4)",borderRadius:3},"&__tableAddColumns":{position:"absolute",top:0,width:20,backgroundColor:"#eee",height:"100%",right:0,animation:"table-controls 0.2s ease",border:0,cursor:"pointer"},"&__tableAddColumns:after":{display:"block",content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},"&__tableAddColumns:hover":{backgroundColor:"#c9dbf0"},"&__tableAddRows":{position:"absolute",bottom:-25,width:"calc(100% - 25px)",backgroundColor:"#eee",height:20,left:0,animation:"table-controls 0.2s ease",border:0,cursor:"pointer"},"&__tableAddRows:after":{display:"block",content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},"&__tableAddRows:hover":{backgroundColor:"#c9dbf0"},"&__tableCellResizeRuler":{display:"block",position:"absolute",width:1,backgroundColor:"rgb(60, 132, 244)",height:"100%",top:0},"&__tableCellActionButtonContainer":{display:"block",right:5,top:6,position:"absolute",zIndex:4,width:20,height:20},"&__tableCellActionButton":{backgroundColor:"#eee",display:"block",border:0,borderRadius:20,width:20,height:20,color:"#222",cursor:"pointer"},"&__tableCellActionButton:hover":{backgroundColor:"#ddd"},"&__characterLimit":{display:"inline",backgroundColor:"#ffbbbb !important"},"&__ol1":{padding:0,margin:0},"&__ol2":{padding:0,margin:0,listStyleType:"upper-alpha"},"&__ol3":{padding:0,margin:0,listStyleType:"lower-alpha"},"&__ol4":{padding:0,margin:0,listStyleType:"upper-roman"},"&__ol5":{padding:0,margin:0,listStyleType:"lower-roman"},"&__ul":{padding:0,margin:0},"&__listItem":{margin:"0 32px",listStyle:"inherit"},"&__listItemChecked, &__listItemUnchecked":{position:"relative",marginLeft:8,marginRight:8,paddingLeft:24,paddingRight:24,listStyleType:"none",outline:"none"},"&__listItemChecked":{textDecoration:"line-through"},"&__listItemUnchecked:before, &__listItemChecked:before":{content:'""',width:16,height:16,top:2,left:0,cursor:"pointer",display:"block",backgroundSize:"cover",position:"absolute"},'&__listItemUnchecked[dir="rtl"]:before, &__listItemChecked[dir="rtl"]:before ':{left:"auto",right:0},"&__listItemUnchecked:focus:before, &__listItemChecked:focus:before":{boxShadow:"0 0 0 2px #a6cdfe",borderRadius:2},"&__listItemUnchecked:before":{border:"1px solid #999",borderRadius:2},"&__listItemChecked:before":{border:"1px solid rgb(61, 135, 245)",borderRadius:2,backgroundColor:"#3d87f5",backgroundRepeat:"no-repeat"},"&__listItemChecked:after":{content:'""',cursor:"pointer",borderColor:"#fff",borderStyle:"solid",position:"absolute",display:"block",top:6,width:3,left:7,right:7,height:6,transform:"rotate(45deg)",borderWidth:"0 2px 2px 0"},"&__nestedListItem":{listStyleType:"none"},"&__nestedListItem:before, &__nestedListItem:after":{display:"none"}},"& .Editor__image":{cursor:"default",display:"inline-block",position:"relative",userSelect:"none","& img":{maxWidth:"100%",cursor:"default","&.focused":{outline:"2px solid rgb(60, 132, 244)",userSelect:"none"},"&.focused.draggable":{cursor:"grab"},"&.focused.draggable:active":{cursor:"grabbing"}},"& .image-resizer":{display:"block",width:7,height:7,position:"absolute",backgroundColor:"rgb(60, 132, 244)",border:"1px solid #fff","&.image-resizer-n":{top:-6,left:"48%",cursor:"n-resize"},"&.image-resizer-ne":{top:-6,right:-6,cursor:"ne-resize"},"&.image-resizer-e":{bottom:"48%",right:-6,cursor:"e-resize"},"&.image-resizer-se":{bottom:-2,right:-6,cursor:"nwse-resize"},"&.image-resizer-s":{bottom:-2,left:"48%",cursor:"s-resize"},"&.image-resizer-sw":{bottom:-2,left:-6,cursor:"sw-resize"},"&.image-resizer-w":{bottom:"48%",left:-6,cursor:"w-resize"},"&.image-resizer-nw":{top:-6,left:-6,cursor:"nw-resize"}}}}),"Editor-Content"),Editor:H("div")({position:"relative"}),Placeholder:H("div")({color:"#999",overflow:"hidden",position:"absolute",textOverflow:"ellipsis",top:15,left:30,fontSize:15,userSelect:"none",display:"inline-block",pointerEvents:"none"})},Ag=H("div")({display:"grid",rowGap:20}),kg=H("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"1fr 1fr",gap:20,marginTop:30,"& .MuiButton-root":{minWidth:0},[t.breakpoints.down("sm")]:{gridTemplateColumns:"1fr"}})),Ig={Dialog:Sd(t=>({paper:{padding:"35px 24px 24px",width:"100%",maxWidth:e=>e.maxWidth||320,[t.breakpoints.up("sm")]:{maxWidth:e=>e.maxWidth||450,padding:"35px 40px 40px"}}}))(wd),Title:H("p")(({theme:t})=>({fontWeight:500,marginBottom:18,fontSize:20,textAlign:"center",[t.breakpoints.up("sm")]:{fontSize:24,marginBottom:25}}))};var Yn={},ed={},Th=oe,at=O,sn=A;function Wl(t,e){return t.getEditorState().read(()=>{let r=at.$getNodeByKey(e);return r===null?!1:r.isSelected()})}ed.useLexicalNodeSelection=function(t){let[e]=Th.useLexicalComposerContext(),[r,n]=sn.useState(()=>Wl(e,t));sn.useEffect(()=>{let l=!0,s=e.registerUpdateListener(()=>{l&&n(Wl(e,t))});return()=>{l=!1,s()}},[e,t]);let i=sn.useCallback(l=>{e.update(()=>{let s=at.$getSelection();at.$isNodeSelection(s)||(s=at.$createNodeSelection(),at.$setSelection(s)),at.$isNodeSelection(s)&&(l?s.add(t):s.delete(t))})},[e,t]),o=sn.useCallback(()=>{e.update(()=>{const l=at.$getSelection();at.$isNodeSelection(l)&&l.clear()})},[e]);return[r,i,o]};const Sh=ed;var td=Sh,wh=oe,Oh=td,$h=Q,ke=O,fn=A;let Mh=ke.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");function Rh({nodeKey:t}){let[e]=wh.useLexicalComposerContext(),[r,n,i]=Oh.useLexicalNodeSelection(t),o=fn.useCallback(l=>(r&&ke.$isNodeSelection(ke.$getSelection())&&(l.preventDefault(),l=ke.$getNodeByKey(t),rd(l)&&l.remove()),!1),[r,t]);return fn.useEffect(()=>$h.mergeRegister(e.registerCommand(ke.CLICK_COMMAND,l=>{let s=e.getElementByKey(t);return l.target===s?(l.shiftKey||i(),n(!r),!0):!1},ke.COMMAND_PRIORITY_LOW),e.registerCommand(ke.KEY_DELETE_COMMAND,o,ke.COMMAND_PRIORITY_LOW),e.registerCommand(ke.KEY_BACKSPACE_COMMAND,o,ke.COMMAND_PRIORITY_LOW)),[i,e,r,t,o,n]),fn.useEffect(()=>{let l=e.getElementByKey(t);l!==null&&(l.className=r?"selected":"")},[e,r,t]),null}class Ur extends ke.DecoratorNode{static getType(){return"horizontalrule"}static clone(e){return new Ur(e.__key)}static importJSON(){return Do()}static importDOM(){return{hr:()=>({conversion:Dh,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return` `}isInline(){return!1}updateDOM(){return!1}decorate(){return fn.createElement(Rh,{nodeKey:this.__key})}}function Dh(){return{node:Do()}}function Do(){return ke.$applyNodeReplacement(new Ur)}function rd(t){return t instanceof Ur}Yn.$createHorizontalRuleNode=Do;Yn.$isHorizontalRuleNode=rd;Yn.HorizontalRuleNode=Ur;Yn.INSERT_HORIZONTAL_RULE_COMMAND=Mh;var Gn={},Ao={},ko=oe,be=O,G=A,Hl=Q,Ah=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?G.useLayoutEffect:G.useEffect;let kh=class{constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}},Yl=t=>{const e=document.getElementById("typeahead-menu");if(e){var r=e.getBoundingClientRect();r.top+r.height>window.innerHeight&&e.scrollIntoView({block:"center"}),0>r.top&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})}};function Ih(t){var e=be.$getSelection();if(!be.$isRangeSelection(e)||!e.isCollapsed())return null;var r=e.anchor;if(r.type!=="text"||(e=r.getNode(),!e.isSimpleText()))return null;r=r.offset;let n=e.getTextContent().slice(0,r);var i=t.matchingString;t=t.replaceableString.length;for(let l=t;l<=i.length;l++)n.substr(-l)===i.substr(0,l)&&(t=l);if(t=r-t,0>t)return null;let o;return t===0?[o]=e.splitText(r):[,o]=e.splitText(t,r),o}function Ph(t,e){let r=getComputedStyle(t),n=r.position==="absolute";if(e=e?/(auto|scroll|hidden)/:/(auto|scroll)/,r.position==="fixed")return document.body;for(;t=t.parentElement;)if(r=getComputedStyle(t),(!n||r.position!=="static")&&e.test(r.overflow+r.overflowY+r.overflowX))return t;return document.body}function Gl(t,e){return t=t.getBoundingClientRect(),e=e.getBoundingClientRect(),t.top>e.top&&t.top<e.bottom}function Lh(t,e,r,n){let[i]=ko.useLexicalComposerContext();G.useEffect(()=>{if(e!=null&&t!=null){let o=i.getRootElement(),l=o!=null?Ph(o,!1):document.body,s=!1,a=Gl(e,l),d=function(){s||(window.requestAnimationFrame(function(){r(),s=!1}),s=!0);const h=Gl(e,l);h!==a&&(a=h,n!=null&&n(h))},u=new ResizeObserver(r);return window.addEventListener("resize",r),document.addEventListener("scroll",d,{capture:!0,passive:!0}),u.observe(e),()=>{u.unobserve(e),window.removeEventListener("resize",r),document.removeEventListener("scroll",d,!0)}}},[e,i,n,r,t])}let Ul=be.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function bh({close:t,editor:e,anchorElementRef:r,resolution:n,options:i,menuRenderFn:o,onSelectOption:l,shouldSplitNodeWithQuery:s=!1,commandPriority:a=be.COMMAND_PRIORITY_LOW}){let[d,u]=G.useState(null);G.useEffect(()=>{u(0)},[n.match&&n.match.matchingString]);let h=G.useCallback(f=>{e.update(()=>{const p=n.match!=null&&s?Ih(n.match):null;l(f,p,t,n.match?n.match.matchingString:"")})},[e,s,n.match,l,t]),c=G.useCallback(f=>{const p=e.getRootElement();p!==null&&(p.setAttribute("aria-activedescendant","typeahead-item-"+f),u(f))},[e]);G.useEffect(()=>()=>{let f=e.getRootElement();f!==null&&f.removeAttribute("aria-activedescendant")},[e]),Ah(()=>{i===null?u(null):d===null&&c(0)},[i,d,c]),G.useEffect(()=>Hl.mergeRegister(e.registerCommand(Ul,({option:f})=>f.ref&&f.ref.current!=null?(Yl(f.ref.current),!0):!1,a)),[e,c,a]),G.useEffect(()=>Hl.mergeRegister(e.registerCommand(be.KEY_ARROW_DOWN_COMMAND,f=>{if(i!==null&&i.length&&d!==null){let p=d!==i.length-1?d+1:0;c(p);let y=i[p];y.ref!=null&&y.ref.current&&e.dispatchCommand(Ul,{index:p,option:y}),f.preventDefault(),f.stopImmediatePropagation()}return!0},a),e.registerCommand(be.KEY_ARROW_UP_COMMAND,f=>{if(i!==null&&i.length&&d!==null){var p=d!==0?d-1:i.length-1;c(p),p=i[p],p.ref!=null&&p.ref.current&&Yl(p.ref.current),f.preventDefault(),f.stopImmediatePropagation()}return!0},a),e.registerCommand(be.KEY_ESCAPE_COMMAND,f=>(f.preventDefault(),f.stopImmediatePropagation(),t(),!0),a),e.registerCommand(be.KEY_TAB_COMMAND,f=>i===null||d===null||i[d]==null?!1:(f.preventDefault(),f.stopImmediatePropagation(),h(i[d]),!0),a),e.registerCommand(be.KEY_ENTER_COMMAND,f=>i===null||d===null||i[d]==null?!1:(f!==null&&(f.preventDefault(),f.stopImmediatePropagation()),h(i[d]),!0),a)),[h,t,e,i,d,c,a]);let g=G.useMemo(()=>({options:i,selectOptionAndCleanUp:h,selectedIndex:d,setHighlightedIndex:u}),[h,d,i]);return o(r,g,n.match?n.match.matchingString:"")}function zh(t,e,r){let[n]=ko.useLexicalComposerContext(),i=G.useRef(document.createElement("div")),o=G.useCallback(()=>{i.current.style.top=i.current.style.bottom;const s=n.getRootElement(),a=i.current;var d=a.firstChild;if(s!==null&&t!==null){const{left:h,top:c,width:g,height:f}=t.getRect();if(a.style.top=`${c+window.pageYOffset+i.current.offsetHeight+3}px`,a.style.left=`${h+window.pageXOffset}px`,a.style.height=`${f}px`,a.style.width=`${g}px`,d!==null){d.style.top=`${c}`;var u=d.getBoundingClientRect();d=u.height,u=u.width;const p=s.getBoundingClientRect();h+u>p.right&&(a.style.left=`${p.right-u+window.pageXOffset}px`),(c+d>window.innerHeight||c+d>p.bottom)&&c-p.top>d&&(a.style.top=`${c-d+window.pageYOffset-f}px`)}a.isConnected||(r!=null&&(a.className=r),a.setAttribute("aria-label","Typeahead menu"),a.setAttribute("id","typeahead-menu"),a.setAttribute("role","listbox"),a.style.display="block",a.style.position="absolute",document.body.append(a)),i.current=a,s.setAttribute("aria-controls","typeahead-menu")}},[n,t,r]);G.useEffect(()=>{let s=n.getRootElement();if(t!==null)return o(),()=>{s!==null&&s.removeAttribute("aria-controls");let a=i.current;a!==null&&a.isConnected&&a.remove()}},[n,o,t]);let l=G.useCallback(s=>{t!==null&&(s||e(null))},[t,e]);return Lh(t,i.current,o,l),i}function Fh(t){G.startTransition?G.startTransition(t):t()}Ao.LexicalNodeMenuPlugin=function({options:t,nodeKey:e,onClose:r,onOpen:n,onSelectOption:i,menuRenderFn:o,anchorClassName:l,commandPriority:s=be.COMMAND_PRIORITY_LOW}){let[a]=ko.useLexicalComposerContext(),[d,u]=G.useState(null);l=zh(d,u,l);let h=G.useCallback(()=>{u(null),r!=null&&d!==null&&r()},[r,d]),c=G.useCallback(f=>{u(f),n!=null&&d===null&&n(f)},[n,d]),g=G.useCallback(()=>{e?a.update(()=>{const f=be.$getNodeByKey(e),p=a.getElementByKey(e);f!=null&&p!=null&&d==null&&Fh(()=>c({getRect:()=>p.getBoundingClientRect()}))}):e==null&&d!=null&&h()},[h,a,e,c,d]);return G.useEffect(()=>{g()},[g,e]),G.useEffect(()=>{if(e!=null)return a.registerUpdateListener(({dirtyElements:f})=>{f.get(e)&&g()})},[a,g,e]),d===null||a===null?null:G.createElement(bh,{close:h,resolution:d,editor:a,anchorElementRef:l,options:t,menuRenderFn:o,onSelectOption:i,commandPriority:s})};Ao.MenuOption=kh;const Bh=Ao;var Kh=Bh,pr=Zt,Wh=oe,nd=Kh,Hh=Q,Gt=O,Be=A;let id=Gt.createCommand("INSERT_EMBED_COMMAND");class Yh extends nd.MenuOption{constructor(e,r){super(e),this.title=e,this.onSelect=r.onSelect.bind(this)}}Gn.AutoEmbedOption=Yh;Gn.INSERT_EMBED_COMMAND=id;Gn.LexicalAutoEmbedPlugin=function({embedConfigs:t,onOpenEmbedModalForConfig:e,getMenuOptions:r,menuRenderFn:n,menuCommandPriority:i=Gt.COMMAND_PRIORITY_LOW}){let[o]=Wh.useLexicalComposerContext(),[l,s]=Be.useState(null),[a,d]=Be.useState(null),u=Be.useCallback(()=>{s(null),d(null)},[]),h=Be.useCallback(p=>{o.getEditorState().read(async()=>{const y=Gt.$getNodeByKey(p);if(pr.$isLinkNode(y))for(let v=0;v<t.length;v++){const M=t[v];await Promise.resolve(M.parseUrl(y.__url))!=null&&(d(M),s(y.getKey()))}})},[o,t]);Be.useEffect(()=>{let p=(y,{updateTags:v,dirtyLeaves:M})=>{for(const[R,b]of y)b==="created"&&v.has("paste")&&3>=M.size?h(R):R===l&&u()};return Hh.mergeRegister(...[pr.LinkNode,pr.AutoLinkNode].map(y=>o.registerMutationListener(y,(...v)=>p(...v))))},[h,o,t,l,u]),Be.useEffect(()=>o.registerCommand(id,p=>{let y=t.find(({type:v})=>v===p);return y?(e(y),!0):!1},Gt.COMMAND_PRIORITY_EDITOR),[o,t,e]);let c=Be.useCallback(async()=>{if(a!=null&&l!=null){const p=o.getEditorState().read(()=>{const y=Gt.$getNodeByKey(l);return pr.$isLinkNode(y)?y:null});if(pr.$isLinkNode(p)){const y=await Promise.resolve(a.parseUrl(p.__url));y!=null&&o.update(()=>{Gt.$getSelection()||p.selectEnd(),a.insertNode(o,y),p.isAttached()&&p.remove()})}}},[a,o,l]),g=Be.useMemo(()=>a!=null&&l!=null?r(a,c,u):[],[a,c,r,l,u]),f=Be.useCallback((p,y,v)=>{o.update(()=>{p.onSelect(y),v()})},[o]);return l!=null?Be.createElement(nd.LexicalNodeMenuPlugin,{nodeKey:l,onClose:u,onSelectOption:f,options:g,menuRenderFn:n,commandPriority:i}):null};Gn.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function Nr(t){return t.disabled?t.children:$.jsx(Od,{arrow:!0,...t})}const Gh={bold:{parts:[{type:"path",props:{d:"M8.21 13c2.106 0 3.412-1.087 3.412-2.823 0-1.306-.984-2.283-2.324-2.386v-.055a2.176 2.176 0 0 0 1.852-2.14c0-1.51-1.162-2.46-3.014-2.46H3.843V13H8.21zM5.908 4.674h1.696c.963 0 1.517.451 1.517 1.244 0 .834-.629 1.32-1.73 1.32H5.908V4.673zm0 6.788V8.598h1.73c1.217 0 1.88.492 1.88 1.415 0 .943-.643 1.449-1.832 1.449H5.907z"}}],viewSize:16},h1:{parts:[{type:"path",props:{d:"M8.637 13V3.669H7.379V7.62H2.758V3.67H1.5V13h1.258V8.728h4.62V13h1.259zm5.329 0V3.669h-1.244L10.5 5.316v1.265l2.16-1.565h.062V13h1.244z"}}],viewSize:16},h2:{parts:[{type:"path",props:{d:"M7.638 13V3.669H6.38V7.62H1.759V3.67H.5V13h1.258V8.728h4.62V13h1.259zm3.022-6.733v-.048c0-.889.63-1.668 1.716-1.668.957 0 1.675.608 1.675 1.572 0 .855-.554 1.504-1.067 2.085l-3.513 3.999V13H15.5v-1.094h-4.245v-.075l2.481-2.844c.875-.998 1.586-1.784 1.586-2.953 0-1.463-1.155-2.556-2.919-2.556-1.941 0-2.966 1.326-2.966 2.74v.049h1.223z"}}],viewSize:16},h3:{parts:[{type:"path",props:{d:"M7.637 13V3.669H6.379V7.62H1.758V3.67H.5V13h1.258V8.728h4.62V13h1.259zm3.625-4.272h1.018c1.142 0 1.935.67 1.949 1.674.013 1.005-.78 1.737-2.01 1.73-1.08-.007-1.853-.588-1.935-1.32H9.108c.069 1.327 1.224 2.386 3.083 2.386 1.935 0 3.343-1.155 3.309-2.789-.027-1.51-1.251-2.16-2.037-2.249v-.068c.704-.123 1.764-.91 1.723-2.229-.035-1.353-1.176-2.4-2.954-2.385-1.873.006-2.857 1.162-2.898 2.358h1.196c.062-.69.711-1.299 1.696-1.299.998 0 1.695.622 1.695 1.525.007.922-.718 1.592-1.695 1.592h-.964v1.074z"}}],viewSize:16},h4:{parts:[{type:"path",props:{d:"M7.637 13V3.669H6.379V7.62H1.758V3.67H.5V13h1.258V8.728h4.62V13Zm5.337.2v-2.328H9.108V9.828l3.441-6.35h1.632v6.141H15.5v1.253h-1.319V13.2Zm-2.615-3.581h2.615V6.7L13 4.689l-.872 1.7z"}}],viewSize:16},italic:{parts:[{type:"path",props:{d:"M7.991 11.674 9.53 4.455c.123-.595.246-.71 1.347-.807l.11-.52H7.211l-.11.52c1.06.096 1.128.212 1.005.807L6.57 11.674c-.123.595-.246.71-1.346.806l-.11.52h3.774l.11-.52c-1.06-.095-1.129-.211-1.006-.806z"}}],viewSize:16},strikethrough:{parts:[{type:"path",props:{d:"M6.333 5.686c0 .31.083.581.27.814H5.166a2.776 2.776 0 0 1-.099-.76c0-1.627 1.436-2.768 3.48-2.768 1.969 0 3.39 1.175 3.445 2.85h-1.23c-.11-1.08-.964-1.743-2.25-1.743-1.23 0-2.18.602-2.18 1.607zm2.194 7.478c-2.153 0-3.589-1.107-3.705-2.81h1.23c.144 1.06 1.129 1.703 2.544 1.703 1.34 0 2.31-.705 2.31-1.675 0-.827-.547-1.374-1.914-1.675L8.046 8.5H1v-1h14v1h-3.504c.468.437.675.994.675 1.697 0 1.826-1.436 2.967-3.644 2.967z"}}],viewSize:16},subscript:{parts:[{type:"path",props:{d:"M11.354 14.5v-.665l1.553-1.438c.132-.128.243-.243.332-.345.091-.102.16-.203.207-.3.047-.1.07-.207.07-.322a.574.574 0 0 0-.326-.546.748.748 0 0 0-.343-.077.721.721 0 0 0-.35.082.557.557 0 0 0-.23.232.753.753 0 0 0-.08.36h-.876c0-.286.065-.534.194-.744.13-.21.31-.373.543-.488.233-.115.502-.172.806-.172.312 0 .584.055.816.166.233.11.414.261.543.456.13.194.194.418.194.669 0 .165-.033.327-.098.488-.064.16-.178.339-.343.535a7.918 7.918 0 0 1-.697.7l-.637.625v.03h1.832v.754h-3.11ZM5.04 4.273 6.96 7.469h.068l1.93-3.196h1.803L8.073 8.636 10.805 13H8.972L7.03 9.825h-.068L5.018 13H3.194l2.757-4.364-2.723-4.363H5.04Z"}}],viewSize:16},superscript:{parts:[{type:"path",props:{d:"M11.354 6v-.665l1.553-1.438c.132-.128.243-.243.332-.345a1.31 1.31 0 0 0 .207-.3c.047-.1.07-.207.07-.322a.574.574 0 0 0-.326-.545.748.748 0 0 0-.343-.077.721.721 0 0 0-.35.08.557.557 0 0 0-.23.233.753.753 0 0 0-.08.36h-.876c0-.286.065-.534.194-.744.13-.21.31-.373.543-.488.233-.115.502-.172.806-.172.312 0 .584.055.816.166.233.11.414.261.543.456.13.194.194.417.194.669 0 .165-.033.327-.098.488-.064.16-.178.339-.343.535a7.92 7.92 0 0 1-.697.7l-.637.625v.03h1.832V6h-3.11ZM5.04 4.273 6.96 7.469h.068l1.93-3.196h1.803L8.073 8.636 10.805 13H8.972L7.03 9.825h-.068L5.018 13H3.194l2.757-4.364-2.723-4.363H5.04Z"}}],viewSize:16},underline:{parts:[{type:"path",props:{d:"M5.313 3.136h-1.23V9.54c0 2.105 1.47 3.623 3.917 3.623s3.917-1.518 3.917-3.623V3.136h-1.23v6.323c0 1.49-.978 2.57-2.687 2.57-1.709 0-2.687-1.08-2.687-2.57V3.136zM12.5 15h-9v-1h9v1z"}}],viewSize:16},textStyle:{parts:[{type:"path",props:{d:"M4.648 4.475 1.824 12.25H.67l3.252-8.531h.744l-.018.756Zm2.368 7.775-2.83-7.775-.018-.756h.744l3.264 8.531h-1.16Zm-.147-3.158v.926H2.076v-.926H6.87Zm6.024 2.074V7.902c0-.25-.051-.466-.153-.65a.997.997 0 0 0-.445-.434c-.2-.101-.445-.152-.738-.152-.274 0-.514.047-.721.14a1.255 1.255 0 0 0-.48.37.809.809 0 0 0-.17.492H9.101c0-.227.058-.451.175-.674.118-.223.286-.424.504-.603.223-.184.489-.329.797-.434.313-.11.66-.164 1.043-.164.461 0 .867.078 1.219.234.355.157.633.393.832.71.203.312.305.704.305 1.177v2.953c0 .211.017.436.052.674.04.238.096.443.17.615v.094h-1.13a2.022 2.022 0 0 1-.13-.498 4.011 4.011 0 0 1-.046-.586Zm.187-2.76.012.762h-1.096c-.309 0-.584.025-.826.076a1.89 1.89 0 0 0-.61.217.979.979 0 0 0-.504.879c0 .2.046.38.135.545a.98.98 0 0 0 .405.392c.183.094.408.141.674.141.332 0 .625-.07.878-.211a1.83 1.83 0 0 0 .604-.516c.152-.203.234-.4.246-.591l.463.521a1.572 1.572 0 0 1-.223.545 2.607 2.607 0 0 1-1.2 1.025 2.328 2.328 0 0 1-.927.176c-.43 0-.806-.084-1.13-.252a1.933 1.933 0 0 1-.75-.674 1.784 1.784 0 0 1-.264-.955c0-.34.066-.638.199-.896a1.73 1.73 0 0 1 .574-.65c.25-.176.551-.31.903-.399a4.76 4.76 0 0 1 1.177-.135h1.26Z"}}],viewSize:16},horizontalRule:{parts:[{type:"path",props:{d:"M0 10.5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1H.5a.5.5 0 0 1-.5-.5zM12 0H4a2 2 0 0 0-2 2v7h1V2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v7h1V2a2 2 0 0 0-2-2zm2 12h-1v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-2H2v2a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-2z"}}],viewSize:16},fileImage:{parts:[{type:"path",props:{d:"M8.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"}},{type:"path",props:{d:"M12 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM3 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8l-2.083-2.083a.5.5 0 0 0-.76.063L8 11 5.835 9.7a.5.5 0 0 0-.611.076L3 12V2z"}}],viewSize:16},table:{parts:[{type:"path",props:{d:"M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm15 2h-4v3h4V4zm0 4h-4v3h4V8zm0 4h-4v3h3a1 1 0 0 0 1-1v-2zm-5 3v-3H6v3h4zm-5 0v-3H1v2a1 1 0 0 0 1 1h3zm-4-4h4V8H1v3zm0-4h4V4H1v3zm5-3v3h4V4H6zm4 4H6v3h4V8z"}}],viewSize:16},paragraph:{parts:[{type:"path",props:{d:"M8 1h4.5a.5.5 0 0 1 0 1H11v12.5a.5.5 0 0 1-1 0V2H9v12.5a.5.5 0 0 1-1 0V1z"}},{type:"path",props:{d:"M9 1v8H7a4 4 0 1 1 0-8h2z"}}],viewSize:16},numberedList:{parts:[{type:"path",props:{d:"M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5z"}},{type:"path",props:{d:"M1.713 11.865v-.474H2c.217 0 .363-.137.363-.317 0-.185-.158-.31-.361-.31-.223 0-.367.152-.373.31h-.59c.016-.467.373-.787.986-.787.588-.002.954.291.957.703a.595.595 0 0 1-.492.594v.033a.615.615 0 0 1 .569.631c.003.533-.502.8-1.051.8-.656 0-1-.37-1.008-.794h.582c.008.178.186.306.422.309.254 0 .424-.145.422-.35-.002-.195-.155-.348-.414-.348h-.3zm-.004-4.699h-.604v-.035c0-.408.295-.844.958-.844.583 0 .96.326.96.756 0 .389-.257.617-.476.848l-.537.572v.03h1.054V9H1.143v-.395l.957-.99c.138-.142.293-.304.293-.508 0-.18-.147-.32-.342-.32a.33.33 0 0 0-.342.338v.041zM2.564 5h-.635V2.924h-.031l-.598.42v-.567l.629-.443h.635V5z"}}],viewSize:16},bulletList:{parts:[{type:"path",props:{d:"M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm-3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"}}],viewSize:16},squareCheck:{parts:[{type:"path",props:{d:"M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}},{type:"path",props:{d:"M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.235.235 0 0 1 .02-.022z"}}],viewSize:16},quote:{parts:[{type:"path",props:{d:"M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2.5a2 2 0 0 0-1.6.8L8 14.333 6.1 11.8a2 2 0 0 0-1.6-.8H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2.5a1 1 0 0 1 .8.4l1.9 2.533a1 1 0 0 0 1.6 0l1.9-2.533a1 1 0 0 1 .8-.4H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}},{type:"path",props:{d:"M7.066 4.76A1.665 1.665 0 0 0 4 5.668a1.667 1.667 0 0 0 2.561 1.406c-.131.389-.375.804-.777 1.22a.417.417 0 1 0 .6.58c1.486-1.54 1.293-3.214.682-4.112zm4 0A1.665 1.665 0 0 0 8 5.668a1.667 1.667 0 0 0 2.561 1.406c-.131.389-.375.804-.777 1.22a.417.417 0 1 0 .6.58c1.486-1.54 1.293-3.214.682-4.112z"}}],viewSize:16},textCenter:{parts:[{type:"path",props:{d:"M4 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},textLeft:{parts:[{type:"path",props:{d:"M2 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},textRight:{parts:[{type:"path",props:{d:"M6 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm4-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},justify:{parts:[{type:"path",props:{d:"M2 12.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},outdent:{parts:[{type:"path",props:{d:"M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm10.646 2.146a.5.5 0 0 1 .708.708L11.707 8l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708l2-2zM2 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},indent:{parts:[{type:"path",props:{d:"M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm.646 2.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L4.293 8 2.646 6.354a.5.5 0 0 1 0-.708zM7 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"}}],viewSize:16},tweet:{parts:[{type:"path",props:{d:"M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z"}}],viewSize:16},youtube:{parts:[{type:"path",props:{d:"M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z"}}],viewSize:16},arrowClockwise:{parts:[{type:"path",props:{d:"M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"}},{type:"path",props:{d:"M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"}}],viewSize:16},arrowCounterclockwise:{parts:[{type:"path",props:{d:"M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z"}},{type:"path",props:{d:"M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"}}],viewSize:16},link:{parts:[{type:"path",props:{d:"M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9c-.086 0-.17.01-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"}},{type:"path",props:{d:"M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4.02 4.02 0 0 1-.82 1H12a3 3 0 1 0 0-6H9z"}}],viewSize:16},plus:{parts:[{type:"path",props:{d:"M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"}}],viewSize:16},fontColor:{parts:[{type:"path",props:{d:"M221.631 109 109.92 392h58.055l24.079-61h127.892l24.079 61h58.055L290.369 109Zm-8.261 168L256 169l42.63 108Z"}}],viewSize:512},fontFamily:{parts:[{type:"path",props:{d:"M12.258 3h-8.51l-.083 2.46h.479c.26-1.544.758-1.783 2.693-1.845l.424-.013v7.827c0 .663-.144.82-1.3.923v.52h4.082v-.52c-1.162-.103-1.306-.26-1.306-.923V3.602l.431.013c1.934.062 2.434.301 2.693 1.846h.479L12.258 3z"}}],viewSize:16},bgColor:{parts:[{type:"path",props:{d:"M0 0h48v48H0z",fill:"#fff",fillOpacity:".01"}},{type:"path",props:{d:"M37 37a4 4 0 0 0 4-4c0-1.473-1.333-3.473-4-6-2.667 2.527-4 4.527-4 6a4 4 0 0 0 4 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"#68676C"}},{type:"path",props:{d:"m20.854 5.504 3.535 3.536",strokeWidth:"4",strokeLinecap:"round",stroke:"#68676C"}},{type:"path",props:{d:"M23.682 8.333 8.125 23.889 19.44 35.203l15.556-15.557L23.682 8.333Z",strokeWidth:"4",strokeLinejoin:"round",stroke:"#68676C"}},{type:"path",props:{d:"m12 20.073 16.961 5.577M4 43h40",strokeWidth:"4",strokeLinecap:"round",stroke:"#68676C"}}],viewSize:48},openLink:{parts:[{type:"path",props:{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}}],viewSize:24},linkOff:{parts:[{type:"path",props:{d:"M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3 2 4.27z"}}],viewSize:24},draggableBlock:{parts:[{type:"path",props:{d:"M8.5 10a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm0 7a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm7-10a2 2 0 1 0-2-2 2 2 0 0 0 2 2Zm-7-4a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm7 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm0-7a2 2 0 1 0 2 2 2 2 0 0 0-2-2Z"}}],viewSize:24}};function St({name:t,size:e=20,style:r={},...n}){const i=Gh[t]||Bd[t];if(!i)return null;const{parts:o,viewSize:l}=i,s={...r,fontSize:e||l},a=typeof l=="number"?`0 0 ${l} ${l}`:l;return $.jsx($d,{viewBox:a,style:s,...n,children:o.map((d,u)=>$.jsx(d.type,{...d.props},`Icon-parts--${u.toString()}`))})}function Uh(t,e){return e?E.gray.dark:t?E.black:E.gray.darkest}const qt=H(mi("button",["active"]))(({disabled:t,active:e})=>({border:0,display:"flex",background:"none",borderRadius:10,padding:8,cursor:"pointer",flexShrink:0,alignItems:"center",justifyContent:"space-between",color:Uh(e,t),backgroundColor:e?E.gray.light:"transparent",transition:he.transition(),"&:disabled":{cursor:"default",opacity:.8},"&:not(:disabled):hover":{backgroundColor:E.gray.normal},"&:active":{color:E.black}})),Vi={Select:H(Md)({border:0,height:36,borderRadius:10,transition:he.transition(),"&:hover":{backgroundColor:E.gray.normal},"& .MuiSelect-select":{display:"flex",alignItems:"center",color:E.gray.darkest,padding:"0 34px 0 12px"}}),Option:H("div")({display:"flex",alignItems:"center",gap:8})},Lg={Container:H("div")({backgroundColor:E.white,boxShadow:es,padding:16,borderRadius:8,minWidth:250}),ButtonWrapper:H("div")({marginTop:16})},an={Container:H("div")({maxWidth:400,backgroundColor:E.white,boxShadow:es,padding:4,borderRadius:8,transition:"opacity 0.5s",willChange:"transform"}),EditWrapper:H("div")({display:"grid",gridTemplateColumns:"1fr 36px",width:300,padding:5,gap:8}),SubmitButtonWrapper:H("div")({paddingTop:7}),Actions:H("div")({display:"flex",alignItems:"center",gap:10})},bg={Container:H("div")({display:"flex",padding:4,borderBottom:`2px solid ${E.gray.normal}`,flexWrap:"wrap",gap:"6px 4px"}),IconButton:qt,Divider:H("div")({width:1,backgroundColor:E.gray.normal,margin:"0 4px"})},Vh=Vi.Option;function jh({children:t,options:e,title:r,...n}){const i=r?Nr:A.Fragment,[o,l]=A.useState(!1),[s,a]=A.useState(!1),d=r?{title:r,open:o}:{};return $.jsx(i,{...d,children:$.jsxs(Vi.Select,{onOpen:()=>{a(!0),l(!1),setTimeout(()=>{const u=document.querySelector(".Mui-focusVisible");!n.value&&u&&u.classList.remove("Mui-focusVisible")},50)},onClose:()=>{a(!1)},onMouseEnter:()=>{s||l(!0)},onMouseLeave:()=>l(!1),MenuProps:{anchorOrigin:{vertical:40,horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},...n,children:[e&&e.map(({icon:u,label:h,iconProps:c,...g})=>$.jsx(ts,{...g,children:$.jsxs(Vi.Option,{children:[u&&$.jsx(St,{name:u,size:20,...c}),h]})},g.value)),t]})})}var ql;const Jh=((ql=navigator==null?void 0:navigator.userAgentData)==null?void 0:ql.platform)||(navigator==null?void 0:navigator.platform)||"unknown",zg=/Mac|iPod|iPhone|iPad/.test(Jh);function Xh(t){const{anchor:e,focus:r}=t,n=t.anchor.getNode(),i=t.focus.getNode();return n===i?n:t.isBackward()?Rt.$isAtNodeEnd(r)?n:i:Rt.$isAtNodeEnd(e)?n:i}var od={},Io={},Zh=O;class ld extends Zh.DecoratorNode{constructor(e,r){super(r),this.__format=e||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){this.getWritable().__format=e}isInline(){return!1}}Io.$isDecoratorBlockNode=function(t){return t instanceof ld};Io.DecoratorBlockNode=ld;const qh=Io;var Po=qh,Qh=oe,Vl=Po,eg=td,jl=Q,ce=O,dn=A;od.BlockWithAlignableContents=function({children:t,format:e,nodeKey:r,className:n}){let[i]=Qh.useLexicalComposerContext(),[o,l,s]=eg.useLexicalNodeSelection(r),a=dn.useRef(null),d=dn.useCallback(u=>(o&&ce.$isNodeSelection(ce.$getSelection())&&(u.preventDefault(),u=ce.$getNodeByKey(r),ce.$isDecoratorNode(u)&&u.remove()),!1),[o,r]);return dn.useEffect(()=>jl.mergeRegister(i.registerCommand(ce.FORMAT_ELEMENT_COMMAND,u=>{if(o){var h=ce.$getSelection();if(ce.$isNodeSelection(h)){var c=ce.$getNodeByKey(r);Vl.$isDecoratorBlockNode(c)&&c.setFormat(u)}else if(ce.$isRangeSelection(h)){h=h.getNodes();for(c of h)Vl.$isDecoratorBlockNode(c)?c.setFormat(u):jl.$getNearestBlockElementAncestorOrThrow(c).setFormat(u)}return!0}return!1},ce.COMMAND_PRIORITY_LOW),i.registerCommand(ce.CLICK_COMMAND,u=>u.target===a.current?(u.preventDefault(),u.shiftKey||s(),l(!o),!0):!1,ce.COMMAND_PRIORITY_LOW),i.registerCommand(ce.KEY_DELETE_COMMAND,d,ce.COMMAND_PRIORITY_LOW),i.registerCommand(ce.KEY_BACKSPACE_COMMAND,d,ce.COMMAND_PRIORITY_LOW)),[s,i,o,r,d,l]),dn.createElement("div",{className:[n.base,o?n.focus:null].filter(Boolean).join(" "),ref:a,style:{textAlign:e||void 0}},t)};const tg=od;var sd=tg;const rg="https://platform.twitter.com/widgets.js";function ng(t){const e=t.getAttribute("data-lexical-tweet-id");return e?{node:Lo(e)}:null}let Jl=!0;function ig({className:t,format:e,loadingComponent:r,nodeKey:n,onError:i,onLoad:o,tweetID:l}){const s=A.useRef(null),a=A.useRef(""),[d,u]=A.useState(!1),h=A.useCallback(async()=>{try{await window.twttr.widgets.createTweet(l,s.current),u(!1),Jl=!1,o&&o()}catch(c){i&&i(String(c))}},[i,o,l]);return A.useEffect(()=>{var c;if(l!==a.current){if(u(!0),Jl){const g=document.createElement("script");g.src=rg,g.async=!0,(c=document.body)==null||c.appendChild(g),g.onload=h,i&&(g.onerror=i)}else h();a&&(a.current=l)}},[h,i,l]),$.jsxs(sd.BlockWithAlignableContents,{className:t,format:e,nodeKey:n,children:[d?r:null,$.jsx("div",{style:{display:"inline-block",width:"550px"},ref:s})]})}class Un extends Po.DecoratorBlockNode{static getType(){return"tweet"}static clone(e){return new Un(e.__id,e.__format,e.__key)}static importJSON(e){const r=Lo(e.id);return r.setFormat(e.format),r}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:e=>e.hasAttribute("data-lexical-tweet-id")?{conversion:ng,priority:2}:null}}exportDOM(){const e=document.createElement("div");e.setAttribute("data-lexical-tweet-id",this.__id);const r=document.createTextNode(this.getTextContent());return e.append(r),{element:e}}constructor(e,r,n){super(r,n),this.__id=e}getId(){return this.__id}getTextContent(){return`https://twitter.com/i/web/status/${this.__id}`}decorate(e,r){const n=r.theme.embedBlock||{},i={base:n.base||"",focus:n.focus||""};return $.jsx(ig,{className:i,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}isInline(){return!1}}function Lo(t){return new Un(t)}const og=O.createCommand("INSERT_TWEET_COMMAND");function Fg(){const[t]=oe.useLexicalComposerContext();return A.useEffect(()=>{if(!t.hasNodes([Un]))throw new Error("TwitterPlugin: TweetNode not registered on editor");return t.registerCommand(og,e=>{const r=Lo(e);return Q.$insertNodeToNearestRoot(r),!0},O.COMMAND_PRIORITY_EDITOR)},[t]),null}function lg({className:t,format:e,nodeKey:r,videoID:n}){return $.jsx(sd.BlockWithAlignableContents,{className:t,format:e,nodeKey:r,children:$.jsx("iframe",{width:"560",src:`https://www.youtube.com/embed/${n}`,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video",style:{border:0,maxWidth:"100%",aspectRatio:"16 / 9"}})})}class Vn extends Po.DecoratorBlockNode{static getType(){return"youtube"}static clone(e){return new Vn(e.__id,e.__format,e.__key)}static importJSON(e){const r=ad(e.videoID);return r.setFormat(e.format),r}exportJSON(){return{...super.exportJSON(),type:"youtube",version:1,videoID:this.__id}}constructor(e,r,n){super(r,n),this.__id=e}updateDOM(){return!1}getId(){return this.__id}getTextContent(){return`https://www.youtube.com/watch?v=${this.__id}`}decorate(e,r){const n=r.theme.embedBlock||{},i={base:n.base||"",focus:n.focus||""};return $.jsx(lg,{className:i,format:this.__format,nodeKey:this.getKey(),videoID:this.__id})}isInline(){return!1}}function ad(t){return new Vn(t)}const sg=O.createCommand("INSERT_YOUTUBE_COMMAND");function Bg(){const[t]=oe.useLexicalComposerContext();return A.useEffect(()=>{if(!t.hasNodes([Vn]))throw new Error("YouTubePlugin: YouTubeNode not registered on editor");return t.registerCommand(sg,e=>{const r=ad(e);return Q.$insertNodeToNearestRoot(r),!0},O.COMMAND_PRIORITY_EDITOR)},[t]),null}var I={},_=O,z=Q;function Z(t){let e=new URLSearchParams;e.append("code",t);for(let r=1;r<arguments.length;r++)e.append("v",arguments[r]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class jn extends _.INTERNAL_PointSelection{constructor(e,r,n){super(r,n),this.gridKey=e}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ae(e)?this.gridKey===e.gridKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus):!1}set(e,r,n){this.dirty=!0,this.gridKey=e,this.anchor.key=r,this.focus.key=n,this._cachedNodes=null}clone(){return new jn(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(e){let r=this.focus.getNode();if(!_.$isElementNode(r))throw Error("Expected GridSelection focus to be an ElementNode");_.$normalizeSelection__EXPERIMENTAL(r.select(0,r.getChildrenSize())).insertNodes(e)}getShape(){var e=_.$getNodeByKey(this.anchor.key);if(_.DEPRECATED_$isGridCellNode(e)||Z(103),e=_.DEPRECATED_$getGridCellNodeRect(e),e===null)throw Error("getCellRect: expected to find AnchorNode");var r=_.$getNodeByKey(this.focus.key);_.DEPRECATED_$isGridCellNode(r)||Z(104);let n=_.DEPRECATED_$getGridCellNodeRect(r);if(n===null)throw Error("getCellRect: expected to find focusCellNode");r=Math.min(e.columnIndex,n.columnIndex);let i=Math.max(e.columnIndex,n.columnIndex),o=Math.min(e.rowIndex,n.rowIndex);return e=Math.max(e.rowIndex,n.rowIndex),{fromX:Math.min(r,i),fromY:Math.min(o,e),toX:Math.max(r,i),toY:Math.max(o,e)}}getNodes(){function e(y){let{cell:v,startColumn:M,startRow:R}=y;d=Math.min(d,M),u=Math.min(u,R),h=Math.max(h,M+v.__colSpan-1),c=Math.max(c,R+v.__rowSpan-1)}var r=this._cachedNodes;if(r!==null)return r;var n=this.anchor.getNode();r=this.focus.getNode();var i=z.$findMatchingParent(n,_.DEPRECATED_$isGridCellNode);n=z.$findMatchingParent(r,_.DEPRECATED_$isGridCellNode),_.DEPRECATED_$isGridCellNode(i)||Z(103),_.DEPRECATED_$isGridCellNode(n)||Z(104),r=i.getParent(),_.DEPRECATED_$isGridRowNode(r)||Z(105),r=r.getParent(),_.DEPRECATED_$isGridNode(r)||Z(106);var o=n.getParents()[1];if(o!==r){if(r.isParentOf(n)){if(r=o.getParent(),r==null)throw Error("Expected focusCellParent to have a parent");this.set(this.gridKey,n.getKey(),r.getKey())}else{if(r=r.getParent(),r==null)throw Error("Expected gridParent to have a parent");this.set(this.gridKey,r.getKey(),n.getKey())}return this.getNodes()}let[l,s,a]=_.DEPRECATED_$computeGridMap(r,i,n),d=Math.min(s.startColumn,a.startColumn),u=Math.min(s.startRow,a.startRow),h=Math.max(s.startColumn+s.cell.__colSpan-1,a.startColumn+a.cell.__colSpan-1),c=Math.max(s.startRow+s.cell.__rowSpan-1,a.startRow+a.cell.__rowSpan-1);n=d,i=u,o=d;for(var g=u;d<n||u<i||h>o||c>g;){if(d<n){var f=g-i;--n;for(var p=0;p<=f;p++)e(l[i+p][n])}if(u<i)for(f=o-n,--i,p=0;p<=f;p++)e(l[i][n+p]);if(h>o)for(f=g-i,o+=1,p=0;p<=f;p++)e(l[i+p][o]);if(c>g)for(f=o-n,g+=1,p=0;p<=f;p++)e(l[g][n+p])}for(r=[r],n=null,i=u;i<=c;i++)for(o=d;o<=h;o++)({cell:g}=l[i][o]),f=g.getParent(),_.DEPRECATED_$isGridRowNode(f)||Z(107),f!==n&&r.push(f),r.push(g,...ag(g)),n=f;return _.isCurrentlyReadOnlyMode()||(this._cachedNodes=r),r}getTextContent(){let e=this.getNodes(),r="";for(let n=0;n<e.length;n++)r+=e[n].getTextContent();return r}}function ae(t){return t instanceof jn}function Mn(){let t=_.$createPoint("root",0,"element"),e=_.$createPoint("root",0,"element");return new jn("root",t,e)}function ag(t){let e=[],r=[t];for(;0<r.length;){let n=r.pop();n===void 0&&Z(112),_.$isElementNode(n)&&r.unshift(...n.getChildren()),n!==t&&e.push(n)}return e}let dd=/^(\d+(?:\.\d+)?)px$/,U={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Vr extends _.DEPRECATED_GridCellNode{static getType(){return"tablecell"}static clone(e){let r=new Vr(e.__headerState,e.__colSpan,e.__width,e.__key);return r.__rowSpan=e.__rowSpan,r.__backgroundColor=e.__backgroundColor,r}static importDOM(){return{td:()=>({conversion:Xl,priority:0}),th:()=>({conversion:Xl,priority:0})}}static importJSON(e){let r=e.rowSpan||1,n=Pe(e.headerState,e.colSpan||1,e.width||void 0);return n.__rowSpan=r,n.__backgroundColor=e.backgroundColor||null,n}constructor(e=U.NO_STATUS,r=1,n,i){super(r,i),this.__headerState=e,this.__width=n,this.__backgroundColor=null}createDOM(e){let r=document.createElement(this.getTag());return this.__width&&(r.style.width=`${this.__width}px`),1<this.__colSpan&&(r.colSpan=this.__colSpan),1<this.__rowSpan&&(r.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(r.style.backgroundColor=this.__backgroundColor),z.addClassNamesToElement(r,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),r}exportDOM(e){if({element:e}=super.exportDOM(e),e){var r=this.getParentOrThrow().getChildrenSize();e.style.border="1px solid black",1<this.__colSpan&&(e.colSpan=this.__colSpan),1<this.__rowSpan&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||Math.max(90,700/r)}px`,e.style.verticalAlign="top",e.style.textAlign="start",r=this.getBackgroundColor(),r!==null?e.style.backgroundColor=r:this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return{element:e}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),headerState:this.__headerState,type:"tablecell",width:this.getWidth()}}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){let r=this.getWritable();return r.__headerState=(r.__headerState&e)===e?r.__headerState-e:r.__headerState+e,r}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==U.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Xl(t){var e=t.nodeName.toLowerCase();let r;return dd.test(t.style.width)&&(r=parseFloat(t.style.width)),e=Pe(e==="th"?U.ROW:U.NO_STATUS,t.colSpan,r),e.__rowSpan=t.rowSpan,t=t.style.backgroundColor,t!==""&&(e.__backgroundColor=t),{forChild:(n,i)=>P(i)&&!_.$isElementNode(n)?(i=_.$createParagraphNode(),_.$isLineBreakNode(n)&&n.getTextContent()===` `?null:(i.append(n),i)):n,node:e}}function Pe(t,e=1,r){return _.$applyNodeReplacement(new Vr(t,e,r))}function P(t){return t instanceof Vr}class jr extends _.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(e){return new jr(e.__height,e.__key)}static importDOM(){return{tr:()=>({conversion:dg,priority:0})}}static importJSON(e){return At(e.height)}constructor(e,r){super(r),this.__height=e}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(e){let r=document.createElement("tr");return this.__height&&(r.style.height=`${this.__height}px`),z.addClassNamesToElement(r,e.theme.tableRow),r}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function dg(t){let e;return dd.test(t.style.height)&&(e=parseFloat(t.style.height)),{node:At(e)}}function At(t){return _.$applyNodeReplacement(new jr(t))}function kt(t){return t instanceof jr}let ug=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";class ud{constructor(e,r){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.listenersToRemove=new Set,this.tableNodeKey=r,this.editor=e,this.grid={cells:[],columns:0,rows:0},this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.trackTableGrid()}getGrid(){return this.grid}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTableGrid(){let e=new MutationObserver(r=>{this.editor.update(()=>{var n=!1;for(let i=0;i<r.length;i++){const o=r[i].target.nodeName;if(o==="TABLE"||o==="TR"){n=!0;break}}if(n){if(n=this.editor.getElementByKey(this.tableNodeKey),!n)throw Error("Expected to find TableElement in DOM");this.grid=rr(n)}})});this.editor.update(()=>{let r=this.editor.getElementByKey(this.tableNodeKey);if(!r)throw Error("Expected to find TableElement in DOM");this.grid=rr(r),e.observe(r,{childList:!0,subtree:!0})})}clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{var r=_.$getNodeByKey(this.tableNodeKey);if(!tt(r))throw Error("Expected TableNode.");if(r=e.getElementByKey(this.tableNodeKey),!r)throw Error("Expected to find TableElement in DOM");r=rr(r),un(e,r,null),_.$setSelection(null),e.dispatchCommand(_.SELECTION_CHANGE_COMMAND,void 0)})}enableHighlightStyle(){let e=this.editor;e.update(()=>{let r=e.getElementByKey(this.tableNodeKey);if(!r)throw Error("Expected to find TableElement in DOM");z.removeClassNamesFromElement(r,e._config.theme.tableSelection),r.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){let e=this.editor;e.update(()=>{let r=e.getElementByKey(this.tableNodeKey);if(!r)throw Error("Expected to find TableElement in DOM");z.addClassNamesToElement(r,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableGridSelection(e){if(e!=null&&e.gridKey===this.tableNodeKey){let r=this.editor;this.gridSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),un(r,this.grid,this.gridSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.gridKey,this.updateTableGridSelection(e))}setFocusCellForSelection(e,r=!1){let n=this.editor;n.update(()=>{var i=_.$getNodeByKey(this.tableNodeKey);if(!tt(i))throw Error("Expected TableNode.");if(!n.getElementByKey(this.tableNodeKey))throw Error("Expected to find TableElement in DOM");i=e.x;let o=e.y;if(this.focusCell=e,this.anchorCell!==null){let l=ug?(n._window||window).getSelection():null;l&&l.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==i||this.anchorY!==o||r))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(i===this.focusX&&o===this.focusY)return;this.focusX=i,this.focusY=o,this.isHighlightingCells&&(i=_.$getNearestNodeFromDOMNode(e.elem),this.gridSelection!=null&&this.anchorCellNodeKey!=null&&P(i)&&(i=i.getKey(),this.gridSelection=this.gridSelection.clone()||Mn(),this.focusCellNodeKey=i,this.gridSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),_.$setSelection(this.gridSelection),n.dispatchCommand(_.SELECTION_CHANGE_COMMAND,void 0),un(n,this.grid,this.gridSelection)))})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{var r=_.$getNearestNodeFromDOMNode(e.elem);P(r)&&(r=r.getKey(),this.gridSelection=this.gridSelection!=null?this.gridSelection.clone():Mn(),this.anchorCellNodeKey=r)})}formatCells(e){this.editor.update(()=>{let r=_.$getSelection();ae(r)||Z(11);let n=_.$createRangeSelection(),i=n.anchor,o=n.focus;r.getNodes().forEach(l=>{P(l)&&l.getTextContentSize()!==0&&(i.set(l.getKey(),0,"element"),o.set(l.getKey(),l.getChildrenSize(),"element"),n.formatText(e))}),_.$setSelection(r),this.editor.dispatchCommand(_.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){let e=this.editor;e.update(()=>{let r=_.$getNodeByKey(this.tableNodeKey);if(!tt(r))throw Error("Expected TableNode.");var n=_.$getSelection();ae(n)||Z(11),n=n.getNodes().filter(P),n.length===this.grid.columns*this.grid.rows?(r.selectPrevious(),r.remove(),_.$getRoot().selectStart()):(n.forEach(i=>{if(_.$isElementNode(i)){let o=_.$createParagraphNode(),l=_.$createTextNode();o.append(l),i.append(o),i.getChildren().forEach(s=>{s!==o&&s.remove()})}}),un(e,this.grid,null),_.$setSelection(null),e.dispatchCommand(_.SELECTION_CHANGE_COMMAND,void 0))})}}function ji(t){for(;t!=null;){let e=t.nodeName;if(e==="TD"||e==="TH"){if(t=t._cell,t===void 0)break;return t}t=t.parentNode}return null}function rr(t){let e=[],r={cells:e,columns:0,rows:0};var n=t.firstChild;let i=t=0;for(e.length=0;n!=null;){var o=n.nodeName;if(o==="TD"||o==="TH"){o=n,o={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:t,y:i},n._cell=o;let l=e[i];l===void 0&&(l=e[i]=[]),l[t]=o}else if(o=n.firstChild,o!=null){n=o;continue}if(o=n.nextSibling,o!=null)t++,n=o;else if(o=n.parentNode,o!=null){if(n=o.nextSibling,n==null)break;i++,t=0}}return r.columns=t+1,r.rows=i+1,r}function un(t,e,r){let n=new Set(r?r.getNodes():[]);bo(e,(i,o)=>{let l=i.elem;n.has(o)?(i.highlighted=!0,hd(t,i)):(i.highlighted=!1,gd(t,i),l.getAttribute("style")||l.removeAttribute("style"))})}function bo(t,e){({cells:t}=t);for(let r=0;r<t.length;r++){let n=t[r];if(n)for(let i=0;i<n.length;i++){let o=n[i];if(!o)continue;let l=_.$getNearestNodeFromDOMNode(o.elem);l!==null&&e(o,l,{x:i,y:r})}}}function Zl(t,e){e.disableHighlightStyle(),bo(e.grid,r=>{r.highlighted=!0,hd(t,r)})}function cg(t,e){e.enableHighlightStyle(),bo(e.grid,r=>{let n=r.elem;r.highlighted=!1,gd(t,r),n.getAttribute("style")||n.removeAttribute("style")})}let cd=(t,e,r,n,i)=>{const o=i==="forward";switch(i){case"backward":case"forward":return r!==(o?t.grid.columns-1:0)?(t=e.getCellNodeFromCordsOrThrow(r+(o?1:-1),n,t.grid),o?t.selectStart():t.selectEnd()):n!==(o?t.grid.rows-1:0)?(t=e.getCellNodeFromCordsOrThrow(o?0:t.grid.columns-1,n+(o?1:-1),t.grid),o?t.selectStart():t.selectEnd()):o?e.selectNext():e.selectPrevious(),!0;case"up":return n!==0?e.getCellNodeFromCordsOrThrow(r,n-1,t.grid).selectEnd():e.selectPrevious(),!0;case"down":return n!==t.grid.rows-1?e.getCellNodeFromCordsOrThrow(r,n+1,t.grid).selectStart():e.selectNext(),!0;default:return!1}},hg=(t,e,r,n,i)=>{const o=i==="forward";switch(i){case"backward":case"forward":return r!==(o?t.grid.columns-1:0)&&t.setFocusCellForSelection(e.getCellFromCordsOrThrow(r+(o?1:-1),n,t.grid)),!0;case"up":return n!==0?(t.setFocusCellForSelection(e.getCellFromCordsOrThrow(r,n-1,t.grid)),!0):!1;case"down":return n!==t.grid.rows-1?(t.setFocusCellForSelection(e.getCellFromCordsOrThrow(r,n+1,t.grid)),!0):!1;default:return!1}};function Ut(t,e){if(_.$isRangeSelection(t)||ae(t)){let r=e.isParentOf(t.anchor.getNode());return t=e.isParentOf(t.focus.getNode()),r&&t}return!1}function hd(t,e){t=e.elem,e=_.$getNearestNodeFromDOMNode(t),P(e)||Z(131),e.getBackgroundColor()===null?t.style.setProperty("background-color","rgb(172,206,247)"):t.style.setProperty("background-image","linear-gradient(to right, rgba(172,206,247,0.85), rgba(172,206,247,0.85))"),t.style.setProperty("caret-color","transparent")}function gd(t,e){t=e.elem,e=_.$getNearestNodeFromDOMNode(t),P(e)||Z(131),e.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function _i(t){return t=z.$findMatchingParent(t,P),P(t)?t:null}function Ji(t){return t=z.$findMatchingParent(t,tt),tt(t)?t:null}function vr(t,e,r,n,i){let o=_.$getSelection();if(!Ut(o,n))return!1;if(_.$isRangeSelection(o)&&o.isCollapsed()){if(r==="backward"||r==="forward")return!1;let{anchor:d,focus:u}=o;var l=z.$findMatchingParent(d.getNode(),P),s=z.$findMatchingParent(u.getNode(),P);if(!P(l)||!l.is(s))return!1;if(s=Ji(l),s!==n&&s!=null){var a=t.getElementByKey(s.getKey());if(a!=null)return i.grid=rr(a),vr(t,e,r,s,i)}if(s=t.getElementByKey(l.__key),a=t.getElementByKey(d.key),a==null||s==null)return!1;if(d.type==="element")s=a.getBoundingClientRect();else{if(s=window.getSelection(),s===null||s.rangeCount===0)return!1;s=s.getRangeAt(0).getBoundingClientRect()}if(a=r==="up"?l.getFirstChild():l.getLastChild(),a==null||(t=t.getElementByKey(a.__key),t==null))return!1;if(t=t.getBoundingClientRect(),r==="up"?t.top>s.top-s.height:s.bottom+s.height>t.bottom){if(Dr(e),t=n.getCordsFromCellNode(l,i.grid),e.shiftKey)r=n.getCellFromCordsOrThrow(t.x,t.y,i.grid),i.setAnchorCellForSelection(r),i.setFocusCellForSelection(r,!0);else return cd(i,n,t.x,t.y,r);return!0}}else if(ae(o)){let{anchor:d,focus:u}=o;return a=z.$findMatchingParent(d.getNode(),P),s=z.$findMatchingParent(u.getNode(),P),[l]=o.getNodes(),t=t.getElementByKey(l.getKey()),!P(a)||!P(s)||!tt(l)||t==null?!1:(i.updateTableGridSelection(o),t=rr(t),a=n.getCordsFromCellNode(a,t),a=n.getCellFromCordsOrThrow(a.x,a.y,t),i.setAnchorCellForSelection(a),Dr(e),e.shiftKey?(e=n.getCordsFromCellNode(s,t),hg(i,l,e.x,e.y,r)):(s.selectEnd(),!0))}return!1}function Dr(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}class Jr extends _.DEPRECATED_GridNode{static getType(){return"table"}static clone(e){return new Jr(e.__key)}static importDOM(){return{table:()=>({conversion:gg,priority:1})}}static importJSON(){return Jn()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e){let r=document.createElement("table");return z.addClassNamesToElement(r,e.theme.table),r}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:r=>{if(r){let n=r.cloneNode(),i=document.createElement("colgroup"),o=document.createElement("tbody");if(z.isHTMLElement(r)&&o.append(...r.children),r=this.getFirstChildOrThrow(),!kt(r))throw Error("Expected to find row node.");r=r.getChildrenSize();for(let l=0;l<r;l++){let s=document.createElement("col");i.append(s)}return n.replaceChildren(i,o),n}}}}canExtractContents(){return!1}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,r){let{rows:n,cells:i}=r;for(r=0;r<n;r++){var o=i[r];if(o!=null&&(o=o.findIndex(l=>{if(l)return{elem:l}=l,_.$getNearestNodeFromDOMNode(l)===e}),o!==-1))return{x:o,y:r}}throw Error("Cell not found in table.")}getCellFromCords(e,r,n){return{cells:n}=n,r=n[r],r==null?null:(e=r[e],e??null)}getCellFromCordsOrThrow(e,r,n){if(e=this.getCellFromCords(e,r,n),!e)throw Error("Cell not found at cords.");return e}getCellNodeFromCords(e,r,n){return e=this.getCellFromCords(e,r,n),e==null?null:(e=_.$getNearestNodeFromDOMNode(e.elem),P(e)?e:null)}getCellNodeFromCordsOrThrow(e,r,n){if(e=this.getCellNodeFromCords(e,r,n),!e)throw Error("Node at cords not TableCellNode.");return e}canSelectBefore(){return!0}canIndent(){return!1}}function gg(){return{node:Jn()}}function Jn(){return _.$applyNodeReplacement(new Jr)}function tt(t){return t instanceof Jr}function zo(t){if(t=z.$findMatchingParent(t,e=>kt(e)),kt(t))return t;throw Error("Expected table cell to be inside of table row.")}function Fo(t){if(t=z.$findMatchingParent(t,e=>tt(e)),tt(t))return t;throw Error("Expected table cell to be inside of table.")}function fd(t,e){let r=Fo(t),{x:n,y:i}=r.getCordsFromCellNode(t,e);return{above:r.getCellNodeFromCords(n,i-1,e),below:r.getCellNodeFromCords(n,i+1,e),left:r.getCellNodeFromCords(n-1,i,e),right:r.getCellNodeFromCords(n+1,i,e)}}function Fr(t){let e=t.getFirstDescendant();e==null?t.selectStart():e.getParentOrThrow().selectStart()}function Bo(t,e){let r=t.getFirstChild();r!==null?r.insertBefore(e):t.append(e)}let fg=_.createCommand("INSERT_TABLE_COMMAND");I.$createGridSelection=Mn;I.$createTableCellNode=Pe;I.$createTableNode=Jn;I.$createTableNodeWithDimensions=function(t,e,r=!0){let n=Jn();for(let o=0;o<t;o++){let l=At();for(let s=0;s<e;s++){var i=U.NO_STATUS;typeof r=="object"?(o===0&&r.rows&&(i|=U.ROW),s===0&&r.columns&&(i|=U.COLUMN)):r&&(o===0&&(i|=U.ROW),s===0&&(i|=U.COLUMN)),i=Pe(i);let a=_.$createParagraphNode();a.append(_.$createTextNode()),i.append(a),l.append(i)}n.append(l)}return n};I.$createTableRowNode=At;I.$deleteTableColumn=function(t,e){let r=t.getChildren();for(let i=0;i<r.length;i++){var n=r[i];if(kt(n)){if(n=n.getChildren(),e>=n.length||0>e)throw Error("Table column target index out of range");n[e].remove()}}return t};I.$deleteTableColumn__EXPERIMENTAL=function(){var t=_.$getSelection();if(!_.$INTERNAL_isPointSelection(t))throw Error("Expected a INTERNAL_PointSelection");var e=t.anchor.getNode();t=t.focus.getNode();let[r,,n]=_.DEPRECATED_$getNodeTriplet(e);[e]=_.DEPRECATED_$getNodeTriplet(t);let[i,o,l]=_.DEPRECATED_$computeGridMap(n,r,e);var{startColumn:s}=o;let{startRow:a,startColumn:d}=l;t=Math.min(s,d),s=Math.max(s+r.__colSpan-1,d+e.__colSpan-1);let u=s-t+1;if(i[0].length===s-t+1)n.selectPrevious(),n.remove();else{var h=i.length;for(let c=0;c<h;c++)for(let g=t;g<=s;g++){let{cell:f,startColumn:p}=i[c][g];p<t?g===t&&f.setColSpan(f.__colSpan-Math.min(u,f.__colSpan-(t-p))):p+f.__colSpan-1>s?g===s&&f.setColSpan(f.__colSpan-(s-p+1)):f.remove()}t=i[a],e=t[d+e.__colSpan],e!==void 0?({cell:e}=e,Fr(e)):({cell:e}=t[d-1],Fr(e))}};I.$deleteTableRow__EXPERIMENTAL=function(){var t=_.$getSelection();if(!_.$INTERNAL_isPointSelection(t))throw Error("Expected a INTERNAL_PointSelection");var e=t.anchor.getNode();t=t.focus.getNode();let[r,,n]=_.DEPRECATED_$getNodeTriplet(e);[t]=_.DEPRECATED_$getNodeTriplet(t);let[i,o,l]=_.DEPRECATED_$computeGridMap(n,r,t);({startRow:e}=o);var{startRow:s}=l;if(t=s+t.__rowSpan-1,i.length===t-e+1)n.remove();else{s=i[0].length;var a=i[t+1],d=n.getChildAtIndex(t+1);for(let h=t;h>=e;h--){for(var u=s-1;0<=u;u--){let{cell:c,startRow:g,startColumn:f}=i[h][u];if(f===u&&(h===e&&g<e&&c.setRowSpan(c.__rowSpan-(g-e)),g>=e&&g+c.__rowSpan-1>t))if(c.setRowSpan(c.__rowSpan-(t-g+1)),d===null&&Z(122),u===0)Bo(d,c);else{let{cell:p}=a[u-1];p.insertAfter(c)}}u=n.getChildAtIndex(h),_.DEPRECATED_$isGridRowNode(u)||Z(123,String(h)),u.remove()}a!==void 0?({cell:e}=a[0],Fr(e)):({cell:e}=i[e-1][0],Fr(e))}};I.$getElementGridForTableNode=function(t,e){if(t=t.getElementByKey(e.getKey()),t==null)throw Error("Table Element Not Found");return rr(t)};I.$getTableCellNodeFromLexicalNode=function(t){return t=z.$findMatchingParent(t,e=>P(e)),P(t)?t:null};I.$getTableColumnIndexFromTableCellNode=function(t){return zo(t).getChildren().findIndex(e=>e.is(t))};I.$getTableNodeFromLexicalNodeOrThrow=Fo;I.$getTableRowIndexFromTableCellNode=function(t){let e=zo(t);return Fo(e).getChildren().findIndex(r=>r.is(e))};I.$getTableRowNodeFromTableCellNodeOrThrow=zo;I.$insertTableColumn=function(t,e,r=!0,n,i){let o=t.getChildren(),l=[];for(let d=0;d<o.length;d++){let u=o[d];if(kt(u))for(let h=0;h<n;h++){var s=u.getChildren();if(e>=s.length||0>e)throw Error("Table column target index out of range");s=s[e],P(s)||Z(12);let{left:c,right:g}=fd(s,i);var a=U.NO_STATUS;(c&&c.hasHeaderState(U.ROW)||g&&g.hasHeaderState(U.ROW))&&(a|=U.ROW),a=Pe(a),a.append(_.$createParagraphNode()),l.push({newTableCell:a,targetCell:s})}}return l.forEach(({newTableCell:d,targetCell:u})=>{r?u.insertAfter(d):u.insertBefore(d)}),t};I.$insertTableColumn__EXPERIMENTAL=function(t=!0){function e(){let h=Pe(U.NO_STATUS).append(_.$createParagraphNode());return d===null&&(d=h),h}var r=_.$getSelection();if(!_.$INTERNAL_isPointSelection(r))throw Error("Expected a PointSeleciton");var n=r.anchor.getNode();r=r.focus.getNode(),[n]=_.DEPRECATED_$getNodeTriplet(n);let[i,,o]=_.DEPRECATED_$getNodeTriplet(r),[l,s,a]=_.DEPRECATED_$computeGridMap(o,i,n);n=l.length,r=t?Math.max(s.startColumn,a.startColumn):Math.min(s.startColumn,a.startColumn),t=t?r+i.__colSpan-1:r-1,r=o.getFirstChild(),_.DEPRECATED_$isGridRowNode(r)||Z(120);let d=null;var u=r;e:for(r=0;r<n;r++){r!==0&&(u=u.getNextSibling(),_.DEPRECATED_$isGridRowNode(u)||Z(121));let h=l[r];if(0>t){Bo(u,e());continue}let{cell:c,startColumn:g,startRow:f}=h[t];if(g+c.__colSpan-1<=t){let p=c,y=f,v=t;for(;y!==r&&1<p.__rowSpan;)if(v-=c.__colSpan,0<=v){let{cell:M,startRow:R}=h[v];p=M,y=R}else{u.append(e());continue e}p.insertAfter(e())}else c.setColSpan(c.__colSpan+1)}d!==null&&Fr(d)};I.$insertTableRow=function(t,e,r=!0,n,i){var o=t.getChildren();if(e>=o.length||0>e)throw Error("Table row target index out of range");if(e=o[e],kt(e))for(o=0;o<n;o++){let s=e.getChildren(),a=s.length,d=At();for(let u=0;u<a;u++){var l=s[u];P(l)||Z(12);let{above:h,below:c}=fd(l,i);l=U.NO_STATUS;let g=h&&h.getWidth()||c&&c.getWidth()||void 0;(h&&h.hasHeaderState(U.COLUMN)||c&&c.hasHeaderState(U.COLUMN))&&(l|=U.COLUMN),l=Pe(l,1,g),l.append(_.$createParagraphNode()),d.append(l)}r?e.insertAfter(d):e.insertBefore(d)}else throw Error("Row before insertion index does not exist.");return t};I.$insertTableRow__EXPERIMENTAL=function(t=!0){var e=_.$getSelection();if(!_.$INTERNAL_isPointSelection(e))throw Error("Expected a INTERNAL_PointSelection");e=e.focus.getNode();let[r,,n]=_.DEPRECATED_$getNodeTriplet(e),[i,o]=_.DEPRECATED_$computeGridMap(n,r,r);e=i[0].length;var{startRow:l}=o;if(t){t=l+r.__rowSpan-1;var s=i[t];l=At();for(var a=0;a<e;a++){let{cell:d,startRow:u}=s[a];u+d.__rowSpan-1<=t?l.append(Pe(U.NO_STATUS).append(_.$createParagraphNode())):d.setRowSpan(d.__rowSpan+1)}e=n.getChildAtIndex(t),_.DEPRECATED_$isGridRowNode(e)||Z(119),e.insertAfter(l)}else{for(s=i[l],t=At(),a=0;a<e;a++){let{cell:d,startRow:u}=s[a];u===l?t.append(Pe(U.NO_STATUS).append(_.$createParagraphNode())):d.setRowSpan(d.__rowSpan+1)}e=n.getChildAtIndex(l),_.DEPRECATED_$isGridRowNode(e)||Z(119),e.insertBefore(t)}};I.$isGridSelection=ae;I.$isTableCellNode=P;I.$isTableNode=tt;I.$isTableRowNode=kt;I.$removeTableRowAtIndex=function(t,e){let r=t.getChildren();if(e>=r.length||0>e)throw Error("Expected table cell to be inside of table row.");return r[e].remove(),t};I.$unmergeCell=function(){var t=_.$getSelection();if(!_.$INTERNAL_isPointSelection(t))throw Error("Expected a INTERNAL_PointSelection");t=t.anchor.getNode();let[e,r,n]=_.DEPRECATED_$getNodeTriplet(t);t=e.__colSpan;let i=e.__rowSpan;if(1<t){for(var o=1;o<t;o++)e.insertAfter(Pe(U.NO_STATUS));e.setColSpan(1)}if(1<i){let[a,d]=_.DEPRECATED_$computeGridMap(n,e,e),{startColumn:u,startRow:h}=d,c;for(o=1;o<i;o++){var l=h+o;let g=a[l];c=(c||r).getNextSibling(),_.DEPRECATED_$isGridRowNode(c)||Z(125);var s=null;for(let f=0;f<u;f++){let p=g[f],y=p.cell;p.startRow===l&&(s=y),1<y.__colSpan&&(f+=y.__colSpan-1)}if(s===null)for(s=0;s<t;s++)Bo(c,Pe(U.NO_STATUS));else for(l=0;l<t;l++)s.insertAfter(Pe(U.NO_STATUS))}e.setRowSpan(1)}};I.INSERT_TABLE_COMMAND=fg;I.TableCellHeaderStates=U;I.TableCellNode=Vr;I.TableNode=Jr;I.TableRowNode=jr;I.TableSelection=ud;I.applyTableHandlers=function(t,e,r,n){function i(u){return u=t.getCordsFromCellNode(u,l.grid),t.getCellFromCordsOrThrow(u.x,u.y,l.grid)}let o=r.getRootElement();if(o===null)throw Error("No root element.");let l=new ud(r,t.getKey()),s=r._window||window;e.__lexicalTableSelection=l,e.addEventListener("mousedown",u=>{setTimeout(()=>{if(u.button===0&&s){var h=ji(u.target);h!==null&&(Dr(u),l.setAnchorCellForSelection(h));var c=()=>{s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",g)},g=f=>{const p=ji(f.target);p===null||l.anchorX===p.x&&l.anchorY===p.y||(f.preventDefault(),l.setFocusCellForSelection(p))};s.addEventListener("mouseup",c),s.addEventListener("mousemove",g)}},0)});let a=u=>{u.button===0&&r.update(()=>{const h=_.$getSelection(),c=u.target;ae(h)&&h.gridKey===l.tableNodeKey&&o.contains(c)&&l.clearHighlight()})};s.addEventListener("mousedown",a),l.listenersToRemove.add(()=>s.removeEventListener("mousedown",a)),l.listenersToRemove.add(r.registerCommand(_.KEY_ARROW_DOWN_COMMAND,u=>vr(r,u,"down",t,l),_.COMMAND_PRIORITY_HIGH)),l.listenersToRemove.add(r.registerCommand(_.KEY_ARROW_UP_COMMAND,u=>vr(r,u,"up",t,l),_.COMMAND_PRIORITY_HIGH)),l.listenersToRemove.add(r.registerCommand(_.KEY_ARROW_LEFT_COMMAND,u=>vr(r,u,"backward",t,l),_.COMMAND_PRIORITY_HIGH)),l.listenersToRemove.add(r.registerCommand(_.KEY_ARROW_RIGHT_COMMAND,u=>vr(r,u,"forward",t,l),_.COMMAND_PRIORITY_HIGH)),l.listenersToRemove.add(r.registerCommand(_.KEY_ESCAPE_COMMAND,u=>{var h=_.$getSelection();return ae(h)&&(h=z.$findMatchingParent(h.focus.getNode(),P),P(h))?(Dr(u),h.selectEnd(),!0):!1},_.COMMAND_PRIORITY_HIGH));let d=u=>()=>{var h=_.$getSelection();if(!Ut(h,t))return!1;if(ae(h))return l.clearText(),!0;if(_.$isRangeSelection(h)){const f=z.$findMatchingParent(h.anchor.getNode(),p=>P(p));if(!P(f))return!1;var c=h.anchor.getNode(),g=h.focus.getNode();if(c=t.isParentOf(c),g=t.isParentOf(g),c&&!g||g&&!c)return l.clearText(),!0;if(c=(g=z.$findMatchingParent(h.anchor.getNode(),p=>_.$isElementNode(p)))&&z.$findMatchingParent(g,p=>_.$isElementNode(p)&&P(p.getParent())),!_.$isElementNode(c)||!_.$isElementNode(g))return!1;if(u===_.DELETE_LINE_COMMAND&&c.getPreviousSibling()===null)return!0;if((u===_.DELETE_CHARACTER_COMMAND||u===_.DELETE_WORD_COMMAND)&&h.isCollapsed()&&h.anchor.offset===0&&g!==c){h=g.getChildren();const p=_.$createParagraphNode();return h.forEach(y=>p.append(y)),g.replace(p),g.getWritable().__parent=f.getKey(),!0}}return!1};return[_.DELETE_WORD_COMMAND,_.DELETE_LINE_COMMAND,_.DELETE_CHARACTER_COMMAND].forEach(u=>{l.listenersToRemove.add(r.registerCommand(u,d(u),_.COMMAND_PRIORITY_CRITICAL))}),e=u=>{const h=_.$getSelection();return Ut(h,t)?ae(h)?(u.preventDefault(),u.stopPropagation(),l.clearText(),!0):(_.$isRangeSelection(h)&&(u=z.$findMatchingParent(h.anchor.getNode(),c=>P(c)),P(u)),!1):!1},l.listenersToRemove.add(r.registerCommand(_.KEY_BACKSPACE_COMMAND,e,_.COMMAND_PRIORITY_CRITICAL)),l.listenersToRemove.add(r.registerCommand(_.KEY_DELETE_COMMAND,e,_.COMMAND_PRIORITY_CRITICAL)),l.listenersToRemove.add(r.registerCommand(_.FORMAT_TEXT_COMMAND,u=>{let h=_.$getSelection();return Ut(h,t)?ae(h)?(l.formatCells(u),!0):(_.$isRangeSelection(h)&&(u=z.$findMatchingParent(h.anchor.getNode(),c=>P(c)),P(u)),!1):!1},_.COMMAND_PRIORITY_CRITICAL)),l.listenersToRemove.add(r.registerCommand(_.CONTROLLED_TEXT_INSERTION_COMMAND,()=>{var u=_.$getSelection();return Ut(u,t)&&(ae(u)?l.clearHighlight():_.$isRangeSelection(u)&&(u=z.$findMatchingParent(u.anchor.getNode(),h=>P(h)),P(u))),!1},_.COMMAND_PRIORITY_CRITICAL)),n&&l.listenersToRemove.add(r.registerCommand(_.KEY_TAB_COMMAND,u=>{var h=_.$getSelection();return!_.$isRangeSelection(h)||!h.isCollapsed()||!Ut(h,t)||(h=_i(h.anchor.getNode()),h===null)?!1:(Dr(u),h=t.getCordsFromCellNode(h,l.grid),cd(l,t,h.x,h.y,u.shiftKey?"backward":"forward"),!0)},_.COMMAND_PRIORITY_CRITICAL)),l.listenersToRemove.add(r.registerCommand(_.FOCUS_COMMAND,()=>t.isSelected(),_.COMMAND_PRIORITY_HIGH)),l.listenersToRemove.add(r.registerCommand(_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,u=>{let{nodes:h,selection:c}=u;u=_.$INTERNAL_isPointSelection(c);var g=_.$isRangeSelection(c);if(u=g&&z.$findMatchingParent(c.anchor.getNode(),se=>_.DEPRECATED_$isGridCellNode(se))!==null&&z.$findMatchingParent(c.focus.getNode(),se=>_.DEPRECATED_$isGridCellNode(se))!==null||u&&!g,h.length!==1||!_.DEPRECATED_$isGridNode(h[0])||!u)return!1;var{anchor:f}=c,p=h[0];u=p.getChildren(),g=p.getFirstChildOrThrow().getChildrenSize(),p=p.getChildrenSize();var y=z.$findMatchingParent(f.getNode(),se=>_.DEPRECATED_$isGridCellNode(se)),v=(f=y&&z.$findMatchingParent(y,se=>_.DEPRECATED_$isGridRowNode(se)))&&z.$findMatchingParent(f,se=>_.DEPRECATED_$isGridNode(se));if(!_.DEPRECATED_$isGridCellNode(y)||!_.DEPRECATED_$isGridRowNode(f)||!_.DEPRECATED_$isGridNode(v))return!1;var M=f.getIndexWithinParent(),R=Math.min(v.getChildrenSize()-1,M+p-1);p=y.getIndexWithinParent(),y=Math.min(f.getChildrenSize()-1,p+g-1),g=Math.min(p,y),f=Math.min(M,R),p=Math.max(p,y),M=Math.max(M,R),v=v.getChildren(),R=0;let b,re;for(y=f;y<=M;y++){var K=v[y];if(!_.DEPRECATED_$isGridRowNode(K))return!1;var Le=u[R];if(!_.DEPRECATED_$isGridRowNode(Le))return!1;K=K.getChildren(),Le=Le.getChildren();let se=0;for(let Nt=g;Nt<=p;Nt++){let Je=K[Nt];if(!_.DEPRECATED_$isGridCellNode(Je))return!1;let Se=Le[se];if(!_.DEPRECATED_$isGridCellNode(Se))return!1;y===f&&Nt===g?b=Je.getKey():y===M&&Nt===p&&(re=Je.getKey());let vt=Je.getChildren();Se.getChildren().forEach(Xe=>{_.$isTextNode(Xe)&&_.$createParagraphNode().append(Xe),Je.append(Xe)}),vt.forEach(Xe=>Xe.remove()),se++}R++}return b&&re&&(u=Mn(),u.set(h[0].getKey(),b,re),_.$setSelection(u)),!0},_.COMMAND_PRIORITY_CRITICAL)),l.listenersToRemove.add(r.registerCommand(_.SELECTION_CHANGE_COMMAND,()=>{let u=_.$getSelection(),h=_.$getPreviousSelection();if(_.$isRangeSelection(u)){let{anchor:y,focus:v}=u;var c=y.getNode(),g=v.getNode();c=_i(c),g=_i(g);var f=c&&t.is(Ji(c)),p=g&&t.is(Ji(g));let M=f!==p;p=f&&p,f=u.isBackward(),M?(c=u.clone(),c.focus.set(t.getKey(),f?0:t.getChildrenSize(),"element"),_.$setSelection(c),Zl(r,l)):p&&!c.is(g)&&(l.setAnchorCellForSelection(i(c)),l.setFocusCellForSelection(i(g),!0))}return u&&!u.is(h)&&(ae(u)||ae(h))&&l.gridSelection&&!l.gridSelection.is(h)?(ae(u)&&u.gridKey===l.tableNodeKey?l.updateTableGridSelection(u):!ae(u)&&ae(h)&&h.gridKey===l.tableNodeKey&&l.updateTableGridSelection(null),!1):(l.hasHijackedSelectionStyles&&!t.isSelected()?cg(r,l):!l.hasHijackedSelectionStyles&&t.isSelected()&&Zl(r,l),!1)},_.COMMAND_PRIORITY_CRITICAL)),l};I.getCellFromTarget=ji;I.getTableSelectionFromTableElement=function(t){return t.__lexicalTableSelection};const pg=I;var xr=pg;const _g="#f2f3f5";class Rn extends xr.TableNode{static getType(){return"custom-table"}static clone(e){return new Rn(e.__key,e.__backgroundColor,e.__backgroundImage,e.__headerBackgroundColor)}static importJSON(e){const r=super.importJSON();return r.setBackgrounds({backgroundColor:e.backgroundColor,backgroundImage:e.backgroundImage,headerBackgroundColor:e.headerBackgroundColor}),r}get parsedBackgroundImage(){return this.__backgroundImage?`url(${Rd.getImageUrl(this.__backgroundImage)})`:""}get hasBackground(){return!!(this.__backgroundColor||this.__backgroundImage)}constructor(e,r,n,i){super(e),this.__backgroundColor=r,this.__backgroundImage=n,this.__headerBackgroundColor=i||_g}getBackgroundColor(){return this.getLatest().__backgroundColor}getBackgroundImage(){return this.getLatest().__backgroundImage}getHeaderBackgroundColor(){return this.getLatest().__headerBackgroundColor}setBackgrounds({backgroundColor:e,backgroundImage:r,headerBackgroundColor:n}){const i=this.getWritable();i.__backgroundColor=e,i.__backgroundImage=r,i.__headerBackgroundColor=n}setBackgroundColor(e){const r=this.getWritable();r.__backgroundColor=e}setBackgroundImage(e){const r=this.getWritable();r.__backgroundImage=e}setHeaderBackgroundColor(e){const r=this.getWritable();r.__headerBackgroundColor=e}exportJSON(){return{...super.exportJSON(),backgroundColor:this.__backgroundColor,backgroundImage:this.__backgroundImage,headerBackgroundColor:this.__headerBackgroundColor,type:"custom-table",version:1}}createDOM(e){const r=super.createDOM(e);return r.style.backgroundColor=this.__backgroundColor||"",r.style.backgroundImage=this.parsedBackgroundImage,r.style.setProperty("--header-background-color",this.__headerBackgroundColor),r}updateDOM(e,r){return e.__backgroundColor!==this.__backgroundColor&&(r.style.backgroundColor=this.__backgroundColor||""),e.__backgroundImage!==this.__backgroundImage&&(r.style.backgroundImage=this.parsedBackgroundImage),e.__headerBackgroundColor!==this.__headerBackgroundColor&&r.style.setProperty("--header-background-color",this.__headerBackgroundColor),!1}}const mg=O.createCommand();function Kg(){const[t]=oe.useLexicalComposerContext();return A.useEffect(()=>t.registerCommand(mg,({columns:e,rows:r,includeHeaders:n,backgroundColor:i,backgroundImage:o,headerBackgroundColor:l})=>{const s=O.$getSelection();if(!O.$isRangeSelection(s))return!0;const{focus:a}=s,d=a.getNode();if(d!==null){const u=xr.$createTableNodeWithDimensions(Number(r),Number(e),n);if(u.setBackgrounds({backgroundColor:i,backgroundImage:o,headerBackgroundColor:l}),O.$isRootOrShadowRoot(d)){const c=d.getChildAtIndex(a.offset);c!==null?c.insertBefore(u):d.append(u),u.insertBefore(O.$createParagraphNode())}else d.getTopLevelElementOrThrow().insertAfter(u);u.insertAfter(O.$createParagraphNode()),u.getFirstChildOrThrow().getFirstChildOrThrow().select()}return!0},O.COMMAND_PRIORITY_EDITOR),[t]),A.useEffect(()=>{const e=new Map,r=i=>{const o=i.getKey(),l=t.getElementByKey(o);if(l&&!e.has(o)){const s=xr.applyTableHandlers(i,l,t);e.set(o,s)}};t.getEditorState().read(()=>{const i=O.$nodesOfType(Rn);for(const o of i)xr.$isTableNode(o)&&r(o)});const n=t.registerMutationListener(Rn,i=>{for(const[o,l]of i)if(l==="created")t.getEditorState().read(()=>{const s=O.$getNodeByKey(o);xr.$isTableNode(s)&&r(s)});else if(l==="destroyed"){const s=e.get(o);s!==void 0&&(s.removeListeners(),e.delete(o))}});return()=>{n();for(const[,i]of e)i.removeListeners()}},[t]),null}const Wg={TableCellButtonContainer:H("div")({position:"absolute",top:0,left:0,willChange:"transform"}),TableCellButton:H("button")({border:0,width:24,height:24,color:E.gray.darkest,position:"relative",borderRadius:15,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"})},Hg={Label:H("p")({color:E.gray.darkest,fontSize:13,fontWeight:600,lineHeight:"18px",marginBottom:6}),InputWrapper:H("div")({display:"flex",alignItems:"center",gap:10})},Cg={InputColor:H("input")({width:0,padding:0,border:0,position:"absolute",opacity:0})};function yg(t,e){let r;return n=>{const i=n.target.value;r&&clearTimeout(r),r=setTimeout(()=>{e(n,i),r=null},t)}}const Yg=A.forwardRef(function({disabled:e=!1,error:r=!1,value:n="#000000",onChange:i=()=>{},name:o,icon:l,iconProps:s,...a},d){const u=A.useRef(null);(n===""||Dd(n)||r)&&`${E.gray.normal}`;const h=yg(150,(c,g)=>{c.target.value=g,c.target.name=o,i(g)});return $.jsxs("div",{ref:d,...a,children:[$.jsx(qt,{type:"button",disabled:e,onClick:c=>{const g=c.currentTarget.nextSibling;g.focus(),g.click()},children:$.jsx(St,{name:l,size:20,...s})}),$.jsx(Cg.InputColor,{type:"color",ref:u,value:n,onChange:h})]})}),Ng=Xi.map(t=>t.url).filter(Boolean),vg=Xi.reduce((t,e)=>({...t,[e.familyName]:e.value}),{});function Gg({editor:t,value:e,disabled:r=!1}){const n=rs(),i=A.useCallback(o=>{t.update(()=>{const l=O.$getSelection();O.$isRangeSelection(l)&&Rt.$patchStyleText(l,{"font-family":o})})},[t]);return $.jsxs($.Fragment,{children:[$.jsx(Ad,{children:Ng.map((o,l)=>$.jsx("link",{href:o,rel:"stylesheet"},`fonts-to-include--${l.toString()}`))}),$.jsx(jh,{disabled:r,title:n.formatMessage({id:"editor.toolbar.font"}),renderValue:()=>$.jsx(Vh,{children:$.jsx(St,{name:"fontFamily"})}),displayEmpty:!0,value:e==="lato"?e:vg[e]||e,children:Xi.map(o=>$.jsx(ts,{value:o.value,style:{fontFamily:o.familyName},onClick:()=>i(o.familyName),children:o.text},o.value))})]})}function xg({editor:t,isLink:e,setIsLink:r}){const n=A.useRef(null),i=rs(),[o,l]=A.useState(""),[s,a]=A.useState(!1),[d,u]=A.useState(null),h=kd();A.useEffect(()=>{var f;if(e){const p=window.getSelection();u((f=p.anchorNode)==null?void 0:f.parentElement)}},[t,e]);const c=A.useCallback(()=>{const f=O.$getSelection();if(O.$isRangeSelection(f)){const p=Xh(f),y=p.getParent();Zt.$isLinkNode(y)?l(y.getURL()):Zt.$isLinkNode(p)?l(p.getURL()):l("")}},[t]);A.useEffect(()=>{e||setTimeout(()=>{a(!1)},200)},[e]),A.useEffect(()=>Q.mergeRegister(t.registerUpdateListener(({editorState:f})=>{f.read(()=>{c()})}),t.registerCommand(O.SELECTION_CHANGE_COMMAND,()=>(c(),!0),O.COMMAND_PRIORITY_LOW),t.registerCommand(O.KEY_ESCAPE_COMMAND,()=>e?(r(!1),!0):!1,O.COMMAND_PRIORITY_HIGH)),[t,c]);function g({url:f}){l(f),t.dispatchCommand(Zt.TOGGLE_LINK_COMMAND,f),a(!1)}return d?$.jsx(Id,{open:e,anchorEl:d,transition:!0,children:({TransitionProps:f})=>$.jsx(Pd,{...f,timeout:100,children:$.jsx(an.Container,{ref:n,children:s?$.jsx(Ld,{initialValues:{url:o},onSubmit:g,validationSchema:h.object().shape({url:h.string().customUrl().max(500).required()}),validateOnBlur:!0,children:()=>$.jsx(bd,{children:$.jsxs(an.EditWrapper,{children:[$.jsx(zd,{type:"text",name:"url",autoFocus:!0,component:Fd,placeholder:i.formatMessage({id:"formikFields.buttons.urlPlaceholder"}),onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),a(!1))}}),$.jsx(an.SubmitButtonWrapper,{children:$.jsx(Nr,{title:i.formatMessage({id:"common.confirm"}),children:$.jsx(qt,{type:"submit",children:$.jsx(St,{name:"check"})})})})]})})}):$.jsx($.Fragment,{children:$.jsxs(an.Actions,{className:"link-input",children:[$.jsx(Nr,{title:i.formatMessage({id:"editor.openLink"}),children:$.jsx(qt,{component:"a",href:o,target:"_blank",rel:"noopener noreferrer",children:$.jsx(St,{name:"openLink"})})}),$.jsx(Nr,{title:i.formatMessage({id:"common.edit"}),children:$.jsx(qt,{onClick:()=>a(!0),children:$.jsx(St,{name:"edit"})})}),$.jsx(Nr,{title:i.formatMessage({id:"editor.toolbar.removeLink"}),children:$.jsx(qt,{onClick:()=>{u(null),t.dispatchCommand(Zt.TOGGLE_LINK_COMMAND,null)},children:$.jsx(St,{name:"linkOff"})})})]})})})})}):null}const Ug=A.memo(xg),Vg={BlockMenu:H("div")({borderRadius:4,padding:"2px 1px",cursor:"grab",opacity:0,position:"absolute",left:0,top:0,willChange:"transform",display:"flex",alignItems:"center","& svg":{opacity:.3,pointerEvents:"none"},"&:active":{cursor:"grabbing"},"&:hover":{backgroundColor:E.gray.normal}}),TargetLine:H("div")({pointerEvents:"none",background:"deepskyblue",height:4,position:"absolute",left:0,top:0,opacity:0,willChange:"transform"})};export{ph as $,gc as A,nh as B,Lg as C,kg as D,Zt as E,Ag as F,Xh as G,bg as H,Za as I,zg as J,Gg as K,oe as L,Yg as M,Ug as N,$g as O,Wg as P,Vg as Q,Rn as R,jh as S,Nr as T,Gr as U,Un as V,Dg as W,Rg as X,Vn as Y,Kg as Z,Fg as _,td as a,Bg as a0,O as b,Q as c,Og as d,Kd as e,xc as f,Sc as g,Mg as h,za as i,zc as j,Vc as k,Ja as l,uh as m,Yn as n,Gn as o,Ig as p,sg as q,og as r,Hg as s,_g as t,wg as u,xr as v,mg as w,Vh as x,St as y,Rt as z};