@qwanyx/stack 0.2.19 → 0.2.20
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 +5 -5
- package/dist/index.esm.js +103 -105
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -41,7 +41,7 @@ ${s}
|
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var Li;function oa(){return Li||(Li=1,process.env.NODE_ENV!=="production"&&function(){var r=T,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),u=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,g="@@iterator";function _(m){if(m===null||typeof m!="object")return null;var B=p&&m[p]||m[g];return typeof B=="function"?B:null}var D=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(m){{for(var B=arguments.length,M=new Array(B>1?B-1:0),z=1;z<B;z++)M[z-1]=arguments[z];C("error",m,M)}}function C(m,B,M){{var z=D.ReactDebugCurrentFrame,Q=z.getStackAddendum();Q!==""&&(B+="%s",M=M.concat([Q]));var X=M.map(function(H){return String(H)});X.unshift("Warning: "+B),Function.prototype.apply.call(console[m],console,X)}}var x=!1,w=!1,b=!1,k=!1,A=!1,S;S=Symbol.for("react.module.reference");function O(m){return!!(typeof m=="string"||typeof m=="function"||m===n||m===o||A||m===s||m===a||m===c||k||m===h||x||w||b||typeof m=="object"&&m!==null&&(m.$$typeof===d||m.$$typeof===f||m.$$typeof===i||m.$$typeof===u||m.$$typeof===l||m.$$typeof===S||m.getModuleId!==void 0))}function L(m,B,M){var z=m.displayName;if(z)return z;var Q=B.displayName||B.name||"";return Q!==""?M+"("+Q+")":M}function W(m){return m.displayName||"Context"}function q(m){if(m==null)return null;if(typeof m.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case u:var B=m;return W(B)+".Consumer";case i:var M=m;return W(M._context)+".Provider";case l:return L(m,m.render,"ForwardRef");case f:var z=m.displayName||null;return z!==null?z:q(m.type)||"Memo";case d:{var Q=m,X=Q._payload,H=Q._init;try{return q(H(X))}catch{return null}}}return null}var I=Object.assign,V=0,re,Ee,
|
|
44
|
+
*/var Li;function oa(){return Li||(Li=1,process.env.NODE_ENV!=="production"&&function(){var r=T,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),u=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,g="@@iterator";function _(m){if(m===null||typeof m!="object")return null;var B=p&&m[p]||m[g];return typeof B=="function"?B:null}var D=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(m){{for(var B=arguments.length,M=new Array(B>1?B-1:0),z=1;z<B;z++)M[z-1]=arguments[z];C("error",m,M)}}function C(m,B,M){{var z=D.ReactDebugCurrentFrame,Q=z.getStackAddendum();Q!==""&&(B+="%s",M=M.concat([Q]));var X=M.map(function(H){return String(H)});X.unshift("Warning: "+B),Function.prototype.apply.call(console[m],console,X)}}var x=!1,w=!1,b=!1,k=!1,A=!1,S;S=Symbol.for("react.module.reference");function O(m){return!!(typeof m=="string"||typeof m=="function"||m===n||m===o||A||m===s||m===a||m===c||k||m===h||x||w||b||typeof m=="object"&&m!==null&&(m.$$typeof===d||m.$$typeof===f||m.$$typeof===i||m.$$typeof===u||m.$$typeof===l||m.$$typeof===S||m.getModuleId!==void 0))}function L(m,B,M){var z=m.displayName;if(z)return z;var Q=B.displayName||B.name||"";return Q!==""?M+"("+Q+")":M}function W(m){return m.displayName||"Context"}function q(m){if(m==null)return null;if(typeof m.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case u:var B=m;return W(B)+".Consumer";case i:var M=m;return W(M._context)+".Provider";case l:return L(m,m.render,"ForwardRef");case f:var z=m.displayName||null;return z!==null?z:q(m.type)||"Memo";case d:{var Q=m,X=Q._payload,H=Q._init;try{return q(H(X))}catch{return null}}}return null}var I=Object.assign,V=0,re,Ee,Me,_t,it,le,je;function Ie(){}Ie.__reactDisabledLog=!0;function ot(){{if(V===0){re=console.log,Ee=console.info,Me=console.warn,_t=console.error,it=console.group,le=console.groupCollapsed,je=console.groupEnd;var m={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:m,log:m,warn:m,error:m,group:m,groupCollapsed:m,groupEnd:m})}V++}}function ut(){{if(V--,V===0){var m={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},m,{value:re}),info:I({},m,{value:Ee}),warn:I({},m,{value:Me}),error:I({},m,{value:_t}),group:I({},m,{value:it}),groupCollapsed:I({},m,{value:le}),groupEnd:I({},m,{value:je})})}V<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _e=D.ReactCurrentDispatcher,Ye;function ke(m,B,M){{if(Ye===void 0)try{throw Error()}catch(Q){var z=Q.stack.trim().match(/\n( *(at )?)/);Ye=z&&z[1]||""}return`
|
|
45
45
|
`+Ye+m}}var $e=!1,Xe;{var Vn=typeof WeakMap=="function"?WeakMap:Map;Xe=new Vn}function Ur(m,B){if(!m||$e)return"";{var M=Xe.get(m);if(M!==void 0)return M}var z;$e=!0;var Q=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var X;X=_e.current,_e.current=null,ot();try{if(B){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(xe){z=xe}Reflect.construct(m,[],H)}else{try{H.call()}catch(xe){z=xe}m.call(H.prototype)}}else{try{throw Error()}catch(xe){z=xe}m()}}catch(xe){if(xe&&z&&typeof xe.stack=="string"){for(var K=xe.stack.split(`
|
|
46
46
|
`),pe=z.stack.split(`
|
|
47
47
|
`),se=K.length-1,ie=pe.length-1;se>=1&&ie>=0&&K[se]!==pe[ie];)ie--;for(;se>=1&&ie>=0;se--,ie--)if(K[se]!==pe[ie]){if(se!==1||ie!==1)do if(se--,ie--,ie<0||K[se]!==pe[ie]){var Te=`
|
|
@@ -58,9 +58,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
58
58
|
flex items-center gap-4 p-4 border-b border-gray-200
|
|
59
59
|
hover:bg-gray-50 transition-colors
|
|
60
60
|
${e?"cursor-pointer":""}
|
|
61
|
-
`,children:[l&&v.jsx("div",{className:"flex-shrink-0",children:v.jsx("img",{src:l,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),a&&v.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:a})]}),u&&v.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:u})]}),e&&v.jsx("div",{className:"flex-shrink-0 text-gray-400",children:v.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:v.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function aa({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return v.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:v.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[v.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[v.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&v.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:v.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:v.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),v.jsxs("div",{className:"p-6",children:[i&&v.jsx("div",{className:"mb-6",children:v.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&v.jsx("div",{className:"space-y-4",children:s.map((u,l)=>{const a=u.value(r);return a==null||a===""?null:v.jsxs("div",{children:[v.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:u.label}),v.jsx("div",{className:"text-base text-gray-900",children:typeof a=="object"?JSON.stringify(a,null,2):String(a)})]},l)})}),s.length===0&&v.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&v.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:v.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const ca={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function da({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const u=Math.min(Math.max(e,1),5),[l,a]=T.useState([]),[c,f]=T.useState([]),[d,h]=T.useState(Array(u).fill(!1)),[p,g]=T.useState(Array(u).fill(!1)),_=T.useRef([]),D=T.useCallback(b=>{const k=r.filter(S=>!b.includes(S._id));if(k.length===0)return null;const A=Math.floor(Math.random()*k.length);return k[A]},[r]),y=T.useCallback(()=>Math.random()*(n-t)+t,[t,n]);T.useEffect(()=>{if(r.length===0){a([]),f([]);return}const b=[],k=[],A=[];for(let S=0;S<u&&S<r.length;S++){const O=D(A);O&&(b.push(O),A.push(O._id))}for(let S=0;S<b.length;S++){const O=[b[S]._id,...b.filter((W,q)=>q!==S).map(W=>W._id)],L=D(O);L?k.push(L):k.push(b[S])}a(b),f(k)},[r,u,D]);const C=T.useCallback(b=>{const k=y(),A=setTimeout(()=>{h(S=>{const O=[...S];return O[b]=!O[b],O}),setTimeout(()=>{g(S=>{const O=[...S];return O[b]=!O[b],O}),setTimeout(()=>{const S=!p[b];S&&a(O=>{const L=[...O];return L[b]=c[b],L}),f(O=>{const L=[...O],q=[(S?c[b]:l[b])._id,...l.filter((V,re)=>re!==b).map(V=>V._id),...O.filter((V,re)=>re!==b).map(V=>V._id)],I=D(q);return I&&(L[b]=I),L}),setTimeout(()=>{C(b)},150)},200)},150)},k);_.current[b]=A},[y,D,l,c,p]),x=T.useRef(!1);T.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!x.current){x.current=!0;for(let b=0;b<l.length;b++)C(b);return()=>{_.current.forEach(b=>clearTimeout(b)),_.current=[],x.current=!1}}},[l.length,r.length]);const w=b=>{s&&s(b)};return r.length===0?v.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:v.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?v.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:v.jsx("p",{className:"text-gray-500",children:"Loading..."})}):v.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:l.map((b,k)=>{const A=c[k],S=p[k];return v.jsx("div",{className:`relative ${ca[o]}`,style:{perspective:"1000px"},onClick:()=>w(S?A:b),children:v.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${d[k]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[v.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:v.jsxs("div",{style:{transform:d[k]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[v.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),v.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:v.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),A&&v.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:v.jsxs("div",{style:{transform:d[k]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[v.jsx("img",{src:A.data.image,alt:A.title,className:"w-full h-full object-cover"}),v.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:v.jsx("p",{className:"text-white text-sm font-medium truncate",children:A.title})})]})})]})},`slot-${k}`)})})}function Gr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(u,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const fa={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function ha({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,emptyMessage:u="No emails",autoLoad:l=!0,onSelect:a,onSelectionChange:c,onDelete:f,onError:d,onLoad:h,renderItem:p,renderDetail:g,renderActions:_,renderEmpty:D,renderLoading:y,theme:C={}}){const x={...fa,...C},[w,b]=T.useState([]),[k,A]=T.useState(!1),[S,O]=T.useState(null),[L,W]=T.useState(new Set),[q,I]=T.useState(null),[V,re]=T.useState(null),[Ee,je]=T.useState(null),[_t,it]=T.useState(!1),le=T.useMemo(()=>e?new Go({baseUrl:r,system_id:e}):null,[r,e]),Ne=T.useCallback(async()=>{if(le){A(!0),O(null);try{const $=await le.listEmails(t,n,s);$!=null&&$.messages&&(b($.messages),h==null||h($.messages))}catch($){const U=$ instanceof Error?$:new Error("Failed to fetch emails");O(U.message),d==null||d(U)}A(!1)}},[le,t,n,s,d,h]);T.useEffect(()=>{l&&Ne()},[l,Ne]),T.useEffect(()=>{Ne()},[s]);const Ie=T.useCallback(async $=>{if(le){re($),je(null),it(!0);try{const U=await le.getEmailParsed(t,$.uid,s||"INBOX");U!=null&&U.body&&je(U.body)}catch(U){console.error("Failed to fetch email body:",U)}it(!1)}},[le,t,s]),ot=T.useCallback($=>{a==null||a($),i&&Ie($)},[a,i,Ie]),ut=T.useCallback(($,U,ne)=>{if(!o){a==null||a($),i&&Ie($);return}const Se=$.uid;if(ne.shiftKey&&q!==null){const Ce=Math.min(q,U),qe=Math.max(q,U),Qn=w.slice(Ce,qe+1).map(Kr=>Kr.uid),tr=new Set(Qn);W(tr),c==null||c(Array.from(tr))}else if(ne.ctrlKey||ne.metaKey)W(Ce=>{const qe=new Set(Ce);return qe.has(Se)?qe.delete(Se):qe.add(Se),c==null||c(Array.from(qe)),qe}),I(U);else{const Ce=new Set([Se]);W(Ce),I(U),c==null||c(Array.from(Ce))}},[o,q,w,L,a,c,i]),_e=T.useCallback(async()=>{if(!le||L.size===0)return;const $=s||"INBOX";try{const U=await le.trashEmails(t,Array.from(L),$);if(console.log("Trash result:",U),U.success&&U.moved>0){b(Se=>Se.filter(Ce=>!L.has(Ce.uid)));const ne=Array.from(L);W(new Set),f==null||f(ne)}else O("Failed to move emails to trash")}catch(U){const ne=U instanceof Error?U:new Error("Trash failed");console.error("Trash error:",ne),O(ne.message),d==null||d(ne)}},[le,t,L,s,f,d]),Ye=T.useCallback(async()=>{if(!le||L.size===0)return;const $=s||"INBOX";try{const U=await le.archiveEmails(t,Array.from(L),$);if(console.log("Archive result:",U),U.success&&U.archived>0){b(Se=>Se.filter(Ce=>!L.has(Ce.uid)));const ne=Array.from(L);W(new Set),f==null||f(ne)}else O("Failed to archive emails")}catch(U){const ne=U instanceof Error?U:new Error("Archive failed");console.error("Archive error:",ne),O(ne.message),d==null||d(ne)}},[le,t,L,s,f,d]),ke=T.useCallback(()=>{if(L.size===w.length)W(new Set),c==null||c([]);else{const $=new Set(w.map(U=>U.uid));W($),c==null||c(Array.from($))}},[w,L.size,c]),$e=T.useCallback(()=>{W(new Set),c==null||c([])},[c]),Xe={delete:_e,archive:Ye,refresh:Ne,selectAll:ke,clearSelection:$e},Vn=$=>{if(!$)return"";const U=new Date($),ne=new Date;return U.toDateString()===ne.toDateString()?U.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):U.toLocaleDateString([],{month:"short",day:"numeric"})},Ur=($,U)=>v.jsx("div",{style:{padding:"12px 16px",background:U?x.selectedBackground:$.seen?x.cardBackground:x.unreadBackground,borderBottom:`1px solid ${x.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:"14px",fontWeight:$.seen?400:600,color:x.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gr($.from).split("@")[0]}),v.jsx("div",{style:{fontSize:"14px",fontWeight:$.seen?400:500,color:$.seen?x.textSecondary:x.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gr($.subject)||"(No subject)"})]}),v.jsx("div",{style:{fontSize:"12px",color:x.textSecondary,flexShrink:0},children:Vn($.date)})]})}),Kn=$=>v.jsxs("div",{style:{padding:"24px"},children:[v.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:x.text},children:Gr($.subject)||"(No subject)"}),v.jsxs("div",{style:{fontSize:"14px",color:x.textSecondary,marginBottom:"16px"},children:["From: ",Gr($.from)," • ",new Date($.date).toLocaleString()]}),_t?v.jsx("div",{style:{fontSize:"14px",color:x.textSecondary},children:"Loading..."}):Ee?v.jsx("div",{style:{fontSize:"14px",color:x.text},dangerouslySetInnerHTML:{__html:Ee}}):v.jsx("div",{style:{fontSize:"14px",color:x.textSecondary},children:"No content available"})]}),Hn=($,U)=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:x.cardBackground,borderBottom:`1px solid ${x.border}`},children:[v.jsx("button",{onClick:U.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:x.text},children:$.length===w.length?"Deselect All":"Select All"}),$.length>0&&v.jsxs(v.Fragment,{children:[v.jsxs("span",{style:{fontSize:"13px",color:x.textSecondary},children:[$.length," selected"]}),v.jsx("button",{onClick:U.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),v.jsx("button",{onClick:U.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),v.jsx("div",{style:{flex:1}}),v.jsx("button",{onClick:U.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),Ot=()=>v.jsx("div",{style:{padding:"48px",textAlign:"center",color:x.textSecondary},children:u}),xt=()=>v.jsx("div",{style:{padding:"48px",textAlign:"center",color:x.textSecondary},children:"Loading..."}),Wr=p||Ur,Vr=g||Kn,Rt=_||Hn,Gn=D||Ot,Jn=y||xt;return k&&w.length===0?v.jsx("div",{style:{background:x.background,width:"100%",height:"100%"},children:Jn()}):v.jsxs("div",{style:{display:"flex",background:x.background,width:"100%",height:"100%"},children:[v.jsxs("div",{style:{flex:i&&V?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&V?`1px solid ${x.border}`:"none",overflow:"hidden"},children:[o&&Rt(Array.from(L),Xe),S&&v.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:x.danger,fontSize:"14px",borderBottom:`1px solid ${x.border}`},children:S}),v.jsx("div",{style:{flex:1,overflowY:"auto"},children:w.length===0?Gn():w.map(($,U)=>v.jsx("div",{onClick:ne=>ut($,U,ne),onDoubleClick:()=>ot($),children:Wr($,L.has($.uid))},$.uid))})]}),i&&V&&v.jsx("div",{style:{flex:1,overflowY:"auto"},children:Vr(V)})]})}function pa({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:u=!0,className:l=""}){const[a,c]=T.useState(new Set),[f,d]=T.useState(-1),h=r.filter(x=>a.has(x.id)),p=f>=0&&f<h.length?h[f]:null,g=T.useCallback(x=>{c(w=>{const b=new Set(w);return b.has(x)?b.delete(x):b.add(x),t==null||t(Array.from(b)),b})},[t]),_=T.useCallback(()=>{if(a.size===r.length)c(new Set),d(-1),t==null||t([]);else{const x=new Set(r.map(w=>w.id));c(x),r.length>0&&(d(0),n==null||n(r[0],0)),t==null||t(r.map(w=>w.id))}},[r,a.size,t,n]),D=T.useCallback(()=>{if(h.length===0)return;const x=f<=0?h.length-1:f-1;d(x),n==null||n(h[x],x)},[h,f,n]),y=T.useCallback(()=>{if(h.length===0)return;const x=f>=h.length-1?0:f+1;d(x),n==null||n(h[x],x)},[h,f,n]),C=T.useCallback(x=>{s==null||s(x,h,p)},[s,h,p]);return T.useEffect(()=>{h.length===0?d(-1):f>=h.length?d(h.length-1):f<0&&h.length>0&&(d(0),n==null||n(h[0],0))},[h.length,f,n]),r.length===0?v.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${l}`,children:i}):v.jsxs("div",{className:`space-y-2 ${l}`,children:[v.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[u&&v.jsxs("button",{onClick:_,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[v.jsx("span",{className:"material-icons text-sm",children:a.size===r.length?"check_box":a.size>0?"indeterminate_check_box":"check_box_outline_blank"}),v.jsx("span",{children:a.size===r.length?"Deselect all":"Select all"})]}),a.size>0&&v.jsxs("span",{className:"text-neutral-400",children:["(",a.size," selected)"]})]}),h.length>1&&v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("button",{onClick:D,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:v.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),v.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[f+1," / ",h.length]}),v.jsx("button",{onClick:y,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:v.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),v.jsx("div",{className:"space-y-1",children:r.map(x=>{const w=a.has(x.id),b=(p==null?void 0:p.id)===x.id;return v.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":w?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>g(x.id),children:[v.jsx("span",{className:`material-icons text-lg ${w?"text-blue-500":"text-neutral-300"}`,children:w?"check_box":"check_box_outline_blank"}),v.jsx("div",{className:"flex-1 min-w-0",children:e(x,w,b)})]},x.id)})}),o.length>0&&a.size>0&&v.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(x=>{var b;const w=((b=x.disabled)==null?void 0:b.call(x,h))??!1;return v.jsxs("button",{onClick:()=>C(x.id),disabled:w,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${w?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[x.icon&&v.jsx("span",{className:"material-icons text-sm",children:x.icon}),x.label]},x.id)})})]})}function ga(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ma=ga(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 Xo=T.createContext(null);function ya(r,e){return{getTheme:function(){return e??null}}}function Je(){const r=T.useContext(Xo);return r==null&&ma(8),r}function Br(r){return{}}const zs={},_a={},Zo={},wt={},Wt={},Cr={},Vt={},Tn={},xs={},wr={},Ar={},Oe={},Us={},Ws={},xa={},eu={},va={},tu={},ba={},ru={},nu={},an={},Da={},su={},iu={},ou={},Ca={},wa={},Aa={},Pi={},uu={},Ea={},lu={},au={},ka={},Bn={},Vs={},vs={},Sa={},Ta={},Jr={},Qr={},Ba={},Na={},Fa={},Me=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,La=Me&&"documentMode"in document?document.documentMode:null,Fe=Me&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),pt=Me&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),cn=!(!Me||!("InputEvent"in window)||La)&&"getTargetRanges"in new window.InputEvent("input"),Nn=Me&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Nr=Me&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pa=Me&&/Android/.test(navigator.userAgent),cu=Me&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Oa=Me&&Pa&&cu,Ks=Me&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!cu,Fr=1,mt=3,kt=0,du=1,Gt=2,Ra=0,Ma=1,ja=2,dn=4,fn=8,Hs=128,Ia=112|(3|dn|fn)|Hs,Gs=1,Js=2,Qs=3,Ys=4,Xs=5,Zs=6,Fn=Nn||Nr||Ks?" ":"",tt=`
|
|
61
|
+
`,children:[l&&v.jsx("div",{className:"flex-shrink-0",children:v.jsx("img",{src:l,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),a&&v.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:a})]}),u&&v.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:u})]}),e&&v.jsx("div",{className:"flex-shrink-0 text-gray-400",children:v.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:v.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function aa({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return v.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:v.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[v.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[v.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&v.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:v.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:v.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),v.jsxs("div",{className:"p-6",children:[i&&v.jsx("div",{className:"mb-6",children:v.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&v.jsx("div",{className:"space-y-4",children:s.map((u,l)=>{const a=u.value(r);return a==null||a===""?null:v.jsxs("div",{children:[v.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:u.label}),v.jsx("div",{className:"text-base text-gray-900",children:typeof a=="object"?JSON.stringify(a,null,2):String(a)})]},l)})}),s.length===0&&v.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&v.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:v.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const ca={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function da({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const u=Math.min(Math.max(e,1),5),[l,a]=T.useState([]),[c,f]=T.useState([]),[d,h]=T.useState(Array(u).fill(!1)),[p,g]=T.useState(Array(u).fill(!1)),_=T.useRef([]),D=T.useCallback(b=>{const k=r.filter(S=>!b.includes(S._id));if(k.length===0)return null;const A=Math.floor(Math.random()*k.length);return k[A]},[r]),y=T.useCallback(()=>Math.random()*(n-t)+t,[t,n]);T.useEffect(()=>{if(r.length===0){a([]),f([]);return}const b=[],k=[],A=[];for(let S=0;S<u&&S<r.length;S++){const O=D(A);O&&(b.push(O),A.push(O._id))}for(let S=0;S<b.length;S++){const O=[b[S]._id,...b.filter((W,q)=>q!==S).map(W=>W._id)],L=D(O);L?k.push(L):k.push(b[S])}a(b),f(k)},[r,u,D]);const C=T.useCallback(b=>{const k=y(),A=setTimeout(()=>{h(S=>{const O=[...S];return O[b]=!O[b],O}),setTimeout(()=>{g(S=>{const O=[...S];return O[b]=!O[b],O}),setTimeout(()=>{const S=!p[b];S&&a(O=>{const L=[...O];return L[b]=c[b],L}),f(O=>{const L=[...O],q=[(S?c[b]:l[b])._id,...l.filter((V,re)=>re!==b).map(V=>V._id),...O.filter((V,re)=>re!==b).map(V=>V._id)],I=D(q);return I&&(L[b]=I),L}),setTimeout(()=>{C(b)},150)},200)},150)},k);_.current[b]=A},[y,D,l,c,p]),x=T.useRef(!1);T.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!x.current){x.current=!0;for(let b=0;b<l.length;b++)C(b);return()=>{_.current.forEach(b=>clearTimeout(b)),_.current=[],x.current=!1}}},[l.length,r.length]);const w=b=>{s&&s(b)};return r.length===0?v.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:v.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?v.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:v.jsx("p",{className:"text-gray-500",children:"Loading..."})}):v.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:l.map((b,k)=>{const A=c[k],S=p[k];return v.jsx("div",{className:`relative ${ca[o]}`,style:{perspective:"1000px"},onClick:()=>w(S?A:b),children:v.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${d[k]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[v.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:v.jsxs("div",{style:{transform:d[k]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[v.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),v.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:v.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),A&&v.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:v.jsxs("div",{style:{transform:d[k]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[v.jsx("img",{src:A.data.image,alt:A.title,className:"w-full h-full object-cover"}),v.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:v.jsx("p",{className:"text-white text-sm font-medium truncate",children:A.title})})]})})]})},`slot-${k}`)})})}function Gr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(u,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const fa={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function ha({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,emptyMessage:u="No emails",autoLoad:l=!0,onSelect:a,onSelectionChange:c,onDelete:f,onError:d,onLoad:h,renderItem:p,renderDetail:g,renderActions:_,renderEmpty:D,renderLoading:y,theme:C={}}){const x={...fa,...C},[w,b]=T.useState([]),[k,A]=T.useState(!1),[S,O]=T.useState(null),[L,W]=T.useState(new Set),[q,I]=T.useState(null),[V,re]=T.useState(null),[Ee,Me]=T.useState(null),[_t,it]=T.useState(!1),le=T.useMemo(()=>e?new Go({baseUrl:r,system_id:e}):null,[r,e]),je=T.useCallback(async()=>{if(le){A(!0),O(null);try{const $=await le.listEmails(t,n,s);$!=null&&$.messages&&(b($.messages),h==null||h($.messages))}catch($){const U=$ instanceof Error?$:new Error("Failed to fetch emails");O(U.message),d==null||d(U)}A(!1)}},[le,t,n,s,d,h]);T.useEffect(()=>{l&&je()},[l,je]);const Ie=T.useCallback(async $=>{if(le){re($),Me(null),it(!0);try{const U=await le.getEmailParsed(t,$.uid,s||"INBOX");U!=null&&U.body&&Me(U.body)}catch(U){console.error("Failed to fetch email body:",U)}it(!1)}},[le,t,s]),ot=T.useCallback($=>{a==null||a($),i&&Ie($)},[a,i,Ie]),ut=T.useCallback(($,U,ne)=>{if(!o){a==null||a($),i&&Ie($);return}const Se=$.uid;if(ne.shiftKey&&q!==null){const Ce=Math.min(q,U),qe=Math.max(q,U),Qn=w.slice(Ce,qe+1).map(Kr=>Kr.uid),tr=new Set(Qn);W(tr),c==null||c(Array.from(tr))}else if(ne.ctrlKey||ne.metaKey)W(Ce=>{const qe=new Set(Ce);return qe.has(Se)?qe.delete(Se):qe.add(Se),c==null||c(Array.from(qe)),qe}),I(U);else{const Ce=new Set([Se]);W(Ce),I(U),c==null||c(Array.from(Ce))}},[o,q,w,L,a,c,i]),_e=T.useCallback(async()=>{if(!le||L.size===0)return;const $=s||"INBOX";try{const U=await le.trashEmails(t,Array.from(L),$);if(console.log("Trash result:",U),U.success&&U.moved>0){b(Se=>Se.filter(Ce=>!L.has(Ce.uid)));const ne=Array.from(L);W(new Set),f==null||f(ne)}else O("Failed to move emails to trash")}catch(U){const ne=U instanceof Error?U:new Error("Trash failed");console.error("Trash error:",ne),O(ne.message),d==null||d(ne)}},[le,t,L,s,f,d]),Ye=T.useCallback(async()=>{if(!le||L.size===0)return;const $=s||"INBOX";try{const U=await le.archiveEmails(t,Array.from(L),$);if(console.log("Archive result:",U),U.success&&U.archived>0){b(Se=>Se.filter(Ce=>!L.has(Ce.uid)));const ne=Array.from(L);W(new Set),f==null||f(ne)}else O("Failed to archive emails")}catch(U){const ne=U instanceof Error?U:new Error("Archive failed");console.error("Archive error:",ne),O(ne.message),d==null||d(ne)}},[le,t,L,s,f,d]),ke=T.useCallback(()=>{if(L.size===w.length)W(new Set),c==null||c([]);else{const $=new Set(w.map(U=>U.uid));W($),c==null||c(Array.from($))}},[w,L.size,c]),$e=T.useCallback(()=>{W(new Set),c==null||c([])},[c]),Xe={delete:_e,archive:Ye,refresh:je,selectAll:ke,clearSelection:$e},Vn=$=>{if(!$)return"";const U=new Date($),ne=new Date;return U.toDateString()===ne.toDateString()?U.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):U.toLocaleDateString([],{month:"short",day:"numeric"})},Ur=($,U)=>v.jsx("div",{style:{padding:"12px 16px",background:U?x.selectedBackground:$.seen?x.cardBackground:x.unreadBackground,borderBottom:`1px solid ${x.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:"14px",fontWeight:$.seen?400:600,color:x.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gr($.from).split("@")[0]}),v.jsx("div",{style:{fontSize:"14px",fontWeight:$.seen?400:500,color:$.seen?x.textSecondary:x.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gr($.subject)||"(No subject)"})]}),v.jsx("div",{style:{fontSize:"12px",color:x.textSecondary,flexShrink:0},children:Vn($.date)})]})}),Kn=$=>v.jsxs("div",{style:{padding:"24px"},children:[v.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:x.text},children:Gr($.subject)||"(No subject)"}),v.jsxs("div",{style:{fontSize:"14px",color:x.textSecondary,marginBottom:"16px"},children:["From: ",Gr($.from)," • ",new Date($.date).toLocaleString()]}),_t?v.jsx("div",{style:{fontSize:"14px",color:x.textSecondary},children:"Loading..."}):Ee?v.jsx("div",{style:{fontSize:"14px",color:x.text},dangerouslySetInnerHTML:{__html:Ee}}):v.jsx("div",{style:{fontSize:"14px",color:x.textSecondary},children:"No content available"})]}),Hn=($,U)=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:x.cardBackground,borderBottom:`1px solid ${x.border}`},children:[v.jsx("button",{onClick:U.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:x.text},children:$.length===w.length?"Deselect All":"Select All"}),$.length>0&&v.jsxs(v.Fragment,{children:[v.jsxs("span",{style:{fontSize:"13px",color:x.textSecondary},children:[$.length," selected"]}),v.jsx("button",{onClick:U.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),v.jsx("button",{onClick:U.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),v.jsx("div",{style:{flex:1}}),v.jsx("button",{onClick:U.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${x.border}`,borderRadius:"6px",cursor:"pointer",color:x.textSecondary},children:v.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),Ot=()=>v.jsx("div",{style:{padding:"48px",textAlign:"center",color:x.textSecondary},children:u}),xt=()=>v.jsx("div",{style:{padding:"48px",textAlign:"center",color:x.textSecondary},children:"Loading..."}),Wr=p||Ur,Vr=g||Kn,Rt=_||Hn,Gn=D||Ot,Jn=y||xt;return k&&w.length===0?v.jsx("div",{style:{background:x.background,width:"100%",height:"100%"},children:Jn()}):v.jsxs("div",{style:{display:"flex",background:x.background,width:"100%",height:"100%"},children:[v.jsxs("div",{style:{flex:i&&V?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&V?`1px solid ${x.border}`:"none",overflow:"hidden"},children:[o&&Rt(Array.from(L),Xe),S&&v.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:x.danger,fontSize:"14px",borderBottom:`1px solid ${x.border}`},children:S}),v.jsx("div",{style:{flex:1,overflowY:"auto"},children:w.length===0?Gn():w.map(($,U)=>v.jsx("div",{onClick:ne=>ut($,U,ne),onDoubleClick:()=>ot($),children:Wr($,L.has($.uid))},$.uid))})]}),i&&V&&v.jsx("div",{style:{flex:1,overflowY:"auto"},children:Vr(V)})]})}function pa({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:u=!0,className:l=""}){const[a,c]=T.useState(new Set),[f,d]=T.useState(-1),h=r.filter(x=>a.has(x.id)),p=f>=0&&f<h.length?h[f]:null,g=T.useCallback(x=>{c(w=>{const b=new Set(w);return b.has(x)?b.delete(x):b.add(x),t==null||t(Array.from(b)),b})},[t]),_=T.useCallback(()=>{if(a.size===r.length)c(new Set),d(-1),t==null||t([]);else{const x=new Set(r.map(w=>w.id));c(x),r.length>0&&(d(0),n==null||n(r[0],0)),t==null||t(r.map(w=>w.id))}},[r,a.size,t,n]),D=T.useCallback(()=>{if(h.length===0)return;const x=f<=0?h.length-1:f-1;d(x),n==null||n(h[x],x)},[h,f,n]),y=T.useCallback(()=>{if(h.length===0)return;const x=f>=h.length-1?0:f+1;d(x),n==null||n(h[x],x)},[h,f,n]),C=T.useCallback(x=>{s==null||s(x,h,p)},[s,h,p]);return T.useEffect(()=>{h.length===0?d(-1):f>=h.length?d(h.length-1):f<0&&h.length>0&&(d(0),n==null||n(h[0],0))},[h.length,f,n]),r.length===0?v.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${l}`,children:i}):v.jsxs("div",{className:`space-y-2 ${l}`,children:[v.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[u&&v.jsxs("button",{onClick:_,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[v.jsx("span",{className:"material-icons text-sm",children:a.size===r.length?"check_box":a.size>0?"indeterminate_check_box":"check_box_outline_blank"}),v.jsx("span",{children:a.size===r.length?"Deselect all":"Select all"})]}),a.size>0&&v.jsxs("span",{className:"text-neutral-400",children:["(",a.size," selected)"]})]}),h.length>1&&v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("button",{onClick:D,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:v.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),v.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[f+1," / ",h.length]}),v.jsx("button",{onClick:y,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:v.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),v.jsx("div",{className:"space-y-1",children:r.map(x=>{const w=a.has(x.id),b=(p==null?void 0:p.id)===x.id;return v.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":w?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>g(x.id),children:[v.jsx("span",{className:`material-icons text-lg ${w?"text-blue-500":"text-neutral-300"}`,children:w?"check_box":"check_box_outline_blank"}),v.jsx("div",{className:"flex-1 min-w-0",children:e(x,w,b)})]},x.id)})}),o.length>0&&a.size>0&&v.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(x=>{var b;const w=((b=x.disabled)==null?void 0:b.call(x,h))??!1;return v.jsxs("button",{onClick:()=>C(x.id),disabled:w,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${w?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[x.icon&&v.jsx("span",{className:"material-icons text-sm",children:x.icon}),x.label]},x.id)})})]})}function ga(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ma=ga(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 Xo=T.createContext(null);function ya(r,e){return{getTheme:function(){return e??null}}}function Je(){const r=T.useContext(Xo);return r==null&&ma(8),r}function Br(r){return{}}const zs={},_a={},Zo={},wt={},Wt={},Cr={},Vt={},Tn={},xs={},wr={},Ar={},Pe={},Us={},Ws={},xa={},eu={},va={},tu={},ba={},ru={},nu={},an={},Da={},su={},iu={},ou={},Ca={},wa={},Aa={},Pi={},uu={},Ea={},lu={},au={},ka={},Bn={},Vs={},vs={},Sa={},Ta={},Jr={},Qr={},Ba={},Na={},Fa={},Re=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,La=Re&&"documentMode"in document?document.documentMode:null,Ne=Re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),pt=Re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),cn=!(!Re||!("InputEvent"in window)||La)&&"getTargetRanges"in new window.InputEvent("input"),Nn=Re&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Nr=Re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pa=Re&&/Android/.test(navigator.userAgent),cu=Re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Oa=Re&&Pa&&cu,Ks=Re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!cu,Fr=1,mt=3,kt=0,du=1,Gt=2,Ra=0,Ma=1,ja=2,dn=4,fn=8,Hs=128,Ia=112|(3|dn|fn)|Hs,Gs=1,Js=2,Qs=3,Ys=4,Xs=5,Zs=6,Fn=Nn||Nr||Ks?" ":"",tt=`
|
|
62
62
|
|
|
63
|
-
`,$a=pt?" ":Fn,fu="֑-߿יִ-﷽ﹰ-ﻼ",hu="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",qa=new RegExp("^[^"+hu+"]*["+fu+"]"),za=new RegExp("^[^"+fu+"]*["+hu+"]"),St={bold:1,code:16,highlight:Hs,italic:2,strikethrough:dn,subscript:32,superscript:64,underline:fn},Ua={directionless:1,unmergeable:2},Oi={center:Js,end:Zs,justify:Ys,left:Gs,right:Qs,start:Xs},Wa={[Js]:"center",[Zs]:"end",[Ys]:"justify",[Gs]:"left",[Qs]:"right",[Xs]:"start"},Va={normal:0,segmented:2,token:1},Ka={[Ra]:"normal",[ja]:"segmented",[Ma]:"token"};function Ha(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var F=Ha(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 hn(...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}const Ga=100;let bs=!1,ei=0;function Ja(r){ei=r.timeStamp}function os(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&Pn(r,t)!==void 0}function Qa(r,e,t){const n=Be(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&ii(e,i,s,o,!1)}function Ya(r,e,t){if(N(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===mt&&t.isAttached()}function Xa(r,e,t,n){for(let s=r;s&&!dc(s);s=Pr(s)){const o=Pn(s,e);if(o!==void 0){const i=he(o,t);if(i)return Y(i)?void 0:[s,i]}else if(s===n)return[n,Du(t)]}}function pu(r,e,t){bs=!0;const n=performance.now()-ei>Ga;try{we(r,()=>{const s=j()||function(d){return d.getEditorState().read(()=>{const h=j();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),u=r._editorState,l=r._blockCursorElement;let a=!1,c="";for(let d=0;d<e.length;d++){const h=e[d],p=h.type,g=h.target,_=Xa(g,r,u,i);if(!_)continue;const[D,y]=_;if(p==="characterData")n&&P(y)&&Ya(s,g,y)&&Qa(g,y,r);else if(p==="childList"){a=!0;const C=h.addedNodes;for(let b=0;b<C.length;b++){const k=C[b],A=vu(k),S=k.parentNode;if(S!=null&&k!==l&&A===null&&!os(k,S,r)){if(pt){const O=k.innerText||k.nodeValue;O&&(c+=O)}S.removeChild(k)}}const x=h.removedNodes,w=x.length;if(w>0){let b=0;for(let k=0;k<w;k++){const A=x[k];(os(A,g,r)||l===A)&&(g.appendChild(A),b++)}w!==b&&o.set(D,y)}}}if(o.size>0)for(const[d,h]of o)h.reconcileObservedMutation(d,r);const f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const h=f[d],p=h.addedNodes,g=h.target;for(let _=0;_<p.length;_++){const D=p[_],y=D.parentNode;y==null||D.nodeName!=="BR"||os(D,g,r)||y.removeChild(D)}}t.takeRecords()}s!==null&&(a&&(s.dirty=!0,Ke(s)),pt&&Eu(r)&&s.insertRawText(c))})}finally{bs=!1}}function gu(r){const e=r._observer;e!==null&&pu(r,e.takeRecords(),e)}function mu(r){(function(e){ei===0&&Rn(e).addEventListener("textInput",Ja,!0)})(r),r._observer=new MutationObserver((e,t)=>{pu(r,e,t)})}function Ri(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,u=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==u)}function Mi(r,e){const t=r.mergeWithSibling(e),n=ee()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function ji(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&P(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ri(e,n)){n=Mi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&P(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ri(n,t)){n=Mi(n,t);break}break}t.remove()}}else n.remove()}function yu(r){return Ii(r.anchor),Ii(r.focus),r}function Ii(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),P(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!E(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Za=1;const ec=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function ti(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Y(Jt(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Ln(e)==null)}function Lr(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!ti(e)&&_u(e)===r}catch{return!1}}function ri(r){return r instanceof qn}function _u(r){let e=r;for(;e!=null;){const t=Ln(e);if(ri(t))return t;e=Pr(e)}return null}function Ln(r){return r?r.__lexicalEditor:null}function Dt(r){return r.isToken()||r.isSegmented()}function tc(r){return r.nodeType===mt}function pn(r){let e=r;for(;e!=null;){if(tc(e))return e;e=e.firstChild}return null}function gn(r,e,t){const n=St[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function xu(r){return P(r)||Et(r)||Y(r)}function rc(r,e){if(e!=null)return void(r.__key=e);ve(),Ku();const t=ee(),n=nt(),s=""+Za++;n._nodeMap.set(s,r),E(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=du,r.__key=s}function At(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const u=o.getWritable();u.__prev=i.__key,i.__next=u.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const u=s.getWritable();u.__next=i.__key,i.__prev=u.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function mn(r){Ku();const e=r.getLatest(),t=e.__parent,n=nt(),s=ee(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(l,a,c){let f=l;for(;f!==null;){if(c.has(f))return;const d=a.get(f);if(d===void 0)break;c.set(f,!1),f=d.__parent}}(t,o,i);const u=e.__key;s._dirtyType=du,E(r)?i.set(u,!0):s._dirtyLeaves.add(u)}function fe(r){ve();const e=ee(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=he(t);n!==null&&n.getWritable()}if(r!==null){const n=he(r);n!==null&&n.getWritable()}}}function dt(){return Ir()?null:ee()._compositionKey}function he(r,e){const t=(e||nt())._nodeMap.get(r);return t===void 0?null:t}function vu(r,e){const t=Pn(r,ee());return t!==void 0?he(t,e):null}function Pn(r,e){return r[`__lexicalKey_${e._key}`]}function Jt(r,e){let t=r;for(;t!=null;){const n=vu(t,e);if(n!==null)return n;t=Pr(t)}return null}function bu(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function $i(r){return r.read(()=>te().getTextContent())}function te(){return Du(nt())}function Du(r){return r._nodeMap.get("root")}function Ke(r){ve();const e=nt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function zt(r){const e=ee(),t=function(n,s){let o=n;for(;o!=null;){const i=Pn(o,s);if(i!==void 0)return i;o=Pr(o)}return null}(r,e);return t===null?r===e.getRootElement()?he("root"):null:he(t)}function qi(r,e){return e?r.getTextContentSize():0}function Cu(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ni(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function wu(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Au(r){return r.nodeType===mt?r.nodeValue:null}function si(r,e,t){const n=Be(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let u=Au(s);const l=Jt(s);if(u!==null&&P(l)){if(u===Fn&&t){const a=t.length;u=t,o=a,i=a}u!==null&&ii(l,u,o,i,r)}}}function ii(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let u=e;(i||s)&&e[e.length-1]===Fn&&(u=e.slice(0,-1));const l=o.getTextContent();if(s||u!==l){if(u===""){if(fe(null),Nn||Nr||Ks)o.remove();else{const g=ee();setTimeout(()=>{g.update(()=>{o.isAttached()&&o.remove()})},20)}return}const a=o.getParent(),c=jr(),f=o.getTextContentSize(),d=dt(),h=o.getKey();if(o.isToken()||d!==null&&h===d&&!i||N(c)&&(a!==null&&!a.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===f&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const p=j();if(!N(p)||t===null||n===null)return void o.setTextContent(u);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const g=ae(o.getTextContent());o.replace(g),o=g}o.setTextContent(u)}}}function nc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return(P(i)||E(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function zi(r){return r==="ArrowLeft"}function Ui(r){return r==="ArrowRight"}function dr(r,e){return Fe?r:e}function Wi(r){return r==="Enter"}function ir(r){return r==="Backspace"}function or(r){return r==="Delete"}function Vi(r,e,t){return r.toLowerCase()==="a"&&dr(e,t)}function sc(){const r=te();Ke(yu(r.select(0,r.getChildrenSize())))}function yr(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const o=hn(s);return t[e]=o,o}return s}function oi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,u=e.get(o);u===void 0&&F(33,o);const l=u.klass;let a=r.get(l);a===void 0&&(a=new Map,r.set(l,a));const c=a.get(i),f=c==="destroyed"&&s==="created";(c===void 0||f)&&a.set(i,f?"updated":s)}function Ki(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function Er(r,e){const t=r.offset;if(r.type==="element")return Ki(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?Ki(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Eu(r){const e=Rn(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(r,e,t){return Ju(r,e,t)}function On(r){return!me(r)&&!r.isLastChild()&&!r.isInline()}function yn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&F(75,e),t}function Pr(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function _r(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Rn(r){const e=r._window;return e===null&&F(78),e}function ic(r){let e=r.getParentOrThrow();for(;e!==null;){if(He(e))return e;e=e.getParentOrThrow()}return e}function He(r){return me(r)||E(r)&&r.isShadowRoot()}function Qe(r){const e=ee(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&F(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),u=i.constructor;return o!==null?i instanceof o||F(201,o.name,o.getType(),u.name,u.getType(),r.constructor.name,t):i instanceof r.constructor&&u!==r.constructor||F(202,u.name,u.getType(),r.constructor.name,t),i.__key===r.__key&&F(203,r.constructor.name,t,u.name,u.getType()),i}return r}function us(r,e){!me(r.getParent())||E(e)||Y(e)||F(99)}function ls(r){return(Y(r)||E(r)&&!r.canBeEmpty())&&!r.isInline()}function ui(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function oc(r,e,t){let n=r._blockCursorElement;if(N(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let u=!1,l=null;if(i===o.getChildrenSize())ls(o.getChildAtIndex(i-1))&&(u=!0);else{const a=o.getChildAtIndex(i);if(a!==null&&ls(a)){const c=a.getPreviousSibling();(c===null||ls(c))&&(u=!0,l=r.getElementByKey(a.__key))}}if(u){const a=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const f=c.theme,d=document.createElement("div");d.contentEditable="false",d.setAttribute("data-lexical-cursor","true");let h=f.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=hn(h);h=f.blockCursor=p}h!==void 0&&d.classList.add(...h)}return d}(r._config)),e.style.caretColor="transparent",void(l===null?a.appendChild(n):a.insertBefore(n,l))}}n!==null&&ui(n,r,e)}function Be(r){return Me?(r||window).getSelection():null}function uc(r){return rt(r)&&r.tagName==="A"}function rt(r){return r.nodeType===1}function Hi(r){return r.nodeType===11}function Ds(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function _n(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function at(r){if(Y(r)&&!r.isInline())return!0;if(!E(r)||He(r))return!1;const e=r.getFirstChild(),t=e===null||Et(e)||P(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function ur(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function lc(){return ee()}const Gi=new WeakMap,ac=new Map;function cc(r){if(!r._readOnly&&r.isEmpty())return ac;r._readOnly||F(192);let e=Gi.get(r);if(!e){e=new Map,Gi.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function li(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function ai(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function dc(r){return r.__lexicalUnmanaged===!0}function ku(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const u=i.__key;i.__parent===e&&(E(i)&&ku(i,u,t,n,s,o),t.has(u)||o.delete(u),s.push(u)),i=i.getNextSibling()}}let gt,ye,kr,Mn,Cs,ws,Tt,Re,As,Sr,oe="",ge="",ze=null,Le="",et="",Su=!1,Tr=!1,sn=null;function xn(r,e){const t=Tt.get(r);if(e!==null){const n=Ss(r);n.parentNode===e&&e.removeChild(n)}if(Re.has(r)||ye._keyToDOMMap.delete(r),E(t)){const n=bn(t,Tt);Es(n,0,n.length-1,null)}t!==void 0&&oi(Sr,kr,Mn,t,"destroyed")}function Es(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&xn(o,n)}}function bt(r,e){r.setProperty("text-align",e)}const fc="40px";function Tu(r,e){const t=gt.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||fc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Bu(r,e){const t=r.style;e===0?bt(t,""):e===Gs?bt(t,"left"):e===Js?bt(t,"center"):e===Qs?bt(t,"right"):e===Ys?bt(t,"justify"):e===Xs?bt(t,"start"):e===Zs&&bt(t,"end")}function vn(r,e){const t=Re.get(r);t===void 0&&F(60);const n=t.createDOM(gt,ye);if(function(s,o,i){const u=i._keyToDOMMap;(function(l,a,c){l[`__lexicalKey_${a._key}`]=c})(o,i,s),u.set(s,o)}(r,n,ye),P(t)?n.setAttribute("data-lexical-text","true"):Y(t)&&n.setAttribute("data-lexical-decorator","true"),E(t)){const s=t.__indent,o=t.__size;if(s!==0&&Tu(n,s),o!==0){const u=o-1;(function(l,a,c,f){const d=ge;ge="",ks(l,c,0,a,c.getDOMSlot(f)),Fu(c,f),ge=d})(bn(t,Re),u,t,n)}const i=t.__format;i!==0&&Bu(n,i),t.isInline()||Nu(null,t,n),On(t)&&(oe+=tt,et+=tt)}else{const s=t.getTextContent();if(Y(t)){const o=t.decorate(ye,gt);o!==null&&Lu(r,o),n.contentEditable="false"}else P(t)&&(t.isDirectionless()||(ge+=s));oe+=s,et+=s}return e!==null&&e.insertChild(n),oi(Sr,kr,Mn,t,"created"),n}function ks(r,e,t,n,s){const o=oe;oe="";let i=t;for(;i<=n;++i){vn(r[i],s);const u=Re.get(r[i]);u!==null&&P(u)&&(ze===null&&(ze=u.getFormat()),Le===""&&(Le=u.getStyle()))}On(e)&&(oe+=tt),s.element.__lexicalTextContent=oe,oe=o+oe}function Ji(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return Et(n)?"line-break":Y(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Nu(r,e,t){const n=Ji(r,Tt),s=Ji(e,Re);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Fu(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==ge||n!==sn){const o=ge==="",i=o?sn:(s=ge,qa.test(s)?"rtl":za.test(s)?"ltr":null);if(i!==n){const u=e.classList,l=gt.theme;let a=n!==null?l[n]:void 0,c=i!==null?l[i]:void 0;if(a!==void 0){if(typeof a=="string"){const f=hn(a);a=l[n]=f}u.remove(...a)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const f=hn(c);c=l[i]=f}c!==void 0&&u.add(...c)}e.dir=i}Tr||(r.getWritable().__dir=i)}sn=i,e.__lexicalDirTextContent=ge,e.__lexicalDir=i}var s}function hc(r,e,t){const n=ge;var s;ge="",ze=null,Le="",function(o,i,u){const l=oe,a=o.__size,c=i.__size;oe="";const f=u.element;if(a===1&&c===1){const d=o.__first,h=i.__first;if(d===h)fr(d,f);else{const g=Ss(d),_=vn(h,null);try{f.replaceChild(_,g)}catch(D){if(typeof D=="object"&&D!=null){const y=`${D.toString()} Parent: ${f.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(y)}throw D}xn(d,null)}const p=Re.get(h);P(p)&&(ze===null&&(ze=p.getFormat()),Le===""&&(Le=p.getStyle()))}else{const d=bn(o,Tt),h=bn(i,Re);if(d.length!==a&&F(227),h.length!==c&&F(228),a===0)c!==0&&ks(h,i,0,c-1,u);else if(c===0){if(a!==0){const p=u.after==null&&u.before==null&&u.element.__lexicalLineBreak==null;Es(d,0,a-1,p?null:f),p&&(f.textContent="")}}else(function(p,g,_,D,y,C){const x=D-1,w=y-1;let b,k,A=C.getFirstChild(),S=0,O=0;for(;S<=x&&O<=w;){const q=g[S],I=_[O];if(q===I)A=as(fr(I,C.element)),S++,O++;else{b===void 0&&(b=new Set(g)),k===void 0&&(k=new Set(_));const re=k.has(q),Ee=b.has(I);if(re)if(Ee){const je=yn(ye,I);je===A?A=as(fr(I,C.element)):(C.withBefore(A).insertChild(je),fr(I,C.element)),S++,O++}else vn(I,C.withBefore(A)),O++;else A=as(Ss(q)),xn(q,C.element),S++}const V=Re.get(I);V!==null&&P(V)&&(ze===null&&(ze=V.getFormat()),Le===""&&(Le=V.getStyle()))}const L=S>x,W=O>w;if(L&&!W){const q=_[w+1],I=q===void 0?null:ye.getElementByKey(q);ks(_,p,O,w,C.withBefore(I))}else W&&!L&&Es(g,S,x,C.element)})(i,d,h,a,c,u)}On(i)&&(oe+=tt),f.__lexicalTextContent=oe,oe=l+oe}(r,e,e.getDOMSlot(t)),Fu(e,t),Qt(s=e)&&ze!=null&&ze!==s.__textFormat&&!Tr&&(s.setTextFormat(ze),s.setTextStyle(Le)),function(o){Qt(o)&&Le!==""&&Le!==o.__textStyle&&!Tr&&o.setTextStyle(Le)}(e),ge=n}function bn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&F(101),t.push(n),n=s.__next}return t}function fr(r,e){const t=Tt.get(r);let n=Re.get(r);t!==void 0&&n!==void 0||F(61);const s=Su||ws.has(r)||Cs.has(r),o=yn(ye,r);if(t===n&&!s){if(E(t)){const i=o.__lexicalTextContent;i!==void 0&&(oe+=i,et+=i);const u=o.__lexicalDirTextContent;u!==void 0&&(ge+=u)}else{const i=t.getTextContent();P(t)&&!t.isDirectionless()&&(ge+=i),et+=i,oe+=i}return o}if(t!==n&&s&&oi(Sr,kr,Mn,n,"updated"),n.updateDOM(t,o,gt)){const i=vn(r,null);return e===null&&F(62),e.replaceChild(i,o),xn(r,null),i}if(E(t)&&E(n)){const i=n.__indent;i!==t.__indent&&Tu(o,i);const u=n.__format;u!==t.__format&&Bu(o,u),s&&(hc(t,n,o),me(n)||n.isInline()||Nu(t,n,o)),On(n)&&(oe+=tt,et+=tt)}else{const i=n.getTextContent();if(Y(n)){const u=n.decorate(ye,gt);u!==null&&Lu(r,u)}else P(n)&&!n.isDirectionless()&&(ge+=i);oe+=i,et+=i}if(!Tr&&me(n)&&n.__cachedText!==et){const i=n.getWritable();i.__cachedText=et,n=i}return o}function Lu(r,e){let t=ye._pendingDecorators;const n=ye._decorators;if(t===null){if(n[r]===e)return;t=bu(ye)}t[r]=e}function as(r){let e=r.nextSibling;return e!==null&&e===ye._blockCursorElement&&(e=e.nextSibling),e}function pc(r,e,t,n,s,o){oe="",et="",ge="",Su=n===Gt,sn=null,ye=t,gt=t._config,kr=t._nodes,Mn=ye._listeners.mutation,Cs=s,ws=o,Tt=r._nodeMap,Re=e._nodeMap,Tr=e._readOnly,As=new Map(t._keyToDOMMap);const i=new Map;return Sr=i,fr("root",null),ye=void 0,kr=void 0,Cs=void 0,ws=void 0,Tt=void 0,Re=void 0,gt=void 0,As=void 0,Sr=void 0,i}function Ss(r){const e=As.get(r);return e===void 0&&F(75,r),e}const Ze=Object.freeze({}),Ts=30,Bs=[["keydown",function(r,e){if(xr=r.timeStamp,Pu=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!R(e,xa,r)&&t!=null){if(function(u,l,a,c){return Ui(u)&&!l&&!c&&!a}(t,s,i,o))R(e,eu,r);else if(function(u,l,a,c,f){return Ui(u)&&!c&&!a&&(l||f)}(t,s,n,i,o))R(e,va,r);else if(function(u,l,a,c){return zi(u)&&!l&&!c&&!a}(t,s,i,o))R(e,tu,r);else if(function(u,l,a,c,f){return zi(u)&&!c&&!a&&(l||f)}(t,s,n,i,o))R(e,ba,r);else if(function(u,l,a){return function(c){return c==="ArrowUp"}(u)&&!l&&!a}(t,s,o))R(e,ru,r);else if(function(u,l,a){return function(c){return c==="ArrowDown"}(u)&&!l&&!a}(t,s,o))R(e,nu,r);else if(function(u,l){return Wi(u)&&l}(t,n))vr=!0,R(e,an,r);else if(function(u){return u===" "}(t))R(e,Da,r);else if(function(u,l){return Fe&&l&&u.toLowerCase()==="o"}(t,s))r.preventDefault(),vr=!0,R(e,Wt,!0);else if(function(u,l){return Wi(u)&&!l}(t,n))vr=!1,R(e,an,r);else if(function(u,l,a,c){return Fe?!l&&!a&&(ir(u)||u.toLowerCase()==="h"&&c):!(c||l||a)&&ir(u)}(t,i,o,s))ir(t)?R(e,su,r):(r.preventDefault(),R(e,wt,!0));else if(function(u){return u==="Escape"}(t))R(e,iu,r);else if(function(u,l,a,c,f){return Fe?!(a||c||f)&&(or(u)||u.toLowerCase()==="d"&&l):!(l||c||f)&&or(u)}(t,s,n,i,o))or(t)?R(e,ou,r):(r.preventDefault(),R(e,wt,!1));else if(function(u,l,a){return ir(u)&&(Fe?l:a)}(t,i,s))r.preventDefault(),R(e,wr,!0);else if(function(u,l,a){return or(u)&&(Fe?l:a)}(t,i,s))r.preventDefault(),R(e,wr,!1);else if(function(u,l){return Fe&&l&&ir(u)}(t,o))r.preventDefault(),R(e,Ar,!0);else if(function(u,l){return Fe&&l&&or(u)}(t,o))r.preventDefault(),R(e,Ar,!1);else if(function(u,l,a,c){return u.toLowerCase()==="b"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Oe,"bold");else if(function(u,l,a,c){return u.toLowerCase()==="u"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Oe,"underline");else if(function(u,l,a,c){return u.toLowerCase()==="i"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Oe,"italic");else if(function(u,l,a,c){return u==="Tab"&&!l&&!a&&!c}(t,i,s,o))R(e,Ca,r);else if(function(u,l,a,c){return u.toLowerCase()==="z"&&!l&&dr(a,c)}(t,n,o,s))r.preventDefault(),R(e,Us,void 0);else if(function(u,l,a,c){return Fe?u.toLowerCase()==="z"&&a&&l:u.toLowerCase()==="y"&&c||u.toLowerCase()==="z"&&c&&l}(t,n,o,s))r.preventDefault(),R(e,Ws,void 0);else{const u=e._editorState._selection;u===null||N(u)?!pt&&Vi(t,o,s)&&(r.preventDefault(),R(e,vs,r)):function(l,a,c,f){return!a&&l.toLowerCase()==="c"&&(Fe?c:f)}(t,n,o,s)?(r.preventDefault(),R(e,Bn,r)):function(l,a,c,f){return!a&&l.toLowerCase()==="x"&&(Fe?c:f)}(t,n,o,s)?(r.preventDefault(),R(e,Vs,r)):Vi(t,o,s)&&(r.preventDefault(),R(e,vs,r))}(function(u,l,a,c){return u||l||a||c})(s,n,i,o)&&R(e,Fa,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&we(e,()=>{Y(Jt(t))||(Fs=!0)})}],["compositionstart",function(r,e){we(e,()=>{const t=j();if(N(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();fe(n.key),(r.timeStamp<xr+Ts||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||P(s)&&s.getStyle()!==t.style)&&R(e,Vt,$a)}})}],["compositionend",function(r,e){pt?lr=!0:we(e,()=>{cs(e,r.data)})}],["input",function(r,e){r.stopPropagation(),we(e,()=>{const t=j(),n=r.data,s=ju(r);if(n!=null&&N(t)&&Mu(t,s,n,r.timeStamp,!1)){lr&&(cs(e,n),lr=!1);const o=t.anchor.getNode(),i=Be(e._window);if(i===null)return;const u=t.isBackward(),l=u?t.anchor.offset:t.focus.offset,a=u?t.focus.offset:t.anchor.offset;cn&&!t.isCollapsed()&&P(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,l)+n+o.getTextContent().slice(l+a)===Au(i.anchorNode)||R(e,Vt,n);const c=n.length;pt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),Nn||Nr||Ks||!e.isComposing()||(xr=0,fe(null))}else si(!1,e,n!==null?n:void 0),lr&&(cs(e,n||void 0),lr=!1);ve(),gu(ee())}),qt=null}],["click",function(r,e){we(e,()=>{const t=j(),n=Be(e._window),s=jr();if(n){if(N(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!me(i)&&te().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(E(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===Fr||i===mt)&&Ke(di(s,n,e,r))}}}R(e,Zo,r)})}],["cut",Ze],["copy",Ze],["dragstart",Ze],["dragover",Ze],["dragend",Ze],["paste",Ze],["focus",Ze],["blur",Ze],["drop",Ze]];cn&&Bs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=ju(t);s==="deleteCompositionText"||pt&&Eu(n)||s!=="insertCompositionText"&&we(n,()=>{const i=j();if(s==="deleteContentBackward"){if(i===null){const h=jr();if(!N(h))return;Ke(h.clone())}if(N(i)){const h=i.anchor.key===i.focus.key;if(u=t.timeStamp,Pu==="MediaLast"&&u<xr+Ts&&n.isComposing()&&h){if(fe(null),xr=0,setTimeout(()=>{we(n,()=>{fe(null)})},Ts),N(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),P(p)||F(142),i.style=p.getStyle()}}else{fe(null),t.preventDefault();const p=i.anchor.getNode(),g=p.getTextContent(),_=p.canInsertTextAfter(),D=i.anchor.offset===0&&i.focus.offset===g.length;Oa&&h&&!D&&_||R(n,wt,!0)}return}}var u;if(!N(i))return;const l=t.data;qt!==null&&si(!1,n,qt),i.dirty&&qt===null||!i.isCollapsed()||me(i.anchor.getNode())||o===null||i.applyDOMRange(o),qt=null;const a=i.anchor,c=i.focus,f=a.getNode(),d=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(n,Vt,t);break;case"insertFromComposition":fe(null),R(n,Vt,t);break;case"insertLineBreak":fe(null),R(n,Wt,!1);break;case"insertParagraph":fe(null),vr&&!Nr?(vr=!1,R(n,Wt,!1)):R(n,Cr,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(n,Tn,t);break;case"deleteByComposition":(function(h,p){return h!==p||E(h)||E(p)||!h.isToken()||!p.isToken()})(f,d)&&R(n,xs,t);break;case"deleteByDrag":case"deleteByCut":R(n,xs,t);break;case"deleteContent":R(n,wt,!1);break;case"deleteWordBackward":R(n,wr,!0);break;case"deleteWordForward":R(n,wr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(n,Ar,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(n,Ar,!1);break;case"formatStrikeThrough":R(n,Oe,"strikethrough");break;case"formatBold":R(n,Oe,"bold");break;case"formatItalic":R(n,Oe,"italic");break;case"formatUnderline":R(n,Oe,"underline");break;case"historyUndo":R(n,Us,void 0);break;case"historyRedo":R(n,Ws,void 0)}else{if(l===`
|
|
63
|
+
`,$a=pt?" ":Fn,fu="֑-߿יִ-﷽ﹰ-ﻼ",hu="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",qa=new RegExp("^[^"+hu+"]*["+fu+"]"),za=new RegExp("^[^"+fu+"]*["+hu+"]"),St={bold:1,code:16,highlight:Hs,italic:2,strikethrough:dn,subscript:32,superscript:64,underline:fn},Ua={directionless:1,unmergeable:2},Oi={center:Js,end:Zs,justify:Ys,left:Gs,right:Qs,start:Xs},Wa={[Js]:"center",[Zs]:"end",[Ys]:"justify",[Gs]:"left",[Qs]:"right",[Xs]:"start"},Va={normal:0,segmented:2,token:1},Ka={[Ra]:"normal",[ja]:"segmented",[Ma]:"token"};function Ha(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var F=Ha(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 hn(...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}const Ga=100;let bs=!1,ei=0;function Ja(r){ei=r.timeStamp}function os(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&Pn(r,t)!==void 0}function Qa(r,e,t){const n=Be(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&ii(e,i,s,o,!1)}function Ya(r,e,t){if(N(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===mt&&t.isAttached()}function Xa(r,e,t,n){for(let s=r;s&&!dc(s);s=Pr(s)){const o=Pn(s,e);if(o!==void 0){const i=he(o,t);if(i)return Y(i)?void 0:[s,i]}else if(s===n)return[n,Du(t)]}}function pu(r,e,t){bs=!0;const n=performance.now()-ei>Ga;try{we(r,()=>{const s=j()||function(d){return d.getEditorState().read(()=>{const h=j();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),u=r._editorState,l=r._blockCursorElement;let a=!1,c="";for(let d=0;d<e.length;d++){const h=e[d],p=h.type,g=h.target,_=Xa(g,r,u,i);if(!_)continue;const[D,y]=_;if(p==="characterData")n&&P(y)&&Ya(s,g,y)&&Qa(g,y,r);else if(p==="childList"){a=!0;const C=h.addedNodes;for(let b=0;b<C.length;b++){const k=C[b],A=vu(k),S=k.parentNode;if(S!=null&&k!==l&&A===null&&!os(k,S,r)){if(pt){const O=k.innerText||k.nodeValue;O&&(c+=O)}S.removeChild(k)}}const x=h.removedNodes,w=x.length;if(w>0){let b=0;for(let k=0;k<w;k++){const A=x[k];(os(A,g,r)||l===A)&&(g.appendChild(A),b++)}w!==b&&o.set(D,y)}}}if(o.size>0)for(const[d,h]of o)h.reconcileObservedMutation(d,r);const f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const h=f[d],p=h.addedNodes,g=h.target;for(let _=0;_<p.length;_++){const D=p[_],y=D.parentNode;y==null||D.nodeName!=="BR"||os(D,g,r)||y.removeChild(D)}}t.takeRecords()}s!==null&&(a&&(s.dirty=!0,Ke(s)),pt&&Eu(r)&&s.insertRawText(c))})}finally{bs=!1}}function gu(r){const e=r._observer;e!==null&&pu(r,e.takeRecords(),e)}function mu(r){(function(e){ei===0&&Rn(e).addEventListener("textInput",Ja,!0)})(r),r._observer=new MutationObserver((e,t)=>{pu(r,e,t)})}function Ri(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,u=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==u)}function Mi(r,e){const t=r.mergeWithSibling(e),n=ee()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function ji(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&P(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ri(e,n)){n=Mi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&P(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ri(n,t)){n=Mi(n,t);break}break}t.remove()}}else n.remove()}function yu(r){return Ii(r.anchor),Ii(r.focus),r}function Ii(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),P(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!E(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Za=1;const ec=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function ti(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Y(Jt(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Ln(e)==null)}function Lr(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!ti(e)&&_u(e)===r}catch{return!1}}function ri(r){return r instanceof qn}function _u(r){let e=r;for(;e!=null;){const t=Ln(e);if(ri(t))return t;e=Pr(e)}return null}function Ln(r){return r?r.__lexicalEditor:null}function Dt(r){return r.isToken()||r.isSegmented()}function tc(r){return r.nodeType===mt}function pn(r){let e=r;for(;e!=null;){if(tc(e))return e;e=e.firstChild}return null}function gn(r,e,t){const n=St[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function xu(r){return P(r)||Et(r)||Y(r)}function rc(r,e){if(e!=null)return void(r.__key=e);ve(),Ku();const t=ee(),n=nt(),s=""+Za++;n._nodeMap.set(s,r),E(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=du,r.__key=s}function At(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const u=o.getWritable();u.__prev=i.__key,i.__next=u.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const u=s.getWritable();u.__next=i.__key,i.__prev=u.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function mn(r){Ku();const e=r.getLatest(),t=e.__parent,n=nt(),s=ee(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(l,a,c){let f=l;for(;f!==null;){if(c.has(f))return;const d=a.get(f);if(d===void 0)break;c.set(f,!1),f=d.__parent}}(t,o,i);const u=e.__key;s._dirtyType=du,E(r)?i.set(u,!0):s._dirtyLeaves.add(u)}function fe(r){ve();const e=ee(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=he(t);n!==null&&n.getWritable()}if(r!==null){const n=he(r);n!==null&&n.getWritable()}}}function dt(){return Ir()?null:ee()._compositionKey}function he(r,e){const t=(e||nt())._nodeMap.get(r);return t===void 0?null:t}function vu(r,e){const t=Pn(r,ee());return t!==void 0?he(t,e):null}function Pn(r,e){return r[`__lexicalKey_${e._key}`]}function Jt(r,e){let t=r;for(;t!=null;){const n=vu(t,e);if(n!==null)return n;t=Pr(t)}return null}function bu(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function $i(r){return r.read(()=>te().getTextContent())}function te(){return Du(nt())}function Du(r){return r._nodeMap.get("root")}function Ke(r){ve();const e=nt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function zt(r){const e=ee(),t=function(n,s){let o=n;for(;o!=null;){const i=Pn(o,s);if(i!==void 0)return i;o=Pr(o)}return null}(r,e);return t===null?r===e.getRootElement()?he("root"):null:he(t)}function qi(r,e){return e?r.getTextContentSize():0}function Cu(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ni(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function wu(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Au(r){return r.nodeType===mt?r.nodeValue:null}function si(r,e,t){const n=Be(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let u=Au(s);const l=Jt(s);if(u!==null&&P(l)){if(u===Fn&&t){const a=t.length;u=t,o=a,i=a}u!==null&&ii(l,u,o,i,r)}}}function ii(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let u=e;(i||s)&&e[e.length-1]===Fn&&(u=e.slice(0,-1));const l=o.getTextContent();if(s||u!==l){if(u===""){if(fe(null),Nn||Nr||Ks)o.remove();else{const g=ee();setTimeout(()=>{g.update(()=>{o.isAttached()&&o.remove()})},20)}return}const a=o.getParent(),c=jr(),f=o.getTextContentSize(),d=dt(),h=o.getKey();if(o.isToken()||d!==null&&h===d&&!i||N(c)&&(a!==null&&!a.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===f&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const p=j();if(!N(p)||t===null||n===null)return void o.setTextContent(u);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const g=ae(o.getTextContent());o.replace(g),o=g}o.setTextContent(u)}}}function nc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return(P(i)||E(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function zi(r){return r==="ArrowLeft"}function Ui(r){return r==="ArrowRight"}function dr(r,e){return Ne?r:e}function Wi(r){return r==="Enter"}function ir(r){return r==="Backspace"}function or(r){return r==="Delete"}function Vi(r,e,t){return r.toLowerCase()==="a"&&dr(e,t)}function sc(){const r=te();Ke(yu(r.select(0,r.getChildrenSize())))}function yr(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const o=hn(s);return t[e]=o,o}return s}function oi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,u=e.get(o);u===void 0&&F(33,o);const l=u.klass;let a=r.get(l);a===void 0&&(a=new Map,r.set(l,a));const c=a.get(i),f=c==="destroyed"&&s==="created";(c===void 0||f)&&a.set(i,f?"updated":s)}function Ki(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function Er(r,e){const t=r.offset;if(r.type==="element")return Ki(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?Ki(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Eu(r){const e=Rn(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(r,e,t){return Ju(r,e,t)}function On(r){return!me(r)&&!r.isLastChild()&&!r.isInline()}function yn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&F(75,e),t}function Pr(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function _r(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Rn(r){const e=r._window;return e===null&&F(78),e}function ic(r){let e=r.getParentOrThrow();for(;e!==null;){if(He(e))return e;e=e.getParentOrThrow()}return e}function He(r){return me(r)||E(r)&&r.isShadowRoot()}function Qe(r){const e=ee(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&F(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),u=i.constructor;return o!==null?i instanceof o||F(201,o.name,o.getType(),u.name,u.getType(),r.constructor.name,t):i instanceof r.constructor&&u!==r.constructor||F(202,u.name,u.getType(),r.constructor.name,t),i.__key===r.__key&&F(203,r.constructor.name,t,u.name,u.getType()),i}return r}function us(r,e){!me(r.getParent())||E(e)||Y(e)||F(99)}function ls(r){return(Y(r)||E(r)&&!r.canBeEmpty())&&!r.isInline()}function ui(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function oc(r,e,t){let n=r._blockCursorElement;if(N(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let u=!1,l=null;if(i===o.getChildrenSize())ls(o.getChildAtIndex(i-1))&&(u=!0);else{const a=o.getChildAtIndex(i);if(a!==null&&ls(a)){const c=a.getPreviousSibling();(c===null||ls(c))&&(u=!0,l=r.getElementByKey(a.__key))}}if(u){const a=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const f=c.theme,d=document.createElement("div");d.contentEditable="false",d.setAttribute("data-lexical-cursor","true");let h=f.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=hn(h);h=f.blockCursor=p}h!==void 0&&d.classList.add(...h)}return d}(r._config)),e.style.caretColor="transparent",void(l===null?a.appendChild(n):a.insertBefore(n,l))}}n!==null&&ui(n,r,e)}function Be(r){return Re?(r||window).getSelection():null}function uc(r){return rt(r)&&r.tagName==="A"}function rt(r){return r.nodeType===1}function Hi(r){return r.nodeType===11}function Ds(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function _n(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function at(r){if(Y(r)&&!r.isInline())return!0;if(!E(r)||He(r))return!1;const e=r.getFirstChild(),t=e===null||Et(e)||P(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function ur(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function lc(){return ee()}const Gi=new WeakMap,ac=new Map;function cc(r){if(!r._readOnly&&r.isEmpty())return ac;r._readOnly||F(192);let e=Gi.get(r);if(!e){e=new Map,Gi.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function li(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function ai(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function dc(r){return r.__lexicalUnmanaged===!0}function ku(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const u=i.__key;i.__parent===e&&(E(i)&&ku(i,u,t,n,s,o),t.has(u)||o.delete(u),s.push(u)),i=i.getNextSibling()}}let gt,ye,kr,Mn,Cs,ws,Tt,Oe,As,Sr,oe="",ge="",ze=null,Fe="",et="",Su=!1,Tr=!1,sn=null;function xn(r,e){const t=Tt.get(r);if(e!==null){const n=Ss(r);n.parentNode===e&&e.removeChild(n)}if(Oe.has(r)||ye._keyToDOMMap.delete(r),E(t)){const n=bn(t,Tt);Es(n,0,n.length-1,null)}t!==void 0&&oi(Sr,kr,Mn,t,"destroyed")}function Es(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&xn(o,n)}}function bt(r,e){r.setProperty("text-align",e)}const fc="40px";function Tu(r,e){const t=gt.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||fc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Bu(r,e){const t=r.style;e===0?bt(t,""):e===Gs?bt(t,"left"):e===Js?bt(t,"center"):e===Qs?bt(t,"right"):e===Ys?bt(t,"justify"):e===Xs?bt(t,"start"):e===Zs&&bt(t,"end")}function vn(r,e){const t=Oe.get(r);t===void 0&&F(60);const n=t.createDOM(gt,ye);if(function(s,o,i){const u=i._keyToDOMMap;(function(l,a,c){l[`__lexicalKey_${a._key}`]=c})(o,i,s),u.set(s,o)}(r,n,ye),P(t)?n.setAttribute("data-lexical-text","true"):Y(t)&&n.setAttribute("data-lexical-decorator","true"),E(t)){const s=t.__indent,o=t.__size;if(s!==0&&Tu(n,s),o!==0){const u=o-1;(function(l,a,c,f){const d=ge;ge="",ks(l,c,0,a,c.getDOMSlot(f)),Fu(c,f),ge=d})(bn(t,Oe),u,t,n)}const i=t.__format;i!==0&&Bu(n,i),t.isInline()||Nu(null,t,n),On(t)&&(oe+=tt,et+=tt)}else{const s=t.getTextContent();if(Y(t)){const o=t.decorate(ye,gt);o!==null&&Lu(r,o),n.contentEditable="false"}else P(t)&&(t.isDirectionless()||(ge+=s));oe+=s,et+=s}return e!==null&&e.insertChild(n),oi(Sr,kr,Mn,t,"created"),n}function ks(r,e,t,n,s){const o=oe;oe="";let i=t;for(;i<=n;++i){vn(r[i],s);const u=Oe.get(r[i]);u!==null&&P(u)&&(ze===null&&(ze=u.getFormat()),Fe===""&&(Fe=u.getStyle()))}On(e)&&(oe+=tt),s.element.__lexicalTextContent=oe,oe=o+oe}function Ji(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return Et(n)?"line-break":Y(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Nu(r,e,t){const n=Ji(r,Tt),s=Ji(e,Oe);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Fu(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==ge||n!==sn){const o=ge==="",i=o?sn:(s=ge,qa.test(s)?"rtl":za.test(s)?"ltr":null);if(i!==n){const u=e.classList,l=gt.theme;let a=n!==null?l[n]:void 0,c=i!==null?l[i]:void 0;if(a!==void 0){if(typeof a=="string"){const f=hn(a);a=l[n]=f}u.remove(...a)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const f=hn(c);c=l[i]=f}c!==void 0&&u.add(...c)}e.dir=i}Tr||(r.getWritable().__dir=i)}sn=i,e.__lexicalDirTextContent=ge,e.__lexicalDir=i}var s}function hc(r,e,t){const n=ge;var s;ge="",ze=null,Fe="",function(o,i,u){const l=oe,a=o.__size,c=i.__size;oe="";const f=u.element;if(a===1&&c===1){const d=o.__first,h=i.__first;if(d===h)fr(d,f);else{const g=Ss(d),_=vn(h,null);try{f.replaceChild(_,g)}catch(D){if(typeof D=="object"&&D!=null){const y=`${D.toString()} Parent: ${f.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(y)}throw D}xn(d,null)}const p=Oe.get(h);P(p)&&(ze===null&&(ze=p.getFormat()),Fe===""&&(Fe=p.getStyle()))}else{const d=bn(o,Tt),h=bn(i,Oe);if(d.length!==a&&F(227),h.length!==c&&F(228),a===0)c!==0&&ks(h,i,0,c-1,u);else if(c===0){if(a!==0){const p=u.after==null&&u.before==null&&u.element.__lexicalLineBreak==null;Es(d,0,a-1,p?null:f),p&&(f.textContent="")}}else(function(p,g,_,D,y,C){const x=D-1,w=y-1;let b,k,A=C.getFirstChild(),S=0,O=0;for(;S<=x&&O<=w;){const q=g[S],I=_[O];if(q===I)A=as(fr(I,C.element)),S++,O++;else{b===void 0&&(b=new Set(g)),k===void 0&&(k=new Set(_));const re=k.has(q),Ee=b.has(I);if(re)if(Ee){const Me=yn(ye,I);Me===A?A=as(fr(I,C.element)):(C.withBefore(A).insertChild(Me),fr(I,C.element)),S++,O++}else vn(I,C.withBefore(A)),O++;else A=as(Ss(q)),xn(q,C.element),S++}const V=Oe.get(I);V!==null&&P(V)&&(ze===null&&(ze=V.getFormat()),Fe===""&&(Fe=V.getStyle()))}const L=S>x,W=O>w;if(L&&!W){const q=_[w+1],I=q===void 0?null:ye.getElementByKey(q);ks(_,p,O,w,C.withBefore(I))}else W&&!L&&Es(g,S,x,C.element)})(i,d,h,a,c,u)}On(i)&&(oe+=tt),f.__lexicalTextContent=oe,oe=l+oe}(r,e,e.getDOMSlot(t)),Fu(e,t),Qt(s=e)&&ze!=null&&ze!==s.__textFormat&&!Tr&&(s.setTextFormat(ze),s.setTextStyle(Fe)),function(o){Qt(o)&&Fe!==""&&Fe!==o.__textStyle&&!Tr&&o.setTextStyle(Fe)}(e),ge=n}function bn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&F(101),t.push(n),n=s.__next}return t}function fr(r,e){const t=Tt.get(r);let n=Oe.get(r);t!==void 0&&n!==void 0||F(61);const s=Su||ws.has(r)||Cs.has(r),o=yn(ye,r);if(t===n&&!s){if(E(t)){const i=o.__lexicalTextContent;i!==void 0&&(oe+=i,et+=i);const u=o.__lexicalDirTextContent;u!==void 0&&(ge+=u)}else{const i=t.getTextContent();P(t)&&!t.isDirectionless()&&(ge+=i),et+=i,oe+=i}return o}if(t!==n&&s&&oi(Sr,kr,Mn,n,"updated"),n.updateDOM(t,o,gt)){const i=vn(r,null);return e===null&&F(62),e.replaceChild(i,o),xn(r,null),i}if(E(t)&&E(n)){const i=n.__indent;i!==t.__indent&&Tu(o,i);const u=n.__format;u!==t.__format&&Bu(o,u),s&&(hc(t,n,o),me(n)||n.isInline()||Nu(t,n,o)),On(n)&&(oe+=tt,et+=tt)}else{const i=n.getTextContent();if(Y(n)){const u=n.decorate(ye,gt);u!==null&&Lu(r,u)}else P(n)&&!n.isDirectionless()&&(ge+=i);oe+=i,et+=i}if(!Tr&&me(n)&&n.__cachedText!==et){const i=n.getWritable();i.__cachedText=et,n=i}return o}function Lu(r,e){let t=ye._pendingDecorators;const n=ye._decorators;if(t===null){if(n[r]===e)return;t=bu(ye)}t[r]=e}function as(r){let e=r.nextSibling;return e!==null&&e===ye._blockCursorElement&&(e=e.nextSibling),e}function pc(r,e,t,n,s,o){oe="",et="",ge="",Su=n===Gt,sn=null,ye=t,gt=t._config,kr=t._nodes,Mn=ye._listeners.mutation,Cs=s,ws=o,Tt=r._nodeMap,Oe=e._nodeMap,Tr=e._readOnly,As=new Map(t._keyToDOMMap);const i=new Map;return Sr=i,fr("root",null),ye=void 0,kr=void 0,Cs=void 0,ws=void 0,Tt=void 0,Oe=void 0,gt=void 0,As=void 0,Sr=void 0,i}function Ss(r){const e=As.get(r);return e===void 0&&F(75,r),e}const Ze=Object.freeze({}),Ts=30,Bs=[["keydown",function(r,e){if(xr=r.timeStamp,Pu=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!R(e,xa,r)&&t!=null){if(function(u,l,a,c){return Ui(u)&&!l&&!c&&!a}(t,s,i,o))R(e,eu,r);else if(function(u,l,a,c,f){return Ui(u)&&!c&&!a&&(l||f)}(t,s,n,i,o))R(e,va,r);else if(function(u,l,a,c){return zi(u)&&!l&&!c&&!a}(t,s,i,o))R(e,tu,r);else if(function(u,l,a,c,f){return zi(u)&&!c&&!a&&(l||f)}(t,s,n,i,o))R(e,ba,r);else if(function(u,l,a){return function(c){return c==="ArrowUp"}(u)&&!l&&!a}(t,s,o))R(e,ru,r);else if(function(u,l,a){return function(c){return c==="ArrowDown"}(u)&&!l&&!a}(t,s,o))R(e,nu,r);else if(function(u,l){return Wi(u)&&l}(t,n))vr=!0,R(e,an,r);else if(function(u){return u===" "}(t))R(e,Da,r);else if(function(u,l){return Ne&&l&&u.toLowerCase()==="o"}(t,s))r.preventDefault(),vr=!0,R(e,Wt,!0);else if(function(u,l){return Wi(u)&&!l}(t,n))vr=!1,R(e,an,r);else if(function(u,l,a,c){return Ne?!l&&!a&&(ir(u)||u.toLowerCase()==="h"&&c):!(c||l||a)&&ir(u)}(t,i,o,s))ir(t)?R(e,su,r):(r.preventDefault(),R(e,wt,!0));else if(function(u){return u==="Escape"}(t))R(e,iu,r);else if(function(u,l,a,c,f){return Ne?!(a||c||f)&&(or(u)||u.toLowerCase()==="d"&&l):!(l||c||f)&&or(u)}(t,s,n,i,o))or(t)?R(e,ou,r):(r.preventDefault(),R(e,wt,!1));else if(function(u,l,a){return ir(u)&&(Ne?l:a)}(t,i,s))r.preventDefault(),R(e,wr,!0);else if(function(u,l,a){return or(u)&&(Ne?l:a)}(t,i,s))r.preventDefault(),R(e,wr,!1);else if(function(u,l){return Ne&&l&&ir(u)}(t,o))r.preventDefault(),R(e,Ar,!0);else if(function(u,l){return Ne&&l&&or(u)}(t,o))r.preventDefault(),R(e,Ar,!1);else if(function(u,l,a,c){return u.toLowerCase()==="b"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Pe,"bold");else if(function(u,l,a,c){return u.toLowerCase()==="u"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Pe,"underline");else if(function(u,l,a,c){return u.toLowerCase()==="i"&&!l&&dr(a,c)}(t,i,o,s))r.preventDefault(),R(e,Pe,"italic");else if(function(u,l,a,c){return u==="Tab"&&!l&&!a&&!c}(t,i,s,o))R(e,Ca,r);else if(function(u,l,a,c){return u.toLowerCase()==="z"&&!l&&dr(a,c)}(t,n,o,s))r.preventDefault(),R(e,Us,void 0);else if(function(u,l,a,c){return Ne?u.toLowerCase()==="z"&&a&&l:u.toLowerCase()==="y"&&c||u.toLowerCase()==="z"&&c&&l}(t,n,o,s))r.preventDefault(),R(e,Ws,void 0);else{const u=e._editorState._selection;u===null||N(u)?!pt&&Vi(t,o,s)&&(r.preventDefault(),R(e,vs,r)):function(l,a,c,f){return!a&&l.toLowerCase()==="c"&&(Ne?c:f)}(t,n,o,s)?(r.preventDefault(),R(e,Bn,r)):function(l,a,c,f){return!a&&l.toLowerCase()==="x"&&(Ne?c:f)}(t,n,o,s)?(r.preventDefault(),R(e,Vs,r)):Vi(t,o,s)&&(r.preventDefault(),R(e,vs,r))}(function(u,l,a,c){return u||l||a||c})(s,n,i,o)&&R(e,Fa,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&we(e,()=>{Y(Jt(t))||(Fs=!0)})}],["compositionstart",function(r,e){we(e,()=>{const t=j();if(N(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();fe(n.key),(r.timeStamp<xr+Ts||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||P(s)&&s.getStyle()!==t.style)&&R(e,Vt,$a)}})}],["compositionend",function(r,e){pt?lr=!0:we(e,()=>{cs(e,r.data)})}],["input",function(r,e){r.stopPropagation(),we(e,()=>{const t=j(),n=r.data,s=ju(r);if(n!=null&&N(t)&&Mu(t,s,n,r.timeStamp,!1)){lr&&(cs(e,n),lr=!1);const o=t.anchor.getNode(),i=Be(e._window);if(i===null)return;const u=t.isBackward(),l=u?t.anchor.offset:t.focus.offset,a=u?t.focus.offset:t.anchor.offset;cn&&!t.isCollapsed()&&P(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,l)+n+o.getTextContent().slice(l+a)===Au(i.anchorNode)||R(e,Vt,n);const c=n.length;pt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),Nn||Nr||Ks||!e.isComposing()||(xr=0,fe(null))}else si(!1,e,n!==null?n:void 0),lr&&(cs(e,n||void 0),lr=!1);ve(),gu(ee())}),qt=null}],["click",function(r,e){we(e,()=>{const t=j(),n=Be(e._window),s=jr();if(n){if(N(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!me(i)&&te().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(E(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===Fr||i===mt)&&Ke(di(s,n,e,r))}}}R(e,Zo,r)})}],["cut",Ze],["copy",Ze],["dragstart",Ze],["dragover",Ze],["dragend",Ze],["paste",Ze],["focus",Ze],["blur",Ze],["drop",Ze]];cn&&Bs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=ju(t);s==="deleteCompositionText"||pt&&Eu(n)||s!=="insertCompositionText"&&we(n,()=>{const i=j();if(s==="deleteContentBackward"){if(i===null){const h=jr();if(!N(h))return;Ke(h.clone())}if(N(i)){const h=i.anchor.key===i.focus.key;if(u=t.timeStamp,Pu==="MediaLast"&&u<xr+Ts&&n.isComposing()&&h){if(fe(null),xr=0,setTimeout(()=>{we(n,()=>{fe(null)})},Ts),N(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),P(p)||F(142),i.style=p.getStyle()}}else{fe(null),t.preventDefault();const p=i.anchor.getNode(),g=p.getTextContent(),_=p.canInsertTextAfter(),D=i.anchor.offset===0&&i.focus.offset===g.length;Oa&&h&&!D&&_||R(n,wt,!0)}return}}var u;if(!N(i))return;const l=t.data;qt!==null&&si(!1,n,qt),i.dirty&&qt===null||!i.isCollapsed()||me(i.anchor.getNode())||o===null||i.applyDOMRange(o),qt=null;const a=i.anchor,c=i.focus,f=a.getNode(),d=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(n,Vt,t);break;case"insertFromComposition":fe(null),R(n,Vt,t);break;case"insertLineBreak":fe(null),R(n,Wt,!1);break;case"insertParagraph":fe(null),vr&&!Nr?(vr=!1,R(n,Wt,!1)):R(n,Cr,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(n,Tn,t);break;case"deleteByComposition":(function(h,p){return h!==p||E(h)||E(p)||!h.isToken()||!p.isToken()})(f,d)&&R(n,xs,t);break;case"deleteByDrag":case"deleteByCut":R(n,xs,t);break;case"deleteContent":R(n,wt,!1);break;case"deleteWordBackward":R(n,wr,!0);break;case"deleteWordForward":R(n,wr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(n,Ar,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(n,Ar,!1);break;case"formatStrikeThrough":R(n,Pe,"strikethrough");break;case"formatBold":R(n,Pe,"bold");break;case"formatItalic":R(n,Pe,"italic");break;case"formatUnderline":R(n,Pe,"underline");break;case"historyUndo":R(n,Us,void 0);break;case"historyRedo":R(n,Ws,void 0)}else{if(l===`
|
|
64
64
|
`)t.preventDefault(),R(n,Wt,!1);else if(l===tt)t.preventDefault(),R(n,Cr,void 0);else if(l==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else l!=null&&Mu(i,o,l,t.timeStamp,!0)?(t.preventDefault(),R(n,Vt,l)):qt=l;Ou=t.timeStamp}})}(r,e)]);let xr=0,Pu=null,Ou=0,qt=null;const Dn=new WeakMap;let Ns=!1,Fs=!1,vr=!1,lr=!1,Ru=[0,"",0,"root",0];function Mu(r,e,t,n,s){const o=r.anchor,i=r.focus,u=o.getNode(),l=ee(),a=Be(l._window),c=a!==null?a.anchorNode:null,f=o.key,d=l.getElementByKey(f),h=t.length;return f!==i.key||!P(u)||(!s&&(!cn||Ou<n+50)||u.isDirty()&&h<2||Cu(t))&&o.offset!==i.offset&&!u.isComposing()||Dt(u)||u.isDirty()&&h>1||(s||!cn)&&d!==null&&!u.isComposing()&&c!==pn(d)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||u.getFormat()!==r.format||u.getStyle()!==r.style||nc(r,u)}function Qi(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===mt&&e!==0&&e!==r.nodeValue.length}function Yi(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Ns&&(Ns=!1,Qi(n,s)&&Qi(o,i))||we(e,()=>{if(!t)return void Ke(null);if(!Lr(e,n,o))return;const u=j();if(N(u)){const l=u.anchor,a=l.getNode();if(u.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(u.dirty=!0);const c=Rn(e).event,f=c?c.timeStamp:performance.now(),[d,h,p,g,_]=Ru,D=te(),y=e.isComposing()===!1&&D.getTextContent()==="";if(f<_+200&&l.offset===p&&l.key===g)u.format=d,u.style=h;else if(l.type==="text")P(a)||F(141),u.format=a.getFormat(),u.style=a.getStyle();else if(l.type==="element"&&!y){const C=l.getNode();u.style="",C instanceof Xt&&C.getChildrenSize()===0?(u.format=C.getTextFormat(),u.style=C.getTextStyle()):u.format=0}}else{const c=l.key,f=u.focus.key,d=u.getNodes(),h=d.length,p=u.isBackward(),g=p?i:s,_=p?s:i,D=p?f:c,y=p?c:f;let C=Ia,x=!1;for(let w=0;w<h;w++){const b=d[w],k=b.getTextContentSize();if(P(b)&&k!==0&&!(w===0&&b.__key===D&&g===k||w===h-1&&b.__key===y&&_===0)&&(x=!0,C&=b.getFormat(),C===0))break}u.format=x?C:0}}R(e,zs,void 0)})}function ju(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function cs(r,e){const t=r._compositionKey;if(fe(null),t!==null&&e!=null){if(e===""){const n=he(t),s=pn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&P(n)&&ii(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
65
65
|
`){const n=j();if(N(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void R(r,an,null)}}}si(!0,r,e)}function Iu(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Kt=new Map;function $u(r){const e=r.target,t=Be(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=_u(t.anchorNode);if(n===null)return;Fs&&(Fs=!1,we(n,()=>{const a=jr(),c=t.anchorNode;if(c===null)return;const f=c.nodeType;f!==Fr&&f!==mt||Ke(di(a,t,n,r))}));const s=ni(n),o=s[s.length-1],i=o._key,u=Kt.get(i),l=u||o;l!==n&&Yi(t,l,!1),Yi(t,n,!0),n!==o?Kt.set(i,n):u&&Kt.delete(i)}function Xi(r){r._lexicalHandled=!0}function Zi(r){return r._lexicalHandled===!0}function gc(r){const e=r.ownerDocument,t=Dn.get(e);t===void 0&&F(162);const n=t-1;n>=0||F(164),Dn.set(e,n),n===0&&e.removeEventListener("selectionchange",$u);const s=Ln(r);ri(s)?(function(i){if(i._parentEditor!==null){const u=ni(i),l=u[u.length-1]._key;Kt.get(l)===i&&Kt.delete(l)}else Kt.delete(i._key)}(s),r.__lexicalEditor=null):s&&F(198);const o=Iu(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function Ls(r,e,t){ve();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(u){const l=j();if(!N(l)||!E(u))return l;const{anchor:a,focus:c}=l,f=a.getNode(),d=c.getNode();return _r(f,u)&&a.set(u.__key,0,"element"),_r(d,u)&&c.set(u.__key,0,"element"),l}(r);let i=!1;if(N(o)&&e){const u=o.anchor,l=o.focus;u.key===n&&(wn(u,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),l.key===n&&(wn(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else Ue(o)&&e&&r.isSelected()&&r.selectPrevious();if(N(o)&&e&&!i){const u=r.getIndexWithinParent();At(r),Cn(o,s,u,-1)}else At(r);t||He(s)||s.canBeEmpty()||!s.isEmpty()||Ls(s,e),e&&me(s)&&s.isEmpty()&&s.selectEnd()}class jn{static getType(){F(64,this.name)}static clone(e){F(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,rc(this,e)}getType(){return this.__type}isInline(){F(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=he(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||j();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(P(this))return n;if(N(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Y(this)&&this.isInline()&&s){const o=t.isBackward()?t.focus:t.anchor,i=o.getNode();if(o.offset===i.getChildrenSize()&&i.is(s)&&i.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:he(e)}getParentOrThrow(){const e=this.getParent();return e===null&&F(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(He(t))return E(e)||e===this&&Y(e)||F(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&F(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:he(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:he(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();E(this)&&t.unshift(this),E(e)&&n.unshift(e);const s=t.length,o=n.length;if(s===0||o===0||t[s-1]!==n[o-1])return null;const i=new Set(n);for(let u=0;u<s;u++){const l=t[u];if(i.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,o=this;for(;;){const i=o.getParentOrThrow();if(i===t){n=o.getIndexWithinParent();break}o=i}for(o=e;;){const i=o.getParentOrThrow();if(i===t){s=o.getIndexWithinParent();break}o=i}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let o=this;for(;o!==null;){const i=o.__key;if(s.has(i)||(s.add(i),n.push(o)),o===e)break;const u=E(o)?t?o.getFirstChild():o.getLastChild():null;if(u!==null){o=u;continue}const l=t?o.getNextSibling():o.getPreviousSibling();if(l!==null){o=l;continue}const a=o.getParentOrThrow();if(s.has(a.__key)||n.push(a),a===e)break;let c=null,f=a;do{if(f===null&&F(68),c=t?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||s.has(f.__key)||n.push(f)}while(c===null);o=c}return t||n.reverse(),n}isDirty(){const e=ee()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=he(this.__key);return e===null&&F(113),e}getWritable(){ve();const e=nt(),t=ee(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,u=j();if(u!==null&&u.setCachedNodes(null),i.has(s))return mn(o),o;const l=li(o);return i.add(s),mn(l),n.set(s,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){F(70)}updateDOM(e,t,n){F(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){F(72)}static importJSON(e){F(18,this.name)}static transform(){return null}remove(e){Ls(this,!0,e)}replace(e,t){ve();let n=j();n!==null&&(n=n.clone()),us(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,u=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;At(u);const c=s.getPreviousSibling(),f=s.getNextSibling(),d=s.__prev,h=s.__next,p=s.__parent;if(Ls(s,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,u.__prev=d,f===null?l.__last=i:f.getWritable().__prev=i,u.__next=h,u.__parent=p,l.__size=a,t&&(E(this)&&E(u)||F(139),this.getChildren().forEach(g=>{u.append(g)})),N(n)){Ke(n);const g=n.anchor,_=n.focus;g.key===o&&no(g,u),_.key===o&&no(_,u)}return dt()===o&&fe(i),u}insertAfter(e,t=!0){ve(),us(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.getParent(),i=j();let u=!1,l=!1;if(o!==null){const h=e.getIndexWithinParent();if(At(s),N(i)){const p=o.__key,g=i.anchor,_=i.focus;u=g.type==="element"&&g.key===p&&g.offset===h+1,l=_.type==="element"&&_.key===p&&_.offset===h+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=s.__key,d=n.__next;if(a===null?c.__last=f:a.getWritable().__prev=f,c.__size++,n.__next=f,s.__next=d,s.__prev=n.__key,s.__parent=n.__parent,t&&N(i)){const h=this.getIndexWithinParent();Cn(i,c,h+1);const p=c.__key;u&&i.anchor.set(p,h+2,"element"),l&&i.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){ve(),us(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;At(s);const i=this.getPreviousSibling(),u=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();i===null?u.__first=o:i.getWritable().__next=o,u.__size++,n.__prev=o,s.__prev=l,s.__next=n.__key,s.__parent=n.__parent;const c=j();return t&&N(c)&&Cn(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return ue()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){ve();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(E(n))return n.select();if(!P(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){ve();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(E(n))return n.select(0,0);if(!P(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class Or extends jn{static getType(){return"linebreak"}static clone(e){return new Or(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
66
66
|
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&_n(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Yr(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&Yr(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&_n(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Yr(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&Yr(o))return!0}return!1}(e)?null:{conversion:mc,priority:0}}}static importJSON(e){return Bt()}exportJSON(){return{type:"linebreak",version:1}}}function mc(r){return{node:Bt()}}function Bt(){return Qe(new Or)}function Et(r){return r instanceof Or}function Yr(r){return r.nodeType===mt&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function ds(r,e){return 16&e?"code":e&Hs?"mark":32&e?"sub":64&e?"sup":null}function fs(r,e){return 1&e?"strong":2&e?"em":"span"}function qu(r,e,t,n,s){const o=n.classList;let i=yr(s,"base");i!==void 0&&o.add(...i),i=yr(s,"underlineStrikethrough");let u=!1;const l=e&fn&&e&dn;i!==void 0&&(t&fn&&t&dn?(u=!0,l||o.add(...i)):l&&o.remove(...i));for(const a in St){const c=St[a];if(i=yr(s,a),i!==void 0)if(t&c){if(u&&(a==="underline"||a==="strikethrough")){e&c&&o.remove(...i);continue}e&c&&(!l||a!=="underline")&&a!=="strikethrough"||o.add(...i)}else e&c&&o.remove(...i)}}function zu(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?Fn:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||pt){const[u,l,a]=function(c,f){const d=c.length,h=f.length;let p=0,g=0;for(;p<d&&p<h&&c[p]===f[p];)p++;for(;g+p<d&&g+p<h&&c[d-g-1]===f[h-g-1];)g++;return[p,d-p-g,f.slice(p,h-g)]}(i,o);l!==0&&n.deleteData(u,l),n.insertData(u,a)}else n.nodeValue=o}}function eo(r,e,t,n,s,o){zu(s,r,e);const i=o.theme.text;i!==void 0&&qu(0,0,n,r,i)}function Xr(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Yt extends jn{static getType(){return"text"}static clone(e){return new Yt(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Ka[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===dt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=St[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return gn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=ds(0,n),o=fs(0,n),i=s===null?o:s,u=document.createElement(i);let l=u;this.hasFormat("code")&&u.setAttribute("spellcheck","false"),s!==null&&(l=document.createElement(o),u.appendChild(l)),eo(l,this,0,n,this.__text,e);const a=this.__style;return a!==""&&(u.style.cssText=a),u}updateDOM(e,t,n){const s=this.__text,o=e.__format,i=this.__format,u=ds(0,o),l=ds(0,i),a=fs(0,o),c=fs(0,i);if((u===null?a:u)!==(l===null?c:l))return!0;if(u===l&&a!==c){const g=t.firstChild;g==null&&F(48);const _=document.createElement(c);return eo(_,this,0,i,s,n),t.replaceChild(_,g),!1}let f=t;l!==null&&u!==null&&(f=t.firstChild,f==null&&F(49)),zu(s,f,this);const d=n.theme.text;d!==void 0&&o!==i&&qu(0,o,i,f,d);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:vc,priority:0}),b:()=>({conversion:_c,priority:0}),code:()=>({conversion:lt,priority:0}),em:()=>({conversion:lt,priority:0}),i:()=>({conversion:lt,priority:0}),s:()=>({conversion:lt,priority:0}),span:()=>({conversion:yc,priority:0}),strong:()=>({conversion:lt,priority:0}),sub:()=>({conversion:lt,priority:0}),sup:()=>({conversion:lt,priority:0}),u:()=>({conversion:lt,priority:0})}}static importJSON(e){const t=ae(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&rt(t)||F(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Xr(t,"b")),this.hasFormat("italic")&&(t=Xr(t,"i")),this.hasFormat("strikethrough")&&(t=Xr(t,"s")),this.hasFormat("underline")&&(t=Xr(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?St[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Ua[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=gn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Va[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){ve();let n=e,s=t;const o=j(),i=this.getTextContent(),u=this.__key;if(typeof i=="string"){const l=i.length;n===void 0&&(n=l),s===void 0&&(s=l)}else n=0,s=0;if(!N(o))return Vu(u,n,u,s,"text","text");{const l=dt();l!==o.anchor.key&&l!==o.focus.key||fe(u),o.setTextNodeRange(this,n,this,s)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const o=this.getWritable(),i=o.__text,u=n.length;let l=e;l<0&&(l=u+l,l<0&&(l=0));const a=j();if(s&&N(a)){const f=e+u;a.setTextNodeRange(o,f,o,f)}const c=i.slice(0,l)+n+i.slice(l+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ve();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=dt(),i=new Set(e),u=[],l=n.length;let a="";for(let w=0;w<l;w++)a!==""&&i.has(w)&&(u.push(a),a=""),a+=n[w];a!==""&&u.push(a);const c=u.length;if(c===0)return[];if(u[0]===n)return[t];const f=u[0],d=t.getParent();let h;const p=t.getFormat(),g=t.getStyle(),_=t.__detail;let D=!1;t.isSegmented()?(h=ae(f),h.__format=p,h.__style=g,h.__detail=_,D=!0):(h=t.getWritable(),h.__text=f);const y=j(),C=[h];let x=f.length;for(let w=1;w<c;w++){const b=u[w],k=b.length,A=ae(b).getWritable();A.__format=p,A.__style=g,A.__detail=_;const S=A.__key,O=x+k;if(N(y)){const L=y.anchor,W=y.focus;L.key===s&&L.type==="text"&&L.offset>x&&L.offset<=O&&(L.key=S,L.offset-=x,y.dirty=!0),W.key===s&&W.type==="text"&&W.offset>x&&W.offset<=O&&(W.key=S,W.offset-=x,y.dirty=!0)}o===s&&fe(S),x=O,C.push(A)}if(d!==null){(function(k){const A=k.getPreviousSibling(),S=k.getNextSibling();A!==null&&mn(A),S!==null&&mn(S)})(this);const w=d.getWritable(),b=this.getIndexWithinParent();D?(w.splice(b,0,C),this.remove()):w.splice(b,1,C),N(y)&&Cn(y,d,b,c-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||F(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;dt()===s&&fe(n);const u=j();if(N(u)){const f=u.anchor,d=u.focus;f!==null&&f.key===s&&(co(f,t,n,e,i),u.dirty=!0),d!==null&&d.key===s&&(co(d,t,n,e,i),u.dirty=!0)}const l=e.__text,a=t?l+o:o+l;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function yc(r){return{forChild:ci(r.style),node:null}}function _c(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:ci(e.style,t?void 0:"bold"),node:null}}const to=new WeakMap;function xc(r){return r.nodeName==="PRE"||r.nodeType===Fr&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function vc(r){const e=r;r.parentElement===null&&F(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=to.get(o))===void 0&&!xc(o);)i.push(o),o=o.parentNode;const u=s===void 0?o:s;for(let l=0;l<i.length;l++)to.set(i[l],u);return u}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],o=n.length;for(let i=0;i<o;i++){const u=n[i];u===`
|
|
@@ -68,9 +68,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
68
68
|
`?s.push(Bt()):u===" "?s.push(Mr()):u!==""&&s.push(ae(u))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=ro(n,!1))!==null;){const o=n.textContent||"";if(o.length>0){/[ \t\n]$/.test(o)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=ro(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:ae(t)}}function ro(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const o=t.parentElement;if(o===null)return null;t=o}if(t=n,t.nodeType===Fr){const o=t.style.display;if(o===""&&!Ds(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===mt)return t;if(t.nodeName==="BR")return null}}const bc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function lt(r){const e=bc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ci(r.style,e),node:null}}function ae(r=""){return Qe(new Yt(r))}function P(r){return r instanceof Yt}function ci(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",o=n.includes("line-through"),i=r.fontStyle==="italic",u=n.includes("underline"),l=r.verticalAlign;return a=>(P(a)&&(s&&!a.hasFormat("bold")&&a.toggleFormat("bold"),o&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),u&&!a.hasFormat("underline")&&a.toggleFormat("underline"),l!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),l!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class Rr extends Yt{static getType(){return"tab"}static clone(e){return new Rr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=Mr();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){F(126)}setDetail(e){F(127)}setMode(e){F(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Mr(){return Qe(new Rr)}function Dc(r){return r instanceof Rr}class Cc{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,o=e.offset;if(E(t)){const i=t.getDescendantByIndex(s);t=i??t}if(E(n)){const i=n.getDescendantByIndex(o);n=i??n}return t===n?s<o:t.isBefore(n)}getNode(){const e=he(this.key);return e===null&&F(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,Ir()||(dt()===o&&fe(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function Ge(r,e,t){return new Cc(r,e,t)}function hs(r,e){let t=e.__key,n=r.offset,s="element";if(P(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!E(e)){const o=e.getNextSibling();if(P(o))t=o.__key,n=0,s="text";else{const i=e.getParent();i&&(t=i.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function no(r,e){if(E(e)){const t=e.getLastDescendant();E(t)||P(t)?hs(r,t):hs(r,e)}else hs(r,e)}function ct(r,e,t,n){r.key=e,r.offset=t,r.type=n}class In{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ue(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new In(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let o;if(P(s))o=s.select();else{const i=s.getIndexWithinParent()+1;o=s.getParentOrThrow().select(i,i)}o.insertNodes(e);for(let i=0;i<n;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const o=he(s);o!==null&&n.push(o)}return Ir()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function N(r){return r instanceof yt}class yt{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!N(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),o=s?t:n,i=s?n:t;let u=o.getNode(),l=i.getNode();const a=o.offset,c=i.offset;if(E(u)){const d=u.getDescendantByIndex(a);u=d??u}if(E(l)){let d=l.getDescendantByIndex(c);d!==null&&d!==u&&l.getChildAtIndex(c)===d&&(d=d.getPreviousSibling()),l=d??l}let f;return f=u.is(l)?E(u)&&u.getChildrenSize()>0?[]:[u]:u.getNodesBetween(l),Ir()||(this._cachedNodes=f),f}setTextNodeRange(e,t,n,s){ct(this.anchor,e.__key,t,"text"),ct(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,o=this.focus,i=s.isBefore(o),[u,l]=Ps(this);let a="",c=!0;for(let f=0;f<e.length;f++){const d=e[f];if(E(d)&&!d.isInline())c||(a+=`
|
|
69
69
|
`),c=!d.isEmpty();else if(c=!1,P(d)){let h=d.getTextContent();d===t?d===n?s.type==="element"&&o.type==="element"&&o.offset!==s.offset||(h=u<l?h.slice(u,l):h.slice(l,u)):h=i?h.slice(u):h.slice(l):d===n&&(h=i?h.slice(0,l):h.slice(0,u)),a+=h}else!Y(d)&&!Et(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=ee(),n=t.getEditorState()._selection,s=Wu(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;ct(this.anchor,o.key,o.offset,o.type),ct(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new yt(Ge(e.key,e.offset,e.type),Ge(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=gn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=St[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];i===`
|
|
70
70
|
`||i===`\r
|
|
71
|
-
`?n.push(Bt()):i===" "?n.push(Mr()):n.push(ae(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,u=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,u=t),i.type==="element"&&function(_,D,y,C){const x=_.getNode(),w=x.getChildAtIndex(_.offset),b=ae(),k=me(x)?ue().append(b):b;b.setFormat(y),b.setStyle(C),w===null?x.append(k):w.insertBefore(k),_.is(D)&&D.set(b.__key,0,"text"),_.set(b.__key,0,"text")}(i,u,s,o);const l=i.offset;let a=u.offset;const c=this.getNodes(),f=c.length;let d=c[0];P(d)||F(26);const h=d.getTextContent().length,p=d.getParentOrThrow();let g=c[f-1];if(f===1&&u.type==="element"&&(a=h,u.set(i.key,a,"text")),this.isCollapsed()&&l===h&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let _=d.getNextSibling();if(P(_)&&_.canInsertTextBefore()&&!Dt(_)||(_=ae(),_.setFormat(s),_.setStyle(o),p.canInsertTextAfter()?d.insertAfter(_):p.insertAfter(_)),_.select(0,0),d=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let _=d.getPreviousSibling();if(P(_)&&!Dt(_)||(_=ae(),_.setFormat(s),p.canInsertTextBefore()?d.insertBefore(_):p.insertBefore(_)),_.select(),d=_,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const _=ae(d.getTextContent());_.setFormat(s),d.replace(_),d=_}else if(!this.isCollapsed()&&e!==""){const _=g.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||E(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Uu(this.anchor,this.focus,null),void this.insertText(e)}if(f===1){if(d.isToken()){const C=ae(e);return C.select(),void d.replace(C)}const _=d.getFormat(),D=d.getStyle();if(l!==a||_===s&&D===o){if(Dc(d)){const C=ae(e);return C.setFormat(s),C.setStyle(o),C.select(),void d.replace(C)}}else{if(d.getTextContent()!==""){const C=ae(e);if(C.setFormat(s),C.setStyle(o),C.select(),l===0)d.insertBefore(C,!1);else{const[x]=d.splitText(l);x.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(s),d.setStyle(o)}const y=a-l;d=d.spliceText(l,y,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=D))}else{const _=new Set([...d.getParentKeys(),...g.getParentKeys()]),D=E(d)?d:d.getParentOrThrow();let y=E(g)?g:g.getParentOrThrow(),C=g;if(!D.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(u.type==="text"&&(a!==0||g.getTextContent()==="")||u.type==="element"&&g.getIndexWithinParent()<a)if(P(g)&&!g.isToken()&&a!==g.getTextContentSize()){if(g.isSegmented()){const A=ae(g.getTextContent());g.replace(A),g=A}me(u.getNode())||u.type!=="text"||(g=g.spliceText(0,a,"")),_.add(g.__key)}else{const A=g.getParentOrThrow();A.canBeEmpty()||A.getChildrenSize()!==1?g.remove():A.remove()}else _.add(g.__key);const x=y.getChildren(),w=new Set(c),b=D.is(y),k=D.isInline()&&d.getNextSibling()===null?D:d;for(let A=x.length-1;A>=0;A--){const S=x[A];if(S.is(d)||E(S)&&S.isParentOf(d))break;S.isAttached()&&(!w.has(S)||S.is(C)?b||k.insertAfter(S,!1):S.remove())}if(!b){let A=y,S=null;for(;A!==null;){const O=A.getChildren(),L=O.length;(L===0||O[L-1].is(S))&&(_.delete(A.__key),S=A),A=A.getParent()}}if(d.isToken())if(l===h)d.select();else{const A=ae(e);A.select(),d.replace(A)}else d=d.spliceText(l,h-l,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let A=1;A<f;A++){const S=c[A],O=S.__key;_.has(O)||S.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(),u=o.getNode();const l=ur(i,at),a=ur(u,at);P(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&P(u)&&u.isToken()&&(o.offset=u.getTextContentSize()),n.forEach(f=>{_r(i,f)||_r(u,f)||f.getKey()===i.getKey()||f.getKey()===u.getKey()||f.remove()});const c=(f,d)=>{if(f.getTextContent()==="")f.remove();else if(d!==0&&Dt(f)){const h=ae(f.getTextContent());return h.setFormat(f.getFormat()),h.setStyle(f.getStyle()),f.replace(h)}};if(i===u&&P(i)){const f=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,f,"",!0),void c(i,f)}if(P(i)){const f=i.getTextContentSize()-s.offset;i.spliceText(s.offset,f,""),i=c(i,f)||i}P(u)&&(u.spliceText(0,o.offset,""),u=c(u,o.offset)||u),i.isAttached()&&P(i)?i.selectEnd():u.isAttached()&&P(u)&&u.selectStart(),E(l)&&E(a)&&l!==a&&(l.append(...a.getChildren()),a.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void fe(null);const n=this.getNodes(),s=[];for(const x of n)P(x)&&s.push(x);const o=x=>{n.forEach(w=>{if(Qt(w)){const b=w.getFormatFlags(e,x);w.setTextFormat(b)}})},i=s.length;if(i===0)return this.toggleFormat(e),fe(null),void o(t);const u=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:u,f=a?u:l;let d=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(d=1,h=s[1],p=0),h==null)return;const g=h.getFormatFlags(e,t);o(g);const _=i-1;let D=s[_];const y=f.type==="text"?f.offset:D.getTextContentSize();if(h.is(D)){if(p===y)return;if(Dt(h)||p===0&&y===h.getTextContentSize())h.setFormat(g);else{const x=h.splitText(p,y),w=p===0?x[0]:x[1];w.setFormat(g),c.type==="text"&&c.set(w.__key,0,"text"),f.type==="text"&&f.set(w.__key,y-p,"text")}return void(this.format=g)}p===0||Dt(h)||([,h]=h.splitText(p),p=0),h.setFormat(g);const C=D.getFormatFlags(e,g);y>0&&(y===D.getTextContentSize()||Dt(D)||([D]=D.splitText(y)),D.setFormat(C));for(let x=d+1;x<_;x++){const w=s[x],b=w.getFormatFlags(e,C);w.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),f.type==="text"&&f.set(D.__key,y,"text"),this.format=g|C}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=j();return N(p)||F(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=ur(t,at),s=e[e.length-1];if(E(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=ps(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(E(p)||Y(p))&&!p.isInline())){E(n)||F(211,t.constructor.name,t.getType());const p=ps(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const g=ue();let _=null;for(let D=0;D<p.length;D++){const y=p[D],C=Et(y);if(C||Y(y)&&y.isInline()||E(y)&&y.isInline()||P(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),g.append(_),C))continue;_!==null&&_.append(y)}else g.append(y),_=null}return g}(e),i=o.getLastDescendant(),u=o.getChildren(),l=!E(n)||!n.isEmpty()?this.insertParagraph():null,a=u[u.length-1];let c=u[0];var f;E(f=c)&&at(f)&&!f.isEmpty()&&E(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(E(n)||F(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=u[1]),c&&(n===null&&F(212,t.constructor.name,t.getType()),function(p,g,_){const D=g.getParentOrThrow().getLastChild();let y=g;const C=[g];for(;y!==D;)y.getNextSibling()||F(140),y=y.getNextSibling(),C.push(y);let x=p;for(const w of C)x=x.insertAfter(w)}(n,c));const d=ur(i,at);l&&E(d)&&(l.canMergeWhenEmpty()||at(a))&&(d.append(...l.getChildren()),l.remove()),E(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=E(n)?n.getLastChild():null;Et(h)&&d!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ue();return te().splice(this.anchor.offset,0,[i]),i.select(),i}const e=ps(this),t=ur(this.anchor.getNode(),at);E(t)||F(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=Bt();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],u=e[n];const[l,a]=Ps(this);if(t===0)return[];if(t===1){if(P(i)&&!this.isCollapsed()){const f=l>a?a:l,d=l>a?l:a,h=i.splitText(f,d),p=f===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(P(i)){const f=c?l:a;f===i.getTextContentSize()?e.shift():f!==0&&([,i]=i.splitText(f),e[0]=i)}if(P(u)){const f=u.getTextContent().length,d=c?a:l;d===0?e.pop():d!==f&&([u]=u.splitText(d),e[n]=u)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",u=Er(s,t);if(Y(u)&&!u.isIsolated()){if(i&&u.isKeyboardSelectable()){const h=lo();return h.add(u.__key),void Ke(h)}const d=t?u.getPreviousSibling():u.getNextSibling();if(P(d)){const h=d.__key,p=t?d.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=u.getParentOrThrow();let p,g;return E(d)?(g=d.__key,p=t?d.getChildrenSize():0):(p=u.getIndexWithinParent(),g=h.__key,t||p++),s.set(g,p,"element"),void(i&&o.set(g,p,"element"))}}const l=ee(),a=Be(l._window);if(!a)return;const c=l._blockCursorElement,f=l._rootElement;if(f===null||c===null||!E(u)||u.isInline()||u.canBeEmpty()||ui(c,l,f),function(d,h,p,g){d.modify(h,p,g)}(a,e,t?"backward":"forward",n),a.rangeCount>0){const d=a.getRangeAt(0),h=this.anchor.getNode(),p=me(h)?h:ic(h);if(this.applyDOMRange(d),this.dirty=!0,!i){const g=this.getNodes(),_=[];let D=!1;for(let y=0;y<g.length;y++){const C=g[y];_r(C,p)?_.push(C):D=!0}if(D&&_.length>0)if(t){const y=_[0];E(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=_[_.length-1];E(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===d.startContainer&&a.anchorOffset===d.startOffset||function(y){const C=y.focus,x=y.anchor,w=x.key,b=x.offset,k=x.type;ct(x,C.key,C.offset,C.type),ct(C,w,b,k),y._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&E(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(E(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=Er(o,e);if(Y(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&E(s)&&s.getChildrenSize()===0){s.remove();const u=lo();u.add(i.__key),Ke(u)}else i.remove(),ee().dispatchCommand(zs,void 0);return}if(!e&&E(i)&&E(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 u=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,u!==null&&u.isSegmented()){const l=o.offset,a=u.getTextContentSize();if(u.is(s)||e&&l!==a||!e&&l!==0)return void io(u,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,a=s.getTextContentSize();if(s.is(u)||e&&l!==0||!e&&l!==a)return void io(s,e,l)}(function(l,a){const c=l.anchor,f=l.focus,d=c.getNode(),h=f.getNode();if(d===h&&c.type==="text"&&f.type==="text"){const p=c.offset,g=f.offset,_=p<g,D=_?p:g,y=_?g:p,C=y-1;D!==C&&(Cu(d.getTextContent().slice(D,y))||(a?f.offset=C:c.offset=C))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&me(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 Ue(r){return r instanceof In}function so(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Ps(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]:[so(t),so(n)]}function io(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,u=0;for(let a=0;a<o;a++){const c=a===o-1;if(u=i,i+=s[a].length,e&&i===t||i>t||c){s.splice(a,1),c&&(u=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(u,u))}function oo(r,e,t,n){let s,o=e;if(r.nodeType===Fr){let i=!1;const u=r.childNodes,l=u.length,a=n._blockCursorElement;o===l&&(i=!0,o=l-1);let c=u[o],f=!1;if(c===a)c=u[o+1],f=!0;else if(a!==null){const d=a.parentNode;r===d&&e>Array.prototype.indexOf.call(d.children,a)&&o--}if(s=zt(c),P(s))o=qi(s,i);else{let d=zt(r);if(d===null)return null;if(E(d)){const h=n.getElementByKey(d.getKey());h===null&&F(214),[d,o]=d.getDOMSlot(h).resolveChildIndex(d,h,r,e),E(d)||F(215),i&&o>=d.getChildrenSize()&&(o=Math.max(0,d.getChildrenSize()-1));let g=d.getChildAtIndex(o);if(E(g)&&function(_,D,y){const C=_.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()}(g,0,t)){const _=i?g.getLastDescendant():g.getFirstDescendant();_===null?d=g:(g=_,d=E(g)?g:g.getParentOrThrow()),o=0}P(g)?(s=g,d=null,o=qi(g,i)):g!==d&&i&&!f&&(E(d)||F(216),o=Math.min(d.getChildrenSize(),o+1))}else{const h=d.getIndexWithinParent();o=e===0&&Y(d)&&zt(r)===d?h:h+1,d=d.getParentOrThrow()}if(E(d))return Ge(d.__key,o,"element")}}else s=zt(r);return P(s)?Ge(s.__key,o,"text"):null}function uo(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&&E(i)&&i.isInline()){const u=i.getPreviousSibling();P(u)&&(r.key=u.__key,r.offset=u.getTextContent().length)}}else E(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):P(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&&E(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&E(i)&&i.isInline()&&!i.canInsertTextAfter()){const u=i.getNextSibling();P(u)&&(r.key=u.__key,r.offset=0)}}}function Uu(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);uo(r,n,s),uo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=ee();if(o.isComposing()&&o._compositionKey!==r.key&&N(t)){const i=t.anchor,u=t.focus;ct(r,i.key,i.offset,i.type),ct(e,u.key,u.offset,u.type)}}}function Wu(r,e,t,n,s,o){if(r===null||t===null||!Lr(s,r,t))return null;const i=oo(r,e,N(o)?o.anchor:null,s);if(i===null)return null;const u=oo(t,n,N(o)?o.focus:null,s);if(u===null)return null;if(i.type==="element"&&u.type==="element"){const l=zt(r),a=zt(t);if(Y(l)&&Y(a))return null}return Uu(i,u,o),[i,u]}function Os(r){return E(r)&&!r.isInline()}function Vu(r,e,t,n,s,o){const i=nt(),u=new yt(Ge(r,e,s),Ge(t,n,o),0,"");return u.dirty=!0,i._selection=u,u}function wc(){const r=Ge("root",0,"element"),e=Ge("root",0,"element");return new yt(r,e,0,"")}function lo(){return new In(new Set)}function di(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,u=i==="selectionchange",l=!bs&&(u||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let a,c,f,d;if(N(r)&&!l)return r.clone();if(e===null)return null;if(a=e.anchorNode,c=e.focusNode,f=e.anchorOffset,d=e.focusOffset,u&&N(r)&&!Lr(t,a,c))return r.clone();const h=Wu(a,f,c,d,t,r);if(h===null)return null;const[p,g]=h;return new yt(p,g,N(r)?r.format:0,N(r)?r.style:"")}function j(){return nt()._selection}function jr(){return ee()._editorState._selection}function Cn(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),u=o.getNode();if(!e.is(i)&&!e.is(u))return;const l=e.__key;if(r.isCollapsed()){const a=s.offset;if(t<=a&&n>0||t<a&&n<0){const c=Math.max(0,a+n);s.set(l,c,"element"),o.set(l,c,"element"),ao(r)}}else{const a=r.isBackward(),c=a?o:s,f=c.getNode(),d=a?s:o,h=d.getNode();if(e.is(f)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=d.offset;(t<=p&&n>0||t<p&&n<0)&&d.set(l,Math.max(0,p+n),"element")}}ao(r)}function ao(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!E(o))return;const u=o.getChildrenSize(),l=t>=u,a=l?o.getChildAtIndex(u-1):o.getChildAtIndex(t);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),e.set(a.__key,c,"text"),n.set(a.__key,c,"text")}}else{if(E(o)){const u=o.getChildrenSize(),l=t>=u,a=l?o.getChildAtIndex(u-1):o.getChildAtIndex(t);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),e.set(a.__key,c,"text")}}if(E(i)){const u=i.getChildrenSize(),l=s>=u,a=l?i.getChildAtIndex(u-1):i.getChildAtIndex(s);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),n.set(a.__key,c,"text")}}}}function wn(r,e,t,n,s){let o=null,i=0,u=null;n!==null?(o=n.__key,P(n)?(i=n.getTextContentSize(),u="text"):E(n)&&(i=n.getChildrenSize(),u="element")):s!==null&&(o=s.__key,P(s)?u="text":E(s)&&(u="element")),o!==null&&u!==null?r.set(o,i,u):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function co(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Ac(r,e,t,n,s,o,i){const u=n.anchorNode,l=n.focusNode,a=n.anchorOffset,c=n.focusOffset,f=document.activeElement;if(s.has("collaboration")&&f!==o||f!==null&&ti(f))return;if(!N(e))return void(r!==null&&Lr(t,u,l)&&n.removeAllRanges());const d=e.anchor,h=e.focus,p=d.key,g=h.key,_=yn(t,p),D=yn(t,g),y=d.offset,C=h.offset,x=e.format,w=e.style,b=e.isCollapsed();let k=_,A=D,S=!1;if(d.type==="text"){k=pn(_);const V=d.getNode();S=V.getFormat()!==x||V.getStyle()!==w}else N(r)&&r.anchor.type==="text"&&(S=!0);var O,L,W,q,I;if(h.type==="text"&&(A=pn(D)),k!==null&&A!==null&&(b&&(r===null||S||N(r)&&(r.format!==x||r.style!==w))&&(O=x,L=w,W=y,q=p,I=performance.now(),Ru=[O,L,W,q,I]),a!==y||c!==C||u!==k||l!==A||n.type==="Range"&&b||(f!==null&&o.contains(f)||o.focus({preventScroll:!0}),d.type==="element"))){try{n.setBaseAndExtent(k,y,A,C)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const V=e instanceof yt&&e.anchor.type==="element"?k.childNodes[y]||null:n.rangeCount>0?n.getRangeAt(0):null;if(V!==null){let re;if(V instanceof Text){const Ee=document.createRange();Ee.selectNode(V),re=Ee.getBoundingClientRect()}else re=V.getBoundingClientRect();(function(Ee,je,_t){const it=_t.ownerDocument,le=it.defaultView;if(le===null)return;let{top:Ne,bottom:Ie}=je,ot=0,ut=0,_e=_t;for(;_e!==null;){const Ye=_e===it.body;if(Ye)ot=0,ut=Rn(Ee).innerHeight;else{const $e=_e.getBoundingClientRect();ot=$e.top,ut=$e.bottom}let ke=0;if(Ne<ot?ke=-(ot-Ne):Ie>ut&&(ke=Ie-ut),ke!==0)if(Ye)le.scrollBy(0,ke);else{const $e=_e.scrollTop;_e.scrollTop+=ke;const Xe=_e.scrollTop-$e;Ne-=Xe,Ie-=Xe}if(Ye)break;_e=Pr(_e)}})(t,re,o)}}Ns=!0}}function Ec(r){let e=j()||jr();e===null&&(e=te().selectEnd()),e.insertNodes(r)}function ps(r){let e=r;r.isCollapsed()||e.removeText();const t=j();N(t)&&(e=t),N(e)||F(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!at(s);)[s,o]=kc(s,o);return o}function kc(r,e){const t=r.getParent();if(!t){const s=ue();return te().append(s),s.select(),[te(),0]}if(P(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(!E(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new yt(Ge(r.__key,e,"element"),Ge(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let ce=null,de=null,be=!1,gs=!1,on=0;const fo={characterData:!0,childList:!0,subtree:!0};function Ir(){return be||ce!==null&&ce._readOnly}function ve(){be&&F(13)}function Ku(){on>99&&F(14)}function nt(){return ce===null&&F(195,Hu()),ce}function ee(){return de===null&&F(196,Hu()),de}function Hu(){let r=0;const e=new Set,t=qn.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=Ln(s);if(ri(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 Sc(){return de}function ho(r,e,t){const n=e.__type,s=function(u,l){const a=u._nodes.get(l);return a===void 0&&F(30,l),a}(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 u=0;u<i&&(o[u](e),e.isAttached());u++);}function po(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Gu(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 Tc(r){return fi(r,ee()._nodes)}function fi(r,e){const t=r.type,n=e.get(t);n===void 0&&F(17,t);const s=n.klass;r.type!==s.getType()&&F(18,s.name);const o=s.importJSON(r),i=r.children;if(E(o)&&Array.isArray(i))for(let u=0;u<i.length;u++){const l=fi(i[u],e);o.append(l)}return o}function go(r,e,t){const n=ce,s=be,o=de;ce=e,be=!0,de=r;try{return t()}finally{ce=n,be=s,de=o}}function ft(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,u=t._selection,l=r._dirtyType!==kt,a=ce,c=be,f=de,d=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){de=r,ce=t,be=!1,r._updating=!0;try{const b=r._dirtyType,k=r._dirtyElements,A=r._dirtyLeaves;h.disconnect(),p=pc(o,t,r,b,k,A)}catch(b){if(b instanceof Error&&r._onError(b),gs)throw b;return Zu(r,null,n,t),mu(r),r._dirtyType=Gt,gs=!0,ft(r,o),void(gs=!1)}finally{h.observe(n,fo),r._updating=d,ce=a,be=c,de=f}}t._readOnly||(t._readOnly=!0);const g=r._dirtyLeaves,_=r._dirtyElements,D=r._normalizedNodes,y=r._updateTags,C=r._deferred;l&&(r._dirtyType=kt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,k){const A=b._decorators;let S=b._pendingDecorators||A;const O=k._nodeMap;let L;for(L in S)O.has(L)||(S===A&&(S=bu(b)),delete S[L])}(r,t);const x=s?null:Be(r._window);if(r._editable&&x!==null&&(l||u===null||u.dirty)){de=r,ce=t;try{if(h!==null&&h.disconnect(),l||u===null||u.dirty){const b=r._blockCursorElement;b!==null&&ui(b,r,n),Ac(i,u,r,x,y,n)}oc(r,n,u),h!==null&&h.observe(n,fo)}finally{de=f,ce=a}}p!==null&&function(b,k,A,S,O){const L=Array.from(b._listeners.mutation),W=L.length;for(let q=0;q<W;q++){const[I,V]=L[q],re=k.get(V);re!==void 0&&I(re,{dirtyLeaves:S,prevEditorState:O,updateTags:A})}}(r,p,y,g,o),N(u)||u===null||i!==null&&i.is(u)||r.dispatchCommand(zs,void 0);const w=r._pendingDecorators;w!==null&&(r._decorators=w,r._pendingDecorators=null,br("decorator",r,!0,w)),function(b,k,A){const S=$i(k),O=$i(A);S!==O&&br("textcontent",b,!0,O)}(r,e||o,t),br("update",r,!0,{dirtyElements:_,dirtyLeaves:g,editorState:t,normalizedNodes:D,prevEditorState:e||o,tags:y}),function(b,k){if(b._deferred=[],k.length!==0){const A=b._updating;b._updating=!0;try{for(let S=0;S<k.length;S++)k[S]()}finally{b._updating=A}}}(r,C),function(b){const k=b._updates;if(k.length!==0){const A=k.shift();if(A){const[S,O]=A;Qu(b,S,O)}}}(r)}function br(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 Ju(r,e,t){if(r._updating===!1||de!==r){let s=!1;return r.update(()=>{s=Ju(r,e,t)}),s}const n=ni(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 u=i[s];if(u!==void 0){const l=Array.from(u),a=l.length;for(let c=0;c<a;c++)if(l[c](t,r)===!0)return!0}}}return!1}function mo(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 u;if(i!==void 0){if(u=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const l=r._pendingEditorState;l===null&&F(191),l._flushSync=!0}u&&r._deferred.push(u),Gu(r,i.tag)}o()}}return n}function Qu(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,Gu(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const u=r._editorState;let l=r._pendingEditorState,a=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Yu(l||u),a=!0),l._flushSync=i;const c=ce,f=be,d=de,h=r._updating;ce=l,be=!1,r._updating=!0,de=r;try{a&&(r._headless?u._selection!==null&&(l._selection=u._selection.clone()):l._selection=function(D){const y=D.getEditorState()._selection,C=Be(D._window);return N(y)||y==null?di(y,C,D,null):y.clone()}(r));const g=r._compositionKey;e(),o=mo(r,o),function(D,y){const C=y.getEditorState()._selection,x=D._selection;if(N(x)){const w=x.anchor,b=x.focus;let k;if(w.type==="text"&&(k=w.getNode(),k.selectionTransform(C,x)),b.type==="text"){const A=b.getNode();k!==A&&A.selectionTransform(C,x)}}}(l,r),r._dirtyType!==kt&&(o?function(D,y){const C=y._dirtyLeaves,x=D._nodeMap;for(const w of C){const b=x.get(w);P(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&ji(b)}}(l,r):function(D,y){const C=y._dirtyLeaves,x=y._dirtyElements,w=D._nodeMap,b=dt(),k=new Map;let A=C,S=A.size,O=x,L=O.size;for(;S>0||L>0;){if(S>0){y._dirtyLeaves=new Set;for(const W of A){const q=w.get(W);P(q)&&q.isAttached()&&q.isSimpleText()&&!q.isUnmergeable()&&ji(q),q!==void 0&&po(q,b)&&ho(y,q,k),C.add(W)}if(A=y._dirtyLeaves,S=A.size,S>0){on++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const W of O){const q=W[0],I=W[1];if(q!=="root"&&!I)continue;const V=w.get(q);V!==void 0&&po(V,b)&&ho(y,V,k),x.set(q,I)}A=y._dirtyLeaves,S=A.size,O=y._dirtyElements,L=O.size,on++}y._dirtyLeaves=C,y._dirtyElements=x}(l,r),mo(r),function(D,y,C,x){const w=D._nodeMap,b=y._nodeMap,k=[];for(const[A]of x){const S=b.get(A);S!==void 0&&(S.isAttached()||(E(S)&&ku(S,A,w,b,k,x),w.has(A)||x.delete(A),k.push(A)))}for(const A of k)b.delete(A);for(const A of C){const S=b.get(A);S===void 0||S.isAttached()||(w.has(A)||C.delete(A),b.delete(A))}}(u,l,r._dirtyLeaves,r._dirtyElements)),g!==r._compositionKey&&(l._flushSync=!0);const _=l._selection;if(N(_)){const D=l._nodeMap,y=_.anchor.key,C=_.focus.key;D.get(y)!==void 0&&D.get(C)!==void 0||F(19)}else Ue(_)&&_._nodes.size===0&&(l._selection=null)}catch(g){return g instanceof Error&&r._onError(g),r._pendingEditorState=u,r._dirtyType=Gt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void ft(r)}finally{ce=c,be=f,de=d,r._updating=h,on=0}r._dirtyType!==kt||function(g,_){const D=_.getEditorState()._selection,y=g._selection;if(y!==null){if(y.dirty||!y.is(D))return!0}else if(D!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,ft(r)):a&&ec(()=>{ft(r)}):(l._flushSync=!1,a&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function we(r,e,t){r._updating?r._updates.push([e,t]):Qu(r,e,t)}class Dr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Dr(this.element,e,this.after)}withAfter(e){return new Dr(this.element,this.before,e)}withElement(e){return new Dr(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&F(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&F(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&F(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"&&(Nr||Nn);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 l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const o=yo(t,n);o.push(s);const i=yo(t,this.element);let u=e.getIndexWithinParent();for(let l=0;l<i.length;l++){const a=o[l],c=i[l];if(a===void 0||a<c)break;if(a>c){u+=1;break}}return[e.getParentOrThrow(),u]}}function yo(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&&F(225),t.reverse()}class st extends jn{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 Wa[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=ee()._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(P(t)&&e.push(t),E(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;E(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;E(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 E(o)&&o.getLastDescendant()||o||null}const s=t[e];return E(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:he(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&F(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:he(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&F(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(),E(o)&&s!==n-1&&!o.isInline()&&(e+=tt)}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(),E(o)&&s!==n-1&&!o.isInline()&&(e+=tt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Oi[e];return!!(this.getFormat()&t)}return!1}select(e,t){ve();const n=j();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(P(l)||E(l))return l.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const l=this.getLastChild();if(P(l)||E(l))return l.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const u=this.__key;return N(n)?(n.anchor.set(u,s,"element"),n.focus.set(u,o,"element"),n.dirty=!0,n):Vu(u,s,u,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!==""?Oi[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||F(226,String(e),String(t),String(o));const u=i.__key,l=[],a=[],c=this.getChildAtIndex(e+t);let f=null,d=o-t+s;if(e!==0)if(e===o)f=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(f=p.getPreviousSibling())}if(t>0){let p=f===null?this.getFirstChild():f.getNextSibling();for(let g=0;g<t;g++){p===null&&F(100);const _=p.getNextSibling(),D=p.__key;At(p.getWritable()),a.push(D),p=_}}let h=f;for(let p=0;p<s;p++){const g=n[p];h!==null&&g.is(h)&&(f=h=h.getPreviousSibling());const _=g.getWritable();_.__parent===u&&d--,At(_);const D=g.__key;if(h===null)i.__first=D,_.__prev=null;else{const y=h.getWritable();y.__next=D,_.__prev=y.__key}g.__key===u&&F(76),_.__parent=u,l.push(D),h=g}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const g=h.getWritable();p.__prev=h.__key,g.__next=c.__key}else p.__prev=null}if(i.__size=d,a.length){const p=j();if(N(p)){const g=new Set(a),_=new Set(l),{anchor:D,focus:y}=p;_o(D,g,_)&&wn(D,D.getNode(),this,f,c),_o(y,g,_)&&wn(y,y.getNode(),this,f,c),d!==0||this.canBeEmpty()||He(this)||this.remove()}}return i}getDOMSlot(e){return new Dr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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 E(r){return r instanceof st}function _o(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 Bc extends jn{constructor(e){super(e)}decorate(e,t){F(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Y(r){return r instanceof Bc}class $r extends st{static getType(){return"root"}static clone(){return new $r}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){F(51)}getTextContent(){const e=this.__cachedText;return!Ir()&&ee()._dirtyType!==kt||e===null?super.getTextContent():e}remove(){F(52)}replace(e){F(53)}insertBefore(e){F(54)}insertAfter(e){F(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];E(n)||Y(n)||F(56)}return super.append(...e)}static importJSON(e){const t=te();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 me(r){return r instanceof $r}function Yu(r){return new $n(new Map(r._nodeMap))}function hi(){return new $n(new Map([["root",new $r]]))}function Xu(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&F(130,t.name),E(r)){const n=e.children;Array.isArray(n)||F(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=Xu(s[o]);n.push(i)}}return e}class $n{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 go(t&&t.editor||null,this,e)}clone(e){const t=new $n(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return go(null,this,()=>({root:Xu(te())}))}}class pi extends st{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Xt extends st{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=St[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return gn(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 Xt(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=yr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Nc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=ue();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=ue();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||P(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 Nc(r){const e=ue();return r.style&&(e.setFormat(r.style.textAlign),ai(r,e)),{node:e}}function ue(){return Qe(new Xt)}function Qt(r){return r instanceof Xt}const J=0,Ut=1,Fc=4;function Zu(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=hi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=kt,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 Lc(r){const e=r||{},t=Sc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=hi(),u=e.namespace||(s!==null?s._config.namespace:wu()),l=e.editorState,a=[$r,Yt,Or,Rr,Xt,pi,...e.nodes||[]],{onError:c,html:f}=e,d=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let g=0;g<a.length;g++){let _=a[g],D=null,y=null;if(typeof _!="function"){const b=_;_=b.replace,D=b.with,y=b.withKlass||null}const C=_.getType(),x=_.transform(),w=new Set;x!==null&&w.add(x),h.set(C,{exportDOM:f&&f.export?f.export.get(_):void 0,klass:_,replace:D,replaceWithKlass:y,transforms:w})}}const p=new qn(i,s,h,{disableEvents:o,namespace:u,theme:n},c||console.error,function(g,_){const D=new Map,y=new Set,C=x=>{Object.keys(x).forEach(w=>{let b=D.get(w);b===void 0&&(b=[],D.set(w,b)),b.push(x[w])})};return g.forEach(x=>{const w=x.klass.importDOM;if(w==null||y.has(w))return;y.add(w);const b=w.call(x.klass);b!==null&&C(b)}),_&&C(_),D}(h,f?f.import:void 0),d);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Gt),p}class qn{constructor(e,t,n,s,o,i,u){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=kt,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=wu(),this._onError=o,this._htmlConversions=i,this._editable=u,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&&F(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&&F(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(u=>u.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&&F(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=cc(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 l=this.registerNodeTransformToKlass(o,t);s.push(l)}var i,u;return i=this,u=e.getType(),we(i,()=>{const l=nt();if(l.isEmpty())return;if(u==="root")return void te().markDirty();const a=l._nodeMap;for(const[,c]of a)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return R(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=yr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Zu(this,t,e,s),t!==null&&(this._config.disableEvents||gc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(u){const l=u.ownerDocument;return l&&l.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=Gt,mu(this),this._updateTags.add("history-merge"),ft(this),this._config.disableEvents||function(u,l){const a=u.ownerDocument,c=Dn.get(a);(c===void 0||c<1)&&a.addEventListener("selectionchange",$u),Dn.set(a,(c||0)+1),u.__lexicalEditor=l;const f=Iu(u);for(let d=0;d<Bs.length;d++){const[h,p]=Bs[d],g=typeof p=="function"?_=>{Zi(_)||(Xi(_),(l.isEditable()||h==="click")&&p(_,l))}:_=>{if(Zi(_))return;Xi(_);const D=l.isEditable();switch(h){case"cut":return D&&R(l,Vs,_);case"copy":return R(l,Bn,_);case"paste":return D&&R(l,Tn,_);case"dragstart":return D&&R(l,lu,_);case"dragover":return D&&R(l,au,_);case"dragend":return D&&R(l,ka,_);case"focus":return D&&R(l,Ba,_);case"blur":return D&&R(l,Na,_);case"drop":return D&&R(l,uu,_)}};u.addEventListener(h,g),f.push(()=>{u.removeEventListener(h,g)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;br("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&F(38);let n=e;n._readOnly&&(n=Yu(e),n._selection=e._selection?e._selection.clone():null),gu(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),ft(this)),this._pendingEditorState=n,this._dirtyType=Gt,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||ft(this)}parseEditorState(e,t){return function(n,s,o){const i=hi(),u=ce,l=be,a=de,c=s._dirtyElements,f=s._dirtyLeaves,d=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,ce=i,be=!1,de=s;try{const p=s._nodes;fi(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=f,s._cloneNotNeeded=d,s._dirtyType=h,ce=u,be=l,de=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return ft(this),this.getEditorState().read(e,{editor:this})}update(e,t){we(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),we(this,()=>{const s=j(),o=te();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=Be(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,br("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}qn.version="0.21.0+prod.esm";const el=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pc=el?T.useLayoutEffect:T.useEffect,Zr={tag:"history-merge"};function Oc({initialConfig:r,children:e}){const t=T.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:u,html:l}=r,a=ya(null,n),c=Lc({editable:r.editable,html:l,namespace:s,nodes:o,onError:f=>i(f,c),theme:n});return function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const h=te();if(h.isEmpty()){const p=ue();h.append(p);const g=el?document.activeElement:null;(j()!==null||g!==null&&g===f.getRootElement())&&p.select()}},Zr);else if(d!==null)switch(typeof d){case"string":{const h=f.parseEditorState(d);f.setEditorState(h,Zr);break}case"object":f.setEditorState(d,Zr);break;case"function":f.update(()=>{te().isEmpty()&&d(f)},Zr)}}}(c,u),[c,a]},[]);return Pc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),v.jsx(Xo.Provider,{value:t,children:e})}const Rc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function Mc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function jc(){return function(r){const[e]=Je(),t=T.useMemo(()=>r(e),[e,r]),[n,s]=T.useState(()=>t.initialValueFn()),o=T.useRef(n);return Rc(()=>{const{initialValueFn:i,subscribe:u}=t,l=i();return o.current!==l&&(o.current=l,s(l)),u(a=>{o.current=a,s(a)})},[t,r]),n}(Mc)}function Ic(){return te().getTextContent()}function $c(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!$c(r,!1))return!1;const e=te().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Y(s))return!1;if(E(s)){if(!Qt(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let u=0;u<i;u++){const l=o[n];if(!P(l))return!1}}}return!0}function tl(r){return()=>qc(r)}function zc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}zc(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 Uc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wc=Uc(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 Vc=new Map;function Kc(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 rl(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(),u=s.getNode(),l=e.is(i),a=e.is(u);if(l||a){const[c,f]=Ps(r),d=i.is(u),h=e.is(o?u:i),p=e.is(o?i:u);let g,_=0;return d?(_=c>f?f:c,g=c>f?c:f):h?(_=o?f:c,g=void 0):p&&(_=0,g=o?c:f),e.__text=e.__text.slice(_,g),e}}return e}function Hc(r){const e=r.getStyle(),t=Kc(e);Vc.set(e,t)}function Gc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),u=te(),l=u.getFirstChild();return void(l?l.replace(i,!0):u.append(i))}const s=r.getNodes(),o=n!==null&&function(i,u){let l=i;for(;l!==null&&l.getParent()!==null&&!u(l);)l=l.getParentOrThrow();return u(l)?l:null}(n.getNode(),bo);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const u=s[i];if(!bo(u))continue;E(u)||Wc(178);const l=e();l.setFormat(u.getFormatType()),l.setIndent(u.getIndent()),u.replace(l,!0)}}function xo(r,e){const t=Er(r.focus,e);return Y(t)&&!t.isIsolated()||E(t)&&!t.isInline()&&!t.canBeEmpty()}function Jc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Qc(r){const e=r.anchor.getNode();return(me(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function vo(r,e,t){const n=Qc(r);Jc(r,e,t?!n:n,"character")}function bo(r){if(Y(r)||!E(r)||He(r))return!1;const e=r.getFirstChild(),t=e===null||Et(e)||P(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Yc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Xc=Yc(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 nl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Zc=nl&&"documentMode"in document?document.documentMode:null;!(!nl||!("InputEvent"in window)||Zc)&&"getTargetRanges"in new window.InputEvent("input");function sl(...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 Ft(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function qr(r,...e){const t=sl(...e);t.length>0&&r.classList.add(...t)}function il(r,...e){const t=sl(...e);t.length>0&&r.classList.remove(...t)}function ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function td(r){const e=zn(r,t=>E(t)&&!t.isInline());return E(e)||Xc(4,r.__key),e}const zn=(r,e)=>{let t=r;for(;t!==te()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function ht(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function rd(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 u=i.payload;if(u&&u.functionId==="makeChanges"){const l=u.args;if(l){const[a,c,f,d,h,p]=l;r.update(()=>{const g=j();if(N(g)){const _=g.anchor;let D=_.getNode(),y=0,C=0;if(P(D)&&a>=0&&c>=0&&(y=a,C=a+c,g.setTextNodeRange(D,y,D,C)),y===C&&f===""||(g.insertRawText(f),D=_.getNode()),P(D)){y=d,C=d+h;const x=D.getTextContentSize();y=y>x?x:y,C=C>x?x:C,g.setTextNodeRange(D,y,D,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function ol(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(!al.has(i.nodeName)){const u=cl(i,r,s,!1);u!==null&&(n=n.concat(u))}}return function(o){for(const i of o)i.getNextSibling()instanceof pi&&i.insertAfter(Bt());for(const i of o){const u=i.getChildren();for(const l of u)i.insertBefore(l);i.remove()}}(s),n}function ul(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=te().getChildren();for(let s=0;s<n.length;s++)ll(r,n[s],t,e);return t.innerHTML}function ll(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=E(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=li(e);h=P(h)&&n!==null?rl(n,h):h,i=h}const u=E(i)?i.getChildren():[],l=r._nodes.get(i.getType());let a;a=l&&l.exportDOM!==void 0?l.exportDOM(r,i):i.exportDOM(r);const{element:c,after:f}=a;if(!c)return!1;const d=document.createDocumentFragment();for(let h=0;h<u.length;h++){const p=u[h],g=ll(r,p,d,n);!s&&E(e)&&g&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((rt(c)||Hi(c))&&c.append(d),t.append(c),f){const h=f.call(i,c);h&&(Hi(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(d);return s}const al=new Set(["STYLE","SCRIPT"]);function cl(r,e,t,n,s=new Map,o){let i=[];if(al.has(r.nodeName))return i;let u=null;const l=function(p,g){const{nodeName:_}=p,D=g._htmlConversions.get(_.toLowerCase());let y=null;if(D!==void 0)for(const C of D){const x=C(p);x!==null&&(y===null||(y.priority||0)<=(x.priority||0))&&(y=x)}return y!==null?y.conversion:null}(r,e),a=l?l(r):null;let c=null;if(a!==null){c=a.after;const p=a.node;if(u=Array.isArray(p)?p[p.length-1]:p,u!==null){for(const[,g]of s)if(u=g(u,o),!u)break;u&&i.push(...Array.isArray(p)?p:[u])}a.forChild!=null&&s.set(r.nodeName,a.forChild)}const f=r.childNodes;let d=[];const h=(u==null||!He(u))&&(u!=null&&Os(u)||n);for(let p=0;p<f.length;p++)d.push(...cl(f[p],e,t,h,new Map(s),u));return c!=null&&(d=c(d)),_n(r)&&(d=nd(r,d,h?()=>{const p=new pi;return t.push(p),p}:ue)),u==null?d.length>0?i=i.concat(d):_n(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ds(p.nextSibling)&&Ds(p.previousSibling)}(r)&&(i=i.concat(Bt())):E(u)&&u.append(...d),i}function nd(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const u=e[i];if(Os(u))n&&!u.getFormat()&&u.setFormat(n),s.push(u);else if(o.push(u),i===e.length-1||i<e.length-1&&Os(e[i+1])){const l=t();l.setFormat(n),l.append(...o),s.push(l),o=[]}}return s}function sd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var An=sd(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 id(r,e=j()){return e==null&&An(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?"":ul(r,e)}function od(r,e=j()){return e==null&&An(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ud(r,e))}function Do(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 Co(t,ld(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(u){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(u):u}(s),"text/html");return Co(t,ol(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(N(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let u=0;u<i.length;u++){const l=j();if(N(l)){const a=i[u];a===`
|
|
71
|
+
`?n.push(Bt()):i===" "?n.push(Mr()):n.push(ae(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,u=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,u=t),i.type==="element"&&function(_,D,y,C){const x=_.getNode(),w=x.getChildAtIndex(_.offset),b=ae(),k=me(x)?ue().append(b):b;b.setFormat(y),b.setStyle(C),w===null?x.append(k):w.insertBefore(k),_.is(D)&&D.set(b.__key,0,"text"),_.set(b.__key,0,"text")}(i,u,s,o);const l=i.offset;let a=u.offset;const c=this.getNodes(),f=c.length;let d=c[0];P(d)||F(26);const h=d.getTextContent().length,p=d.getParentOrThrow();let g=c[f-1];if(f===1&&u.type==="element"&&(a=h,u.set(i.key,a,"text")),this.isCollapsed()&&l===h&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let _=d.getNextSibling();if(P(_)&&_.canInsertTextBefore()&&!Dt(_)||(_=ae(),_.setFormat(s),_.setStyle(o),p.canInsertTextAfter()?d.insertAfter(_):p.insertAfter(_)),_.select(0,0),d=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let _=d.getPreviousSibling();if(P(_)&&!Dt(_)||(_=ae(),_.setFormat(s),p.canInsertTextBefore()?d.insertBefore(_):p.insertBefore(_)),_.select(),d=_,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const _=ae(d.getTextContent());_.setFormat(s),d.replace(_),d=_}else if(!this.isCollapsed()&&e!==""){const _=g.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||E(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Uu(this.anchor,this.focus,null),void this.insertText(e)}if(f===1){if(d.isToken()){const C=ae(e);return C.select(),void d.replace(C)}const _=d.getFormat(),D=d.getStyle();if(l!==a||_===s&&D===o){if(Dc(d)){const C=ae(e);return C.setFormat(s),C.setStyle(o),C.select(),void d.replace(C)}}else{if(d.getTextContent()!==""){const C=ae(e);if(C.setFormat(s),C.setStyle(o),C.select(),l===0)d.insertBefore(C,!1);else{const[x]=d.splitText(l);x.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(s),d.setStyle(o)}const y=a-l;d=d.spliceText(l,y,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=D))}else{const _=new Set([...d.getParentKeys(),...g.getParentKeys()]),D=E(d)?d:d.getParentOrThrow();let y=E(g)?g:g.getParentOrThrow(),C=g;if(!D.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(u.type==="text"&&(a!==0||g.getTextContent()==="")||u.type==="element"&&g.getIndexWithinParent()<a)if(P(g)&&!g.isToken()&&a!==g.getTextContentSize()){if(g.isSegmented()){const A=ae(g.getTextContent());g.replace(A),g=A}me(u.getNode())||u.type!=="text"||(g=g.spliceText(0,a,"")),_.add(g.__key)}else{const A=g.getParentOrThrow();A.canBeEmpty()||A.getChildrenSize()!==1?g.remove():A.remove()}else _.add(g.__key);const x=y.getChildren(),w=new Set(c),b=D.is(y),k=D.isInline()&&d.getNextSibling()===null?D:d;for(let A=x.length-1;A>=0;A--){const S=x[A];if(S.is(d)||E(S)&&S.isParentOf(d))break;S.isAttached()&&(!w.has(S)||S.is(C)?b||k.insertAfter(S,!1):S.remove())}if(!b){let A=y,S=null;for(;A!==null;){const O=A.getChildren(),L=O.length;(L===0||O[L-1].is(S))&&(_.delete(A.__key),S=A),A=A.getParent()}}if(d.isToken())if(l===h)d.select();else{const A=ae(e);A.select(),d.replace(A)}else d=d.spliceText(l,h-l,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let A=1;A<f;A++){const S=c[A],O=S.__key;_.has(O)||S.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(),u=o.getNode();const l=ur(i,at),a=ur(u,at);P(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&P(u)&&u.isToken()&&(o.offset=u.getTextContentSize()),n.forEach(f=>{_r(i,f)||_r(u,f)||f.getKey()===i.getKey()||f.getKey()===u.getKey()||f.remove()});const c=(f,d)=>{if(f.getTextContent()==="")f.remove();else if(d!==0&&Dt(f)){const h=ae(f.getTextContent());return h.setFormat(f.getFormat()),h.setStyle(f.getStyle()),f.replace(h)}};if(i===u&&P(i)){const f=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,f,"",!0),void c(i,f)}if(P(i)){const f=i.getTextContentSize()-s.offset;i.spliceText(s.offset,f,""),i=c(i,f)||i}P(u)&&(u.spliceText(0,o.offset,""),u=c(u,o.offset)||u),i.isAttached()&&P(i)?i.selectEnd():u.isAttached()&&P(u)&&u.selectStart(),E(l)&&E(a)&&l!==a&&(l.append(...a.getChildren()),a.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void fe(null);const n=this.getNodes(),s=[];for(const x of n)P(x)&&s.push(x);const o=x=>{n.forEach(w=>{if(Qt(w)){const b=w.getFormatFlags(e,x);w.setTextFormat(b)}})},i=s.length;if(i===0)return this.toggleFormat(e),fe(null),void o(t);const u=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:u,f=a?u:l;let d=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(d=1,h=s[1],p=0),h==null)return;const g=h.getFormatFlags(e,t);o(g);const _=i-1;let D=s[_];const y=f.type==="text"?f.offset:D.getTextContentSize();if(h.is(D)){if(p===y)return;if(Dt(h)||p===0&&y===h.getTextContentSize())h.setFormat(g);else{const x=h.splitText(p,y),w=p===0?x[0]:x[1];w.setFormat(g),c.type==="text"&&c.set(w.__key,0,"text"),f.type==="text"&&f.set(w.__key,y-p,"text")}return void(this.format=g)}p===0||Dt(h)||([,h]=h.splitText(p),p=0),h.setFormat(g);const C=D.getFormatFlags(e,g);y>0&&(y===D.getTextContentSize()||Dt(D)||([D]=D.splitText(y)),D.setFormat(C));for(let x=d+1;x<_;x++){const w=s[x],b=w.getFormatFlags(e,C);w.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),f.type==="text"&&f.set(D.__key,y,"text"),this.format=g|C}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=j();return N(p)||F(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=ur(t,at),s=e[e.length-1];if(E(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=ps(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(E(p)||Y(p))&&!p.isInline())){E(n)||F(211,t.constructor.name,t.getType());const p=ps(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const g=ue();let _=null;for(let D=0;D<p.length;D++){const y=p[D],C=Et(y);if(C||Y(y)&&y.isInline()||E(y)&&y.isInline()||P(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),g.append(_),C))continue;_!==null&&_.append(y)}else g.append(y),_=null}return g}(e),i=o.getLastDescendant(),u=o.getChildren(),l=!E(n)||!n.isEmpty()?this.insertParagraph():null,a=u[u.length-1];let c=u[0];var f;E(f=c)&&at(f)&&!f.isEmpty()&&E(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(E(n)||F(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=u[1]),c&&(n===null&&F(212,t.constructor.name,t.getType()),function(p,g,_){const D=g.getParentOrThrow().getLastChild();let y=g;const C=[g];for(;y!==D;)y.getNextSibling()||F(140),y=y.getNextSibling(),C.push(y);let x=p;for(const w of C)x=x.insertAfter(w)}(n,c));const d=ur(i,at);l&&E(d)&&(l.canMergeWhenEmpty()||at(a))&&(d.append(...l.getChildren()),l.remove()),E(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=E(n)?n.getLastChild():null;Et(h)&&d!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ue();return te().splice(this.anchor.offset,0,[i]),i.select(),i}const e=ps(this),t=ur(this.anchor.getNode(),at);E(t)||F(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=Bt();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],u=e[n];const[l,a]=Ps(this);if(t===0)return[];if(t===1){if(P(i)&&!this.isCollapsed()){const f=l>a?a:l,d=l>a?l:a,h=i.splitText(f,d),p=f===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(P(i)){const f=c?l:a;f===i.getTextContentSize()?e.shift():f!==0&&([,i]=i.splitText(f),e[0]=i)}if(P(u)){const f=u.getTextContent().length,d=c?a:l;d===0?e.pop():d!==f&&([u]=u.splitText(d),e[n]=u)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",u=Er(s,t);if(Y(u)&&!u.isIsolated()){if(i&&u.isKeyboardSelectable()){const h=lo();return h.add(u.__key),void Ke(h)}const d=t?u.getPreviousSibling():u.getNextSibling();if(P(d)){const h=d.__key,p=t?d.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=u.getParentOrThrow();let p,g;return E(d)?(g=d.__key,p=t?d.getChildrenSize():0):(p=u.getIndexWithinParent(),g=h.__key,t||p++),s.set(g,p,"element"),void(i&&o.set(g,p,"element"))}}const l=ee(),a=Be(l._window);if(!a)return;const c=l._blockCursorElement,f=l._rootElement;if(f===null||c===null||!E(u)||u.isInline()||u.canBeEmpty()||ui(c,l,f),function(d,h,p,g){d.modify(h,p,g)}(a,e,t?"backward":"forward",n),a.rangeCount>0){const d=a.getRangeAt(0),h=this.anchor.getNode(),p=me(h)?h:ic(h);if(this.applyDOMRange(d),this.dirty=!0,!i){const g=this.getNodes(),_=[];let D=!1;for(let y=0;y<g.length;y++){const C=g[y];_r(C,p)?_.push(C):D=!0}if(D&&_.length>0)if(t){const y=_[0];E(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=_[_.length-1];E(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===d.startContainer&&a.anchorOffset===d.startOffset||function(y){const C=y.focus,x=y.anchor,w=x.key,b=x.offset,k=x.type;ct(x,C.key,C.offset,C.type),ct(C,w,b,k),y._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&E(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(E(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=Er(o,e);if(Y(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&E(s)&&s.getChildrenSize()===0){s.remove();const u=lo();u.add(i.__key),Ke(u)}else i.remove(),ee().dispatchCommand(zs,void 0);return}if(!e&&E(i)&&E(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 u=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,u!==null&&u.isSegmented()){const l=o.offset,a=u.getTextContentSize();if(u.is(s)||e&&l!==a||!e&&l!==0)return void io(u,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,a=s.getTextContentSize();if(s.is(u)||e&&l!==0||!e&&l!==a)return void io(s,e,l)}(function(l,a){const c=l.anchor,f=l.focus,d=c.getNode(),h=f.getNode();if(d===h&&c.type==="text"&&f.type==="text"){const p=c.offset,g=f.offset,_=p<g,D=_?p:g,y=_?g:p,C=y-1;D!==C&&(Cu(d.getTextContent().slice(D,y))||(a?f.offset=C:c.offset=C))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&me(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 Ue(r){return r instanceof In}function so(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Ps(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]:[so(t),so(n)]}function io(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,u=0;for(let a=0;a<o;a++){const c=a===o-1;if(u=i,i+=s[a].length,e&&i===t||i>t||c){s.splice(a,1),c&&(u=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(u,u))}function oo(r,e,t,n){let s,o=e;if(r.nodeType===Fr){let i=!1;const u=r.childNodes,l=u.length,a=n._blockCursorElement;o===l&&(i=!0,o=l-1);let c=u[o],f=!1;if(c===a)c=u[o+1],f=!0;else if(a!==null){const d=a.parentNode;r===d&&e>Array.prototype.indexOf.call(d.children,a)&&o--}if(s=zt(c),P(s))o=qi(s,i);else{let d=zt(r);if(d===null)return null;if(E(d)){const h=n.getElementByKey(d.getKey());h===null&&F(214),[d,o]=d.getDOMSlot(h).resolveChildIndex(d,h,r,e),E(d)||F(215),i&&o>=d.getChildrenSize()&&(o=Math.max(0,d.getChildrenSize()-1));let g=d.getChildAtIndex(o);if(E(g)&&function(_,D,y){const C=_.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()}(g,0,t)){const _=i?g.getLastDescendant():g.getFirstDescendant();_===null?d=g:(g=_,d=E(g)?g:g.getParentOrThrow()),o=0}P(g)?(s=g,d=null,o=qi(g,i)):g!==d&&i&&!f&&(E(d)||F(216),o=Math.min(d.getChildrenSize(),o+1))}else{const h=d.getIndexWithinParent();o=e===0&&Y(d)&&zt(r)===d?h:h+1,d=d.getParentOrThrow()}if(E(d))return Ge(d.__key,o,"element")}}else s=zt(r);return P(s)?Ge(s.__key,o,"text"):null}function uo(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&&E(i)&&i.isInline()){const u=i.getPreviousSibling();P(u)&&(r.key=u.__key,r.offset=u.getTextContent().length)}}else E(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):P(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&&E(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&E(i)&&i.isInline()&&!i.canInsertTextAfter()){const u=i.getNextSibling();P(u)&&(r.key=u.__key,r.offset=0)}}}function Uu(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);uo(r,n,s),uo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=ee();if(o.isComposing()&&o._compositionKey!==r.key&&N(t)){const i=t.anchor,u=t.focus;ct(r,i.key,i.offset,i.type),ct(e,u.key,u.offset,u.type)}}}function Wu(r,e,t,n,s,o){if(r===null||t===null||!Lr(s,r,t))return null;const i=oo(r,e,N(o)?o.anchor:null,s);if(i===null)return null;const u=oo(t,n,N(o)?o.focus:null,s);if(u===null)return null;if(i.type==="element"&&u.type==="element"){const l=zt(r),a=zt(t);if(Y(l)&&Y(a))return null}return Uu(i,u,o),[i,u]}function Os(r){return E(r)&&!r.isInline()}function Vu(r,e,t,n,s,o){const i=nt(),u=new yt(Ge(r,e,s),Ge(t,n,o),0,"");return u.dirty=!0,i._selection=u,u}function wc(){const r=Ge("root",0,"element"),e=Ge("root",0,"element");return new yt(r,e,0,"")}function lo(){return new In(new Set)}function di(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,u=i==="selectionchange",l=!bs&&(u||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let a,c,f,d;if(N(r)&&!l)return r.clone();if(e===null)return null;if(a=e.anchorNode,c=e.focusNode,f=e.anchorOffset,d=e.focusOffset,u&&N(r)&&!Lr(t,a,c))return r.clone();const h=Wu(a,f,c,d,t,r);if(h===null)return null;const[p,g]=h;return new yt(p,g,N(r)?r.format:0,N(r)?r.style:"")}function j(){return nt()._selection}function jr(){return ee()._editorState._selection}function Cn(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),u=o.getNode();if(!e.is(i)&&!e.is(u))return;const l=e.__key;if(r.isCollapsed()){const a=s.offset;if(t<=a&&n>0||t<a&&n<0){const c=Math.max(0,a+n);s.set(l,c,"element"),o.set(l,c,"element"),ao(r)}}else{const a=r.isBackward(),c=a?o:s,f=c.getNode(),d=a?s:o,h=d.getNode();if(e.is(f)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=d.offset;(t<=p&&n>0||t<p&&n<0)&&d.set(l,Math.max(0,p+n),"element")}}ao(r)}function ao(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!E(o))return;const u=o.getChildrenSize(),l=t>=u,a=l?o.getChildAtIndex(u-1):o.getChildAtIndex(t);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),e.set(a.__key,c,"text"),n.set(a.__key,c,"text")}}else{if(E(o)){const u=o.getChildrenSize(),l=t>=u,a=l?o.getChildAtIndex(u-1):o.getChildAtIndex(t);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),e.set(a.__key,c,"text")}}if(E(i)){const u=i.getChildrenSize(),l=s>=u,a=l?i.getChildAtIndex(u-1):i.getChildAtIndex(s);if(P(a)){let c=0;l&&(c=a.getTextContentSize()),n.set(a.__key,c,"text")}}}}function wn(r,e,t,n,s){let o=null,i=0,u=null;n!==null?(o=n.__key,P(n)?(i=n.getTextContentSize(),u="text"):E(n)&&(i=n.getChildrenSize(),u="element")):s!==null&&(o=s.__key,P(s)?u="text":E(s)&&(u="element")),o!==null&&u!==null?r.set(o,i,u):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function co(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Ac(r,e,t,n,s,o,i){const u=n.anchorNode,l=n.focusNode,a=n.anchorOffset,c=n.focusOffset,f=document.activeElement;if(s.has("collaboration")&&f!==o||f!==null&&ti(f))return;if(!N(e))return void(r!==null&&Lr(t,u,l)&&n.removeAllRanges());const d=e.anchor,h=e.focus,p=d.key,g=h.key,_=yn(t,p),D=yn(t,g),y=d.offset,C=h.offset,x=e.format,w=e.style,b=e.isCollapsed();let k=_,A=D,S=!1;if(d.type==="text"){k=pn(_);const V=d.getNode();S=V.getFormat()!==x||V.getStyle()!==w}else N(r)&&r.anchor.type==="text"&&(S=!0);var O,L,W,q,I;if(h.type==="text"&&(A=pn(D)),k!==null&&A!==null&&(b&&(r===null||S||N(r)&&(r.format!==x||r.style!==w))&&(O=x,L=w,W=y,q=p,I=performance.now(),Ru=[O,L,W,q,I]),a!==y||c!==C||u!==k||l!==A||n.type==="Range"&&b||(f!==null&&o.contains(f)||o.focus({preventScroll:!0}),d.type==="element"))){try{n.setBaseAndExtent(k,y,A,C)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const V=e instanceof yt&&e.anchor.type==="element"?k.childNodes[y]||null:n.rangeCount>0?n.getRangeAt(0):null;if(V!==null){let re;if(V instanceof Text){const Ee=document.createRange();Ee.selectNode(V),re=Ee.getBoundingClientRect()}else re=V.getBoundingClientRect();(function(Ee,Me,_t){const it=_t.ownerDocument,le=it.defaultView;if(le===null)return;let{top:je,bottom:Ie}=Me,ot=0,ut=0,_e=_t;for(;_e!==null;){const Ye=_e===it.body;if(Ye)ot=0,ut=Rn(Ee).innerHeight;else{const $e=_e.getBoundingClientRect();ot=$e.top,ut=$e.bottom}let ke=0;if(je<ot?ke=-(ot-je):Ie>ut&&(ke=Ie-ut),ke!==0)if(Ye)le.scrollBy(0,ke);else{const $e=_e.scrollTop;_e.scrollTop+=ke;const Xe=_e.scrollTop-$e;je-=Xe,Ie-=Xe}if(Ye)break;_e=Pr(_e)}})(t,re,o)}}Ns=!0}}function Ec(r){let e=j()||jr();e===null&&(e=te().selectEnd()),e.insertNodes(r)}function ps(r){let e=r;r.isCollapsed()||e.removeText();const t=j();N(t)&&(e=t),N(e)||F(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!at(s);)[s,o]=kc(s,o);return o}function kc(r,e){const t=r.getParent();if(!t){const s=ue();return te().append(s),s.select(),[te(),0]}if(P(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(!E(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new yt(Ge(r.__key,e,"element"),Ge(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let ce=null,de=null,be=!1,gs=!1,on=0;const fo={characterData:!0,childList:!0,subtree:!0};function Ir(){return be||ce!==null&&ce._readOnly}function ve(){be&&F(13)}function Ku(){on>99&&F(14)}function nt(){return ce===null&&F(195,Hu()),ce}function ee(){return de===null&&F(196,Hu()),de}function Hu(){let r=0;const e=new Set,t=qn.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=Ln(s);if(ri(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 Sc(){return de}function ho(r,e,t){const n=e.__type,s=function(u,l){const a=u._nodes.get(l);return a===void 0&&F(30,l),a}(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 u=0;u<i&&(o[u](e),e.isAttached());u++);}function po(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Gu(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 Tc(r){return fi(r,ee()._nodes)}function fi(r,e){const t=r.type,n=e.get(t);n===void 0&&F(17,t);const s=n.klass;r.type!==s.getType()&&F(18,s.name);const o=s.importJSON(r),i=r.children;if(E(o)&&Array.isArray(i))for(let u=0;u<i.length;u++){const l=fi(i[u],e);o.append(l)}return o}function go(r,e,t){const n=ce,s=be,o=de;ce=e,be=!0,de=r;try{return t()}finally{ce=n,be=s,de=o}}function ft(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,u=t._selection,l=r._dirtyType!==kt,a=ce,c=be,f=de,d=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){de=r,ce=t,be=!1,r._updating=!0;try{const b=r._dirtyType,k=r._dirtyElements,A=r._dirtyLeaves;h.disconnect(),p=pc(o,t,r,b,k,A)}catch(b){if(b instanceof Error&&r._onError(b),gs)throw b;return Zu(r,null,n,t),mu(r),r._dirtyType=Gt,gs=!0,ft(r,o),void(gs=!1)}finally{h.observe(n,fo),r._updating=d,ce=a,be=c,de=f}}t._readOnly||(t._readOnly=!0);const g=r._dirtyLeaves,_=r._dirtyElements,D=r._normalizedNodes,y=r._updateTags,C=r._deferred;l&&(r._dirtyType=kt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,k){const A=b._decorators;let S=b._pendingDecorators||A;const O=k._nodeMap;let L;for(L in S)O.has(L)||(S===A&&(S=bu(b)),delete S[L])}(r,t);const x=s?null:Be(r._window);if(r._editable&&x!==null&&(l||u===null||u.dirty)){de=r,ce=t;try{if(h!==null&&h.disconnect(),l||u===null||u.dirty){const b=r._blockCursorElement;b!==null&&ui(b,r,n),Ac(i,u,r,x,y,n)}oc(r,n,u),h!==null&&h.observe(n,fo)}finally{de=f,ce=a}}p!==null&&function(b,k,A,S,O){const L=Array.from(b._listeners.mutation),W=L.length;for(let q=0;q<W;q++){const[I,V]=L[q],re=k.get(V);re!==void 0&&I(re,{dirtyLeaves:S,prevEditorState:O,updateTags:A})}}(r,p,y,g,o),N(u)||u===null||i!==null&&i.is(u)||r.dispatchCommand(zs,void 0);const w=r._pendingDecorators;w!==null&&(r._decorators=w,r._pendingDecorators=null,br("decorator",r,!0,w)),function(b,k,A){const S=$i(k),O=$i(A);S!==O&&br("textcontent",b,!0,O)}(r,e||o,t),br("update",r,!0,{dirtyElements:_,dirtyLeaves:g,editorState:t,normalizedNodes:D,prevEditorState:e||o,tags:y}),function(b,k){if(b._deferred=[],k.length!==0){const A=b._updating;b._updating=!0;try{for(let S=0;S<k.length;S++)k[S]()}finally{b._updating=A}}}(r,C),function(b){const k=b._updates;if(k.length!==0){const A=k.shift();if(A){const[S,O]=A;Qu(b,S,O)}}}(r)}function br(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 Ju(r,e,t){if(r._updating===!1||de!==r){let s=!1;return r.update(()=>{s=Ju(r,e,t)}),s}const n=ni(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 u=i[s];if(u!==void 0){const l=Array.from(u),a=l.length;for(let c=0;c<a;c++)if(l[c](t,r)===!0)return!0}}}return!1}function mo(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 u;if(i!==void 0){if(u=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const l=r._pendingEditorState;l===null&&F(191),l._flushSync=!0}u&&r._deferred.push(u),Gu(r,i.tag)}o()}}return n}function Qu(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,Gu(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const u=r._editorState;let l=r._pendingEditorState,a=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Yu(l||u),a=!0),l._flushSync=i;const c=ce,f=be,d=de,h=r._updating;ce=l,be=!1,r._updating=!0,de=r;try{a&&(r._headless?u._selection!==null&&(l._selection=u._selection.clone()):l._selection=function(D){const y=D.getEditorState()._selection,C=Be(D._window);return N(y)||y==null?di(y,C,D,null):y.clone()}(r));const g=r._compositionKey;e(),o=mo(r,o),function(D,y){const C=y.getEditorState()._selection,x=D._selection;if(N(x)){const w=x.anchor,b=x.focus;let k;if(w.type==="text"&&(k=w.getNode(),k.selectionTransform(C,x)),b.type==="text"){const A=b.getNode();k!==A&&A.selectionTransform(C,x)}}}(l,r),r._dirtyType!==kt&&(o?function(D,y){const C=y._dirtyLeaves,x=D._nodeMap;for(const w of C){const b=x.get(w);P(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&ji(b)}}(l,r):function(D,y){const C=y._dirtyLeaves,x=y._dirtyElements,w=D._nodeMap,b=dt(),k=new Map;let A=C,S=A.size,O=x,L=O.size;for(;S>0||L>0;){if(S>0){y._dirtyLeaves=new Set;for(const W of A){const q=w.get(W);P(q)&&q.isAttached()&&q.isSimpleText()&&!q.isUnmergeable()&&ji(q),q!==void 0&&po(q,b)&&ho(y,q,k),C.add(W)}if(A=y._dirtyLeaves,S=A.size,S>0){on++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const W of O){const q=W[0],I=W[1];if(q!=="root"&&!I)continue;const V=w.get(q);V!==void 0&&po(V,b)&&ho(y,V,k),x.set(q,I)}A=y._dirtyLeaves,S=A.size,O=y._dirtyElements,L=O.size,on++}y._dirtyLeaves=C,y._dirtyElements=x}(l,r),mo(r),function(D,y,C,x){const w=D._nodeMap,b=y._nodeMap,k=[];for(const[A]of x){const S=b.get(A);S!==void 0&&(S.isAttached()||(E(S)&&ku(S,A,w,b,k,x),w.has(A)||x.delete(A),k.push(A)))}for(const A of k)b.delete(A);for(const A of C){const S=b.get(A);S===void 0||S.isAttached()||(w.has(A)||C.delete(A),b.delete(A))}}(u,l,r._dirtyLeaves,r._dirtyElements)),g!==r._compositionKey&&(l._flushSync=!0);const _=l._selection;if(N(_)){const D=l._nodeMap,y=_.anchor.key,C=_.focus.key;D.get(y)!==void 0&&D.get(C)!==void 0||F(19)}else Ue(_)&&_._nodes.size===0&&(l._selection=null)}catch(g){return g instanceof Error&&r._onError(g),r._pendingEditorState=u,r._dirtyType=Gt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void ft(r)}finally{ce=c,be=f,de=d,r._updating=h,on=0}r._dirtyType!==kt||function(g,_){const D=_.getEditorState()._selection,y=g._selection;if(y!==null){if(y.dirty||!y.is(D))return!0}else if(D!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,ft(r)):a&&ec(()=>{ft(r)}):(l._flushSync=!1,a&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function we(r,e,t){r._updating?r._updates.push([e,t]):Qu(r,e,t)}class Dr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Dr(this.element,e,this.after)}withAfter(e){return new Dr(this.element,this.before,e)}withElement(e){return new Dr(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&F(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&F(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&F(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"&&(Nr||Nn);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 l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const o=yo(t,n);o.push(s);const i=yo(t,this.element);let u=e.getIndexWithinParent();for(let l=0;l<i.length;l++){const a=o[l],c=i[l];if(a===void 0||a<c)break;if(a>c){u+=1;break}}return[e.getParentOrThrow(),u]}}function yo(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&&F(225),t.reverse()}class st extends jn{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 Wa[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=ee()._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(P(t)&&e.push(t),E(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;E(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;E(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 E(o)&&o.getLastDescendant()||o||null}const s=t[e];return E(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:he(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&F(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:he(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&F(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(),E(o)&&s!==n-1&&!o.isInline()&&(e+=tt)}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(),E(o)&&s!==n-1&&!o.isInline()&&(e+=tt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Oi[e];return!!(this.getFormat()&t)}return!1}select(e,t){ve();const n=j();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(P(l)||E(l))return l.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const l=this.getLastChild();if(P(l)||E(l))return l.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const u=this.__key;return N(n)?(n.anchor.set(u,s,"element"),n.focus.set(u,o,"element"),n.dirty=!0,n):Vu(u,s,u,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!==""?Oi[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||F(226,String(e),String(t),String(o));const u=i.__key,l=[],a=[],c=this.getChildAtIndex(e+t);let f=null,d=o-t+s;if(e!==0)if(e===o)f=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(f=p.getPreviousSibling())}if(t>0){let p=f===null?this.getFirstChild():f.getNextSibling();for(let g=0;g<t;g++){p===null&&F(100);const _=p.getNextSibling(),D=p.__key;At(p.getWritable()),a.push(D),p=_}}let h=f;for(let p=0;p<s;p++){const g=n[p];h!==null&&g.is(h)&&(f=h=h.getPreviousSibling());const _=g.getWritable();_.__parent===u&&d--,At(_);const D=g.__key;if(h===null)i.__first=D,_.__prev=null;else{const y=h.getWritable();y.__next=D,_.__prev=y.__key}g.__key===u&&F(76),_.__parent=u,l.push(D),h=g}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const g=h.getWritable();p.__prev=h.__key,g.__next=c.__key}else p.__prev=null}if(i.__size=d,a.length){const p=j();if(N(p)){const g=new Set(a),_=new Set(l),{anchor:D,focus:y}=p;_o(D,g,_)&&wn(D,D.getNode(),this,f,c),_o(y,g,_)&&wn(y,y.getNode(),this,f,c),d!==0||this.canBeEmpty()||He(this)||this.remove()}}return i}getDOMSlot(e){return new Dr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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 E(r){return r instanceof st}function _o(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 Bc extends jn{constructor(e){super(e)}decorate(e,t){F(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Y(r){return r instanceof Bc}class $r extends st{static getType(){return"root"}static clone(){return new $r}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){F(51)}getTextContent(){const e=this.__cachedText;return!Ir()&&ee()._dirtyType!==kt||e===null?super.getTextContent():e}remove(){F(52)}replace(e){F(53)}insertBefore(e){F(54)}insertAfter(e){F(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];E(n)||Y(n)||F(56)}return super.append(...e)}static importJSON(e){const t=te();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 me(r){return r instanceof $r}function Yu(r){return new $n(new Map(r._nodeMap))}function hi(){return new $n(new Map([["root",new $r]]))}function Xu(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&F(130,t.name),E(r)){const n=e.children;Array.isArray(n)||F(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=Xu(s[o]);n.push(i)}}return e}class $n{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 go(t&&t.editor||null,this,e)}clone(e){const t=new $n(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return go(null,this,()=>({root:Xu(te())}))}}class pi extends st{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Xt extends st{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=St[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return gn(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 Xt(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=yr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Nc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=ue();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=ue();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||P(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 Nc(r){const e=ue();return r.style&&(e.setFormat(r.style.textAlign),ai(r,e)),{node:e}}function ue(){return Qe(new Xt)}function Qt(r){return r instanceof Xt}const J=0,Ut=1,Fc=4;function Zu(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=hi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=kt,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 Lc(r){const e=r||{},t=Sc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=hi(),u=e.namespace||(s!==null?s._config.namespace:wu()),l=e.editorState,a=[$r,Yt,Or,Rr,Xt,pi,...e.nodes||[]],{onError:c,html:f}=e,d=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let g=0;g<a.length;g++){let _=a[g],D=null,y=null;if(typeof _!="function"){const b=_;_=b.replace,D=b.with,y=b.withKlass||null}const C=_.getType(),x=_.transform(),w=new Set;x!==null&&w.add(x),h.set(C,{exportDOM:f&&f.export?f.export.get(_):void 0,klass:_,replace:D,replaceWithKlass:y,transforms:w})}}const p=new qn(i,s,h,{disableEvents:o,namespace:u,theme:n},c||console.error,function(g,_){const D=new Map,y=new Set,C=x=>{Object.keys(x).forEach(w=>{let b=D.get(w);b===void 0&&(b=[],D.set(w,b)),b.push(x[w])})};return g.forEach(x=>{const w=x.klass.importDOM;if(w==null||y.has(w))return;y.add(w);const b=w.call(x.klass);b!==null&&C(b)}),_&&C(_),D}(h,f?f.import:void 0),d);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Gt),p}class qn{constructor(e,t,n,s,o,i,u){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=kt,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=wu(),this._onError=o,this._htmlConversions=i,this._editable=u,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&&F(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&&F(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(u=>u.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&&F(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=cc(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 l=this.registerNodeTransformToKlass(o,t);s.push(l)}var i,u;return i=this,u=e.getType(),we(i,()=>{const l=nt();if(l.isEmpty())return;if(u==="root")return void te().markDirty();const a=l._nodeMap;for(const[,c]of a)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return R(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=yr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Zu(this,t,e,s),t!==null&&(this._config.disableEvents||gc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(u){const l=u.ownerDocument;return l&&l.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=Gt,mu(this),this._updateTags.add("history-merge"),ft(this),this._config.disableEvents||function(u,l){const a=u.ownerDocument,c=Dn.get(a);(c===void 0||c<1)&&a.addEventListener("selectionchange",$u),Dn.set(a,(c||0)+1),u.__lexicalEditor=l;const f=Iu(u);for(let d=0;d<Bs.length;d++){const[h,p]=Bs[d],g=typeof p=="function"?_=>{Zi(_)||(Xi(_),(l.isEditable()||h==="click")&&p(_,l))}:_=>{if(Zi(_))return;Xi(_);const D=l.isEditable();switch(h){case"cut":return D&&R(l,Vs,_);case"copy":return R(l,Bn,_);case"paste":return D&&R(l,Tn,_);case"dragstart":return D&&R(l,lu,_);case"dragover":return D&&R(l,au,_);case"dragend":return D&&R(l,ka,_);case"focus":return D&&R(l,Ba,_);case"blur":return D&&R(l,Na,_);case"drop":return D&&R(l,uu,_)}};u.addEventListener(h,g),f.push(()=>{u.removeEventListener(h,g)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;br("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&F(38);let n=e;n._readOnly&&(n=Yu(e),n._selection=e._selection?e._selection.clone():null),gu(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),ft(this)),this._pendingEditorState=n,this._dirtyType=Gt,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||ft(this)}parseEditorState(e,t){return function(n,s,o){const i=hi(),u=ce,l=be,a=de,c=s._dirtyElements,f=s._dirtyLeaves,d=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,ce=i,be=!1,de=s;try{const p=s._nodes;fi(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=f,s._cloneNotNeeded=d,s._dirtyType=h,ce=u,be=l,de=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return ft(this),this.getEditorState().read(e,{editor:this})}update(e,t){we(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),we(this,()=>{const s=j(),o=te();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=Be(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,br("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}qn.version="0.21.0+prod.esm";const el=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pc=el?T.useLayoutEffect:T.useEffect,Zr={tag:"history-merge"};function Oc({initialConfig:r,children:e}){const t=T.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:u,html:l}=r,a=ya(null,n),c=Lc({editable:r.editable,html:l,namespace:s,nodes:o,onError:f=>i(f,c),theme:n});return function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const h=te();if(h.isEmpty()){const p=ue();h.append(p);const g=el?document.activeElement:null;(j()!==null||g!==null&&g===f.getRootElement())&&p.select()}},Zr);else if(d!==null)switch(typeof d){case"string":{const h=f.parseEditorState(d);f.setEditorState(h,Zr);break}case"object":f.setEditorState(d,Zr);break;case"function":f.update(()=>{te().isEmpty()&&d(f)},Zr)}}}(c,u),[c,a]},[]);return Pc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),v.jsx(Xo.Provider,{value:t,children:e})}const Rc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function Mc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function jc(){return function(r){const[e]=Je(),t=T.useMemo(()=>r(e),[e,r]),[n,s]=T.useState(()=>t.initialValueFn()),o=T.useRef(n);return Rc(()=>{const{initialValueFn:i,subscribe:u}=t,l=i();return o.current!==l&&(o.current=l,s(l)),u(a=>{o.current=a,s(a)})},[t,r]),n}(Mc)}function Ic(){return te().getTextContent()}function $c(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!$c(r,!1))return!1;const e=te().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Y(s))return!1;if(E(s)){if(!Qt(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let u=0;u<i;u++){const l=o[n];if(!P(l))return!1}}}return!0}function tl(r){return()=>qc(r)}function zc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}zc(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 Uc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wc=Uc(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 Vc=new Map;function Kc(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 rl(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(),u=s.getNode(),l=e.is(i),a=e.is(u);if(l||a){const[c,f]=Ps(r),d=i.is(u),h=e.is(o?u:i),p=e.is(o?i:u);let g,_=0;return d?(_=c>f?f:c,g=c>f?c:f):h?(_=o?f:c,g=void 0):p&&(_=0,g=o?c:f),e.__text=e.__text.slice(_,g),e}}return e}function Hc(r){const e=r.getStyle(),t=Kc(e);Vc.set(e,t)}function Gc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),u=te(),l=u.getFirstChild();return void(l?l.replace(i,!0):u.append(i))}const s=r.getNodes(),o=n!==null&&function(i,u){let l=i;for(;l!==null&&l.getParent()!==null&&!u(l);)l=l.getParentOrThrow();return u(l)?l:null}(n.getNode(),bo);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const u=s[i];if(!bo(u))continue;E(u)||Wc(178);const l=e();l.setFormat(u.getFormatType()),l.setIndent(u.getIndent()),u.replace(l,!0)}}function xo(r,e){const t=Er(r.focus,e);return Y(t)&&!t.isIsolated()||E(t)&&!t.isInline()&&!t.canBeEmpty()}function Jc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Qc(r){const e=r.anchor.getNode();return(me(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function vo(r,e,t){const n=Qc(r);Jc(r,e,t?!n:n,"character")}function bo(r){if(Y(r)||!E(r)||He(r))return!1;const e=r.getFirstChild(),t=e===null||Et(e)||P(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Yc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Xc=Yc(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 nl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Zc=nl&&"documentMode"in document?document.documentMode:null;!(!nl||!("InputEvent"in window)||Zc)&&"getTargetRanges"in new window.InputEvent("input");function sl(...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 Ft(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function qr(r,...e){const t=sl(...e);t.length>0&&r.classList.add(...t)}function il(r,...e){const t=sl(...e);t.length>0&&r.classList.remove(...t)}function ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function td(r){const e=zn(r,t=>E(t)&&!t.isInline());return E(e)||Xc(4,r.__key),e}const zn=(r,e)=>{let t=r;for(;t!==te()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function ht(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function rd(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 u=i.payload;if(u&&u.functionId==="makeChanges"){const l=u.args;if(l){const[a,c,f,d,h,p]=l;r.update(()=>{const g=j();if(N(g)){const _=g.anchor;let D=_.getNode(),y=0,C=0;if(P(D)&&a>=0&&c>=0&&(y=a,C=a+c,g.setTextNodeRange(D,y,D,C)),y===C&&f===""||(g.insertRawText(f),D=_.getNode()),P(D)){y=d,C=d+h;const x=D.getTextContentSize();y=y>x?x:y,C=C>x?x:C,g.setTextNodeRange(D,y,D,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function ol(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(!al.has(i.nodeName)){const u=cl(i,r,s,!1);u!==null&&(n=n.concat(u))}}return function(o){for(const i of o)i.getNextSibling()instanceof pi&&i.insertAfter(Bt());for(const i of o){const u=i.getChildren();for(const l of u)i.insertBefore(l);i.remove()}}(s),n}function ul(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=te().getChildren();for(let s=0;s<n.length;s++)ll(r,n[s],t,e);return t.innerHTML}function ll(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=E(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=li(e);h=P(h)&&n!==null?rl(n,h):h,i=h}const u=E(i)?i.getChildren():[],l=r._nodes.get(i.getType());let a;a=l&&l.exportDOM!==void 0?l.exportDOM(r,i):i.exportDOM(r);const{element:c,after:f}=a;if(!c)return!1;const d=document.createDocumentFragment();for(let h=0;h<u.length;h++){const p=u[h],g=ll(r,p,d,n);!s&&E(e)&&g&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((rt(c)||Hi(c))&&c.append(d),t.append(c),f){const h=f.call(i,c);h&&(Hi(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(d);return s}const al=new Set(["STYLE","SCRIPT"]);function cl(r,e,t,n,s=new Map,o){let i=[];if(al.has(r.nodeName))return i;let u=null;const l=function(p,g){const{nodeName:_}=p,D=g._htmlConversions.get(_.toLowerCase());let y=null;if(D!==void 0)for(const C of D){const x=C(p);x!==null&&(y===null||(y.priority||0)<=(x.priority||0))&&(y=x)}return y!==null?y.conversion:null}(r,e),a=l?l(r):null;let c=null;if(a!==null){c=a.after;const p=a.node;if(u=Array.isArray(p)?p[p.length-1]:p,u!==null){for(const[,g]of s)if(u=g(u,o),!u)break;u&&i.push(...Array.isArray(p)?p:[u])}a.forChild!=null&&s.set(r.nodeName,a.forChild)}const f=r.childNodes;let d=[];const h=(u==null||!He(u))&&(u!=null&&Os(u)||n);for(let p=0;p<f.length;p++)d.push(...cl(f[p],e,t,h,new Map(s),u));return c!=null&&(d=c(d)),_n(r)&&(d=nd(r,d,h?()=>{const p=new pi;return t.push(p),p}:ue)),u==null?d.length>0?i=i.concat(d):_n(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ds(p.nextSibling)&&Ds(p.previousSibling)}(r)&&(i=i.concat(Bt())):E(u)&&u.append(...d),i}function nd(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const u=e[i];if(Os(u))n&&!u.getFormat()&&u.setFormat(n),s.push(u);else if(o.push(u),i===e.length-1||i<e.length-1&&Os(e[i+1])){const l=t();l.setFormat(n),l.append(...o),s.push(l),o=[]}}return s}function sd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var An=sd(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 id(r,e=j()){return e==null&&An(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?"":ul(r,e)}function od(r,e=j()){return e==null&&An(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ud(r,e))}function Do(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 Co(t,ld(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(u){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(u):u}(s),"text/html");return Co(t,ol(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(N(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let u=0;u<i.length;u++){const l=j();if(N(l)){const a=i[u];a===`
|
|
72
72
|
`||a===`\r
|
|
73
|
-
`?l.insertParagraph():a===" "?l.insertNodes([Mr()]):l.insertText(a)}}}else e.insertRawText(o)}function Co(r,e,t){r.dispatchCommand(_a,{nodes:e,selection:t})||t.insertNodes(e)}function dl(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=E(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=li(t);a=P(a)&&e!==null?rl(e,a):a,i=a}const u=E(i)?i.getChildren():[],l=function(a){const c=a.exportJSON(),f=a.constructor;if(c.type!==f.getType()&&An(58,f.name),E(a)){const d=c.children;Array.isArray(d)||An(59,f.name)}return c}(i);if(P(i)){const a=i.__text;a.length>0?l.text=a:s=!1}for(let a=0;a<u.length;a++){const c=u[a],f=dl(r,e,c,l.children);!s&&E(t)&&f&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(l);else if(Array.isArray(l.children))for(let a=0;a<l.children.length;a++){const c=l.children[a];n.push(c)}return s}function ud(r,e){const t=[],n=te().getChildren();for(let s=0;s<n.length;s++)dl(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ld(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Tc(n);P(s)&&Hc(s),e.push(s)}return e}let It=null;async function wo(r,e,t){if(It!==null)return!1;if(e!==null)return new Promise((l,a)=>{r.update(()=>{l(Ao(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=Be(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 u=new Range;return u.setStart(i,0),u.setEnd(i,1),o.removeAllRanges(),o.addRange(u),new Promise((l,a)=>{const c=r.registerCommand(Bn,f=>(ht(f,ClipboardEvent)&&(c(),It!==null&&(window.clearTimeout(It),It=null),l(Ao(r,f,t))),!0),Fc);It=window.setTimeout(()=>{c(),It=null,l(!1)},50),s.execCommand("copy"),i.remove()})}function Ao(r,e,t){if(t===void 0){const s=Be(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!Lr(r,o,i))return!1;const u=j();if(u===null)return!1;t=cd(u)}e.preventDefault();const n=e.clipboardData;return n!==null&&(dd(n,t),!0)}const ad=[["text/html",id],["application/x-lexical-editor",od]];function cd(r=j()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=lc();for(const[n,s]of ad){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function dd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Eo(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 Zt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,fd=Zt&&"documentMode"in document?document.documentMode:null,hd=!(!Zt||!("InputEvent"in window)||fd)&&"getTargetRanges"in new window.InputEvent("input"),pd=Zt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ko=Zt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,gd=Zt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),md=Zt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!gd,So=Br();class Un extends st{static getType(){return"quote"}static clone(e){return new Un(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return qr(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:yd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=gi();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=ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function gi(){return Qe(new Un)}class Wn extends st{static getType(){return"heading"}static clone(e){return new Wn(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];qr(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:$t,priority:0}),h2:e=>({conversion:$t,priority:0}),h3:e=>({conversion:$t,priority:0}),h4:e=>({conversion:$t,priority:0}),h5:e=>({conversion:$t,priority:0}),h6:e=>({conversion:$t,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&To(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>To(e)?{conversion:t=>({node:hr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=hr(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?ue():hr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const u=ue();u.select(),this.replace(u,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ue():hr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function To(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function $t(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=hr(e),r.style!==null&&(ai(r,t),t.setFormat(r.style.textAlign))),{node:t}}function yd(r){const e=gi();return r.style!==null&&(e.setFormat(r.style.textAlign),ai(r,e)),{node:e}}function hr(r){return Qe(new Wn(r))}function en(r){let e=null;if(ht(r,DragEvent)?e=r.dataTransfer:ht(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 Bo(r){const e=j();if(!N(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 u=zn(o,a=>E(a)&&!a.isInline());if(u===null)continue;const l=u.getKey();u.canIndent()&&!t.has(l)&&(t.add(l),r(u))}return t.size>0}function tn(r){const e=Jt(r);return Y(e)}function _d(r){return Ft(r.registerCommand(Zo,e=>{const t=j();return!!Ue(t)&&(t.clear(),!0)},0),r.registerCommand(wt,e=>{const t=j();return!!N(t)&&(t.deleteCharacter(e),!0)},J),r.registerCommand(wr,e=>{const t=j();return!!N(t)&&(t.deleteWord(e),!0)},J),r.registerCommand(Ar,e=>{const t=j();return!!N(t)&&(t.deleteLine(e),!0)},J),r.registerCommand(Vt,e=>{const t=j();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Do(n,t,r);else if(N(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},J),r.registerCommand(xs,()=>{const e=j();return!!N(e)&&(e.removeText(),!0)},J),r.registerCommand(Oe,e=>{const t=j();return!!N(t)&&(t.formatText(e),!0)},J),r.registerCommand(Ea,e=>{const t=j();if(!N(t)&&!Ue(t))return!1;const n=t.getNodes();for(const s of n){const o=zn(s,i=>E(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},J),r.registerCommand(Wt,e=>{const t=j();return!!N(t)&&(t.insertLineBreak(e),!0)},J),r.registerCommand(Cr,()=>{const e=j();return!!N(e)&&(e.insertParagraph(),!0)},J),r.registerCommand(wa,()=>(Ec([Mr()]),!0),J),r.registerCommand(Aa,()=>Bo(e=>{const t=e.getIndent();e.setIndent(t+1)}),J),r.registerCommand(Pi,()=>Bo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),J),r.registerCommand(ru,e=>{const t=j();if(Ue(t)&&!tn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(N(t)){const n=Er(t.focus,!0);if(!e.shiftKey&&Y(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},J),r.registerCommand(nu,e=>{const t=j();if(Ue(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(N(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===te().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Er(t.focus,!1);if(!e.shiftKey&&Y(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},J),r.registerCommand(tu,e=>{const t=j();if(Ue(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!N(t))return!1;if(xo(t,!0)){const n=e.shiftKey;return e.preventDefault(),vo(t,n,!0),!0}return!1},J),r.registerCommand(eu,e=>{const t=j();if(Ue(t)&&!tn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!N(t))return!1;const n=e.shiftKey;return!!xo(t,!1)&&(e.preventDefault(),vo(t,n,!1),!0)},J),r.registerCommand(su,e=>{if(tn(e.target))return!1;const t=j();if(!N(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!me(s)&&td(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Pi,void 0)):(!ko||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(wt,!0))},J),r.registerCommand(ou,e=>{if(tn(e.target))return!1;const t=j();return!!N(t)&&(e.preventDefault(),r.dispatchCommand(wt,!1))},J),r.registerCommand(an,e=>{const t=j();if(!N(t))return!1;if(e!==null){if((ko||pd||md)&&hd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Wt,!1)}return r.dispatchCommand(Cr,void 0)},J),r.registerCommand(iu,()=>{const e=j();return!!N(e)&&(r.blur(),!0)},J),r.registerCommand(uu,e=>{const[,t]=en(e);if(t.length>0){const s=Eo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,u=Jt(i);if(u!==null){const l=wc();if(P(u))l.anchor.set(u.getKey(),o,"text"),l.focus.set(u.getKey(),o,"text");else{const c=u.getParentOrThrow().getKey(),f=u.getIndexWithinParent()+1;l.anchor.set(c,f,"element"),l.focus.set(c,f,"element")}const a=yu(l);Ke(a)}r.dispatchCommand(So,t)}return e.preventDefault(),!0}const n=j();return!!N(n)},J),r.registerCommand(lu,e=>{const[t]=en(e),n=j();return!(t&&!N(n))},J),r.registerCommand(au,e=>{const[t]=en(e),n=j();if(t&&!N(n))return!1;const s=Eo(e.clientX,e.clientY);if(s!==null){const o=Jt(s.node);Y(o)&&e.preventDefault()}return!0},J),r.registerCommand(vs,()=>(sc(),!0),J),r.registerCommand(Bn,e=>(wo(r,ht(e,ClipboardEvent)?e:null),!0),J),r.registerCommand(Vs,e=>(async function(t,n){await wo(n,ht(t,ClipboardEvent)?t:null),n.update(()=>{const s=j();N(s)?s.removeText():Ue(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),J),r.registerCommand(Tn,e=>{const[,t,n]=en(e);return t.length>0&&!n?(r.dispatchCommand(So,t),!0):ti(e.target)?!1:j()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=j(),u=ht(s,InputEvent)||ht(s,KeyboardEvent)?null:s.clipboardData;u!=null&&i!==null&&Do(u,i,o)},{tag:"paste"})}(e,r),!0)},J))}const Rs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function No(r){return r.getEditorState().read(tl(r.isComposing()))}function xd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Je(),s=function(o,i){const[u,l]=T.useState(()=>o.getDecorators());return Rs(()=>o.registerDecoratorListener(a=>{wi.flushSync(()=>{l(a)})}),[o]),T.useEffect(()=>{l(o.getDecorators())},[o]),T.useMemo(()=>{const a=[],c=Object.keys(u);for(let f=0;f<c.length;f++){const d=c[f],h=v.jsx(i,{onError:g=>o._onError(g),children:v.jsx(T.Suspense,{fallback:null,children:u[d]})}),p=o.getElementByKey(d);p!==null&&a.push(wi.createPortal(h,p,d))}return a},[i,u,o])}(n,t);return function(o){Rs(()=>Ft(_d(o),rd(o)),[o])}(n),v.jsxs(v.Fragment,{children:[r,v.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=Je(),t=function(s){const[o,i]=T.useState(()=>No(s));return Rs(()=>{function u(){const l=No(s);i(l)}return u(),Ft(s.registerUpdateListener(()=>{u()}),s.registerEditableListener(()=>{u()}))},[s]),o}(e),n=jc();return t?typeof r=="function"?r(n):r:null}const fl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function bd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:u,ariaLabel:l,ariaLabelledBy:a,ariaMultiline:c,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:p,id:g,role:_="textbox",spellCheck:D=!0,style:y,tabIndex:C,"data-testid":x,...w},b){const[k,A]=T.useState(r.isEditable()),S=T.useCallback(L=>{L&&L.ownerDocument&&L.ownerDocument.defaultView?r.setRootElement(L):r.setRootElement(null)},[r]),O=T.useMemo(()=>function(...L){return W=>{L.forEach(q=>{typeof q=="function"?q(W):q!=null&&(q.current=W)})}}(b,S),[S,b]);return fl(()=>(A(r.isEditable()),r.registerEditableListener(L=>{A(L)})),[r]),v.jsx("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?t:"none","aria-controls":k?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":k&&_==="combobox"?!!i:void 0,...u!=null?{"aria-invalid":u}:{},"aria-label":l,"aria-labelledby":a,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":d,autoCapitalize:h,className:p,contentEditable:k,"data-testid":x,id:g,ref:O,role:k?_:void 0,spellCheck:D,style:y,tabIndex:C,...w})}const Dd=T.forwardRef(bd);function Fo(r){return r.getEditorState().read(tl(r.isComposing()))}const Cd=T.forwardRef(wd);function wd(r,e){const{placeholder:t,...n}=r,[s]=Je();return v.jsxs(v.Fragment,{children:[v.jsx(Dd,{editor:s,...n,ref:e}),t!=null&&v.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[u,l]=T.useState(()=>Fo(i));return fl(()=>{function a(){const c=Fo(i);l(c)}return a(),Ft(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),u}(e),[n,s]=T.useState(e.isEditable());if(T.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:v.jsx("div",{"aria-hidden":!0,children:o})}const rn=0,Ms=1,js=2,Pe=0,Ed=1,Lo=2,kd=3,Sd=4;function Td(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Pe;const o=e._selection,i=r._selection;if(s)return Ed;if(!(N(o)&&N(i)&&i.isCollapsed()&&o.isCollapsed()))return Pe;const u=function(D,y,C){const x=D._nodeMap,w=[];for(const b of y){const k=x.get(b);k!==void 0&&w.push(k)}for(const[b,k]of C){if(!k)continue;const A=x.get(b);A===void 0||me(A)||w.push(A)}return w}(e,t,n);if(u.length===0)return Pe;if(u.length>1){const D=e._nodeMap,y=D.get(o.anchor.key),C=D.get(i.anchor.key);return y&&C&&!r._nodeMap.has(y.__key)&&P(y)&&y.__text.length===1&&o.anchor.offset===1?Lo:Pe}const l=u[0],a=r._nodeMap.get(l.__key);if(!P(a)||!P(l)||a.__mode!==l.__mode)return Pe;const c=a.__text,f=l.__text;if(c===f)return Pe;const d=o.anchor,h=i.anchor;if(d.key!==h.key||d.type!=="text")return Pe;const p=d.offset,g=h.offset,_=f.length-c.length;return _===1&&g===p-1?Lo:_===-1&&g===p+1?kd:_===-1&&g===p?Sd:Pe}function Bd(r,e){let t=Date.now(),n=Pe;return(s,o,i,u,l,a)=>{const c=Date.now();if(a.has("historic"))return n=Pe,t=c,js;const f=Td(s,o,u,l,r.isComposing()),d=(()=>{const h=i===null||i.editor===r,p=a.has("history-push");if(!p&&h&&a.has("history-merge"))return rn;if(s===null)return Ms;const g=o._selection;return u.size>0||l.size>0?p===!1&&f!==Pe&&f===n&&c<t+e&&h||u.size===1&&function(_,D,y){const C=D._nodeMap.get(_),x=y._nodeMap.get(_),w=D._selection,b=y._selection;return!(N(w)&&N(b)&&w.anchor.type==="element"&&w.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!P(C)||!P(x)||C.__parent!==x.__parent)&&JSON.stringify(D.read(()=>C.exportJSON()))===JSON.stringify(y.read(()=>x.exportJSON()))}(Array.from(u)[0],s,o)?rn:Ms:g!==null?rn:js})();return t=c,n=f,d}}function Po(r){r.undoStack=[],r.redoStack=[],r.current=null}function Nd(r,e,t){const n=Bd(r,t);return Ft(r.registerCommand(Us,()=>(function(o,i){const u=i.redoStack,l=i.undoStack;if(l.length!==0){const a=i.current,c=l.pop();a!==null&&(u.push(a),o.dispatchCommand(Jr,!0)),l.length===0&&o.dispatchCommand(Qr,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),J),r.registerCommand(Ws,()=>(function(o,i){const u=i.redoStack,l=i.undoStack;if(u.length!==0){const a=i.current;a!==null&&(l.push(a),o.dispatchCommand(Qr,!0));const c=u.pop();u.length===0&&o.dispatchCommand(Jr,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),J),r.registerCommand(Sa,()=>(Po(e),!1),J),r.registerCommand(Ta,()=>(Po(e),r.dispatchCommand(Jr,!1),r.dispatchCommand(Qr,!1),!0),J),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:u,dirtyElements:l,tags:a})=>{const c=e.current,f=e.redoStack,d=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const p=n(i,o,c,u,l,a);if(p===Ms)f.length!==0&&(e.redoStack=[],r.dispatchCommand(Jr,!1)),c!==null&&(d.push({...c}),r.dispatchCommand(Qr,!0));else if(p===js)return;e.current={editor:r,editorState:o}}))}function Fd(){return{current:null,redoStack:[],undoStack:[]}}function Ld({delay:r,externalHistoryState:e}){const[t]=Je();return function(n,s,o=1e3){const i=T.useMemo(()=>s||Fd(),[s]);T.useEffect(()=>Nd(n,i,o),[o,n,i])}(t,e,r),null}const Pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function Od({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Je();return Pd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:u,tags:l})=>{e&&o.size===0&&i.size===0||r&&l.has("history-merge")||u.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function Is(r,e){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Is(r,e)}var Oo={error:null},Rd=function(r){var e,t;function n(){for(var o,i=arguments.length,u=new Array(i),l=0;l<i;l++)u[l]=arguments[l];return(o=r.call.apply(r,[this].concat(u))||this).state=Oo,o.resetErrorBoundary=function(){for(var a,c=arguments.length,f=new Array(c),d=0;d<c;d++)f[d]=arguments[d];o.props.onReset==null||(a=o.props).onReset.apply(a,f),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,Is(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Oo)},s.componentDidCatch=function(o,i){var u,l;(u=(l=this.props).onError)==null||u.call(l,o,i)},s.componentDidUpdate=function(o,i){var u,l,a,c,f=this.state.error,d=this.props.resetKeys;f!==null&&i.error!==null&&((a=o.resetKeys)===void 0&&(a=[]),(c=d)===void 0&&(c=[]),a.length!==c.length||a.some(function(h,p){return!Object.is(h,c[p])}))&&((u=(l=this.props).onResetKeysChange)==null||u.call(l,o.resetKeys,d),this.reset())},s.render=function(){var o=this.state.error,i=this.props,u=i.fallbackRender,l=i.FallbackComponent,a=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(ts.isValidElement(a))return a;if(typeof u=="function")return u(c);if(l)return ts.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(ts.Component);function Md({children:r,onError:e}){return v.jsx(Rd,{fallback:v.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function jd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var We=jd(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(Z(t)){const n=t.getParent();if(G(n)){e++,t=n.getParent();continue}We(40)}return e}return e}function $s(r){let e=r.getParent();G(e)||We(40);let t=e;for(;t!==null;)t=t.getParent(),G(t)&&(e=t);return e}function hl(r){let e=[];const t=r.getChildren().filter(Z);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();G(o)?e=e.concat(hl(o)):e.push(s)}return e}function Ve(r){return Z(r)&&G(r.getFirstChild())}function Ro(r){return Ae().append(r)}function pl(r,e){return Z(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Mo(r,e){r.update(()=>{const t=j();if(t!==null){const n=t.getNodes();if(N(t)){const o=t.getStartEndPoints();o===null&&We(143);const[i]=o,u=i.getNode(),l=u.getParent();if(pl(u,n)){const a=De(e);if(He(l)){u.replace(a);const c=Ae();E(u)&&(c.setFormat(u.getFormatType()),c.setIndent(u.getIndent())),a.append(c)}else if(Z(u)){const c=u.getParentOrThrow();Nt(a,c.getChildren()),c.replace(a)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!E(i)||!i.isEmpty()||Z(i)||s.has(i.getKey())){if(xu(i)){let u=i.getParent();for(;u!=null;){const l=u.getKey();if(G(u)){if(!s.has(l)){const a=De(e);Nt(a,u.getChildren()),u.replace(a),s.add(l)}break}{const a=u.getParent();if(He(a)&&!s.has(l)){s.add(l),jo(u,e);break}u=a}}}}else jo(i,e)}}})}function Nt(r,e){r.splice(r.getChildrenSize(),0,e)}function jo(r,e){if(G(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=Ae();let o;if(Nt(s,r.getChildren()),G(t)&&e===t.getListType())t.append(s),G(n)&&e===n.getListType()&&(Nt(t,n.getChildren()),n.remove()),o=t;else if(G(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=De(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function mi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Ve(t)&&Ve(n)&&(mi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function $d(r){r.update(()=>{const e=j();if(N(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(pl(s,n))t.add($s(s));else for(let o=0;o<n.length;o++){const i=n[o];if(xu(i)){const u=ed(i,Lt);u!=null&&t.add($s(u))}}for(const o of t){let i=o;const u=hl(o);for(const l of u){const a=ue();Nt(a,l.getChildren()),i.insertAfter(a),i=a,l.__key===e.anchor.key&&e.anchor.set(a.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(a.getKey(),0,"element"),l.remove()}o.remove()}}})}function qd(r){const e=new Set;if(Ve(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Ve(n)&&Ve(s)){const o=s.getFirstChild();if(G(o)){o.append(r);const i=n.getFirstChild();G(i)&&(Nt(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Ve(n)){const o=n.getFirstChild();if(G(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(Ve(s)){const o=s.getFirstChild();G(o)&&o.append(r)}else if(G(t)){const o=Ae(),i=De(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function zd(r){if(Ve(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(G(t?t.getParent():void 0)&&Z(t)&&G(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=Ae(),u=De(o);i.append(u),r.getPreviousSiblings().forEach(c=>u.append(c));const l=Ae(),a=De(o);l.append(a),Nt(a,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(r)}}}function Ud(){const r=j();if(!N(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Z(e)||e.getChildrenSize()!==0)return!1;const t=$s(e),n=e.getParent();G(n)||We(40);const s=n.getParent();let o;if(He(s))o=ue(),t.insertAfter(o);else{if(!Z(s))return!1;o=Ae(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const u=De(n.getListType());if(Qt(o))o.insertAfter(u);else{const l=Ae();l.append(u),o.insertAfter(l)}i.forEach(l=>{l.remove(),u.append(l)})}return function(u){let l=u;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const a=l.getParent();if(a==null||!Z(l)&&!G(l))break;l=a}l.remove()}(e),!0}function En(...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 Lt extends st{static getType(){return"listitem"}static clone(e){return new Lt(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 G(n)&&n.getListType()==="check"&&$o(t,this,null),t.value=this.__value,Io(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return G(s)&&s.getListType()==="check"&&$o(t,this,e),t.value=this.__value,Io(t,n.theme,this),!1}static transform(){return e=>{if(Z(e)||We(144),e.__checked==null)return;const t=e.getParent();G(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Wd,priority:0})}}static importJSON(e){const t=Ae();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(E(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Z(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!G(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=De(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&&(E(e)||We(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(G(n)||We(39),Z(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=De(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&&Ve(t)&&Ve(n)&&(mi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Ae(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ue();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Z(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,u=e.focus,l=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(l,i.offset,"element"),u.type==="element"&&u.getNode().is(this)&&u.set(l,u.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 G(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(;Z(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&We(117),(e=Math.floor(e))>=0||We(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(zd(this),t--);return this}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return Qt(e)||Z(e)}extractWithChild(e,t){if(!N(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 De("bullet")}canMergeWhenEmpty(){return!0}}function Io(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let u;if(o&&o.nested&&(u=o.nested.listitem),i!==void 0&&n.push(...En(i)),o){const l=t.getParent(),a=G(l)&&l.getListType()==="check",c=t.getChecked();a&&!c||s.push(o.listitemUnchecked),a&&c||s.push(o.listitemChecked),a&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(u!==void 0){const l=En(u);t.getChildren().some(a=>G(a))?n.push(...l):s.push(...l)}s.length>0&&il(r,...s),n.length>0&&qr(r,...n)}function $o(r,e,t,n){G(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 Wd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Vd(t)}const e=r.getAttribute("aria-checked");return{node:Ae(e==="true"||e!=="false"&&void 0)}}function Vd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:Ae(r.hasAttribute("checked"))}}function Ae(r){return Qe(new Lt(void 0,r))}function Z(r){return r instanceof Lt}class er extends st{static getType(){return"list"}static clone(e){const t=e.__listType||Uo[e.__tag];return new er(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Uo[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,qo(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(qo(t,n.theme,this),!1)}static transform(){return e=>{G(e)||We(163),function(t){const n=t.getNextSibling();G(n)&&t.getListType()===n.getListType()&&mi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Z(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),G(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:zo,priority:0}),ul:()=>({conversion:zo,priority:0})}}static importJSON(e){const t=De(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&&rt(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(Z(n))super.append(n);else{const s=Ae();if(G(n))s.append(n);else if(E(n))if(n.isInline())s.append(n);else{const o=ae(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Z(e)}}function qo(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],u=Id(t)-1,l=u%i.length,a=i[l],c=o[t.__tag];let f;const d=o.nested,h=o.checklist;if(d!==void 0&&d.list&&(f=d.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),a!==void 0){n.push(...En(a));for(let p=0;p<i.length;p++)p!==l&&s.push(t.__tag+p)}if(f!==void 0){const p=En(f);u>1?n.push(...p):s.push(...p)}}s.length>0&&il(r,...s),n.length>0&&qr(r,...n)}function Kd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Z(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{G(o)&&e.push(Ro(o))})}else e.push(Ro(n))}return e}function zo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=De("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(rt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?De("check"):De("bullet")),{after:Kd,node:t}}const Uo={ol:"number",ul:"bullet"};function De(r,e=1){return Qe(new er(r,e))}function G(r){return r instanceof er}const gl=Br(),ml=Br(),Hd=Br();function Gd(r){return Ft(r.registerCommand(ml,()=>(Mo(r,"number"),!0),Ut),r.registerCommand(gl,()=>(Mo(r,"bullet"),!0),Ut),r.registerCommand(Hd,()=>($d(r),!0),Ut),r.registerCommand(Cr,()=>!!Ud(),Ut))}function Jd(){const[r]=Je();return T.useEffect(()=>{if(!r.hasNodes([er,Lt]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){T.useEffect(()=>Gd(e),[e])}(r),null}const Qd=new Set(["http:","https:","mailto:","sms:","tel:"]);class Pt extends st{static getType(){return"link"}static clone(e){return new Pt(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),qr(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,u=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")),u!==e.__title&&(u?t.title=u:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:Yd,priority:1})}}static importJSON(e){const t=kn(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(!Qd.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=kn(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(!N(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 Yd(r){let e=null;if(uc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=kn(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function kn(r,e){return Qe(new Pt(r,e))}function ar(r){return r instanceof Pt}class zr extends Pt{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 zr(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=Wo(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(E(n)){const s=Wo(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function Wo(r,e){return Qe(new zr(r,e))}function Xd(r){return r instanceof zr}const Vo=Br();function ms(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=j();if(!N(o))return;const i=o.extract();if(r===null)i.forEach(u=>{const l=zn(u,a=>!Xd(a)&&ar(a));if(l){const a=l.getChildren();for(let c=0;c<a.length;c++)l.insertBefore(a[c]);l.remove()}});else{if(i.length===1){const a=function(c,f){let d=c;for(;d!==null&&d.getParent()!==null&&!f(d);)d=d.getParentOrThrow();return f(d)?d:null}(i[0],ar);if(a!==null)return a.setURL(r),t!==void 0&&a.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n))}let u=null,l=null;i.forEach(a=>{const c=a.getParent();if(c!==l&&c!==null&&(!E(a)||a.isInline())){if(ar(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(u)||(u=c,l=kn(r,{rel:s,target:t,title:n}),ar(c)?a.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):a.insertBefore(l)),ar(a)){if(a.is(l))return;if(l!==null){const f=a.getChildren();for(let d=0;d<f.length;d++)l.append(f[d])}a.remove()}else l!==null&&l.append(a)}})}}function Zd({validateUrl:r,attributes:e}){const[t]=Je();return T.useEffect(()=>{if(!t.hasNodes([Pt]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ft(t.registerCommand(Vo,n=>{if(n===null)return ms(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(ms(n,e),!0);{const{url:s,target:o,rel:i,title:u}=n;return ms(s,{...e,rel:i,target:o,title:u}),!0}},Ut),r!==void 0?t.registerCommand(Tn,n=>{const s=j();if(!N(s)||s.isCollapsed()||!ht(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(u=>E(u))&&(t.dispatchCommand(Vo,{...e,url:i}),n.preventDefault(),!0)},Ut):()=>{})},[t,r,e]),null}const ef={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},tf={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 rf({theme:r,disabled:e}){const[t]=Je(),n=T.useCallback(()=>{t.dispatchCommand(Oe,"bold")},[t]),s=T.useCallback(()=>{t.dispatchCommand(Oe,"italic")},[t]),o=T.useCallback(()=>{t.dispatchCommand(Oe,"underline")},[t]),i=T.useCallback(()=>{t.dispatchCommand(gl,void 0)},[t]),u=T.useCallback(()=>{t.dispatchCommand(ml,void 0)},[t]),l=T.useCallback(()=>{t.update(()=>{const f=j();N(f)&&Gc(f,()=>gi())})},[t]),a={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},c=`
|
|
73
|
+
`?l.insertParagraph():a===" "?l.insertNodes([Mr()]):l.insertText(a)}}}else e.insertRawText(o)}function Co(r,e,t){r.dispatchCommand(_a,{nodes:e,selection:t})||t.insertNodes(e)}function dl(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=E(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=li(t);a=P(a)&&e!==null?rl(e,a):a,i=a}const u=E(i)?i.getChildren():[],l=function(a){const c=a.exportJSON(),f=a.constructor;if(c.type!==f.getType()&&An(58,f.name),E(a)){const d=c.children;Array.isArray(d)||An(59,f.name)}return c}(i);if(P(i)){const a=i.__text;a.length>0?l.text=a:s=!1}for(let a=0;a<u.length;a++){const c=u[a],f=dl(r,e,c,l.children);!s&&E(t)&&f&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(l);else if(Array.isArray(l.children))for(let a=0;a<l.children.length;a++){const c=l.children[a];n.push(c)}return s}function ud(r,e){const t=[],n=te().getChildren();for(let s=0;s<n.length;s++)dl(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ld(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Tc(n);P(s)&&Hc(s),e.push(s)}return e}let It=null;async function wo(r,e,t){if(It!==null)return!1;if(e!==null)return new Promise((l,a)=>{r.update(()=>{l(Ao(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=Be(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 u=new Range;return u.setStart(i,0),u.setEnd(i,1),o.removeAllRanges(),o.addRange(u),new Promise((l,a)=>{const c=r.registerCommand(Bn,f=>(ht(f,ClipboardEvent)&&(c(),It!==null&&(window.clearTimeout(It),It=null),l(Ao(r,f,t))),!0),Fc);It=window.setTimeout(()=>{c(),It=null,l(!1)},50),s.execCommand("copy"),i.remove()})}function Ao(r,e,t){if(t===void 0){const s=Be(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!Lr(r,o,i))return!1;const u=j();if(u===null)return!1;t=cd(u)}e.preventDefault();const n=e.clipboardData;return n!==null&&(dd(n,t),!0)}const ad=[["text/html",id],["application/x-lexical-editor",od]];function cd(r=j()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=lc();for(const[n,s]of ad){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function dd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Eo(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 Zt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,fd=Zt&&"documentMode"in document?document.documentMode:null,hd=!(!Zt||!("InputEvent"in window)||fd)&&"getTargetRanges"in new window.InputEvent("input"),pd=Zt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ko=Zt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,gd=Zt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),md=Zt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!gd,So=Br();class Un extends st{static getType(){return"quote"}static clone(e){return new Un(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return qr(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:yd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=gi();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=ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function gi(){return Qe(new Un)}class Wn extends st{static getType(){return"heading"}static clone(e){return new Wn(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];qr(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:$t,priority:0}),h2:e=>({conversion:$t,priority:0}),h3:e=>({conversion:$t,priority:0}),h4:e=>({conversion:$t,priority:0}),h5:e=>({conversion:$t,priority:0}),h6:e=>({conversion:$t,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&To(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>To(e)?{conversion:t=>({node:hr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&rt(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=hr(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?ue():hr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const u=ue();u.select(),this.replace(u,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ue():hr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function To(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function $t(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=hr(e),r.style!==null&&(ai(r,t),t.setFormat(r.style.textAlign))),{node:t}}function yd(r){const e=gi();return r.style!==null&&(e.setFormat(r.style.textAlign),ai(r,e)),{node:e}}function hr(r){return Qe(new Wn(r))}function en(r){let e=null;if(ht(r,DragEvent)?e=r.dataTransfer:ht(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 Bo(r){const e=j();if(!N(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 u=zn(o,a=>E(a)&&!a.isInline());if(u===null)continue;const l=u.getKey();u.canIndent()&&!t.has(l)&&(t.add(l),r(u))}return t.size>0}function tn(r){const e=Jt(r);return Y(e)}function _d(r){return Ft(r.registerCommand(Zo,e=>{const t=j();return!!Ue(t)&&(t.clear(),!0)},0),r.registerCommand(wt,e=>{const t=j();return!!N(t)&&(t.deleteCharacter(e),!0)},J),r.registerCommand(wr,e=>{const t=j();return!!N(t)&&(t.deleteWord(e),!0)},J),r.registerCommand(Ar,e=>{const t=j();return!!N(t)&&(t.deleteLine(e),!0)},J),r.registerCommand(Vt,e=>{const t=j();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Do(n,t,r);else if(N(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},J),r.registerCommand(xs,()=>{const e=j();return!!N(e)&&(e.removeText(),!0)},J),r.registerCommand(Pe,e=>{const t=j();return!!N(t)&&(t.formatText(e),!0)},J),r.registerCommand(Ea,e=>{const t=j();if(!N(t)&&!Ue(t))return!1;const n=t.getNodes();for(const s of n){const o=zn(s,i=>E(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},J),r.registerCommand(Wt,e=>{const t=j();return!!N(t)&&(t.insertLineBreak(e),!0)},J),r.registerCommand(Cr,()=>{const e=j();return!!N(e)&&(e.insertParagraph(),!0)},J),r.registerCommand(wa,()=>(Ec([Mr()]),!0),J),r.registerCommand(Aa,()=>Bo(e=>{const t=e.getIndent();e.setIndent(t+1)}),J),r.registerCommand(Pi,()=>Bo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),J),r.registerCommand(ru,e=>{const t=j();if(Ue(t)&&!tn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(N(t)){const n=Er(t.focus,!0);if(!e.shiftKey&&Y(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},J),r.registerCommand(nu,e=>{const t=j();if(Ue(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(N(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===te().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Er(t.focus,!1);if(!e.shiftKey&&Y(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},J),r.registerCommand(tu,e=>{const t=j();if(Ue(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!N(t))return!1;if(xo(t,!0)){const n=e.shiftKey;return e.preventDefault(),vo(t,n,!0),!0}return!1},J),r.registerCommand(eu,e=>{const t=j();if(Ue(t)&&!tn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!N(t))return!1;const n=e.shiftKey;return!!xo(t,!1)&&(e.preventDefault(),vo(t,n,!1),!0)},J),r.registerCommand(su,e=>{if(tn(e.target))return!1;const t=j();if(!N(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!me(s)&&td(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(Pi,void 0)):(!ko||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(wt,!0))},J),r.registerCommand(ou,e=>{if(tn(e.target))return!1;const t=j();return!!N(t)&&(e.preventDefault(),r.dispatchCommand(wt,!1))},J),r.registerCommand(an,e=>{const t=j();if(!N(t))return!1;if(e!==null){if((ko||pd||md)&&hd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Wt,!1)}return r.dispatchCommand(Cr,void 0)},J),r.registerCommand(iu,()=>{const e=j();return!!N(e)&&(r.blur(),!0)},J),r.registerCommand(uu,e=>{const[,t]=en(e);if(t.length>0){const s=Eo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,u=Jt(i);if(u!==null){const l=wc();if(P(u))l.anchor.set(u.getKey(),o,"text"),l.focus.set(u.getKey(),o,"text");else{const c=u.getParentOrThrow().getKey(),f=u.getIndexWithinParent()+1;l.anchor.set(c,f,"element"),l.focus.set(c,f,"element")}const a=yu(l);Ke(a)}r.dispatchCommand(So,t)}return e.preventDefault(),!0}const n=j();return!!N(n)},J),r.registerCommand(lu,e=>{const[t]=en(e),n=j();return!(t&&!N(n))},J),r.registerCommand(au,e=>{const[t]=en(e),n=j();if(t&&!N(n))return!1;const s=Eo(e.clientX,e.clientY);if(s!==null){const o=Jt(s.node);Y(o)&&e.preventDefault()}return!0},J),r.registerCommand(vs,()=>(sc(),!0),J),r.registerCommand(Bn,e=>(wo(r,ht(e,ClipboardEvent)?e:null),!0),J),r.registerCommand(Vs,e=>(async function(t,n){await wo(n,ht(t,ClipboardEvent)?t:null),n.update(()=>{const s=j();N(s)?s.removeText():Ue(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),J),r.registerCommand(Tn,e=>{const[,t,n]=en(e);return t.length>0&&!n?(r.dispatchCommand(So,t),!0):ti(e.target)?!1:j()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=j(),u=ht(s,InputEvent)||ht(s,KeyboardEvent)?null:s.clipboardData;u!=null&&i!==null&&Do(u,i,o)},{tag:"paste"})}(e,r),!0)},J))}const Rs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function No(r){return r.getEditorState().read(tl(r.isComposing()))}function xd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Je(),s=function(o,i){const[u,l]=T.useState(()=>o.getDecorators());return Rs(()=>o.registerDecoratorListener(a=>{wi.flushSync(()=>{l(a)})}),[o]),T.useEffect(()=>{l(o.getDecorators())},[o]),T.useMemo(()=>{const a=[],c=Object.keys(u);for(let f=0;f<c.length;f++){const d=c[f],h=v.jsx(i,{onError:g=>o._onError(g),children:v.jsx(T.Suspense,{fallback:null,children:u[d]})}),p=o.getElementByKey(d);p!==null&&a.push(wi.createPortal(h,p,d))}return a},[i,u,o])}(n,t);return function(o){Rs(()=>Ft(_d(o),rd(o)),[o])}(n),v.jsxs(v.Fragment,{children:[r,v.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=Je(),t=function(s){const[o,i]=T.useState(()=>No(s));return Rs(()=>{function u(){const l=No(s);i(l)}return u(),Ft(s.registerUpdateListener(()=>{u()}),s.registerEditableListener(()=>{u()}))},[s]),o}(e),n=jc();return t?typeof r=="function"?r(n):r:null}const fl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function bd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:u,ariaLabel:l,ariaLabelledBy:a,ariaMultiline:c,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:p,id:g,role:_="textbox",spellCheck:D=!0,style:y,tabIndex:C,"data-testid":x,...w},b){const[k,A]=T.useState(r.isEditable()),S=T.useCallback(L=>{L&&L.ownerDocument&&L.ownerDocument.defaultView?r.setRootElement(L):r.setRootElement(null)},[r]),O=T.useMemo(()=>function(...L){return W=>{L.forEach(q=>{typeof q=="function"?q(W):q!=null&&(q.current=W)})}}(b,S),[S,b]);return fl(()=>(A(r.isEditable()),r.registerEditableListener(L=>{A(L)})),[r]),v.jsx("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?t:"none","aria-controls":k?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":k&&_==="combobox"?!!i:void 0,...u!=null?{"aria-invalid":u}:{},"aria-label":l,"aria-labelledby":a,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":d,autoCapitalize:h,className:p,contentEditable:k,"data-testid":x,id:g,ref:O,role:k?_:void 0,spellCheck:D,style:y,tabIndex:C,...w})}const Dd=T.forwardRef(bd);function Fo(r){return r.getEditorState().read(tl(r.isComposing()))}const Cd=T.forwardRef(wd);function wd(r,e){const{placeholder:t,...n}=r,[s]=Je();return v.jsxs(v.Fragment,{children:[v.jsx(Dd,{editor:s,...n,ref:e}),t!=null&&v.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[u,l]=T.useState(()=>Fo(i));return fl(()=>{function a(){const c=Fo(i);l(c)}return a(),Ft(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),u}(e),[n,s]=T.useState(e.isEditable());if(T.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:v.jsx("div",{"aria-hidden":!0,children:o})}const rn=0,Ms=1,js=2,Le=0,Ed=1,Lo=2,kd=3,Sd=4;function Td(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Le;const o=e._selection,i=r._selection;if(s)return Ed;if(!(N(o)&&N(i)&&i.isCollapsed()&&o.isCollapsed()))return Le;const u=function(D,y,C){const x=D._nodeMap,w=[];for(const b of y){const k=x.get(b);k!==void 0&&w.push(k)}for(const[b,k]of C){if(!k)continue;const A=x.get(b);A===void 0||me(A)||w.push(A)}return w}(e,t,n);if(u.length===0)return Le;if(u.length>1){const D=e._nodeMap,y=D.get(o.anchor.key),C=D.get(i.anchor.key);return y&&C&&!r._nodeMap.has(y.__key)&&P(y)&&y.__text.length===1&&o.anchor.offset===1?Lo:Le}const l=u[0],a=r._nodeMap.get(l.__key);if(!P(a)||!P(l)||a.__mode!==l.__mode)return Le;const c=a.__text,f=l.__text;if(c===f)return Le;const d=o.anchor,h=i.anchor;if(d.key!==h.key||d.type!=="text")return Le;const p=d.offset,g=h.offset,_=f.length-c.length;return _===1&&g===p-1?Lo:_===-1&&g===p+1?kd:_===-1&&g===p?Sd:Le}function Bd(r,e){let t=Date.now(),n=Le;return(s,o,i,u,l,a)=>{const c=Date.now();if(a.has("historic"))return n=Le,t=c,js;const f=Td(s,o,u,l,r.isComposing()),d=(()=>{const h=i===null||i.editor===r,p=a.has("history-push");if(!p&&h&&a.has("history-merge"))return rn;if(s===null)return Ms;const g=o._selection;return u.size>0||l.size>0?p===!1&&f!==Le&&f===n&&c<t+e&&h||u.size===1&&function(_,D,y){const C=D._nodeMap.get(_),x=y._nodeMap.get(_),w=D._selection,b=y._selection;return!(N(w)&&N(b)&&w.anchor.type==="element"&&w.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!P(C)||!P(x)||C.__parent!==x.__parent)&&JSON.stringify(D.read(()=>C.exportJSON()))===JSON.stringify(y.read(()=>x.exportJSON()))}(Array.from(u)[0],s,o)?rn:Ms:g!==null?rn:js})();return t=c,n=f,d}}function Po(r){r.undoStack=[],r.redoStack=[],r.current=null}function Nd(r,e,t){const n=Bd(r,t);return Ft(r.registerCommand(Us,()=>(function(o,i){const u=i.redoStack,l=i.undoStack;if(l.length!==0){const a=i.current,c=l.pop();a!==null&&(u.push(a),o.dispatchCommand(Jr,!0)),l.length===0&&o.dispatchCommand(Qr,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),J),r.registerCommand(Ws,()=>(function(o,i){const u=i.redoStack,l=i.undoStack;if(u.length!==0){const a=i.current;a!==null&&(l.push(a),o.dispatchCommand(Qr,!0));const c=u.pop();u.length===0&&o.dispatchCommand(Jr,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),J),r.registerCommand(Sa,()=>(Po(e),!1),J),r.registerCommand(Ta,()=>(Po(e),r.dispatchCommand(Jr,!1),r.dispatchCommand(Qr,!1),!0),J),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:u,dirtyElements:l,tags:a})=>{const c=e.current,f=e.redoStack,d=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const p=n(i,o,c,u,l,a);if(p===Ms)f.length!==0&&(e.redoStack=[],r.dispatchCommand(Jr,!1)),c!==null&&(d.push({...c}),r.dispatchCommand(Qr,!0));else if(p===js)return;e.current={editor:r,editorState:o}}))}function Fd(){return{current:null,redoStack:[],undoStack:[]}}function Ld({delay:r,externalHistoryState:e}){const[t]=Je();return function(n,s,o=1e3){const i=T.useMemo(()=>s||Fd(),[s]);T.useEffect(()=>Nd(n,i,o),[o,n,i])}(t,e,r),null}const Pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?T.useLayoutEffect:T.useEffect;function Od({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Je();return Pd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:u,tags:l})=>{e&&o.size===0&&i.size===0||r&&l.has("history-merge")||u.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function Is(r,e){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Is(r,e)}var Oo={error:null},Rd=function(r){var e,t;function n(){for(var o,i=arguments.length,u=new Array(i),l=0;l<i;l++)u[l]=arguments[l];return(o=r.call.apply(r,[this].concat(u))||this).state=Oo,o.resetErrorBoundary=function(){for(var a,c=arguments.length,f=new Array(c),d=0;d<c;d++)f[d]=arguments[d];o.props.onReset==null||(a=o.props).onReset.apply(a,f),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,Is(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(Oo)},s.componentDidCatch=function(o,i){var u,l;(u=(l=this.props).onError)==null||u.call(l,o,i)},s.componentDidUpdate=function(o,i){var u,l,a,c,f=this.state.error,d=this.props.resetKeys;f!==null&&i.error!==null&&((a=o.resetKeys)===void 0&&(a=[]),(c=d)===void 0&&(c=[]),a.length!==c.length||a.some(function(h,p){return!Object.is(h,c[p])}))&&((u=(l=this.props).onResetKeysChange)==null||u.call(l,o.resetKeys,d),this.reset())},s.render=function(){var o=this.state.error,i=this.props,u=i.fallbackRender,l=i.FallbackComponent,a=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(ts.isValidElement(a))return a;if(typeof u=="function")return u(c);if(l)return ts.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(ts.Component);function Md({children:r,onError:e}){return v.jsx(Rd,{fallback:v.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function jd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var We=jd(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(Z(t)){const n=t.getParent();if(G(n)){e++,t=n.getParent();continue}We(40)}return e}return e}function $s(r){let e=r.getParent();G(e)||We(40);let t=e;for(;t!==null;)t=t.getParent(),G(t)&&(e=t);return e}function hl(r){let e=[];const t=r.getChildren().filter(Z);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();G(o)?e=e.concat(hl(o)):e.push(s)}return e}function Ve(r){return Z(r)&&G(r.getFirstChild())}function Ro(r){return Ae().append(r)}function pl(r,e){return Z(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Mo(r,e){r.update(()=>{const t=j();if(t!==null){const n=t.getNodes();if(N(t)){const o=t.getStartEndPoints();o===null&&We(143);const[i]=o,u=i.getNode(),l=u.getParent();if(pl(u,n)){const a=De(e);if(He(l)){u.replace(a);const c=Ae();E(u)&&(c.setFormat(u.getFormatType()),c.setIndent(u.getIndent())),a.append(c)}else if(Z(u)){const c=u.getParentOrThrow();Nt(a,c.getChildren()),c.replace(a)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!E(i)||!i.isEmpty()||Z(i)||s.has(i.getKey())){if(xu(i)){let u=i.getParent();for(;u!=null;){const l=u.getKey();if(G(u)){if(!s.has(l)){const a=De(e);Nt(a,u.getChildren()),u.replace(a),s.add(l)}break}{const a=u.getParent();if(He(a)&&!s.has(l)){s.add(l),jo(u,e);break}u=a}}}}else jo(i,e)}}})}function Nt(r,e){r.splice(r.getChildrenSize(),0,e)}function jo(r,e){if(G(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=Ae();let o;if(Nt(s,r.getChildren()),G(t)&&e===t.getListType())t.append(s),G(n)&&e===n.getListType()&&(Nt(t,n.getChildren()),n.remove()),o=t;else if(G(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=De(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function mi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Ve(t)&&Ve(n)&&(mi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function $d(r){r.update(()=>{const e=j();if(N(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(pl(s,n))t.add($s(s));else for(let o=0;o<n.length;o++){const i=n[o];if(xu(i)){const u=ed(i,Lt);u!=null&&t.add($s(u))}}for(const o of t){let i=o;const u=hl(o);for(const l of u){const a=ue();Nt(a,l.getChildren()),i.insertAfter(a),i=a,l.__key===e.anchor.key&&e.anchor.set(a.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(a.getKey(),0,"element"),l.remove()}o.remove()}}})}function qd(r){const e=new Set;if(Ve(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Ve(n)&&Ve(s)){const o=s.getFirstChild();if(G(o)){o.append(r);const i=n.getFirstChild();G(i)&&(Nt(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Ve(n)){const o=n.getFirstChild();if(G(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(Ve(s)){const o=s.getFirstChild();G(o)&&o.append(r)}else if(G(t)){const o=Ae(),i=De(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function zd(r){if(Ve(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(G(t?t.getParent():void 0)&&Z(t)&&G(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=Ae(),u=De(o);i.append(u),r.getPreviousSiblings().forEach(c=>u.append(c));const l=Ae(),a=De(o);l.append(a),Nt(a,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(r)}}}function Ud(){const r=j();if(!N(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Z(e)||e.getChildrenSize()!==0)return!1;const t=$s(e),n=e.getParent();G(n)||We(40);const s=n.getParent();let o;if(He(s))o=ue(),t.insertAfter(o);else{if(!Z(s))return!1;o=Ae(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const u=De(n.getListType());if(Qt(o))o.insertAfter(u);else{const l=Ae();l.append(u),o.insertAfter(l)}i.forEach(l=>{l.remove(),u.append(l)})}return function(u){let l=u;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const a=l.getParent();if(a==null||!Z(l)&&!G(l))break;l=a}l.remove()}(e),!0}function En(...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 Lt extends st{static getType(){return"listitem"}static clone(e){return new Lt(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 G(n)&&n.getListType()==="check"&&$o(t,this,null),t.value=this.__value,Io(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return G(s)&&s.getListType()==="check"&&$o(t,this,e),t.value=this.__value,Io(t,n.theme,this),!1}static transform(){return e=>{if(Z(e)||We(144),e.__checked==null)return;const t=e.getParent();G(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Wd,priority:0})}}static importJSON(e){const t=Ae();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(E(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Z(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!G(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=De(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&&(E(e)||We(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(G(n)||We(39),Z(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=De(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&&Ve(t)&&Ve(n)&&(mi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Ae(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ue();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=Z(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,u=e.focus,l=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(l,i.offset,"element"),u.type==="element"&&u.getNode().is(this)&&u.set(l,u.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 G(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(;Z(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&We(117),(e=Math.floor(e))>=0||We(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(zd(this),t--);return this}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return Qt(e)||Z(e)}extractWithChild(e,t){if(!N(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 De("bullet")}canMergeWhenEmpty(){return!0}}function Io(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let u;if(o&&o.nested&&(u=o.nested.listitem),i!==void 0&&n.push(...En(i)),o){const l=t.getParent(),a=G(l)&&l.getListType()==="check",c=t.getChecked();a&&!c||s.push(o.listitemUnchecked),a&&c||s.push(o.listitemChecked),a&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(u!==void 0){const l=En(u);t.getChildren().some(a=>G(a))?n.push(...l):s.push(...l)}s.length>0&&il(r,...s),n.length>0&&qr(r,...n)}function $o(r,e,t,n){G(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 Wd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Vd(t)}const e=r.getAttribute("aria-checked");return{node:Ae(e==="true"||e!=="false"&&void 0)}}function Vd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:Ae(r.hasAttribute("checked"))}}function Ae(r){return Qe(new Lt(void 0,r))}function Z(r){return r instanceof Lt}class er extends st{static getType(){return"list"}static clone(e){const t=e.__listType||Uo[e.__tag];return new er(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Uo[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,qo(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(qo(t,n.theme,this),!1)}static transform(){return e=>{G(e)||We(163),function(t){const n=t.getNextSibling();G(n)&&t.getListType()===n.getListType()&&mi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())Z(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),G(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:zo,priority:0}),ul:()=>({conversion:zo,priority:0})}}static importJSON(e){const t=De(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&&rt(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(Z(n))super.append(n);else{const s=Ae();if(G(n))s.append(n);else if(E(n))if(n.isInline())s.append(n);else{const o=ae(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Z(e)}}function qo(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],u=Id(t)-1,l=u%i.length,a=i[l],c=o[t.__tag];let f;const d=o.nested,h=o.checklist;if(d!==void 0&&d.list&&(f=d.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),a!==void 0){n.push(...En(a));for(let p=0;p<i.length;p++)p!==l&&s.push(t.__tag+p)}if(f!==void 0){const p=En(f);u>1?n.push(...p):s.push(...p)}}s.length>0&&il(r,...s),n.length>0&&qr(r,...n)}function Kd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Z(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{G(o)&&e.push(Ro(o))})}else e.push(Ro(n))}return e}function zo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=De("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(rt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?De("check"):De("bullet")),{after:Kd,node:t}}const Uo={ol:"number",ul:"bullet"};function De(r,e=1){return Qe(new er(r,e))}function G(r){return r instanceof er}const gl=Br(),ml=Br(),Hd=Br();function Gd(r){return Ft(r.registerCommand(ml,()=>(Mo(r,"number"),!0),Ut),r.registerCommand(gl,()=>(Mo(r,"bullet"),!0),Ut),r.registerCommand(Hd,()=>($d(r),!0),Ut),r.registerCommand(Cr,()=>!!Ud(),Ut))}function Jd(){const[r]=Je();return T.useEffect(()=>{if(!r.hasNodes([er,Lt]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){T.useEffect(()=>Gd(e),[e])}(r),null}const Qd=new Set(["http:","https:","mailto:","sms:","tel:"]);class Pt extends st{static getType(){return"link"}static clone(e){return new Pt(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),qr(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,u=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")),u!==e.__title&&(u?t.title=u:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:Yd,priority:1})}}static importJSON(e){const t=kn(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(!Qd.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=kn(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(!N(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 Yd(r){let e=null;if(uc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=kn(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function kn(r,e){return Qe(new Pt(r,e))}function ar(r){return r instanceof Pt}class zr extends Pt{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 zr(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=Wo(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(E(n)){const s=Wo(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function Wo(r,e){return Qe(new zr(r,e))}function Xd(r){return r instanceof zr}const Vo=Br();function ms(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=j();if(!N(o))return;const i=o.extract();if(r===null)i.forEach(u=>{const l=zn(u,a=>!Xd(a)&&ar(a));if(l){const a=l.getChildren();for(let c=0;c<a.length;c++)l.insertBefore(a[c]);l.remove()}});else{if(i.length===1){const a=function(c,f){let d=c;for(;d!==null&&d.getParent()!==null&&!f(d);)d=d.getParentOrThrow();return f(d)?d:null}(i[0],ar);if(a!==null)return a.setURL(r),t!==void 0&&a.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n))}let u=null,l=null;i.forEach(a=>{const c=a.getParent();if(c!==l&&c!==null&&(!E(a)||a.isInline())){if(ar(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(u)||(u=c,l=kn(r,{rel:s,target:t,title:n}),ar(c)?a.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):a.insertBefore(l)),ar(a)){if(a.is(l))return;if(l!==null){const f=a.getChildren();for(let d=0;d<f.length;d++)l.append(f[d])}a.remove()}else l!==null&&l.append(a)}})}}function Zd({validateUrl:r,attributes:e}){const[t]=Je();return T.useEffect(()=>{if(!t.hasNodes([Pt]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ft(t.registerCommand(Vo,n=>{if(n===null)return ms(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(ms(n,e),!0);{const{url:s,target:o,rel:i,title:u}=n;return ms(s,{...e,rel:i,target:o,title:u}),!0}},Ut),r!==void 0?t.registerCommand(Tn,n=>{const s=j();if(!N(s)||s.isCollapsed()||!ht(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(u=>E(u))&&(t.dispatchCommand(Vo,{...e,url:i}),n.preventDefault(),!0)},Ut):()=>{})},[t,r,e]),null}const ef={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},tf={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 rf({theme:r,disabled:e}){const[t]=Je(),n=T.useCallback(()=>{t.dispatchCommand(Pe,"bold")},[t]),s=T.useCallback(()=>{t.dispatchCommand(Pe,"italic")},[t]),o=T.useCallback(()=>{t.dispatchCommand(Pe,"underline")},[t]),i=T.useCallback(()=>{t.dispatchCommand(gl,void 0)},[t]),u=T.useCallback(()=>{t.dispatchCommand(ml,void 0)},[t]),l=T.useCallback(()=>{t.update(()=>{const f=j();N(f)&&Gc(f,()=>gi())})},[t]),a={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},c=`
|
|
74
74
|
.mail-editor-toolbar-btn:hover:not(:disabled) {
|
|
75
75
|
background: ${r.border};
|
|
76
76
|
}
|