@qwanyx/stack 0.2.53 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -70,7 +70,7 @@ React keys must be passed directly to JSX without using spread:
70
70
  `||i===`\r
71
71
  `?n.push(mr()):i===" "?n.push(_n()):n.push(Ue(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(b,C,v,E){const D=b.getNode(),k=D.getChildAtIndex(b.offset),y=Ue(),_=Ze(D)?ze().append(y):y;y.setFormat(v),y.setStyle(E),k===null?D.append(_):k.insertBefore(_),b.is(C)&&C.set(y.__key,0,"text"),b.set(y.__key,0,"text")}(i,l,s,o);const a=i.offset;let u=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||M(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(u=h,l.set(i.key,u,"text")),this.isCollapsed()&&a===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let b=f.getNextSibling();if(z(b)&&b.canInsertTextBefore()&&!ar(b)||(b=Ue(),b.setFormat(s),b.setStyle(o),g.canInsertTextAfter()?f.insertAfter(b):g.insertAfter(b)),b.select(0,0),f=b,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let b=f.getPreviousSibling();if(z(b)&&!ar(b)||(b=Ue(),b.setFormat(s),g.canInsertTextBefore()?f.insertBefore(b):g.insertBefore(b)),b.select(),f=b,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const b=Ue(f.getTextContent());b.setFormat(s),f.replace(b),f=b}else if(!this.isCollapsed()&&e!==""){const b=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||F(b)&&(!b.canInsertTextBefore()||!b.canInsertTextAfter()))return this.insertText(""),ia(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ue(e);return E.select(),void f.replace(E)}const b=f.getFormat(),C=f.getStyle();if(a!==u||b===s&&C===o){if(kc(f)){const E=Ue(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ue(e);if(E.setFormat(s),E.setStyle(o),E.select(),a===0)f.insertBefore(E,!1);else{const[D]=f.splitText(a);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const v=u-a;f=f.spliceText(a,v,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=b,this.style=C))}else{const b=new Set([...f.getParentKeys(),...m.getParentKeys()]),C=F(f)?f:f.getParentOrThrow();let v=F(m)?m:m.getParentOrThrow(),E=m;if(!C.is(v)&&v.isInline())do E=v,v=v.getParentOrThrow();while(v.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ue(m.getTextContent());m.replace(S),m=S}Ze(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),b.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else b.add(m.__key);const D=v.getChildren(),k=new Set(c),y=C.is(v),_=C.isInline()&&f.getNextSibling()===null?C:f;for(let S=D.length-1;S>=0;S--){const A=D[S];if(A.is(f)||F(A)&&A.isParentOf(f))break;A.isAttached()&&(!k.has(A)||A.is(E)?y||_.insertAfter(A,!1):A.remove())}if(!y){let S=v,A=null;for(;S!==null;){const I=S.getChildren(),B=I.length;(B===0||I[B-1].is(A))&&(b.delete(S.__key),A=S),S=S.getParent()}}if(f.isToken())if(a===h)f.select();else{const S=Ue(e);S.select(),f.replace(S)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const A=c[S],I=A.__key;b.has(I)||A.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const a=Ur(i,Yt),u=Ur(l,Yt);z(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&z(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{en(i,d)||en(l,d)||d.getKey()===i.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&ar(d)){const h=Ue(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&z(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(z(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}z(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&z(i)?i.selectEnd():l.isAttached()&&z(l)&&l.selectStart(),F(a)&&F(u)&&a!==u&&(a.append(...u.getChildren()),u.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ve(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(Lr(k)){const y=k.getFormatFlags(e,D);k.setTextFormat(y)}})},i=s.length;if(i===0)return this.toggleFormat(e),Ve(null),void o(t);const l=this.anchor,a=this.focus,u=this.isBackward(),c=u?a:l,d=u?l:a;let f=0,h=s[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===h.getTextContentSize()&&(f=1,h=s[1],g=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const b=i-1;let C=s[b];const v=d.type==="text"?d.offset:C.getTextContentSize();if(h.is(C)){if(g===v)return;if(ar(h)||g===0&&v===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(g,v),k=g===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,v-g,"text")}return void(this.format=m)}g===0||ar(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);const E=C.getFormatFlags(e,m);v>0&&(v===C.getTextContentSize()||ar(C)||([C]=C.splitText(v)),C.setFormat(E));for(let D=f+1;D<b;D++){const k=s[D],y=k.getFormatFlags(e,E);k.setFormat(y)}c.type==="text"&&c.set(h.__key,g,"text"),d.type==="text"&&d.set(C.__key,v,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const g=V();return P(g)||M(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Ur(t,Yt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=Os(this);n.splice(g,0,e),s.selectEnd()}return}if(!e.some(g=>(F(g)||_e(g))&&!g.isInline())){F(n)||M(211,t.constructor.name,t.getType());const g=Os(this);return n.splice(g,0,e),void s.selectEnd()}const o=function(g){const m=ze();let b=null;for(let C=0;C<g.length;C++){const v=g[C],E=fr(v);if(E||_e(v)&&v.isInline()||F(v)&&v.isInline()||z(v)||v.isParentRequired()){if(b===null&&(b=v.createParentElementNode(),m.append(b),E))continue;b!==null&&b.append(v)}else m.append(v),b=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),a=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=l[l.length-1];let c=l[0];var d;F(d=c)&&Yt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||M(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&M(212,t.constructor.name,t.getType()),function(g,m,b){const C=m.getParentOrThrow().getLastChild();let v=m;const E=[m];for(;v!==C;)v.getNextSibling()||M(140),v=v.getNextSibling(),E.push(v);let D=g;for(const k of E)D=D.insertAfter(k)}(n,c));const f=Ur(i,Yt);a&&F(f)&&(a.canMergeWhenEmpty()||Yt(u))&&(f.append(...a.getChildren()),a.remove()),F(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=F(n)?n.getLastChild():null;fr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ze();return Be().splice(this.anchor.offset,0,[i]),i.select(),i}const e=Os(this),t=Ur(this.anchor.getNode(),Yt);F(t)||M(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=mr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,o=this.focus;let i=e[0],l=e[n];const[a,u]=ni(this);if(t===0)return[];if(t===1){if(z(i)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const c=s.isBefore(o);if(z(i)){const d=c?a:u;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(z(l)){const d=l.getTextContent().length,f=c?u:a;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=un(s,t);if(_e(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=So();return h.add(l.__key),void Lt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(z(f)){const h=f.__key,g=t?f.getTextContent().length:0;return s.set(h,g,"text"),void(i&&o.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,m;return F(f)?(m=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),m=h.__key,t||g++),s.set(m,g,"element"),void(i&&o.set(m,g,"element"))}}const a=je(),u=ht(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!F(l)||l.isInline()||l.canBeEmpty()||Bi(c,a,d),function(f,h,g,m){f.modify(h,g,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),g=Ze(h)?h:cc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),b=[];let C=!1;for(let v=0;v<m.length;v++){const E=m[v];en(E,g)?b.push(E):C=!0}if(C&&b.length>0)if(t){const v=b[0];F(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{const v=b[b.length-1];F(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(v){const E=v.focus,D=v.anchor,k=D.key,y=D.offset,_=D.type;Xt(D,E.key,E.offset,E.type),Xt(E,k,y,_),v._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(o)&&o.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const o=this.focus,i=un(o,e);if(_e(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const l=So();l.add(i.__key),Lt(l)}else i.remove(),je().dispatchCommand(di,void 0);return}if(!e&&F(i)&&F(s)&&s.isEmpty())return s.remove(),void i.selectStart();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{const l=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,u=l.getTextContentSize();if(l.is(s)||e&&a!==u||!e&&a!==0)return void Co(l,e,a)}else if(s!==null&&s.isSegmented()){const a=n.offset,u=s.getTextContentSize();if(s.is(l)||e&&a!==0||!e&&a!==u)return void Co(s,e,a)}(function(a,u){const c=a.anchor,d=a.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const g=c.offset,m=d.offset,b=g<m,C=b?g:m,v=b?m:g,E=v-1;C!==E&&(Il(f.getTextContent().slice(C,v))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&Ze(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Nt(r){return r instanceof ms}function vo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ni(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[vo(t),vo(n)]}function Co(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let u=0;u<o;u++){const c=u===o-1;if(l=i,i+=s[u].length,e&&i===t||i>t||c){s.splice(u,1),c&&(l=void 0);break}}const a=s.join("").trim();a===""?n.remove():(n.setTextContent(a),n.select(l,l))}function wo(r,e,t,n){let s,o=e;if(r.nodeType===gn){let i=!1;const l=r.childNodes,a=l.length,u=n._blockCursorElement;o===a&&(i=!0,o=a-1);let c=l[o],d=!1;if(c===u)c=l[o+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&o--}if(s=Er(c),z(s))o=no(s,i);else{let f=Er(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(F(m)&&function(b,C,v){const E=b.getParent();return v===null||E===null||!E.canBeEmpty()||E!==v.getNode()}(m,0,t)){const b=i?m.getLastDescendant():m.getFirstDescendant();b===null?f=m:(m=b,f=F(m)?m:m.getParentOrThrow()),o=0}z(m)?(s=m,f=null,o=no(m,i)):m!==f&&i&&!d&&(F(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&_e(f)&&Er(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return Pt(f.__key,o,"element")}}else s=Er(r);return z(s)?Pt(s.__key,o,"text"):null}function Do(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&F(i)&&i.isInline()){const l=i.getPreviousSibling();z(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else F(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):z(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&F(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&F(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();z(l)&&(r.key=l.__key,r.offset=0)}}}function ia(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Do(r,n,s),Do(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=je();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;Xt(r,i.key,i.offset,i.type),Xt(e,l.key,l.offset,l.type)}}}function oa(r,e,t,n,s,o){if(r===null||t===null||!mn(s,r,t))return null;const i=wo(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=wo(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=Er(r),u=Er(t);if(_e(a)&&_e(u))return null}return ia(i,l,o),[i,l]}function si(r){return F(r)&&!r.isInline()}function la(r,e,t,n,s,o){const i=Vt(),l=new ir(Pt(r,e,s),Pt(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Tc(){const r=Pt("root",0,"element"),e=Pt("root",0,"element");return new ir(r,e,0,"")}function So(){return new ms(new Set)}function Li(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",a=!Ws&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let u,c,d,f;if(P(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!mn(t,u,c))return r.clone();const h=oa(u,d,c,f,t,r);if(h===null)return null;const[g,m]=h;return new ir(g,m,P(r)?r.format:0,P(r)?r.style:"")}function V(){return Vt()._selection}function vn(){return je()._editorState._selection}function es(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),l=o.getNode();if(!e.is(i)&&!e.is(l))return;const a=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(a,c,"element"),o.set(a,c,"element"),Eo(r)}}else{const u=r.isBackward(),c=u?o:s,d=c.getNode(),f=u?s:o,h=f.getNode();if(e.is(d)){const g=c.offset;(t<=g&&n>0||t<g&&n<0)&&c.set(a,Math.max(0,g+n),"element")}if(e.is(h)){const g=f.offset;(t<=g&&n>0||t<g&&n<0)&&f.set(a,Math.max(0,g+n),"element")}}Eo(r)}function Eo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!F(o))return;const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(o)){const l=o.getChildrenSize(),a=t>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(i)){const l=i.getChildrenSize(),a=s>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(z(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function ts(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,z(n)?(i=n.getTextContentSize(),l="text"):F(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,z(s)?l="text":F(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function ko(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Bc(r,e,t,n,s,o,i){const l=n.anchorNode,a=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==o||d!==null&&Di(d))return;if(!P(e))return void(r!==null&&mn(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,m=h.key,b=Hn(t,g),C=Hn(t,m),v=f.offset,E=h.offset,D=e.format,k=e.style,y=e.isCollapsed();let _=b,S=C,A=!1;if(f.type==="text"){_=Gn(b);const $=f.getNode();A=$.getFormat()!==D||$.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(A=!0);var I,B,N,j,L;if(h.type==="text"&&(S=Gn(C)),_!==null&&S!==null&&(y&&(r===null||A||P(r)&&(r.format!==D||r.style!==k))&&(I=D,B=k,N=v,j=g,L=performance.now(),Xl=[I,B,N,j,L]),u!==v||c!==E||l!==_||a!==S||n.type==="Range"&&y||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(_,v,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const $=e instanceof ir&&e.anchor.type==="element"?_.childNodes[v]||null:n.rangeCount>0?n.getRangeAt(0):null;if($!==null){let X;if($ instanceof Text){const ce=document.createRange();ce.selectNode($),X=ce.getBoundingClientRect()}else X=$.getBoundingClientRect();(function(ce,ve,le){const Le=le.ownerDocument,me=Le.defaultView;if(me===null)return;let{top:he,bottom:ye}=ve,xe=0,Se=0,pe=le;for(;pe!==null;){const Ce=pe===Le.body;if(Ce)xe=0,Se=hs(ce).innerHeight;else{const ae=pe.getBoundingClientRect();xe=ae.top,Se=ae.bottom}let Ne=0;if(he<xe?Ne=-(xe-he):ye>Se&&(Ne=ye-Se),Ne!==0)if(Ce)me.scrollBy(0,Ne);else{const ae=pe.scrollTop;pe.scrollTop+=Ne;const Re=pe.scrollTop-ae;he-=Re,ye-=Re}if(Ce)break;pe=yn(pe)}})(t,X,o)}}ei=!0}}function aa(r){let e=V()||vn();e===null&&(e=Be().selectEnd()),e.insertNodes(r)}function Os(r){let e=r;r.isCollapsed()||e.removeText();const t=V();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!Yt(s);)[s,o]=Nc(s,o);return o}function Nc(r,e){const t=r.getParent();if(!t){const s=ze();return Be().append(s),s.select(),[Be(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new ir(Pt(r.__key,e,"element"),Pt(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ge=null,Ke=null,st=!1,Ms=!1,On=0;const Ao={characterData:!0,childList:!0,subtree:!0};function Cn(){return st||Ge!==null&&Ge._readOnly}function nt(){st&&M(13)}function ua(){On>99&&M(14)}function Vt(){return Ge===null&&M(195,ca()),Ge}function je(){return Ke===null&&M(196,ca()),Ke}function ca(){let r=0;const e=new Set,t=xs.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=cs(s);if(Si(o))r++;else if(o){let i=String(o.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function Fc(){return Ke}function To(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&M(30,a),u}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function Bo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function da(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function jc(r){return Ri(r,je()._nodes)}function Ri(r,e){const t=r.type,n=e.get(t);n===void 0&&M(17,t);const s=n.klass;r.type!==s.getType()&&M(18,s.name);const o=s.importJSON(r),i=r.children;if(F(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const a=Ri(i[l],e);o.append(a)}return o}function No(r,e,t){const n=Ge,s=st,o=Ke;Ge=e,st=!0,Ke=r;try{return t()}finally{Ge=n,st=s,Ke=o}}function er(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,a=r._dirtyType!==hr,u=Ge,c=st,d=Ke,f=r._updating,h=r._observer;let g=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Ke=r,Ge=t,st=!1,r._updating=!0;try{const y=r._dirtyType,_=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),g=bc(o,t,r,y,_,S)}catch(y){if(y instanceof Error&&r._onError(y),Ms)throw y;return ya(r,null,n,t),Fl(r),r._dirtyType=Fr,Ms=!0,er(r,o),void(Ms=!1)}finally{h.observe(n,Ao),r._updating=f,Ge=u,st=c,Ke=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,b=r._dirtyElements,C=r._normalizedNodes,v=r._updateTags,E=r._deferred;a&&(r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(y,_){const S=y._decorators;let A=y._pendingDecorators||S;const I=_._nodeMap;let B;for(B in A)I.has(B)||(A===S&&(A=Ol(y)),delete A[B])}(r,t);const D=s?null:ht(r._window);if(r._editable&&D!==null&&(a||l===null||l.dirty)){Ke=r,Ge=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const y=r._blockCursorElement;y!==null&&Bi(y,r,n),Bc(i,l,r,D,v,n)}dc(r,n,l),h!==null&&h.observe(n,Ao)}finally{Ke=d,Ge=u}}g!==null&&function(y,_,S,A,I){const B=Array.from(y._listeners.mutation),N=B.length;for(let j=0;j<N;j++){const[L,$]=B[j],X=_.get($);X!==void 0&&L(X,{dirtyLeaves:A,prevEditorState:I,updateTags:S})}}(r,g,v,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(di,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,nn("decorator",r,!0,k)),function(y,_,S){const A=ro(_),I=ro(S);A!==I&&nn("textcontent",y,!0,I)}(r,e||o,t),nn("update",r,!0,{dirtyElements:b,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:v}),function(y,_){if(y._deferred=[],_.length!==0){const S=y._updating;y._updating=!0;try{for(let A=0;A<_.length;A++)_[A]()}finally{y._updating=S}}}(r,E),function(y){const _=y._updates;if(_.length!==0){const S=_.shift();if(S){const[A,I]=S;ha(y,A,I)}}}(r)}function nn(r,e,t,...n){const s=e._updating;e._updating=t;try{const o=Array.from(e._listeners[r]);for(let i=0;i<o.length;i++)o[i].apply(null,n)}finally{e._updating=s}}function fa(r,e,t){if(r._updating===!1||Ke!==r){let s=!1;return r.update(()=>{s=fa(r,e,t)}),s}const n=Ei(r);for(let s=4;s>=0;s--)for(let o=0;o<n.length;o++){const i=n[o]._commands.get(e);if(i!==void 0){const l=i[s];if(l!==void 0){const a=Array.from(l),u=a.length;for(let c=0;c<u;c++)if(a[c](t,r)===!0)return!0}}}return!1}function Fo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const a=r._pendingEditorState;a===null&&M(191),a._flushSync=!0}l&&r._deferred.push(l),da(r,i.tag)}o()}}return n}function ha(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,da(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let a=r._pendingEditorState,u=!1;(a===null||a._readOnly)&&(a=r._pendingEditorState=ga(a||l),u=!0),a._flushSync=i;const c=Ge,d=st,f=Ke,h=r._updating;Ge=a,st=!1,r._updating=!0,Ke=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(C){const v=C.getEditorState()._selection,E=ht(C._window);return P(v)||v==null?Li(v,E,C,null):v.clone()}(r));const m=r._compositionKey;e(),o=Fo(r,o),function(C,v){const E=v.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,y=D.focus;let _;if(k.type==="text"&&(_=k.getNode(),_.selectionTransform(E,D)),y.type==="text"){const S=y.getNode();_!==S&&S.selectionTransform(E,D)}}}(a,r),r._dirtyType!==hr&&(o?function(C,v){const E=v._dirtyLeaves,D=C._nodeMap;for(const k of E){const y=D.get(k);z(y)&&y.isAttached()&&y.isSimpleText()&&!y.isUnmergeable()&&eo(y)}}(a,r):function(C,v){const E=v._dirtyLeaves,D=v._dirtyElements,k=C._nodeMap,y=Zt(),_=new Map;let S=E,A=S.size,I=D,B=I.size;for(;A>0||B>0;){if(A>0){v._dirtyLeaves=new Set;for(const N of S){const j=k.get(N);z(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&eo(j),j!==void 0&&Bo(j,y)&&To(v,j,_),E.add(N)}if(S=v._dirtyLeaves,A=S.size,A>0){On++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const N of I){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const $=k.get(j);$!==void 0&&Bo($,y)&&To(v,$,_),D.set(j,L)}S=v._dirtyLeaves,A=S.size,I=v._dirtyElements,B=I.size,On++}v._dirtyLeaves=E,v._dirtyElements=D}(a,r),Fo(r),function(C,v,E,D){const k=C._nodeMap,y=v._nodeMap,_=[];for(const[S]of D){const A=y.get(S);A!==void 0&&(A.isAttached()||(F(A)&&Ul(A,S,k,y,_,D),k.has(S)||D.delete(S),_.push(S)))}for(const S of _)y.delete(S);for(const S of E){const A=y.get(S);A===void 0||A.isAttached()||(k.has(S)||E.delete(S),y.delete(S))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const b=a._selection;if(P(b)){const C=a._nodeMap,v=b.anchor.key,E=b.focus.key;C.get(v)!==void 0&&C.get(E)!==void 0||M(19)}else Nt(b)&&b._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=Fr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void er(r)}finally{Ge=c,st=d,Ke=f,r._updating=h,On=0}r._dirtyType!==hr||function(m,b){const C=b.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(C))return!0}else if(C!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,er(r)):u&&ic(()=>{er(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function at(r,e,t){r._updating?r._updates.push([e,t]):ha(r,e,t)}class sn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new sn(this.element,e,this.after)}withAfter(e){return new sn(this.element,this.before,e)}withElement(e){return new sn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&M(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(pn||as);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,o=document.createElement("br");if(n.insertBefore(o,s),e){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",n.insertBefore(i,o),n.__lexicalLineBreak=i}else n.__lexicalLineBreak=o}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,s))]}const o=jo(t,n);o.push(s);const i=jo(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<i.length;a++){const u=o[a],c=i[a];if(u===void 0||u<c)break;if(u>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function jo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&M(225),t.reverse()}class Ht extends gs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ju[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=je()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const o=t[n-1];return F(o)&&o.getLastDescendant()||o||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Qe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Qe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContent(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),F(o)&&s!==n-1&&!o.isInline()&&(e+=Gt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Yi[e];return!!(this.getFormat()&t)}return!1}select(e,t){nt();const n=V();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(z(a)||F(a))return a.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const a=this.getLastChild();if(z(a)||F(a))return a.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):la(l,s,l,o,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Yi[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||M(226,String(e),String(t),String(o));const l=i.__key,a=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){g===null&&M(100);const b=g.getNextSibling(),C=g.__key;dr(g.getWritable()),u.push(C),g=b}}let h=d;for(let g=0;g<s;g++){const m=n[g];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const b=m.getWritable();b.__parent===l&&f--,dr(b);const C=m.__key;if(h===null)i.__first=C,b.__prev=null;else{const v=h.getWritable();v.__next=C,b.__prev=v.__key}m.__key===l&&M(76),b.__parent=l,a.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const g=c.getWritable();if(h!==null){const m=h.getWritable();g.__prev=h.__key,m.__next=c.__key}else g.__prev=null}if(i.__size=f,u.length){const g=V();if(P(g)){const m=new Set(u),b=new Set(a),{anchor:C,focus:v}=g;Lo(C,m,b)&&ts(C,C.getNode(),this,d,c),Lo(v,m,b)&&ts(v,v.getNode(),this,d,c),f!==0||this.canBeEmpty()||Rt(this)||this.remove()}}return i}getDOMSlot(e){return new sn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function F(r){return r instanceof Ht}function Lo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class pa extends gs{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function _e(r){return r instanceof pa}class wn extends Ht{static getType(){return"root"}static clone(){return new wn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!Cn()&&je()._dirtyType!==hr||e===null?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||_e(n)||M(56)}return super.append(...e)}static importJSON(e){const t=Be();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Ze(r){return r instanceof wn}function ga(r){return new ys(new Map(r._nodeMap))}function Pi(){return new ys(new Map([["root",new wn]]))}function ma(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),F(r)){const n=e.children;Array.isArray(n)||M(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=ma(s[o]);n.push(i)}}return e}class ys{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return No(t&&t.editor||null,this,e)}clone(e){const t=new ys(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return No(null,this,()=>({root:ma(Be())}))}}class Oi extends Ht{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Pr extends Ht{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=pr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Kn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new Pr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Zr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Lc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=ze();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=ze();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(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 Lc(r){const e=ze();return r.style&&(e.setFormat(r.style.textAlign),Fi(r,e)),{node:e}}function ze(){return Ot(new Pr)}function Lr(r){return r instanceof Pr}const fe=0,kr=1,Rc=4;function ya(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Pi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=hr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function Pc(r){const e=r||{},t=Fc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=Pi(),l=e.namespace||(s!==null?s._config.namespace:$l()),a=e.editorState,u=[wn,Rr,xn,bn,Pr,Oi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let b=u[m],C=null,v=null;if(typeof b!="function"){const y=b;b=y.replace,C=y.with,v=y.withKlass||null}const E=b.getType(),D=b.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(b):void 0,klass:b,replace:C,replaceWithKlass:v,transforms:k})}}const g=new xs(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,b){const C=new Map,v=new Set,E=D=>{Object.keys(D).forEach(k=>{let y=C.get(k);y===void 0&&(y=[],C.set(k,y)),y.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||v.has(k))return;v.add(k);const y=k.call(D.klass);y!==null&&E(y)}),b&&E(b),C}(h,d?d.import:void 0),f);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=Fr),g}class xs{constructor(e,t,n,s,o,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=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=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=hr,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=$l(),this._onError=o,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&M(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=s.get(e);o===void 0&&M(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,s);const i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(t,s),()=>{o.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=gc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],o=n.replaceWithKlass;if(o!=null){const a=this.registerNodeTransformToKlass(o,t);s.push(a)}var i,l;return i=this,l=e.getType(),at(i,()=>{const a=Vt();if(a.isEmpty())return;if(l==="root")return void Be().markDirty();const u=a._nodeMap;for(const[,c]of u)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=Zr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,ya(this,t,e,s),t!==null&&(this._config.disableEvents||_c(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=Fr,Fl(this),this._updateTags.add("history-merge"),er(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=Zn.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ra),Zn.set(u,(c||0)+1),l.__lexicalEditor=a;const d=ta(l);for(let f=0;f<Zs.length;f++){const[h,g]=Zs[f],m=typeof g=="function"?b=>{mo(b)||(go(b),(a.isEditable()||h==="click")&&g(b,a))}:b=>{if(mo(b))return;go(b);const C=a.isEditable();switch(h){case"cut":return C&&G(a,pi,b);case"copy":return G(a,ls,b);case"paste":return C&&G(a,os,b);case"dragstart":return C&&G(a,Dl,b);case"dragover":return C&&G(a,Sl,b);case"dragend":return C&&G(a,Fu,b);case"focus":return C&&G(a,Ru,b);case"blur":return C&&G(a,Pu,b);case"drop":return C&&G(a,wl,b)}};l.addEventListener(h,m),d.push(()=>{l.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;nn("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=ga(e),n._selection=e._selection?e._selection.clone():null),Nl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),er(this)),this._pendingEditorState=n,this._dirtyType=Fr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||er(this)}parseEditorState(e,t){return function(n,s,o){const i=Pi(),l=Ge,a=st,u=Ke,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ge=i,st=!1,Ke=s;try{const g=s._nodes;Ri(n.root,g),o&&o(),i._readOnly=!0}catch(g){g instanceof Error&&s._onError(g)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ge=l,st=a,Ke=u}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return er(this),this.getEditorState().read(e,{editor:this})}update(e,t){at(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),at(this,()=>{const s=V(),o=Be();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=ht(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,nn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}xs.version="0.21.0+prod.esm";const xa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Oc=xa?w.useLayoutEffect:w.useEffect,Nn={tag:"history-merge"};function Mc({initialConfig:r,children:e}){const t=w.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:a}=r,u=Cu(null,n),c=Pc({editable:r.editable,html:a,namespace:s,nodes:o,onError:d=>i(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Be();if(h.isEmpty()){const g=ze();h.append(g);const m=xa?document.activeElement:null;(V()!==null||m!==null&&m===d.getRootElement())&&g.select()}},Nn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Nn);break}case"object":d.setEditorState(f,Nn);break;case"function":d.update(()=>{Be().isEmpty()&&f(d)},Nn)}}}(c,l),[c,u]},[]);return Oc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),p.jsx(pl.Provider,{value:t,children:e})}const Ic=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function $c(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function zc(){return function(r){const[e]=wt(),t=w.useMemo(()=>r(e),[e,r]),[n,s]=w.useState(()=>t.initialValueFn()),o=w.useRef(n);return Ic(()=>{const{initialValueFn:i,subscribe:l}=t,a=i();return o.current!==a&&(o.current=a,s(a)),l(u=>{o.current=u,s(u)})},[t,r]),n}($c)}function qc(){return Be().getTextContent()}function Uc(r,e=!0){if(r)return!1;let t=qc();return e&&(t=t.trim()),t===""}function Wc(r){if(!Uc(r,!1))return!1;const e=Be().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(_e(s))return!1;if(F(s)){if(!Lr(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const a=o[n];if(!z(a))return!1}}}return!0}function ba(r){return()=>Wc(r)}function Gc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Gc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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 Kc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Vc=Kc(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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.`)});const Hc=new Map;function Jc(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function _a(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,o=r.isBackward(),i=n.getNode(),l=s.getNode(),a=e.is(i),u=e.is(l);if(a||u){const[c,d]=ni(r),f=i.is(l),h=e.is(o?l:i),g=e.is(o?i:l);let m,b=0;return f?(b=c>d?d:c,m=c>d?c:d):h?(b=o?d:c,m=void 0):g&&(b=0,m=o?c:d),e.__text=e.__text.slice(b,m),e}}return e}function Qc(r){const e=r.getStyle(),t=Jc(e);Hc.set(e,t)}function Yc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=Be(),a=l.getFirstChild();return void(a?a.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let a=i;for(;a!==null&&a.getParent()!==null&&!l(a);)a=a.getParentOrThrow();return l(a)?a:null}(n.getNode(),Oo);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!Oo(l))continue;F(l)||Vc(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function Ro(r,e){const t=un(r.focus,e);return _e(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function Xc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Zc(r){const e=r.anchor.getNode();return(Ze(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Po(r,e,t){const n=Zc(r);Xc(r,e,t?!n:n,"character")}function Oo(r){if(_e(r)||!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||fr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function ed(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var td=ed(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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.`)});const va=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,rd=va&&"documentMode"in document?document.documentMode:null;!(!va||!("InputEvent"in window)||rd)&&"getTargetRanges"in new window.InputEvent("input");function Ca(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function xr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Dn(r,...e){const t=Ca(...e);t.length>0&&r.classList.add(...t)}function wa(r,...e){const t=Ca(...e);t.length>0&&r.classList.remove(...t)}function nd(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function sd(r){const e=bs(r,t=>F(t)&&!t.isInline());return F(e)||td(4,r.__key),e}const bs=(r,e)=>{let t=r;for(;t!==Be()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function id(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[u,c,d,f,h,g]=a;r.update(()=>{const m=V();if(P(m)){const b=m.anchor;let C=b.getNode(),v=0,E=0;if(z(C)&&u>=0&&c>=0&&(v=u,E=u+c,m.setTextNodeRange(C,v,C,E)),v===E&&d===""||(m.insertRawText(d),C=b.getNode()),z(C)){v=f,E=f+h;const D=C.getTextContentSize();v=v>D?D:v,E=E>D?D:E,m.setTextNodeRange(C,v,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Da(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let o=0;o<t.length;o++){const i=t[o];if(!ka.has(i.nodeName)){const l=Aa(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof Oi&&i.insertAfter(mr());for(const i of o){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}}(s),n}function Sa(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Be().getChildren();for(let s=0;s<n.length;s++)Ea(r,n[s],t,e);return t.innerHTML}function Ea(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=F(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=Ni(e);h=z(h)&&n!==null?_a(n,h):h,i=h}const l=F(i)?i.getChildren():[],a=r._nodes.get(i.getType());let u;u=a&&a.exportDOM!==void 0?a.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],m=Ea(r,g,f,n);!s&&F(e)&&m&&e.extractWithChild(g,n,"html")&&(s=!0)}if(s&&!o){if((Kt(c)||uo(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(uo(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ka=new Set(["STYLE","SCRIPT"]);function Aa(r,e,t,n,s=new Map,o){let i=[];if(ka.has(r.nodeName))return i;let l=null;const a=function(g,m){const{nodeName:b}=g,C=m._htmlConversions.get(b.toLowerCase());let v=null;if(C!==void 0)for(const E of C){const D=E(g);D!==null&&(v===null||(v.priority||0)<=(D.priority||0))&&(v=D)}return v!==null?v.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const g=u.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!Rt(l))&&(l!=null&&si(l)||n);for(let g=0;g<d.length;g++)f.push(...Aa(d[g],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Jn(r)&&(f=od(r,f,h?()=>{const g=new Oi;return t.push(g),g}:ze)),l==null?f.length>0?i=i.concat(f):Jn(r)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Gs(g.nextSibling)&&Gs(g.previousSibling)}(r)&&(i=i.concat(mr())):F(l)&&l.append(...f),i}function od(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(si(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&si(e[i+1])){const a=t();a.setFormat(n),a.append(...o),s.push(a),o=[]}}return s}function ld(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var rs=ld(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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 ad(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":Sa(r,e)}function ud(r,e=V()){return e==null&&rs(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(cd(r,e))}function Mo(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const i=JSON.parse(n);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return Io(t,dd(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:a=>a}).createHTML(l):l}(s),"text/html");return Io(t,Da(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const a=V();if(P(a)){const u=i[l];u===`
72
72
  `||u===`\r
73
- `?a.insertParagraph():u===" "?a.insertNodes([_n()]):a.insertText(u)}}}else e.insertRawText(o)}function Io(r,e,t){r.dispatchCommand(wu,{nodes:e,selection:t})||t.insertNodes(e)}function Ta(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=F(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let u=Ni(t);u=z(u)&&e!==null?_a(e,u):u,i=u}const l=F(i)?i.getChildren():[],a=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&rs(58,d.name),F(u)){const f=c.children;Array.isArray(f)||rs(59,d.name)}return c}(i);if(z(i)){const u=i.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=Ta(r,e,c,a.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(a);else if(Array.isArray(a.children))for(let u=0;u<a.children.length;u++){const c=a.children[u];n.push(c)}return s}function cd(r,e){const t=[],n=Be().getChildren();for(let s=0;s<n.length;s++)Ta(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function dd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=jc(n);z(s)&&Qc(s),e.push(s)}return e}let wr=null;async function $o(r,e,t){if(wr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(zo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ht(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(ls,d=>(tr(d,ClipboardEvent)&&(c(),wr!==null&&(window.clearTimeout(wr),wr=null),a(zo(r,d,t))),!0),Rc);wr=window.setTimeout(()=>{c(),wr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function zo(r,e,t){if(t===void 0){const s=ht(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!mn(r,o,i))return!1;const l=V();if(l===null)return!1;t=hd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(pd(n,t),!0)}const fd=[["text/html",ad],["application/x-lexical-editor",ud]];function hd(r=V()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=hc();for(const[n,s]of fd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function qo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,gd=Or&&"documentMode"in document?document.documentMode:null,md=!(!Or||!("InputEvent"in window)||gd)&&"getTargetRanges"in new window.InputEvent("input"),yd=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Uo=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xd=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bd=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xd,Wo=hn();class _s extends Ht{static getType(){return"quote"}static clone(e){return new _s(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Dn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:_d,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Mi();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=ze(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ze();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Mi(){return Ot(new _s)}class vs extends Ht{static getType(){return"heading"}static clone(e){return new vs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const o=s[t];Dn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Dr,priority:0}),h2:e=>({conversion:Dr,priority:0}),h3:e=>({conversion:Dr,priority:0}),h4:e=>({conversion:Dr,priority:0}),h5:e=>({conversion:Dr,priority:0}),h6:e=>({conversion:Dr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Go(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Go(e)?{conversion:t=>({node:Jr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Jr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ze():Jr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ze();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ze():Jr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Go(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Dr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Jr(e),r.style!==null&&(Fi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function _d(r){const e=Mi();return r.style!==null&&(e.setFormat(r.style.textAlign),Fi(r,e)),{node:e}}function Jr(r){return Ot(new vs(r))}function Fn(r){let e=null;if(tr(r,DragEvent)?e=r.dataTransfer:tr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function Ko(r){const e=V();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=bs(o,u=>F(u)&&!u.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),r(l))}return t.size>0}function jn(r){const e=jr(r);return _e(e)}function vd(r){return xr(r.registerCommand(gl,e=>{const t=V();return!!Nt(t)&&(t.clear(),!0)},0),r.registerCommand(cr,e=>{const t=V();return!!P(t)&&(t.deleteCharacter(e),!0)},fe),r.registerCommand(ln,e=>{const t=V();return!!P(t)&&(t.deleteWord(e),!0)},fe),r.registerCommand(an,e=>{const t=V();return!!P(t)&&(t.deleteLine(e),!0)},fe),r.registerCommand(Tr,e=>{const t=V();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Mo(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},fe),r.registerCommand(qs,()=>{const e=V();return!!P(e)&&(e.removeText(),!0)},fe),r.registerCommand(vt,e=>{const t=V();return!!P(t)&&(t.formatText(e),!0)},fe),r.registerCommand(Nu,e=>{const t=V();if(!P(t)&&!Nt(t))return!1;const n=t.getNodes();for(const s of n){const o=bs(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},fe),r.registerCommand(Ar,e=>{const t=V();return!!P(t)&&(t.insertLineBreak(e),!0)},fe),r.registerCommand(on,()=>{const e=V();return!!P(e)&&(e.insertParagraph(),!0)},fe),r.registerCommand(Tu,()=>(aa([_n()]),!0),fe),r.registerCommand(Bu,()=>Ko(e=>{const t=e.getIndent();e.setIndent(t+1)}),fe),r.registerCommand(Qi,()=>Ko(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),fe),r.registerCommand(xl,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=un(t.focus,!0);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},fe),r.registerCommand(bl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===Be().getChildrenSize()}(t))return e.preventDefault(),!0;const n=un(t.focus,!1);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},fe),r.registerCommand(yl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ro(t,!0)){const n=e.shiftKey;return e.preventDefault(),Po(t,n,!0),!0}return!1},fe),r.registerCommand(ml,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Ro(t,!1)&&(e.preventDefault(),Po(t,n,!1),!0)},fe),r.registerCommand(_l,e=>{if(jn(e.target))return!1;const t=V();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ze(s)&&sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Qi,void 0)):(!Uo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(cr,!0))},fe),r.registerCommand(Cl,e=>{if(jn(e.target))return!1;const t=V();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(cr,!1))},fe),r.registerCommand($n,e=>{const t=V();if(!P(t))return!1;if(e!==null){if((Uo||yd||bd)&&md)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Ar,!1)}return r.dispatchCommand(on,void 0)},fe),r.registerCommand(vl,()=>{const e=V();return!!P(e)&&(r.blur(),!0)},fe),r.registerCommand(wl,e=>{const[,t]=Fn(e);if(t.length>0){const s=qo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=jr(i);if(l!==null){const a=Tc();if(z(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=jl(a);Lt(u)}r.dispatchCommand(Wo,t)}return e.preventDefault(),!0}const n=V();return!!P(n)},fe),r.registerCommand(Dl,e=>{const[t]=Fn(e),n=V();return!(t&&!P(n))},fe),r.registerCommand(Sl,e=>{const[t]=Fn(e),n=V();if(t&&!P(n))return!1;const s=qo(e.clientX,e.clientY);if(s!==null){const o=jr(s.node);_e(o)&&e.preventDefault()}return!0},fe),r.registerCommand(Us,()=>(uc(),!0),fe),r.registerCommand(ls,e=>($o(r,tr(e,ClipboardEvent)?e:null),!0),fe),r.registerCommand(pi,e=>(async function(t,n){await $o(n,tr(t,ClipboardEvent)?t:null),n.update(()=>{const s=V();P(s)?s.removeText():Nt(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),fe),r.registerCommand(os,e=>{const[,t,n]=Fn(e);return t.length>0&&!n?(r.dispatchCommand(Wo,t),!0):Di(e.target)?!1:V()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=V(),l=tr(s,InputEvent)||tr(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&Mo(l,i,o)},{tag:"paste"})}(e,r),!0)},fe))}const ii=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Vo(r){return r.getEditorState().read(ba(r.isComposing()))}function Cd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=wt(),s=function(o,i){const[l,a]=w.useState(()=>o.getDecorators());return ii(()=>o.registerDecoratorListener(u=>{$i.flushSync(()=>{a(u)})}),[o]),w.useEffect(()=>{a(o.getDecorators())},[o]),w.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(i,{onError:m=>o._onError(m),children:p.jsx(w.Suspense,{fallback:null,children:l[f]})}),g=o.getElementByKey(f);g!==null&&u.push($i.createPortal(h,g,f))}return u},[i,l,o])}(n,t);return function(o){ii(()=>xr(vd(o),id(o)),[o])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(wd,{content:e}),s]})}function wd({content:r}){const[e]=wt(),t=function(s){const[o,i]=w.useState(()=>Vo(s));return ii(()=>{function l(){const a=Vo(s);i(a)}return l(),xr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=zc();return t?typeof r=="function"?r(n):r:null}const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:b="textbox",spellCheck:C=!0,style:v,tabIndex:E,"data-testid":D,...k},y){const[_,S]=w.useState(r.isEditable()),A=w.useCallback(B=>{B&&B.ownerDocument&&B.ownerDocument.defaultView?r.setRootElement(B):r.setRootElement(null)},[r]),I=w.useMemo(()=>function(...B){return N=>{B.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(y,A),[A,y]);return Ba(()=>(S(r.isEditable()),r.registerEditableListener(B=>{S(B)})),[r]),p.jsx("div",{"aria-activedescendant":_?e:void 0,"aria-autocomplete":_?t:"none","aria-controls":_?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":_&&b==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:_,"data-testid":D,id:m,ref:I,role:_?b:void 0,spellCheck:C,style:v,tabIndex:E,...k})}const Sd=w.forwardRef(Dd);function Ho(r){return r.getEditorState().read(ba(r.isComposing()))}const Ed=w.forwardRef(kd);function kd(r,e){const{placeholder:t,...n}=r,[s]=wt();return p.jsxs(p.Fragment,{children:[p.jsx(Sd,{editor:s,...n,ref:e}),t!=null&&p.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,a]=w.useState(()=>Ho(i));return Ba(()=>{function u(){const c=Ho(i);a(c)}return u(),xr(i.registerUpdateListener(()=>{u()}),i.registerEditableListener(()=>{u()}))},[i]),l}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:p.jsx("div",{"aria-hidden":!0,children:o})}const Ln=0,oi=1,li=2,_t=0,Td=1,Jo=2,Bd=3,Nd=4;function Fd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return _t;const o=e._selection,i=r._selection;if(s)return Td;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return _t;const l=function(C,v,E){const D=C._nodeMap,k=[];for(const y of v){const _=D.get(y);_!==void 0&&k.push(_)}for(const[y,_]of E){if(!_)continue;const S=D.get(y);S===void 0||Ze(S)||k.push(S)}return k}(e,t,n);if(l.length===0)return _t;if(l.length>1){const C=e._nodeMap,v=C.get(o.anchor.key),E=C.get(i.anchor.key);return v&&E&&!r._nodeMap.has(v.__key)&&z(v)&&v.__text.length===1&&o.anchor.offset===1?Jo:_t}const a=l[0],u=r._nodeMap.get(a.__key);if(!z(u)||!z(a)||u.__mode!==a.__mode)return _t;const c=u.__text,d=a.__text;if(c===d)return _t;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return _t;const g=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===g-1?Jo:b===-1&&m===g+1?Bd:b===-1&&m===g?Nd:_t}function jd(r,e){let t=Date.now(),n=_t;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=_t,t=c,li;const d=Fd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return Ln;if(s===null)return oi;const m=o._selection;return l.size>0||a.size>0?g===!1&&d!==_t&&d===n&&c<t+e&&h||l.size===1&&function(b,C,v){const E=C._nodeMap.get(b),D=v._nodeMap.get(b),k=C._selection,y=v._selection;return!(P(k)&&P(y)&&k.anchor.type==="element"&&k.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(v.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?Ln:oi:m!==null?Ln:li})();return t=c,n=d,f}}function Qo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Ld(r,e,t){const n=jd(r,t);return xr(r.registerCommand(fi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(a.length!==0){const u=i.current,c=a.pop();u!==null&&(l.push(u),o.dispatchCommand(kn,!0)),a.length===0&&o.dispatchCommand(An,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(hi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(l.length!==0){const u=i.current;u!==null&&(a.push(u),o.dispatchCommand(An,!0));const c=l.pop();l.length===0&&o.dispatchCommand(kn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(ju,()=>(Qo(e),!1),fe),r.registerCommand(Lu,()=>(Qo(e),r.dispatchCommand(kn,!1),r.dispatchCommand(An,!1),!0),fe),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const g=n(i,o,c,l,a,u);if(g===oi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(kn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(An,!0));else if(g===li)return;e.current={editor:r,editorState:o}}))}function Rd(){return{current:null,redoStack:[],undoStack:[]}}function Pd({delay:r,externalHistoryState:e}){const[t]=wt();return function(n,s,o=1e3){const i=w.useMemo(()=>s||Rd(),[s]);w.useEffect(()=>Ld(n,i,o),[o,n,i])}(t,e,r),null}const Od=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Md({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=wt();return Od(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:a})=>{e&&o.size===0&&i.size===0||r&&a.has("history-merge")||l.isEmpty()||t(s,n,a)})},[n,r,e,t]),null}function ai(r,e){return ai=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ai(r,e)}var Yo={error:null},Id=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),a=0;a<i;a++)l[a]=arguments[a];return(o=r.call.apply(r,[this].concat(l))||this).state=Yo,o.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(u=o.props).onReset.apply(u,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,ai(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Yo)},s.componentDidCatch=function(o,i){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,i)},s.componentDidUpdate=function(o,i){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((u=o.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,a=i.FallbackComponent,u=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(Ds.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return Ds.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ds.Component);function $d({children:r,onError:e}){return p.jsx(Id,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function zd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ft=zd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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 qd(r){let e=1,t=r.getParent();for(;t!=null;){if(Fe(t)){const n=t.getParent();if(ue(n)){e++,t=n.getParent();continue}Ft(40)}return e}return e}function ui(r){let e=r.getParent();ue(e)||Ft(40);let t=e;for(;t!==null;)t=t.getParent(),ue(t)&&(e=t);return e}function Na(r){let e=[];const t=r.getChildren().filter(Fe);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();ue(o)?e=e.concat(Na(o)):e.push(s)}return e}function jt(r){return Fe(r)&&ue(r.getFirstChild())}function Xo(r){return ut().append(r)}function Fa(r,e){return Fe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Zo(r,e){r.update(()=>{const t=V();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&Ft(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Fa(l,n)){const u=it(e);if(Rt(a)){l.replace(u);const c=ut();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Fe(l)){const c=l.getParentOrThrow();yr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!F(i)||!i.isEmpty()||Fe(i)||s.has(i.getKey())){if(Rl(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(ue(l)){if(!s.has(a)){const u=it(e);yr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Rt(u)&&!s.has(a)){s.add(a),el(l,e);break}l=u}}}}else el(i,e)}}})}function yr(r,e){r.splice(r.getChildrenSize(),0,e)}function el(r,e){if(ue(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=ut();let o;if(yr(s,r.getChildren()),ue(t)&&e===t.getListType())t.append(s),ue(n)&&e===n.getListType()&&(yr(t,n.getChildren()),n.remove()),o=t;else if(ue(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=it(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ii(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function Ud(r){r.update(()=>{const e=V();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Fa(s,n))t.add(ui(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Rl(i)){const l=nd(i,br);l!=null&&t.add(ui(l))}}for(const o of t){let i=o;const l=Na(o);for(const a of l){const u=ze();yr(u,a.getChildren()),i.insertAfter(u),i=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}o.remove()}}})}function Wd(r){const e=new Set;if(jt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(jt(n)&&jt(s)){const o=s.getFirstChild();if(ue(o)){o.append(r);const i=n.getFirstChild();ue(i)&&(yr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(jt(n)){const o=n.getFirstChild();if(ue(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(jt(s)){const o=s.getFirstChild();ue(o)&&o.append(r)}else if(ue(t)){const o=ut(),i=it(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Gd(r){if(jt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(ue(t?t.getParent():void 0)&&Fe(t)&&ue(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const o=e.getListType(),i=ut(),l=it(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=ut(),u=it(o);a.append(u),yr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Kd(){const r=V();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Fe(e)||e.getChildrenSize()!==0)return!1;const t=ui(e),n=e.getParent();ue(n)||Ft(40);const s=n.getParent();let o;if(Rt(s))o=ze(),t.insertAfter(o);else{if(!Fe(s))return!1;o=ut(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=it(n.getListType());if(Lr(o))o.insertAfter(l);else{const a=ut();a.append(l),o.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Fe(a)&&!ue(a))break;a=u}a.remove()}(e),!0}function ns(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class br extends Ht{static getType(){return"listitem"}static clone(e){return new br(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return ue(n)&&n.getListType()==="check"&&rl(t,this,null),t.value=this.__value,tl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return ue(s)&&s.getListType()==="check"&&rl(t,this,e),t.value=this.__value,tl(t,n.theme,this),!1}static transform(){return e=>{if(Fe(e)||Ft(144),e.__checked==null)return;const t=e.getParent();ue(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Vd,priority:0})}}static importJSON(e){const t=ut();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Fe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ue(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=it(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Ft(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(ue(n)||Ft(39),Fe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=it(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ut(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ze();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Fe(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,a=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(a,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return ue(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Fe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Ft(117),(e=Math.floor(e))>=0||Ft(199);let t=this.getIndent();for(;t!==e;)t<e?(Wd(this),t++):(Gd(this),t--);return this}canInsertAfter(e){return Fe(e)}canReplaceWith(e){return Fe(e)}canMergeWith(e){return Lr(e)||Fe(e)}extractWithChild(e,t){if(!P(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return it("bullet")}canMergeWhenEmpty(){return!0}}function tl(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...ns(i)),o){const a=t.getParent(),u=ue(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(o.listitemUnchecked),u&&c||s.push(o.listitemChecked),u&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const a=ns(l);t.getChildren().some(u=>ue(u))?n.push(...a):s.push(...a)}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function rl(r,e,t,n){ue(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Vd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Hd(t)}const e=r.getAttribute("aria-checked");return{node:ut(e==="true"||e!=="false"&&void 0)}}function Hd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:ut(r.hasAttribute("checked"))}}function ut(r){return Ot(new br(void 0,r))}function Fe(r){return r instanceof br}class Mr extends Ht{static getType(){return"list"}static clone(e){const t=e.__listType||il[e.__tag];return new Mr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=il[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,nl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(nl(t,n.theme,this),!1)}static transform(){return e=>{ue(e)||Ft(163),function(t){const n=t.getNextSibling();ue(n)&&t.getListType()===n.getListType()&&Ii(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Fe(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),ue(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:sl,priority:0}),ul:()=>({conversion:sl,priority:0})}}static importJSON(e){const t=it(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Kt(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}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 t=0;t<e.length;t++){const n=e[t];if(Fe(n))super.append(n);else{const s=ut();if(ue(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Ue(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Fe(e)}}function nl(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=qd(t)-1,a=l%i.length,u=i[a],c=o[t.__tag];let d;const f=o.nested,h=o.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...ns(u));for(let g=0;g<i.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=ns(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function Jd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Fe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{ue(o)&&e.push(Xo(o))})}else e.push(Xo(n))}return e}function sl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=it("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Kt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?it("check"):it("bullet")),{after:Jd,node:t}}const il={ol:"number",ul:"bullet"};function it(r,e=1){return Ot(new Mr(r,e))}function ue(r){return r instanceof Mr}const ja=hn(),La=hn(),Qd=hn();function Yd(r){return xr(r.registerCommand(La,()=>(Zo(r,"number"),!0),kr),r.registerCommand(ja,()=>(Zo(r,"bullet"),!0),kr),r.registerCommand(Qd,()=>(Ud(r),!0),kr),r.registerCommand(on,()=>!!Kd(),kr))}function Xd(){const[r]=wt();return w.useEffect(()=>{if(!r.hasNodes([Mr,br]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>Yd(e),[e])}(r),null}const Zd=new Set(["http:","https:","mailto:","sms:","tel:"]);class _r extends Ht{static getType(){return"link"}static clone(e){return new _r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Dn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:ef,priority:1})}}static importJSON(e){const t=ss(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Zd.has(t.protocol))return"about:blank"}catch{return e}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,t=!0){const n=ss(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function ef(r){let e=null;if(fc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=ss(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function ss(r,e){return Ot(new _r(r,e))}function Gr(r){return r instanceof _r}class Sn extends _r{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Sn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ol(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ol(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ol(r,e){return Ot(new Sn(r,e))}function tf(r){return r instanceof Sn}const ll=hn();function Is(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=V();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=bs(l,u=>!tf(u)&&Gr(u));if(a){const u=a.getChildren();for(let c=0;c<u.length;c++)a.insertBefore(u[c]);a.remove()}});else{if(i.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Gr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let l=null,a=null;i.forEach(u=>{const c=u.getParent();if(c!==a&&c!==null&&(!F(u)||u.isInline())){if(Gr(c))return a=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n));if(c.is(l)||(l=c,a=ss(r,{rel:s,target:t,title:n}),Gr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Gr(u)){if(u.is(a))return;if(a!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)a.append(d[f])}u.remove()}else a!==null&&a.append(u)}})}}function rf({validateUrl:r,attributes:e}){const[t]=wt();return w.useEffect(()=>{if(!t.hasNodes([_r]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xr(t.registerCommand(ll,n=>{if(n===null)return Is(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Is(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Is(s,{...e,rel:i,target:o,title:l}),!0}},kr),r!==void 0?t.registerCommand(os,n=>{const s=V();if(!P(s)||s.isCollapsed()||!tr(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>F(l))&&(t.dispatchCommand(ll,{...e,url:i}),n.preventDefault(),!0)},kr):()=>{})},[t,r,e]),null}function nf(r){if(r instanceof HTMLImageElement){const{src:e,alt:t,width:n,height:s}=r;return{node:Ra({src:e,altText:t,width:n||void 0,height:s||void 0})}}return null}class Cs extends pa{constructor(t,n,s,o,i){super(i);qt(this,"__src");qt(this,"__altText");qt(this,"__width");qt(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=o}static getType(){return"image"}static clone(t){return new Cs(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:o,height:i}=t;return Ra({src:n,altText:s,width:o,height:i})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:nf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx("img",{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}}function Ra(r){return new Cs(r.src,r.altText,r.width,r.height)}const sf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},of={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function lf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:o,aiProcessingAction:i,onAiAction:l,hasContent:a}){const[u]=wt(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,g=w.useCallback(()=>{u.dispatchCommand(vt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(vt,"italic")},[u]),b=w.useCallback(()=>{u.dispatchCommand(vt,"underline")},[u]),C=w.useCallback(()=>{u.dispatchCommand(ja,void 0)},[u]),v=w.useCallback(()=>{u.dispatchCommand(La,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const _=V();P(_)&&Yc(_,()=>Mi())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},k=`
73
+ `?a.insertParagraph():u===" "?a.insertNodes([_n()]):a.insertText(u)}}}else e.insertRawText(o)}function Io(r,e,t){r.dispatchCommand(wu,{nodes:e,selection:t})||t.insertNodes(e)}function Ta(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=F(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let u=Ni(t);u=z(u)&&e!==null?_a(e,u):u,i=u}const l=F(i)?i.getChildren():[],a=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&rs(58,d.name),F(u)){const f=c.children;Array.isArray(f)||rs(59,d.name)}return c}(i);if(z(i)){const u=i.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=Ta(r,e,c,a.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(a);else if(Array.isArray(a.children))for(let u=0;u<a.children.length;u++){const c=a.children[u];n.push(c)}return s}function cd(r,e){const t=[],n=Be().getChildren();for(let s=0;s<n.length;s++)Ta(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function dd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=jc(n);z(s)&&Qc(s),e.push(s)}return e}let wr=null;async function $o(r,e,t){if(wr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(zo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ht(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(ls,d=>(tr(d,ClipboardEvent)&&(c(),wr!==null&&(window.clearTimeout(wr),wr=null),a(zo(r,d,t))),!0),Rc);wr=window.setTimeout(()=>{c(),wr=null,a(!1)},50),s.execCommand("copy"),i.remove()})}function zo(r,e,t){if(t===void 0){const s=ht(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!mn(r,o,i))return!1;const l=V();if(l===null)return!1;t=hd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(pd(n,t),!0)}const fd=[["text/html",ad],["application/x-lexical-editor",ud]];function hd(r=V()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=hc();for(const[n,s]of fd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function qo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,gd=Or&&"documentMode"in document?document.documentMode:null,md=!(!Or||!("InputEvent"in window)||gd)&&"getTargetRanges"in new window.InputEvent("input"),yd=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Uo=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xd=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bd=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xd,Wo=hn();class _s extends Ht{static getType(){return"quote"}static clone(e){return new _s(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Dn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:_d,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Mi();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=ze(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ze();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Mi(){return Ot(new _s)}class vs extends Ht{static getType(){return"heading"}static clone(e){return new vs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const o=s[t];Dn(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Dr,priority:0}),h2:e=>({conversion:Dr,priority:0}),h3:e=>({conversion:Dr,priority:0}),h4:e=>({conversion:Dr,priority:0}),h5:e=>({conversion:Dr,priority:0}),h6:e=>({conversion:Dr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Go(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Go(e)?{conversion:t=>({node:Jr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Kt(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Jr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ze():Jr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ze();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ze():Jr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Go(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Dr(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Jr(e),r.style!==null&&(Fi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function _d(r){const e=Mi();return r.style!==null&&(e.setFormat(r.style.textAlign),Fi(r,e)),{node:e}}function Jr(r){return Ot(new vs(r))}function Fn(r){let e=null;if(tr(r,DragEvent)?e=r.dataTransfer:tr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function Ko(r){const e=V();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=bs(o,u=>F(u)&&!u.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),r(l))}return t.size>0}function jn(r){const e=jr(r);return _e(e)}function vd(r){return xr(r.registerCommand(gl,e=>{const t=V();return!!Nt(t)&&(t.clear(),!0)},0),r.registerCommand(cr,e=>{const t=V();return!!P(t)&&(t.deleteCharacter(e),!0)},fe),r.registerCommand(ln,e=>{const t=V();return!!P(t)&&(t.deleteWord(e),!0)},fe),r.registerCommand(an,e=>{const t=V();return!!P(t)&&(t.deleteLine(e),!0)},fe),r.registerCommand(Tr,e=>{const t=V();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Mo(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},fe),r.registerCommand(qs,()=>{const e=V();return!!P(e)&&(e.removeText(),!0)},fe),r.registerCommand(vt,e=>{const t=V();return!!P(t)&&(t.formatText(e),!0)},fe),r.registerCommand(Nu,e=>{const t=V();if(!P(t)&&!Nt(t))return!1;const n=t.getNodes();for(const s of n){const o=bs(s,i=>F(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},fe),r.registerCommand(Ar,e=>{const t=V();return!!P(t)&&(t.insertLineBreak(e),!0)},fe),r.registerCommand(on,()=>{const e=V();return!!P(e)&&(e.insertParagraph(),!0)},fe),r.registerCommand(Tu,()=>(aa([_n()]),!0),fe),r.registerCommand(Bu,()=>Ko(e=>{const t=e.getIndent();e.setIndent(t+1)}),fe),r.registerCommand(Qi,()=>Ko(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),fe),r.registerCommand(xl,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=un(t.focus,!0);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},fe),r.registerCommand(bl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===Be().getChildrenSize()}(t))return e.preventDefault(),!0;const n=un(t.focus,!1);if(!e.shiftKey&&_e(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},fe),r.registerCommand(yl,e=>{const t=V();if(Nt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ro(t,!0)){const n=e.shiftKey;return e.preventDefault(),Po(t,n,!0),!0}return!1},fe),r.registerCommand(ml,e=>{const t=V();if(Nt(t)&&!jn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Ro(t,!1)&&(e.preventDefault(),Po(t,n,!1),!0)},fe),r.registerCommand(_l,e=>{if(jn(e.target))return!1;const t=V();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ze(s)&&sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Qi,void 0)):(!Uo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(cr,!0))},fe),r.registerCommand(Cl,e=>{if(jn(e.target))return!1;const t=V();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(cr,!1))},fe),r.registerCommand($n,e=>{const t=V();if(!P(t))return!1;if(e!==null){if((Uo||yd||bd)&&md)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Ar,!1)}return r.dispatchCommand(on,void 0)},fe),r.registerCommand(vl,()=>{const e=V();return!!P(e)&&(r.blur(),!0)},fe),r.registerCommand(wl,e=>{const[,t]=Fn(e);if(t.length>0){const s=qo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=jr(i);if(l!==null){const a=Tc();if(z(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=jl(a);Lt(u)}r.dispatchCommand(Wo,t)}return e.preventDefault(),!0}const n=V();return!!P(n)},fe),r.registerCommand(Dl,e=>{const[t]=Fn(e),n=V();return!(t&&!P(n))},fe),r.registerCommand(Sl,e=>{const[t]=Fn(e),n=V();if(t&&!P(n))return!1;const s=qo(e.clientX,e.clientY);if(s!==null){const o=jr(s.node);_e(o)&&e.preventDefault()}return!0},fe),r.registerCommand(Us,()=>(uc(),!0),fe),r.registerCommand(ls,e=>($o(r,tr(e,ClipboardEvent)?e:null),!0),fe),r.registerCommand(pi,e=>(async function(t,n){await $o(n,tr(t,ClipboardEvent)?t:null),n.update(()=>{const s=V();P(s)?s.removeText():Nt(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),fe),r.registerCommand(os,e=>{const[,t,n]=Fn(e);return t.length>0&&!n?(r.dispatchCommand(Wo,t),!0):Di(e.target)?!1:V()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=V(),l=tr(s,InputEvent)||tr(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&Mo(l,i,o)},{tag:"paste"})}(e,r),!0)},fe))}const ii=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Vo(r){return r.getEditorState().read(ba(r.isComposing()))}function Cd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=wt(),s=function(o,i){const[l,a]=w.useState(()=>o.getDecorators());return ii(()=>o.registerDecoratorListener(u=>{$i.flushSync(()=>{a(u)})}),[o]),w.useEffect(()=>{a(o.getDecorators())},[o]),w.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(i,{onError:m=>o._onError(m),children:p.jsx(w.Suspense,{fallback:null,children:l[f]})}),g=o.getElementByKey(f);g!==null&&u.push($i.createPortal(h,g,f))}return u},[i,l,o])}(n,t);return function(o){ii(()=>xr(vd(o),id(o)),[o])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(wd,{content:e}),s]})}function wd({content:r}){const[e]=wt(),t=function(s){const[o,i]=w.useState(()=>Vo(s));return ii(()=>{function l(){const a=Vo(s);i(a)}return l(),xr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=zc();return t?typeof r=="function"?r(n):r:null}const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:b="textbox",spellCheck:C=!0,style:v,tabIndex:E,"data-testid":D,...k},y){const[_,S]=w.useState(r.isEditable()),A=w.useCallback(B=>{B&&B.ownerDocument&&B.ownerDocument.defaultView?r.setRootElement(B):r.setRootElement(null)},[r]),I=w.useMemo(()=>function(...B){return N=>{B.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(y,A),[A,y]);return Ba(()=>(S(r.isEditable()),r.registerEditableListener(B=>{S(B)})),[r]),p.jsx("div",{"aria-activedescendant":_?e:void 0,"aria-autocomplete":_?t:"none","aria-controls":_?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":_&&b==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:_,"data-testid":D,id:m,ref:I,role:_?b:void 0,spellCheck:C,style:v,tabIndex:E,...k})}const Sd=w.forwardRef(Dd);function Ho(r){return r.getEditorState().read(ba(r.isComposing()))}const Ed=w.forwardRef(kd);function kd(r,e){const{placeholder:t,...n}=r,[s]=wt();return p.jsxs(p.Fragment,{children:[p.jsx(Sd,{editor:s,...n,ref:e}),t!=null&&p.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,a]=w.useState(()=>Ho(i));return Ba(()=>{function u(){const c=Ho(i);a(c)}return u(),xr(i.registerUpdateListener(()=>{u()}),i.registerEditableListener(()=>{u()}))},[i]),l}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:p.jsx("div",{"aria-hidden":!0,children:o})}const Ln=0,oi=1,li=2,_t=0,Td=1,Jo=2,Bd=3,Nd=4;function Fd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return _t;const o=e._selection,i=r._selection;if(s)return Td;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return _t;const l=function(C,v,E){const D=C._nodeMap,k=[];for(const y of v){const _=D.get(y);_!==void 0&&k.push(_)}for(const[y,_]of E){if(!_)continue;const S=D.get(y);S===void 0||Ze(S)||k.push(S)}return k}(e,t,n);if(l.length===0)return _t;if(l.length>1){const C=e._nodeMap,v=C.get(o.anchor.key),E=C.get(i.anchor.key);return v&&E&&!r._nodeMap.has(v.__key)&&z(v)&&v.__text.length===1&&o.anchor.offset===1?Jo:_t}const a=l[0],u=r._nodeMap.get(a.__key);if(!z(u)||!z(a)||u.__mode!==a.__mode)return _t;const c=u.__text,d=a.__text;if(c===d)return _t;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return _t;const g=f.offset,m=h.offset,b=d.length-c.length;return b===1&&m===g-1?Jo:b===-1&&m===g+1?Bd:b===-1&&m===g?Nd:_t}function jd(r,e){let t=Date.now(),n=_t;return(s,o,i,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=_t,t=c,li;const d=Fd(s,o,l,a,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return Ln;if(s===null)return oi;const m=o._selection;return l.size>0||a.size>0?g===!1&&d!==_t&&d===n&&c<t+e&&h||l.size===1&&function(b,C,v){const E=C._nodeMap.get(b),D=v._nodeMap.get(b),k=C._selection,y=v._selection;return!(P(k)&&P(y)&&k.anchor.type==="element"&&k.focus.type==="element"&&y.anchor.type==="text"&&y.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(v.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?Ln:oi:m!==null?Ln:li})();return t=c,n=d,f}}function Qo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Ld(r,e,t){const n=jd(r,t);return xr(r.registerCommand(fi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(a.length!==0){const u=i.current,c=a.pop();u!==null&&(l.push(u),o.dispatchCommand(kn,!0)),a.length===0&&o.dispatchCommand(An,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(hi,()=>(function(o,i){const l=i.redoStack,a=i.undoStack;if(l.length!==0){const u=i.current;u!==null&&(a.push(u),o.dispatchCommand(An,!0));const c=l.pop();l.length===0&&o.dispatchCommand(kn,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),fe),r.registerCommand(ju,()=>(Qo(e),!1),fe),r.registerCommand(Lu,()=>(Qo(e),r.dispatchCommand(kn,!1),r.dispatchCommand(An,!1),!0),fe),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const g=n(i,o,c,l,a,u);if(g===oi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(kn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(An,!0));else if(g===li)return;e.current={editor:r,editorState:o}}))}function Rd(){return{current:null,redoStack:[],undoStack:[]}}function Pd({delay:r,externalHistoryState:e}){const[t]=wt();return function(n,s,o=1e3){const i=w.useMemo(()=>s||Rd(),[s]);w.useEffect(()=>Ld(n,i,o),[o,n,i])}(t,e,r),null}const Od=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Md({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=wt();return Od(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:a})=>{e&&o.size===0&&i.size===0||r&&a.has("history-merge")||l.isEmpty()||t(s,n,a)})},[n,r,e,t]),null}function ai(r,e){return ai=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ai(r,e)}var Yo={error:null},Id=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),a=0;a<i;a++)l[a]=arguments[a];return(o=r.call.apply(r,[this].concat(l))||this).state=Yo,o.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(u=o.props).onReset.apply(u,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,ai(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Yo)},s.componentDidCatch=function(o,i){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,i)},s.componentDidUpdate=function(o,i){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((u=o.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,a=i.FallbackComponent,u=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(Ds.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return Ds.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ds.Component);function $d({children:r,onError:e}){return p.jsx(Id,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function zd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ft=zd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; 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 qd(r){let e=1,t=r.getParent();for(;t!=null;){if(Fe(t)){const n=t.getParent();if(ue(n)){e++,t=n.getParent();continue}Ft(40)}return e}return e}function ui(r){let e=r.getParent();ue(e)||Ft(40);let t=e;for(;t!==null;)t=t.getParent(),ue(t)&&(e=t);return e}function Na(r){let e=[];const t=r.getChildren().filter(Fe);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();ue(o)?e=e.concat(Na(o)):e.push(s)}return e}function jt(r){return Fe(r)&&ue(r.getFirstChild())}function Xo(r){return ut().append(r)}function Fa(r,e){return Fe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Zo(r,e){r.update(()=>{const t=V();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&Ft(143);const[i]=o,l=i.getNode(),a=l.getParent();if(Fa(l,n)){const u=it(e);if(Rt(a)){l.replace(u);const c=ut();F(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Fe(l)){const c=l.getParentOrThrow();yr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!F(i)||!i.isEmpty()||Fe(i)||s.has(i.getKey())){if(Rl(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(ue(l)){if(!s.has(a)){const u=it(e);yr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Rt(u)&&!s.has(a)){s.add(a),el(l,e);break}l=u}}}}else el(i,e)}}})}function yr(r,e){r.splice(r.getChildrenSize(),0,e)}function el(r,e){if(ue(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=ut();let o;if(yr(s,r.getChildren()),ue(t)&&e===t.getListType())t.append(s),ue(n)&&e===n.getListType()&&(yr(t,n.getChildren()),n.remove()),o=t;else if(ue(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=it(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ii(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function Ud(r){r.update(()=>{const e=V();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Fa(s,n))t.add(ui(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Rl(i)){const l=nd(i,br);l!=null&&t.add(ui(l))}}for(const o of t){let i=o;const l=Na(o);for(const a of l){const u=ze();yr(u,a.getChildren()),i.insertAfter(u),i=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}o.remove()}}})}function Wd(r){const e=new Set;if(jt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(jt(n)&&jt(s)){const o=s.getFirstChild();if(ue(o)){o.append(r);const i=n.getFirstChild();ue(i)&&(yr(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(jt(n)){const o=n.getFirstChild();if(ue(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(jt(s)){const o=s.getFirstChild();ue(o)&&o.append(r)}else if(ue(t)){const o=ut(),i=it(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Gd(r){if(jt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(ue(t?t.getParent():void 0)&&Fe(t)&&ue(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const o=e.getListType(),i=ut(),l=it(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=ut(),u=it(o);a.append(u),yr(u,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(a),t.replace(r)}}}function Kd(){const r=V();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Fe(e)||e.getChildrenSize()!==0)return!1;const t=ui(e),n=e.getParent();ue(n)||Ft(40);const s=n.getParent();let o;if(Rt(s))o=ze(),t.insertAfter(o);else{if(!Fe(s))return!1;o=ut(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=it(n.getListType());if(Lr(o))o.insertAfter(l);else{const a=ut();a.append(l),o.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Fe(a)&&!ue(a))break;a=u}a.remove()}(e),!0}function ns(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class br extends Ht{static getType(){return"listitem"}static clone(e){return new br(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return ue(n)&&n.getListType()==="check"&&rl(t,this,null),t.value=this.__value,tl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return ue(s)&&s.getListType()==="check"&&rl(t,this,e),t.value=this.__value,tl(t,n.theme,this),!1}static transform(){return e=>{if(Fe(e)||Ft(144),e.__checked==null)return;const t=e.getParent();ue(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Vd,priority:0})}}static importJSON(e){const t=ut();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Fe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ue(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=it(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Ft(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(ue(n)||Ft(39),Fe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=it(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&jt(t)&&jt(n)&&(Ii(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ut(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ze();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Fe(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,a=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(a,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return ue(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Fe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Ft(117),(e=Math.floor(e))>=0||Ft(199);let t=this.getIndent();for(;t!==e;)t<e?(Wd(this),t++):(Gd(this),t--);return this}canInsertAfter(e){return Fe(e)}canReplaceWith(e){return Fe(e)}canMergeWith(e){return Lr(e)||Fe(e)}extractWithChild(e,t){if(!P(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return it("bullet")}canMergeWhenEmpty(){return!0}}function tl(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...ns(i)),o){const a=t.getParent(),u=ue(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(o.listitemUnchecked),u&&c||s.push(o.listitemChecked),u&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const a=ns(l);t.getChildren().some(u=>ue(u))?n.push(...a):s.push(...a)}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function rl(r,e,t,n){ue(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Vd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Hd(t)}const e=r.getAttribute("aria-checked");return{node:ut(e==="true"||e!=="false"&&void 0)}}function Hd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:ut(r.hasAttribute("checked"))}}function ut(r){return Ot(new br(void 0,r))}function Fe(r){return r instanceof br}class Mr extends Ht{static getType(){return"list"}static clone(e){const t=e.__listType||il[e.__tag];return new Mr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=il[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,nl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(nl(t,n.theme,this),!1)}static transform(){return e=>{ue(e)||Ft(163),function(t){const n=t.getNextSibling();ue(n)&&t.getListType()===n.getListType()&&Ii(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Fe(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),ue(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:sl,priority:0}),ul:()=>({conversion:sl,priority:0})}}static importJSON(e){const t=it(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Kt(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}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 t=0;t<e.length;t++){const n=e[t];if(Fe(n))super.append(n);else{const s=ut();if(ue(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const o=Ue(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Fe(e)}}function nl(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=qd(t)-1,a=l%i.length,u=i[a],c=o[t.__tag];let d;const f=o.nested,h=o.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...ns(u));for(let g=0;g<i.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=ns(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&wa(r,...s),n.length>0&&Dn(r,...n)}function Jd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Fe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{ue(o)&&e.push(Xo(o))})}else e.push(Xo(n))}return e}function sl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=it("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Kt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?it("check"):it("bullet")),{after:Jd,node:t}}const il={ol:"number",ul:"bullet"};function it(r,e=1){return Ot(new Mr(r,e))}function ue(r){return r instanceof Mr}const ja=hn(),La=hn(),Qd=hn();function Yd(r){return xr(r.registerCommand(La,()=>(Zo(r,"number"),!0),kr),r.registerCommand(ja,()=>(Zo(r,"bullet"),!0),kr),r.registerCommand(Qd,()=>(Ud(r),!0),kr),r.registerCommand(on,()=>!!Kd(),kr))}function Xd(){const[r]=wt();return w.useEffect(()=>{if(!r.hasNodes([Mr,br]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>Yd(e),[e])}(r),null}const Zd=new Set(["http:","https:","mailto:","sms:","tel:"]);class _r extends Ht{static getType(){return"link"}static clone(e){return new _r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Dn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:ef,priority:1})}}static importJSON(e){const t=ss(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Zd.has(t.protocol))return"about:blank"}catch{return e}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,t=!0){const n=ss(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function ef(r){let e=null;if(fc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=ss(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function ss(r,e){return Ot(new _r(r,e))}function Gr(r){return r instanceof _r}class Sn extends _r{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Sn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ol(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ol(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ol(r,e){return Ot(new Sn(r,e))}function tf(r){return r instanceof Sn}const ll=hn();function Is(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=V();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const a=bs(l,u=>!tf(u)&&Gr(u));if(a){const u=a.getChildren();for(let c=0;c<u.length;c++)a.insertBefore(u[c]);a.remove()}});else{if(i.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Gr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let l=null,a=null;i.forEach(u=>{const c=u.getParent();if(c!==a&&c!==null&&(!F(u)||u.isInline())){if(Gr(c))return a=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n));if(c.is(l)||(l=c,a=ss(r,{rel:s,target:t,title:n}),Gr(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),Gr(u)){if(u.is(a))return;if(a!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)a.append(d[f])}u.remove()}else a!==null&&a.append(u)}})}}function rf({validateUrl:r,attributes:e}){const[t]=wt();return w.useEffect(()=>{if(!t.hasNodes([_r]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xr(t.registerCommand(ll,n=>{if(n===null)return Is(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Is(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Is(s,{...e,rel:i,target:o,title:l}),!0}},kr),r!==void 0?t.registerCommand(os,n=>{const s=V();if(!P(s)||s.isCollapsed()||!tr(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>F(l))&&(t.dispatchCommand(ll,{...e,url:i}),n.preventDefault(),!0)},kr):()=>{})},[t,r,e]),null}function nf(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return console.log("[ImageNode] Converting img element, src length:",e.length,"alt:",t),{node:Ra({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}class Cs extends pa{constructor(t,n,s,o,i){super(i);qt(this,"__src");qt(this,"__altText");qt(this,"__width");qt(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=o}static getType(){return"image"}static clone(t){return new Cs(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:o,height:i}=t;return Ra({src:n,altText:s,width:o,height:i})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:nf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){var t;return console.log("[ImageNode] decorate() called, src length:",(t=this.__src)==null?void 0:t.length,"alt:",this.__altText),p.jsx("img",{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}}function Ra(r){return new Cs(r.src,r.altText,r.width,r.height)}const sf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},of={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function lf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:o,aiProcessingAction:i,onAiAction:l,hasContent:a}){const[u]=wt(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,g=w.useCallback(()=>{u.dispatchCommand(vt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(vt,"italic")},[u]),b=w.useCallback(()=>{u.dispatchCommand(vt,"underline")},[u]),C=w.useCallback(()=>{u.dispatchCommand(ja,void 0)},[u]),v=w.useCallback(()=>{u.dispatchCommand(La,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const _=V();P(_)&&Yc(_,()=>Mi())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},k=`
74
74
  .mail-editor-toolbar-btn:hover:not(:disabled) {
75
75
  background: ${r.border};
76
76
  }
package/dist/index.esm.js CHANGED
@@ -11673,12 +11673,12 @@ function rf({ validateUrl: r, attributes: e }) {
11673
11673
  }
11674
11674
  function nf(r) {
11675
11675
  if (r instanceof HTMLImageElement) {
11676
- const { src: e, alt: t, width: n, height: s } = r;
11677
- return { node: Oa({
11676
+ const e = r.getAttribute("src") || "", t = r.getAttribute("alt") || "", n = r.getAttribute("width"), s = r.getAttribute("height");
11677
+ return console.log("[ImageNode] Converting img element, src length:", e.length, "alt:", t), { node: Oa({
11678
11678
  src: e,
11679
11679
  altText: t,
11680
- width: n || void 0,
11681
- height: s || void 0
11680
+ width: n ? parseInt(n, 10) : void 0,
11681
+ height: s ? parseInt(s, 10) : void 0
11682
11682
  }) };
11683
11683
  }
11684
11684
  return null;
@@ -11738,7 +11738,8 @@ class Ss extends ma {
11738
11738
  return !1;
11739
11739
  }
11740
11740
  decorate() {
11741
- return /* @__PURE__ */ p.jsx(
11741
+ var t;
11742
+ return console.log("[ImageNode] decorate() called, src length:", (t = this.__src) == null ? void 0 : t.length, "alt:", this.__altText), /* @__PURE__ */ p.jsx(
11742
11743
  "img",
11743
11744
  {
11744
11745
  src: this.__src,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/stack",
3
- "version": "0.2.53",
3
+ "version": "0.2.55",
4
4
  "description": "Modern HyperCard for React - All-in-one data management (REST + Graph API + Auth + Hooks + UI)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",