@eddyter/core 1.0.4-beta.0 → 1.0.4-beta.1
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/editor.cjs +1 -1
- package/dist/editor.iife.js +1 -1
- package/dist/editor.mjs +4 -2
- package/dist/main.d.ts +1 -1
- package/dist/types.d.ts +16 -0
- package/package.json +1 -1
package/dist/editor.cjs
CHANGED
|
@@ -1801,4 +1801,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
1801
1801
|
`}n+=`@keyframes waa-ripple { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
|
|
1802
1802
|
`,n+=`@keyframes cteditor-dotPulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.55); } 70% { box-shadow: 0 0 0 11px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
|
|
1803
1803
|
`,n+=`@keyframes cteditor-waveBar { 0%,100% { height: 5px; opacity: 0.55; } 25% { height: 22px; opacity: 1; } 50% { height: 10px; opacity: 0.85; } 75% { height: 26px; opacity: 1; } }
|
|
1804
|
-
`,e.textContent=n,document.head.appendChild(e)}p1t=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},m1t=({elapsedTime:e,isPaused:t,isBatchMode:n,isProcessing:r,processingStatus:i,onPause:a,onResume:o,onStop:s})=>{let[c,l]=(0,Q.useState)(!1),{isDark:u}=R4(),d=L4();if((0,Q.useEffect)(()=>(h5++,h5===1&&l(!0),()=>{h5--}),[]),!c)return null;let f=null,p=document.querySelectorAll(`[data-toolbar-item="voiceTranscript"]`);for(let e of p){let t=e.getBoundingClientRect();if(t.width>0&&t.height>0){f=t;break}}let m=f?f.bottom+8:60,h=f?f.left+f.width/2:window.innerWidth/2;return(0,P0.createPortal)((0,X.jsx)(`div`,{id:`ct-editor-f47ac10b`,className:k$(`eddyter-scope`,u&&`dark cteditor-dark`),children:(0,X.jsxs)(`div`,{style:{top:m,left:h,userSelect:`none`},className:`cteditor-fixed cteditor--translate-x-1/2 cteditor-z-[9999] cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-white cteditor-pl-3 cteditor-pr-2 cteditor-h-[46px] cteditor-min-w-[260px] cteditor-rounded-full cteditor-mt-1 cteditor-overflow-hidden cteditor-border cteditor-border-foreground/10 cteditor-bg-gradient-to-b cteditor-from-main-background cteditor-to-background`,children:[(0,X.jsx)(`div`,{className:k$(`cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-pointer-events-none`,t?`cteditor-bg-[radial-gradient(50%_100%_at_0%_0%,rgba(234,179,8,0.10),transparent_60%)]`:`cteditor-bg-[radial-gradient(50%_100%_at_0%_0%,rgba(239,68,68,0.10),transparent_60%)]`)}),(0,X.jsxs)(`div`,{className:`cteditor-shrink-0 cteditor-relative cteditor-flex cteditor-items-center cteditor-justify-center cteditor-size-6`,children:[!t&&!r&&(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-inset-0 cteditor-rounded-full`,style:{animation:`cteditor-dotPulse 1.6s ease-out infinite`}}),(0,X.jsx)(`div`,{className:k$(`cteditor-relative cteditor-z-10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-transition-colors`,t||r?`cteditor-opacity-40`:`cteditor-text-red-500`),children:(0,X.jsx)(Bqt,{})})]}),r?(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-flex-1 cteditor-relative cteditor-z-10`,children:[(0,X.jsx)(y2,{style:{width:14,height:14,color:`#a1a1aa`},className:`cteditor-animate-spin`}),(0,X.jsx)(`span`,{className:`cteditor-text-xs`,children:i})]}):(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-[2.5px] cteditor-h-[26px] cteditor-flex-1 cteditor-relative cteditor-z-10 cteditor-text-foreground/20 dark:cteditor-text-foreground`,children:Array.from({length:24}).map((e,n)=>(0,X.jsx)(`div`,{style:{width:2,transformOrigin:`center`,background:n%3==0?`linear-gradient(180deg, #ef4444, rgba(239,68,68,0.45))`:`linear-gradient(180deg, currentColor, hsla(var(--cteditorf47ac10b-foreground) / 0.45))`,height:t?5:void 0,opacity:t?.55:void 0,animation:t?`none`:`cteditor-waveBar 1.1s ease-in-out infinite`,animationDelay:t?void 0:`${-(n*.17%1.1).toFixed(2)}s`},className:`cteditor-rounded-full`},n))}),(0,X.jsx)(`span`,{className:`cteditor-text-[13.5px] cteditor-font-medium cteditor-min-w-10 cteditor-text-right cteditor-shrink-0 cteditor-font-[monospace] cteditor-ml-auto cteditor-relative cteditor-z-10 ${t?`cteditor-text-yellow-500`:`cteditor-text-foreground`}`,children:p1t(e)}),!n&&!r&&(0,X.jsx)(`button`,{type:`button`,onClick:t?o:a,title:t?`Resume`:`Pause`,className:`cteditor-relative cteditor-z-10 cteditor-bg-foreground/5 cteditor-text-foreground cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-full cteditor-border cteditor-border-foreground/10 hover:cteditor-bg-foreground/10 cteditor-outline-0 cteditor-cursor-pointer cteditor-shrink-0 cteditor-transition-colors`,children:t?(0,X.jsx)(Vqt,{}):(0,X.jsx)(tJt,{className:`cteditor-size-4`})}),(0,X.jsx)(`button`,{type:`button`,onClick:s,title:`Stop recording`,className:`cteditor-relative cteditor-z-10 cteditor-bg-red-500/10 cteditor-text-red-500 cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-full cteditor-border cteditor-border-red-500/20 hover:cteditor-bg-red-500/20 cteditor-outline-0 cteditor-cursor-pointer cteditor-shrink-0 cteditor-transition-colors`,children:(0,X.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,X.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`})})})]})}),d||document.body)},h1t=({recording:e,editor:t,voiceRestrictedByok:n,selectedLanguage:r,setSelectedLanguage:i})=>{let{isRecording:a,isPaused:o,isLoading:s,isProcessing:c,processingStatus:l,isBatchMode:u,elapsedTime:d,toggleRecording:f,pauseRecording:p,resumeRecording:m,setEditor:h}=e;return(0,Q.useEffect)(()=>{h(t)},[t,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(c1t,{selectedLanguage:r,onLanguageChange:i,disabled:s||a||c}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:f,disabled:s||!a&&c||!t||n,className:k$(n&&`cteditor-opacity-60 cteditor-cursor-not-allowed`,a?o?`cteditor-bg-yellow-500/10 cteditor-text-yellow-500 cteditor-ring-1 cteditor-ring-yellow-500/30 hover:cteditor-bg-yellow-500/20 hover:cteditor-text-yellow-500`:`cteditor-bg-red-500/10 cteditor-text-red-500 cteditor-ring-1 cteditor-ring-red-500/30 hover:cteditor-bg-red-500/20 hover:cteditor-text-red-500`:`cteditor-text-foreground hover:cteditor-bg-foreground/5`),children:s?(0,X.jsxs)(`svg`,{className:`!cteditor-size-4 cteditor-animate-spin`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,X.jsx)(`circle`,{className:`cteditor-opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,X.jsx)(`path`,{className:`cteditor-opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}):(0,X.jsx)(fqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:n?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:s?`Starting recording...`:a?`Stop recording`:`Start voice recording`})})]})}),(a||c)&&(0,X.jsx)(m1t,{elapsedTime:d,isPaused:o,isBatchMode:u,isProcessing:c,processingStatus:l,onPause:p,onResume:m,onStop:f}),(0,X.jsx)(f1t,{isRecording:a&&!o,editor:t})]})},g1t=({editor:e,apiKey:t,voiceRestrictedByok:n})=>{let[r,i]=(0,Q.useState)(`en`);return(0,X.jsx)(h1t,{recording:qLt(t,r),editor:e,voiceRestrictedByok:n,selectedLanguage:r,setSelectedLanguage:i})},_1t=({editor:e,apiKey:t})=>{let n=K0(),r=n?.isByokPlan??!1,i=n?.byokApiKeys,a=r&&!i?.hasAssemblyaiKey,o=JLt();return o?(0,X.jsx)(h1t,{recording:o,editor:e,voiceRestrictedByok:a,selectedLanguage:o.selectedLanguage,setSelectedLanguage:o.setSelectedLanguage}):(0,X.jsx)(g1t,{editor:e,apiKey:t,voiceRestrictedByok:a})},v1t=()=>(0,X.jsx)(d1t,{}),g5=new Map,_5=null,v5={backgroundColor:`#2d2d2d`,textColor:`#f8f8f2`,gutterBackgroundColor:`#252525`,gutterTextColor:`#8c8c8c`,tokenColors:{comment:`#6a9955`,punctuation:`#d4d4d4`,property:`#e06c75`,selector:`#98c379`,operator:`#d19a66`,attr:`#61afef`,variable:`#e5c07b`,function:`#c678dd`}},y1t=[`--cteditorf47ac10b-card`,`--cteditorf47ac10b-border`,`--cteditorf47ac10b-foreground`,`--cteditorf47ac10b-muted-foreground`],b1t=new Set([`PlaygroundEditorTheme__checklist`,`PlaygroundEditorTheme__listItem`,`PlaygroundEditorTheme__listItemChecked`,`PlaygroundEditorTheme__listItemUnchecked`]),y5={A4_WIDTH:`210mm`,MARGIN:12,RENDER_DELAY:100,HIGHLIGHT_PADDING:{TOP:`0.03em`,BOTTOM:`0.18em`,VERTICAL_OFFSET:`0.10em`},COLORS:{DEFAULT_HIGHLIGHT:`rgba(255,212,0,0.45)`,WHITE_THRESHOLD:240,NEAR_BLACK:`#111111`}},x1t={rule:`#d4d0c8`,muted:`#8a857a`,accent:`#ef9f27`,ink:`#0f0f0e`},S1t=async()=>{let e=await Promise.resolve().then(()=>(YSt(),WSt)).then(e=>e.h);return e?.default||e},C1t=async()=>{let e=await Promise.resolve().then(()=>(lot(),U7e));return e?.default||e},w1t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],T1t=`https://unpkg.com/html-docx-js@0.3.1/dist/html-docx.js`,E1t=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),D1t=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/),O1t=()=>{let[e]=Gd(),t=(0,Q.useCallback)(t=>{e.update(()=>{let e=W();U(e)&&Bu(e,t)})},[e]);return{onFontColorSelect:(0,Q.useCallback)(e=>{t({color:e})},[t]),onBgColorSelect:(0,Q.useCallback)(e=>{t({"background-color":e})},[t]),onHighlightColorSelect:(0,Q.useCallback)(n=>{n===null?(e.dispatchCommand(pc,`highlight`),t({"background-color":`transparent`})):(e.dispatchCommand(pc,`highlight`),t({"background-color":n}))},[e,t])}},b5=di(`AI_IMAGE_COMMAND`),x5=di(`AI_TRANSLATE_COMMAND`),S5=di(`AI_ADJUST_TONE_COMMAND`),C5=`rovingFocusGroup.onEntryFocus`,k1t={bubbles:!1,cancelable:!0},w5=`RovingFocusGroup`,[T5,A1t,j1t]=tIt(w5),[M1t,N1t]=j$(w5,[j1t]),[P1t,F1t]=M1t(w5),I1t=Z.forwardRef((e,t)=>(0,X.jsx)(T5.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(T5.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(L1t,{...e,ref:t})})})),I1t.displayName=w5,L1t=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=Z.useRef(null),p=O$(t,f),m=nIt(a),[h,g]=N$({prop:o,defaultProp:s??null,onChange:c,caller:w5}),[_,v]=Z.useState(!1),y=F$(l),b=A1t(n),x=Z.useRef(!1),[S,C]=Z.useState(0);return Z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(C5,y),()=>e.removeEventListener(C5,y)},[y]),(0,X.jsx)(P1t,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:Z.useCallback(e=>g(e),[g]),onItemShiftTab:Z.useCallback(()=>v(!0),[]),onFocusableItemAdd:Z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:Z.useCallback(()=>C(e=>e-1),[]),children:(0,X.jsx)(e4.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:A$(e.onMouseDown,()=>{x.current=!0}),onFocus:A$(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(C5,k1t);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);kRt([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:A$(e.onBlur,()=>v(!1))})})}),E5=`RovingFocusGroupItem`,R1t=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=M$(),l=a||c,u=F1t(E5,n),d=u.currentTabStopId===l,f=A1t(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return Z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,X.jsx)(T5.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(e4.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:A$(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:A$(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:A$(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ORt(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ARt(n,r+1):n.slice(r+1)}setTimeout(()=>kRt(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})}),R1t.displayName=E5,z1t={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`},B1t=I1t,V1t=R1t,D5=[`Enter`,` `],H1t=[`ArrowDown`,`PageUp`,`Home`],U1t=[`ArrowUp`,`PageDown`,`End`],W1t=[...H1t,...U1t],G1t={ltr:[...D5,`ArrowRight`],rtl:[...D5,`ArrowLeft`]},K1t={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},O5=`Menu`,[k5,q1t,J1t]=tIt(O5),[A5,Y1t]=j$(O5,[J1t,F3,N1t]),j5=F3(),X1t=N1t(),[Z1t,M5]=A5(O5),[Q1t,N5]=A5(O5),$1t=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=j5(t),[c,l]=Z.useState(null),u=Z.useRef(!1),d=F$(a),f=nIt(i);return Z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,X.jsx)(L3,{...s,children:(0,X.jsx)(Z1t,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(Q1t,{scope:t,onClose:Z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},$1t.displayName=O5,e0t=`MenuAnchor`,P5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(R3,{...j5(n),...r,ref:t})}),P5.displayName=e0t,F5=`MenuPortal`,[t0t,n0t]=A5(F5,{forceMount:void 0}),r0t=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=M5(F5,t);return(0,X.jsx)(t0t,{scope:t,forceMount:n,children:(0,X.jsx)(s4,{present:n||a.open,children:(0,X.jsx)(o4,{asChild:!0,container:i,children:r})})})},r0t.displayName=F5,I5=`MenuContent`,[i0t,L5]=A5(I5),a0t=Z.forwardRef((e,t)=>{let n=n0t(I5,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=M5(I5,e.__scopeMenu),o=N5(I5,e.__scopeMenu);return(0,X.jsx)(k5.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(s4,{present:r||a.open,children:(0,X.jsx)(k5.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(o0t,{...i,ref:t}):(0,X.jsx)(s0t,{...i,ref:t})})})})}),o0t=Z.forwardRef((e,t)=>{let n=M5(I5,e.__scopeMenu),r=Z.useRef(null),i=O$(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return E4(e)},[]),(0,X.jsx)(R5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:A$(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),s0t=Z.forwardRef((e,t)=>{let n=M5(I5,e.__scopeMenu);return(0,X.jsx)(R5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),c0t=P$(`MenuContent.ScrollLock`),R5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=M5(I5,n),_=N5(I5,n),v=j5(n),y=X1t(n),b=q1t(n),[x,S]=Z.useState(null),C=Z.useRef(null),w=O$(t,C,g.onContentChange),T=Z.useRef(0),E=Z.useRef(``),D=Z.useRef(0),O=Z.useRef(null),k=Z.useRef(`right`),A=Z.useRef(0),j=m?x4:Z.Fragment,M=m?{as:c0t,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=FRt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};Z.useEffect(()=>()=>window.clearTimeout(T.current),[]),R$();let P=Z.useCallback(e=>k.current===O.current?.side&&LRt(e,O.current?.area),[]);return(0,X.jsx)(i0t,{scope:n,searchRef:E,onItemEnter:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Z.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:Z.useCallback(e=>{O.current=e},[]),children:(0,X.jsx)(j,{...M,children:(0,X.jsx)(a4,{asChild:!0,trapped:i,onMountAutoFocus:A$(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(n4,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,X.jsx)(B1t,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:A$(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(z3,{role:`menu`,"aria-orientation":`vertical`,"data-state":jRt(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:A$(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!W1t.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);U1t.includes(e.key)&&a.reverse(),NRt(a)}),onBlur:A$(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:A$(e.onPointerMove,p0(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})}),a0t.displayName=I5,l0t=`MenuGroup`,z5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{role:`group`,...r,ref:t})}),z5.displayName=l0t,u0t=`MenuLabel`,d0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{...r,ref:t})}),d0t.displayName=u0t,B5=`MenuItem`,f0t=`menu.itemSelect`,V5=Z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Z.useRef(null),o=N5(B5,e.__scopeMenu),s=L5(B5,e.__scopeMenu),c=O$(t,a),l=Z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(f0t,{bubbles:!0,cancelable:!0});e.addEventListener(f0t,e=>r?.(e),{once:!0}),sMt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(p0t,{...i,ref:c,disabled:n,onClick:A$(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:A$(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:A$(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||D5.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})}),V5.displayName=B5,p0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=L5(B5,n),s=X1t(n),c=Z.useRef(null),l=O$(t,c),[u,d]=Z.useState(!1),[f,p]=Z.useState(``);return Z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,X.jsx)(k5.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(V1t,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(e4.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:A$(e.onPointerMove,p0(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:A$(e.onPointerLeave,p0(e=>o.onItemLeave(e))),onFocus:A$(e.onFocus,()=>d(!0)),onBlur:A$(e.onBlur,()=>d(!1))})})})}),m0t=`MenuCheckboxItem`,h0t=Z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(S0t,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(V5,{role:`menuitemcheckbox`,"aria-checked":f0(n)?`mixed`:n,...i,ref:t,"data-state":MRt(n),onSelect:A$(i.onSelect,()=>r?.(f0(n)?!0:!n),{checkForDefaultPrevented:!1})})})}),h0t.displayName=m0t,g0t=`MenuRadioGroup`,[_0t,v0t]=A5(g0t,{value:void 0,onValueChange:()=>{}}),y0t=Z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=F$(r);return(0,X.jsx)(_0t,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(z5,{...i,ref:t})})}),y0t.displayName=g0t,b0t=`MenuRadioItem`,x0t=Z.forwardRef((e,t)=>{let{value:n,...r}=e,i=v0t(b0t,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(S0t,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(V5,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":MRt(a),onSelect:A$(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})}),x0t.displayName=b0t,H5=`MenuItemIndicator`,[S0t,C0t]=A5(H5,{checked:!1}),w0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=C0t(H5,n);return(0,X.jsx)(s4,{present:r||f0(a.checked)||a.checked===!0,children:(0,X.jsx)(e4.span,{...i,ref:t,"data-state":MRt(a.checked)})})}),w0t.displayName=H5,T0t=`MenuSeparator`,E0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})}),E0t.displayName=T0t,D0t=`MenuArrow`,O0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(B3,{...j5(n),...r,ref:t})}),O0t.displayName=D0t,U5=`MenuSub`,[k0t,A0t]=A5(U5),j0t=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=M5(U5,t),o=j5(t),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=F$(i);return Z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(L3,{...o,children:(0,X.jsx)(Z1t,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(k0t,{scope:t,contentId:M$(),triggerId:M$(),trigger:s,onTriggerChange:c,children:n})})})},j0t.displayName=U5,W5=`MenuSubTrigger`,M0t=Z.forwardRef((e,t)=>{let n=M5(W5,e.__scopeMenu),r=N5(W5,e.__scopeMenu),i=A0t(W5,e.__scopeMenu),a=L5(W5,e.__scopeMenu),o=Z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return Z.useEffect(()=>u,[u]),Z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,X.jsx)(P5,{asChild:!0,...l,children:(0,X.jsx)(p0t,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":jRt(n.open),...e,ref:D$(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:A$(e.onPointerMove,p0(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:A$(e.onPointerLeave,p0(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:A$(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||G1t[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})}),M0t.displayName=W5,N0t=`MenuSubContent`,P0t=Z.forwardRef((e,t)=>{let n=n0t(I5,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=M5(I5,e.__scopeMenu),o=N5(I5,e.__scopeMenu),s=A0t(N0t,e.__scopeMenu),c=Z.useRef(null),l=O$(t,c);return(0,X.jsx)(k5.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(s4,{present:r||a.open,children:(0,X.jsx)(k5.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(R5,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:A$(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:A$(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:A$(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=K1t[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})}),P0t.displayName=N0t,F0t=$1t,I0t=P5,L0t=r0t,R0t=a0t,z0t=z5,B0t=d0t,V0t=V5,H0t=h0t,U0t=y0t,W0t=x0t,G0t=w0t,K0t=E0t,q0t=O0t,J0t=j0t,Y0t=M0t,X0t=P0t,G5=`DropdownMenu`,[Z0t]=j$(G5,[Y1t]),K5=Y1t(),[Q0t,$0t]=Z0t(G5),e2t=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=K5(t),l=Z.useRef(null),[u,d]=N$({prop:i,defaultProp:a??!1,onChange:o,caller:G5});return(0,X.jsx)(Q0t,{scope:t,triggerId:M$(),triggerRef:l,contentId:M$(),open:u,onOpenChange:d,onOpenToggle:Z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(F0t,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},e2t.displayName=G5,t2t=`DropdownMenuTrigger`,n2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=$0t(t2t,n);return(0,X.jsx)(I0t,{asChild:!0,...K5(n),children:(0,X.jsx)(e4.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:D$(t,a.triggerRef),onPointerDown:A$(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:A$(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})}),n2t.displayName=t2t,r2t=`DropdownMenuPortal`,i2t=e=>{let{__scopeDropdownMenu:t,...n}=e;return(0,X.jsx)(L0t,{...K5(t),...n})},i2t.displayName=r2t,a2t=`DropdownMenuContent`,o2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$0t(a2t,n),a=K5(n),o=Z.useRef(!1);return(0,X.jsx)(R0t,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:A$(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:A$(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})}),o2t.displayName=a2t,s2t=`DropdownMenuGroup`,c2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(z0t,{...K5(n),...r,ref:t})}),c2t.displayName=s2t,l2t=`DropdownMenuLabel`,u2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(B0t,{...K5(n),...r,ref:t})}),u2t.displayName=l2t,d2t=`DropdownMenuItem`,f2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(V0t,{...K5(n),...r,ref:t})}),f2t.displayName=d2t,p2t=`DropdownMenuCheckboxItem`,m2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(H0t,{...K5(n),...r,ref:t})}),m2t.displayName=p2t,h2t=`DropdownMenuRadioGroup`,g2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(U0t,{...K5(n),...r,ref:t})}),g2t.displayName=h2t,_2t=`DropdownMenuRadioItem`,v2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(W0t,{...K5(n),...r,ref:t})}),v2t.displayName=_2t,y2t=`DropdownMenuItemIndicator`,b2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(G0t,{...K5(n),...r,ref:t})}),b2t.displayName=y2t,x2t=`DropdownMenuSeparator`,S2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(K0t,{...K5(n),...r,ref:t})}),S2t.displayName=x2t,C2t=`DropdownMenuArrow`,w2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(q0t,{...K5(n),...r,ref:t})}),w2t.displayName=C2t,T2t=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=K5(t),[s,c]=N$({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,X.jsx)(J0t,{...o,open:s,onOpenChange:c,children:n})},E2t=`DropdownMenuSubTrigger`,D2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(Y0t,{...K5(n),...r,ref:t})}),D2t.displayName=E2t,O2t=`DropdownMenuSubContent`,k2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(X0t,{...K5(n),...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})}),k2t.displayName=O2t,A2t=e2t,j2t=n2t,M2t=i2t,N2t=o2t,P2t=u2t,F2t=f2t,I2t=m2t,L2t=v2t,R2t=b2t,z2t=S2t,B2t=T2t,V2t=D2t,H2t=k2t,q5=({modal:e=!1,...t})=>(0,X.jsx)(A2t,{modal:e,...t}),J5=j2t,U2t=M2t,Y5=B2t,X5=Z.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,X.jsxs)(V2t,{ref:i,className:k$(`cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-outline-none focus:cteditor-bg-foreground/5 data-[state=open]:cteditor-bg-foreground/10 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`cteditor-pl-8`,e),...r,children:[n,(0,X.jsx)(l2,{className:`cteditor-ml-auto`})]})),X5.displayName=V2t.displayName,Z5=Z.forwardRef(({className:e,...t},n)=>(0,X.jsx)(H2t,{ref:n,className:k$(`cteditor-z-[9999] cteditor-min-w-[8rem] cteditor-overflow-hidden cteditor-rounded-xl cteditor-border cteditor-bg-popover cteditor-p-1 cteditor-text-popover-foreground ct-menu-shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]`,e),...t})),Z5.displayName=H2t.displayName,Q5=Z.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,X.jsx)(M2t,{container:L4(),children:(0,X.jsx)(N2t,{ref:r,sideOffset:t,className:k$(`cteditor-z-[9999] cteditor-max-h-[var(--radix-dropdown-menu-content-available-height)] cteditor-min-w-[8rem] cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-rounded-xl cteditor-border cteditor-border-border cteditor-bg-dropdown cteditor-p-1 cteditor-text-foreground ct-menu-shadow`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]`,e),...n})})),Q5.displayName=N2t.displayName,$5=Z.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(F2t,{ref:r,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1 cteditor-text-[13px] cteditor-outline-none focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,t&&`cteditor-pl-8`,e),...n})),$5.displayName=F2t.displayName,W2t=Z.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,X.jsxs)(I2t,{ref:i,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-lg cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,e),checked:n,...r,children:[(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-left-2 cteditor-flex cteditor-h-3.5 cteditor-w-3.5 cteditor-items-center cteditor-justify-center`,children:(0,X.jsx)(R2t,{children:(0,X.jsx)(s2,{className:`cteditor-h-4 cteditor-w-4`})})}),t]})),W2t.displayName=I2t.displayName,G2t=Z.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(L2t,{ref:r,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-lg cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,e),...n,children:[(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-left-2 cteditor-flex cteditor-h-3.5 cteditor-w-3.5 cteditor-items-center cteditor-justify-center`,children:(0,X.jsx)(R2t,{children:(0,X.jsx)(sUt,{className:`cteditor-h-2 cteditor-w-2 cteditor-fill-current`})})}),t]})),G2t.displayName=L2t.displayName,K2t=Z.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(P2t,{ref:r,className:k$(`cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-font-semibold`,t&&`cteditor-pl-8`,e),...n})),K2t.displayName=P2t.displayName,e7=Z.forwardRef(({className:e,...t},n)=>(0,X.jsx)(z2t,{ref:n,className:k$(`cteditor--mx-1 cteditor-my-1 cteditor-h-px cteditor-bg-muted`,e),...t})),e7.displayName=z2t.displayName,t7=[`1`,`1.15`,`1.5`,`2`,`2.5`,`3`],n7=`1.5`,q2t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(n7),r=Q.useRef(null),i=Q.useRef(!1);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();if(U(e)){let t=m0(Hu(e,`line-height`,n7));if(i.current){i.current=!1;return}!e.isCollapsed()&&r.current!==null&&(r.current=null),r.current!==null&&t!==r.current&&t!==n7&&(r.current=null),r.current===null&&n(t)}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(r.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=W();U(e)&&e.isCollapsed()&&Bu(e,{"line-height":r.current})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(r.current!==null){let t=r.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(i.current=!0,Bu(e,{"line-height":t}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let a=(0,Q.useCallback)(t=>{let a=m0(t);r.current=a,i.current=!0,n(a),e.update(()=>{let e=W();U(e)&&Bu(e,{"line-height":a})})},[e]),o=e=>{e.preventDefault()};return(0,X.jsxs)(Y5,{children:[(0,X.jsx)(X5,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-xs [&>svg]:cteditor-w-5`,children:`Line Height`}),(0,X.jsx)(Z5,{onMouseDown:o,className:`cteditor-border-foreground/10`,children:t7.map(e=>(0,X.jsx)($5,{onMouseDown:o,onClick:()=>a(e),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2 `,t===e&&`cteditor-bg-foreground/10`),children:e},e))})]})},J2t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(n7),r=Q.useRef(null),i=Q.useRef(!1);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();if(U(e)){let t=m0(Hu(e,`line-height`,n7));if(i.current){i.current=!1;return}!e.isCollapsed()&&r.current!==null&&(r.current=null),r.current!==null&&t!==r.current&&t!==n7&&(r.current=null),r.current===null&&n(t)}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(r.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=W();U(e)&&e.isCollapsed()&&Bu(e,{"line-height":r.current})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(r.current!==null){let t=r.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(i.current=!0,Bu(e,{"line-height":t}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let a=(0,Q.useCallback)(t=>{let a=m0(t);r.current=a,i.current=!0,n(a),e.update(()=>{let e=W();U(e)&&Bu(e,{"line-height":a})})},[e]),o=e=>{e.preventDefault()};return(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-6 cteditor-gap-1`,children:t7.map((e,n)=>(0,X.jsx)(`button`,{type:`button`,onMouseDown:o,onClick:()=>a(e),className:k$(`cteditor-relative cteditor-flex cteditor-justify-center cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,t===e&&`cteditor-bg-foreground/10`),title:`Line Height: ${e}`,children:e},n))})},Y2t=()=>{let[e,t]=(0,Q.useState)(!1);return{show:()=>t(!0),hide:()=>t(!1),isOpen:e}},X2t=({enableLineHeight:e=!0})=>{let[t]=Gd(),n=Y2t(),{toolbarState:r}=$8(),i=r.elementFormat;return(0,X.jsxs)(q5,{open:n.isOpen,onOpenChange:e=>e?n.show():n.hide(),children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`toolbar`,size:`sm`,className:`cteditor-flex cteditor-items-center !cteditor-gap-0 cteditor-h-7.5 !cteditor-rounded-md`,children:[(0,X.jsx)(l3,{}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[Z8.map((e,r)=>(0,X.jsxs)($5,{onClick:()=>{n.hide(),t.dispatchCommand(Nc,e.payload)},className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,i===e.payload&&`cteditor-bg-foreground/10`),children:[e.icon,e.name]},r)),e&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e7,{}),(0,X.jsx)(q2t,{})]})]})]})},Z2t=()=>{let[e]=Gd(),{toolbarState:t}=$8(),n=t.elementFormat;return(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-1`,children:Z8.map((t,r)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{e.dispatchCommand(Nc,t.payload)},className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,n===t.payload&&`cteditor-bg-foreground/10`),title:t.name,children:[(0,X.jsx)(`span`,{children:t.icon}),(0,X.jsx)(`span`,{children:t.name})]},r))})},Q2t=[`bullet`,`number`,`check`],$2t=[{name:`Check list`,kind:`check`,icon:(0,X.jsx)(cqt,{}),activeType:`check`},{name:`Quote`,kind:`quote`,icon:(0,X.jsx)(n3,{}),activeType:`quote`},{name:`Code block`,kind:`codeBlock`,icon:(0,X.jsx)(W4,{}),activeType:`code`}],e4t=[{style:`disc`,label:`Default`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,fill:`currentColor`})})},{style:`circle`,label:`Circle`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`circle`,{cx:`7`,cy:`7`,r:`3.75`,stroke:`currentColor`,strokeWidth:`1.5`})})},{style:`square`,label:`Square`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`rect`,{x:`3.5`,y:`3.5`,width:`7`,height:`7`,fill:`currentColor`})})}],t4t=[{style:`decimal`,label:`Default (1, 2, 3)`,glyph:`1.`},{style:`lower-alpha`,label:`Lower alpha (a, b, c)`,glyph:`a.`},{style:`upper-alpha`,label:`Upper alpha (A, B, C)`,glyph:`A.`},{style:`lower-roman`,label:`Lower roman (i, ii, iii)`,glyph:`i.`},{style:`upper-roman`,label:`Upper roman (I, II, III)`,glyph:`I.`}],n4t=({blockType:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)(`disc`),[i,a]=(0,Q.useState)(`decimal`);(0,Q.useEffect)(()=>{let e=()=>{t.getEditorState().read(()=>{let e=W();if(!U(e))return;let t=e.anchor.getNode(),n=yIt(t);r(n?n.getBulletStyle():`disc`);let i=bIt(t);a(i?i.getNumberStyle():`decimal`)})};return e(),t.registerUpdateListener(e)},[t]);let o=n=>{t.update(()=>{if(!U(W()))return;e!==`bullet`&&kd(`bullet`);let t=W();if(!U(t))return;let r=t.anchor.getNode(),i=Fd(r)?r:id(r,Fd);if(!(!i||i.getListType()!==`bullet`)){if(n===`disc`){P1(i)&&i.replace(Pd(`bullet`,i.getStart()),!0);return}P1(i)?i.setBulletStyle(n):i.replace(vIt(`bullet`,i.getStart(),n),!0)}})},s=n=>{t.update(()=>{if(!U(W()))return;e!==`number`&&kd(`number`);let t=W();if(!U(t))return;let r=t.anchor.getNode(),i=Fd(r)?r:id(r,Fd);if(!(!i||i.getListType()!==`number`)){if(n===`decimal`){P1(i)&&i.replace(Pd(`number`,i.getStart()),!0);return}P1(i)?i.setNumberStyle(n):i.replace(vIt(`number`,i.getStart(),`disc`,n),!0)}})},c=n=>{if(Q2t.includes(n)){if(e===n){t.dispatchCommand(Ud,void 0);return}t.dispatchCommand(n===`bullet`?Bd:n===`number`?Vd:Hd,void 0);return}t.update(()=>{let e=W();if(U(e))if(n===`quote`)Vu(e,()=>Df());else if(e.isCollapsed())Vu(e,()=>sd());else{let t=e.getTextContent(),n=sd();e.insertNodes([n]),e.insertRawText(t)}})};return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`toolbar`,size:`sm`,title:`Lists & blocks`,className:`cteditor-flex cteditor-items-center !cteditor-gap-0 cteditor-h-7 !cteditor-rounded-md cteditor-px-1`,children:[(0,X.jsx)(e3,{}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`bullet`&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)(e3,{}),`Bulleted list`]}),(0,X.jsx)(Z5,{children:e4t.map(t=>(0,X.jsxs)($5,{onClick:()=>o(t.style),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`bullet`&&n===t.style&&`cteditor-bg-foreground/10`),children:[t.glyph,t.label]},t.style))})]}),(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`number`&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)($4,{}),`Numbered list`]}),(0,X.jsx)(Z5,{children:t4t.map(t=>(0,X.jsxs)($5,{onClick:()=>s(t.style),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`number`&&i===t.style&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)(`span`,{className:`cteditor-w-3.5 cteditor-text-center cteditor-text-xs cteditor-font-medium`,children:t.glyph}),t.label]},t.style))})]}),$2t.map(t=>(0,X.jsxs)(Q.Fragment,{children:[t.kind===`quote`&&(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`}),(0,X.jsxs)($5,{onClick:()=>c(t.kind),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===t.activeType&&`cteditor-bg-foreground/10`),children:[t.icon,t.name]})]},t.kind))]})]})},r4t=({isOpen:e,onClick:t,commentCount:n=0,fitToPage:r=!1})=>(0,X.jsx)(`div`,{className:k$(`toolbar-comments-feature`,r?`cteditor-bg-transparent`:`cteditor-bg-main-background`),children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:t,className:k$(`cteditor-relative cteditor-transition-all cteditor-duration-200`,e&&`cteditor-bg-primary text-primary-foreground`),title:`${e?`Hide`:`Show`} comments`,children:[(0,X.jsx)(pqt,{}),n>0&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-absolute cteditor-top-1 cteditor-right-1 cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-0.5 cteditor-ring-background`})]})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Comments`})})]})})}),i4t=(0,Q.memo)(r4t),a4t=e=>{let{blockType:t,enableHeadings:n=!0}=e,[r]=Gd(),i=()=>{t!==`paragraph`&&r.update(()=>{let e=W();U(e)&&Vu(e,()=>Qs())})},a=e=>{t!==e&&r.update(()=>{let t=W();if(U(t)){Vu(t,()=>kf(e));let n=W();if(U(n)){let e=n.getNodes();for(let t of e)Jo(t)&&!t.hasFormat(`bold`)&&t.toggleFormat(`bold`);Bu(n,{"font-size":null})}}})},o=()=>{t===`bullet`?r.update(()=>{r.dispatchCommand(Ud,void 0)}):r.update(()=>{r.dispatchCommand(Bd,void 0)})},s=()=>{t===`check`?r.dispatchCommand(Ud,void 0):r.dispatchCommand(Hd,void 0)},c=()=>{t===`number`?r.update(()=>{r.dispatchCommand(Ud,void 0)}):r.update(()=>{r.dispatchCommand(Vd,void 0)})},l=()=>{t!==`quote`&&r.update(()=>{let e=W();U(e)&&Vu(e,()=>Df())})},u=()=>{r.update(()=>{let e=W();if(!U(e))return;let t=Yu(e.anchor.getNode(),Rd);t&&t.getListType()===`number`&&t.setStart(1)})};return{blocks:[{name:`Normal`,blockType:`paragraph`,icon:(0,X.jsx)(a3,{}),onClick:i},...n?[{name:`Heading 1`,blockType:`h1`,icon:(0,X.jsx)(_qt,{}),onClick:()=>a(`h1`)},{name:`Heading 2`,blockType:`h2`,icon:(0,X.jsx)(o3,{}),onClick:()=>a(`h2`)},{name:`Heading 3`,blockType:`h3`,icon:(0,X.jsx)(vqt,{}),onClick:()=>a(`h3`)},{name:`Heading 4`,blockType:`h4`,icon:(0,X.jsx)(yqt,{}),onClick:()=>a(`h4`)},{name:`Heading 5`,blockType:`h5`,icon:(0,X.jsx)(bqt,{}),onClick:()=>a(`h5`)},{name:`Heading 6`,blockType:`h6`,icon:(0,X.jsx)(xqt,{}),onClick:()=>a(`h6`)}]:[]],formatParagraph:i,formatHeading:a,formatBulletList:o,formatCheckList:s,formatNumberedList:c,formatQuote:l,resetListNumbering:u}},o4t=({blockType:e,enableHeadings:t=!0,enableLists:n=!0,enableBlockquote:r=!0,triggerClassName:i})=>{let[a,o]=(0,Q.useState)(null),s=!!a,c=e=>o(e.currentTarget),l=()=>o(null),{blocks:u,resetListNumbering:d}=a4t({blockType:e,enableHeadings:t});return(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(q5,{open:s,onOpenChange:e=>{e||l()},children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{"aria-haspopup":a?`true`:void 0,"aria-controls":a?`block-format-menu`:void 0,onClick:c,variant:`toolbar`,className:k$(`cteditor-flex cteditor-items-center !cteditor-gap-1 cteditor-whitespace-nowrap !cteditor-rounded-md cteditor-h-7.5`,i),size:`sm`,children:[(0,X.jsx)(`span`,{className:`cteditor-flex cteditor-items-center cteditor-justify-center [&_svg]:!cteditor-size-5`,children:u.find(t=>t.blockType===e)?.icon??u[0]?.icon}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-70`})]})}),(0,X.jsxs)(Q5,{id:`block-format-menu`,className:`cteditor-w-56`,align:`start`,"aria-labelledby":`block-format-button`,role:`listbox`,children:[u.map((t,n)=>(0,X.jsxs)($5,{role:`option`,className:k$(`cteditor-flex cteditor-items-center !cteditor-gap-2 cteditor-cursor-pointer`,e===t.blockType&&`cteditor-bg-foreground/10`),onClick:()=>{l(),t.onClick()},children:[t.icon,(0,X.jsx)(`span`,{children:t.name})]},n)),e===`number`&&n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e7,{}),(0,X.jsxs)($5,{role:`option`,className:`cteditor-flex cteditor-items-center !cteditor-gap-2 cteditor-cursor-pointer`,onClick:()=>{l(),d()},children:[(0,X.jsx)($4,{}),(0,X.jsx)(`span`,{children:`Restart numbering at 1`})]})]})]})]})})},(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(r7||={}),(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(s4t||={}),i7=r7.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),a7=e=>{switch(typeof e){case`undefined`:return i7.undefined;case`string`:return i7.string;case`number`:return Number.isNaN(e)?i7.nan:i7.number;case`boolean`:return i7.boolean;case`function`:return i7.function;case`bigint`:return i7.bigint;case`symbol`:return i7.symbol;case`object`:return Array.isArray(e)?i7.array:e===null?i7.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?i7.promise:typeof Map<`u`&&e instanceof Map?i7.map:typeof Set<`u`&&e instanceof Set?i7.set:typeof Date<`u`&&e instanceof Date?i7.date:i7.object;default:return i7.unknown}},o7=r7.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),s7=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r7.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}},s7.create=e=>new s7(e),c7=(e,t)=>{let n;switch(e.code){case o7.invalid_type:n=e.received===i7.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case o7.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,r7.jsonStringifyReplacer)}`;break;case o7.unrecognized_keys:n=`Unrecognized key(s) in object: ${r7.joinValues(e.keys,`, `)}`;break;case o7.invalid_union:n=`Invalid input`;break;case o7.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${r7.joinValues(e.options)}`;break;case o7.invalid_enum_value:n=`Invalid enum value. Expected ${r7.joinValues(e.options)}, received '${e.received}'`;break;case o7.invalid_arguments:n=`Invalid function arguments`;break;case o7.invalid_return_type:n=`Invalid function return type`;break;case o7.invalid_date:n=`Invalid date`;break;case o7.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:r7.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case o7.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case o7.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case o7.custom:n=`Invalid input`;break;case o7.invalid_intersection_types:n=`Intersection results could not be merged`;break;case o7.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case o7.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,r7.assertNever(e)}return{message:n}},c4t=c7,l4t=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},l7=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return u7;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return u7;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(typeof i.value<`u`||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},u7=Object.freeze({status:`aborted`}),d7=e=>({status:`dirty`,value:e}),f7=e=>({status:`valid`,value:e}),u4t=e=>e.status===`aborted`,d4t=e=>e.status===`dirty`,p7=e=>e.status===`valid`,m7=e=>typeof Promise<`u`&&e instanceof Promise,(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(h7||={}),g7=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},f4t=(e,t)=>{if(p7(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new s7(e.common.issues);return this._error=t,this._error}}},_7=class{get description(){return this._def.description}_getType(e){return a7(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l7,ctx:{common:e.parent.common,data:e.data,parsedType:a7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(m7(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)};return f4t(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return p7(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>p7(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)},r=this._parse({data:e,path:n.path,parent:n});return f4t(n,await(m7(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||typeof t>`u`?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:o7.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new A7({schema:this,typeName:I7.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return j7.create(this,this._def)}nullable(){return M7.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S7.create(this)}promise(){return k7.create(this,this._def)}or(e){return w7.create([this,e],this._def)}and(e){return T7.create(this,e,this._def)}transform(e){return new A7({...g0(this._def),schema:this,typeName:I7.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new N7({...g0(this._def),innerType:this,defaultValue:t,typeName:I7.ZodDefault})}brand(){return new W4t({typeName:I7.ZodBranded,type:this,...g0(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new P7({...g0(this._def),innerType:this,catchValue:t,typeName:I7.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return G4t.create(this,e)}readonly(){return F7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},p4t=/^c[^\s-]{8,}$/i,m4t=/^[0-9a-z]+$/,h4t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g4t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_4t=/^[a-z0-9_-]{21}$/i,v4t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,y4t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,b4t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,x4t=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,C4t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,w4t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,T4t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,E4t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D4t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O4t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k4t=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,A4t=RegExp(`^${k4t}$`),v7=class e extends _7{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i7.string){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.string,received:t.parsedType}),u7}let t=new l7,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?h0(n,{code:o7.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&h0(n,{code:o7.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)b4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`email`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)S4t||=new RegExp(x4t,`u`),S4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`emoji`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)g4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`uuid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)_4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`nanoid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)p4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cuid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)m4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cuid2`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)h4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`ulid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),h0(n,{validation:`url`,code:o7.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`regex`,code:o7.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?VRt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?A4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?BRt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?y4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`duration`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?HRt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`ip`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?URt(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`jwt`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?WRt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cidr`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?D4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`base64`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?O4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`base64url`,code:o7.invalid_string,message:r.message}),t.dirty()):r7.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:o7.invalid_string,...h7.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...h7.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...h7.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...h7.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...h7.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...h7.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...h7.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...h7.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...h7.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...h7.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...h7.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...h7.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...h7.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...h7.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:typeof e?.precision>`u`?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h7.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:typeof e?.precision>`u`?null:e?.precision,...h7.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...h7.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...h7.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...h7.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...h7.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...h7.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...h7.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...h7.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...h7.errToObj(t)})}nonempty(e){return this.min(1,h7.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},v7.create=e=>new v7({checks:[],typeName:I7.ZodString,coerce:e?.coerce??!1,...g0(e)}),y7=class e extends _7{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i7.number){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.number,received:t.parsedType}),u7}let t,n=new l7;for(let r of this._def.checks)r.kind===`int`?r7.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?GRt(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_finite,message:r.message}),n.dirty()):r7.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,h7.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,h7.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,h7.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,h7.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:h7.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:h7.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:h7.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:h7.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:h7.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:h7.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:h7.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:h7.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:h7.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:h7.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&r7.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}},y7.create=e=>new y7({checks:[],typeName:I7.ZodNumber,coerce:e?.coerce||!1,...g0(e)}),j4t=class e extends _7{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==i7.bigint)return this._getInvalidInput(e);let t,n=new l7;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r7.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.bigint,received:t.parsedType}),u7}gte(e,t){return this.setLimit(`min`,e,!0,h7.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,h7.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,h7.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,h7.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:h7.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:h7.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:h7.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:h7.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:h7.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:h7.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},j4t.create=e=>new j4t({checks:[],typeName:I7.ZodBigInt,coerce:e?.coerce??!1,...g0(e)}),M4t=class extends _7{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==i7.boolean){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.boolean,received:t.parsedType}),u7}return f7(e.data)}},M4t.create=e=>new M4t({typeName:I7.ZodBoolean,coerce:e?.coerce||!1,...g0(e)}),N4t=class e extends _7{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i7.date){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.date,received:t.parsedType}),u7}if(Number.isNaN(e.data.getTime()))return h0(this._getOrReturnCtx(e),{code:o7.invalid_date}),u7;let t=new l7,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):r7.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:h7.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:h7.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}},N4t.create=e=>new N4t({checks:[],coerce:e?.coerce||!1,typeName:I7.ZodDate,...g0(e)}),P4t=class extends _7{_parse(e){if(this._getType(e)!==i7.symbol){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.symbol,received:t.parsedType}),u7}return f7(e.data)}},P4t.create=e=>new P4t({typeName:I7.ZodSymbol,...g0(e)}),F4t=class extends _7{_parse(e){if(this._getType(e)!==i7.undefined){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.undefined,received:t.parsedType}),u7}return f7(e.data)}},F4t.create=e=>new F4t({typeName:I7.ZodUndefined,...g0(e)}),I4t=class extends _7{_parse(e){if(this._getType(e)!==i7.null){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.null,received:t.parsedType}),u7}return f7(e.data)}},I4t.create=e=>new I4t({typeName:I7.ZodNull,...g0(e)}),b7=class extends _7{constructor(){super(...arguments),this._any=!0}_parse(e){return f7(e.data)}},b7.create=e=>new b7({typeName:I7.ZodAny,...g0(e)}),L4t=class extends _7{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f7(e.data)}},L4t.create=e=>new L4t({typeName:I7.ZodUnknown,...g0(e)}),x7=class extends _7{_parse(e){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.never,received:t.parsedType}),u7}},x7.create=e=>new x7({typeName:I7.ZodNever,...g0(e)}),R4t=class extends _7{_parse(e){if(this._getType(e)!==i7.undefined){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.void,received:t.parsedType}),u7}return f7(e.data)}},R4t.create=e=>new R4t({typeName:I7.ZodVoid,...g0(e)}),S7=class e extends _7{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i7.array)return h0(t,{code:o7.invalid_type,expected:i7.array,received:t.parsedType}),u7;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(h0(t,{code:e?o7.too_big:o7.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(h0(t,{code:o7.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(h0(t,{code:o7.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new g7(t,e,t.path,n)))).then(e=>l7.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new g7(t,e,t.path,n)));return l7.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:h7.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:h7.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:h7.toString(n)}})}nonempty(e){return this.min(1,e)}},S7.create=(e,t)=>new S7({type:e,minLength:null,maxLength:null,exactLength:null,typeName:I7.ZodArray,...g0(t)}),C7=class e extends _7{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=r7.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==i7.object){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.object,received:t.parsedType}),u7}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof x7&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new g7(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof x7){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(h0(n,{code:o7.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new g7(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>l7.mergeObjectSync(t,e)):l7.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return h7.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:h7.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:I7.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of r7.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of r7.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return _0(this)}partial(t){let n={};for(let e of r7.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of r7.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof j7;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qRt(r7.objectKeys(this.shape))}},C7.create=(e,t)=>new C7({shape:()=>e,unknownKeys:`strip`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),C7.strictCreate=(e,t)=>new C7({shape:()=>e,unknownKeys:`strict`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),C7.lazycreate=(e,t)=>new C7({shape:e,unknownKeys:`strip`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),w7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new s7(e.ctx.common.issues));return h0(t,{code:o7.invalid_union,unionErrors:n}),u7}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new s7(e));return h0(t,{code:o7.invalid_union,unionErrors:i}),u7}}get options(){return this._def.options}},w7.create=(e,t)=>new w7({options:e,typeName:I7.ZodUnion,...g0(t)}),T7=class extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(u4t(e)||u4t(r))return u7;let i=KRt(e.value,r.value);return i.valid?((d4t(e)||d4t(r))&&t.dirty(),{status:t.value,value:i.data}):(h0(n,{code:o7.invalid_intersection_types}),u7)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}},T7.create=(e,t,n)=>new T7({left:e,right:t,typeName:I7.ZodIntersection,...g0(n)}),E7=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.array)return h0(n,{code:o7.invalid_type,expected:i7.array,received:n.parsedType}),u7;if(n.data.length<this._def.items.length)return h0(n,{code:o7.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),u7;!this._def.rest&&n.data.length>this._def.items.length&&(h0(n,{code:o7.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new g7(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>l7.mergeArray(t,e)):l7.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}},E7.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new E7({items:e,typeName:I7.ZodTuple,rest:null,...g0(t)})},z4t=class extends _7{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.map)return h0(n,{code:o7.invalid_type,expected:i7.map,received:n.parsedType}),u7;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new g7(n,e,n.path,[a,`key`])),value:i._parse(new g7(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return u7;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return u7;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}},z4t.create=(e,t,n)=>new z4t({valueType:t,keyType:e,typeName:I7.ZodMap,...g0(n)}),B4t=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.set)return h0(n,{code:o7.invalid_type,expected:i7.set,received:n.parsedType}),u7;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(h0(n,{code:o7.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(h0(n,{code:o7.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return u7;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new g7(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:h7.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:h7.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},B4t.create=(e,t)=>new B4t({valueType:e,minSize:null,maxSize:null,typeName:I7.ZodSet,...g0(t)}),V4t=class extends _7{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}},V4t.create=(e,t)=>new V4t({getter:e,typeName:I7.ZodLazy,...g0(t)}),D7=class extends _7{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h0(t,{received:t.data,code:o7.invalid_literal,expected:this._def.value}),u7}return{status:`valid`,value:e.data}}get value(){return this._def.value}},D7.create=(e,t)=>new D7({value:e,typeName:I7.ZodLiteral,...g0(t)}),O7=class e extends _7{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return h0(t,{expected:r7.joinValues(n),received:t.parsedType,code:o7.invalid_type}),u7}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return h0(t,{received:t.data,code:o7.invalid_enum_value,options:n}),u7}return f7(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}},O7.create=qRt,H4t=class extends _7{_parse(e){let t=r7.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==i7.string&&n.parsedType!==i7.number){let e=r7.objectValues(t);return h0(n,{expected:r7.joinValues(e),received:n.parsedType,code:o7.invalid_type}),u7}if(this._cache||=new Set(r7.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=r7.objectValues(t);return h0(n,{received:n.data,code:o7.invalid_enum_value,options:e}),u7}return f7(e.data)}get enum(){return this._def.values}},H4t.create=(e,t)=>new H4t({values:e,typeName:I7.ZodNativeEnum,...g0(t)}),k7=class extends _7{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==i7.promise&&t.common.async===!1?(h0(t,{code:o7.invalid_type,expected:i7.promise,received:t.parsedType}),u7):f7((t.parsedType===i7.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}},k7.create=(e,t)=>new k7({type:e,typeName:I7.ZodPromise,...g0(t)}),A7=class extends _7{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I7.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{h0(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return u7;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?u7:r.status===`dirty`||t.value===`dirty`?d7(r.value):r});{if(t.value===`aborted`)return u7;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?u7:r.status===`dirty`||t.value===`dirty`?d7(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?u7:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?u7:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!p7(e))return u7;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>p7(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):u7);r7.assertNever(r)}},A7.create=(e,t,n)=>new A7({schema:e,typeName:I7.ZodEffects,effect:t,...g0(n)}),A7.createWithPreprocess=(e,t,n)=>new A7({schema:t,effect:{type:`preprocess`,transform:e},typeName:I7.ZodEffects,...g0(n)}),j7=class extends _7{_parse(e){return this._getType(e)===i7.undefined?f7(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},j7.create=(e,t)=>new j7({innerType:e,typeName:I7.ZodOptional,...g0(t)}),M7=class extends _7{_parse(e){return this._getType(e)===i7.null?f7(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},M7.create=(e,t)=>new M7({innerType:e,typeName:I7.ZodNullable,...g0(t)}),N7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===i7.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},N7.create=(e,t)=>new N7({innerType:e,typeName:I7.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...g0(t)}),P7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return m7(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new s7(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new s7(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}},P7.create=(e,t)=>new P7({innerType:e,typeName:I7.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...g0(t)}),U4t=class extends _7{_parse(e){if(this._getType(e)!==i7.nan){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.nan,received:t.parsedType}),u7}return{status:`valid`,value:e.data}}},U4t.create=e=>new U4t({typeName:I7.ZodNaN,...g0(e)}),W4t=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},G4t=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?u7:e.status===`dirty`?(t.dirty(),d7(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?u7:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:I7.ZodPipeline})}},F7=class extends _7{_parse(e){let t=this._def.innerType._parse(e),n=e=>(p7(e)&&(e.value=Object.freeze(e.value)),e);return m7(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}},F7.create=(e,t)=>new F7({innerType:e,typeName:I7.ZodReadonly,...g0(t)}),(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(I7||={}),K4t=(e,t={message:`Input not instance of ${e.name}`})=>YRt(t=>t instanceof e,t),L7=v7.create,q4t=y7.create,b7.create,x7.create,J4t=S7.create,R7=C7.create,w7.create,T7.create,E7.create,z7=D7.create,O7.create,k7.create,j7.create,M7.create,Y4t=class{static async createBugReport(e,t){return(await B0.post(`/api/bug-reports`,e,t?{headers:{"X-API-Key":t}}:void 0)).data}static async getUserBugReports(e){return(await B0.get(`/api/bug-reports/my-reports`,e?{headers:{"X-API-Key":e}}:void 0)).data}static async getBugReportById(e,t){return(await B0.get(`/api/bug-reports/${e}`,t?{headers:{"X-API-Key":t}}:void 0)).data}},X4t=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],B7=`JPEG, PNG, GIF, WebP`,Z4t=10*1024*1024,Q4t=R7({title:L7().trim().min(3,`Title must be at least 3 characters`).max(100,`Title must not exceed 100 characters`),description:L7().trim().min(10,`Description must be at least 10 characters`).max(2e3,`Description must not exceed 2000 characters`),errorMessage:L7().max(5e3,`Error message must not exceed 5000 characters`).optional().or(z7(``)),url:L7().url(`Please enter a valid URL`).optional().or(z7(``)),attachments:J4t(K4t(File)).max(3,`Maximum 3 attachments allowed`).optional()}),$4t=[{value:`bar`,label:`Bar`,description:`Compare values across categories`},{value:`horizontal-bar`,label:`Horizontal`,description:`Long labels read left-to-right`},{value:`line`,label:`Line`,description:`Trends over a continuous range`},{value:`pie`,label:`Pie`,description:`Whole split into a few parts`},{value:`donut`,label:`Donut`,description:`Pie with a value in the middle`}],e3t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(FDt(),gCt))),V7=(0,Q.forwardRef)(({title:e,icon:t,onChange:n,className:r,...i},a)=>{let[o,s]=(0,Q.useState)(!1),c=e=>{n&&n(e),s(!1)};return(0,X.jsxs)(m8,{open:o,onOpenChange:s,modal:!1,children:[(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-shrink-0 cteditor-rounded-sm hover:cteditor-bg-accent cteditor-flex cteditor-items-center cteditor-gap-2`,r),title:e,...i,children:[(0,X.jsx)(`div`,{children:t}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-[13px] cteditor-text-left`,children:`Emoji`})]})}),(0,X.jsx)(g8,{ref:a,className:`cteditor-w-auto cteditor-p-0 cteditor-border-none !cteditor-z-[99999] max-md:!cteditor-p-0`,sideOffset:5,id:`emoji-picker`,collisionPadding:12,children:(0,X.jsx)(`div`,{className:`cteditor-w-[350px] cteditor-max-w-[calc(100vw-70px)] cteditor-p-0`,children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(`div`,{className:`cteditor-w-[350px] cteditor-max-w-[calc(100vw-70px)] `,"aria-hidden":`true`}),children:(0,X.jsx)(e3t,{onEmojiClick:c,width:`100%`,height:400,searchPlaceHolder:`Search emojis...`})})})})]})}),V7.displayName=`EmojiPickerWidget`,t3t=class{static async createSuggestion(e,t){return(await B0.post(`/api/feature-suggestions`,e,t?{headers:{"X-API-Key":t}}:void 0)).data}},n3t=R7({title:L7().trim().min(3,`Title must be at least 3 characters`).max(100,`Title must not exceed 100 characters`),description:L7().trim().min(10,`Description must be at least 10 characters`).max(1e3,`Description must not exceed 1000 characters`),link:L7().url(`Please enter a valid URL`).optional().or(z7(``))}),r3t=[{value:`productivity`,label:`Productivity`},{value:`integrations`,label:`Integrations`},{value:`ui_design`,label:`UI / Design`},{value:`performance`,label:`Performance`},{value:`mobile`,label:`Mobile`},{value:`accessibility`,label:`Accessibility`},{value:`other`,label:`Other`}],i3t=[`Be specific about what you want and why it would be useful.`,`Explain the problem your suggestion would solve.`,`Consider how other users might benefit from this feature.`,`Include any relevant examples or use cases.`],H7=R7({rating:q4t().min(1,`Please select a rating`).max(5,`Rating must be between 1 and 5`),comment:L7().max(500,`Comment must be less than 500 characters`).optional()}),a3t=[``,`Poor`,`Fair`,`Good`,`Very Good`,`Excellent`],U7=500,W7={toolbarContainer:`toolbar-features cteditor-flex cteditor-text-foreground cteditor-px-2 cteditor-py-1 cteditor-border-main-border/10 dark:cteditor-border-main-border/[0.07] cteditor-items-center cteditor-gap-1.5 cteditor-relative cteditor-w-full cteditor-min-h-11 cteditor-overflow-hidden `,toolbarInnerContent:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-overflow-y-hidden cteditor-flex-nowrap md:cteditor-overflow-hidden no-scrollbar`,moreMenuTriggerButton:`!cteditor-px-1 !cteditor-py-0.5 !cteditor-h-7 !cteditor-gap-1 dark:!cteditor-bg-body/20 !cteditor-bg-body !cteditor-rounded-md cteditor-border !cteditor-border-foreground/5`,searchWrapper:`cteditor-relative`,searchIcon:`cteditor-absolute cteditor-left-2.5 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-size-3.5 cteditor-text-muted-foreground/60`,searchInput:`cteditor-h-8 cteditor-pl-8 cteditor-border !cteditor-border-foreground/10 cteditor-pr-8 cteditor-text-xs !cteditor-bg-background/80 !cteditor-rounded-lg cteditor-shadow-sm cteditor-placeholder:text-muted-foreground/50 cteditor-transition-all focus:cteditor-ring-1 focus:cteditor-ring-primary/20 cteditor-outline-none`,searchClearButton:`cteditor-absolute cteditor-right-2 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-text-muted-foreground/60 hover:cteditor-text-foreground cteditor-transition-colors`,searchClearIcon:`!cteditor-size-3.5`,controlGroup:`cteditor-flex cteditor-items-center cteditor-gap-1.5`,dropdownSectionLabel:`cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2`,dropdownItemTrigger:`cteditor-w-full cteditor-px-2 cteditor-py-1.5 cteditor-h-auto hover:cteditor-bg-foreground/5 cteditor-rounded-sm`,searchEmptyStateContainer:`cteditor-py-8 cteditor-text-center cteditor-text-muted-foreground/60`,searchEmptyStateIcon:`cteditor-size-8 cteditor-mx-auto cteditor-mb-2 cteditor-opacity-40`,searchEmptyStateTitle:`cteditor-text-sm`,searchEmptyStateDescription:`cteditor-text-xs cteditor-mt-1`,searchStatusText:`cteditor-text-[10px] cteditor-text-muted-foreground/60 cteditor-mt-1.5 cteditor-px-0.5`,categoryHeader:`cteditor-flex cteditor-items-center cteditor-px-2 cteditor-pt-2.5 cteditor-pb-1 cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground cteditor-tracking-widest`,categoryHeaderLine:`cteditor-flex-1 cteditor-h-px cteditor-bg-border/50 cteditor-ml-2`},o3t=700,s3t={"DM Sans":{family:`DM Sans`,kind:`variable`,boldWeight:500}},G7=[{label:`Sans-Serif`,fonts:[`Geist`,`Inter`,`Poppins`,`DM Sans`,`Manrope`,`Plus Jakarta Sans`,`Public Sans`,`Montserrat`,`Raleway`,`Arial`,`Helvetica`,`Verdana`,`Tahoma`]},{label:`Serif`,fonts:[`Lora`,`Merriweather`,`Playfair Display`,`Libre Baskerville`,`Georgia`,`Times New Roman`]},{label:`Monospace`,fonts:[`JetBrains Mono`,`Fira Code`,`Courier New`]},{label:`Display`,fonts:[`Bebas Neue`,`Comic Sans MS`]}],c3t=G7.flatMap(e=>e.fonts),K7=e=>e.trim().toLowerCase(),l3t=({fonts:e=c3t,activeEditor:t})=>{let[n,r]=(0,Q.useState)(`DM Sans`),[i,a]=(0,Q.useState)(``),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(new Set),l=Q.useRef(null),u=Q.useRef(!1),d=Q.useRef(!1),f=e===c3t,p=(0,Q.useMemo)(()=>{let t=new Set(e);return s.forEach(e=>t.add(e)),Array.from(t)},[e,s]),m=(0,Q.useMemo)(()=>{let t=new Set(e);return Array.from(s).filter(e=>!t.has(e))},[e,s]),h=(0,Q.useMemo)(()=>{if(!i)return G7;let e=K7(i);return G7.map(t=>({...t,fonts:t.fonts.filter(t=>K7(t).includes(e))})).filter(e=>e.fonts.length>0)},[i]),g=(0,Q.useMemo)(()=>{if(!i)return m;let e=K7(i);return m.filter(t=>K7(t).includes(e))},[i,m]),_=(0,Q.useMemo)(()=>{if(!i)return p;let e=K7(i);return p.filter(t=>K7(t).includes(e))},[i,p]);(0,Q.useEffect)(()=>t.registerUpdateListener(({editorState:t})=>{t.read(()=>{let t=W();if(U(t)){let n=Hu(t,`font-family`,`DM Sans`).replace(/^["']|["']$/g,``).trim();if(u.current){u.current=!1;return}if(!t.isCollapsed()&&l.current!==null&&(l.current=null,d.current=!1),d.current)return;l.current!==null&&n!==l.current&&n!==`DM Sans`&&(l.current=null),l.current===null&&(r(n),n&&n!==`DM Sans`&&!e.includes(n)&&c(e=>{if(e.has(n))return e;let t=new Set(e);return t.add(n),t}))}})}),[t,e]),(0,Q.useEffect)(()=>t.registerCommand(gc,e=>{if(l.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=l.current,t=W();U(t)&&t.isCollapsed()&&Bu(t,rzt(e)),d.current=!1}return!1},4),[t]),(0,Q.useEffect)(()=>{let e=t.getRootElement();if(!e)return;let n=()=>{if(l.current!==null){let e=l.current;t.update(()=>{let t=W();U(t)&&t.isCollapsed()&&(u.current=!0,Bu(t,rzt(e)))})}};return e.addEventListener(`focus`,n),()=>{e.removeEventListener(`focus`,n)}},[t]);let v=(0,Q.useCallback)(e=>{l.current=e,u.current=!0,d.current=!0,t.update(()=>{let t=W();U(t)&&Bu(t,rzt(e))})},[t]),y=e=>{r(e),v(e),a(``)};(0,Q.useEffect)(()=>{let e=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(e)},[i]);let b=e=>{e.preventDefault()};return(0,X.jsxs)($6,{value:n,onValueChange:y,children:[(0,X.jsx)(t8,{className:`!cteditor-h-7.5 cteditor-text-foreground md:!cteditor-w-[120px] cteditor-text-xs max-md:cteditor-w-full !cteditor-bg-foreground/[0.03] dark:cteditor-bg-foreground/[0.02] !cteditor-rounded-md !cteditor-border-foreground/5 !cteditor-shadow-none`,onMouseDown:b,children:(0,X.jsx)(e8,{placeholder:`Select font`})}),(0,X.jsxs)(n8,{onMouseDown:b,className:`cteditor-border-foreground/20`,children:[(0,X.jsxs)(`div`,{className:`${W7.searchWrapper} cteditor-mb-1`,onMouseDown:b,children:[(0,X.jsx)(C2,{className:W7.searchIcon}),(0,X.jsx)(`input`,{ref:o,type:`text`,placeholder:`Search fonts...`,value:i,onChange:e=>a(e.target.value),onMouseDown:e=>e.stopPropagation(),className:W7.searchInput})]}),f?(0,X.jsxs)(X.Fragment,{children:[h.map((e,t)=>(0,X.jsxs)(Q.Fragment,{children:[t>0&&(0,X.jsx)(a8,{}),(0,X.jsxs)(nQt,{children:[(0,X.jsx)(r8,{className:`cteditor-text-[10px] cteditor-uppercase cteditor-tracking-wider cteditor-text-muted-foreground cteditor-font-medium`,children:e.label}),e.fonts.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e))]})]},e.label)),g.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(a8,{}),(0,X.jsxs)(nQt,{children:[(0,X.jsx)(r8,{className:`cteditor-text-[10px] cteditor-uppercase cteditor-tracking-wider cteditor-text-muted-foreground cteditor-font-medium`,children:`Detected`}),g.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e))]})]}),h.length===0&&g.length===0&&(0,X.jsx)(`div`,{className:`cteditor-py-4 cteditor-text-center cteditor-text-sm cteditor-text-muted-foreground`,children:`No fonts found`})]}):(0,X.jsxs)(X.Fragment,{children:[_.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e)),_.length===0&&(0,X.jsx)(`div`,{className:`cteditor-py-4 cteditor-text-center cteditor-text-sm cteditor-text-muted-foreground`,children:`No fonts found`})]})]})]})},u3t=8,d3t=400,q7=16,f3t=2,J7=(e,t)=>{let n=Hu(t,`font-size`,``);if(n)return izt(n);let r=e.getElementByKey(t.anchor.getNode().getKey());if(r){let e=parseFloat(window.getComputedStyle(r).fontSize);if(!isNaN(e))return Math.round(e)}return q7},p3t=e=>{let t=q7;return e.getEditorState().read(()=>{let n=W();U(n)&&(t=J7(e,n))}),t},Y7=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(()=>p3t(e)),[r,i]=(0,Q.useState)(()=>p3t(e).toString()),a=Q.useRef(null),o=Q.useRef(!1),s=Q.useRef(null);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:t})=>{t.read(()=>{let t=W();if(U(t)){let r=J7(e,t);if(o.current){o.current=!1;return}!t.isCollapsed()&&a.current!==null&&(a.current=null),a.current!==null&&r!==a.current&&r!==q7&&(a.current=null),a.current===null&&(n(r),i(r.toString()))}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(a.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=a.current,t=W();U(t)&&t.isCollapsed()&&Bu(t,{"font-size":`${e}px`})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(a.current!==null){let t=a.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(o.current=!0,Bu(e,{"font-size":`${t}px`}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let c=(0,Q.useCallback)(t=>{a.current=t,o.current=!0,e.update(()=>{s.current&&=(Zi(s.current.clone()),null);let e=W();U(e)&&Bu(e,{"font-size":`${t}px`})})},[e]),l=e=>{i(e.target.value.replace(/\D/g,``))},u=()=>{if(r===``||isNaN(Number(r)))i(t.toString());else{let e=Math.max(u3t,Math.min(Number(r),d3t));n(e),i(e.toString()),c(e)}},d=()=>{e.getEditorState().read(()=>{let e=W();U(e)&&(s.current=e.clone())})},f=n=>{n.stopPropagation(),n.key===`Enter`&&(n.preventDefault(),u(),e.focus()),n.key===`Escape`&&(i(t.toString()),s.current=null,e.focus())},p=()=>{let r=t;e.getEditorState().read(()=>{let t=W();U(t)&&(r=J7(e,t))});let a=Math.min(r+f3t,d3t);n(a),i(a.toString()),c(a)},m=()=>{let r=t;e.getEditorState().read(()=>{let t=W();U(t)&&(r=J7(e,t))});let a=Math.max(r-f3t,u3t);n(a),i(a.toString()),c(a)},h=e=>{e.preventDefault()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-bg-foreground/[0.03] dark:cteditor-bg-foreground/[0.02] cteditor-px-1 cteditor-rounded-md cteditor-border cteditor-border-foreground/5`,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:m,onMouseDown:h,className:`cteditor-text-foreground/50 !cteditor-w-5.5 !cteditor-bg-transparent !cteditor-h-7`,children:(0,X.jsx)(kUt,{className:`!cteditor-size-4`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Decrease Font Size`})})]})}),(0,X.jsx)(N6,{className:`cteditor-max-w-7 !cteditor-h-7 !cteditor-p-0 !cteditor-text-center cteditor-border-none !cteditor-outline-0 !cteditor-outline-none !cteditor-ring-0 !cteditor-shadow-none `,value:r,onChange:l,onFocus:d,onBlur:u,onKeyDown:f}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:p,onMouseDown:h,className:`cteditor-text-foreground/50 !cteditor-w-5.5 !cteditor-bg-transparent !cteditor-h-7`,children:(0,X.jsx)(x2,{className:`!cteditor-size-4`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Increase Font Size`})})]})})]})},m3t=[`bold`,`italic`,`strikethrough`,`underline`,`code`,`subscript`,`superscript`],h3t=({hasFormat:e})=>{let[t]=Gd(),n=Q8.filter(e=>m3t.includes(e.payload));return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`toolbar`,size:`icon-sm`,className:`cteditor-text-foreground/50`,children:(0,X.jsx)(c2,{className:`!cteditor-size-4`})})}),(0,X.jsx)(Q5,{align:`end`,children:n.map((n,r)=>(0,X.jsxs)($5,{className:k$(e[n.payload]&&`cteditor-bg-foreground/10`),onClick:()=>t.dispatchCommand(pc,n.payload),children:[(0,X.jsx)(`span`,{children:n.icon}),(0,X.jsx)(`span`,{children:n.name})]},r))})]})},g3t=`cteditor-z-[9999] cteditor-border-0 cteditor-bg-transparent cteditor-p-0 cteditor-shadow-none cteditor-overflow-visible data-[side=bottom]:cteditor-slide-in-from-top-2 data-[side=top]:cteditor-slide-in-from-bottom-2 data-[side=left]:cteditor-slide-in-from-right-2 data-[side=right]:cteditor-slide-in-from-left-2 !cteditor-p-0`,X7=({featureName:e,displayTitle:t,planUnlockCatalogKey:n,tooltipMessage:r,side:i=`right`,sideOffset:a=10,align:o=`center`,alignOffset:s=0})=>(0,X.jsxs)($3,{side:i,sideOffset:a,align:o,alignOffset:s,className:k$(g3t),children:[(0,X.jsx)(n6,{featureName:e,displayTitle:t,planUnlockCatalogKey:n,tooltipMessage:r}),(0,X.jsx)(e6,{className:`cteditor-z-10`})]}),Z7=[`bold`,`italic`,`strikethrough`,`underline`,`code`,`subscript`,`superscript`],_3t=({hasFormat:e,blockType:t})=>{let[n]=Gd(),{editorConfig:r}=G0(),i=r?.toolbarOptions,a=r?.hideLockedFeatures??!1,o=i?.enableCodeFormat??!0,s=i?.enableLists??!0,c=i?.enableBlockquote??!0,l=e=>{switch(e){case`codeBlock`:return o;case`bullet`:case`number`:case`check`:return s;case`quote`:return c;default:return!0}},u=e=>{switch(e){case`codeBlock`:return`Code Format`;case`bullet`:case`number`:case`check`:return`Lists`;case`quote`:return`Blockquote`;default:return`Text Formatting`}},d=e=>{if(Z7.includes(e)){n.dispatchCommand(pc,e);return}n.update(()=>{let r=W();if(U(r))switch(e){case`codeBlock`:if(r.isCollapsed())Vu(r,()=>sd());else{let e=r.getTextContent(),t=sd();r.insertNodes([t]),r.insertRawText(e)}break;case`bullet`:t===`bullet`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Bd,void 0);break;case`number`:t===`number`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Vd,void 0);break;case`check`:t===`check`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Hd,void 0);break;case`quote`:Vu(r,()=>Df());break}})},f=Q8.filter(e=>Z7.includes(e.payload)),p=Q8.filter(e=>!Z7.includes(e.payload));return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-w-full`,children:[f.map((t,n)=>(0,X.jsxs)(Q2,{variant:`ghost`,size:`sm`,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-size-4 [&>svg]:cteditor-shrink-0 !cteditor-justify-start cteditor-h-auto `,e[t.payload]&&`cteditor-bg-foreground/10`),onClick:()=>d(t.payload),title:t.name,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:t.icon}),(0,X.jsx)(`span`,{children:t.name})]},n)),p.map((e,n)=>{let r=l(e.payload);if(!r&&a)return null;if(!r){let t=u(e.payload);return(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-opacity-50 cteditor-cursor-not-allowed`,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:e.icon}),(0,X.jsx)(`span`,{className:`cteditor-flex-1`,children:e.name}),(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:t,displayTitle:e.name,side:`right`})]})},`list-quote-${n}`)}return(0,X.jsxs)(Q2,{variant:`ghost`,size:`sm`,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-size-4 [&>svg]:cteditor-shrink-0 !cteditor-justify-start cteditor-h-auto`,t===e.payload&&`cteditor-bg-foreground/10`),onClick:()=>d(e.payload),title:e.name,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},`list-quote-${n}`)})]})},v3t=di(`INSERT_HTML_CANVAS_COMMAND`),y3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>e.registerCommand(v3t,t=>{let{htmlContent:n,width:r,height:i}=t;return e.update(()=>{let e=DFt({htmlContent:n,width:r||`100%`,height:i||`auto`}),t=Qs(),a=W();U(a)?(a.insertNodes([e]),e.insertAfter(t),t.select()):(Yi().append(e,t),t.select())}),!0},0),[e]),null},b3t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(I7e(),xqe))),x3t=({open:e,onOpenChange:t})=>{let[n]=Gd(),[r,i]=(0,Q.useState)(``),a=(0,Q.useRef)(``),[o,s]=(0,Q.useState)(`code`),[c,l]=(0,Q.useState)(`desktop`),[u,d]=(0,Q.useState)(100),[f,p]=(0,Q.useState)(400),m=(0,Q.useRef)(null),h=azt(),g=e=>{a.current=e,i(e)},_=r.trim();return(0,Q.useEffect)(()=>{o===`preview`&&m.current&&_&&(m.current.srcdoc=ozt(_,h))},[o,_,h]),(0,X.jsx)(x6,{open:e,modal:!0,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`!cteditor-max-w-[1320px] cteditor-w-full cteditor-h-[90vh] !cteditor-flex !cteditor-flex-col cteditor-p-0 cteditor-overflow-hidden !cteditor-p-0 !cteditor-gap-0`,"aria-describedby":void 0,children:[(0,X.jsx)(T6,{className:`cteditor-sr-only`,children:`Insert HTML Canvas`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-justify-between cteditor-px-6 cteditor-py-4 cteditor-gap-4 `,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3`,children:[(0,X.jsx)(lUt,{}),(0,X.jsx)(`div`,{children:(0,X.jsx)(`h2`,{className:`cteditor-text-lg cteditor-font-semibold cteditor-text-foreground`,children:`Insert HTML Canvas`})})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-3 cteditor-py-2 cteditor-bg-primary/10 cteditor-rounded-md cteditor-text-xs `,children:[(0,X.jsx)(_2,{className:`cteditor-flex-shrink-0 cteditor-text-green-500 cteditor-size-4`}),(0,X.jsxs)(`div`,{className:`cteditor-text-sm cteditor-text-foreground`,children:[(0,X.jsx)(`strong`,{children:`HTML Canvas`}),` preserves the full visual appearance of your HTML including backgrounds, gradients, and layout styles. Paste code, use `,(0,X.jsx)(`strong`,{children:`Preview`}),` to see how it looks (Desktop / Tablet / Mobile), then insert.`]})]})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-4 cteditor-justify-between cteditor-px-6 cteditor-pb-4 cteditor-items-center cteditor-border-b cteditor-border-border cteditor-flex-wrap cteditor-gap-2`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`label`,{className:`cteditor-block cteditor-font-medium cteditor-text-foreground`,children:`HTML Content`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-muted/50 cteditor-rounded-lg cteditor-p-1 [&>button]:cteditor-text-xs`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`code`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-transition-colors ${o===`code`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Edit HTML code`,children:[(0,X.jsx)(cUt,{className:`cteditor-w-3.5 cteditor-h-3.5`}),`Code`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`preview`),disabled:!_,className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-transition-colors ${o===`preview`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`} ${_?``:`cteditor-opacity-50 cteditor-pointer-events-none`}`,title:`Preview HTML (Desktop / Tablet / Mobile)`,children:[(0,X.jsx)(m2,{className:`cteditor-w-3.5 cteditor-h-3.5`}),`Preview`]})]})]}),(0,X.jsx)(Q2,{onClick:()=>{let e=a.current||r;e.trim()&&(n.dispatchCommand(v3t,{htmlContent:e.trim(),width:`100%`,height:`auto`}),a.current=``,i(``),s(`code`),t(!1))},disabled:!r.trim(),variant:`default`,title:`Insert HTML Canvas into document`,className:`max-sm:cteditor-text-xs`,children:`Insert HTML Canvas`})]}),(0,X.jsx)(`div`,{className:`cteditor-p-6 cteditor-flex-1 cteditor-min-h-0 cteditor-overflow-hidden cteditor-flex cteditor-flex-col`,children:o===`code`?(0,X.jsxs)(`div`,{className:`cteditor-contents cteditor-w-full cteditor-flex-1 cteditor-min-h-0 cteditor-border cteditor-border-foreground/50 cteditor-rounded-lg cteditor-bg-foreground/5 html-codemirror-wrapper`,style:{minHeight:320,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-min-h-0 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-xs cteditor-text-muted-foreground`,children:[(0,X.jsx)(y2,{className:`cteditor-w-4 cteditor-h-4 cteditor-animate-spin cteditor-mr-2`}),`Loading editor...`]}),children:(0,X.jsx)(b3t,{value:r,onChange:g,height:`100%`,isDarkMode:h,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!1},placeholder:`Paste your HTML here... (e.g., landing page, email template). Switch to Preview to see how it looks.`,style:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace`,fontSize:`13px`,flex:1,minHeight:0},className:`cteditor-flex-1 cteditor-min-h-0`})}),r.trim()&&(0,X.jsxs)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-mt-2 cteditor-px-2 cteditor-pb-2`,children:[(0,X.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,X.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),`HTML content detected (`,r.length,` characters). Switch to Preview to see render.`]})]}):(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-flex cteditor-flex-col cteditor-min-h-0 cteditor-overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-flex-wrap cteditor-gap-4 cteditor-pb-3`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-muted/50 cteditor-rounded-lg cteditor-p-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`desktop`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`desktop`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Desktop view`,children:[(0,X.jsx)(AUt,{size:14}),`Desktop`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`tablet`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`tablet`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Tablet view (768px)`,children:[(0,X.jsx)(HUt,{size:14}),`Tablet`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`mobile`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`mobile`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Mobile view (375px)`,children:[(0,X.jsx)(zUt,{size:14}),`Mobile`]})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-xs cteditor-text-muted-foreground`,children:`Zoom:`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(e=>Math.max(25,e-25)),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors`,disabled:u<=25,children:`-`}),(0,X.jsxs)(`span`,{className:`cteditor-text-xs cteditor-min-w-[40px] cteditor-text-center`,children:[u,`%`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(e=>Math.min(200,e+25)),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors`,disabled:u>=200,children:`+`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(100),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors cteditor-ml-1`,children:`Reset`})]})]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1 cteditor-min-h-0 cteditor-overflow-auto`,style:{minHeight:200},children:(0,X.jsx)(`div`,{className:`cteditor-mx-auto cteditor-transition-all cteditor-duration-300 !cteditor-h-full`,style:{width:(()=>{switch(c){case`mobile`:return`375px`;case`tablet`:return`768px`;default:return`100%`}})(),maxWidth:`100%`,transform:`scale(${u/100})`,transformOrigin:`top center`},children:(0,X.jsx)(`iframe`,{ref:m,title:`HTML Canvas Preview`,className:`cteditor-w-full cteditor-border cteditor-border-border cteditor-rounded-md cteditor-bg-background cteditor-text-foreground !cteditor-h-full`,style:{height:f,display:`block`},sandbox:`allow-same-origin allow-scripts`,onLoad:()=>{if(m.current)try{let e=m.current.contentDocument;if(e?.body){let t=e.body.scrollHeight;p(Math.min(Math.max(t+32,200),800))}}catch{}}})})})]})})]})})},Q7=di(`INSERT_IMAGE_COMMAND`),S3t=({captionsEnabled:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>{if(!t.hasNodes([c6]))throw Error(`ImagesPlugin: ImageNode not registered on editor`);return Gu(t.registerCommand(Q7,e=>{let t=u1(e);return xs([t]),ja(t.getParentOrThrow())&&Qu(t,Qs).selectEnd(),!0},0))},[e,t]),null},C3t=({onInsert:e,onDone:t})=>{let{apiKey:n}=G0(),{uploadFileToS3:r,progress:i,uploading:a,error:o}=Y8(n||void 0),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),_=o||d,v=e=>{let t=Array.from(e),n=t.filter(e=>e.type.startsWith(`image/`));if(n.length===0){f(Error(`Please select an image file (PNG, JPG, GIF, etc.)`));return}f(n.length<t.length?Error(`Skipped ${t.length-n.length} file(s) — only images can be uploaded.`):null),n.forEach(e=>{let t=`img-${++g.current}`;c(n=>[...n,{id:t,file:e,previewSrc:``,altText:``}]);let n=new FileReader;n.onload=()=>{if(typeof n.result!=`string`)return;let e=n.result,r=new Image;r.onload=()=>{c(n=>n.map(n=>n.id===t?{...n,previewSrc:e,width:r.naturalWidth,height:r.naturalHeight}:n))},r.onerror=()=>{c(n=>n.map(n=>n.id===t?{...n,previewSrc:e}:n))},r.src=e},n.readAsDataURL(e)})},y=e=>{c(t=>t.filter(t=>t.id!==e))},b=(e,t)=>{c(n=>n.map(n=>n.id===e?{...n,altText:t}:n))},x=e=>{let t=e.target.files;!t||t.length===0||(v(t),e.target.value=``)},S=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},C=e=>{e.preventDefault(),e.stopPropagation(),m(!1)},w=e=>{e.preventDefault(),e.stopPropagation(),m(!1);let t=e.dataTransfer.files;t&&t.length>0&&v(t)},T=()=>{h.current?.click()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-6`,children:[(0,X.jsx)(`input`,{ref:h,type:`file`,accept:`image/*`,multiple:!0,className:`cteditor-hidden`,onChange:x,"data-test-id":`image-modal-file-upload`}),(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:T,onDragOver:S,onDragLeave:C,onDrop:w,onKeyDown:e=>e.key===`Enter`&&T(),className:`cteditor-w-full cteditor-border cteditor-border-dashed cteditor-rounded-xl cteditor-p-8 cteditor-cursor-pointer cteditor-transition-colors cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-1 cteditor-min-h-[180px] cteditor-outline-none ${p?`cteditor-border-primary cteditor-bg-accent/50`:`cteditor-border-muted-foreground/50 hover:cteditor-border-muted-foreground`}`,children:[(0,X.jsx)(`div`,{className:`cteditor-size-8 cteditor-bg-foreground/5 cteditor-rounded-full cteditor-flex cteditor-items-center cteditor-justify-center [&>svg]:cteditor-size-6`,children:(0,X.jsx)(t3,{})}),(0,X.jsx)(`p`,{className:`cteditor-text-base cteditor-font-semibold cteditor-text-foreground cteditor-mt-3`,children:`Drop your images here`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-muted-foreground cteditor-mt-2`,children:`PNG, JPG, GIF or other image files — select as many as you like`})]}),s.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-space-y-2`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-justify-between`,children:[(0,X.jsxs)(F6,{className:`cteditor-block`,children:[s.length,` image`,s.length===1?``:`s`,` selected`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>c([]),disabled:a,className:`cteditor-text-xs cteditor-text-muted-foreground hover:cteditor-text-foreground disabled:cteditor-opacity-50`,children:`Clear all`})]}),(0,X.jsx)(`div`,{className:`cteditor-space-y-2 cteditor-max-h-[240px] cteditor-overflow-y-auto`,children:s.map(e=>(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-p-3 cteditor-rounded-md cteditor-bg-accent cteditor-text-sm`,children:[(0,X.jsx)(`div`,{className:`cteditor-size-10 cteditor-shrink-0 cteditor-rounded cteditor-overflow-hidden cteditor-bg-foreground/5 cteditor-flex cteditor-items-center cteditor-justify-center [&>svg]:cteditor-size-5`,children:e.previewSrc?(0,X.jsx)(`img`,{src:e.previewSrc,alt:``,className:`cteditor-size-full cteditor-object-cover`}):(0,X.jsx)(t3,{})}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-min-w-0 cteditor-space-y-1.5`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-foreground cteditor-truncate cteditor-block`,children:e.file.name}),(0,X.jsx)(N6,{placeholder:`Alt text (describes this image)`,value:e.altText,onChange:t=>b(e.id,t.target.value),"data-test-id":`image-modal-alt-text-input`,className:`cteditor-w-full !cteditor-h-8`})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),disabled:a,"aria-label":`Remove ${e.file.name}`,className:`cteditor-shrink-0 cteditor-text-muted-foreground hover:cteditor-text-destructive disabled:cteditor-opacity-50 [&>svg]:cteditor-size-4`,children:(0,X.jsx)(Fqt,{})})]},e.id))}),(0,X.jsxs)(Q2,{disabled:a,onClick:async()=>{if(s.length===0||a)return;f(null);let n=[],i=[],o=null;for(let e=0;e<s.length;e++){let t=s[e];if(u(e),o){i.push(t);continue}try{let e=await r(t.file);if(!e){i.push(t);continue}n.push({altText:t.altText,src:e,width:t.width,height:t.height})}catch(e){console.error(`Upload failed:`,e),o=e instanceof J8||e instanceof Error?e:Error(`Upload failed`),i.push(t)}}n.length>0&&e(n),c(i),u(0),o?f(o):t()},"data-test-id":`image-modal-file-upload-btn`,className:`cteditor-w-full cteditor-gap-1`,children:[(0,X.jsx)(sqt,{}),a?`Uploading ${l+1} of ${s.length}... ${i}%`:`Upload ${s.length} image${s.length===1?``:`s`}`]})]}),_&&(_ instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-p-3 cteditor-rounded-md cteditor-bg-destructive/10 cteditor-border cteditor-border-destructive/50`,children:[(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-destructive cteditor-text-sm`,children:`Storage Quota Exceeded`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-destructive/90 cteditor-mt-1`,children:_.message}),_.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-xs cteditor-text-destructive/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{children:[`Used: `,_.details.currentUsage,` / `,_.details.maxStorage]}),(0,X.jsxs)(`p`,{children:[`Available: `,_.details.availableStorage]}),(0,X.jsxs)(`p`,{children:[`File size: `,_.details.requestedSize]})]})]}):(0,X.jsxs)(`p`,{className:`cteditor-text-sm cteditor-text-destructive`,children:[`Error: `,_.message]}))]})},w3t=({onClick:e})=>{let[t,n]=(0,Q.useState)(``),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),{apiKey:h}=G0(),g=d,_=e=>{try{let t=new URL(e);if(t.hostname.includes(`google.com`)&&t.pathname===`/imgres`){let e=t.searchParams.get(`imgurl`);if(e)return e}if(t.hostname.includes(`bing.com`)&&t.pathname.includes(`/images/`)){let e=t.searchParams.get(`mediaurl`);if(e)return e}}catch{}return e},v=e=>{if(!e.trim())return!1;try{if(e.startsWith(`data:image/`))return!0;let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)}catch{return!1}},y=e=>{let t=_(e);if(n(t),c(null),!t.trim()){o(!1);return}let r=v(t);if(o(r),r){let e=new Image;e.onload=()=>{c(null),o(!0),u({width:e.naturalWidth,height:e.naturalHeight})},e.onerror=()=>{c(`Failed to load image preview. The image URL may be invalid or inaccessible. You can still try to insert it.`)},e.src=t}};return(0,X.jsxs)(`div`,{className:`cteditor-space-y-4`,children:[t&&a&&!s&&(0,X.jsx)(`div`,{className:`cteditor-mb-4 cteditor-flex cteditor-flex-col cteditor-justify-center cteditor-items-center`,children:(0,X.jsx)(`img`,{src:t,alt:`Preview`,className:`cteditor-max-w-full cteditor-max-h-[200px] cteditor-object-contain cteditor-rounded-md`,onError:()=>{c(`Failed to load image preview. The image URL may be invalid or inaccessible. You can still try to insert it.`)}})}),s&&(0,X.jsx)(`div`,{className:`cteditor-mb-4 cteditor-p-2 cteditor-bg-red-50 cteditor-border cteditor-border-red-200 rcteditor-ounded cteditor-text-red-600 cteditor-text-sm`,children:s}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(F6,{htmlFor:`image-url`,className:`cteditor-mb-2 cteditor-block`,children:`Image URL`}),(0,X.jsx)(N6,{id:`image-url`,type:`url`,placeholder:`https://example.com/image.jpg`,value:t,onChange:e=>y(e.target.value),"data-test-id":`image-modal-url-input`,className:`!cteditor-w-full`}),t&&!a&&!s&&(0,X.jsx)(`p`,{className:`cteditor-text-sm cteditor-text-red-500 cteditor-mt-1`,children:`Please enter a valid image URL`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(F6,{htmlFor:`alt-text-url`,className:`!cteditor-mb-2 !cteditor-block`,children:`Alt Text`}),(0,X.jsx)(N6,{id:`alt-text-url`,placeholder:`Descriptive alternative text`,value:r,onChange:e=>i(e.target.value),"data-test-id":`image-modal-url-alt-text-input`,className:`!cteditor-w-full`})]}),g&&(g instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-p-3 cteditor-rounded-md cteditor-bg-destructive/10 cteditor-border cteditor-border-destructive/50`,children:[(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-destructive cteditor-text-sm`,children:`Storage Quota Exceeded`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-destructive/90 cteditor-mt-1`,children:g.message}),g.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-xs cteditor-text-destructive/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{children:[`Used: `,g.details.currentUsage,` / `,g.details.maxStorage]}),(0,X.jsxs)(`p`,{children:[`Available: `,g.details.availableStorage]}),(0,X.jsxs)(`p`,{children:[`File size: `,g.details.requestedSize]})]})]}):(0,X.jsxs)(`p`,{className:`cteditor-text-sm cteditor-text-destructive`,children:[`Error: `,g.message]})),(0,X.jsx)(`div`,{className:`cteditor-text-center`,children:(0,X.jsx)(Q2,{disabled:!t||!a||p,onClick:async()=>{if(!(!t||!a||p)){f(null),m(!0);try{if(!h){e({altText:r,src:t,width:l?.width,height:l?.height});return}let n=(await B0.post(V0.project.fileUploadFromUrl,{url:t,prefix:`uploads`},{headers:{...h&&{"x-api-key":h}}})).data.fileUrl;e({altText:r,src:n,width:l?.width,height:l?.height})}catch(e){if(console.error(`Failed to upload image from URL:`,e),e instanceof Jr&&e.response?.data){let t=e.response.data;e.response.status===413&&t.error===`Storage quota exceeded`?f(new J8(t.message||`Storage quota exceeded`,t.details)):f(Error(t.message||`Failed to upload image`))}else e instanceof Error?f(e):f(Error(`Failed to upload image`))}finally{m(!1)}}},"data-test-id":`image-modal-url-insert-btn`,children:p?`Uploading...`:`Insert Image`})})]})},$7=({activeEditor:e,onClose:t})=>{let[n,r]=(0,Q.useState)(`file`),i=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{i.current=!1;let e=e=>{i.current=e.altKey};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[e]);let a=t=>{t.forEach(t=>e.dispatchCommand(Q7,t))};return(0,X.jsx)(x6,{open:!0,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`cteditor-w-full sm:cteditor-max-w-4xl [&>.closeDialog]:cteditor-top-1 [&>.closeDialog]:cteditor-right-1`,children:[(0,X.jsx)(C6,{className:`cteditor-sr-only`,children:(0,X.jsx)(T6,{children:`Insert Image`})}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-4 `,children:n===`file`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(C3t,{onInsert:a,onDone:t}),(0,X.jsx)(`p`,{className:`cteditor-text-center cteditor-text-foreground cteditor-text-xs`,children:`OR`}),(0,X.jsx)(`div`,{className:`cteditor-text-center`,children:(0,X.jsxs)(Q2,{onClick:()=>r(`url`),className:`cteditor-gap-1`,children:[(0,X.jsx)(G4,{}),`Insert via URL`]})})]}):(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(w3t,{onClick:e=>{a([e]),t()}})})})]})})},T3t=di(),E3t=[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],D3t=[`image/`,`image/heic`,`image/heif`,`image/gif`,`image/webp`,`image/png`,`image/jpg`,`image/jpeg`,`image/svg+xml`],O3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>e.registerCommand(T3t,({src:t,linkText:n,fileSize:r,mimeType:i})=>{try{return e.update(()=>{e.focus();let a=W(),o=szt(i,E3t)?R1({src:t}):szt(i,D3t)?u1({src:t,altText:n||`Uploaded image`}):E1({src:t,fileName:n||t.split(`/`).pop()||`Download File`,fileSize:r});if(U(a))a.insertNodes([o]);else{let e=Qs();e.append(o),Yi().append(e)}}),!0}catch(e){return console.error(`Error in INSERT_FILE_COMMAND handler:`,e),!1}},0),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n){if(t.hasAttribute(`download`)){e.preventDefault(),window.open(n,`_blank`);return}e.preventDefault()}};return t.addEventListener(`click`,n),()=>{t.removeEventListener(`click`,n)}},[e]),null},k3t=new Set(`.exe,.msi,.bat,.cmd,.sh,.ps1,.apk,.dmg,.jar,.php,.py,.rb,.pl,.wasm,.svg,.html,.htm,.js,.mjs,.cjs,.ts,.tsx,.jsx,.xml,.xhtml,.rar,.tar,.gz,.bz2`.split(`,`)),A3t=`This file type is not allowed for security reasons.`,j3t=e=>e.includes(`.`)?`.${e.split(`.`).pop().toLowerCase()}`:``,M3t=e=>{let t=j3t(e.name);return k3t.has(t)?A3t:null},N3t=20,P3t=`cteditor-relative cteditor-rounded-[14px] cteditor-pt-[26px] cteditor-px-5 cteditor-pb-[22px] cteditor-text-center cteditor-overflow-hidden hover:cteditor-bg-accent dark:hover:cteditor-bg-[#16161a] cteditor-transition-colors cteditor-duration-300 cteditor-border cteditor-border-dashed cteditor-outline-none`,F3t=`cteditor-w-11 cteditor-h-11 cteditor-mx-auto cteditor-mb-3 cteditor-rounded-xl cteditor-bg-gradient-to-b cteditor-from-gray-100 cteditor-to-white dark:cteditor-from-[#25252a] dark:cteditor-to-[#1a1a1e] cteditor-border cteditor-border-border dark:cteditor-border-white/10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-muted-foreground dark:cteditor-text-[#d1d5dc] cteditor-shadow-sm dark:cteditor-shadow-[inset_0_1px_0_0_rgba(255,255,255,.06)]`,I3t=`cteditor-grid cteditor-grid-cols-[28px_1fr_20px] cteditor-gap-2.5 cteditor-items-center cteditor-py-2 cteditor-px-2.5 cteditor-rounded-[10px] cteditor-bg-muted/30 dark:cteditor-bg-white/[0.025] cteditor-border cteditor-border-border dark:cteditor-border-white/5 cteditor-transition-colors hover:cteditor-bg-muted/50 dark:hover:cteditor-bg-white/5`,L3t=`cteditor-w-7 cteditor-h-7 cteditor-rounded-md cteditor-grid cteditor-place-items-center cteditor-font-mono cteditor-text-[9px] cteditor-font-bold cteditor-tracking-[0.02em] cteditor-bg-primary/10 dark:cteditor-bg-[rgba(99,82,232,.18)] cteditor-text-primary dark:cteditor-text-[#a99cff]`,R3t=`cteditor-text-[12.5px] cteditor-text-foreground dark:cteditor-text-white cteditor-font-medium cteditor-tracking-[-0.005em] cteditor-whitespace-nowrap cteditor-overflow-hidden cteditor-text-ellipsis cteditor-min-w-0`,z3t=`cteditor-block cteditor-h-full cteditor-bg-gradient-to-r cteditor-from-primary/80 cteditor-to-primary dark:cteditor-from-[#a99cff] dark:cteditor-to-[#6352e8] cteditor-rounded-full cteditor-shadow-sm dark:cteditor-shadow-[0_0_8px_rgba(99,82,232,.45)] cteditor-transition-all cteditor-duration-500`,B3t=({onClick:e})=>{let[t,n]=(0,Q.useState)(``),{apiKey:r}=G0(),{uploadFileToS3:i,progress:a,uploading:o,error:s}=Y8(r||void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=e=>M3t(e)||(e.size>N3t*1024*1024?`File size exceeds ${N3t}MB limit.`:null),g=e=>{let t=h(e);if(t){d(t),l(null);return}d(null),l(e)},_=e=>{let t=e.target.files;!t||t.length===0||(g(t[0]),e.target.value=``)},v=e=>{e.preventDefault(),e.stopPropagation(),p(!0)},y=e=>{e.preventDefault(),e.stopPropagation(),p(!1)},b=e=>{e.preventDefault(),e.stopPropagation(),p(!1);let t=e.dataTransfer.files;t&&t.length>0&&g(t[0])},x=()=>{m.current?.click()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-3.5`,children:[(0,X.jsx)(`input`,{ref:m,type:`file`,className:`cteditor-hidden`,accept:`*/*`,onChange:_}),(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:x,onDragOver:v,onDragLeave:y,onDrop:b,onKeyDown:e=>e.key===`Enter`&&x(),className:`${P3t} ${f?`cteditor-bg-accent dark:cteditor-bg-[#16161a] cteditor-border-primary dark:cteditor-border-indigo-600`:`cteditor-bg-background dark:cteditor-bg-[#131316] cteditor-border-border dark:cteditor-border-white/10`}`,children:[(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-inset-0 cteditor-bg-[radial-gradient(120%_80%_at_50%_0%,rgba(99,82,232,.07),transparent_55%)] cteditor-pointer-events-none`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-z-10 cteditor-flex cteditor-flex-col cteditor-gap-2`,children:[(0,X.jsx)(`div`,{className:F3t,children:(0,X.jsx)(WUt,{size:22})}),(0,X.jsxs)(`h4`,{className:`cteditor-m-0 cteditor-mb-1 cteditor-text-base cteditor-font-semibold cteditor-tracking-[-0.005em] cteditor-text-foreground dark:cteditor-text-white`,children:[`Drop a file or `,(0,X.jsx)(`span`,{className:`cteditor-text-foreground dark:cteditor-text-white cteditor-border-b cteditor-border-border dark:cteditor-border-white/32 cteditor-pb-px`,children:`browse`})]}),(0,X.jsx)(`p`,{className:`cteditor-m-0 cteditor-text-[12.5px] cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:`PDF, images, docs, video · up to 20 MB each`})]})]}),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-text-[10.5px] cteditor-tracking-[0.14em] cteditor-uppercase cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-font-semibold cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-0.5`,children:[(0,X.jsx)(`span`,{children:o?`Uploading`:`Selected file`}),(0,X.jsxs)(`span`,{className:`cteditor-font-mono cteditor-tracking-normal cteditor-normal-case cteditor-text-[11px] cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:[`1 file · `,(c.size/(1024*1024)).toFixed(2),` MB`]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-1.5`,children:(0,X.jsxs)(`div`,{className:I3t,children:[(0,X.jsx)(`div`,{className:L3t,children:c.name.split(`.`).pop()?.toUpperCase().substring(0,3)||`DOC`}),(0,X.jsxs)(`div`,{className:`cteditor-min-w-0`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-baseline cteditor-justify-between cteditor-gap-2.5 cteditor-min-w-0`,children:[(0,X.jsx)(`span`,{className:R3t,children:c.name}),(0,X.jsx)(`span`,{className:`cteditor-font-mono cteditor-text-[10.5px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-shrink-0`,children:o?`${a}%`:`${(c.size/(1024*1024)).toFixed(2)} MB`})]}),o&&(0,X.jsx)(`div`,{className:`cteditor-h-[3px] cteditor-rounded-full cteditor-bg-muted dark:cteditor-bg-white/5 cteditor-mt-[5px] cteditor-overflow-hidden`,children:(0,X.jsx)(`span`,{className:z3t,style:{width:`${a}%`}})})]}),o?(0,X.jsx)(`span`,{className:`cteditor-w-5`}):(0,X.jsx)(Q2,{variant:`ghost`,size:`icon`,className:`!cteditor-h-5 !cteditor-w-5 cteditor-bg-transparent hover:cteditor-bg-foreground/5`,onClick:()=>l(null),"aria-label":`Remove`,children:(0,X.jsx)(k2,{size:12,className:`!cteditor-size-3`})})]})})]}),c&&(0,X.jsx)(`div`,{className:`cteditor-mt-1 cteditor-pt-3.5 cteditor-border-t cteditor-border-border dark:cteditor-border-white/5 cteditor-flex cteditor-items-center cteditor-justify-between cteditor-gap-3`,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`span`,{className:`cteditor-w-3.5 cteditor-h-3.5 cteditor-rounded-full cteditor-border-2 cteditor-border-border dark:cteditor-border-white/10 cteditor-border-t-primary dark:cteditor-border-t-[#a99cff] cteditor-animate-spin`}),`Uploading… `,(0,X.jsxs)(`span`,{className:`cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:[Math.round(a),`%`]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-2 cteditor-items-center`,children:(0,X.jsx)(Q2,{disabled:!0,className:`cteditor-gap-2`,children:`Done`})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-flex cteditor-items-center cteditor-gap-2`,children:`Ready to upload`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-2 cteditor-items-center`,children:[(0,X.jsx)(Q2,{variant:`outline`,onClick:()=>l(null),children:`Cancel`}),(0,X.jsxs)(Q2,{className:`cteditor-gap-2`,onClick:async()=>{if(!(!c||o))try{let r=await i(c);if(!r)return;e({linkText:t||c.name,src:r,mimeType:c.type}),l(null),n(``)}catch(e){console.error(`Upload failed:`,e)}},children:[(0,X.jsx)(D2,{className:`!cteditor-size-3.5`}),` Upload 1 file`]})]})]})}),u&&(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-red-500/10 cteditor-border cteditor-border-red-500/20 cteditor-text-red-400`,children:[(0,X.jsx)(e2,{size:16,className:`cteditor-shrink-0 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-font-medium cteditor-m-0`,children:u})]}),s&&(s instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-amber-500/10 cteditor-border cteditor-border-amber-500/20`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-mb-1`,children:[(0,X.jsx)(t2,{size:16,className:`cteditor-shrink-0 cteditor-text-amber-400 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-amber-400 cteditor-text-[13px] cteditor-m-0`,children:`Storage Quota Exceeded`})]}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-text-amber-400/90 cteditor-mt-1 cteditor-mb-0`,children:s.message}),s.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-[11.5px] cteditor-text-amber-400/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`Used: `,s.details.currentUsage,` / `,s.details.maxStorage]}),(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`Available: `,s.details.availableStorage]}),(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`File size: `,s.details.requestedSize]})]})]}):(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-red-500/10 cteditor-border cteditor-border-red-500/20 cteditor-text-red-400`,children:[(0,X.jsx)(e2,{size:16,className:`cteditor-shrink-0 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-font-medium cteditor-m-0`,children:s.message})]}))]})},e9=({activeEditor:e,onClose:t})=>(0,X.jsx)(x6,{open:!0,modal:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(S6,{className:`sm:cteditor-max-w-xl !cteditor-p-0 !cteditor-gap-0 [&>.closeDialog]:cteditor-top-5 [&>.closeDialog]:cteditor-right-5`,"aria-describedby":void 0,children:[(0,X.jsx)(C6,{className:`cteditor-p-5 cteditor-border-b cteditor-border-border dark:cteditor-border-white/5 cteditor-m-0 cteditor-space-y-0`,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-text-left`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-9 cteditor-h-9 cteditor-rounded-[8px] cteditor-border cteditor-border-border dark:cteditor-border-white/10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-bg-muted/30 dark:cteditor-bg-white/5 cteditor-shrink-0`,children:(0,X.jsx)(g2,{size:16,className:`cteditor-text-muted-foreground dark:cteditor-text-white/70 cteditor-stroke-[1.5]`})}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-start cteditor-justify-center`,children:[(0,X.jsx)(T6,{className:`cteditor-text-[15px] cteditor-font-semibold cteditor-tracking-tight cteditor-text-foreground dark:cteditor-text-white cteditor-leading-tight cteditor-m-0`,children:`Add file to workspace`}),(0,X.jsx)(`p`,{className:`cteditor-text-[13px] cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-leading-tight cteditor-mt-0.5 cteditor-m-0`,children:`Private and secure • Indexed for AI context`})]})]})}),(0,X.jsx)(`div`,{className:`cteditor-p-5`,children:(0,X.jsx)(B3t,{onClick:n=>{e.dispatchCommand(T3t,n),t()}})})]})}),t9=di(`INSERT_ORNAMENT_DIVIDER_COMMAND`),n9=di(`INSERT_ASTERISM_COMMAND`),r9=di(`INSERT_LABELED_RULE_COMMAND`),i9=di(`INSERT_SECTION_HEADING_COMMAND`),a9=di(`INSERT_PULL_QUOTE_RULES_COMMAND`),V3t=/^\/\S*$/,H3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{if(!e.hasNodes([j8,P8,F8]))throw Error(`EditorialTypographyPlugin: editorial nodes not registered on editor`);return Gu(e.registerCommand(t9,e=>(dzt(B1(e)),!0),0),e.registerCommand(n9,e=>(dzt(V1(e)),!0),0),e.registerCommand(r9,e=>{let t=W1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(i9,e=>{let t=K1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(a9,e=>{let t=J1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(Oc,e=>{let t=pzt();if(!t)return!1;let{fields:n,index:r,block:i}=t,a=e.shiftKey?r-1:r+1;return a>=0&&a<n.length?(e.preventDefault(),n[a].selectStart(),!0):(e.shiftKey||(e.preventDefault(),hzt(i)),!0)},1),e.registerCommand(Cc,e=>{let t=pzt();if(!t)return!1;let{fields:n,index:r,block:i}=t;return e&&e.preventDefault(),r<n.length-1?n[r+1].selectStart():hzt(i),!0},1),e.registerCommand(Tc,e=>{let t=pzt();if(!t)return!1;let{field:n,fields:r,index:i,block:a}=t;if(!mzt(n))return!1;if(i>0)return e.preventDefault(),r[i-1].selectEnd(),!0;if(e.preventDefault(),r.every(e=>e.getTextContent().trim()===``)){let e=a.getPreviousSibling();a.remove(),e&&`selectEnd`in e&&e.selectEnd()}return!0},1))},[e]),null},o9=di(`OPEN_DIVIDER_PICKER_COMMAND`),s9=[{id:`labeled-thin`,group:`Labeled rule`,label:`Thin`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--thin`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`thin`)},{id:`labeled-thick`,group:`Labeled rule`,label:`Thick`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--thick`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`thick`)},{id:`labeled-dashed`,group:`Labeled rule`,label:`Dashed`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--dashed`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`dashed`)},{id:`labeled-dotted`,group:`Labeled rule`,label:`Dotted`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--dotted`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`dotted`)},{id:`ornament-star`,group:`Ornament`,label:`Star`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--star`,children:`✦ ✦ ✦`}),run:e=>e.dispatchCommand(t9,`star`)},{id:`ornament-flower`,group:`Ornament`,label:`Flower`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--flower`,children:`❋ ❋ ❋`}),run:e=>e.dispatchCommand(t9,`flower`)},{id:`ornament-diamond`,group:`Ornament`,label:`Diamond`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--diamond`,children:`◆ ◆ ◆`}),run:e=>e.dispatchCommand(t9,`diamond`)},{id:`ornament-dot`,group:`Ornament`,label:`Dot`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--dot`,children:`• • •`}),run:e=>e.dispatchCommand(t9,`dot`)},{id:`ornament-section`,group:`Ornament`,label:`Section mark`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--section`,children:`§ § §`}),run:e=>e.dispatchCommand(t9,`section`)},{id:`asterism-asterism`,group:`Asterism`,label:`Asterism`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--asterism`,children:`⁂`}),run:e=>e.dispatchCommand(n9,`asterism`)},{id:`asterism-triple`,group:`Asterism`,label:`Triple star`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--triple-star`,children:`* * *`}),run:e=>e.dispatchCommand(n9,`triple-star`)},{id:`asterism-section`,group:`Asterism`,label:`Section mark`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--section`,children:`§`}),run:e=>e.dispatchCommand(n9,`section`)}],U3t=({activeEditor:e,savedSelection:t,onClose:n})=>{let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(0),s=(0,Q.useRef)(null),c=(0,Q.useMemo)(()=>{let e=r.trim().toLowerCase();return e?s9.filter(t=>t.label.toLowerCase().includes(e)||t.group.toLowerCase().includes(e)):s9},[r]);(0,Q.useEffect)(()=>{o(e=>e>=c.length?0:e)},[c.length]),(0,Q.useEffect)(()=>{s.current?.querySelector(`[data-picker-index="${a}"]`)?.scrollIntoView({block:`nearest`})},[a]);let l=r=>{let i=t;n(),requestAnimationFrame(()=>{e.focus(),e.update(()=>{i&&Zi(i.clone()),r.run(e)})})},u=e=>{let t=e.target.tagName===`INPUT`;if(e.key===`ArrowDown`)e.preventDefault(),o(e=>Math.min(e+2,c.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),o(e=>Math.max(e-2,0));else if(e.key===`ArrowRight`&&!t)e.preventDefault(),o(e=>Math.min(e+1,c.length-1));else if(e.key===`ArrowLeft`&&!t)e.preventDefault(),o(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=c[a];t&&l(t)}},d=(0,Q.useMemo)(()=>{let e=[];return c.forEach((t,n)=>{let r=e[e.length-1];!r||r.group!==t.group?e.push({group:t.group,entries:[{item:t,index:n}]}):r.entries.push({item:t,index:n})}),e},[c]),f=new Set(s9.map(e=>e.group)).size;return(0,X.jsx)(x6,{open:!0,modal:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(S6,{className:`sm:cteditor-max-w-[520px] !cteditor-gap-3`,onKeyDown:u,children:[(0,X.jsxs)(C6,{children:[(0,X.jsx)(T6,{children:`Insert divider`}),(0,X.jsxs)(`p`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 !cteditor-mt-0.5`,children:[s9.length,` styles · `,f,` families`]})]}),(0,X.jsxs)(`div`,{className:`cteditor-relative`,children:[(0,X.jsx)(C2,{className:`cteditor-absolute cteditor-left-3 cteditor-top-1/2 -cteditor-translate-y-1/2 cteditor-size-3.5 cteditor-text-muted-foreground cteditor-pointer-events-none`}),(0,X.jsx)(N6,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Search dividers…`,className:`!cteditor-h-9 cteditor-pl-9`})]}),(0,X.jsxs)(`div`,{ref:s,className:`cteditor-max-h-[min(60vh,660px)] cteditor-overflow-y-auto cteditor-pr-1 -cteditor-mr-1`,children:[c.length===0&&(0,X.jsx)(`div`,{className:`cteditor-text-sm cteditor-text-muted-foreground cteditor-py-6 cteditor-text-center`,children:`No matching dividers`}),d.map(e=>(0,X.jsxs)(Q.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-px-0.5 cteditor-pt-3.5 cteditor-pb-2 first:cteditor-pt-0.5`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-[10px] cteditor-font-semibold cteditor-tracking-[0.16em] cteditor-uppercase cteditor-text-muted-foreground`,children:e.group}),(0,X.jsx)(`span`,{className:`cteditor-text-[10px] cteditor-text-muted-foreground/60`,children:e.entries.length}),(0,X.jsx)(`div`,{className:`cteditor-h-px cteditor-flex-1 cteditor-bg-border/60`})]}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-2 cteditor-gap-2`,children:e.entries.map(({item:e,index:t})=>{let n=t===a;return(0,X.jsxs)(`button`,{type:`button`,"data-picker-index":t,onMouseEnter:()=>o(t),onClick:()=>l(e),className:`cteditor-flex cteditor-flex-col cteditor-h-[72px] cteditor-w-full cteditor-text-left cteditor-rounded-[10px] cteditor-border cteditor-border-border/60 cteditor-px-3.5 cteditor-transition-colors `+(n?`cteditor-bg-[linear-gradient(180deg,rgba(184,132,56,0.10),rgba(184,132,56,0.03))] dark:cteditor-bg-[linear-gradient(180deg,rgba(230,185,107,0.10),rgba(230,185,107,0.03))]`:`cteditor-bg-foreground/[0.02]`),children:[(0,X.jsx)(`div`,{className:`ed-picker-preview cteditor-flex-1 cteditor-min-h-0 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-overflow-hidden cteditor-w-full`,children:e.preview}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-pb-2 cteditor-text-[11.5px] cteditor-leading-none `+(n?`cteditor-text-[#b88438] dark:cteditor-text-[#e6b96b] cteditor-font-semibold`:`cteditor-text-muted-foreground`),children:e.label})]},e.id)})})]},e.group))]})]})})},W3t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>e.registerCommand(o9,()=>{let t=null;return e.read(()=>{let e=W();e&&(t=e.clone())}),i(t),n(!0),!0},0),[e]),t?(0,X.jsx)(U3t,{activeEditor:e,savedSelection:r,onClose:()=>{n(!1),i(null)}}):null},c9=di(`INSERT_COLUMNS_COMMAND`),l9=di(`INSERT_BUTTON_BLOCK_COMMAND`),u9=di(`INSERT_FAQ_COMMAND`),G3t=/^\/\S*$/,K3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>Gu(e.registerCommand(c9,e=>{if(_zt())return!0;let t=$1(e);vzt(t),t.getNextSibling()===null&&t.insertAfter(Qs());let n=t.getChildren().filter(Z1)[0]?.getFirstChild();return n&&`selectStart`in n&&n.selectStart(),!0},0),e.registerCommand(l9,()=>{let e=a0(`Button`,``,`filled`);return vzt(e),e.getNextSibling()===null&&e.insertAfter(Qs()),!0},0),e.registerCommand(u9,()=>{let e=CLt();return vzt(e),e.getNextSibling()===null&&e.insertAfter(Qs()),!0},0)),[e]),null},d9=di(`INSERT_PATTERN_COMMAND`),f9=[{id:`hero`,name:`Hero`,description:`Heading + subtext + CTA button`},{id:`feature`,name:`Feature row`,description:`Two columns: copy + image`},{id:`three`,name:`Three-up`,description:`Three feature columns`},{id:`cta`,name:`CTA band`,description:`Closing line + button`}],q3t={hero:()=>[wzt(`A headline that sells the page`),Tzt(`One supporting sentence that explains the value in plain terms.`),a0(`Get started`,``,`filled`)],feature:()=>[Ezt(2,[b0(y0(`Feature name.`,`A short description of what it does and why it matters.`)),b0(y0(`Product preview.`,`Add a supporting image below.`),ELt())])],three:()=>[Ezt(3,[b0(y0(`Fast`,`Integrate in 10 minutes.`)),b0(y0(`Native`,`Built on Lexical.`)),b0(y0(`AI-ready`,`Per-block actions.`))])],cta:()=>[h1(),wzt(`Ready when you are`),a0(`Start free`,``,`filled`)]},J3t=/^\/\S*$/,Y3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>Gu(e.registerCommand(d9,e=>{let t=q3t[e];return t?(Ozt(t()),!0):!1},0)),[e]),null},p9=({className:e})=>(0,X.jsx)(`span`,{className:`cteditor-shrink-0 cteditor-rounded cteditor-px-[5px] cteditor-py-[2px] cteditor-text-[8.5px] cteditor-font-bold cteditor-tracking-[0.08em] cteditor-font-geist cteditor-uppercase cteditor-leading-3 cteditor-text-[#1a1206] cteditor-bg-[linear-gradient(180deg,#f5db9e_0%,#e6b96b_55%,#b88438_100%)] cteditor-shadow-[0_1px_0_rgba(255,255,255,0.4)_inset,0_0_10px_-2px_rgba(230,185,107,0.55)]`+(e?` `+e:``),children:`NEW`}),X3t=({className:e})=>(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-relative cteditor-shrink-0 cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-[1.5px] cteditor-ring-background`+(e?` `+e:``),children:(0,X.jsx)(`span`,{className:`cteditor-absolute -cteditor-inset-[3px] cteditor-rounded-full cteditor-border-[1.5px] cteditor-border-solid cteditor-border-[#e6b96b] cteditor-animate-ping-slow`})}),Z3t={hero:(0,X.jsx)(S3,{}),feature:(0,X.jsx)(C3,{}),three:(0,X.jsx)(w3,{}),cta:(0,X.jsx)(T3,{})},Q3t=()=>{let[e,t]=(0,Q.useState)(null);return{show:e=>{t(e(()=>t(null)))},hide:()=>{t(null)},activeModal:e}},$3t=({enableHorizontalLine:e=!0,enableFileAttachments:t=!0,enableSignature:n=!0})=>{let[r]=Gd(),i=Q3t(),a=L4(),o=K0()?.editorConfig?.toolbarOptions,s=o?.enableEditorialDividers!==!1,c=o?.enableSectionHeading!==!1,l=o?.enablePullQuote!==!1,u=o?.enableColumns!==!1,d=o?.enableButtonBlock!==!1,f=o?.enableFaq!==!1,p=o?.enablePatterns!==!1,{isNew:m,markUsed:h}=s0(),g=e=>{let t=null;r.getEditorState().read(()=>{let e=W();e&&(t=e.clone())}),requestAnimationFrame(()=>{r.focus(),r.update(()=>{t&&Zi(t.clone()),e()})})},_=[{name:`Decorative Divider`,featureName:`Editorial Dividers`,icon:(0,X.jsx)(x3,{}),enabled:s,newKey:`styled-divider`,onClick:()=>r.dispatchCommand(o9,void 0)},{name:`Section Heading`,featureName:`Section Heading`,icon:(0,X.jsx)(o3,{}),enabled:c,newKey:`section-heading`,onClick:()=>g(()=>r.dispatchCommand(i9,void 0))},{name:`Pull Quote`,featureName:`Pull Quote`,icon:(0,X.jsx)(n3,{}),enabled:l,newKey:`pull-quote`,onClick:()=>g(()=>r.dispatchCommand(a9,void 0))}],v=[{name:`Columns`,featureName:`Columns`,icon:(0,X.jsx)(D3,{}),enabled:u,newKey:`columns`,onClick:()=>g(()=>r.dispatchCommand(c9,2))},{name:`Button`,featureName:`Button`,icon:(0,X.jsx)(uJt,{}),enabled:d,newKey:`button`,onClick:()=>g(()=>r.dispatchCommand(l9,void 0))},{name:`FAQ`,featureName:`FAQ`,icon:(0,X.jsx)(E3,{}),enabled:f,newKey:`faq`,onClick:()=>g(()=>r.dispatchCommand(u9,void 0))}],y=f9.map(e=>({name:e.name,featureName:`Patterns`,icon:Z3t[e.id],enabled:p,newKey:`pattern:${e.id}`,onClick:()=>g(()=>r.dispatchCommand(d9,e.id))})),b=[{label:`Editorial`,icon:(0,X.jsx)(a3,{}),items:_},{label:`Blocks`,icon:(0,X.jsx)(nJt,{}),items:v},{label:`Patterns`,icon:(0,X.jsx)(rJt,{}),items:y}],x=(e,t)=>e.enabled?(0,X.jsxs)($5,{className:m(e.newKey)?`hover:!cteditor-bg-yellow-500/10`:void 0,onClick:()=>{h(e.newKey),setTimeout(()=>e.onClick(),0)},children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),m(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-w-full cteditor-opacity-50 cteditor-cursor-not-allowed cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-gap-2`,children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),m(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`}),(0,X.jsx)(`div`,{className:`${m(e.newKey)?``:`cteditor-ml-auto`} [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.featureName,side:`right`})]})},t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`toolbar`,size:`icon-sm`,className:`cteditor-text-foreground/50`,children:(0,X.jsx)(c2,{className:`!cteditor-size-4`})})}),(0,X.jsxs)(Q5,{align:`start`,children:[[{name:`Horizontal Line`,icon:(0,X.jsx)(Z4,{}),enabled:e,onClick:()=>{let e=null;r.getEditorState().read(()=>{let t=W();t&&(e=t.clone())}),i.show(t=>(0,X.jsx)(S8,{activeEditor:r,onClose:t,savedSelection:e}))}},{name:`Upload File`,icon:(0,X.jsx)(c3,{}),enabled:t,onClick:()=>i.show(e=>(0,X.jsx)(e9,{activeEditor:r,onClose:e}))},{name:`Signature`,icon:(0,X.jsx)(Q4,{}),enabled:n,onClick:()=>i.show(e=>(0,X.jsx)(s5,{onClose:e}))}].map((e,t)=>e.enabled?(0,X.jsxs)($5,{onClick:()=>{setTimeout(()=>e.onClick(),0)},children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-w-full cteditor-opacity-50 cteditor-cursor-not-allowed cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-gap-2`,children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.name,side:`right`})]})},t)),b.some(e=>e.items.length>0)&&(0,X.jsx)(e7,{}),b.filter(e=>e.items.length>0).map(e=>(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:`!cteditor-text-[13px] [&_svg]:cteditor-size-3.5 !cteditor-py-1`,children:[(0,X.jsx)(`span`,{className:`[&>svg]:!cteditor-size-6`,children:e.icon}),(0,X.jsx)(`span`,{children:e.label}),e.items.some(e=>m(e.newKey))&&(0,X.jsx)(X3t,{className:`cteditor-ml-auto`})]}),(0,X.jsx)(U2t,{container:a,children:(0,X.jsx)(Z5,{className:`cteditor-border-foreground/10`,children:e.items.map((t,n)=>x(t,`${e.label}-${n}`))})})]},e.label))]})]}),i.activeModal]})},e6t=`cteditor-relative cteditor-flex cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1 cteditor-text-[13px] cteditor-outline-none [&>svg]:cteditor-shrink-0`,t6t=`${e6t} cteditor-cursor-pointer cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,n6t=`${e6t} cteditor-opacity-50 cteditor-cursor-not-allowed`,r6t={hero:(0,X.jsx)(S3,{}),feature:(0,X.jsx)(C3,{}),three:(0,X.jsx)(w3,{}),cta:(0,X.jsx)(T3,{})},i6t=()=>{let[e,t]=(0,Q.useState)(null);return{show:e=>{t(e(()=>t(null)))},hide:()=>{t(null)},activeModal:e}},a6t=({enableHorizontalLine:e=!0,enableFileAttachments:t=!0,enableSignature:n=!0,enableImageUpload:r=!0})=>{let[i]=Gd(),a=i6t(),{isNew:o,markUsed:s}=s0(),c=W7,l=K0()?.editorConfig?.toolbarOptions,u=l?.enableEditorialDividers!==!1,d=l?.enableSectionHeading!==!1,f=l?.enablePullQuote!==!1,p=l?.enableColumns!==!1,m=l?.enableButtonBlock!==!1,h=l?.enableFaq!==!1,g=l?.enablePatterns!==!1,_=e=>{let t=null;i.getEditorState().read(()=>{let e=W();e&&(t=e.clone())}),requestAnimationFrame(()=>{i.focus(),i.update(()=>{t&&Zi(t.clone()),e()})})},v=[{name:`Decorative Divider`,featureName:`Editorial Dividers`,icon:(0,X.jsx)(x3,{}),enabled:u,newKey:`styled-divider`,onClick:()=>i.dispatchCommand(o9,void 0)},{name:`Section Heading`,featureName:`Section Heading`,icon:(0,X.jsx)(o3,{}),enabled:d,newKey:`section-heading`,onClick:()=>_(()=>i.dispatchCommand(i9,void 0))},{name:`Pull Quote`,featureName:`Pull Quote`,icon:(0,X.jsx)(n3,{}),enabled:f,newKey:`pull-quote`,onClick:()=>_(()=>i.dispatchCommand(a9,void 0))}],y=[{name:`Columns`,featureName:`Columns`,icon:(0,X.jsx)(D3,{}),enabled:p,newKey:`columns`,onClick:()=>_(()=>i.dispatchCommand(c9,2))},{name:`Button`,featureName:`Button`,icon:(0,X.jsx)(jUt,{size:16}),enabled:m,newKey:`button`,onClick:()=>_(()=>i.dispatchCommand(l9,void 0))},{name:`FAQ`,featureName:`FAQ`,icon:(0,X.jsx)(E3,{}),enabled:h,newKey:`faq`,onClick:()=>_(()=>i.dispatchCommand(u9,void 0))}],b=f9.map(e=>({name:e.name,featureName:`Patterns`,icon:r6t[e.id],enabled:g,newKey:`pattern:${e.id}`,onClick:()=>_(()=>i.dispatchCommand(d9,e.id))})),x=[{label:`EDITORIAL`,items:v},{label:`BLOCKS`,items:y},{label:`PATTERNS`,items:b}],S=(e,t)=>(0,X.jsx)(r6,{isEnabled:e.enabled,planAllows:e.enabled,featureName:e.featureName,variant:`inline`,children:(0,X.jsxs)(`button`,{type:`button`,className:`cteditor-relative cteditor-flex cteditor-w-full cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-text-accent-foreground [&>svg]:cteditor-shrink-0 `+(o(e.newKey)?`hover:!cteditor-bg-yellow-500/10`:`focus:cteditor-bg-foreground/5 hover:cteditor-bg-foreground/5`),onClick:()=>{s(e.newKey),setTimeout(()=>e.onClick(),0)},title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),o(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`})]})},t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:[[{name:`Horizontal Line`,icon:(0,X.jsx)(Z4,{}),enabled:e,onClick:()=>{let e=null;i.getEditorState().read(()=>{let t=W();t&&(e=t.clone())}),a.show(t=>(0,X.jsx)(S8,{activeEditor:i,onClose:t,savedSelection:e}))}},{name:`Image`,icon:(0,X.jsx)(m3,{}),enabled:r,onClick:()=>{a.show(e=>(0,X.jsx)($7,{activeEditor:i,onClose:e}))}},{name:`File`,icon:(0,X.jsx)(c3,{}),enabled:t,onClick:()=>a.show(e=>(0,X.jsx)(e9,{activeEditor:i,onClose:e}))},{name:`Signature`,icon:(0,X.jsx)(Q4,{}),enabled:n,onClick:()=>a.show(e=>(0,X.jsx)(s5,{onClose:e}))}].map((e,t)=>e.enabled?(0,X.jsxs)(`button`,{type:`button`,className:t6t,onClick:()=>setTimeout(()=>e.onClick(),0),title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:n6t,title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.name,side:`right`})]})},t)),x.filter(e=>e.items.length>0).map(e=>(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:[(0,X.jsxs)(`div`,{className:c.categoryHeader,children:[e.label,` `,(0,X.jsx)(`div`,{className:c.categoryHeaderLine})]}),e.items.map((t,n)=>S(t,`${e.label}-${n}`))]},e.label))]}),a.activeModal]})},m9=di(`INSERT_NOTE_PANEL_COMMAND`),o6t=[{type:`info`,label:`Info`,icon:_2,iconColor:`cteditor-text-blue-600 dark:cteditor-text-blue-400`,description:`Information panel`},{type:`warning`,label:`Warning`,icon:t2,iconColor:`cteditor-text-yellow-600 dark:cteditor-text-yellow-400`,description:`Warning panel`},{type:`error`,label:`Error`,icon:e2,iconColor:`cteditor-text-red-600 dark:cteditor-text-red-400`,description:`Error panel`},{type:`success`,label:`Success`,icon:o2,iconColor:`cteditor-text-green-600 dark:cteditor-text-green-400`,description:`Success panel`},{type:`note`,label:`Note`,icon:VUt,iconColor:`cteditor-text-gray-600 dark:cteditor-text-gray-400`,description:`General note panel`}],s6t=({className:e})=>{let[t]=Gd(),n=e=>{t.focus();try{t.dispatchCommand(m9,{type:e})}catch(e){console.error(`Error dispatching note panel command:`,e)}};return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-text-foreground cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-rounded-lg !cteditor-py-1`,e),children:[(0,X.jsx)(nqt,{className:`btnIcon`}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-xs cteditor-text-left`,children:`Insert Note Panel`})]})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Note Panel`})})]})})}),(0,X.jsx)(Q5,{align:`start`,className:`cteditor-w-48`,children:o6t.map(e=>{let t=e.icon;return(0,X.jsxs)($5,{onClick:()=>n(e.type),className:`cteditor-flex cteditor-items-center !cteditor-gap-3 cteditor-cursor-pointer`,children:[(0,X.jsx)(`div`,{className:k$(`cteditor-flex-shrink-0`,e.iconColor),children:(0,X.jsx)(t,{size:16})}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1`,children:[(0,X.jsx)(`div`,{className:`cteditor-text-sm cteditor-font-medium`,children:e.label}),(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground`,children:e.description})]})]},e.type)})})]})},c6t=({open:e,onOpenChange:t,htmlContent:n,apiKey:r})=>(0,X.jsx)(x6,{open:e,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`!cteditor-max-w-[1320px] cteditor-w-full cteditor-flex cteditor-flex-col cteditor-p-0 cteditor-overflow-hidden `,children:[(0,X.jsxs)(C6,{className:`cteditor-flex-shrink-0 cteditor-border-b cteditor-border-dashed !cteditor-border-foreground/30 cteditor-pb-4`,children:[(0,X.jsx)(T6,{children:`Content Preview`}),(0,X.jsx)(E6,{className:`cteditor-text-sm cteditor-text-muted-foreground cteditor-text-[#525252]`,children:`Read-only · Final published output`})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1 cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-min-h-0 cteditor-max-h-[calc(100svh-195px)]`,children:(0,X.jsx)(ljt,{apiKey:r,enabled:e,children:(0,X.jsx)(`div`,{className:`cteditor-w-full cteditor-prose cteditor-max-w-none`,dangerouslySetInnerHTML:{__html:n},style:{wordWrap:`break-word`,overflowWrap:`break-word`}})})})]})}),h9=[{name:`common`,label:`Common`,chars:[`©`,`®`,`™`,`°`,`§`,`¶`,`†`,`‡`,`•`,`…`,`‰`,`‱`,`′`,`″`,`‴`,`¡`,`¿`,`‽`,`⁂`,`※`,`⁀`,`⁁`]},{name:`currency`,label:`Currency`,chars:[`€`,`£`,`¥`,`₹`,`₩`,`¢`,`$`,`₽`,`₺`,`₿`,`₫`,`₴`,`₦`,`₱`,`₲`,`₵`,`₸`,`₼`,`₾`,`฿`,`﷼`,`₡`,`₣`,`₤`]},{name:`math`,label:`Math`,chars:`±.×.÷.≠.≤.≥.≈.∞.√.∑.∏.∫.∂.∆.∇.∈.∉.∅.∩.∪.⊂.⊃.⊆.⊇.∀.∃.∄.∝.∧.∨.¬.⊕`.split(`.`)},{name:`arrows`,label:`Arrows`,chars:[`→`,`←`,`↑`,`↓`,`↔`,`↕`,`⇒`,`⇐`,`⇑`,`⇓`,`⇔`,`⇕`,`↗`,`↘`,`↙`,`↖`,`↪`,`↩`,`⟵`,`⟶`,`⟷`,`➜`,`➤`,`➔`]},{name:`latin`,label:`Latin`,chars:`À.Á.Â.Ã.Ä.Å.Æ.Ç.È.É.Ê.Ë.Ì.Í.Î.Ï.Ñ.Ò.Ó.Ô.Õ.Ö.Ø.Ù.Ú.Û.Ü.Ý.ß.à.á.â.ã.ä.å.æ.ç.è.é.ê.ë.ì.í.î.ï.ñ.ò.ó.ô.õ.ö.ø.ù.ú.û.ü`.split(`.`)},{name:`punctuation`,label:`Punctuation`,chars:[`—`,`–`,`―`,`‐`,`«`,`»`,`‹`,`›`,`“`,`”`,`‘`,`’`,`„`,`‟`,`‛`,`‚`,`⁃`,`‣`,`⁌`,`⁍`,`◦`,`▪`,`▸`,`▹`]},{name:`symbols`,label:`Symbols`,chars:`♠.♣.♥.♦.★.☆.✓.✗.✔.✘.♩.♪.♫.♬.☀.☁.☂.☃.⚡.❄.☎.✉.✂.✏.⚠.⛔.♻.⚙.☮.☯.⚖.⚗`.split(`.`)}],l6t=({size:e=18,className:t})=>(0,X.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:(0,X.jsx)(`path`,{d:`M7 19h4a6 6 0 1 1 2 0h4`})}),u6t=[`→`,`©`,`—`,`•`,`€`,`π`],d6t=`cteditor_recent_symbols`,f6t=({char:e,onHover:t,onPick:n})=>(0,X.jsx)(Q2,{variant:`ghost`,className:`!cteditor-h-9 cteditor-w-full cteditor-px-0 cteditor-rounded-md cteditor-border cteditor-border-transparent hover:cteditor-border-border dark:hover:cteditor-border-white/5 dark:hover:cteditor-bg-white/[0.04] cteditor-group`,onMouseEnter:()=>t(e),onFocus:()=>t(e),onClick:()=>n(e),children:(0,X.jsx)(`span`,{className:`cteditor-text-base cteditor-text-foreground dark:cteditor-text-white/90 cteditor-font-normal cteditor-leading-[normal]`,children:e})}),g9={scrollBtn:`cteditor-absolute cteditor-top-0 cteditor-bottom-0 cteditor-z-10 cteditor-flex cteditor-items-center cteditor-px-2 cteditor-cursor-pointer cteditor-text-muted-foreground dark:cteditor-text-white/60 hover:cteditor-text-foreground dark:hover:cteditor-text-white`,scrollLeft:`cteditor-left-0 cteditor-bg-gradient-to-r cteditor-from-popover dark:cteditor-from-[#0e0e11] cteditor-via-popover/80 dark:cteditor-via-[#0e0e11]/80 cteditor-to-transparent`,scrollRight:`cteditor-right-0 cteditor-bg-gradient-to-l cteditor-from-popover dark:cteditor-from-[#0e0e11] cteditor-via-popover/80 dark:cteditor-via-[#0e0e11]/80 cteditor-to-transparent`,tabBase:`cteditor-relative cteditor-px-3 cteditor-py-3 cteditor-text-xs cteditor-font-medium cteditor-whitespace-nowrap cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-cursor-pointer`,tabActive:`cteditor-text-foreground dark:cteditor-text-white`,tabInactive:`cteditor-text-muted-foreground dark:cteditor-text-white/50 hover:cteditor-text-foreground dark:hover:cteditor-text-white/80`,badgeBase:`cteditor-flex cteditor-items-center cteditor-justify-center cteditor-h-4.5 cteditor-px-1.5 cteditor-rounded-full cteditor-text-[10px] cteditor-font-semibold cteditor-transition-colors`,badgeActive:`cteditor-bg-muted dark:cteditor-bg-white/[0.15] cteditor-text-foreground dark:cteditor-text-white`,badgeInactive:`cteditor-bg-muted/50 dark:cteditor-bg-white/[0.08] cteditor-text-muted-foreground dark:cteditor-text-white/60`},_9={wrapper:`cteditor-mb-4`,header:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-1 cteditor-mb-2`,title:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-text-[10px] cteditor-font-medium cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-uppercase cteditor-tracking-widest`,count:`cteditor-text-[10px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/50`,container:`cteditor-flex cteditor-items-center cteditor-p-1 cteditor-bg-foreground/5 cteditor-border cteditor-border-foreground/20 cteditor-rounded-lg cteditor-px-1 cteditor-gap-1`,button:`cteditor-flex-1 !cteditor-h-8 cteditor-px-0 cteditor-font-normal hover:cteditor-bg-foreground/5 cteditor-border cteditor-border-transparent hover:cteditor-border-foreground/10`},v9={wrapper:`cteditor-p-2`,container:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-border cteditor-border-border dark:cteditor-border-white/5 cteditor-h-8 cteditor-rounded-md cteditor-bg-foreground/5`,icon:`cteditor-text-muted-foreground dark:cteditor-text-white/40 cteditor-shrink-0`,input:`cteditor-flex-1 cteditor-bg-transparent cteditor-border-none cteditor-outline-none cteditor-text-xs cteditor-text-foreground dark:cteditor-text-white placeholder:cteditor-text-muted-foreground dark:placeholder:cteditor-text-white/40`,clearBtn:`cteditor-text-muted-foreground dark:cteditor-text-white/40 hover:cteditor-text-foreground dark:hover:cteditor-text-white cteditor-shrink-0`,shortcut:`cteditor-text-[10px] cteditor-px-1.5 cteditor-py-0.5 cteditor-rounded-[4px] cteditor-bg-muted dark:cteditor-bg-white/10 cteditor-border cteditor-border-border/50 dark:cteditor-border-white/5 cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-font-mono cteditor-shrink-0`},y9={header:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-1 cteditor-mb-2`,title:`cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-uppercase cteditor-tracking-widest`,count:`cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground/70 dark:cteditor-text-white/50`,emptyWrapper:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-8 cteditor-text-center`,emptyIcon:`cteditor-text-2xl cteditor-text-muted-foreground/50 dark:cteditor-text-white/20 cteditor-mb-2`,emptyTitle:`cteditor-text-[13px] cteditor-font-medium cteditor-text-foreground dark:cteditor-text-white cteditor-mb-1`,emptyText:`cteditor-text-[11px] cteditor-text-muted-foreground dark:cteditor-text-white/60 cteditor-max-w-[200px]`,emptyCode:`cteditor-font-mono cteditor-bg-muted dark:cteditor-bg-white/10 cteditor-px-1 cteditor-rounded`,grid:`cteditor-grid cteditor-grid-cols-8 cteditor-gap-0`},b9={wrapper:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-3 cteditor-py-2.5 cteditor-bg-muted/30 dark:cteditor-bg-[#141417] cteditor-border-t cteditor-border-border dark:cteditor-border-white/5`,contentBlock:`cteditor-flex cteditor-items-center cteditor-gap-3`,charBtn:`cteditor-rounded-lg dark:cteditor-bg-white/[0.05] dark:cteditor-border-white/10 cteditor-text-[15px] cteditor-shrink-0 cteditor-pointer-events-none`,textCol:`cteditor-flex cteditor-flex-col cteditor-justify-center`,titleActive:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground dark:cteditor-text-white/90 cteditor-leading-tight`,metaRowActive:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-text-[10px] cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-mt-0.5 cteditor-font-mono`,dotActive:`cteditor-w-[3px] cteditor-h-[3px] cteditor-rounded-full cteditor-bg-border dark:cteditor-bg-white/20`,titleInactive:`cteditor-text-xs cteditor-font-medium cteditor-text-muted-foreground dark:cteditor-text-white/70 cteditor-leading-tight`,metaRowInactive:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-text-[9px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-mt-0.5`,shortcutWrap:`cteditor-flex cteditor-items-center cteditor-gap-0.5`,kbd:`cteditor-font-sans cteditor-font-semibold cteditor-text-[9px] cteditor-leading-none`},x9=(0,Q.forwardRef)(({title:e,icon:t,onChange:n,className:r,...i},a)=>{let[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(`common`),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(u6t),v=(0,Q.useRef)(null),[y,b]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(d6t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&_(t)}}catch{}},[]);let[x,S]=(0,Q.useState)(!1),C=(0,Q.useCallback)(()=>{let e=v.current;e&&(b(e.scrollLeft>2),S(e.scrollLeft<e.scrollWidth-e.clientWidth-2))},[]);(0,Q.useEffect)(()=>{if(!o)return;let e=setTimeout(C,50);return()=>clearTimeout(e)},[o,C]);let w=(0,Q.useCallback)(e=>{let t=v.current;t&&t.scrollBy({left:e===`left`?-100:100,behavior:`smooth`})},[]),T=(0,Q.useCallback)(e=>{n&&n(e),h(e),s(!1),_(t=>{let n=[e,...t.filter(t=>t!==e)].slice(0,6);try{localStorage.setItem(d6t,JSON.stringify(n))}catch{}return n})},[n]),E=(0,Q.useMemo)(()=>{let e=u.trim().toLowerCase();return e?Array.from(new Set(h9.flatMap(e=>e.chars))).filter(t=>{let n=t.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`);return t===e||n.includes(e.toUpperCase())}).slice(0,60):h9.find(e=>e.name===c)?.chars||h9[0].chars},[c,u]),D=f||m,O=h9.find(e=>e.name===c)||h9[0];return(0,X.jsxs)(m8,{open:o,onOpenChange:s,modal:!1,children:[(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-rounded-sm hover:cteditor-bg-accent cteditor-flex cteditor-items-center cteditor-gap-2`,r),title:e,ref:a,...i,children:[(0,X.jsx)(`div`,{children:t}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-[13px] cteditor-text-left`,children:`Special Characters`})]})}),(0,X.jsxs)(g8,{className:`cteditor-w-[360px] !cteditor-p-0 !cteditor-z-[99999] cteditor-overflow-hidden cteditor-rounded-xl cteditor-bg-popover dark:cteditor-bg-[#131316] dark:cteditor-border-white/10 cteditor-shadow-xl cteditor-flex cteditor-flex-col`,sideOffset:5,children:[(0,X.jsx)(`div`,{className:v9.wrapper,children:(0,X.jsxs)(`div`,{className:v9.container,children:[(0,X.jsx)(C2,{size:15,className:v9.icon}),(0,X.jsx)(`input`,{autoFocus:!0,value:u,onChange:e=>d(e.target.value),placeholder:`Search 1,200+ symbols by name or codepoint...`,className:v9.input,spellCheck:!1}),u?(0,X.jsx)(`button`,{onClick:()=>d(``),className:v9.clearBtn,children:(0,X.jsx)(k2,{size:14})}):(0,X.jsx)(`kbd`,{className:v9.shortcut,children:`/`})]})}),!u&&(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-border-y cteditor-border-border dark:cteditor-border-white/10`,children:[y&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>w(`left`),className:k$(g9.scrollBtn,g9.scrollLeft),"aria-label":`Scroll left`,children:(0,X.jsx)(aUt,{size:12,strokeWidth:2.5})}),(0,X.jsx)(`div`,{ref:v,onScroll:C,className:`cteditor-flex cteditor-overflow-x-auto no-scrollbar cteditor-px-1`,children:h9.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(e.name),className:k$(g9.tabBase,c===e.name?g9.tabActive:g9.tabInactive),children:[e.label,(0,X.jsx)(`span`,{className:k$(g9.badgeBase,c===e.name?g9.badgeActive:g9.badgeInactive),children:e.chars.length}),c===e.name&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-bottom-0 cteditor-left-2 cteditor-right-2 cteditor-h-0.5 cteditor-bg-foreground dark:cteditor-bg-white cteditor-shadow-[0_-1px_6px_rgba(255,255,255,0.4)] cteditor-rounded-t-full`})]},e.name))}),x&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>w(`right`),className:k$(g9.scrollBtn,g9.scrollRight),"aria-label":`Scroll right`,children:(0,X.jsx)(l2,{size:12,strokeWidth:2.5})})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-overflow-y-auto cteditor-max-h-[300px] cteditor-p-3`,onMouseLeave:()=>p(null),children:[!u&&(0,X.jsxs)(`div`,{className:_9.wrapper,children:[(0,X.jsxs)(`div`,{className:_9.header,children:[(0,X.jsxs)(`div`,{className:_9.title,children:[(0,X.jsx)(u2,{size:11}),` Recently used`]}),(0,X.jsx)(`span`,{className:_9.count,children:g.length})]}),(0,X.jsx)(`div`,{className:_9.container,children:g.map((e,t)=>(0,X.jsx)(Q2,{variant:`ghost`,className:_9.button,onMouseEnter:()=>p(e),onClick:()=>T(e),children:e},`recent-${t}`))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:y9.header,children:[(0,X.jsx)(`span`,{className:y9.title,children:u?`Results · "${u}"`:O.label}),(0,X.jsx)(`span`,{className:y9.count,children:E.length})]}),E.length===0?(0,X.jsxs)(`div`,{className:y9.emptyWrapper,children:[(0,X.jsx)(`div`,{className:y9.emptyIcon,children:`⌕`}),(0,X.jsx)(`div`,{className:y9.emptyTitle,children:`No matches`}),(0,X.jsxs)(`div`,{className:y9.emptyText,children:[`Try a different char or paste a Hex code like `,(0,X.jsx)(`code`,{className:y9.emptyCode,children:`2192`}),`.`]})]}):(0,X.jsx)(`div`,{className:y9.grid,children:E.map((e,t)=>(0,X.jsx)(f6t,{char:e,onHover:p,onPick:T},`list-${t}`))})]})]}),(0,X.jsx)(`div`,{className:b9.wrapper,children:D?(0,X.jsxs)(`div`,{className:b9.contentBlock,children:[(0,X.jsx)(Q2,{variant:`outline`,size:`icon-sm`,className:b9.charBtn,children:D}),(0,X.jsxs)(`div`,{className:b9.textCol,children:[(0,X.jsx)(`div`,{className:b9.titleActive,children:`Character`}),(0,X.jsxs)(`div`,{className:b9.metaRowActive,children:[(0,X.jsxs)(`span`,{children:[`U+`,D.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)]}),(0,X.jsx)(`span`,{className:b9.dotActive}),(0,X.jsxs)(`span`,{children:[`&#`,D.charCodeAt(0),`;`]})]})]})]}):(0,X.jsxs)(`div`,{className:b9.contentBlock,children:[(0,X.jsx)(Q2,{variant:`outline`,size:`icon-sm`,children:(0,X.jsx)(l6t,{className:`!cteditor-w-4`})}),(0,X.jsxs)(`div`,{className:b9.textCol,children:[(0,X.jsx)(`div`,{className:b9.titleInactive,children:`Hover a symbol for details`}),(0,X.jsxs)(`div`,{className:b9.metaRowInactive,children:[(0,X.jsx)(`span`,{children:`Click to insert at cursor`}),(0,X.jsx)(`span`,{className:`cteditor-opacity-50`,children:`·`}),(0,X.jsxs)(`span`,{className:b9.shortcutWrap,children:[(0,X.jsx)(`kbd`,{className:b9.kbd,children:`⌥`}),` to copy`]})]})]})]})})]})]})}),x9.displayName=`SpecialCharactersWidget`,p6t=Symbol.for(`react.lazy`),S9=Z.use,m6t=Symbol(`radix.slottable`),h6t=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jzt(`Primitive.${t}`),r=Z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,X.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),g6t=`Separator`,_6t=`horizontal`,v6t=[`horizontal`,`vertical`],y6t=Z.forwardRef((e,t)=>{let{decorative:n,orientation:r=_6t,...i}=e,a=Izt(r)?r:_6t,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,X.jsx)(h6t.div,{"data-orientation":a,...o,...i,ref:t})}),y6t.displayName=g6t,b6t=y6t,C9=Z.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,size:r=`default`,...i},a)=>(0,X.jsx)(b6t,{ref:a,decorative:n,orientation:t,className:k$(`cteditor-shrink-0 cteditor-bg-foreground/10`,t===`horizontal`?`cteditor-h-[1px] cteditor-w-full`:k$(`cteditor-w-[1px]`,r===`md`?`cteditor-h-6`:`cteditor-h-full`),e),...i})),C9.displayName=b6t.displayName,x6t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(eOt(),IDt)).then(e=>({default:e.HexColorPicker}))),S6t=[`#FFFFFF`,`#4A90E2`,`#7ED3F7`,`#50E3C2`,`#F5A623`,`#F08A8A`,`#BD10E0`,`#4A4A4A`,`#357ABD`,`#50B5FF`,`#00D084`,`#D0021B`,`#E25822`,`#9013FE`,`#000000`,`#1F4E79`,`#2E5984`,`#7ED321`,`#8B572A`,`#7F0000`,`#50327C`],C6t=[{color:`#ffeb3b`,label:`Yellow`},{color:`#a5d6a7`,label:`Green`},{color:`#90caf9`,label:`Blue`},{color:`#f48fb1`,label:`Pink`},{color:`#ce93d8`,label:`Purple`},{color:`#ffcc80`,label:`Orange`},{color:`#b2dfdb`,label:`Teal`},{color:`#ff8a80`,label:`Red`},{color:`#fff59d`,label:`Light Yellow`},{color:`#aed581`,label:`Light Green`},{color:`#81d4fa`,label:`Light Blue`},{color:`#f8bbd0`,label:`Light Pink`},{color:`#d1c4e9`,label:`Light Purple`},{color:`#ffab40`,label:`Deep Orange`},{color:`#8d6e63`,label:`Brown`},{color:`#90a4ae`,label:`Gray`},{color:`#e0e0e0`,label:`Light Gray`},{color:`#f5f5f5`,label:`White Smoke`},{color:`#eeeeee`,label:`Gainsboro`},{color:`#bdbdbd`,label:`Silver`}].map(e=>e.color),w6t=`ct-editor-recent-colors`,w9=({onTextColorChange:e,onBackgroundColorChange:t,currentTextColor:n=`#000`,currentBgColor:r,isHighlightActive:i=!1,onOpenChange:a,isActive:o=!1,showTextColorTab:s=!0,showBackgroundColorTab:c=!0,className:l})=>{let[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(s?`text`:`background`),[m,h]=(0,Q.useState)(`#000000`),[g,_]=(0,Q.useState)(`#ffeb3b`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)([]),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(w6t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(typeof t[0]==`string`?x(t.map(e=>({color:e,type:`background`}))):x(t))}}catch{}},[]),(0,Q.useEffect)(()=>{u||(y(!1),S.current=!1,C.current=0)},[u]),(0,Q.useEffect)(()=>{let e=()=>{S.current=!1};return document.addEventListener(`pointerup`,e),document.addEventListener(`pointercancel`,e),()=>{document.removeEventListener(`pointerup`,e),document.removeEventListener(`pointercancel`,e)}},[]);let w=(0,Q.useCallback)((e,t)=>{e!==`transparent`&&x(n=>{let r=n.filter(n=>!(n.color.toLowerCase()===e.toLowerCase()&&n.type===t)),i=[{color:e,type:t},...r].slice(0,7);try{localStorage.setItem(w6t,JSON.stringify(i))}catch{}return i})},[]),T=e=>/^#[0-9A-Fa-f]{6}$/.test(e),E=t=>{h(t),w(t,`text`),e(t)},D=e=>{e&&(_(e),w(e,`background`)),t(e)},O=n=>{f===`text`?(h(n),e(n)):(_(n),t(n))},k=e=>{let t=(`#`+e.target.value.replace(/^#/,``)).toUpperCase();/^#[0-9A-Fa-f]{0,6}$/.test(t)&&(t.length===7&&T(t)?f===`text`?E(t):D(t):f===`text`?h(t):_(t))},A=()=>{T(f===`text`?m:g)||(f===`text`?h(`#000000`):_(`#ffeb3b`))},j=f===`text`?m:g,M=s&&c;return(0,X.jsxs)(m8,{open:u,onOpenChange:e=>{!e&&S.current||!e&&Date.now()-C.current<150||(e&&(C.current=Date.now()),d(e),a?.(e))},modal:!1,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-relative`,o&&`cteditor-bg-foreground/10`,l),onMouseDown:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-[11px] cteditor-leading-none cteditor-font-semibold`,children:`A`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-[1px]`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:n||`#000`}}),(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:r&&r!==`#fff`&&r!==`transparent`?r:`#ffeb3b`}})]})]}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-xs cteditor-text-left`,children:`Colors`})]})})}),(0,X.jsx)($3,{children:`Colors`})]})}),(0,X.jsx)(g8,{className:`cteditor-w-auto cteditor-p-0 cteditor-border-none cteditor-shadow-lg cteditor-bg-transparent !cteditor-z-[99999]`,sideOffset:5,id:`unified-color-picker`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.react-colorful-wrapper`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`#unified-color-picker`))&&e.preventDefault()},children:(0,X.jsxs)(`div`,{className:`cteditor-bg-dropdown cteditor-rounded-xl cteditor-p-3 cteditor-shadow-2xl cteditor-border cteditor-border-foreground/10`,style:{width:`280px`},onMouseDown:e=>e.preventDefault(),children:[M&&(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-p-1 cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-mb-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:k$(`cteditor-flex-1 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-all`,f===`text`?`cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium cteditor-shadow-sm`:`cteditor-text-foreground/40 hover:cteditor-text-foreground/60`),onClick:()=>p(`text`),onMouseDown:e=>e.preventDefault(),children:[`Text`,(0,X.jsx)(`span`,{className:k$(`cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-text-[10px] cteditor-border cteditor-transition-colors`,f===`text`?`cteditor-bg-foreground/15 cteditor-border-foreground/20 cteditor-text-foreground`:`cteditor-bg-transparent cteditor-border-foreground/10 cteditor-text-foreground/30`),children:`A`})]}),(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-flex-1 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-all`,f===`background`?`cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium cteditor-shadow-sm`:`cteditor-text-foreground/40 hover:cteditor-text-foreground/60`),onClick:()=>p(`background`),onMouseDown:e=>e.preventDefault(),children:`Background`})]}),b.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground/50 cteditor-mb-2.5`,children:`Recently picked`}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-2.5`,children:b.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-w-5 cteditor-h-5 cteditor-rounded-full cteditor-border-2 cteditor-transition-all hover:cteditor-scale-110`,e.color.toLowerCase()===`#ffffff`?`cteditor-border-foreground/10`:`cteditor-border-transparent`),style:{backgroundColor:e.color},onClick:()=>{e.type===`text`?E(e.color):D(e.color)},onMouseDown:e=>e.preventDefault(),title:e.type===`text`?`Text: ${e.color}`:`Background: ${e.color}`},`${e.color}-${e.type}-${t}`))})]}),(0,X.jsxs)(`div`,{className:`cteditor-mb-1`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground/50 cteditor-mb-2.5`,children:`Colours`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-mb-2.5`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-border cteditor-border-foreground/10 cteditor-shadow-sm`,style:{backgroundColor:T(j)?j:`#000000`}}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-bg-foreground/[0.03] cteditor-border cteditor-border-foreground/10 cteditor-rounded-md cteditor-px-3 cteditor-flex-1`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-foreground/30 cteditor-text-sm cteditor-font-medium`,children:`#`}),(0,X.jsx)(`input`,{type:`text`,value:j.replace(`#`,``),onChange:k,onBlur:A,onMouseDown:e=>e.stopPropagation(),className:`cteditor-bg-transparent cteditor-text-foreground cteditor-text-sm cteditor-py-1 cteditor-h-7 cteditor-w-full cteditor-text-center focus:cteditor-outline-none cteditor-font-mono cteditor-tracking-wider`,maxLength:6,placeholder:`FFFFFF`})]})]}),(0,X.jsx)(`div`,{className:`cteditor-p-2.5 cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-bg-foreground/[0.01]`,children:(0,X.jsxs)(`div`,{className:`cteditor-grid cteditor-grid-cols-7 cteditor-gap-2`,children:[(f===`text`?S6t:C6t).map(e=>(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-aspect-square cteditor-rounded cteditor-border hover:cteditor-scale-110 cteditor-transition-all`,j.toUpperCase()===e.toUpperCase()?`cteditor-border-primary cteditor-z-10`:`cteditor-border-foreground/5`),style:{backgroundColor:e},onClick:()=>{f===`text`?E(e):D(e)},onMouseDown:e=>e.preventDefault(),title:e},e)),f===`background`&&(0,X.jsx)(`button`,{type:`button`,className:`cteditor-aspect-square cteditor-rounded cteditor-border cteditor-border-foreground/5 hover:cteditor-scale-110 cteditor-transition-all cteditor-flex cteditor-items-center cteditor-justify-center cteditor-bg-background`,onClick:()=>D(null),onMouseDown:e=>e.preventDefault(),title:`Remove color`,children:(0,X.jsx)(k2,{className:`cteditor-size-3 cteditor-text-foreground/40`})})]})})]}),(0,X.jsx)(`div`,{className:`cteditor-mt-4`,children:(0,X.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>y(!v),className:`cteditor-text-[11px] cteditor-font-medium cteditor-text-foreground/40 hover:cteditor-text-foreground/60 cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-1.5`,children:[(0,X.jsx)(`span`,{children:v?`▼`:`▶`}),`Custom Picker`]})}),v&&(0,X.jsx)(`div`,{className:`cteditor-mt-3 cteditor-select-none [&>div]:cteditor-w-full [&>div>div]:cteditor-w-full`,onPointerDown:e=>{e.target.closest(`.react-colorful`)&&(S.current=!0)},onPointerUp:()=>{S.current=!1},onPointerLeave:()=>{S.current=!1},onPointerCancel:()=>{S.current=!1},style:{touchAction:`none`,userSelect:`none`,WebkitUserSelect:`none`},children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(`div`,{style:{width:`100%`,height:150},"aria-hidden":`true`}),children:(0,X.jsx)(x6t,{color:T(j)?j:`#000000`,onChange:O})})})]})})]})},T6t={blockFormat:{label:`Block Format`,keywords:[`paragraph`,`heading`,`h1`,`h2`,`h3`,`quote`,`blockquote`,`code`,`block`,`bullet`,`list`,`ordered`,`unordered`,`numbered`]},preview:{label:`Preview`,keywords:[`preview`,`view`,`render`,`eye`]},fontFamily:{label:`Font Family`,keywords:[`font`,`family`,`typeface`,`arial`,`times`]},fontSize:{label:`Font Size`,keywords:[`size`,`text size`,`bigger`,`smaller`]},alignMenu:{label:`Alignment`,keywords:[`align`,`left`,`center`,`right`,`justify`,`line height`,`line spacing`,`spacing`,`leading`]},inlineFormats:{label:`Strikethrough`,keywords:[`strikethrough`,`strike`,`strikeout`,`cross out`]},codeBlock:{label:`Code Block`,keywords:[`code`,`programming`,`syntax`]},formatTextMenu:{label:`Format Menu`,keywords:[`format`,`style`,`text`]},imageInsert:{label:`Insert Image`,keywords:[`image`,`picture`,`photo`,`insert`]},tableOptions:{label:`Table`,keywords:[`table`,`grid`,`rows`,`columns`]},chartInsert:{label:`Insert Chart`,keywords:[`chart`,`graph`,`visualization`,`data`]},equationInsert:{label:`Insert Equation`,keywords:[`equation`,`formula`,`math`,`latex`,`katex`]},link:{label:`Link`,keywords:[`link`,`url`,`hyperlink`,`anchor`]},colorPickers:{label:`Colors`,keywords:[`color`,`font color`,`background`,`highlight`,`marker`,`emphasis`]},emoji:{label:`Emoji`,keywords:[`emoji`,`emoticon`,`smiley`,`face`]},specialCharacters:{label:`Special Characters`,keywords:[`special`,`character`,`symbol`,`currency`,`math`,`arrow`,`latin`]},todo:{label:`Todo List`,keywords:[`todo`,`checklist`,`task`,`checkbox`]},signature:{label:`Signature`,keywords:[`signature`,`sign`,`draw`,`handwriting`]},notePanels:{label:`Note Panels`,keywords:[`note`,`panel`,`callout`,`info`,`warning`]},insertMenu:{label:`Insert Menu`,keywords:`insert.add.embed.horizontal.rule.divider.line.hr.file.attachment.attach.upload.signature.sign.columns.column.button.cta.faq.question.pattern.patterns.hero.feature.three-up.section.heading.pull.quote`.split(`.`)},editHorizontalRule:{label:`Edit Line`,keywords:[`edit`,`line`,`horizontal`,`rule`,`divider`,`thickness`,`color`,`style`]},autocomplete:{label:`Autocorrection`,keywords:[`autocomplete`,`autocorrect`,`spelling`,`grammar`]},inlineAutocomplete:{label:`Inline Autocomplete`,keywords:[`inline`,`autocomplete`,`ai`,`suggestion`,`ghost`,`complete`]},htmlView:{label:`HTML View`,keywords:[`html`,`code`,`source`,`view`]},htmlCanvas:{label:`HTML Canvas`,keywords:[`html`,`canvas`,`embed`,`iframe`,`web`,`website`]},aiOptions:{label:`AI Options`,keywords:[`ai`,`artificial intelligence`,`magic`,`generate`,`grammar`,`translate`,`simplify`]},actionBold:{label:`Bold`,keywords:[`bold`,`strong`,`ctrl+b`]},actionItalic:{label:`Italic`,keywords:[`italic`,`emphasis`,`ctrl+i`]},actionUnderline:{label:`Underline`,keywords:[`underline`,`ctrl+u`]},actionStrikethrough:{label:`Strikethrough`,keywords:[`strikethrough`,`strike`,`line through`]},actionSubscript:{label:`Subscript`,keywords:[`subscript`,`sub`]},actionSuperscript:{label:`Superscript`,keywords:[`superscript`,`sup`,`power`]},actionQuote:{label:`Block Quote`,keywords:[`quote`,`blockquote`,`quotation`]},actionBulletList:{label:`Bullet List`,keywords:[`bullet`,`list`,`unordered`,`ul`]},actionHorizontalRule:{label:`Horizontal Line`,keywords:[`horizontal`,`rule`,`divider`,`line`,`hr`,`separator`]},suggestFeature:{label:`Suggest a Feature`,keywords:[`suggest`,`feature`,`feedback`,`request`,`idea`]},reportBug:{label:`Report a Bug`,keywords:[`bug`,`report`,`issue`,`error`,`problem`,`fix`]}},E6t=[`actionBold`,`actionItalic`,`actionUnderline`,`actionStrikethrough`,`actionSubscript`,`actionSuperscript`,`actionQuote`,`actionBulletList`,`actionNumberedList`,`actionHorizontalRule`],D6t=({editable:e,enableUndoRedo:t=!0,enableTextFormatting:n=!0,enableAlignment:r=!0,enableFontControls:i=!0,enableTableOptions:a=!0,enableImageOptions:o=!0,enableInsertMenu:s=!0,enableColors:c=!0,enableClearOptions:l=!0,enableEmojiPicker:u=!0,enableSpecialCharacters:d=!0,enableDatePicker:f=!0,enableLinks:p=!0,enableFormatTextMenu:m=!0,enableCodeFormat:h=!0,enableAIChat:g=!0,enableTodoList:_=!0,enableHtmlViewToggle:v=!0,enableHtmlView:y=!0,enableNotePanels:b=!0,enableAutocompleteToggle:x=!0,enableInlineAutocompleteToggle:S=!0,enableHeadings:C=!0,enableLists:w=!0,enableBlockquote:T=!0,enableImageUpload:E=!0,enableWordCount:D=!0,enableCharts:O=!0,enableEquations:k=!0,enableAutoCorrection:A=!0,enablePdfExport:j=!0,enableDocExport:M=!0,enableSpeechToText:N=!0,enableComments:P=!0,enableMentions:F=!0,enableHorizontalLine:I=!0,enableFileAttachments:ee=!0,enableSignature:L=!0,enableEmbeds:te=!0,enableFormatPainter:R=!0,enableFeatureSuggestion:ne=!0,enableBugReport:re=!0,enablePreview:ie=!0,enableHtmlCanvas:ae=!0,fonts:z,editor:oe,activeEditor:se,setActiveEditor:B,fitToPage:ce=!1,isCommentOpen:le=!1,onToggleComment:ue,commentCount:de=0})=>{let[fe,pe]=(0,Q.useState)({undo:!0,redo:!0}),[me,he]=(0,Q.useState)(!1),[ge,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(!1),[Se,Ce]=(0,Q.useState)(!1),{isNew:we}=s0(),[Te,Ee]=(0,Q.useState)(!1),[De,Oe]=(0,Q.useState)(!1),[ke,Ae]=(0,Q.useState)(0),je=(0,Q.useRef)(null),Me=(0,Q.useRef)(null),[Ne,Pe]=(0,Q.useState)(new Set),[Fe,Ie]=(0,Q.useState)(!1),[Le,Re]=(0,Q.useState)(!1),[ze,Be]=(0,Q.useState)(!1),[Ve,He]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(!1),[Ge,Ke]=(0,Q.useState)(!1),[qe,Je]=(0,Q.useState)(!1),[Ye,Xe]=(0,Q.useState)(!1),[Ze,V]=(0,Q.useState)(!1),[Qe,H]=(0,Q.useState)(``),[$e,et]=(0,Q.useState)(``),tt=(0,Q.useRef)(null),nt=W7,{hasFormat:rt,isEditorEmpty:it,blockType:at,clearFormatting:ot}=k$t(),{clearEditorContent:st}=O$t(),{toolbarState:ct,updateToolbarState:lt}=$8(),ut=e=>{if(!$e.trim())return!0;let t=T6t[e];if(!t)return!1;let n=$e.toLowerCase(),r=e=>{let t=e.toLowerCase();return t.startsWith(n)||t.split(/\s+/).some(e=>e.startsWith(n))};return r(t.label)||t.keywords.some(e=>r(e))},dt=Array.from(Ne).some(e=>ut(e))||!!$e.trim()&&E6t.some(e=>ut(e)),{isHtmlView:ft,setIsHtmlView:pt,htmlContent:mt,setHtmlContent:ht}=F0(),{apiKey:gt,editorConfig:_t,planConfig:vt,isByokPlan:yt,byokApiKeys:bt}=G0(),xt=vt?.toolbarOptions,St=bt&&(bt.hasOpenaiKey||bt.hasAnthropicKey||bt.hasGrokKey||bt.hasGeminiKey),Ct=g===!0&&(xt?.enableAIChat??!0)&&(!yt||!!St),wt=yt&&!St,Tt=S===!0&&(xt?.enableInlineAutocompleteToggle??!0)&&(!yt||!!St),Et=yt&&!St,Dt=N&&(xt?.enableSpeechToText??!0)&&(!yt||!!bt?.hasAssemblyaiKey),Ot=yt&&!bt?.hasAssemblyaiKey,{shouldAutoShowFeedback:kt,markFeedbackSubmitted:At,markFeedbackDismissed:jt,totalLoads:Mt}=FLt(gt);(0,Q.useEffect)(()=>{kt&&!qe&&Je(!0)},[kt]);let Nt=e=>{Je(e),!e&&kt&&jt(Mt)};(0,Q.useEffect)(()=>{let e=()=>{if(!je.current||!Me.current)return;let e=Me.current.getBoundingClientRect(),t=Me.current.querySelectorAll(`[data-toolbar-item]`),n=new Set;t.forEach(t=>{if(t.getBoundingClientRect().right>e.right){let e=t.getAttribute(`data-toolbar-item`);e&&n.add(e)}}),Pe(n),xe(n.size>0)},t=()=>{je.current&&Me.current&&requestAnimationFrame(e)};t(),window.addEventListener(`resize`,t);let n=new ResizeObserver(t);return je.current&&n.observe(je.current),()=>{window.removeEventListener(`resize`,t),n.disconnect()}},[t,n,i,a,o,c,p,u,d,f,s,_,b,r,l,g,x,S,v,y]);let Pt=()=>{O6.warning(`Clear editor content?`,{description:`This will remove all content.`,action:{label:`OK`,onClick:()=>{st(),O6.success(`Editor cleared`)}},duration:8e3})},{onFontColorSelect:Ft,onHighlightColorSelect:It}=O1t(),[Lt,Rt]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>oe.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();Rt(U(e)&&!!id(e.anchor.getNode(),e=>e.getType()===`link`))})}),[oe]),(0,Q.useEffect)(()=>Gu(oe.registerCommand(Hc,e=>(pe(t=>({...t,undo:!e})),!1),S$t),oe.registerCommand(Vc,e=>(pe(t=>({...t,redo:!e})),!1),S$t)),[oe]);let zt=(0,Q.useCallback)(()=>{let e=W();lt(`isNodeSelection`,ts(e));let t=null;if(ts(e)){let n=e.getNodes()[0];g1(n)&&(t=n.getKey())}else if(U(e)){let n=e.anchor.getNode();if(g1(n))t=n.getKey();else{let e=n.getTopLevelElement();g1(e)&&(t=e.getKey())}}if(ye(t),U(e)){se!==oe&&Dee(se)?lt(`isImageCaption`,!!se.getRootElement()?.parentElement?.classList.contains(`image-caption-container`)):lt(`isImageCaption`,!1);let t=e.anchor.getNode(),n=t.getKey()===`root`?t:id(t,e=>{let t=e.getParent();return t!==null&&ja(t)});n===null&&(n=t.getTopLevelElementOrThrow());let r=n.getKey(),i=se.getElementByKey(r);lt(`isRTL`,hee(e));let a=e5(e),o=a.getParent();if(lt(`isLink`,Fp(o)||Fp(a)),Sp(id(a,Sp))?lt(`rootType`,`table`):lt(`rootType`,`root`),i!==null)if(_e(r),Fd(n)){let e=Yu(t,Rd);lt(`blockType`,e?e.getListType():n.getListType())}else{let e=Af(n)?n.getTag():n.getType();if(e in b$t&<(`blockType`,e),cd(n)){let e=n.getLanguage();lt(`codeLanguage`,e?Sd[e]||e:``);return}}lt(`fontColor`,Hu(e,`color`,`#000`)),lt(`bgColor`,Hu(e,`background-color`,`#fff`)),lt(`fontFamily`,Hu(e,`font-family`,`DM Sans`));let s;Fp(o)&&(s=id(a,e=>Ws(e)&&!e.isInline())),lt(`elementFormat`,Ws(s)?s.getFormatType():Ws(a)?a.getFormatType():o?.getFormatType()||`left`)}(U(e)||ep(e))&&(lt(`isBold`,e.hasFormat(`bold`)),lt(`isItalic`,e.hasFormat(`italic`)),lt(`isUnderline`,e.hasFormat(`underline`)),lt(`isStrikethrough`,e.hasFormat(`strikethrough`)),lt(`isSubscript`,e.hasFormat(`subscript`)),lt(`isSuperscript`,e.hasFormat(`superscript`)),lt(`isCode`,e.hasFormat(`code`)),lt(`isHighlight`,e.hasFormat(`highlight`)),lt(`fontSize`,Hu(e,`font-size`,`15px`)))},[se,oe,lt]);(0,Q.useEffect)(()=>oe.registerCommand(nc,(e,t)=>(B(t),zt(),!1),4),[oe,zt,B]),(0,Q.useEffect)(()=>{se.getEditorState().read(()=>{zt()})},[se,zt]);let Bt=e=>{se.update(()=>{xs([qo(e.emoji)])})},Vt=(0,Q.useCallback)(e=>{se.update(()=>{xs([qo(e)])})},[se]),Ht=(0,Q.useCallback)(()=>{oe.update(()=>{let e=W();if(U(e)){let t=!1;e.getNodes().forEach(e=>{let n=e.getParent();n&&n.getType()===`link`&&(t=!0)}),t?(he(!1),oe.dispatchCommand(Rp,null)):e.isCollapsed()?O6.error(`Please select some text first to create a link`):(oe.dispatchCommand(Rp,d0(`https://`)),he(!0))}})},[oe]),Ut=(0,Q.useCallback)(()=>{ve&&se.dispatchCommand(p6,{editingNodeKey:ve})},[se,ve]),Wt=(0,Q.useCallback)(()=>{oe.getEditorState().read(()=>{let e=W();if(U(e)){let t=e.getTextContent();oe.dispatchCommand(a5,t||void 0)}else oe.dispatchCommand(a5,void 0)})},[oe]),Gt=(0,Q.useCallback)(()=>{oe.dispatchCommand(Hd,void 0)},[oe]),Kt=(0,Q.useCallback)(()=>{pt(e=>{let t=!e;return t&&oe.update(()=>{ht(Dd(oe,null))}),t})},[oe,pt,ht]),qt=(0,Q.useCallback)(()=>{H(l0(se)),V(!0)},[se]),Jt=(0,Q.useCallback)(()=>{lt(`isAutocompleteEnabled`,!ct.isAutocompleteEnabled)},[lt,ct.isAutocompleteEnabled]),Yt=(0,Q.useCallback)(()=>{lt(`isInlineAutocompleteEnabled`,!ct.isInlineAutocompleteEnabled)},[lt,ct.isInlineAutocompleteEnabled]),Xt=(0,Q.useCallback)(()=>{oe.update(()=>{let e=W();if(U(e)){if(e.isCollapsed())Vu(e,()=>sd());else{let t=e.getTextContent(),n=sd();e.insertNodes([n]),e=W(),U(e)&&e.insertRawText(t)}let t=W();if(U(t)){let e=id(t.anchor.getNode(),cd);if(e){let t=Qs();e.insertAfter(t)}}}})},[oe]),Zt=(0,Q.useCallback)(()=>{Ie(!0)},[]),Qt=(0,Q.useCallback)(()=>{Ie(!1)},[]),$t=(0,Q.useCallback)(()=>{Re(!0)},[]);(0,Q.useCallback)(()=>{Re(!1)},[]);let en=(0,Q.useCallback)(e=>{oe.update(()=>{let t=F1(``,e);if(W()?xs([t]):Yi().append(t),!e){let e=Qs();t.insertAfter(e)}})},[oe]),tn=(0,Q.useCallback)(()=>{Be(!0)},[]),nn=(0,Q.useCallback)(e=>{let t=M1(e);oe.update(()=>{let n=N1(t,e);W()?xs([n]):Yi().append(n);let r=Qs();n.insertAfter(r)})},[oe]),rn=(0,Q.useCallback)(async()=>{try{Ee(!0),Ae(0);let e=O6.loading(`Preparing PDF export...`,{description:`Initializing export process`}),t=setInterval(()=>{Ae(n=>{let r=n+15;return r>=90?(clearInterval(t),90):(r>30&&r<=60?O6.loading(`Rendering content...`,{id:e,description:`Converting editor content to PDF format`}):r>60&&O6.loading(`Finalizing PDF...`,{id:e,description:`Almost done!`}),r)})},200),n=new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`);await xRt(se,`export-${n}.pdf`,gt||void 0),clearInterval(t),Ae(100),O6.success(`PDF exported successfully!`,{id:e,description:`File saved as export-${n}.pdf`,duration:4e3})}catch(e){console.error(`PDF export failed:`,e);let t=e instanceof Error?e.message:`Unknown error occurred`;O6.error(`Failed to export PDF`,{description:t,duration:5e3,action:{label:`Try Again`,onClick:()=>rn()}})}finally{Ee(!1),Ae(0)}},[se,gt]),an=(0,Q.useCallback)(async()=>{try{Oe(!0);let e=O6.loading(`Preparing DOC export...`,{description:`Converting to Word document`}),t=new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`);await TRt(se,`export-${t}.docx`,gt||void 0),O6.success(`Document exported successfully!`,{id:e,description:`File saved as export-${t}.docx`,duration:4e3})}catch(e){console.error(`DOC export failed:`,e);let t=e instanceof Error?e.message:`Unknown error occurred`;O6.error(`Failed to export document`,{description:t,duration:5e3,action:{label:`Try Again`,onClick:()=>an()}})}finally{Oe(!1)}},[se,gt]);return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(bFt,{}),(0,X.jsxs)(`div`,{ref:je,className:k$(nt.toolbarContainer,ce?`cteditor-bg-transparent cteditor-border-b`:`cteditor-bg-main-background cteditor-border cteditor-rounded-xl`),children:[(0,X.jsxs)(`div`,{ref:Me,className:nt.toolbarInnerContent,children:[(0,X.jsxs)(`div`,{"data-toolbar-item":`undoRedo`,className:k$(nt.controlGroup,`cteditor-flex-shrink-0`),children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,onClick:()=>se.dispatchCommand(mc,void 0),disabled:fe.undo,size:`icon-sm`,children:(0,X.jsx)(aqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Undo (Ctrl + Z)`})})]})}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:()=>se.dispatchCommand(hc,void 0),disabled:fe.redo,children:(0,X.jsx)(oqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Redo (Ctrl + Y)`})})]})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]}),(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,lockIconClassName:`cteditor-translate-x-0`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`blockFormat`,className:k$(nt.controlGroup,(se!==oe||ct.isNodeSelection||!(at===`paragraph`||/^h[1-6]$/.test(at)))&&`cteditor-opacity-40 cteditor-cursor-not-allowed cteditor-pointer-events-none`),children:(0,X.jsx)(o4t,{blockType:at,enableHeadings:C,enableLists:w,enableBlockquote:T})})}),(0,X.jsx)(r6,{isEnabled:i,planAllows:xt?.enableFontControls??!0,featureName:`Font Controls`,lockIconClassName:`cteditor-translate-x-0`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`fontControls`,className:nt.controlGroup,children:[(0,X.jsx)(`div`,{"data-toolbar-item":`fontFamily`,children:(0,X.jsx)(l3t,{fonts:z,activeEditor:se})}),(0,X.jsx)(`div`,{"data-toolbar-item":`fontSize`,children:(0,X.jsx)(Y7,{})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),(0,X.jsxs)(`div`,{className:`cteditor-flex`,children:[(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`inlineFormats`,className:nt.controlGroup,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:()=>se.dispatchCommand(pc,`bold`),className:k$(ct.isBold&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(q4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Bold (Ctrl + B)`})})]})})})}),m&&se===oe&&(0,X.jsx)(`div`,{"data-toolbar-item":`formatTextMenu`,children:(0,X.jsx)(h3t,{hasFormat:rt,blockType:at})}),se===oe&&(0,X.jsx)(r6,{isEnabled:c,planAllows:xt?.enableColors??!0,featureName:`Colors`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`colorPickers`,children:(0,X.jsx)(w9,{onTextColorChange:Ft,onBackgroundColorChange:It,currentTextColor:ct.fontColor,currentBgColor:ct.bgColor,isHighlightActive:ct.isHighlight,onOpenChange:Xe,isActive:Ye,showTextColorTab:c,showBackgroundColorTab:c,className:`[&>span]:cteditor-hidden`})})})]}),se===oe&&(0,X.jsx)(r6,{isEnabled:r,planAllows:xt?.enableAlignment??!0,featureName:`Alignment`,lockIconClassName:`cteditor-translate-x-0`,className:`cteditor-pr-1`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`alignMenu`,className:nt.controlGroup,children:[(0,X.jsx)(X2t,{enableLineHeight:i&&(xt?.enableFontControls??!0)}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:w,planAllows:xt?.enableLists??!0,featureName:`Lists`,lockIconClassName:`-cteditor-translate-x-1.5`,className:`cteditor-pr-1`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`listMenu`,className:nt.controlGroup,children:[(0,X.jsx)(n4t,{blockType:at}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:E,planAllows:xt?.enableImageUpload??!0,featureName:`Image Upload`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`imageInsert`,className:nt.controlGroup,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:Zt,className:` cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(t3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Image`})})]})})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:a,planAllows:xt?.enableTableOptions??!0,featureName:`Table Options`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(`div`,{"data-toolbar-item":`tableOptions`,className:nt.controlGroup,children:(0,X.jsx)(KLt,{isActive:ct.rootType===`table`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Add Table`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:O,planAllows:xt?.enableCharts??!0,featureName:`Charts`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`chartInsert`,variant:`ghost`,size:`icon-sm`,onClick:$t,className:`cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(r3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Chart`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:k,planAllows:xt?.enableEquations??!0,featureName:`Equations`,children:(0,X.jsxs)(q5,{children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`equationInsert`,variant:`ghost`,size:`icon-sm`,className:`cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(i3,{})})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Equation`})})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[(0,X.jsx)($5,{onClick:()=>en(!1),children:`Block equation`}),(0,X.jsx)($5,{onClick:()=>en(!0),children:`Inline equation`})]})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:p,planAllows:xt?.enableLinks??!0,featureName:`Links`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`link`,variant:`ghost`,size:`icon-sm`,onClick:Ht,className:k$(Lt?`cteditor-bg-accent`:`cteditor-text-foreground`),children:(0,X.jsx)(G4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Link`})})]})})}),(0,X.jsx)(r6,{isEnabled:u,planAllows:xt?.enableEmojiPicker??!0,featureName:`Emoji Picker`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(V7,{"data-toolbar-item":`emoji`,icon:(0,X.jsx)(K4,{}),onChange:e=>{Bt(e)},className:`[&>span]:cteditor-hidden`},`emoji-picker`)}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Emoji picker`})})]})})}),(0,X.jsx)(r6,{isEnabled:d,planAllows:xt?.enableSpecialCharacters??!0,featureName:`Special Characters`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(x9,{"data-toolbar-item":`specialCharacters`,icon:(0,X.jsx)(zqt,{}),onChange:Vt,className:`[&>span]:cteditor-hidden`},`special-characters`)}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Special Characters`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:b,planAllows:xt?.enableNotePanels??!0,featureName:`Note Panels`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`notePanels`,children:(0,X.jsx)(s6t,{className:`[&>span]:cteditor-hidden`})})}),s&&se===oe&&(0,X.jsx)(`div`,{"data-toolbar-item":`insertMenu`,className:`-cteditor-ml-1.5`,children:(0,X.jsx)($3t,{enableHorizontalLine:I,enableFileAttachments:ee,enableSignature:L})}),se===oe&&ve&&(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`editHorizontalRule`,variant:`ghost`,size:`icon-sm`,onClick:Ut,disabled:!e,className:k$(`cteditor-bg-foreground/10`),children:(0,X.jsx)(Z4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Edit horizontal line`})})]})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`}),(0,X.jsx)(r6,{isEnabled:Dt,planAllows:xt?.enableSpeechToText??!0,featureName:`Speech to Text`,lockIconClassName:`-cteditor-translate-x-1.5`,tooltipMessage:Ot?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:void 0,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-toolbar-item":`voiceTranscript`,className:k$(`cteditor-flex cteditor-items-center cteditor-gap-1 max-md:cteditor-hidden`,!Dt&&`cteditor-pr-2`),children:(0,X.jsx)(_1t,{editor:se,apiKey:gt??void 0})}),(0,X.jsx)(v1t,{}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`,className:`max-md:cteditor-hidden`})]})}),(0,X.jsx)(r6,{isEnabled:_t?.htmlViewOption??!1,planAllows:vt?.htmlViewOption??!0,featureName:`HTML View`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`htmlView`,variant:`ghost`,size:`icon-sm`,onClick:Kt,disabled:!e,className:k$(ft&&`cteditor-bg-foreground/20`),children:(0,X.jsx)(b3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ft?`Switch to Editor View`:`Switch to HTML View`})})]})})}),(0,X.jsx)(r6,{isEnabled:ae,planAllows:xt?.enableHtmlCanvas??!0,featureName:`HTML Canvas`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`htmlCanvas`,variant:`ghost`,size:`icon-sm`,onClick:tn,disabled:!e,children:(0,X.jsx)(h3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert HTML Canvas`})})]})})}),(0,X.jsx)(`div`,{"data-toolbar-item":`preview`,className:`cteditor-flex cteditor-items-center`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:qt,children:(0,X.jsx)(m2,{className:`!cteditor-size-3.5`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`View Preview`})})]})})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`}),(0,X.jsx)(r6,{isEnabled:x,planAllows:xt?.enableAutocompleteToggle??!0,featureName:`Autocomplete Toggle`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`autocomplete`,variant:`ghost`,size:`icon-sm`,onClick:Jt,disabled:!e,className:k$(ct.isAutocompleteEnabled&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(p3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ct.isAutocompleteEnabled?`Disable Autocorrection`:`Enable Autocorrection`})})]})})}),(0,X.jsx)(r6,{isEnabled:Tt,planAllows:xt?.enableInlineAutocompleteToggle??!0,featureName:`Inline Autocomplete`,tooltipMessage:Et?`Add at least one AI provider key in License Section > Manage API Keys to use Inline Autocomplete.`:void 0,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`inlineAutocomplete`,variant:`ghost`,size:`icon-sm`,onClick:Yt,disabled:!e,className:k$(ct.isInlineAutocompleteEnabled&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(Rqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ct.isInlineAutocompleteEnabled?`Disable Inline Autocomplete`:`Enable Inline Autocomplete`})})]})})}),(0,X.jsx)(r6,{isEnabled:j||M,planAllows:(xt?.enablePdfExport??!0)||(xt?.enableDocExport??!0),featureName:`Export`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(q5,{children:[(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`export`,variant:`ghost`,size:`icon-sm`,disabled:Te||De,children:Te||De?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-animate-spin`}):(0,X.jsx)(d2,{className:`!cteditor-size-4`})})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:Te||De?`Exporting...`:`Export (PDF or DOC)`})})]}),(0,X.jsxs)(Q5,{align:`end`,children:[(0,X.jsxs)($5,{onClick:rn,disabled:!j||!(xt?.enablePdfExport??!0)||Te,children:[Te?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-mr-2 cteditor-animate-spin`}):(0,X.jsx)(Hqt,{}),Te?`Exporting PDF... ${ke}%`:`Export as PDF`]}),(0,X.jsxs)($5,{onClick:an,disabled:!M||!(xt?.enableDocExport??!0)||De,children:[De?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-mr-2 cteditor-animate-spin`}):(0,X.jsx)(Uqt,{}),De?`Exporting...`:`Export as DOC`]})]})]})})})]}),(0,X.jsx)(r6,{isEnabled:Ct,planAllows:xt?.enableAIChat??!0,featureName:`AI Chat`,lockIconClassName:`cteditor-absolute cteditor-top-2.5 cteditor-right-auto cteditor-left-1`,tooltipMessage:wt?`Add at least one AI provider key in License Section > Manage API Keys to use AI Chat.`:void 0,children:(0,X.jsx)(`div`,{"data-toolbar-item":`aiOptions`,className:k$(`cteditor-aiOption`,!g&&`[&>button>svg:first-child]:cteditor-opacity-0`),children:(0,X.jsxs)(q5,{modal:!1,children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`highlighted`,size:`sm`,className:`cteditor-px-2 !cteditor-gap-1 !cteditor-rounded-md cteditor-h-7.5 max-sm:!cteditor-gap-0`,children:[(0,X.jsx)(y3,{className:`aiSparkle !cteditor-size-4`}),(0,X.jsx)(`span`,{className:`max-sm:cteditor-hidden`,children:`AI`}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{className:`cteditor-w-[200px] cteditor-p-1.5`,children:[(0,X.jsxs)($5,{onClick:Wt,disabled:!e,children:[(0,X.jsx)(X4,{}),` AI Chat`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`REFINE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`SPELLING_GRAMMAR`}),children:[(0,X.jsx)(jqt,{}),` Fix Grammar`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`SIMPLIFY`}),children:[(0,X.jsx)(Pqt,{}),` Simplify`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`COMPLETE_SENTENCE`}),children:[(0,X.jsx)(Aqt,{}),` Complete Sentence`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`REWRITE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`MAKE_LONGER`}),children:[(0,X.jsx)(Mqt,{}),` Make Longer`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`MAKE_SHORTER`}),children:[(0,X.jsx)(Nqt,{}),` Make Shorter`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(S5,void 0),children:[(0,X.jsx)(kqt,{}),` Adjust Tone`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(x5,void 0),children:[(0,X.jsx)(uqt,{}),` Translate`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`EMOJIFY`}),children:[(0,X.jsx)(K4,{}),` Emojify`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`GENERATE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`AI_RESPONSE`}),children:[(0,X.jsx)(f3,{}),` AI`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(b5,void 0),children:[(0,X.jsx)(m3,{}),` Generate Image`]})]})]})})}),(0,X.jsx)(r6,{isEnabled:Dt,planAllows:xt?.enableSpeechToText??!0,featureName:`Speech to Text`,lockIconClassName:`-cteditor-translate-x-1.5`,tooltipMessage:Ot?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:void 0,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-toolbar-item":`voiceTranscript`,className:k$(`cteditor-flex cteditor-items-center cteditor-gap-1 md:cteditor-hidden`,!Dt&&`cteditor-pr-2`),children:(0,X.jsx)(_1t,{editor:se,apiKey:gt??void 0})}),(0,X.jsx)(v1t,{}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`,className:`md:cteditor-hidden`})]})}),(0,X.jsxs)(`div`,{"data-toolbar-item":`clearOptions`,className:k$(nt.controlGroup,`max-md:cteditor-hidden`),children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:ot,children:(0,X.jsx)(wqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Clear formatting`})})]})}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,disabled:it,onClick:Pt,children:(0,X.jsx)(s3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Clear editor`})})]})})]}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto`,children:P&&ue&&(0,X.jsx)(i4t,{fitToPage:ce,isOpen:le,onClick:ue,commentCount:de})}),be&&(0,X.jsx)(`div`,{className:`cteditor-flex-shrink-0 cteditor-h-7`,children:(0,X.jsxs)(q5,{open:Se,onOpenChange:e=>{Ce(e),e||et(``)},children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`secondary`,className:k$(nt.moreMenuTriggerButton,`cteditor-relative !cteditor-bg-foreground/[0.03] dark:!cteditor-bg-foreground/[0.02]`),children:[(0,X.jsx)(x2,{className:`!cteditor-size-4`}),(0,X.jsx)(c2,{className:`!cteditor-size-3 cteditor-opacity-50 `}),Ne.has(`insertMenu`)&&V$t.some(we)&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-absolute cteditor-top-[3px] cteditor-right-[3px] cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-[1.5px] cteditor-ring-background`,children:(0,X.jsx)(`span`,{className:`cteditor-absolute -cteditor-inset-[3px] cteditor-rounded-full cteditor-border-[1.5px] cteditor-border-solid cteditor-border-[#e6b96b] cteditor-animate-ping-slow`})})]})}),(0,X.jsxs)(Q5,{align:`end`,className:`cteditor-w-64 cteditor-max-h-[450px] cteditor-overflow-hidden cteditor-flex cteditor-flex-col`,onCloseAutoFocus:e=>e.preventDefault(),onPointerDownOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.emoji-picker-react`)||t.closest(`[data-voice-transcript]`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`[data-radix-popover-content]`)||t.closest(`[data-radix-dropdown-menu-content]`)||t.closest(`#emoji-picker`)||t.closest(`#highlight-color-picker`)||t.closest(`#color-picker`))&&e.preventDefault()},onInteractOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.emoji-picker-react`)||t.closest(`[data-voice-transcript]`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`[data-radix-popover-content]`)||t.closest(`[data-radix-dropdown-menu-content]`)||t.closest(`#emoji-picker`)||t.closest(`#highlight-color-picker`)||t.closest(`#color-picker`))&&e.preventDefault()},children:[(0,X.jsxs)(`div`,{className:`cteditor-sticky cteditor-top-0 cteditor-z-10 `,children:[(0,X.jsxs)(`div`,{className:W7.searchWrapper,children:[(0,X.jsx)(C2,{className:W7.searchIcon}),(0,X.jsx)(N6,{ref:tt,type:`text`,placeholder:`Search tools...`,value:$e,onChange:e=>et(e.target.value),onKeyDown:e=>e.stopPropagation(),className:W7.searchInput}),$e&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>et(``),className:W7.searchClearButton,children:(0,X.jsx)(s3,{className:W7.searchClearIcon})})]}),$e&&(0,X.jsx)(`p`,{className:nt.searchStatusText,children:dt?`Showing matching tools`:`No tools found`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`md:cteditor-hidden`,children:[(0,X.jsxs)($5,{onClick:ot,children:[(0,X.jsx)(wqt,{}),(0,X.jsx)(`span`,{children:`Clear formatting`})]}),(0,X.jsxs)($5,{onClick:Pt,disabled:it,children:[(0,X.jsx)(s3,{}),(0,X.jsx)(`span`,{children:`Clear editor`})]})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`}),!dt&&$e&&(0,X.jsxs)(`div`,{className:nt.searchEmptyStateContainer,children:[(0,X.jsx)(C2,{className:nt.searchEmptyStateIcon}),(0,X.jsx)(`p`,{className:nt.searchEmptyStateTitle,children:`No tools found`}),(0,X.jsx)(`p`,{className:nt.searchEmptyStateDescription,children:`Try a different search term`})]}),ut(`suggestFeature`)&&(0,X.jsxs)($5,{onClick:()=>We(!0),className:`sm:cteditor-hidden`,children:[(0,X.jsx)(Cqt,{}),(0,X.jsx)(`span`,{children:`Suggest a Feature`})]}),ut(`reportBug`)&&(0,X.jsxs)($5,{onClick:()=>Ke(!0),className:`sm:cteditor-hidden`,children:[(0,X.jsx)(Lqt,{}),(0,X.jsx)(`span`,{children:`Report a Bug`})]}),se===oe&&Ne.has(`blockFormat`)&&ut(`blockFormat`)&&(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(o4t,{blockType:at,enableHeadings:C,enableLists:w,enableBlockquote:T,triggerClassName:`cteditor-w-full dark:cteditor-bg-body/20 cteditor-bg-body cteditor-border-foreground/5 cteditor-border cteditor-h-7.5 !cteditor-rounded-md cteditor-justify-between cteditor-pe-3 `})})})})}),(Ne.has(`fontFamily`)||Ne.has(`fontSize`))&&(ut(`fontFamily`)||ut(`fontSize`))&&(0,X.jsx)(r6,{isEnabled:i,planAllows:xt?.enableFontControls??!0,featureName:`Font Controls`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(l3t,{fonts:z,activeEditor:se})})}),(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full [&>div]:cteditor-w-full [&>div]:cteditor-justify-between`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(Y7,{})})})]})}),se===oe&&Ne.has(`imageInsert`)&&ut(`imageInsert`)&&(0,X.jsx)(r6,{isEnabled:E,planAllows:xt?.enableImageUpload??!0,featureName:`Image Upload`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Zt,children:[(0,X.jsx)(t3,{}),`Insert Image`]})}),se===oe&&Ne.has(`tableOptions`)&&ut(`tableOptions`)&&(0,X.jsx)(r6,{isEnabled:a,planAllows:xt?.enableTableOptions??!0,featureName:`Table Options`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)($5,{asChild:!0,onSelect:()=>{oe.dispatchCommand(c5,void 0)},children:(0,X.jsxs)(`div`,{className:`cteditor-w-full [&>button]:cteditor-size-6 [&>button]:!cteditor-bg-transparent`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(KLt,{isActive:ct.rootType===`table`}),`Table`]})})})}),se===oe&&Ne.has(`chartInsert`)&&ut(`chartInsert`)&&(0,X.jsx)(r6,{isEnabled:O,planAllows:xt?.enableCharts??!0,featureName:`Charts`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:$t,children:[(0,X.jsx)(r3,{}),`Insert Chart`]})}),se===oe&&Ne.has(`equationInsert`)&&ut(`equationInsert`)&&(0,X.jsx)(r6,{isEnabled:k,planAllows:xt?.enableEquations??!0,featureName:`Equations`,variant:`inline`,children:(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{children:[(0,X.jsx)(i3,{}),`Insert Equation`]}),(0,X.jsxs)(Z5,{children:[(0,X.jsx)($5,{onClick:()=>en(!1),children:`Block equation`}),(0,X.jsx)($5,{onClick:()=>en(!0),children:`Inline equation`})]})]})}),Ne.has(`preview`)&&ut(`preview`)&&(0,X.jsxs)($5,{onClick:qt,children:[(0,X.jsx)(Wqt,{}),`Preview`]}),Ne.has(`export`)&&ut(`export`)&&(j||M)&&(0,X.jsxs)(r6,{isEnabled:j||M,planAllows:(xt?.enablePdfExport??!0)||(xt?.enableDocExport??!0),featureName:`Export`,variant:`inline`,children:[(0,X.jsxs)($5,{onClick:rn,disabled:!j||!(xt?.enablePdfExport??!0)||Te,children:[(0,X.jsx)(Hqt,{}),Te?`Exporting PDF... ${ke}%`:`Export as PDF`]}),(0,X.jsxs)($5,{onClick:an,disabled:!M||!(xt?.enableDocExport??!0)||De,children:[(0,X.jsx)(Uqt,{}),De?`Exporting...`:`Export as DOC`]})]}),Ne.has(`inlineFormats`)&&ut(`inlineFormats`)&&(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`strikethrough`),children:[(0,X.jsx)(U4,{}),`Strikethrough`]})}),se===oe&&Ne.has(`codeBlock`)&&ut(`codeBlock`)&&(0,X.jsx)(r6,{isEnabled:h,planAllows:xt?.enableCodeFormat??!0,featureName:`Code Format`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Xt,children:[(0,X.jsx)(W4,{}),`Code Block`]})}),se===oe&&Ne.has(`formatTextMenu`)&&ut(`formatTextMenu`)&&(0,X.jsx)(r6,{isEnabled:m,planAllows:xt?.enableFormatTextMenu??!0,featureName:`Format Text Menu`,variant:`inline`,children:(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-1`,children:[(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2`,children:`Format`}),(0,X.jsx)(_3t,{hasFormat:rt,blockType:at}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),se===oe&&Ne.has(`colorPickers`)&&ut(`colorPickers`)&&(0,X.jsx)(r6,{isEnabled:c,planAllows:xt?.enableColors??!0,featureName:`Colors`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(w9,{className:k$(nt.dropdownItemTrigger,`[&>div]:cteditor-size-6`),onTextColorChange:e=>{Ft(e),Ce(!0)},onBackgroundColorChange:e=>{It(e),Ce(!0)},currentTextColor:ct.fontColor,currentBgColor:ct.bgColor,isHighlightActive:ct.isHighlight,onOpenChange:Xe,isActive:Ye,showTextColorTab:c,showBackgroundColorTab:c})})})}),se===oe&&Ne.has(`link`)&&ut(`link`)&&(0,X.jsx)(r6,{isEnabled:p,planAllows:xt?.enableLinks??!0,featureName:`Links`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Ht,children:[(0,X.jsx)(G4,{}),Lt?`Remove Link`:`Insert Link`]})}),Ne.has(`emoji`)&&ut(`emoji`)&&(0,X.jsx)(r6,{isEnabled:u,planAllows:xt?.enableEmojiPicker??!0,featureName:`Emoji Picker`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(V7,{className:nt.dropdownItemTrigger,icon:(0,X.jsx)(K4,{}),onChange:e=>{Bt(e),Ce(!0)}},`emoji-picker-dropdown`)})}),Ne.has(`specialCharacters`)&&ut(`specialCharacters`)&&(0,X.jsx)(r6,{isEnabled:d,planAllows:xt?.enableSpecialCharacters??!0,featureName:`Special Characters`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(x9,{className:nt.dropdownItemTrigger,icon:(0,X.jsx)(zqt,{}),onChange:e=>{Vt(e),Ce(!0)}},`special-characters-dropdown`)})}),se===oe&&Ne.has(`insertMenu`)&&ut(`insertMenu`)&&(0,X.jsx)(r6,{isEnabled:s,planAllows:xt?.enableInsertMenu??!0,featureName:`Insert Menu`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-w-full `,children:[(0,X.jsx)(`div`,{className:k$(nt.dropdownSectionLabel,`cteditor-pt-2`),children:`Insert Menu`}),(0,X.jsx)(a6t,{enableHorizontalLine:I,enableFileAttachments:ee,enableSignature:L,enableImageUpload:E})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),se===oe&&ve&&Ne.has(`editHorizontalRule`)&&ut(`editHorizontalRule`)&&(0,X.jsxs)($5,{onClick:Ut,children:[(0,X.jsx)(Z4,{}),`Edit Line`]}),se===oe&&Ne.has(`todo`)&&ut(`todo`)&&(0,X.jsx)(r6,{isEnabled:_,planAllows:xt?.enableTodoList??!0,featureName:`Todo List`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($5,{onClick:Gt,children:[(0,X.jsx)(tqt,{}),`Todo List`]})})}),se===oe&&Ne.has(`signature`)&&ut(`signature`)&&(0,X.jsx)(r6,{isEnabled:L,planAllows:xt?.enableSignature??!0,featureName:`Signature`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:()=>He(!0),children:[(0,X.jsx)(Q4,{}),`Signature`]})}),se===oe&&Ne.has(`notePanels`)&&ut(`notePanels`)&&(0,X.jsx)(r6,{isEnabled:b,planAllows:xt?.enableNotePanels??!0,featureName:`Note Panels`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full [&>button]:cteditor-w-full`,children:(0,X.jsx)(s6t,{className:nt.dropdownItemTrigger})})}),r&&se===oe&&Ne.has(`alignMenu`)&&ut(`alignMenu`)&&(0,X.jsx)(r6,{isEnabled:r,planAllows:xt?.enableAlignment??!0,featureName:`Alignment`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-2`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Align Menu`}),(0,X.jsx)(Z2t,{})]}),i&&(xt?.enableFontControls??!0)&&(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-2`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Line Height`}),(0,X.jsx)(J2t,{})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),Ne.has(`htmlView`)&&ut(`htmlView`)&&(0,X.jsx)(r6,{isEnabled:_t?.htmlViewOption??!1,planAllows:vt?.htmlViewOption??!0,featureName:`HTML View`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($5,{onClick:Kt,disabled:!e,children:[(0,X.jsx)(b3,{}),ft?`Switch to Editor View`:`Switch to HTML View`]})})}),Ne.has(`htmlCanvas`)&&ut(`htmlCanvas`)&&(0,X.jsx)(r6,{isEnabled:ae,planAllows:xt?.enableHtmlCanvas??!0,featureName:`HTML Canvas`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:tn,disabled:!e,children:[(0,X.jsx)(h3,{}),`Insert HTML Canvas`]})}),Ne.has(`autocomplete`)&&ut(`autocomplete`)&&(0,X.jsx)(r6,{isEnabled:x,planAllows:xt?.enableAutocompleteToggle??!0,featureName:`Autocomplete Toggle`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Jt,disabled:!e,children:[(0,X.jsx)(p3,{}),ct.isAutocompleteEnabled?`Disable Autocorrection`:`Enable Autocorrection`]})}),Ne.has(`inlineAutocomplete`)&&ut(`inlineAutocomplete`)&&(0,X.jsx)(r6,{isEnabled:Tt,planAllows:xt?.enableInlineAutocompleteToggle??!0,featureName:`Inline Autocomplete`,variant:`inline`,tooltipMessage:Et?`Add at least one AI provider key in License Section > Manage API Keys to use Inline Autocomplete.`:void 0,children:(0,X.jsxs)($5,{onClick:Yt,disabled:!e,children:[(0,X.jsx)(Rqt,{}),ct.isInlineAutocompleteEnabled?`Disable Inline Autocomplete`:`Enable Inline Autocomplete`]})}),$e.trim()&&E6t.some(e=>ut(e))&&(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-1`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Quick Actions`}),ut(`actionBold`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`bold`),children:[(0,X.jsx)(q4,{}),` Bold`]}),ut(`actionItalic`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`italic`),children:[(0,X.jsx)(H4,{}),` Italic`]}),ut(`actionUnderline`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`underline`),children:[(0,X.jsx)(V4,{}),` Underline`]}),ut(`actionStrikethrough`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`strikethrough`),children:[(0,X.jsx)(U4,{}),` Strikethrough`]}),ut(`actionSubscript`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`subscript`),children:[(0,X.jsx)(J4,{}),` Subscript`]}),ut(`actionSuperscript`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`superscript`),children:[(0,X.jsx)(Y4,{}),` Superscript`]}),ut(`actionQuote`)&&(0,X.jsxs)($5,{onClick:()=>{se.update(()=>{let e=W();U(e)&&Vu(e,()=>Df())})},children:[(0,X.jsx)(lqt,{}),` Block Quote`]}),ut(`actionBulletList`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(Bd,void 0),children:[(0,X.jsx)(e3,{}),` Bullet List`]}),ut(`actionNumberedList`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(Vd,void 0),children:[(0,X.jsx)(e3,{}),` Numbered List`]}),ut(`actionHorizontalRule`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(mf,void 0),children:[(0,X.jsx)(Z4,{}),` Horizontal Line`]})]})]})]})]})})]}),Fe&&(0,X.jsx)($7,{activeEditor:se,onClose:Qt}),(0,X.jsx)(QRt,{open:Le,onOpenChange:Re,onInsert:nn}),(0,X.jsx)(x3t,{open:ze,onOpenChange:Be}),Ve&&(0,X.jsx)(s5,{onClose:()=>He(!1)}),(0,X.jsx)($Rt,{open:Ue,onOpenChange:We}),(0,X.jsx)(XRt,{open:Ge,onOpenChange:Ke}),(0,X.jsx)(ezt,{open:qe,onOpenChange:Nt,onFeedbackSubmitted:At}),(0,X.jsx)(c6t,{open:Ze,onOpenChange:V,htmlContent:Qe,apiKey:gt??void 0})]}):null},T9=48,O6t=20,k6t=1e3,A6t=typeof navigator<`u`&&/Android/i.test(navigator.userAgent),j6t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>bte(e),[e]),null},M6t=({anchorElem:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)([]),i=e??null,a=(0,Q.useRef)(``),o=(0,Q.useCallback)(()=>{if(!i){a.current!==``&&(a.current=``,r([]));return}let e=[];t.getEditorState().read(()=>{Yi().getChildren().forEach(t=>{e0(t)&&t.getChildren().forEach(t=>{Z1(t)&&e.push(t.getKey())})})});let n=i.getBoundingClientRect(),o=[];e.forEach(e=>{let r=t.getElementByKey(e);if(!r)return;let a=r.getBoundingClientRect();o.push({key:e,top:a.top-n.top+i.scrollTop,right:a.right-n.left+i.scrollLeft})});let s=o.map(e=>`${e.key}:${Math.round(e.top)}:${Math.round(e.right)}`).join(`|`);s!==a.current&&(a.current=s,r(o))},[t,i]);(0,Q.useEffect)(()=>t.registerUpdateListener(()=>o()),[t,o]),(0,Q.useEffect)(()=>{o()},[o]),(0,Q.useEffect)(()=>{let e=()=>o();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[o]),(0,Q.useEffect)(()=>{if(!i||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>o());return e.observe(i),()=>e.disconnect()},[i,o]);let s=(0,Q.useCallback)(e=>{t.update(()=>{let t=Ui(e);if(!Z1(t))return;let n=Qs();t.append(n),n.select();let r=W();U(r)&&r.insertText(`/`)})},[t]);return!i||n.length===0?null:N0.createPortal((0,X.jsx)(X.Fragment,{children:n.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`ed-col-add-btn`,title:`Add a block to this column`,onMouseDown:e=>e.preventDefault(),onClick:()=>s(e.key),style:{position:`absolute`,top:e.top+8,left:e.right-8,transform:`translateX(-100%)`,zIndex:1},children:[(0,X.jsx)(`span`,{style:{paddingRight:`4px`},children:`+`}),` block`]},e.key))}),i)},N6t=di(`INSERT_COMMENT_COMMAND`),P6t=di(`OPEN_COMMENT_MODAL`),F6t=di(`OPEN_COMMENT_SIDEBAR_COMMAND`),I6t=(e,t)=>{let n;return function(...r){clearTimeout(n),n=window.setTimeout(()=>e.apply(this,r),t)}},E9=({namespace:e})=>{let[t]=Gd(),n=(0,Q.useMemo)(()=>I6t(()=>{let n=JSON.stringify(t.getEditorState());localStorage.setItem(e,n)},500),[t,e]);return(0,Q.useEffect)(()=>t.registerUpdateListener(({dirtyElements:e,dirtyLeaves:t})=>{e.size===0&&t.size===0||n()}),[n,t]),null},L6t=({open:e,onOpenChange:t,oldImageUrl:n,newImageUrl:r,onReplace:i,onCancel:a})=>(0,X.jsx)(x6,{open:e,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`sm:max-w-[800px] max-h-[90vh] overflow-y-auto`,children:[(0,X.jsxs)(C6,{children:[(0,X.jsxs)(T6,{className:`flex items-center gap-2 text-xl`,children:[(0,X.jsx)(`span`,{className:`text-2xl`,children:`🔄`}),`Compare Images`]}),(0,X.jsx)(E6,{className:`text-sm pt-1`,children:`Choose whether to replace the original image with the refined version.`})]}),(0,X.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-gray-700 dark:text-gray-300`,children:`Refined Image`}),(0,X.jsx)(`span`,{className:`text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400`,children:`New`})]}),(0,X.jsx)(`div`,{className:`relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600`,children:(0,X.jsx)(`img`,{src:r,alt:`Refined`,className:`w-full h-full object-contain`})})]})}),(0,X.jsx)(`div`,{className:`p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800`,children:(0,X.jsxs)(`p`,{className:`text-sm text-blue-800 dark:text-blue-200`,children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:`Note:`}),` Clicking "Replace" will update the image in your document. This action cannot be undone.`]})})]}),(0,X.jsxs)(w6,{className:`gap-2`,children:[(0,X.jsx)(Q2,{variant:`outline`,onClick:a,children:`Keep Original`}),(0,X.jsxs)(Q2,{onClick:i,className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,X.jsx)(`span`,{className:`mr-2`,children:`✓`}),`Replace Image`]})]})]})}),R6t=`/transform-image/`,D9={east:1,north:8,south:2,west:4},O9=new Set,k9=di(`RIGHT_CLICK_IMAGE_COMMAND`),A9=`application/x-editor-image-node-key`,z6t=Object.freeze(Object.defineProperty({__proto__:null,IMAGE_DRAG_DATA_TYPE:A9,RIGHT_CLICK_IMAGE_COMMAND:k9,default:rBt},Symbol.toStringTag,{value:`Module`})),B6t=[`image/`,`image/heic`,`image/heif`,`image/gif`,`image/webp`,`image/png`,`image/jpg`,`image/jpeg`,`image/svg+xml`],V6t=[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],H6t=1*1024*1024*1024,U6t=[`application/pdf`,`text/plain`,`text/csv`,`application/json`,`application/zip`,`application/x-zip-compressed`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],W6t=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}),G6t=`draggable-block-menu`,K6t={ornament:[{value:`star`,label:`✦`},{value:`flower`,label:`❋`},{value:`diamond`,label:`◆`},{value:`dot`,label:`•`},{value:`section`,label:`§`}],asterism:[{value:`asterism`,label:`⁂`},{value:`triple-star`,label:`✳`},{value:`section`,label:`§`}],labeled:[{value:`thin`,label:`Thin`},{value:`thick`,label:`Thick`},{value:`dashed`,label:`Dashed`},{value:`dotted`,label:`Dotted`}],section:[{value:`left`,label:(0,X.jsx)(r2,{size:15}),title:`Align left`},{value:`center`,label:(0,X.jsx)(n2,{size:15}),title:`Align center`},{value:`right`,label:(0,X.jsx)(i2,{size:15}),title:`Align right`}],pullquote:[{value:`full`,label:`Full`},{value:`short`,label:`Short`},{value:`none`,label:`None`}],columns:[],button:[{value:`filled`,label:`Filled`},{value:`outline`,label:`Outline`}]},q6t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null),u=(0,Q.useRef)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=t?.key;(0,Q.useEffect)(()=>{m(!1)},[h]),(0,Q.useEffect)(()=>{let t=e.getRootElement();t&&c(t.closest(`.editor-scroller`)||t.parentElement||document.body)},[e]),(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=lBt(),t=e?`${e.key}:${e.variant}:${e.autoNumber??``}:${e.count??``}:${e.trackCount??``}:${e.hasWide??``}:${e.align??``}:${e.radius??``}:${e.textColor??``}:${e.bgColor??``}`:``;t!==u.current&&(u.current=t,n(e))})}),[e]);let g=(0,Q.useCallback)(()=>{if(!t||!s){i(null),o(null);return}let n=e.getElementByKey(t.key);if(!n){i(null),o(null);return}let r=n.getBoundingClientRect(),a=s.getBoundingClientRect(),c=s.scrollTop,u=s.scrollLeft,d=l.current?.offsetHeight||38,f=l.current?.offsetWidth||0,p=r.top-a.top+c,m=r.left-a.left+u;o({top:p,left:m,width:r.width,height:r.height});let h=p-d-8;h<c+4&&(h=p+r.height+8);let g=Math.max(8,m);f>0&&(g=Math.min(g,a.width+u-f-8),g=Math.max(8,g)),i({top:h,left:g})},[t,s,e]);(0,Q.useEffect)(()=>{g()},[g]),(0,Q.useEffect)(()=>{if(!t)return;let e=()=>g();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,g]),(0,Q.useEffect)(()=>{if(!t||typeof ResizeObserver>`u`)return;let n=e.getElementByKey(t.key);if(!n)return;let r=new ResizeObserver(()=>g());return r.observe(n),s&&r.observe(s),()=>r.disconnect()},[t,e,s,g]),(0,Q.useEffect)(()=>{if(t)return e.registerUpdateListener(()=>g())},[t,e,g]);let _=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e&&(t.type===`ornament`&&eLt(e)||t.type===`asterism`&&rLt(e)?e.setVariant(n):t.type===`labeled`&&G1(e)?e.setRuleStyle(n):t.type===`section`&&q1(e)?e.setAlign(n):t.type===`pullquote`&&Y1(e)?e.setRules(n):t.type===`button`&&o0(e)&&e.setVariant(n))})},[t,e]),v=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&e.setAlign(n)})},[t,e]),y=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&e.setRadius(n)})},[t,e]),b=(0,Q.useCallback)((n,r)=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&(n===`text`?e.setTextColor(r):e.setBgColor(r))})},[t,e]),x=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e0(e)&&(n===1?bzt(e):xzt(e))})},[t,e]),S=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e0(e)&&n(e)})},[t,e]),C=(0,Q.useCallback)(e=>{f(!1),S(t=>Szt(t,e))},[S]);(0,Q.useEffect)(()=>{f(!1)},[t?.key,t?.count]),(0,Q.useEffect)(()=>{if(!d)return;let e=e=>{l.current?.contains(e.target)||f(!1)};return document.addEventListener(`mousedown`,e,!0),()=>document.removeEventListener(`mousedown`,e,!0)},[d]);let w=(0,Q.useCallback)(()=>{t&&e.update(()=>{let e=Ui(t.key);if(!e)return;let n=dBt(e,t.type);n&&e.insertAfter(n)})},[t,e]),T=(0,Q.useCallback)(()=>{t&&e.update(()=>{let e=Ui(t.key);q1(e)&&e.setAutoNumber(!e.getAutoNumber())})},[t,e]),E=(0,Q.useCallback)(()=>{t&&(e.update(()=>{Ui(t.key)?.remove()}),n(null),u.current=``)},[t,e]);if(!t||!r||!s)return null;let D=K6t[t.type],O=t.type===`ornament`||t.type===`asterism`,k=a!=null&&(t.type===`labeled`||t.type===`section`||t.type===`pullquote`||t.type===`columns`||t.type===`ornament`||t.type===`asterism`);return N0.createPortal((0,X.jsxs)(X.Fragment,{children:[k&&a&&(0,X.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,top:a.top-4,left:a.left-8,width:a.width+16,height:a.height+16,pointerEvents:`none`,border:`1px dashed var(--ed-accent-color, #ef9f27)`,backgroundColor:`color-mix(in srgb, var(--ed-accent-color, #ef9f27) 5%, transparent)`,borderRadius:12,opacity:.6,zIndex:1}}),(0,X.jsxs)(`div`,{ref:l,onMouseDown:e=>e.preventDefault(),style:{position:`absolute`,top:r.top,left:r.left,zIndex:1e3},className:`cteditor-flex cteditor-p-1 cteditor-align-middle cteditor-absolute cteditor-top-0 cteditor-left-0 cteditor-z-10 cteditor-rounded-lg cteditor-items-center cteditor-bg-accent cteditor-text-sm cteditor-border cteditor-border-foreground/10 cteditor-space-x-1`,children:[D.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e.title||e.value,onClick:()=>_(e.value),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center disabled:cursor-not-allowed cteditor-transition-colors `+(O?`cteditor-size-6 cteditor-p-[2px] cteditor-text-base `:`cteditor-h-6 cteditor-px-2 cteditor-text-xs `)+(t.variant===e.value?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:e.label},e.value)),t.type===`button`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center`,children:[(0,X.jsxs)(`button`,{type:`button`,title:`Button alignment`,"aria-label":`Button alignment`,onClick:()=>m(e=>!e),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-6 cteditor-px-1 cteditor-gap-0.5 `+(p?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:[t.align===`center`?(0,X.jsx)(n2,{size:15}):t.align===`right`?(0,X.jsx)(i2,{size:15}):(0,X.jsx)(r2,{size:15}),(0,X.jsx)(c2,{size:13,className:`cteditor-opacity-50`})]}),p&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-left-0 cteditor-top-full cteditor-mt-1 cteditor-z-10 cteditor-min-w-max cteditor-rounded-xl cteditor-border cteditor-border-foreground/10 cteditor-bg-accent cteditor-p-1`,children:[[`left`,`Left Align`,r2],[`center`,`Center Align`,n2],[`right`,`Right Align`,i2]].map(([e,n,r])=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{v(e),m(!1)},className:`cteditor-border-0 cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-w-full cteditor-whitespace-nowrap cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-left cteditor-text-xs cteditor-text-foreground cteditor-cursor-pointer `+(t.align===e?`cteditor-bg-foreground/10 `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 `),children:[(0,X.jsx)(r,{size:14}),n]},e))})]}),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),[[`rounded`,aJt,`Rounded button`],[`square`,iJt,`Square button`],[`pill`,oJt,`Pill button`]].map(([e,n,r])=>(0,X.jsx)(`button`,{type:`button`,title:r,"aria-label":r,onClick:()=>y(e),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 `+(t.radius===e?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:(0,X.jsx)(n,{className:`cteditor-size-4`})},e)),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsx)(w9,{onTextColorChange:e=>b(`text`,e),onBackgroundColorChange:e=>b(`bg`,e),currentTextColor:t.textColor??void 0,currentBgColor:t.bgColor??void 0,showTextColorTab:!0,showBackgroundColorTab:!0,className:`!cteditor-size-6 [&>span]:cteditor-hidden king`})]}),t.type===`section`&&(0,X.jsx)(`button`,{type:`button`,title:`Auto-number sections`,onClick:T,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center disabled:cursor-not-allowed cteditor-transition-colors cteditor-h-6 cteditor-px-2 cteditor-text-xs cteditor-font-mono `+(t.autoNumber?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:`01`}),t.type===`columns`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,title:`Remove column`,disabled:(t.count??2)<=1,onClick:()=>x(-1),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-[7px] cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-text-foreground/70 hover:cteditor-bg-foreground/10 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:(0,X.jsx)(sJt,{className:`cteditor-size-[15px]`})}),(0,X.jsxs)(`span`,{className:`cteditor-min-w-[34px] cteditor-text-center cteditor-font-semibold cteditor-text-foreground cteditor-text-xs cteditor-inline-flex cteditor-items-center cteditor-justify-center cteditor-gap-[5px]`,children:[(0,X.jsx)(`span`,{children:t.count??2}),(0,X.jsx)(`small`,{className:`cteditor-text-[11.5px] cteditor-text-foreground/50 cteditor-font-medium cteditor-tracking-wider`,children:`Col`})]}),(0,X.jsx)(`button`,{type:`button`,title:`Add column`,disabled:(t.trackCount??2)>=3,onClick:()=>x(1),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-[7px] cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-text-foreground/70 hover:cteditor-bg-foreground/10 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:(0,X.jsx)(rqt,{className:`cteditor-size-[15px]`})})]}),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center`,children:[(0,X.jsxs)(`button`,{type:`button`,title:`Merge two columns into one wider column`,disabled:(t.count??2)<2,onClick:()=>{(t.count??2)<=2?C(0):f(e=>!e)},className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-md cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-[30px] cteditor-px-2 cteditor-text-xs cteditor-font-medium cteditor-gap-1 disabled:cursor-not-allowed disabled:cteditor-opacity-30 `+(d?`cteditor-bg-foreground/10 cteditor-text-foreground`:`cteditor-bg-transparent hover:cteditor-bg-foreground/5 cteditor-text-foreground/70 hover:cteditor-text-foreground`),children:[(0,X.jsx)(cJt,{className:`cteditor-size-5`}),(0,X.jsxs)(`span`,{children:[`Merge`,(t.count??2)>2?` ▾`:``]})]}),d&&(t.count??2)>2&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-left-0 cteditor-top-full cteditor-mt-1 cteditor-z-10 cteditor-min-w-max cteditor-rounded-xl cteditor-border cteditor-border-foreground/10 cteditor-bg-accent cteditor-p-1`,children:Array.from({length:(t.count??2)-1},(e,t)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>C(t),className:`cteditor-border-0 cteditor-bg-transparent cteditor-block cteditor-w-full cteditor-whitespace-nowrap cteditor-rounded-sm cteditor-px-2 cteditor-py-1 cteditor-text-left cteditor-text-xs cteditor-text-foreground hover:cteditor-bg-foreground/10`,children:[`Merge cols `,t+1,` & `,t+2]},t))})]}),(0,X.jsxs)(`button`,{type:`button`,title:`Split the merged column back into two`,disabled:!t.hasWide,onClick:()=>S(Czt),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-md cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-[30px] cteditor-px-2 cteditor-text-xs cteditor-font-medium cteditor-gap-1 cteditor-text-foreground/70 hover:cteditor-bg-foreground/5 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:[(0,X.jsx)(lJt,{className:`cteditor-size-5`}),(0,X.jsx)(`span`,{children:`Split`})]})]}),(0,X.jsx)(`span`,{className:`cteditor-mx-0.5 cteditor-h-4 cteditor-w-px cteditor-bg-foreground/10`}),t.type!==`columns`&&(0,X.jsx)(`button`,{type:`button`,title:`Duplicate`,onClick:w,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-p-[2px] cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground`,children:(0,X.jsx)(uUt,{size:14})}),(0,X.jsx)(`button`,{type:`button`,title:`Delete`,onClick:E,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-p-[2px] cteditor-bg-transparent hover:cteditor-bg-red-500/10 hover:cteditor-text-red-500 cteditor-text-foreground`,children:(0,X.jsx)(T2,{size:14})})]})]}),s)},J6t=`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-accent cteditor-rounded-md cteditor-border cteditor-border-foreground/10 cteditor-p-0.5`,Y6t=`cteditor-size-7 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded cteditor-transition-colors cteditor-text-foreground`,X6t=`cteditor-bg-foreground/10`,Z6t=10,Q6t=5,$6t=10,e8t=5,t8t=[{color:`#000000`,label:`Black`},{color:`#ffff`,label:`White`},{color:`#6b7280`,label:`Gray`},{color:`#ca8a04`,label:`Yellow`},{color:`#ea580c`,label:`Orange`},{color:`#dc2626`,label:`Red`},{color:`#16a34a`,label:`Green`},{color:`#2563eb`,label:`Blue`},{color:`#9333ea`,label:`Purple`},{color:`#db2777`,label:`Pink`},{color:`#0d9488`,label:`Teal`}],n8t=[{color:`transparent`,label:`None`},{color:`#d1d5db`,label:`Gray`},{color:`#fef08a`,label:`Yellow`},{color:`#fed7aa`,label:`Orange`},{color:`#fecaca`,label:`Red`},{color:`#bbf7d0`,label:`Green`},{color:`#bfdbfe`,label:`Blue`},{color:`#e9d5ff`,label:`Purple`},{color:`#fbcfe8`,label:`Pink`},{color:`#99f6e4`,label:`Teal`}],r8t=`ct-editor-recent-highlight-colors`,i8t=({onHighlightChange:e,onTextColorChange:t,isActive:n=!1,currentHighlightColor:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(r8t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(typeof t[0]==`string`?s(t.map(e=>({color:e,type:`background`}))):s(t))}}catch(e){console.error(`Failed to load recent colors`,e)}},[]);let c=(0,Q.useCallback)((e,t)=>{e!==`transparent`&&s(n=>{let r=n.filter(n=>!(n.color===e&&n.type===t)),i=[{color:e,type:t},...r].slice(0,3);try{localStorage.setItem(r8t,JSON.stringify(i))}catch(e){console.error(`Failed to save recent colors`,e)}return i})},[]),l=t=>{t&&c(t,`background`),e(t)},u=e=>{e&&c(e,`text`),t?.(e)},d=({color:e,label:t,onClick:n,showX:r=!1,children:i})=>(0,X.jsxs)(`button`,{type:`button`,className:`cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-border cteditor-border-foreground/20 hover:cteditor-scale-110 cteditor-transition-transform cteditor-flex cteditor-items-center cteditor-justify-center`,style:{backgroundColor:e===`transparent`?`transparent`:e},onClick:n,title:t,children:[r&&(0,X.jsx)(k2,{className:`!cteditor-size-3.5 cteditor-text-foreground/50`}),i]});return(0,X.jsxs)(m8,{open:i,onOpenChange:a,modal:!1,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,className:`cteditor-relative ${n?`cteditor-bg-foreground/10`:``}`,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-[11px] cteditor-leading-none cteditor-font-semibold`,children:`A`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-[1px]`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:`#000`}}),(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:r&&r!==`transparent`?r:`#ffeb3b`}})]})]})})})}),(0,X.jsx)($3,{children:`Colors`})]})}),(0,X.jsxs)(g8,{className:`cteditor-w-auto !cteditor-p-3 cteditor-border-none !cteditor-z-[99999]`,sideOffset:5,id:`floating-highlight-color-picker`,children:[o.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Recently used`}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-1.5 [&>button]:cteditor-rounded-full`,children:o.map((e,t)=>(0,X.jsx)(d,{color:e.type===`text`?`transparent`:e.color,label:e.type===`text`?`Text: ${e.color}`:`Background: ${e.color}`,onClick:()=>e.type===`text`?u(e.color):l(e.color),children:e.type===`text`&&(0,X.jsx)(`span`,{className:`cteditor-font-bold cteditor-text-xs`,style:{color:e.color},children:`A`})},`${e.color}-${e.type}-${t}`))})]}),t&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Text color`}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-5 cteditor-gap-1.5`,children:t8t.map(({color:e,label:t})=>(0,X.jsx)(d,{color:e,label:t,onClick:()=>u(e),children:(0,X.jsx)(`span`,{className:`cteditor-font-bold cteditor-text-xs`,style:{color:e===`#000000`?`#fff`:e},children:`A`})},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Background color`}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-5 cteditor-gap-1.5`,children:n8t.map(({color:e,label:t})=>(0,X.jsx)(d,{color:e,label:t,onClick:()=>l(e===`transparent`?null:e),showX:e===`transparent`},e))})]})]})]})},j9=di(`TEXT_ENHANCE_COMMAND`),a8t=({children:e,trigger:t})=>{let[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return n&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]),(0,X.jsxs)(`div`,{ref:i,className:`cteditor-relative`,children:[(0,X.jsx)(`div`,{onClick:()=>r(!n),children:t}),n&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-top-full cteditor-left-0 cteditor-mt-2 cteditor-bg-dropdown cteditor-border cteditor-border-foreground/10 cteditor-text-foreground cteditor-rounded-xl ct-menu-shadow cteditor-z-50 cteditor-min-w-44 cteditor-p-1 improve-dropdown`,children:(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:typeof e==`function`?e({close:()=>r(!1)}):e})})]})},M9=({children:e,onClick:t,className:n=``})=>(0,X.jsx)(`button`,{className:`cteditor-w-full cteditor-rounded-md cteditor-px-2 cteditor-py-1 cteditor-text-left cteditor-text-[13px] cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-transition-colors cteditor-duration-150 improve-dropdown-item block hover:cteditor-bg-foreground/5`+(n?` ${n}`:``),onClick:t,type:`button`,children:e}),o8t=()=>{let[e]=Gd(),{isHtmlView:t,setHtmlContent:n,setRawHtmlForApply:r,canUpdateFromEditor:i}=F0(),a=(0,Q.useRef)(``),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{t&&!c.current&&e.getEditorState().read(()=>{let t=Dd(e,null);a.current=t,r(t),n(sFt(t))}),c.current=t},[t,e,n,r]),(0,Q.useEffect)(()=>{if(t)return e.registerUpdateListener(({editorState:t,dirtyElements:c,dirtyLeaves:l})=>{if(s.current){s.current=!1;return}i&&(c.size>0||l.size>0)&&(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i&&t.read(()=>{let t=Dd(e,null);t!==a.current&&(a.current=t,r(t),n(sFt(t)))})},500))})},[e,t,n,r,i]),(0,Q.useEffect)(()=>(e._markAsHtmlUpdate=()=>{s.current=!0},()=>{delete e._markAsHtmlUpdate}),[e]),(0,Q.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),null},N9=`<div data-chart-loading="1"></div>`,s8t={SPELLING_GRAMMAR:`fix_grammar`,SIMPLIFY:`simplify`,COMPLETE_SENTENCE:`complete`,AI_RESPONSE:`general`,EMOJIFY:`emojify`,MAKE_LONGER:`make_longer`,MAKE_SHORTER:`make_shorter`,TRANSLATE:`translate`,ADJUST_TONE:`change_tone`,ENHANCE_WITH_AI:`enhance_with_ai`},P9=320,c8t=/^(---|___|\*\*\*)$/,F9=/^(#{1,6})\s$/,I9=/^(\*|-|\+)\s$/,L9=/^(\d+)[\.\)]\s$/,R9=/^\[(x|\s)?\]\s$/i,z9=/^>\s$/,l8t=/^```$/,u8t={Digit1:`h1`,Digit2:`h2`,Digit3:`h3`,Digit4:`h4`,Digit5:`h5`,Digit6:`h6`},d8t={KeyL:`left`,KeyE:`center`,KeyR:`right`,KeyJ:`justify`},f8t=8,p8t=400,B9=16,m8t=2,V9=[{id:`youtube`,label:`YouTube`,match:[`youtube.com`,`youtu.be`],tint:`cteditor-bg-red-500/12 cteditor-text-red-600 dark:cteditor-text-red-400`,accent:`cteditor-from-[#ff4d4d] cteditor-to-[#c62828]`},{id:`vimeo`,label:`Vimeo`,match:[`vimeo.com`],tint:`cteditor-bg-sky-500/12 cteditor-text-sky-700 dark:cteditor-text-sky-400`,accent:`cteditor-from-[#1ab7ea] cteditor-to-[#0d8ecf]`},{id:`loom`,label:`Loom`,match:[`loom.com`],tint:`cteditor-bg-violet-500/12 cteditor-text-violet-700 dark:cteditor-text-violet-300`,accent:`cteditor-from-[#7b61ff] cteditor-to-[#625df5]`},{id:`supercut`,label:`SuperCut`,match:[`supercut.video`],tint:`cteditor-bg-amber-500/12 cteditor-text-amber-700 dark:cteditor-text-amber-300`,accent:`cteditor-from-[#f59e0b] cteditor-to-[#d97706]`},{id:`jam`,label:`Jam`,match:[`jam.dev`],tint:`cteditor-bg-emerald-500/12 cteditor-text-emerald-700 dark:cteditor-text-emerald-300`,accent:`cteditor-from-[#10b981] cteditor-to-[#059669]`}],H9=class extends Eae{label;onSelect;enabled;featureName;planAllows;skipTriggerCleanup;newKey;constructor(e,t,n=!0,r,i=!0,a=!1,o){super(e),this.label=e,this.onSelect=t,this.enabled=n,this.featureName=r||e,this.planAllows=i,this.skipTriggerCleanup=a,this.newKey=o}},U9=!1,h8t=[`#d0021b`,`#f5a623`,`#f8e71c`,`#8b572a`,`#7ed321`,`#417505`,`#bd10e0`,`#9013fe`,`#4a90e2`,`#50e3c2`,`#b8e986`,`#000000`,`#4a4a4a`,`#9b9b9b`,`#ffffff`],g8t=24,_8t=2,v8t=[{value:`left`,label:`Left`,Icon:l3},{value:`center`,label:`Center`,Icon:u3},{value:`right`,label:`Right`,Icon:d3}],y8t=[{value:`top`,label:`Top`,Icon:Eqt},{value:`middle`,label:`Middle`,Icon:Dqt},{value:`bottom`,label:`Bottom`,Icon:Oqt}],W9=33,G9=50,b8t=80,K9=8,q9=16,J9=12,x8t=120*1e3,S8t=({licenseKey:e,syncIntervalMs:t=x8t})=>{let[n]=Gd(),r=(0,Q.useRef)({characters:0,words:0}),i=(0,Q.useRef)({characters:0,words:0}),a=(0,Q.useRef)(!1),o=(0,Q.useCallback)(async()=>{if(!e||a.current)return;let{characters:t,words:n}=i.current;if(!(t===0&&n===0)){a.current=!0;try{await B0.post(`/api/analytics/track-usage`,{licenseKey:e,characters:t,words:n}),i.current={characters:0,words:0}}catch(e){console.error(`Failed to sync usage stats:`,e)}finally{a.current=!1}}},[e]);return(0,Q.useEffect)(()=>{if(!e)return;let a=n.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=Yi().getTextContent(),t=e.trim().split(/\s+/).filter(e=>e.length>0).length,n=e.replace(/\s/g,``).length,a=Math.max(0,n-r.current.characters),o=Math.max(0,t-r.current.words);r.current={characters:n,words:t},(a>0||o>0)&&(i.current.characters+=a,i.current.words+=o)})}),s=setInterval(o,t),c=()=>{let{characters:t,words:n}=i.current;if(t>0||n>0){let r=JSON.stringify({licenseKey:e,characters:t,words:n}),i=B0.defaults.baseURL||``;navigator.sendBeacon(`${i}/api/analytics/track-usage`,new Blob([r],{type:`application/json`}))}},l=()=>{document.visibilityState===`hidden`&&o()};return window.addEventListener(`beforeunload`,c),document.addEventListener(`visibilitychange`,l),()=>{a(),clearInterval(s),o(),window.removeEventListener(`beforeunload`,c),document.removeEventListener(`visibilitychange`,l)}},[n,e,o,t]),null},C8t=di(`INSERT_VIDEO_COMMAND`),w8t=({captionsEnabled:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>{if(!t.hasNodes([D8]))throw Error(`VideoPlugin: VideoNode not registered on editor`);return Gu(t.registerCommand(C8t,t=>{let n=R1({...t,captionsEnabled:e});return xs([n]),ja(n.getParentOrThrow())&&Qu(n,Qs).selectEnd(),!0},0))},[e,t]),null},T8t=({size:e=14,className:t=``})=>(0,X.jsx)(`img`,{src:ajt(`LogoIcon.svg`),alt:`eddyter`,width:e,height:e,className:`cteditor-invert dark:cteditor-invert-0 ${t}`.trim(),loading:`eager`}),E8t=({isWordCountEnabled:e,fitToPage:t,enableFeatureSuggestion:n=!0,enableBugReport:r=!0})=>{let i=Gd()[0],a=K0()?.hideBranding??!1,[o,s]=(0,Q.useState)({words:0,characters:0}),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>i.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=Yi().getTextContent(),t=e.trim().split(/\s+/).filter(e=>e.length>0).length,n=e.replace(/\s/g,``).length;s({words:t,characters:n})})}),[i]);let f=`cteditor-pointer-events-auto cteditor-inline-flex cteditor-items-center cteditor-gap-1.5 cteditor-cursor-pointer cteditor-text-foreground/60 hover:cteditor-text-foreground cteditor-transition-colors [&>svg]:cteditor-size-3.5 cteditor-px-1 cteditor-py-1.5 max-sm:cteditor-hidden`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`wordCount cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-xs cteditor-text-foreground/70 cteditor-py-1 cteditor-px-3 cteditor-z-[5] cteditor-pointer-events-none ${t?`cteditor-fixed cteditor-bottom-2 cteditor-inset-x-0`:`cteditor-absolute cteditor-bottom-0 cteditor-inset-x-0`}`,children:[e&&(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3`,children:[(0,X.jsxs)(`span`,{children:[`Words: `,(0,X.jsx)(`b`,{className:`cteditor-font-semibold cteditor-tabular-nums`,children:o.words})]}),(0,X.jsxs)(`span`,{children:[`Characters:`,` `,(0,X.jsx)(`b`,{className:`cteditor-font-semibold cteditor-tabular-nums`,children:o.characters})]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1`}),n&&(0,X.jsxs)(`button`,{type:`button`,className:f,onClick:()=>l(!0),children:[(0,X.jsx)(v2,{size:12}),`Suggest a Feature`]}),r&&(0,X.jsxs)(`button`,{type:`button`,className:f,onClick:()=>d(!0),children:[(0,X.jsx)(a2,{size:12}),`Report a Bug`]}),!a&&(0,X.jsxs)(`span`,{className:`cteditor-inline-flex cteditor-items-center cteditor-gap-1.5`,children:[(0,X.jsx)(T8t,{size:14,className:`cteditor-shrink-0`}),(0,X.jsx)(`span`,{className:`cteditor-font-medium cteditor-text-foreground/80`,children:`eddyter`})]}),(0,X.jsxs)(`span`,{className:`cteditor-text-[10px] cteditor-text-muted-foreground cteditor-font-mono`,children:[`v`,`1.4.21-beta.0`]})]}),n&&(0,X.jsx)($Rt,{open:c,onOpenChange:l}),r&&(0,X.jsx)(XRt,{open:u,onOpenChange:d})]})},D8t=({minHeight:e=150,maxHeight:t=null,transitionDuration:n=200}={})=>{let[r,i]=(0,Q.useState)(e),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let n=a.current;if(!n)return;let s=()=>{let a=n.scrollHeight,o=Math.max(e,Math.min(t??1/0,a));o!==r&&i(o)};s(),window.ResizeObserver&&(o.current=new ResizeObserver(()=>{s()}),o.current.observe(n));let c=new MutationObserver(()=>{s(),n.querySelectorAll(`img`).forEach(e=>{e.addEventListener(`load`,s,{once:!0})})});c.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let l=()=>s();return n.addEventListener(`input`,l),n.addEventListener(`load`,s,!0),()=>{o.current&&o.current.disconnect(),c.disconnect(),n.removeEventListener(`input`,l),n.removeEventListener(`load`,s,!0)}},[e,t,r]),{height:r,contentRef:a,style:{height:`${r}px`,transition:`height ${n}ms ease-in-out`,overflow:`auto`}}},O8t=()=>({contentEditable:k$(`cteditor-relative cteditor-min-h-[300px] cteditor-rounded-xl !cteditor-h-auto cteditor-resize-none !cteditor-outline-none cteditor-content cteditor-pt-5 cteditor-pb-12 cteditor-px-7`,`cteditor-text-foreground cteditor-border cteditor-border-foreground/10 cteditor-bg-card-content`,`cteditor-font-geist cteditor-text-base`,`cteditor-caret-[#3b82f6] cteditor-p-0 cteditor-transition-all cteditor-duration-200`,`cteditor-w-full `,`[&>hr]:cteditor-border-none [&>hr]:cteditor-h-[2px]`),placeholder:k$(`cteditor-absolute cteditor-top-7 cteditor-left-7 cteditor-text-sm cteditor-opacity-50`,`cteditor-overflow-hidden cteditor-text-ellipsis md:cteditor-whitespace-nowrap cteditor-max-w-[calc(100%-1.5rem)]`,`cteditor-select-none cteditor-pointer-events-none cteditor-inline-block`)}),k8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(JOt(),HOt))),A8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(rkt(),XOt))),j8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(hAt(),ikt))),M8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(yAt(),gAt))),N8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(wAt(),bAt))),P8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(NAt(),TAt))),F8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(YAt(),PAt))),I8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>($At(),XAt))),L8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(ijt(),ejt))),R8t=e=>{let[t]=Gd();return(0,X.jsx)(D6t,{...e,editor:t,activeEditor:t,setActiveEditor:e=>{}})},z8t=()=>{let{toolbarState:e}=$8();return!e.isAutocompleteEnabled&&!e.isGrammarCheckEnabled?null:(0,X.jsx)(Q.Suspense,{fallback:null,children:(0,X.jsx)(j8t,{minMatchLength:2,maxSuggestions:10,enableAI:e?.isAutocompleteEnabled??!0})})},B8t=({enabled:e})=>{let{updateToolbarState:t}=$8();return(0,Q.useEffect)(()=>{t(`isInlineAutocompleteEnabled`,!1)},[t]),null},V8t=({onChange:e,immediateExportRef:t,suppressRef:n})=>{let[r]=Gd(),i=(0,Q.useRef)(e),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{i.current=e},[e]);let o=(0,Q.useCallback)(()=>{if(!i.current||n?.current)return;let e=l0(r);i.current(e)},[r,n]),s=(0,Q.useCallback)(()=>{i.current&&(a.current&&clearTimeout(a.current),a.current=setTimeout(o,300))},[r,o]);return(0,Q.useEffect)(()=>{if(t)return t.current=()=>{a.current&&=(clearTimeout(a.current),null),o()},()=>{t.current=null}},[t,o]),(0,Q.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,X.jsx)(_f,{onChange:s,ignoreHistoryMergeTagChange:!1})},H8t=({immediateExportRef:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand(o6,()=>(e.current?.(),!0),0),[t,e]),null},U8t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{let t=e.getRootElement()?.closest(`.eddyter-scope`)??null;if(!t)return;let n=new MutationObserver(()=>{e.dispatchCommand(o6,void 0)});return n.observe(t,{attributes:!0,attributeFilter:[`class`]}),()=>n.disconnect()},[e]),null},W8t=({onOpen:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand(F6t,()=>(e(),!0),1),[t,e]),null},G8t=({onOpen:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand($Yt,()=>(e(),!0),1),[t,e]),null},K8t=`p, h1, h2, h3, h4, h5, h6, li, blockquote`,q8t=({initialContent:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(n||!e)return;r(!0);let i=gRt(e);t.update(()=>{let e=new DOMParser().parseFromString(i,`text/html`),n=nHt(e.body),r=Ed(t,e);rHt(r,n);let a=Yi();a.clear();let o=[],s=[],c=()=>{if(s.length>0){let e=Qs();e.append(...s),o.push(e),s=[]}};for(let e of r)Ws(e)||Ks(e)?(c(),o.push(e)):s.push(e);c(),a.append(...o);for(let e of a.getAllTextNodes()){let t=e.getStyle();if(!t)continue;let n=QVt(t);n!==null&&(iHt(e)||e.setStyle(n))}let l=[],u=[],d=[],f=e=>{if(!e.startsWith(`__EDDYTER_CHART__`))return null;let t=e.slice(17).split(`::`);if(t.length!==2&&t.length!==4)return null;try{let e=decodeURIComponent(t[0]);if(!e)return null;let n,r=decodeURIComponent(t[1]);if(r)try{n=JSON.parse(r)}catch{n=void 0}let i,a;if(t.length===4){let e=Number(decodeURIComponent(t[2])),n=Number(decodeURIComponent(t[3]));i=Number.isFinite(e)&&e>0?e:void 0,a=Number.isFinite(n)&&n>0?n:void 0}return{html:e,metadata:n,width:i,height:a}}catch{return null}},p=e=>{if(!e.startsWith(`__EDDYTER_EMBED__`))return null;let t=e.slice(17).split(`::`);if(t.length<2)return null;let n=t[0]?.toLowerCase(),r=t[1]||``,i=n===`url`||n===`card`||n===`embed`?n:`embed`,a=t[2]?.toLowerCase(),o=t[3]?.toLowerCase(),s=Number(t[4]),c=Number(t[5]),l=a===`center`||a===`right`?a:`left`,u=o===`left`||o===`right`?o:`none`,d=Number.isFinite(s)&&s>0?s:560,f=Number.isFinite(c)&&c>0?c:315;try{let e=decodeURIComponent(r);return e?{url:e,displayType:i,alignment:l,position:u,width:d,height:f}:null}catch{return null}},m=e=>{if(!e.startsWith(`__EDDYTER_FILE__`))return null;let t=e.slice(16).split(`::`);if(t.length<3)return null;let n=t[0]?.toLowerCase(),r=t[1]||``,i=t[2]||``,a=Number(t[3]),o=n===`inline`?`inline`:`card`;try{let e=decodeURIComponent(r),t=decodeURIComponent(i);return!e||!t?null:{src:e,fileName:t,fileSize:Number.isFinite(a)&&a>0?a:void 0,displayType:o}}catch{return null}},h=e=>{let t=e.trim();if(!t)return null;try{let e=new URL(t),n=e.hostname.toLowerCase(),r=e.pathname;if(n.includes(`youtube.com`)){let t=e.searchParams.get(`v`);if(t)return`https://www.youtube.com/watch?v=${t}`;let n=r.match(/\/embed\/([a-zA-Z0-9_-]+)/i);if(n?.[1])return`https://www.youtube.com/watch?v=${n[1]}`}if(n.includes(`youtu.be`)){let e=r.split(`/`).filter(Boolean)[0];if(e)return`https://www.youtube.com/watch?v=${e}`}if(n.includes(`vimeo.com`)){let e=r.match(/\/video\/(\d+)/i);if(e?.[1])return`https://vimeo.com/${e[1]}`;let t=r.match(/\/(\d+)(?:\/)?$/);if(t?.[1])return`https://vimeo.com/${t[1]}`}if(n.includes(`loom.com`)){let e=r.match(/\/share\/([a-zA-Z0-9_-]+)/i);if(e?.[1])return`https://www.loom.com/share/${e[1]}`;let t=r.match(/\/embed\/([a-zA-Z0-9_-]+)/i);if(t?.[1])return`https://www.loom.com/share/${t[1]}`}if(n.includes(`supercut.video`)){let e=r.match(/\/embed\/([^/]+)\/([^/?#]+)/i);if(e?.[1]&&e?.[2])return`https://supercut.video/${e[1]}/${e[2]}`;let t=r.split(`/`).filter(Boolean);if(t.length>=2)return`https://supercut.video/${t[0]}/${t[1]}`}if(n.includes(`jam.dev`)){let e=r.match(/\/video\/([^/?#]+)/i);if(e?.[1])return`https://jam.dev/c/${e[1]}`;let t=r.match(/\/c\/([^/?#]+)/i);if(t?.[1])return`https://jam.dev/c/${t[1]}`}if(n.includes(`figma.com`)){if(r.includes(`/embed`)){let t=e.searchParams.get(`url`);if(t)return t}return t}}catch{return null}return null},g=e=>{if($s(e)){let t=e.getTextContent().trim(),n=f(t);if(n){let t=e.getParent();if(t&&Vf(t))return;d.push({node:e,html:n.html,metadata:n.metadata,width:n.width,height:n.height});return}let r=p(t);if(r){let t=e.getParent();if(t&&Vf(t))return;l.push({node:e,url:r.url,displayType:r.displayType,alignment:r.alignment,position:r.position,width:r.width,height:r.height});return}let i=m(t);if(i){let t=e.getParent();if(t&&Vf(t))return;u.push({node:e,src:i.src,fileName:i.fileName,fileSize:i.fileSize,displayType:i.displayType});return}let a=h(t);if(!a)return;let o=e.getParent();if(o&&Vf(o))return;let s=a.toLowerCase().includes(`figma.com`)?`card`:`embed`;l.push({node:e,url:a,displayType:s,alignment:`left`,position:`none`,width:560,height:315});return}if(Jo(e)){let t=e.getTextContent().trim(),n=m(t),r=p(t);if(!n&&!r)return;let i=e.getParent();if(!i||Vf(i))return;Nd(i)&&(n?u.push({node:e,src:n.src,fileName:n.fileName,fileSize:n.fileSize,displayType:n.displayType}):r&&l.push({node:e,url:r.url,displayType:r.displayType,alignment:r.alignment,position:r.position,width:r.width,height:r.height}));return}if(Ws(e)){e.getChildren().forEach(g);return}};a.getChildren().forEach(g),l.forEach(({node:e,url:t,displayType:n,alignment:r,position:i,width:a,height:o})=>{let s=f1(t,n,r,a,o,i);if(Jo(e)&&Nd(e.getParent())){let t=Qs();t.append(s),e.replace(t);return}e.replace(s)}),u.forEach(({node:e,src:t,fileName:n,fileSize:r,displayType:i})=>{let a=E1({src:t,fileName:n,fileSize:r,displayType:i});if(Jo(e)&&Nd(e.getParent())){let t=Qs();e.replace(t),t.append(a);return}e.replace(a)}),d.forEach(({node:e,html:t,metadata:n,width:r,height:i})=>{let a=t;if(n)try{a=M1(n)}catch{}let o=N1(a,n,r,i);if(Jo(e)&&Nd(e.getParent())){let t=Qs();e.replace(t),t.append(o);return}e.replace(o)}),a.getChildren().forEach(t=>{if(Sp(t)){let n=t.getChildren();if(n.length>0){let t=n[0];if(Uf(t)){let n=t.getChildren(),r=!1;e.querySelectorAll(`table`).forEach(e=>{let t=e.querySelector(`tr`);t&&t.querySelectorAll(`th`).length>0&&(r=!0)}),r&&n.forEach(e=>{Vf(e)&&e.setHeaderStyles(wp.COLUMN)})}}}}),a.selectEnd()}),requestAnimationFrame(()=>{let e=t.getRootElement();if(!e)return;let n=new DOMParser().parseFromString(i,`text/html`).querySelectorAll(`table`),r=e.querySelectorAll(`table`);r.forEach((e,t)=>{let r=n[t];if(!r)return;let i=r.style.getPropertyValue(`--table-odd-striping-color`),a=r.style.getPropertyValue(`--table-even-striping-color`),o=r.style.getPropertyValue(`--table-header-bg-color`),s=r.style.getPropertyValue(`--table-border-color`),c=r.style.getPropertyValue(`--table-border-size`),l=r.classList.contains(`has-header-row`),u=r.classList.contains(`table-custom-border`),d=r.classList.contains(`table-border-none`)||r.getAttribute(`data-border-none`)===`true`,f=e.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`)||e,p=e=>{if(!e)return``;if(e=e.trim().toLowerCase(),e.startsWith(`#`))return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e;if(e.includes(`rgb`)){let t=e.match(/\d+/g);if(t&&t.length>=3){let e=parseInt(t[0]),n=parseInt(t[1]),r=parseInt(t[2]);return`#${e.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}return e},m=p(i),h=p(a),g=Array.from(r.querySelectorAll(`tr`)),_=Array.from(e.querySelectorAll(`tr`));if(g.forEach((e,t)=>{let n=_[t];if(!n)return;let r=e.querySelectorAll(`td, th`),i=n.querySelectorAll(`td, th`);r.length===i.length&&r.forEach((e,t)=>{let n=i[t];if(!n)return;let r=e,a=r.style.backgroundColor,o=r.style.color;a&&n.style.setProperty(`background-color`,a,`important`),o&&n.style.setProperty(`color`,o,`important`)})}),i||a){let t=Array.from(e.querySelectorAll(`tr`));(l?t.slice(1):t).forEach(e=>{e.querySelectorAll(`td`).forEach(e=>{let t=e,n=t.style.backgroundColor,r=p(n);(r===m||r===h||!n)&&(t.style.removeProperty(`background-color`),t.style.removeProperty(`color`),e.querySelectorAll(`*`).forEach(e=>{e.style.removeProperty(`color`)}))})})}i&&(f.style.setProperty(`--table-odd-striping-color`,i),f.classList.add(`table-custom-odd-striping`)),a&&(f.style.setProperty(`--table-even-striping-color`,a),f.classList.add(`table-custom-even-striping`)),o&&(f.style.setProperty(`--table-header-bg-color`,o),e.style.setProperty(`--table-header-bg-color`,o)),(u||s||c)&&(f.classList.add(`table-custom-border`),e.classList.add(`table-custom-border`)),s&&(f.style.setProperty(`--table-border-color`,s),e.style.setProperty(`--table-border-color`,s)),c&&(f.style.setProperty(`--table-border-size`,c),e.style.setProperty(`--table-border-size`,c)),d?(f.classList.add(`table-border-none`),e.classList.add(`table-border-none`),e.setAttribute(`data-border-none`,`true`)):(f.classList.remove(`table-border-none`),e.classList.remove(`table-border-none`),e.removeAttribute(`data-border-none`)),l&&f.classList.add(`has-header-row`)});let a=QLt();if(a&&a.length>0&&r.length===a.length){let e=eRt(t);e.forEach((e,t)=>{XLt(e,a[t]!==!1)}),r.forEach((n,r)=>{let i=a[r]!==!1,o=n;o.setAttribute(`data-table-full-width`,i?`true`:`false`),i?(o.style.setProperty(`width`,`100%`,`important`),o.style.setProperty(`max-width`,`100%`,`important`),o.style.setProperty(`min-width`,`0`,`important`)):(o.style.removeProperty(`width`),o.style.removeProperty(`max-width`),o.style.removeProperty(`min-width`)),t.getEditorState().read(()=>{let a=Ui(e[r]);if(Sp(a)){let e=o.querySelector(`colgroup`),r=a.getColumnCount();if(e&&r>0){let s=e.querySelectorAll(`col`);if(i){let e=n.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`),i=t.getRootElement(),a=(e??i)?.clientWidth??0,c=Math.max(0,a-24);if(c>0){let e=Math.floor(c/r);o.style.setProperty(`width`,`${c}px`,`important`),s.forEach(t=>{t.style.setProperty(`width`,`${e}px`,`important`)})}else{let e=100/r;s.forEach(t=>{t.style.setProperty(`width`,`${e}%`,`important`)})}}else{let e=a.getColWidths();s.forEach((t,n)=>{let r=e?.[n],i=t;r==null?i.style.removeProperty(`width`):i.style.setProperty(`width`,`${r}px`,`important`)})}}}});let s=n.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`);s&&(i?(s.classList.add(`table-full-width-active`),s.style.setProperty(`width`,`100%`,`important`),s.style.setProperty(`max-width`,`100%`,`important`),s.style.setProperty(`overflow-x`,`hidden`,`important`)):(s.classList.remove(`table-full-width-active`),s.style.removeProperty(`width`),s.style.removeProperty(`max-width`),s.style.removeProperty(`overflow-x`)))})}})},[t,e,n]),null},J8t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{let t=()=>{let t=e.getRootElement();t&&e.getEditorState().read(()=>{t.querySelectorAll(`table`).forEach(e=>{e.querySelectorAll(`td, th`).forEach(e=>{let t=e,n=Object.keys(t).find(e=>e.startsWith(`__reactProps`))?t.__lexicalKey:void 0;if(n)try{let e=Ui(n);if(Vf(e)){let n=e.getBackgroundColor();if(n){let r=n.replace(`#`,``),i=parseInt(r.substr(0,2),16),a=parseInt(r.substr(2,2),16),o=parseInt(r.substr(4,2),16),s=(.299*i+.587*a+.114*o)/255>.5?`#000000`:`#FFFFFF`;t.style.setProperty(`background-color`,n,`important`),t.style.setProperty(`color`,s,`important`),t.style.setProperty(`border-color`,`#bbb`,`important`),t.querySelectorAll(`*`).forEach(e=>{e instanceof HTMLElement&&e.style.setProperty(`color`,s,`important`)}),e.getHeaderStyles()&&t.style.setProperty(`font-weight`,`600`,`important`)}}}catch{}})})})},n=e.registerUpdateListener(()=>{requestAnimationFrame(t)});return t(),()=>{n()}},[e]),null},Y8t=({config:e,defaultFontFamilies:t,mentionUserList:n,currentUser:r,initialContent:i,onChange:a,apiKey:o,toolbarConfig:s,contentClassName:c,editorStyle:l,floatingToolbarClassName:u,fitToPage:d=!1,documentId:f=null,documentIdIsFallback:p=!1,saveVersionApiRef:m})=>{let h=K0();h?.isPaidPlan;let g=!h?.isByokPlan||!!(h?.byokApiKeys?.hasOpenaiKey||h?.byokApiKeys?.hasAnthropicKey||h?.byokApiKeys?.hasGrokKey||h?.byokApiKeys?.hasGeminiKey),_=e.toolbarOptions.enableInlineAutocompleteToggle!==!1&&g,v={mode:s?.mode??(d?`static`:`sticky`),offset:typeof s?.offset==`number`?s.offset:20,zIndex:typeof s?.zIndex==`number`?s.zIndex:1e3},y=(0,Q.useRef)(null),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(null),S=O8t(),[C,w]=(0,Q.useState)(!1),{contentRef:T,style:E}=D8t({minHeight:150,maxHeight:typeof l?.maxHeight==`number`?l.maxHeight:void 0,transitionDuration:200}),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[ee,L]=(0,Q.useState)(0),[te,R]=(0,Q.useState)(!1),ne=e.toolbarOptions.enableVersionHistory!==!1,re=ne&&!!o,ie=(0,Q.useRef)(null),ae=m??ie,z=e=>{e!==null&&M(e)};return(0,Q.useEffect)(()=>{let e=()=>{let e=Iee&&window.matchMedia(`(max-width: 1025px)`).matches;e!==N&&P(e)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[N]),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(JUt,{currentUser:r,mentionUserList:n,children:(0,X.jsxs)(sne,{initialConfig:{...X8},children:[(0,X.jsx)(W8t,{onOpen:()=>I(!0)}),re&&(0,X.jsx)(G8t,{onOpen:()=>R(!0)}),(0,X.jsx)(YLt,{children:(0,X.jsx)(lHt,{children:(0,X.jsxs)(E$t,{children:[(0,X.jsxs)(`div`,{className:`main-container cteditor-flex cteditor-flex-col`,ref:x,children:[e.enableToolbar&&(0,X.jsx)(Vzt,{editorRef:x,mode:v.mode,topOffset:v.offset,zIndex:v.zIndex,floatingToolbarClassName:u,className:d?`cteditor-sticky cteditor-top-0 cteditor-z-50 `:``,children:(0,X.jsxs)(`div`,{className:`toolbar-content cteditor-flex cteditor-justify-between cteditor-items-center`,children:[(0,X.jsx)(R8t,{fitToPage:d,editable:!0,...e.toolbarOptions,fonts:t,isCommentOpen:F,onToggleComment:()=>I(!F),commentCount:ee}),re?(0,X.jsx)(ZYt,{fitToPage:d,isOpen:te,onClick:()=>R(!te)}):ne?null:(0,X.jsx)(r6,{isEnabled:!1,planAllows:!1,featureName:`Version History`,variant:`overlay`,children:(0,X.jsx)(ZYt,{fitToPage:d,isOpen:!1,onClick:()=>{}})})]})}),(0,X.jsxs)(`div`,{className:e.enableToolbar?`cteditor-relative editor-area cteditor-pt-1.5 ${d?`cteditor-text-foreground`:``}`.trim():`cteditor-relative ${d?`cteditor-text-foreground`:``}`.trim(),children:[(0,X.jsx)(Are,{contentEditable:(0,X.jsx)(`div`,{className:`editor-scroller`,children:(0,X.jsx)(`div`,{ref:z,className:`editor-anchor`,children:(0,X.jsx)($d,{ref:T,className:`eddyter-content-root ${S.contentEditable} ${c||``} ${d?` !cteditor-bg-transparent !cteditor-text-foreground !cteditor-border-none`:``}`.trim(),style:{tabSize:1,...E,...l}})})}),placeholder:(0,X.jsx)(OXt,{className:S.placeholder,children:(0,X.jsx)(OHt,{})}),ErrorBoundary:Ene}),(0,X.jsx)(E8t,{isWordCountEnabled:e.toolbarOptions.enableWordCount,fitToPage:d,enableFeatureSuggestion:e.toolbarOptions.enableFeatureSuggestion!==!1,enableBugReport:e.toolbarOptions.enableBugReport!==!1}),(0,X.jsx)(S8t,{licenseKey:o})]})]}),(0,X.jsxs)(Q.Suspense,{fallback:null,children:[e.toolbarOptions.enableMentions!==!1&&(0,X.jsx)(F8t,{userList:n}),e.toolbarOptions.enableNotePanels!==!1&&(0,X.jsx)(I8t,{}),e.toolbarOptions.enableComments===!0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N8t,{}),(0,X.jsx)(M8t,{})]})]}),(0,X.jsx)(J8t,{}),(0,X.jsx)(B8t,{enabled:_}),_&&(0,X.jsx)(PBt,{apiKey:o,debounceDelay:e.inlineAutocompleteOptions?.debounceDelay??400,minContextLength:e.inlineAutocompleteOptions?.minContextLength??10}),e.htmlViewOption===!0&&(0,X.jsx)(DXt,{}),e.toolbarOptions.enableAIChat===!0&&(0,X.jsxs)(Q.Suspense,{fallback:null,children:[(0,X.jsx)(k8t,{}),(0,X.jsx)(A8t,{apiKey:o}),(0,X.jsx)(L8t,{apiKey:o})]}),(0,X.jsx)(o8t,{}),re&&o&&(0,X.jsx)(ZNt,{apiKey:o,documentId:f,saveVersionApiRef:ae}),(0,X.jsx)(y3t,{}),(0,X.jsx)(Hzt,{}),e.toolbarOptions.enableCodeFormat!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j6t,{}),(0,X.jsx)(Wzt,{}),(0,X.jsx)(Gzt,{})]}),(0,X.jsx)(xVt,{}),(0,X.jsx)(iVt,{options:{headings:e.toolbarOptions.enableHeadings!==!1,lists:e.toolbarOptions.enableLists!==!1,blockquote:e.toolbarOptions.enableBlockquote!==!1,codeBlock:e.toolbarOptions.enableCodeFormat!==!1,todoList:e.toolbarOptions.enableTodoList!==!1,alignment:e.toolbarOptions.enableAlignment!==!1,links:e.toolbarOptions.enableLinks!==!1,horizontalRule:e.toolbarOptions.enableHorizontalLine!==!1,table:e.toolbarOptions.enableTableOptions!==!1,aiChat:e.toolbarOptions.enableAIChat!==!1,clearFormatting:e.toolbarOptions.enableClearOptions!==!1,fontSize:e.toolbarOptions.enableFontControls!==!1}}),(0,X.jsx)(H3t,{}),(0,X.jsx)(q6t,{}),(e.toolbarOptions.enableColumns!==!1||e.toolbarOptions.enableButtonBlock!==!1)&&(0,X.jsx)(K3t,{}),e.toolbarOptions.enableColumns!==!1&&(0,X.jsx)(M6t,{anchorElem:j??void 0}),e.toolbarOptions.enablePatterns!==!1&&(0,X.jsx)(Y3t,{}),(0,X.jsx)(W3t,{}),(0,X.jsx)(qBt,{}),e.toolbarOptions.enableAutoCorrection!==!1&&(0,X.jsx)(z8t,{}),(0,X.jsx)(V8t,{onChange:a,immediateExportRef:y,suppressRef:b}),(0,X.jsx)(H8t,{immediateExportRef:y}),(0,X.jsx)(U8t,{}),(0,X.jsx)(q8t,{initialContent:i}),(0,X.jsx)(sf,{}),(0,X.jsx)(E9,{namespace:X8.namespace}),e.toolbarOptions.enableLists!==!1&&(0,X.jsx)(Xne,{}),e.toolbarOptions.enableLinks!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(FBt,{hasLinkAttributes:!1}),(0,X.jsx)(IBt,{apiKey:o})]}),(0,X.jsx)(iBt,{}),(0,X.jsx)(oBt,{}),(0,X.jsx)(rFt,{}),(0,X.jsx)(pVt,{}),e.toolbarOptions.enableFileAttachments!==!1&&(0,X.jsx)(O3t,{}),e.toolbarOptions.enableHorizontalLine!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(qne,{}),(0,X.jsx)(VQt,{}),(0,X.jsx)(KQt,{})]}),e.toolbarOptions.enableTodoList!==!1&&(0,X.jsx)($te,{}),(e.toolbarOptions.enableImageUpload!==!1||e.toolbarOptions.enableImageOptions!==!1)&&(0,X.jsx)(S3t,{}),(0,X.jsx)(w8t,{captionsEnabled:!0}),e.toolbarOptions.enableSignature!==!1&&(0,X.jsx)(GLt,{}),e.toolbarOptions.enableTableOptions!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tie,{hasCellMerge:!0,hasCellBackgroundColor:!0,hasHorizontalScroll:!0}),(0,X.jsx)(qVt,{}),(0,X.jsx)(HVt,{})]}),e.toolbarOptions.enableEmbeds!==!1&&(0,X.jsx)(Q.Suspense,{fallback:null,children:(0,X.jsx)(P8t,{floatingAnchorElem:j??void 0})}),j&&(0,X.jsxs)(X.Fragment,{children:[e.toolbarOptions.enableDragHandle!==!1&&(0,X.jsx)(cBt,{anchorElem:j}),e.toolbarOptions.enableTableOptions!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(BVt,{anchorElem:j,cellMerge:!0,isSmallWidthViewport:N}),(0,X.jsx)(KVt,{anchorElem:j})]}),e.toolbarOptions.enableCodeFormat!==!1&&(0,X.jsx)(Rjt,{anchorElem:j}),e.toolbarOptions.enableLinks!==!1&&(0,X.jsx)(vBt,{anchorElem:j,isLinkEditMode:C,setIsLinkEditMode:w}),e.enableFloatingMenu&&(0,X.jsx)(wBt,{anchorElem:j,setIsLinkEditMode:w,features:e.floatingMenuOptions}),e.toolbarOptions.enableFileAttachments!==!1&&(0,X.jsx)(mBt,{anchorElem:j})]})]})})}),(0,X.jsx)(eqt,{isOpen:F,onClose:()=>I(!1),onCommentCountChange:L}),re&&o&&(0,X.jsx)(YYt,{isOpen:te,onClose:()=>R(!1),apiKey:o,documentId:f,documentIdIsFallback:p,suppressExportRef:b,boundsRef:x})]})})})},X8t=new Set([`Arial`,`Courier New`,`Georgia`,`Times New Roman`,`Verdana`,`Comic Sans MS`,`Tahoma`,`Helvetica`]),Z8t={Geist:`Geist:wght@400;500;600;700`,Poppins:`Poppins:wght@400;500;700`,Inter:`Inter:wght@400;500;700`,"DM Sans":`DM+Sans:wght@400;500;700`,Manrope:`Manrope:wght@400;500;700`,"Plus Jakarta Sans":`Plus+Jakarta+Sans:wght@400;500;700`,"Public Sans":`Public+Sans:wght@400;500;700`,Montserrat:`Montserrat:wght@400;500;700`,Raleway:`Raleway:wght@400;500;700`,Lora:`Lora:wght@400;500;700`,Merriweather:`Merriweather:wght@300;400;700;900`,"Playfair Display":`Playfair+Display:wght@400;500;700`,"Libre Baskerville":`Libre+Baskerville:wght@400;700`,"JetBrains Mono":`JetBrains+Mono:wght@400;500;700`,"Fira Code":`Fira+Code:wght@400;500;700`,"Bebas Neue":`Bebas+Neue`},Y9=!1,X9=({children:e,className:t=``,style:n,darkMode:r,floatingToolbarClassName:i=``})=>{let a=(0,Q.useSyncExternalStore)(sHt,oHt,()=>!1),o=r===void 0?a:r,[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{l.current&&c(l.current),aHt(q0.defaultFontFamilies)},[]),(0,X.jsx)(GKt,{value:{isDark:o},children:(0,X.jsx)(IKt,{value:{container:s},children:(0,X.jsxs)(`div`,{id:`ct-editor-f47ac10b`,className:`eddyter-scope cteditor-relative cteditor-w-full cteditor-max-w-full ${o?`dark cteditor-dark`:``} ${t}`.trim(),style:n,children:[e,(0,X.jsx)(`div`,{ref:l,id:`eddyter-portal-container`,className:`eddyter-scope cteditor-relative`})]})})})},vjt(),Q8t=async e=>{try{await B0.post(`/api/analytics/editor-load`,{licenseKey:e})}catch{}},Z9=`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-3 cteditor-min-h-[200px] cteditor-p-5 cteditor-rounded-lg cteditor-text-sm cteditor-font-medium`,$8t=`${Z9} cteditor-border-main-secondary cteditor-bg-background`,e5t=`${Z9} cteditor-bg-red-50 cteditor-text-red-600 cteditor-border cteditor-border-red-200 dark:cteditor-bg-red-950/50 dark:cteditor-text-red-400 dark:cteditor-border-red-900/50`,t5t=`${Z9} cteditor-bg-background cteditor-border cteditor-border-main-secondary`,Q9=({size:e=28,className:t=``,animation:n})=>(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:32.833/30.67*e,viewBox:`0 0 30.670 32.833`,fill:`none`,className:t,"aria-hidden":`true`,children:[n===`pulse`&&(0,X.jsx)(`animate`,{attributeName:`opacity`,values:`1;0.35;1`,dur:`2s`,repeatCount:`indefinite`}),(0,X.jsx)(`path`,{d:`M 16.706 20.063 C 20.581 26.856 21.755 28.531 29.138 26.949 C 29.248 26.926 29.275 26.778 29.176 26.724 L 16.869 19.892 C 16.761 19.832 16.645 19.956 16.706 20.063 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 14.931 19.742 C 15.022 27.563 15.235 29.597 22.459 31.797 C 22.566 31.83 22.661 31.713 22.601 31.618 L 15.156 19.672 C 15.091 19.567 14.93 19.619 14.931 19.742 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 13.538 18.602 C 9.822 25.483 9.021 27.365 14.269 32.795 C 14.347 32.875 14.486 32.82 14.48 32.708 L 13.769 18.649 C 13.763 18.526 13.596 18.493 13.538 18.602 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 12.875 16.928 C 6.286 21.142 4.672 22.398 6.626 29.692 C 6.655 29.801 6.803 29.82 6.853 29.719 L 13.053 17.082 C 13.108 16.971 12.978 16.862 12.875 16.928 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 13.104 15.142 C 5.298 15.628 3.278 15.944 1.446 23.269 C 1.418 23.378 1.539 23.467 1.631 23.403 L 13.186 15.363 C 13.287 15.293 13.227 15.134 13.104 15.142 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 14.172 13.692 C 7.111 10.329 5.191 9.624 0.034 15.14 C -0.043 15.221 0.02 15.358 0.131 15.346 L 14.136 13.925 C 14.258 13.912 14.283 13.745 14.172 13.692 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 15.812 12.943 C 11.27 6.575 9.934 5.027 2.748 7.347 C 2.641 7.381 2.63 7.531 2.733 7.575 L 15.667 13.129 C 15.78 13.178 15.883 13.043 15.812 12.943 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 17.605 13.082 C 16.725 5.311 16.308 3.309 8.899 1.85 C 8.789 1.828 8.706 1.953 8.775 2.042 L 17.388 13.175 C 17.464 13.272 17.619 13.205 17.605 13.082 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.107 14.076 C 22.109 6.854 22.715 4.901 16.946 0.03 C 16.86 -0.043 16.727 0.027 16.744 0.138 L 18.872 14.052 C 18.891 14.174 19.059 14.19 19.107 14.076 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.937 15.674 C 26.067 10.816 27.545 9.403 24.865 2.344 C 24.825 2.239 24.675 2.235 24.636 2.34 L 19.744 15.539 C 19.701 15.654 19.84 15.75 19.937 15.674 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.89 17.474 C 27.607 16.202 29.585 15.684 30.668 8.211 C 30.684 8.1 30.555 8.024 30.47 8.097 L 19.787 17.262 C 19.693 17.342 19.769 17.494 19.89 17.474 Z`,fill:`currentColor`})]}),n5t={display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`10px 16px`,backgroundColor:`rgba(251, 191, 35, 0.06)`,color:`#fbbf23`,border:`1px solid #fbbf23`,borderRadius:6,fontSize:13,lineHeight:1.4,marginBottom:8},r5t={background:`none`,border:`none`,color:`#92400e`,cursor:`pointer`,padding:`2px 6px`,fontSize:18,lineHeight:1,opacity:.7,flexShrink:0},i5t=(0,Q.forwardRef)(({apiKey:e,initialContent:t,onChange:n,defaultFontFamilies:r=q0.defaultFontFamilies||[],mentionUserList:i=q0.mentionUserList||[],onAuthSuccess:a,onAuthError:o,customVerifyKey:s,enableReactNativeBridge:c=EHt(),onEditorReady:l,onFocus:u,onBlur:d,onHeightChange:f,mode:p=`edit`,containerClassName:m=``,className:h=``,style:g,contentClassName:_,editor:v,onPreviewClick:y,darkMode:b,toolbar:x,floatingToolbarClassName:S=``,fitToPage:C=!1,documentId:w},T)=>{let{isAuthenticated:E,isLoading:D,error:O,editorConfig:k,currentUser:A,verifyKey:j,paymentWarning:M,loadTracked:N}=G0(),P=(0,Q.useMemo)(()=>pjt(w),[w]),F=!w?.trim(),I=(0,Q.useRef)(null);(0,Q.useImperativeHandle)(T,()=>({saveVersion:async e=>I.current?I.current(e):{skipped:!0,reason:`unavailable`}}),[]);let ee=(x?.mode??(C?`static`:`sticky`))===`static`,L=v?.maxHeight??(C?`none`:600),te=ee?{maxHeight:L}:void 0,R=(0,Q.useRef)(a),ne=(0,Q.useRef)(o),re=h||m,ie=(0,Q.useRef)(!1),ae=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),[oe,se]=(0,Q.useState)(!1),B=DHt({enabled:c,onReady:l,onFocus:u,onBlur:d,onHeightChange:f});(0,Q.useEffect)(()=>{R.current=a,ne.current=o},[a,o]),(0,Q.useEffect)(()=>{!e||ie.current||(ie.current=!0,(async()=>{try{if(s){let t=await s(e);t.success?R.current?.():ne.current?.(t.message)}else await j(e)}catch(e){ne.current?.(e.message||`Failed to verify API key`)}})())},[e,s,j]),(0,Q.useEffect)(()=>{E&&(R.current?.(),B.notifyAuthSuccess()),O&&(ne.current?.(O),B.notifyAuthError(O))},[E,O,B]),(0,Q.useEffect)(()=>{E&&!ae.current&&e&&!N&&(ae.current=!0,Q8t(e)),E&&!z.current&&(z.current=!0,setTimeout(()=>{B.notifyReady()},100))},[E,e,B,N]);let ce=(0,Q.useCallback)(e=>{n?.(e),B.notifyContentChange(e)},[n,B]);return D?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,children:(0,X.jsxs)(`div`,{className:$8t,children:[(0,X.jsx)(Q9,{size:32,className:`cteditor-text-foreground`,animation:`pulse`}),(0,X.jsx)(`span`,{className:`cteditor-text-muted-foreground`,children:`Loading editor…`})]})}):O?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,children:(0,X.jsxs)(`div`,{className:e5t,children:[(0,X.jsx)(Q9,{size:28,animation:`pulse`}),(0,X.jsx)(`span`,{children:O})]})}):!E||!k?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:(0,X.jsxs)(`div`,{className:t5t,children:[(0,X.jsx)(Q9,{size:28,className:`cteditor-text-muted-foreground`,animation:`pulse`}),(0,X.jsx)(`span`,{className:`cteditor-text-muted-foreground`,children:`Please provide a valid API key to access the editor`})]})}):p===`preview`?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:(0,X.jsx)(`div`,{className:re,style:te||g,onClick:y,dangerouslySetInnerHTML:{__html:t||``}})}):(0,X.jsx)(THt,{children:(0,X.jsxs)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:[M&&!oe&&(0,X.jsxs)(`div`,{style:n5t,children:[(0,X.jsxs)(`span`,{children:[M.message,M.daysRemaining>0&&` (${M.daysRemaining} day${M.daysRemaining===1?``:`s`} remaining)`]}),(0,X.jsx)(`button`,{type:`button`,style:r5t,onClick:()=>se(!0),"aria-label":`Dismiss warning`,onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.7`},children:`✕`})]}),(0,X.jsx)(Y8t,{config:{...k,htmlViewOption:!0},apiKey:e,defaultFontFamilies:r,mentionUserList:i,currentUser:A,initialContent:t,onChange:ce,toolbarConfig:x,contentClassName:_,editorStyle:te,floatingToolbarClassName:S,fitToPage:C,documentId:P,documentIdIsFallback:F,saveVersionApiRef:I})]})})}),i5t.displayName=`ConfigurableEditorWithAuth`})),a5t=_();$9();var o5t=y(),s5t=typeof document>`u`?null:document.currentScript?.src??null;function c5t(){if(typeof document>`u`||document.getElementById(`eddyter-style`)||!s5t)return;let e=document.createElement(`link`);e.id=`eddyter-style`,e.rel=`stylesheet`,e.href=s5t.replace(/editor(\.iife)?\.js(\?.*)?$/,`style.css`),document.head.appendChild(e)}function l5t(e){c5t();let t=typeof e.container==`string`?document.querySelector(e.container):e.container;if(!(t instanceof HTMLElement))throw Error(`Invalid container`);let n=t.__eddyter__;if(n)return n;let r=(0,a5t.createRoot)(t),i=e,a=()=>{let{user:e,class:t,containerClass:n,contentClass:a,floatingToolbarClass:o,onReady:s,...c}=i,l=e||{id:`anonymous`,name:`Anonymous`};r.render((0,o5t.jsx)(bHt,{currentUser:l,children:(0,o5t.jsx)(i5t,{apiKey:c.apiKey,customVerifyKey:c.customVerifyKey,initialContent:c.initialContent,onChange:c.onChange,onEditorReady:s,onFocus:c.onFocus,onBlur:c.onBlur,onHeightChange:c.onHeightChange,onAuthSuccess:c.onAuthSuccess,onAuthError:c.onAuthError,onPreviewClick:c.onPreviewClick,mode:c.mode,darkMode:c.darkMode,className:t,containerClassName:n,contentClassName:a,floatingToolbarClassName:o,style:c.style,editor:c.editor,toolbar:c.toolbar,defaultFontFamilies:c.defaultFontFamilies,mentionUserList:c.mentionUserList,enableReactNativeBridge:c.enableReactNativeBridge})}))};a();let o={destroy(){r.unmount(),t.__eddyter__=null},update(e){i={...i,...e},a()}};return t.__eddyter__=o,o}s5t&&typeof window<`u`&&(window.Eddyter={init:l5t}),exports.init=l5t;
|
|
1804
|
+
`,e.textContent=n,document.head.appendChild(e)}p1t=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},m1t=({elapsedTime:e,isPaused:t,isBatchMode:n,isProcessing:r,processingStatus:i,onPause:a,onResume:o,onStop:s})=>{let[c,l]=(0,Q.useState)(!1),{isDark:u}=R4(),d=L4();if((0,Q.useEffect)(()=>(h5++,h5===1&&l(!0),()=>{h5--}),[]),!c)return null;let f=null,p=document.querySelectorAll(`[data-toolbar-item="voiceTranscript"]`);for(let e of p){let t=e.getBoundingClientRect();if(t.width>0&&t.height>0){f=t;break}}let m=f?f.bottom+8:60,h=f?f.left+f.width/2:window.innerWidth/2;return(0,P0.createPortal)((0,X.jsx)(`div`,{id:`ct-editor-f47ac10b`,className:k$(`eddyter-scope`,u&&`dark cteditor-dark`),children:(0,X.jsxs)(`div`,{style:{top:m,left:h,userSelect:`none`},className:`cteditor-fixed cteditor--translate-x-1/2 cteditor-z-[9999] cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-white cteditor-pl-3 cteditor-pr-2 cteditor-h-[46px] cteditor-min-w-[260px] cteditor-rounded-full cteditor-mt-1 cteditor-overflow-hidden cteditor-border cteditor-border-foreground/10 cteditor-bg-gradient-to-b cteditor-from-main-background cteditor-to-background`,children:[(0,X.jsx)(`div`,{className:k$(`cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-pointer-events-none`,t?`cteditor-bg-[radial-gradient(50%_100%_at_0%_0%,rgba(234,179,8,0.10),transparent_60%)]`:`cteditor-bg-[radial-gradient(50%_100%_at_0%_0%,rgba(239,68,68,0.10),transparent_60%)]`)}),(0,X.jsxs)(`div`,{className:`cteditor-shrink-0 cteditor-relative cteditor-flex cteditor-items-center cteditor-justify-center cteditor-size-6`,children:[!t&&!r&&(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-inset-0 cteditor-rounded-full`,style:{animation:`cteditor-dotPulse 1.6s ease-out infinite`}}),(0,X.jsx)(`div`,{className:k$(`cteditor-relative cteditor-z-10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-transition-colors`,t||r?`cteditor-opacity-40`:`cteditor-text-red-500`),children:(0,X.jsx)(Bqt,{})})]}),r?(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-flex-1 cteditor-relative cteditor-z-10`,children:[(0,X.jsx)(y2,{style:{width:14,height:14,color:`#a1a1aa`},className:`cteditor-animate-spin`}),(0,X.jsx)(`span`,{className:`cteditor-text-xs`,children:i})]}):(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-[2.5px] cteditor-h-[26px] cteditor-flex-1 cteditor-relative cteditor-z-10 cteditor-text-foreground/20 dark:cteditor-text-foreground`,children:Array.from({length:24}).map((e,n)=>(0,X.jsx)(`div`,{style:{width:2,transformOrigin:`center`,background:n%3==0?`linear-gradient(180deg, #ef4444, rgba(239,68,68,0.45))`:`linear-gradient(180deg, currentColor, hsla(var(--cteditorf47ac10b-foreground) / 0.45))`,height:t?5:void 0,opacity:t?.55:void 0,animation:t?`none`:`cteditor-waveBar 1.1s ease-in-out infinite`,animationDelay:t?void 0:`${-(n*.17%1.1).toFixed(2)}s`},className:`cteditor-rounded-full`},n))}),(0,X.jsx)(`span`,{className:`cteditor-text-[13.5px] cteditor-font-medium cteditor-min-w-10 cteditor-text-right cteditor-shrink-0 cteditor-font-[monospace] cteditor-ml-auto cteditor-relative cteditor-z-10 ${t?`cteditor-text-yellow-500`:`cteditor-text-foreground`}`,children:p1t(e)}),!n&&!r&&(0,X.jsx)(`button`,{type:`button`,onClick:t?o:a,title:t?`Resume`:`Pause`,className:`cteditor-relative cteditor-z-10 cteditor-bg-foreground/5 cteditor-text-foreground cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-full cteditor-border cteditor-border-foreground/10 hover:cteditor-bg-foreground/10 cteditor-outline-0 cteditor-cursor-pointer cteditor-shrink-0 cteditor-transition-colors`,children:t?(0,X.jsx)(Vqt,{}):(0,X.jsx)(tJt,{className:`cteditor-size-4`})}),(0,X.jsx)(`button`,{type:`button`,onClick:s,title:`Stop recording`,className:`cteditor-relative cteditor-z-10 cteditor-bg-red-500/10 cteditor-text-red-500 cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-full cteditor-border cteditor-border-red-500/20 hover:cteditor-bg-red-500/20 cteditor-outline-0 cteditor-cursor-pointer cteditor-shrink-0 cteditor-transition-colors`,children:(0,X.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,X.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`})})})]})}),d||document.body)},h1t=({recording:e,editor:t,voiceRestrictedByok:n,selectedLanguage:r,setSelectedLanguage:i})=>{let{isRecording:a,isPaused:o,isLoading:s,isProcessing:c,processingStatus:l,isBatchMode:u,elapsedTime:d,toggleRecording:f,pauseRecording:p,resumeRecording:m,setEditor:h}=e;return(0,Q.useEffect)(()=>{h(t)},[t,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(c1t,{selectedLanguage:r,onLanguageChange:i,disabled:s||a||c}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:f,disabled:s||!a&&c||!t||n,className:k$(n&&`cteditor-opacity-60 cteditor-cursor-not-allowed`,a?o?`cteditor-bg-yellow-500/10 cteditor-text-yellow-500 cteditor-ring-1 cteditor-ring-yellow-500/30 hover:cteditor-bg-yellow-500/20 hover:cteditor-text-yellow-500`:`cteditor-bg-red-500/10 cteditor-text-red-500 cteditor-ring-1 cteditor-ring-red-500/30 hover:cteditor-bg-red-500/20 hover:cteditor-text-red-500`:`cteditor-text-foreground hover:cteditor-bg-foreground/5`),children:s?(0,X.jsxs)(`svg`,{className:`!cteditor-size-4 cteditor-animate-spin`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,X.jsx)(`circle`,{className:`cteditor-opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,X.jsx)(`path`,{className:`cteditor-opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}):(0,X.jsx)(fqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:n?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:s?`Starting recording...`:a?`Stop recording`:`Start voice recording`})})]})}),(a||c)&&(0,X.jsx)(m1t,{elapsedTime:d,isPaused:o,isBatchMode:u,isProcessing:c,processingStatus:l,onPause:p,onResume:m,onStop:f}),(0,X.jsx)(f1t,{isRecording:a&&!o,editor:t})]})},g1t=({editor:e,apiKey:t,voiceRestrictedByok:n})=>{let[r,i]=(0,Q.useState)(`en`);return(0,X.jsx)(h1t,{recording:qLt(t,r),editor:e,voiceRestrictedByok:n,selectedLanguage:r,setSelectedLanguage:i})},_1t=({editor:e,apiKey:t})=>{let n=K0(),r=n?.isByokPlan??!1,i=n?.byokApiKeys,a=r&&!i?.hasAssemblyaiKey,o=JLt();return o?(0,X.jsx)(h1t,{recording:o,editor:e,voiceRestrictedByok:a,selectedLanguage:o.selectedLanguage,setSelectedLanguage:o.setSelectedLanguage}):(0,X.jsx)(g1t,{editor:e,apiKey:t,voiceRestrictedByok:a})},v1t=()=>(0,X.jsx)(d1t,{}),g5=new Map,_5=null,v5={backgroundColor:`#2d2d2d`,textColor:`#f8f8f2`,gutterBackgroundColor:`#252525`,gutterTextColor:`#8c8c8c`,tokenColors:{comment:`#6a9955`,punctuation:`#d4d4d4`,property:`#e06c75`,selector:`#98c379`,operator:`#d19a66`,attr:`#61afef`,variable:`#e5c07b`,function:`#c678dd`}},y1t=[`--cteditorf47ac10b-card`,`--cteditorf47ac10b-border`,`--cteditorf47ac10b-foreground`,`--cteditorf47ac10b-muted-foreground`],b1t=new Set([`PlaygroundEditorTheme__checklist`,`PlaygroundEditorTheme__listItem`,`PlaygroundEditorTheme__listItemChecked`,`PlaygroundEditorTheme__listItemUnchecked`]),y5={A4_WIDTH:`210mm`,MARGIN:12,RENDER_DELAY:100,HIGHLIGHT_PADDING:{TOP:`0.03em`,BOTTOM:`0.18em`,VERTICAL_OFFSET:`0.10em`},COLORS:{DEFAULT_HIGHLIGHT:`rgba(255,212,0,0.45)`,WHITE_THRESHOLD:240,NEAR_BLACK:`#111111`}},x1t={rule:`#d4d0c8`,muted:`#8a857a`,accent:`#ef9f27`,ink:`#0f0f0e`},S1t=async()=>{let e=await Promise.resolve().then(()=>(YSt(),WSt)).then(e=>e.h);return e?.default||e},C1t=async()=>{let e=await Promise.resolve().then(()=>(lot(),U7e));return e?.default||e},w1t=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],T1t=`https://unpkg.com/html-docx-js@0.3.1/dist/html-docx.js`,E1t=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),D1t=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/),O1t=()=>{let[e]=Gd(),t=(0,Q.useCallback)(t=>{e.update(()=>{let e=W();U(e)&&Bu(e,t)})},[e]);return{onFontColorSelect:(0,Q.useCallback)(e=>{t({color:e})},[t]),onBgColorSelect:(0,Q.useCallback)(e=>{t({"background-color":e})},[t]),onHighlightColorSelect:(0,Q.useCallback)(n=>{n===null?(e.dispatchCommand(pc,`highlight`),t({"background-color":`transparent`})):(e.dispatchCommand(pc,`highlight`),t({"background-color":n}))},[e,t])}},b5=di(`AI_IMAGE_COMMAND`),x5=di(`AI_TRANSLATE_COMMAND`),S5=di(`AI_ADJUST_TONE_COMMAND`),C5=`rovingFocusGroup.onEntryFocus`,k1t={bubbles:!1,cancelable:!0},w5=`RovingFocusGroup`,[T5,A1t,j1t]=tIt(w5),[M1t,N1t]=j$(w5,[j1t]),[P1t,F1t]=M1t(w5),I1t=Z.forwardRef((e,t)=>(0,X.jsx)(T5.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(T5.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(L1t,{...e,ref:t})})})),I1t.displayName=w5,L1t=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=Z.useRef(null),p=O$(t,f),m=nIt(a),[h,g]=N$({prop:o,defaultProp:s??null,onChange:c,caller:w5}),[_,v]=Z.useState(!1),y=F$(l),b=A1t(n),x=Z.useRef(!1),[S,C]=Z.useState(0);return Z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(C5,y),()=>e.removeEventListener(C5,y)},[y]),(0,X.jsx)(P1t,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:Z.useCallback(e=>g(e),[g]),onItemShiftTab:Z.useCallback(()=>v(!0),[]),onFocusableItemAdd:Z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:Z.useCallback(()=>C(e=>e-1),[]),children:(0,X.jsx)(e4.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:A$(e.onMouseDown,()=>{x.current=!0}),onFocus:A$(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(C5,k1t);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);kRt([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:A$(e.onBlur,()=>v(!1))})})}),E5=`RovingFocusGroupItem`,R1t=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=M$(),l=a||c,u=F1t(E5,n),d=u.currentTabStopId===l,f=A1t(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return Z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,X.jsx)(T5.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(e4.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:A$(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:A$(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:A$(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ORt(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ARt(n,r+1):n.slice(r+1)}setTimeout(()=>kRt(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})}),R1t.displayName=E5,z1t={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`},B1t=I1t,V1t=R1t,D5=[`Enter`,` `],H1t=[`ArrowDown`,`PageUp`,`Home`],U1t=[`ArrowUp`,`PageDown`,`End`],W1t=[...H1t,...U1t],G1t={ltr:[...D5,`ArrowRight`],rtl:[...D5,`ArrowLeft`]},K1t={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},O5=`Menu`,[k5,q1t,J1t]=tIt(O5),[A5,Y1t]=j$(O5,[J1t,F3,N1t]),j5=F3(),X1t=N1t(),[Z1t,M5]=A5(O5),[Q1t,N5]=A5(O5),$1t=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=j5(t),[c,l]=Z.useState(null),u=Z.useRef(!1),d=F$(a),f=nIt(i);return Z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,X.jsx)(L3,{...s,children:(0,X.jsx)(Z1t,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(Q1t,{scope:t,onClose:Z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},$1t.displayName=O5,e0t=`MenuAnchor`,P5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(R3,{...j5(n),...r,ref:t})}),P5.displayName=e0t,F5=`MenuPortal`,[t0t,n0t]=A5(F5,{forceMount:void 0}),r0t=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=M5(F5,t);return(0,X.jsx)(t0t,{scope:t,forceMount:n,children:(0,X.jsx)(s4,{present:n||a.open,children:(0,X.jsx)(o4,{asChild:!0,container:i,children:r})})})},r0t.displayName=F5,I5=`MenuContent`,[i0t,L5]=A5(I5),a0t=Z.forwardRef((e,t)=>{let n=n0t(I5,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=M5(I5,e.__scopeMenu),o=N5(I5,e.__scopeMenu);return(0,X.jsx)(k5.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(s4,{present:r||a.open,children:(0,X.jsx)(k5.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(o0t,{...i,ref:t}):(0,X.jsx)(s0t,{...i,ref:t})})})})}),o0t=Z.forwardRef((e,t)=>{let n=M5(I5,e.__scopeMenu),r=Z.useRef(null),i=O$(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return E4(e)},[]),(0,X.jsx)(R5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:A$(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),s0t=Z.forwardRef((e,t)=>{let n=M5(I5,e.__scopeMenu);return(0,X.jsx)(R5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),c0t=P$(`MenuContent.ScrollLock`),R5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=M5(I5,n),_=N5(I5,n),v=j5(n),y=X1t(n),b=q1t(n),[x,S]=Z.useState(null),C=Z.useRef(null),w=O$(t,C,g.onContentChange),T=Z.useRef(0),E=Z.useRef(``),D=Z.useRef(0),O=Z.useRef(null),k=Z.useRef(`right`),A=Z.useRef(0),j=m?x4:Z.Fragment,M=m?{as:c0t,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=FRt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};Z.useEffect(()=>()=>window.clearTimeout(T.current),[]),R$();let P=Z.useCallback(e=>k.current===O.current?.side&&LRt(e,O.current?.area),[]);return(0,X.jsx)(i0t,{scope:n,searchRef:E,onItemEnter:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Z.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:Z.useCallback(e=>{O.current=e},[]),children:(0,X.jsx)(j,{...M,children:(0,X.jsx)(a4,{asChild:!0,trapped:i,onMountAutoFocus:A$(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(n4,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,X.jsx)(B1t,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:A$(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(z3,{role:`menu`,"aria-orientation":`vertical`,"data-state":jRt(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:A$(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!W1t.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);U1t.includes(e.key)&&a.reverse(),NRt(a)}),onBlur:A$(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:A$(e.onPointerMove,p0(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})}),a0t.displayName=I5,l0t=`MenuGroup`,z5=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{role:`group`,...r,ref:t})}),z5.displayName=l0t,u0t=`MenuLabel`,d0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{...r,ref:t})}),d0t.displayName=u0t,B5=`MenuItem`,f0t=`menu.itemSelect`,V5=Z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Z.useRef(null),o=N5(B5,e.__scopeMenu),s=L5(B5,e.__scopeMenu),c=O$(t,a),l=Z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(f0t,{bubbles:!0,cancelable:!0});e.addEventListener(f0t,e=>r?.(e),{once:!0}),sMt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(p0t,{...i,ref:c,disabled:n,onClick:A$(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:A$(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:A$(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||D5.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})}),V5.displayName=B5,p0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=L5(B5,n),s=X1t(n),c=Z.useRef(null),l=O$(t,c),[u,d]=Z.useState(!1),[f,p]=Z.useState(``);return Z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,X.jsx)(k5.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(V1t,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(e4.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:A$(e.onPointerMove,p0(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:A$(e.onPointerLeave,p0(e=>o.onItemLeave(e))),onFocus:A$(e.onFocus,()=>d(!0)),onBlur:A$(e.onBlur,()=>d(!1))})})})}),m0t=`MenuCheckboxItem`,h0t=Z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(S0t,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(V5,{role:`menuitemcheckbox`,"aria-checked":f0(n)?`mixed`:n,...i,ref:t,"data-state":MRt(n),onSelect:A$(i.onSelect,()=>r?.(f0(n)?!0:!n),{checkForDefaultPrevented:!1})})})}),h0t.displayName=m0t,g0t=`MenuRadioGroup`,[_0t,v0t]=A5(g0t,{value:void 0,onValueChange:()=>{}}),y0t=Z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=F$(r);return(0,X.jsx)(_0t,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(z5,{...i,ref:t})})}),y0t.displayName=g0t,b0t=`MenuRadioItem`,x0t=Z.forwardRef((e,t)=>{let{value:n,...r}=e,i=v0t(b0t,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(S0t,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(V5,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":MRt(a),onSelect:A$(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})}),x0t.displayName=b0t,H5=`MenuItemIndicator`,[S0t,C0t]=A5(H5,{checked:!1}),w0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=C0t(H5,n);return(0,X.jsx)(s4,{present:r||f0(a.checked)||a.checked===!0,children:(0,X.jsx)(e4.span,{...i,ref:t,"data-state":MRt(a.checked)})})}),w0t.displayName=H5,T0t=`MenuSeparator`,E0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(e4.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})}),E0t.displayName=T0t,D0t=`MenuArrow`,O0t=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(B3,{...j5(n),...r,ref:t})}),O0t.displayName=D0t,U5=`MenuSub`,[k0t,A0t]=A5(U5),j0t=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=M5(U5,t),o=j5(t),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=F$(i);return Z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(L3,{...o,children:(0,X.jsx)(Z1t,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(k0t,{scope:t,contentId:M$(),triggerId:M$(),trigger:s,onTriggerChange:c,children:n})})})},j0t.displayName=U5,W5=`MenuSubTrigger`,M0t=Z.forwardRef((e,t)=>{let n=M5(W5,e.__scopeMenu),r=N5(W5,e.__scopeMenu),i=A0t(W5,e.__scopeMenu),a=L5(W5,e.__scopeMenu),o=Z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return Z.useEffect(()=>u,[u]),Z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,X.jsx)(P5,{asChild:!0,...l,children:(0,X.jsx)(p0t,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":jRt(n.open),...e,ref:D$(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:A$(e.onPointerMove,p0(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:A$(e.onPointerLeave,p0(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:A$(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||G1t[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})}),M0t.displayName=W5,N0t=`MenuSubContent`,P0t=Z.forwardRef((e,t)=>{let n=n0t(I5,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=M5(I5,e.__scopeMenu),o=N5(I5,e.__scopeMenu),s=A0t(N0t,e.__scopeMenu),c=Z.useRef(null),l=O$(t,c);return(0,X.jsx)(k5.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(s4,{present:r||a.open,children:(0,X.jsx)(k5.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(R5,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:A$(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:A$(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:A$(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=K1t[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})}),P0t.displayName=N0t,F0t=$1t,I0t=P5,L0t=r0t,R0t=a0t,z0t=z5,B0t=d0t,V0t=V5,H0t=h0t,U0t=y0t,W0t=x0t,G0t=w0t,K0t=E0t,q0t=O0t,J0t=j0t,Y0t=M0t,X0t=P0t,G5=`DropdownMenu`,[Z0t]=j$(G5,[Y1t]),K5=Y1t(),[Q0t,$0t]=Z0t(G5),e2t=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=K5(t),l=Z.useRef(null),[u,d]=N$({prop:i,defaultProp:a??!1,onChange:o,caller:G5});return(0,X.jsx)(Q0t,{scope:t,triggerId:M$(),triggerRef:l,contentId:M$(),open:u,onOpenChange:d,onOpenToggle:Z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(F0t,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},e2t.displayName=G5,t2t=`DropdownMenuTrigger`,n2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=$0t(t2t,n);return(0,X.jsx)(I0t,{asChild:!0,...K5(n),children:(0,X.jsx)(e4.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:D$(t,a.triggerRef),onPointerDown:A$(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:A$(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})}),n2t.displayName=t2t,r2t=`DropdownMenuPortal`,i2t=e=>{let{__scopeDropdownMenu:t,...n}=e;return(0,X.jsx)(L0t,{...K5(t),...n})},i2t.displayName=r2t,a2t=`DropdownMenuContent`,o2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$0t(a2t,n),a=K5(n),o=Z.useRef(!1);return(0,X.jsx)(R0t,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:A$(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:A$(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})}),o2t.displayName=a2t,s2t=`DropdownMenuGroup`,c2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(z0t,{...K5(n),...r,ref:t})}),c2t.displayName=s2t,l2t=`DropdownMenuLabel`,u2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(B0t,{...K5(n),...r,ref:t})}),u2t.displayName=l2t,d2t=`DropdownMenuItem`,f2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(V0t,{...K5(n),...r,ref:t})}),f2t.displayName=d2t,p2t=`DropdownMenuCheckboxItem`,m2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(H0t,{...K5(n),...r,ref:t})}),m2t.displayName=p2t,h2t=`DropdownMenuRadioGroup`,g2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(U0t,{...K5(n),...r,ref:t})}),g2t.displayName=h2t,_2t=`DropdownMenuRadioItem`,v2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(W0t,{...K5(n),...r,ref:t})}),v2t.displayName=_2t,y2t=`DropdownMenuItemIndicator`,b2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(G0t,{...K5(n),...r,ref:t})}),b2t.displayName=y2t,x2t=`DropdownMenuSeparator`,S2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(K0t,{...K5(n),...r,ref:t})}),S2t.displayName=x2t,C2t=`DropdownMenuArrow`,w2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(q0t,{...K5(n),...r,ref:t})}),w2t.displayName=C2t,T2t=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=K5(t),[s,c]=N$({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,X.jsx)(J0t,{...o,open:s,onOpenChange:c,children:n})},E2t=`DropdownMenuSubTrigger`,D2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(Y0t,{...K5(n),...r,ref:t})}),D2t.displayName=E2t,O2t=`DropdownMenuSubContent`,k2t=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e;return(0,X.jsx)(X0t,{...K5(n),...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})}),k2t.displayName=O2t,A2t=e2t,j2t=n2t,M2t=i2t,N2t=o2t,P2t=u2t,F2t=f2t,I2t=m2t,L2t=v2t,R2t=b2t,z2t=S2t,B2t=T2t,V2t=D2t,H2t=k2t,q5=({modal:e=!1,...t})=>(0,X.jsx)(A2t,{modal:e,...t}),J5=j2t,U2t=M2t,Y5=B2t,X5=Z.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,X.jsxs)(V2t,{ref:i,className:k$(`cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-outline-none focus:cteditor-bg-foreground/5 data-[state=open]:cteditor-bg-foreground/10 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`cteditor-pl-8`,e),...r,children:[n,(0,X.jsx)(l2,{className:`cteditor-ml-auto`})]})),X5.displayName=V2t.displayName,Z5=Z.forwardRef(({className:e,...t},n)=>(0,X.jsx)(H2t,{ref:n,className:k$(`cteditor-z-[9999] cteditor-min-w-[8rem] cteditor-overflow-hidden cteditor-rounded-xl cteditor-border cteditor-bg-popover cteditor-p-1 cteditor-text-popover-foreground ct-menu-shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]`,e),...t})),Z5.displayName=H2t.displayName,Q5=Z.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,X.jsx)(M2t,{container:L4(),children:(0,X.jsx)(N2t,{ref:r,sideOffset:t,className:k$(`cteditor-z-[9999] cteditor-max-h-[var(--radix-dropdown-menu-content-available-height)] cteditor-min-w-[8rem] cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-rounded-xl cteditor-border cteditor-border-border cteditor-bg-dropdown cteditor-p-1 cteditor-text-foreground ct-menu-shadow`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]`,e),...n})})),Q5.displayName=N2t.displayName,$5=Z.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(F2t,{ref:r,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1 cteditor-text-[13px] cteditor-outline-none focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,t&&`cteditor-pl-8`,e),...n})),$5.displayName=F2t.displayName,W2t=Z.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,X.jsxs)(I2t,{ref:i,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-lg cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,e),checked:n,...r,children:[(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-left-2 cteditor-flex cteditor-h-3.5 cteditor-w-3.5 cteditor-items-center cteditor-justify-center`,children:(0,X.jsx)(R2t,{children:(0,X.jsx)(s2,{className:`cteditor-h-4 cteditor-w-4`})})}),t]})),W2t.displayName=I2t.displayName,G2t=Z.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(L2t,{ref:r,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-lg cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,e),...n,children:[(0,X.jsx)(`span`,{className:`cteditor-absolute cteditor-left-2 cteditor-flex cteditor-h-3.5 cteditor-w-3.5 cteditor-items-center cteditor-justify-center`,children:(0,X.jsx)(R2t,{children:(0,X.jsx)(sUt,{className:`cteditor-h-2 cteditor-w-2 cteditor-fill-current`})})}),t]})),G2t.displayName=L2t.displayName,K2t=Z.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(P2t,{ref:r,className:k$(`cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-font-semibold`,t&&`cteditor-pl-8`,e),...n})),K2t.displayName=P2t.displayName,e7=Z.forwardRef(({className:e,...t},n)=>(0,X.jsx)(z2t,{ref:n,className:k$(`cteditor--mx-1 cteditor-my-1 cteditor-h-px cteditor-bg-muted`,e),...t})),e7.displayName=z2t.displayName,t7=[`1`,`1.15`,`1.5`,`2`,`2.5`,`3`],n7=`1.5`,q2t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(n7),r=Q.useRef(null),i=Q.useRef(!1);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();if(U(e)){let t=m0(Hu(e,`line-height`,n7));if(i.current){i.current=!1;return}!e.isCollapsed()&&r.current!==null&&(r.current=null),r.current!==null&&t!==r.current&&t!==n7&&(r.current=null),r.current===null&&n(t)}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(r.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=W();U(e)&&e.isCollapsed()&&Bu(e,{"line-height":r.current})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(r.current!==null){let t=r.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(i.current=!0,Bu(e,{"line-height":t}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let a=(0,Q.useCallback)(t=>{let a=m0(t);r.current=a,i.current=!0,n(a),e.update(()=>{let e=W();U(e)&&Bu(e,{"line-height":a})})},[e]),o=e=>{e.preventDefault()};return(0,X.jsxs)(Y5,{children:[(0,X.jsx)(X5,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-xs [&>svg]:cteditor-w-5`,children:`Line Height`}),(0,X.jsx)(Z5,{onMouseDown:o,className:`cteditor-border-foreground/10`,children:t7.map(e=>(0,X.jsx)($5,{onMouseDown:o,onClick:()=>a(e),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2 `,t===e&&`cteditor-bg-foreground/10`),children:e},e))})]})},J2t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(n7),r=Q.useRef(null),i=Q.useRef(!1);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();if(U(e)){let t=m0(Hu(e,`line-height`,n7));if(i.current){i.current=!1;return}!e.isCollapsed()&&r.current!==null&&(r.current=null),r.current!==null&&t!==r.current&&t!==n7&&(r.current=null),r.current===null&&n(t)}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(r.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=W();U(e)&&e.isCollapsed()&&Bu(e,{"line-height":r.current})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(r.current!==null){let t=r.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(i.current=!0,Bu(e,{"line-height":t}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let a=(0,Q.useCallback)(t=>{let a=m0(t);r.current=a,i.current=!0,n(a),e.update(()=>{let e=W();U(e)&&Bu(e,{"line-height":a})})},[e]),o=e=>{e.preventDefault()};return(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-6 cteditor-gap-1`,children:t7.map((e,n)=>(0,X.jsx)(`button`,{type:`button`,onMouseDown:o,onClick:()=>a(e),className:k$(`cteditor-relative cteditor-flex cteditor-justify-center cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,t===e&&`cteditor-bg-foreground/10`),title:`Line Height: ${e}`,children:e},n))})},Y2t=()=>{let[e,t]=(0,Q.useState)(!1);return{show:()=>t(!0),hide:()=>t(!1),isOpen:e}},X2t=({enableLineHeight:e=!0})=>{let[t]=Gd(),n=Y2t(),{toolbarState:r}=$8(),i=r.elementFormat;return(0,X.jsxs)(q5,{open:n.isOpen,onOpenChange:e=>e?n.show():n.hide(),children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`toolbar`,size:`sm`,className:`cteditor-flex cteditor-items-center !cteditor-gap-0 cteditor-h-7.5 !cteditor-rounded-md`,children:[(0,X.jsx)(l3,{}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[Z8.map((e,r)=>(0,X.jsxs)($5,{onClick:()=>{n.hide(),t.dispatchCommand(Nc,e.payload)},className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,i===e.payload&&`cteditor-bg-foreground/10`),children:[e.icon,e.name]},r)),e&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e7,{}),(0,X.jsx)(q2t,{})]})]})]})},Z2t=()=>{let[e]=Gd(),{toolbarState:t}=$8(),n=t.elementFormat;return(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-1`,children:Z8.map((t,r)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{e.dispatchCommand(Nc,t.payload)},className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-shrink-0`,n===t.payload&&`cteditor-bg-foreground/10`),title:t.name,children:[(0,X.jsx)(`span`,{children:t.icon}),(0,X.jsx)(`span`,{children:t.name})]},r))})},Q2t=[`bullet`,`number`,`check`],$2t=[{name:`Check list`,kind:`check`,icon:(0,X.jsx)(cqt,{}),activeType:`check`},{name:`Quote`,kind:`quote`,icon:(0,X.jsx)(n3,{}),activeType:`quote`},{name:`Code block`,kind:`codeBlock`,icon:(0,X.jsx)(W4,{}),activeType:`code`}],e4t=[{style:`disc`,label:`Default`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,fill:`currentColor`})})},{style:`circle`,label:`Circle`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`circle`,{cx:`7`,cy:`7`,r:`3.75`,stroke:`currentColor`,strokeWidth:`1.5`})})},{style:`square`,label:`Square`,glyph:(0,X.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,X.jsx)(`rect`,{x:`3.5`,y:`3.5`,width:`7`,height:`7`,fill:`currentColor`})})}],t4t=[{style:`decimal`,label:`Default (1, 2, 3)`,glyph:`1.`},{style:`lower-alpha`,label:`Lower alpha (a, b, c)`,glyph:`a.`},{style:`upper-alpha`,label:`Upper alpha (A, B, C)`,glyph:`A.`},{style:`lower-roman`,label:`Lower roman (i, ii, iii)`,glyph:`i.`},{style:`upper-roman`,label:`Upper roman (I, II, III)`,glyph:`I.`}],n4t=({blockType:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)(`disc`),[i,a]=(0,Q.useState)(`decimal`);(0,Q.useEffect)(()=>{let e=()=>{t.getEditorState().read(()=>{let e=W();if(!U(e))return;let t=e.anchor.getNode(),n=yIt(t);r(n?n.getBulletStyle():`disc`);let i=bIt(t);a(i?i.getNumberStyle():`decimal`)})};return e(),t.registerUpdateListener(e)},[t]);let o=n=>{t.update(()=>{if(!U(W()))return;e!==`bullet`&&kd(`bullet`);let t=W();if(!U(t))return;let r=t.anchor.getNode(),i=Fd(r)?r:id(r,Fd);if(!(!i||i.getListType()!==`bullet`)){if(n===`disc`){P1(i)&&i.replace(Pd(`bullet`,i.getStart()),!0);return}P1(i)?i.setBulletStyle(n):i.replace(vIt(`bullet`,i.getStart(),n),!0)}})},s=n=>{t.update(()=>{if(!U(W()))return;e!==`number`&&kd(`number`);let t=W();if(!U(t))return;let r=t.anchor.getNode(),i=Fd(r)?r:id(r,Fd);if(!(!i||i.getListType()!==`number`)){if(n===`decimal`){P1(i)&&i.replace(Pd(`number`,i.getStart()),!0);return}P1(i)?i.setNumberStyle(n):i.replace(vIt(`number`,i.getStart(),`disc`,n),!0)}})},c=n=>{if(Q2t.includes(n)){if(e===n){t.dispatchCommand(Ud,void 0);return}t.dispatchCommand(n===`bullet`?Bd:n===`number`?Vd:Hd,void 0);return}t.update(()=>{let e=W();if(U(e))if(n===`quote`)Vu(e,()=>Df());else if(e.isCollapsed())Vu(e,()=>sd());else{let t=e.getTextContent(),n=sd();e.insertNodes([n]),e.insertRawText(t)}})};return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`toolbar`,size:`sm`,title:`Lists & blocks`,className:`cteditor-flex cteditor-items-center !cteditor-gap-0 cteditor-h-7 !cteditor-rounded-md cteditor-px-1`,children:[(0,X.jsx)(e3,{}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`bullet`&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)(e3,{}),`Bulleted list`]}),(0,X.jsx)(Z5,{children:e4t.map(t=>(0,X.jsxs)($5,{onClick:()=>o(t.style),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`bullet`&&n===t.style&&`cteditor-bg-foreground/10`),children:[t.glyph,t.label]},t.style))})]}),(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`number`&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)($4,{}),`Numbered list`]}),(0,X.jsx)(Z5,{children:t4t.map(t=>(0,X.jsxs)($5,{onClick:()=>s(t.style),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===`number`&&i===t.style&&`cteditor-bg-foreground/10`),children:[(0,X.jsx)(`span`,{className:`cteditor-w-3.5 cteditor-text-center cteditor-text-xs cteditor-font-medium`,children:t.glyph}),t.label]},t.style))})]}),$2t.map(t=>(0,X.jsxs)(Q.Fragment,{children:[t.kind===`quote`&&(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`}),(0,X.jsxs)($5,{onClick:()=>c(t.kind),className:k$(`cteditor-flex cteditor-items-center cteditor-gap-2`,e===t.activeType&&`cteditor-bg-foreground/10`),children:[t.icon,t.name]})]},t.kind))]})]})},r4t=({isOpen:e,onClick:t,commentCount:n=0,fitToPage:r=!1})=>(0,X.jsx)(`div`,{className:k$(`toolbar-comments-feature`,r?`cteditor-bg-transparent`:`cteditor-bg-main-background`),children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:t,className:k$(`cteditor-relative cteditor-transition-all cteditor-duration-200`,e&&`cteditor-bg-primary text-primary-foreground`),title:`${e?`Hide`:`Show`} comments`,children:[(0,X.jsx)(pqt,{}),n>0&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-absolute cteditor-top-1 cteditor-right-1 cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-0.5 cteditor-ring-background`})]})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Comments`})})]})})}),i4t=(0,Q.memo)(r4t),a4t=e=>{let{blockType:t,enableHeadings:n=!0}=e,[r]=Gd(),i=()=>{t!==`paragraph`&&r.update(()=>{let e=W();U(e)&&Vu(e,()=>Qs())})},a=e=>{t!==e&&r.update(()=>{let t=W();if(U(t)){Vu(t,()=>kf(e));let n=W();if(U(n)){let e=n.getNodes();for(let t of e)Jo(t)&&!t.hasFormat(`bold`)&&t.toggleFormat(`bold`);Bu(n,{"font-size":null})}}})},o=()=>{t===`bullet`?r.update(()=>{r.dispatchCommand(Ud,void 0)}):r.update(()=>{r.dispatchCommand(Bd,void 0)})},s=()=>{t===`check`?r.dispatchCommand(Ud,void 0):r.dispatchCommand(Hd,void 0)},c=()=>{t===`number`?r.update(()=>{r.dispatchCommand(Ud,void 0)}):r.update(()=>{r.dispatchCommand(Vd,void 0)})},l=()=>{t!==`quote`&&r.update(()=>{let e=W();U(e)&&Vu(e,()=>Df())})},u=()=>{r.update(()=>{let e=W();if(!U(e))return;let t=Yu(e.anchor.getNode(),Rd);t&&t.getListType()===`number`&&t.setStart(1)})};return{blocks:[{name:`Normal`,blockType:`paragraph`,icon:(0,X.jsx)(a3,{}),onClick:i},...n?[{name:`Heading 1`,blockType:`h1`,icon:(0,X.jsx)(_qt,{}),onClick:()=>a(`h1`)},{name:`Heading 2`,blockType:`h2`,icon:(0,X.jsx)(o3,{}),onClick:()=>a(`h2`)},{name:`Heading 3`,blockType:`h3`,icon:(0,X.jsx)(vqt,{}),onClick:()=>a(`h3`)},{name:`Heading 4`,blockType:`h4`,icon:(0,X.jsx)(yqt,{}),onClick:()=>a(`h4`)},{name:`Heading 5`,blockType:`h5`,icon:(0,X.jsx)(bqt,{}),onClick:()=>a(`h5`)},{name:`Heading 6`,blockType:`h6`,icon:(0,X.jsx)(xqt,{}),onClick:()=>a(`h6`)}]:[]],formatParagraph:i,formatHeading:a,formatBulletList:o,formatCheckList:s,formatNumberedList:c,formatQuote:l,resetListNumbering:u}},o4t=({blockType:e,enableHeadings:t=!0,enableLists:n=!0,enableBlockquote:r=!0,triggerClassName:i})=>{let[a,o]=(0,Q.useState)(null),s=!!a,c=e=>o(e.currentTarget),l=()=>o(null),{blocks:u,resetListNumbering:d}=a4t({blockType:e,enableHeadings:t});return(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(q5,{open:s,onOpenChange:e=>{e||l()},children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{"aria-haspopup":a?`true`:void 0,"aria-controls":a?`block-format-menu`:void 0,onClick:c,variant:`toolbar`,className:k$(`cteditor-flex cteditor-items-center !cteditor-gap-1 cteditor-whitespace-nowrap !cteditor-rounded-md cteditor-h-7.5`,i),size:`sm`,children:[(0,X.jsx)(`span`,{className:`cteditor-flex cteditor-items-center cteditor-justify-center [&_svg]:!cteditor-size-5`,children:u.find(t=>t.blockType===e)?.icon??u[0]?.icon}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-70`})]})}),(0,X.jsxs)(Q5,{id:`block-format-menu`,className:`cteditor-w-56`,align:`start`,"aria-labelledby":`block-format-button`,role:`listbox`,children:[u.map((t,n)=>(0,X.jsxs)($5,{role:`option`,className:k$(`cteditor-flex cteditor-items-center !cteditor-gap-2 cteditor-cursor-pointer`,e===t.blockType&&`cteditor-bg-foreground/10`),onClick:()=>{l(),t.onClick()},children:[t.icon,(0,X.jsx)(`span`,{children:t.name})]},n)),e===`number`&&n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e7,{}),(0,X.jsxs)($5,{role:`option`,className:`cteditor-flex cteditor-items-center !cteditor-gap-2 cteditor-cursor-pointer`,onClick:()=>{l(),d()},children:[(0,X.jsx)($4,{}),(0,X.jsx)(`span`,{children:`Restart numbering at 1`})]})]})]})]})})},(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(r7||={}),(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(s4t||={}),i7=r7.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),a7=e=>{switch(typeof e){case`undefined`:return i7.undefined;case`string`:return i7.string;case`number`:return Number.isNaN(e)?i7.nan:i7.number;case`boolean`:return i7.boolean;case`function`:return i7.function;case`bigint`:return i7.bigint;case`symbol`:return i7.symbol;case`object`:return Array.isArray(e)?i7.array:e===null?i7.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?i7.promise:typeof Map<`u`&&e instanceof Map?i7.map:typeof Set<`u`&&e instanceof Set?i7.set:typeof Date<`u`&&e instanceof Date?i7.date:i7.object;default:return i7.unknown}},o7=r7.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),s7=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r7.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}},s7.create=e=>new s7(e),c7=(e,t)=>{let n;switch(e.code){case o7.invalid_type:n=e.received===i7.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case o7.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,r7.jsonStringifyReplacer)}`;break;case o7.unrecognized_keys:n=`Unrecognized key(s) in object: ${r7.joinValues(e.keys,`, `)}`;break;case o7.invalid_union:n=`Invalid input`;break;case o7.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${r7.joinValues(e.options)}`;break;case o7.invalid_enum_value:n=`Invalid enum value. Expected ${r7.joinValues(e.options)}, received '${e.received}'`;break;case o7.invalid_arguments:n=`Invalid function arguments`;break;case o7.invalid_return_type:n=`Invalid function return type`;break;case o7.invalid_date:n=`Invalid date`;break;case o7.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:r7.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case o7.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case o7.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case o7.custom:n=`Invalid input`;break;case o7.invalid_intersection_types:n=`Intersection results could not be merged`;break;case o7.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case o7.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,r7.assertNever(e)}return{message:n}},c4t=c7,l4t=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},l7=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return u7;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return u7;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(typeof i.value<`u`||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},u7=Object.freeze({status:`aborted`}),d7=e=>({status:`dirty`,value:e}),f7=e=>({status:`valid`,value:e}),u4t=e=>e.status===`aborted`,d4t=e=>e.status===`dirty`,p7=e=>e.status===`valid`,m7=e=>typeof Promise<`u`&&e instanceof Promise,(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(h7||={}),g7=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},f4t=(e,t)=>{if(p7(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new s7(e.common.issues);return this._error=t,this._error}}},_7=class{get description(){return this._def.description}_getType(e){return a7(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l7,ctx:{common:e.parent.common,data:e.data,parsedType:a7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(m7(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)};return f4t(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return p7(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>p7(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a7(e)},r=this._parse({data:e,path:n.path,parent:n});return f4t(n,await(m7(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||typeof t>`u`?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:o7.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new A7({schema:this,typeName:I7.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return j7.create(this,this._def)}nullable(){return M7.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S7.create(this)}promise(){return k7.create(this,this._def)}or(e){return w7.create([this,e],this._def)}and(e){return T7.create(this,e,this._def)}transform(e){return new A7({...g0(this._def),schema:this,typeName:I7.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new N7({...g0(this._def),innerType:this,defaultValue:t,typeName:I7.ZodDefault})}brand(){return new W4t({typeName:I7.ZodBranded,type:this,...g0(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new P7({...g0(this._def),innerType:this,catchValue:t,typeName:I7.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return G4t.create(this,e)}readonly(){return F7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},p4t=/^c[^\s-]{8,}$/i,m4t=/^[0-9a-z]+$/,h4t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g4t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_4t=/^[a-z0-9_-]{21}$/i,v4t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,y4t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,b4t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,x4t=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,C4t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,w4t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,T4t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,E4t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D4t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O4t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k4t=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,A4t=RegExp(`^${k4t}$`),v7=class e extends _7{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i7.string){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.string,received:t.parsedType}),u7}let t=new l7,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?h0(n,{code:o7.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&h0(n,{code:o7.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)b4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`email`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)S4t||=new RegExp(x4t,`u`),S4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`emoji`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)g4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`uuid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)_4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`nanoid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)p4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cuid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)m4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cuid2`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)h4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`ulid`,code:o7.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),h0(n,{validation:`url`,code:o7.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`regex`,code:o7.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?VRt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?A4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?BRt(r).test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?y4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`duration`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?HRt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`ip`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?URt(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`jwt`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?WRt(e.data,r.version)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`cidr`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?D4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`base64`,code:o7.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?O4t.test(e.data)||(n=this._getOrReturnCtx(e,n),h0(n,{validation:`base64url`,code:o7.invalid_string,message:r.message}),t.dirty()):r7.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:o7.invalid_string,...h7.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...h7.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...h7.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...h7.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...h7.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...h7.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...h7.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...h7.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...h7.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...h7.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...h7.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...h7.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...h7.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...h7.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:typeof e?.precision>`u`?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h7.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:typeof e?.precision>`u`?null:e?.precision,...h7.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...h7.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...h7.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...h7.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...h7.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...h7.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...h7.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...h7.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...h7.errToObj(t)})}nonempty(e){return this.min(1,h7.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},v7.create=e=>new v7({checks:[],typeName:I7.ZodString,coerce:e?.coerce??!1,...g0(e)}),y7=class e extends _7{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i7.number){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.number,received:t.parsedType}),u7}let t,n=new l7;for(let r of this._def.checks)r.kind===`int`?r7.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?GRt(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_finite,message:r.message}),n.dirty()):r7.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,h7.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,h7.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,h7.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,h7.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:h7.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:h7.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:h7.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:h7.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:h7.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:h7.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:h7.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:h7.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:h7.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:h7.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&r7.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}},y7.create=e=>new y7({checks:[],typeName:I7.ZodNumber,coerce:e?.coerce||!1,...g0(e)}),j4t=class e extends _7{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==i7.bigint)return this._getInvalidInput(e);let t,n=new l7;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),h0(t,{code:o7.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r7.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.bigint,received:t.parsedType}),u7}gte(e,t){return this.setLimit(`min`,e,!0,h7.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,h7.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,h7.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,h7.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:h7.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:h7.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:h7.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:h7.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:h7.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:h7.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},j4t.create=e=>new j4t({checks:[],typeName:I7.ZodBigInt,coerce:e?.coerce??!1,...g0(e)}),M4t=class extends _7{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==i7.boolean){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.boolean,received:t.parsedType}),u7}return f7(e.data)}},M4t.create=e=>new M4t({typeName:I7.ZodBoolean,coerce:e?.coerce||!1,...g0(e)}),N4t=class e extends _7{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i7.date){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.date,received:t.parsedType}),u7}if(Number.isNaN(e.data.getTime()))return h0(this._getOrReturnCtx(e),{code:o7.invalid_date}),u7;let t=new l7,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),h0(n,{code:o7.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):r7.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:h7.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:h7.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}},N4t.create=e=>new N4t({checks:[],coerce:e?.coerce||!1,typeName:I7.ZodDate,...g0(e)}),P4t=class extends _7{_parse(e){if(this._getType(e)!==i7.symbol){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.symbol,received:t.parsedType}),u7}return f7(e.data)}},P4t.create=e=>new P4t({typeName:I7.ZodSymbol,...g0(e)}),F4t=class extends _7{_parse(e){if(this._getType(e)!==i7.undefined){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.undefined,received:t.parsedType}),u7}return f7(e.data)}},F4t.create=e=>new F4t({typeName:I7.ZodUndefined,...g0(e)}),I4t=class extends _7{_parse(e){if(this._getType(e)!==i7.null){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.null,received:t.parsedType}),u7}return f7(e.data)}},I4t.create=e=>new I4t({typeName:I7.ZodNull,...g0(e)}),b7=class extends _7{constructor(){super(...arguments),this._any=!0}_parse(e){return f7(e.data)}},b7.create=e=>new b7({typeName:I7.ZodAny,...g0(e)}),L4t=class extends _7{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f7(e.data)}},L4t.create=e=>new L4t({typeName:I7.ZodUnknown,...g0(e)}),x7=class extends _7{_parse(e){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.never,received:t.parsedType}),u7}},x7.create=e=>new x7({typeName:I7.ZodNever,...g0(e)}),R4t=class extends _7{_parse(e){if(this._getType(e)!==i7.undefined){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.void,received:t.parsedType}),u7}return f7(e.data)}},R4t.create=e=>new R4t({typeName:I7.ZodVoid,...g0(e)}),S7=class e extends _7{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i7.array)return h0(t,{code:o7.invalid_type,expected:i7.array,received:t.parsedType}),u7;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(h0(t,{code:e?o7.too_big:o7.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(h0(t,{code:o7.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(h0(t,{code:o7.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new g7(t,e,t.path,n)))).then(e=>l7.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new g7(t,e,t.path,n)));return l7.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:h7.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:h7.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:h7.toString(n)}})}nonempty(e){return this.min(1,e)}},S7.create=(e,t)=>new S7({type:e,minLength:null,maxLength:null,exactLength:null,typeName:I7.ZodArray,...g0(t)}),C7=class e extends _7{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=r7.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==i7.object){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.object,received:t.parsedType}),u7}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof x7&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new g7(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof x7){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(h0(n,{code:o7.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new g7(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>l7.mergeObjectSync(t,e)):l7.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return h7.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:h7.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:I7.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of r7.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of r7.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return _0(this)}partial(t){let n={};for(let e of r7.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of r7.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof j7;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qRt(r7.objectKeys(this.shape))}},C7.create=(e,t)=>new C7({shape:()=>e,unknownKeys:`strip`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),C7.strictCreate=(e,t)=>new C7({shape:()=>e,unknownKeys:`strict`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),C7.lazycreate=(e,t)=>new C7({shape:e,unknownKeys:`strip`,catchall:x7.create(),typeName:I7.ZodObject,...g0(t)}),w7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new s7(e.ctx.common.issues));return h0(t,{code:o7.invalid_union,unionErrors:n}),u7}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new s7(e));return h0(t,{code:o7.invalid_union,unionErrors:i}),u7}}get options(){return this._def.options}},w7.create=(e,t)=>new w7({options:e,typeName:I7.ZodUnion,...g0(t)}),T7=class extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(u4t(e)||u4t(r))return u7;let i=KRt(e.value,r.value);return i.valid?((d4t(e)||d4t(r))&&t.dirty(),{status:t.value,value:i.data}):(h0(n,{code:o7.invalid_intersection_types}),u7)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}},T7.create=(e,t,n)=>new T7({left:e,right:t,typeName:I7.ZodIntersection,...g0(n)}),E7=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.array)return h0(n,{code:o7.invalid_type,expected:i7.array,received:n.parsedType}),u7;if(n.data.length<this._def.items.length)return h0(n,{code:o7.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),u7;!this._def.rest&&n.data.length>this._def.items.length&&(h0(n,{code:o7.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new g7(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>l7.mergeArray(t,e)):l7.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}},E7.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new E7({items:e,typeName:I7.ZodTuple,rest:null,...g0(t)})},z4t=class extends _7{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.map)return h0(n,{code:o7.invalid_type,expected:i7.map,received:n.parsedType}),u7;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new g7(n,e,n.path,[a,`key`])),value:i._parse(new g7(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return u7;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return u7;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}},z4t.create=(e,t,n)=>new z4t({valueType:t,keyType:e,typeName:I7.ZodMap,...g0(n)}),B4t=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i7.set)return h0(n,{code:o7.invalid_type,expected:i7.set,received:n.parsedType}),u7;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(h0(n,{code:o7.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(h0(n,{code:o7.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return u7;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new g7(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:h7.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:h7.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},B4t.create=(e,t)=>new B4t({valueType:e,minSize:null,maxSize:null,typeName:I7.ZodSet,...g0(t)}),V4t=class extends _7{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}},V4t.create=(e,t)=>new V4t({getter:e,typeName:I7.ZodLazy,...g0(t)}),D7=class extends _7{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h0(t,{received:t.data,code:o7.invalid_literal,expected:this._def.value}),u7}return{status:`valid`,value:e.data}}get value(){return this._def.value}},D7.create=(e,t)=>new D7({value:e,typeName:I7.ZodLiteral,...g0(t)}),O7=class e extends _7{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return h0(t,{expected:r7.joinValues(n),received:t.parsedType,code:o7.invalid_type}),u7}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return h0(t,{received:t.data,code:o7.invalid_enum_value,options:n}),u7}return f7(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}},O7.create=qRt,H4t=class extends _7{_parse(e){let t=r7.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==i7.string&&n.parsedType!==i7.number){let e=r7.objectValues(t);return h0(n,{expected:r7.joinValues(e),received:n.parsedType,code:o7.invalid_type}),u7}if(this._cache||=new Set(r7.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=r7.objectValues(t);return h0(n,{received:n.data,code:o7.invalid_enum_value,options:e}),u7}return f7(e.data)}get enum(){return this._def.values}},H4t.create=(e,t)=>new H4t({values:e,typeName:I7.ZodNativeEnum,...g0(t)}),k7=class extends _7{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==i7.promise&&t.common.async===!1?(h0(t,{code:o7.invalid_type,expected:i7.promise,received:t.parsedType}),u7):f7((t.parsedType===i7.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}},k7.create=(e,t)=>new k7({type:e,typeName:I7.ZodPromise,...g0(t)}),A7=class extends _7{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I7.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{h0(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return u7;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?u7:r.status===`dirty`||t.value===`dirty`?d7(r.value):r});{if(t.value===`aborted`)return u7;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?u7:r.status===`dirty`||t.value===`dirty`?d7(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?u7:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?u7:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!p7(e))return u7;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>p7(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):u7);r7.assertNever(r)}},A7.create=(e,t,n)=>new A7({schema:e,typeName:I7.ZodEffects,effect:t,...g0(n)}),A7.createWithPreprocess=(e,t,n)=>new A7({schema:t,effect:{type:`preprocess`,transform:e},typeName:I7.ZodEffects,...g0(n)}),j7=class extends _7{_parse(e){return this._getType(e)===i7.undefined?f7(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},j7.create=(e,t)=>new j7({innerType:e,typeName:I7.ZodOptional,...g0(t)}),M7=class extends _7{_parse(e){return this._getType(e)===i7.null?f7(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},M7.create=(e,t)=>new M7({innerType:e,typeName:I7.ZodNullable,...g0(t)}),N7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===i7.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},N7.create=(e,t)=>new N7({innerType:e,typeName:I7.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...g0(t)}),P7=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return m7(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new s7(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new s7(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}},P7.create=(e,t)=>new P7({innerType:e,typeName:I7.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...g0(t)}),U4t=class extends _7{_parse(e){if(this._getType(e)!==i7.nan){let t=this._getOrReturnCtx(e);return h0(t,{code:o7.invalid_type,expected:i7.nan,received:t.parsedType}),u7}return{status:`valid`,value:e.data}}},U4t.create=e=>new U4t({typeName:I7.ZodNaN,...g0(e)}),W4t=class extends _7{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},G4t=class e extends _7{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?u7:e.status===`dirty`?(t.dirty(),d7(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?u7:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:I7.ZodPipeline})}},F7=class extends _7{_parse(e){let t=this._def.innerType._parse(e),n=e=>(p7(e)&&(e.value=Object.freeze(e.value)),e);return m7(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}},F7.create=(e,t)=>new F7({innerType:e,typeName:I7.ZodReadonly,...g0(t)}),(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(I7||={}),K4t=(e,t={message:`Input not instance of ${e.name}`})=>YRt(t=>t instanceof e,t),L7=v7.create,q4t=y7.create,b7.create,x7.create,J4t=S7.create,R7=C7.create,w7.create,T7.create,E7.create,z7=D7.create,O7.create,k7.create,j7.create,M7.create,Y4t=class{static async createBugReport(e,t){return(await B0.post(`/api/bug-reports`,e,t?{headers:{"X-API-Key":t}}:void 0)).data}static async getUserBugReports(e){return(await B0.get(`/api/bug-reports/my-reports`,e?{headers:{"X-API-Key":e}}:void 0)).data}static async getBugReportById(e,t){return(await B0.get(`/api/bug-reports/${e}`,t?{headers:{"X-API-Key":t}}:void 0)).data}},X4t=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],B7=`JPEG, PNG, GIF, WebP`,Z4t=10*1024*1024,Q4t=R7({title:L7().trim().min(3,`Title must be at least 3 characters`).max(100,`Title must not exceed 100 characters`),description:L7().trim().min(10,`Description must be at least 10 characters`).max(2e3,`Description must not exceed 2000 characters`),errorMessage:L7().max(5e3,`Error message must not exceed 5000 characters`).optional().or(z7(``)),url:L7().url(`Please enter a valid URL`).optional().or(z7(``)),attachments:J4t(K4t(File)).max(3,`Maximum 3 attachments allowed`).optional()}),$4t=[{value:`bar`,label:`Bar`,description:`Compare values across categories`},{value:`horizontal-bar`,label:`Horizontal`,description:`Long labels read left-to-right`},{value:`line`,label:`Line`,description:`Trends over a continuous range`},{value:`pie`,label:`Pie`,description:`Whole split into a few parts`},{value:`donut`,label:`Donut`,description:`Pie with a value in the middle`}],e3t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(FDt(),gCt))),V7=(0,Q.forwardRef)(({title:e,icon:t,onChange:n,className:r,...i},a)=>{let[o,s]=(0,Q.useState)(!1),c=e=>{n&&n(e),s(!1)};return(0,X.jsxs)(m8,{open:o,onOpenChange:s,modal:!1,children:[(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-shrink-0 cteditor-rounded-sm hover:cteditor-bg-accent cteditor-flex cteditor-items-center cteditor-gap-2`,r),title:e,...i,children:[(0,X.jsx)(`div`,{children:t}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-[13px] cteditor-text-left`,children:`Emoji`})]})}),(0,X.jsx)(g8,{ref:a,className:`cteditor-w-auto cteditor-p-0 cteditor-border-none !cteditor-z-[99999] max-md:!cteditor-p-0`,sideOffset:5,id:`emoji-picker`,collisionPadding:12,children:(0,X.jsx)(`div`,{className:`cteditor-w-[350px] cteditor-max-w-[calc(100vw-70px)] cteditor-p-0`,children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(`div`,{className:`cteditor-w-[350px] cteditor-max-w-[calc(100vw-70px)] `,"aria-hidden":`true`}),children:(0,X.jsx)(e3t,{onEmojiClick:c,width:`100%`,height:400,searchPlaceHolder:`Search emojis...`})})})})]})}),V7.displayName=`EmojiPickerWidget`,t3t=class{static async createSuggestion(e,t){return(await B0.post(`/api/feature-suggestions`,e,t?{headers:{"X-API-Key":t}}:void 0)).data}},n3t=R7({title:L7().trim().min(3,`Title must be at least 3 characters`).max(100,`Title must not exceed 100 characters`),description:L7().trim().min(10,`Description must be at least 10 characters`).max(1e3,`Description must not exceed 1000 characters`),link:L7().url(`Please enter a valid URL`).optional().or(z7(``))}),r3t=[{value:`productivity`,label:`Productivity`},{value:`integrations`,label:`Integrations`},{value:`ui_design`,label:`UI / Design`},{value:`performance`,label:`Performance`},{value:`mobile`,label:`Mobile`},{value:`accessibility`,label:`Accessibility`},{value:`other`,label:`Other`}],i3t=[`Be specific about what you want and why it would be useful.`,`Explain the problem your suggestion would solve.`,`Consider how other users might benefit from this feature.`,`Include any relevant examples or use cases.`],H7=R7({rating:q4t().min(1,`Please select a rating`).max(5,`Rating must be between 1 and 5`),comment:L7().max(500,`Comment must be less than 500 characters`).optional()}),a3t=[``,`Poor`,`Fair`,`Good`,`Very Good`,`Excellent`],U7=500,W7={toolbarContainer:`toolbar-features cteditor-flex cteditor-text-foreground cteditor-px-2 cteditor-py-1 cteditor-border-main-border/10 dark:cteditor-border-main-border/[0.07] cteditor-items-center cteditor-gap-1.5 cteditor-relative cteditor-w-full cteditor-min-h-11 cteditor-overflow-hidden `,toolbarInnerContent:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-overflow-y-hidden cteditor-flex-nowrap md:cteditor-overflow-hidden no-scrollbar`,moreMenuTriggerButton:`!cteditor-px-1 !cteditor-py-0.5 !cteditor-h-7 !cteditor-gap-1 dark:!cteditor-bg-body/20 !cteditor-bg-body !cteditor-rounded-md cteditor-border !cteditor-border-foreground/5`,searchWrapper:`cteditor-relative`,searchIcon:`cteditor-absolute cteditor-left-2.5 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-size-3.5 cteditor-text-muted-foreground/60`,searchInput:`cteditor-h-8 cteditor-pl-8 cteditor-border !cteditor-border-foreground/10 cteditor-pr-8 cteditor-text-xs !cteditor-bg-background/80 !cteditor-rounded-lg cteditor-shadow-sm cteditor-placeholder:text-muted-foreground/50 cteditor-transition-all focus:cteditor-ring-1 focus:cteditor-ring-primary/20 cteditor-outline-none`,searchClearButton:`cteditor-absolute cteditor-right-2 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-text-muted-foreground/60 hover:cteditor-text-foreground cteditor-transition-colors`,searchClearIcon:`!cteditor-size-3.5`,controlGroup:`cteditor-flex cteditor-items-center cteditor-gap-1.5`,dropdownSectionLabel:`cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2`,dropdownItemTrigger:`cteditor-w-full cteditor-px-2 cteditor-py-1.5 cteditor-h-auto hover:cteditor-bg-foreground/5 cteditor-rounded-sm`,searchEmptyStateContainer:`cteditor-py-8 cteditor-text-center cteditor-text-muted-foreground/60`,searchEmptyStateIcon:`cteditor-size-8 cteditor-mx-auto cteditor-mb-2 cteditor-opacity-40`,searchEmptyStateTitle:`cteditor-text-sm`,searchEmptyStateDescription:`cteditor-text-xs cteditor-mt-1`,searchStatusText:`cteditor-text-[10px] cteditor-text-muted-foreground/60 cteditor-mt-1.5 cteditor-px-0.5`,categoryHeader:`cteditor-flex cteditor-items-center cteditor-px-2 cteditor-pt-2.5 cteditor-pb-1 cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground cteditor-tracking-widest`,categoryHeaderLine:`cteditor-flex-1 cteditor-h-px cteditor-bg-border/50 cteditor-ml-2`},o3t=700,s3t={"DM Sans":{family:`DM Sans`,kind:`variable`,boldWeight:500}},G7=[{label:`Sans-Serif`,fonts:[`Geist`,`Inter`,`Poppins`,`DM Sans`,`Manrope`,`Plus Jakarta Sans`,`Public Sans`,`Montserrat`,`Raleway`,`Arial`,`Helvetica`,`Verdana`,`Tahoma`]},{label:`Serif`,fonts:[`Lora`,`Merriweather`,`Playfair Display`,`Libre Baskerville`,`Georgia`,`Times New Roman`]},{label:`Monospace`,fonts:[`JetBrains Mono`,`Fira Code`,`Courier New`]},{label:`Display`,fonts:[`Bebas Neue`,`Comic Sans MS`]}],c3t=G7.flatMap(e=>e.fonts),K7=e=>e.trim().toLowerCase(),l3t=({fonts:e=c3t,activeEditor:t})=>{let[n,r]=(0,Q.useState)(`DM Sans`),[i,a]=(0,Q.useState)(``),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(new Set),l=Q.useRef(null),u=Q.useRef(!1),d=Q.useRef(!1),f=e===c3t,p=(0,Q.useMemo)(()=>{let t=new Set(e);return s.forEach(e=>t.add(e)),Array.from(t)},[e,s]),m=(0,Q.useMemo)(()=>{let t=new Set(e);return Array.from(s).filter(e=>!t.has(e))},[e,s]),h=(0,Q.useMemo)(()=>{if(!i)return G7;let e=K7(i);return G7.map(t=>({...t,fonts:t.fonts.filter(t=>K7(t).includes(e))})).filter(e=>e.fonts.length>0)},[i]),g=(0,Q.useMemo)(()=>{if(!i)return m;let e=K7(i);return m.filter(t=>K7(t).includes(e))},[i,m]),_=(0,Q.useMemo)(()=>{if(!i)return p;let e=K7(i);return p.filter(t=>K7(t).includes(e))},[i,p]);(0,Q.useEffect)(()=>t.registerUpdateListener(({editorState:t})=>{t.read(()=>{let t=W();if(U(t)){let n=Hu(t,`font-family`,`DM Sans`).replace(/^["']|["']$/g,``).trim();if(u.current){u.current=!1;return}if(!t.isCollapsed()&&l.current!==null&&(l.current=null,d.current=!1),d.current)return;l.current!==null&&n!==l.current&&n!==`DM Sans`&&(l.current=null),l.current===null&&(r(n),n&&n!==`DM Sans`&&!e.includes(n)&&c(e=>{if(e.has(n))return e;let t=new Set(e);return t.add(n),t}))}})}),[t,e]),(0,Q.useEffect)(()=>t.registerCommand(gc,e=>{if(l.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=l.current,t=W();U(t)&&t.isCollapsed()&&Bu(t,rzt(e)),d.current=!1}return!1},4),[t]),(0,Q.useEffect)(()=>{let e=t.getRootElement();if(!e)return;let n=()=>{if(l.current!==null){let e=l.current;t.update(()=>{let t=W();U(t)&&t.isCollapsed()&&(u.current=!0,Bu(t,rzt(e)))})}};return e.addEventListener(`focus`,n),()=>{e.removeEventListener(`focus`,n)}},[t]);let v=(0,Q.useCallback)(e=>{l.current=e,u.current=!0,d.current=!0,t.update(()=>{let t=W();U(t)&&Bu(t,rzt(e))})},[t]),y=e=>{r(e),v(e),a(``)};(0,Q.useEffect)(()=>{let e=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(e)},[i]);let b=e=>{e.preventDefault()};return(0,X.jsxs)($6,{value:n,onValueChange:y,children:[(0,X.jsx)(t8,{className:`!cteditor-h-7.5 cteditor-text-foreground md:!cteditor-w-[120px] cteditor-text-xs max-md:cteditor-w-full !cteditor-bg-foreground/[0.03] dark:cteditor-bg-foreground/[0.02] !cteditor-rounded-md !cteditor-border-foreground/5 !cteditor-shadow-none`,onMouseDown:b,children:(0,X.jsx)(e8,{placeholder:`Select font`})}),(0,X.jsxs)(n8,{onMouseDown:b,className:`cteditor-border-foreground/20`,children:[(0,X.jsxs)(`div`,{className:`${W7.searchWrapper} cteditor-mb-1`,onMouseDown:b,children:[(0,X.jsx)(C2,{className:W7.searchIcon}),(0,X.jsx)(`input`,{ref:o,type:`text`,placeholder:`Search fonts...`,value:i,onChange:e=>a(e.target.value),onMouseDown:e=>e.stopPropagation(),className:W7.searchInput})]}),f?(0,X.jsxs)(X.Fragment,{children:[h.map((e,t)=>(0,X.jsxs)(Q.Fragment,{children:[t>0&&(0,X.jsx)(a8,{}),(0,X.jsxs)(nQt,{children:[(0,X.jsx)(r8,{className:`cteditor-text-[10px] cteditor-uppercase cteditor-tracking-wider cteditor-text-muted-foreground cteditor-font-medium`,children:e.label}),e.fonts.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e))]})]},e.label)),g.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(a8,{}),(0,X.jsxs)(nQt,{children:[(0,X.jsx)(r8,{className:`cteditor-text-[10px] cteditor-uppercase cteditor-tracking-wider cteditor-text-muted-foreground cteditor-font-medium`,children:`Detected`}),g.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e))]})]}),h.length===0&&g.length===0&&(0,X.jsx)(`div`,{className:`cteditor-py-4 cteditor-text-center cteditor-text-sm cteditor-text-muted-foreground`,children:`No fonts found`})]}):(0,X.jsxs)(X.Fragment,{children:[_.map(e=>(0,X.jsx)(i8,{value:e,style:{fontFamily:e},onMouseDown:b,children:e},e)),_.length===0&&(0,X.jsx)(`div`,{className:`cteditor-py-4 cteditor-text-center cteditor-text-sm cteditor-text-muted-foreground`,children:`No fonts found`})]})]})]})},u3t=8,d3t=400,q7=16,f3t=2,J7=(e,t)=>{let n=Hu(t,`font-size`,``);if(n)return izt(n);let r=e.getElementByKey(t.anchor.getNode().getKey());if(r){let e=parseFloat(window.getComputedStyle(r).fontSize);if(!isNaN(e))return Math.round(e)}return q7},p3t=e=>{let t=q7;return e.getEditorState().read(()=>{let n=W();U(n)&&(t=J7(e,n))}),t},Y7=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(()=>p3t(e)),[r,i]=(0,Q.useState)(()=>p3t(e).toString()),a=Q.useRef(null),o=Q.useRef(!1),s=Q.useRef(null);(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:t})=>{t.read(()=>{let t=W();if(U(t)){let r=J7(e,t);if(o.current){o.current=!1;return}!t.isCollapsed()&&a.current!==null&&(a.current=null),a.current!==null&&r!==a.current&&r!==q7&&(a.current=null),a.current===null&&(n(r),i(r.toString()))}})}),[e]),(0,Q.useEffect)(()=>e.registerCommand(gc,e=>{if(a.current!==null&&e.key.length===1&&!e.ctrlKey&&!e.metaKey){let e=a.current,t=W();U(t)&&t.isCollapsed()&&Bu(t,{"font-size":`${e}px`})}return!1},4),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=()=>{if(a.current!==null){let t=a.current;e.update(()=>{let e=W();U(e)&&e.isCollapsed()&&(o.current=!0,Bu(e,{"font-size":`${t}px`}))})}};return t.addEventListener(`focus`,n),()=>{t.removeEventListener(`focus`,n)}},[e]);let c=(0,Q.useCallback)(t=>{a.current=t,o.current=!0,e.update(()=>{s.current&&=(Zi(s.current.clone()),null);let e=W();U(e)&&Bu(e,{"font-size":`${t}px`})})},[e]),l=e=>{i(e.target.value.replace(/\D/g,``))},u=()=>{if(r===``||isNaN(Number(r)))i(t.toString());else{let e=Math.max(u3t,Math.min(Number(r),d3t));n(e),i(e.toString()),c(e)}},d=()=>{e.getEditorState().read(()=>{let e=W();U(e)&&(s.current=e.clone())})},f=n=>{n.stopPropagation(),n.key===`Enter`&&(n.preventDefault(),u(),e.focus()),n.key===`Escape`&&(i(t.toString()),s.current=null,e.focus())},p=()=>{let r=t;e.getEditorState().read(()=>{let t=W();U(t)&&(r=J7(e,t))});let a=Math.min(r+f3t,d3t);n(a),i(a.toString()),c(a)},m=()=>{let r=t;e.getEditorState().read(()=>{let t=W();U(t)&&(r=J7(e,t))});let a=Math.max(r-f3t,u3t);n(a),i(a.toString()),c(a)},h=e=>{e.preventDefault()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-bg-foreground/[0.03] dark:cteditor-bg-foreground/[0.02] cteditor-px-1 cteditor-rounded-md cteditor-border cteditor-border-foreground/5`,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:m,onMouseDown:h,className:`cteditor-text-foreground/50 !cteditor-w-5.5 !cteditor-bg-transparent !cteditor-h-7`,children:(0,X.jsx)(kUt,{className:`!cteditor-size-4`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Decrease Font Size`})})]})}),(0,X.jsx)(N6,{className:`cteditor-max-w-7 !cteditor-h-7 !cteditor-p-0 !cteditor-text-center cteditor-border-none !cteditor-outline-0 !cteditor-outline-none !cteditor-ring-0 !cteditor-shadow-none `,value:r,onChange:l,onFocus:d,onBlur:u,onKeyDown:f}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:p,onMouseDown:h,className:`cteditor-text-foreground/50 !cteditor-w-5.5 !cteditor-bg-transparent !cteditor-h-7`,children:(0,X.jsx)(x2,{className:`!cteditor-size-4`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Increase Font Size`})})]})})]})},m3t=[`bold`,`italic`,`strikethrough`,`underline`,`code`,`subscript`,`superscript`],h3t=({hasFormat:e})=>{let[t]=Gd(),n=Q8.filter(e=>m3t.includes(e.payload));return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`toolbar`,size:`icon-sm`,className:`cteditor-text-foreground/50`,children:(0,X.jsx)(c2,{className:`!cteditor-size-4`})})}),(0,X.jsx)(Q5,{align:`end`,children:n.map((n,r)=>(0,X.jsxs)($5,{className:k$(e[n.payload]&&`cteditor-bg-foreground/10`),onClick:()=>t.dispatchCommand(pc,n.payload),children:[(0,X.jsx)(`span`,{children:n.icon}),(0,X.jsx)(`span`,{children:n.name})]},r))})]})},g3t=`cteditor-z-[9999] cteditor-border-0 cteditor-bg-transparent cteditor-p-0 cteditor-shadow-none cteditor-overflow-visible data-[side=bottom]:cteditor-slide-in-from-top-2 data-[side=top]:cteditor-slide-in-from-bottom-2 data-[side=left]:cteditor-slide-in-from-right-2 data-[side=right]:cteditor-slide-in-from-left-2 !cteditor-p-0`,X7=({featureName:e,displayTitle:t,planUnlockCatalogKey:n,tooltipMessage:r,side:i=`right`,sideOffset:a=10,align:o=`center`,alignOffset:s=0})=>(0,X.jsxs)($3,{side:i,sideOffset:a,align:o,alignOffset:s,className:k$(g3t),children:[(0,X.jsx)(n6,{featureName:e,displayTitle:t,planUnlockCatalogKey:n,tooltipMessage:r}),(0,X.jsx)(e6,{className:`cteditor-z-10`})]}),Z7=[`bold`,`italic`,`strikethrough`,`underline`,`code`,`subscript`,`superscript`],_3t=({hasFormat:e,blockType:t})=>{let[n]=Gd(),{editorConfig:r}=G0(),i=r?.toolbarOptions,a=r?.hideLockedFeatures??!1,o=i?.enableCodeFormat??!0,s=i?.enableLists??!0,c=i?.enableBlockquote??!0,l=e=>{switch(e){case`codeBlock`:return o;case`bullet`:case`number`:case`check`:return s;case`quote`:return c;default:return!0}},u=e=>{switch(e){case`codeBlock`:return`Code Format`;case`bullet`:case`number`:case`check`:return`Lists`;case`quote`:return`Blockquote`;default:return`Text Formatting`}},d=e=>{if(Z7.includes(e)){n.dispatchCommand(pc,e);return}n.update(()=>{let r=W();if(U(r))switch(e){case`codeBlock`:if(r.isCollapsed())Vu(r,()=>sd());else{let e=r.getTextContent(),t=sd();r.insertNodes([t]),r.insertRawText(e)}break;case`bullet`:t===`bullet`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Bd,void 0);break;case`number`:t===`number`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Vd,void 0);break;case`check`:t===`check`?n.dispatchCommand(Ud,void 0):n.dispatchCommand(Hd,void 0);break;case`quote`:Vu(r,()=>Df());break}})},f=Q8.filter(e=>Z7.includes(e.payload)),p=Q8.filter(e=>!Z7.includes(e.payload));return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-w-full`,children:[f.map((t,n)=>(0,X.jsxs)(Q2,{variant:`ghost`,size:`sm`,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-size-4 [&>svg]:cteditor-shrink-0 !cteditor-justify-start cteditor-h-auto `,e[t.payload]&&`cteditor-bg-foreground/10`),onClick:()=>d(t.payload),title:t.name,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:t.icon}),(0,X.jsx)(`span`,{children:t.name})]},n)),p.map((e,n)=>{let r=l(e.payload);if(!r&&a)return null;if(!r){let t=u(e.payload);return(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-opacity-50 cteditor-cursor-not-allowed`,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:e.icon}),(0,X.jsx)(`span`,{className:`cteditor-flex-1`,children:e.name}),(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:t,displayTitle:e.name,side:`right`})]})},`list-quote-${n}`)}return(0,X.jsxs)(Q2,{variant:`ghost`,size:`sm`,className:k$(`cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-size-4 [&>svg]:cteditor-shrink-0 !cteditor-justify-start cteditor-h-auto`,t===e.payload&&`cteditor-bg-foreground/10`),onClick:()=>d(e.payload),title:e.name,children:[(0,X.jsx)(`span`,{className:`[&>svg]:cteditor-size-4`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},`list-quote-${n}`)})]})},v3t=di(`INSERT_HTML_CANVAS_COMMAND`),y3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>e.registerCommand(v3t,t=>{let{htmlContent:n,width:r,height:i}=t;return e.update(()=>{let e=DFt({htmlContent:n,width:r||`100%`,height:i||`auto`}),t=Qs(),a=W();U(a)?(a.insertNodes([e]),e.insertAfter(t),t.select()):(Yi().append(e,t),t.select())}),!0},0),[e]),null},b3t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(I7e(),xqe))),x3t=({open:e,onOpenChange:t})=>{let[n]=Gd(),[r,i]=(0,Q.useState)(``),a=(0,Q.useRef)(``),[o,s]=(0,Q.useState)(`code`),[c,l]=(0,Q.useState)(`desktop`),[u,d]=(0,Q.useState)(100),[f,p]=(0,Q.useState)(400),m=(0,Q.useRef)(null),h=azt(),g=e=>{a.current=e,i(e)},_=r.trim();return(0,Q.useEffect)(()=>{o===`preview`&&m.current&&_&&(m.current.srcdoc=ozt(_,h))},[o,_,h]),(0,X.jsx)(x6,{open:e,modal:!0,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`!cteditor-max-w-[1320px] cteditor-w-full cteditor-h-[90vh] !cteditor-flex !cteditor-flex-col cteditor-p-0 cteditor-overflow-hidden !cteditor-p-0 !cteditor-gap-0`,"aria-describedby":void 0,children:[(0,X.jsx)(T6,{className:`cteditor-sr-only`,children:`Insert HTML Canvas`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-justify-between cteditor-px-6 cteditor-py-4 cteditor-gap-4 `,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3`,children:[(0,X.jsx)(lUt,{}),(0,X.jsx)(`div`,{children:(0,X.jsx)(`h2`,{className:`cteditor-text-lg cteditor-font-semibold cteditor-text-foreground`,children:`Insert HTML Canvas`})})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-3 cteditor-py-2 cteditor-bg-primary/10 cteditor-rounded-md cteditor-text-xs `,children:[(0,X.jsx)(_2,{className:`cteditor-flex-shrink-0 cteditor-text-green-500 cteditor-size-4`}),(0,X.jsxs)(`div`,{className:`cteditor-text-sm cteditor-text-foreground`,children:[(0,X.jsx)(`strong`,{children:`HTML Canvas`}),` preserves the full visual appearance of your HTML including backgrounds, gradients, and layout styles. Paste code, use `,(0,X.jsx)(`strong`,{children:`Preview`}),` to see how it looks (Desktop / Tablet / Mobile), then insert.`]})]})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-4 cteditor-justify-between cteditor-px-6 cteditor-pb-4 cteditor-items-center cteditor-border-b cteditor-border-border cteditor-flex-wrap cteditor-gap-2`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`label`,{className:`cteditor-block cteditor-font-medium cteditor-text-foreground`,children:`HTML Content`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-muted/50 cteditor-rounded-lg cteditor-p-1 [&>button]:cteditor-text-xs`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`code`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-transition-colors ${o===`code`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Edit HTML code`,children:[(0,X.jsx)(cUt,{className:`cteditor-w-3.5 cteditor-h-3.5`}),`Code`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`preview`),disabled:!_,className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-transition-colors ${o===`preview`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`} ${_?``:`cteditor-opacity-50 cteditor-pointer-events-none`}`,title:`Preview HTML (Desktop / Tablet / Mobile)`,children:[(0,X.jsx)(m2,{className:`cteditor-w-3.5 cteditor-h-3.5`}),`Preview`]})]})]}),(0,X.jsx)(Q2,{onClick:()=>{let e=a.current||r;e.trim()&&(n.dispatchCommand(v3t,{htmlContent:e.trim(),width:`100%`,height:`auto`}),a.current=``,i(``),s(`code`),t(!1))},disabled:!r.trim(),variant:`default`,title:`Insert HTML Canvas into document`,className:`max-sm:cteditor-text-xs`,children:`Insert HTML Canvas`})]}),(0,X.jsx)(`div`,{className:`cteditor-p-6 cteditor-flex-1 cteditor-min-h-0 cteditor-overflow-hidden cteditor-flex cteditor-flex-col`,children:o===`code`?(0,X.jsxs)(`div`,{className:`cteditor-contents cteditor-w-full cteditor-flex-1 cteditor-min-h-0 cteditor-border cteditor-border-foreground/50 cteditor-rounded-lg cteditor-bg-foreground/5 html-codemirror-wrapper`,style:{minHeight:320,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-min-h-0 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-xs cteditor-text-muted-foreground`,children:[(0,X.jsx)(y2,{className:`cteditor-w-4 cteditor-h-4 cteditor-animate-spin cteditor-mr-2`}),`Loading editor...`]}),children:(0,X.jsx)(b3t,{value:r,onChange:g,height:`100%`,isDarkMode:h,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!1},placeholder:`Paste your HTML here... (e.g., landing page, email template). Switch to Preview to see how it looks.`,style:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace`,fontSize:`13px`,flex:1,minHeight:0},className:`cteditor-flex-1 cteditor-min-h-0`})}),r.trim()&&(0,X.jsxs)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-mt-2 cteditor-px-2 cteditor-pb-2`,children:[(0,X.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,X.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),`HTML content detected (`,r.length,` characters). Switch to Preview to see render.`]})]}):(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-flex cteditor-flex-col cteditor-min-h-0 cteditor-overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-flex-wrap cteditor-gap-4 cteditor-pb-3`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-muted/50 cteditor-rounded-lg cteditor-p-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`desktop`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`desktop`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Desktop view`,children:[(0,X.jsx)(AUt,{size:14}),`Desktop`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`tablet`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`tablet`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Tablet view (768px)`,children:[(0,X.jsx)(HUt,{size:14}),`Tablet`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(`mobile`),className:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-px-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-colors ${c===`mobile`?`cteditor-bg-background cteditor-text-foreground cteditor-shadow-sm`:`cteditor-text-muted-foreground hover:cteditor-text-foreground`}`,title:`Mobile view (375px)`,children:[(0,X.jsx)(zUt,{size:14}),`Mobile`]})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-xs cteditor-text-muted-foreground`,children:`Zoom:`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(e=>Math.max(25,e-25)),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors`,disabled:u<=25,children:`-`}),(0,X.jsxs)(`span`,{className:`cteditor-text-xs cteditor-min-w-[40px] cteditor-text-center`,children:[u,`%`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(e=>Math.min(200,e+25)),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors`,disabled:u>=200,children:`+`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>d(100),className:`cteditor-px-2 cteditor-py-1 cteditor-text-xs cteditor-bg-muted/50 cteditor-rounded hover:cteditor-bg-muted cteditor-transition-colors cteditor-ml-1`,children:`Reset`})]})]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1 cteditor-min-h-0 cteditor-overflow-auto`,style:{minHeight:200},children:(0,X.jsx)(`div`,{className:`cteditor-mx-auto cteditor-transition-all cteditor-duration-300 !cteditor-h-full`,style:{width:(()=>{switch(c){case`mobile`:return`375px`;case`tablet`:return`768px`;default:return`100%`}})(),maxWidth:`100%`,transform:`scale(${u/100})`,transformOrigin:`top center`},children:(0,X.jsx)(`iframe`,{ref:m,title:`HTML Canvas Preview`,className:`cteditor-w-full cteditor-border cteditor-border-border cteditor-rounded-md cteditor-bg-background cteditor-text-foreground !cteditor-h-full`,style:{height:f,display:`block`},sandbox:`allow-same-origin allow-scripts`,onLoad:()=>{if(m.current)try{let e=m.current.contentDocument;if(e?.body){let t=e.body.scrollHeight;p(Math.min(Math.max(t+32,200),800))}}catch{}}})})})]})})]})})},Q7=di(`INSERT_IMAGE_COMMAND`),S3t=({captionsEnabled:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>{if(!t.hasNodes([c6]))throw Error(`ImagesPlugin: ImageNode not registered on editor`);return Gu(t.registerCommand(Q7,e=>{let t=u1(e);return xs([t]),ja(t.getParentOrThrow())&&Qu(t,Qs).selectEnd(),!0},0))},[e,t]),null},C3t=({onInsert:e,onDone:t})=>{let{apiKey:n}=G0(),{uploadFileToS3:r,progress:i,uploading:a,error:o}=Y8(n||void 0),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),_=o||d,v=e=>{let t=Array.from(e),n=t.filter(e=>e.type.startsWith(`image/`));if(n.length===0){f(Error(`Please select an image file (PNG, JPG, GIF, etc.)`));return}f(n.length<t.length?Error(`Skipped ${t.length-n.length} file(s) — only images can be uploaded.`):null),n.forEach(e=>{let t=`img-${++g.current}`;c(n=>[...n,{id:t,file:e,previewSrc:``,altText:``}]);let n=new FileReader;n.onload=()=>{if(typeof n.result!=`string`)return;let e=n.result,r=new Image;r.onload=()=>{c(n=>n.map(n=>n.id===t?{...n,previewSrc:e,width:r.naturalWidth,height:r.naturalHeight}:n))},r.onerror=()=>{c(n=>n.map(n=>n.id===t?{...n,previewSrc:e}:n))},r.src=e},n.readAsDataURL(e)})},y=e=>{c(t=>t.filter(t=>t.id!==e))},b=(e,t)=>{c(n=>n.map(n=>n.id===e?{...n,altText:t}:n))},x=e=>{let t=e.target.files;!t||t.length===0||(v(t),e.target.value=``)},S=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},C=e=>{e.preventDefault(),e.stopPropagation(),m(!1)},w=e=>{e.preventDefault(),e.stopPropagation(),m(!1);let t=e.dataTransfer.files;t&&t.length>0&&v(t)},T=()=>{h.current?.click()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-6`,children:[(0,X.jsx)(`input`,{ref:h,type:`file`,accept:`image/*`,multiple:!0,className:`cteditor-hidden`,onChange:x,"data-test-id":`image-modal-file-upload`}),(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:T,onDragOver:S,onDragLeave:C,onDrop:w,onKeyDown:e=>e.key===`Enter`&&T(),className:`cteditor-w-full cteditor-border cteditor-border-dashed cteditor-rounded-xl cteditor-p-8 cteditor-cursor-pointer cteditor-transition-colors cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-1 cteditor-min-h-[180px] cteditor-outline-none ${p?`cteditor-border-primary cteditor-bg-accent/50`:`cteditor-border-muted-foreground/50 hover:cteditor-border-muted-foreground`}`,children:[(0,X.jsx)(`div`,{className:`cteditor-size-8 cteditor-bg-foreground/5 cteditor-rounded-full cteditor-flex cteditor-items-center cteditor-justify-center [&>svg]:cteditor-size-6`,children:(0,X.jsx)(t3,{})}),(0,X.jsx)(`p`,{className:`cteditor-text-base cteditor-font-semibold cteditor-text-foreground cteditor-mt-3`,children:`Drop your images here`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-muted-foreground cteditor-mt-2`,children:`PNG, JPG, GIF or other image files — select as many as you like`})]}),s.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-space-y-2`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-justify-between`,children:[(0,X.jsxs)(F6,{className:`cteditor-block`,children:[s.length,` image`,s.length===1?``:`s`,` selected`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>c([]),disabled:a,className:`cteditor-text-xs cteditor-text-muted-foreground hover:cteditor-text-foreground disabled:cteditor-opacity-50`,children:`Clear all`})]}),(0,X.jsx)(`div`,{className:`cteditor-space-y-2 cteditor-max-h-[240px] cteditor-overflow-y-auto`,children:s.map(e=>(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-p-3 cteditor-rounded-md cteditor-bg-accent cteditor-text-sm`,children:[(0,X.jsx)(`div`,{className:`cteditor-size-10 cteditor-shrink-0 cteditor-rounded cteditor-overflow-hidden cteditor-bg-foreground/5 cteditor-flex cteditor-items-center cteditor-justify-center [&>svg]:cteditor-size-5`,children:e.previewSrc?(0,X.jsx)(`img`,{src:e.previewSrc,alt:``,className:`cteditor-size-full cteditor-object-cover`}):(0,X.jsx)(t3,{})}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-min-w-0 cteditor-space-y-1.5`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-foreground cteditor-truncate cteditor-block`,children:e.file.name}),(0,X.jsx)(N6,{placeholder:`Alt text (describes this image)`,value:e.altText,onChange:t=>b(e.id,t.target.value),"data-test-id":`image-modal-alt-text-input`,className:`cteditor-w-full !cteditor-h-8`})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),disabled:a,"aria-label":`Remove ${e.file.name}`,className:`cteditor-shrink-0 cteditor-text-muted-foreground hover:cteditor-text-destructive disabled:cteditor-opacity-50 [&>svg]:cteditor-size-4`,children:(0,X.jsx)(Fqt,{})})]},e.id))}),(0,X.jsxs)(Q2,{disabled:a,onClick:async()=>{if(s.length===0||a)return;f(null);let n=[],i=[],o=null;for(let e=0;e<s.length;e++){let t=s[e];if(u(e),o){i.push(t);continue}try{let e=await r(t.file);if(!e){i.push(t);continue}n.push({altText:t.altText,src:e,width:t.width,height:t.height})}catch(e){console.error(`Upload failed:`,e),o=e instanceof J8||e instanceof Error?e:Error(`Upload failed`),i.push(t)}}n.length>0&&e(n),c(i),u(0),o?f(o):t()},"data-test-id":`image-modal-file-upload-btn`,className:`cteditor-w-full cteditor-gap-1`,children:[(0,X.jsx)(sqt,{}),a?`Uploading ${l+1} of ${s.length}... ${i}%`:`Upload ${s.length} image${s.length===1?``:`s`}`]})]}),_&&(_ instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-p-3 cteditor-rounded-md cteditor-bg-destructive/10 cteditor-border cteditor-border-destructive/50`,children:[(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-destructive cteditor-text-sm`,children:`Storage Quota Exceeded`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-destructive/90 cteditor-mt-1`,children:_.message}),_.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-xs cteditor-text-destructive/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{children:[`Used: `,_.details.currentUsage,` / `,_.details.maxStorage]}),(0,X.jsxs)(`p`,{children:[`Available: `,_.details.availableStorage]}),(0,X.jsxs)(`p`,{children:[`File size: `,_.details.requestedSize]})]})]}):(0,X.jsxs)(`p`,{className:`cteditor-text-sm cteditor-text-destructive`,children:[`Error: `,_.message]}))]})},w3t=({onClick:e})=>{let[t,n]=(0,Q.useState)(``),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),{apiKey:h}=G0(),g=d,_=e=>{try{let t=new URL(e);if(t.hostname.includes(`google.com`)&&t.pathname===`/imgres`){let e=t.searchParams.get(`imgurl`);if(e)return e}if(t.hostname.includes(`bing.com`)&&t.pathname.includes(`/images/`)){let e=t.searchParams.get(`mediaurl`);if(e)return e}}catch{}return e},v=e=>{if(!e.trim())return!1;try{if(e.startsWith(`data:image/`))return!0;let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)}catch{return!1}},y=e=>{let t=_(e);if(n(t),c(null),!t.trim()){o(!1);return}let r=v(t);if(o(r),r){let e=new Image;e.onload=()=>{c(null),o(!0),u({width:e.naturalWidth,height:e.naturalHeight})},e.onerror=()=>{c(`Failed to load image preview. The image URL may be invalid or inaccessible. You can still try to insert it.`)},e.src=t}};return(0,X.jsxs)(`div`,{className:`cteditor-space-y-4`,children:[t&&a&&!s&&(0,X.jsx)(`div`,{className:`cteditor-mb-4 cteditor-flex cteditor-flex-col cteditor-justify-center cteditor-items-center`,children:(0,X.jsx)(`img`,{src:t,alt:`Preview`,className:`cteditor-max-w-full cteditor-max-h-[200px] cteditor-object-contain cteditor-rounded-md`,onError:()=>{c(`Failed to load image preview. The image URL may be invalid or inaccessible. You can still try to insert it.`)}})}),s&&(0,X.jsx)(`div`,{className:`cteditor-mb-4 cteditor-p-2 cteditor-bg-red-50 cteditor-border cteditor-border-red-200 rcteditor-ounded cteditor-text-red-600 cteditor-text-sm`,children:s}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(F6,{htmlFor:`image-url`,className:`cteditor-mb-2 cteditor-block`,children:`Image URL`}),(0,X.jsx)(N6,{id:`image-url`,type:`url`,placeholder:`https://example.com/image.jpg`,value:t,onChange:e=>y(e.target.value),"data-test-id":`image-modal-url-input`,className:`!cteditor-w-full`}),t&&!a&&!s&&(0,X.jsx)(`p`,{className:`cteditor-text-sm cteditor-text-red-500 cteditor-mt-1`,children:`Please enter a valid image URL`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(F6,{htmlFor:`alt-text-url`,className:`!cteditor-mb-2 !cteditor-block`,children:`Alt Text`}),(0,X.jsx)(N6,{id:`alt-text-url`,placeholder:`Descriptive alternative text`,value:r,onChange:e=>i(e.target.value),"data-test-id":`image-modal-url-alt-text-input`,className:`!cteditor-w-full`})]}),g&&(g instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-p-3 cteditor-rounded-md cteditor-bg-destructive/10 cteditor-border cteditor-border-destructive/50`,children:[(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-destructive cteditor-text-sm`,children:`Storage Quota Exceeded`}),(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-destructive/90 cteditor-mt-1`,children:g.message}),g.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-xs cteditor-text-destructive/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{children:[`Used: `,g.details.currentUsage,` / `,g.details.maxStorage]}),(0,X.jsxs)(`p`,{children:[`Available: `,g.details.availableStorage]}),(0,X.jsxs)(`p`,{children:[`File size: `,g.details.requestedSize]})]})]}):(0,X.jsxs)(`p`,{className:`cteditor-text-sm cteditor-text-destructive`,children:[`Error: `,g.message]})),(0,X.jsx)(`div`,{className:`cteditor-text-center`,children:(0,X.jsx)(Q2,{disabled:!t||!a||p,onClick:async()=>{if(!(!t||!a||p)){f(null),m(!0);try{if(!h){e({altText:r,src:t,width:l?.width,height:l?.height});return}let n=(await B0.post(V0.project.fileUploadFromUrl,{url:t,prefix:`uploads`},{headers:{...h&&{"x-api-key":h}}})).data.fileUrl;e({altText:r,src:n,width:l?.width,height:l?.height})}catch(e){if(console.error(`Failed to upload image from URL:`,e),e instanceof Jr&&e.response?.data){let t=e.response.data;e.response.status===413&&t.error===`Storage quota exceeded`?f(new J8(t.message||`Storage quota exceeded`,t.details)):f(Error(t.message||`Failed to upload image`))}else e instanceof Error?f(e):f(Error(`Failed to upload image`))}finally{m(!1)}}},"data-test-id":`image-modal-url-insert-btn`,children:p?`Uploading...`:`Insert Image`})})]})},$7=({activeEditor:e,onClose:t})=>{let[n,r]=(0,Q.useState)(`file`),i=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{i.current=!1;let e=e=>{i.current=e.altKey};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[e]);let a=t=>{t.forEach(t=>e.dispatchCommand(Q7,t))};return(0,X.jsx)(x6,{open:!0,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`cteditor-w-full sm:cteditor-max-w-4xl [&>.closeDialog]:cteditor-top-1 [&>.closeDialog]:cteditor-right-1`,children:[(0,X.jsx)(C6,{className:`cteditor-sr-only`,children:(0,X.jsx)(T6,{children:`Insert Image`})}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-4 `,children:n===`file`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(C3t,{onInsert:a,onDone:t}),(0,X.jsx)(`p`,{className:`cteditor-text-center cteditor-text-foreground cteditor-text-xs`,children:`OR`}),(0,X.jsx)(`div`,{className:`cteditor-text-center`,children:(0,X.jsxs)(Q2,{onClick:()=>r(`url`),className:`cteditor-gap-1`,children:[(0,X.jsx)(G4,{}),`Insert via URL`]})})]}):(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(w3t,{onClick:e=>{a([e]),t()}})})})]})})},T3t=di(),E3t=[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],D3t=[`image/`,`image/heic`,`image/heif`,`image/gif`,`image/webp`,`image/png`,`image/jpg`,`image/jpeg`,`image/svg+xml`],O3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>e.registerCommand(T3t,({src:t,linkText:n,fileSize:r,mimeType:i})=>{try{return e.update(()=>{e.focus();let a=W(),o=szt(i,E3t)?R1({src:t}):szt(i,D3t)?u1({src:t,altText:n||`Uploaded image`}):E1({src:t,fileName:n||t.split(`/`).pop()||`Download File`,fileSize:r});if(U(a))a.insertNodes([o]);else{let e=Qs();e.append(o),Yi().append(e)}}),!0}catch(e){return console.error(`Error in INSERT_FILE_COMMAND handler:`,e),!1}},0),[e]),(0,Q.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let n=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n){if(t.hasAttribute(`download`)){e.preventDefault(),window.open(n,`_blank`);return}e.preventDefault()}};return t.addEventListener(`click`,n),()=>{t.removeEventListener(`click`,n)}},[e]),null},k3t=new Set(`.exe,.msi,.bat,.cmd,.sh,.ps1,.apk,.dmg,.jar,.php,.py,.rb,.pl,.wasm,.svg,.html,.htm,.js,.mjs,.cjs,.ts,.tsx,.jsx,.xml,.xhtml,.rar,.tar,.gz,.bz2`.split(`,`)),A3t=`This file type is not allowed for security reasons.`,j3t=e=>e.includes(`.`)?`.${e.split(`.`).pop().toLowerCase()}`:``,M3t=e=>{let t=j3t(e.name);return k3t.has(t)?A3t:null},N3t=20,P3t=`cteditor-relative cteditor-rounded-[14px] cteditor-pt-[26px] cteditor-px-5 cteditor-pb-[22px] cteditor-text-center cteditor-overflow-hidden hover:cteditor-bg-accent dark:hover:cteditor-bg-[#16161a] cteditor-transition-colors cteditor-duration-300 cteditor-border cteditor-border-dashed cteditor-outline-none`,F3t=`cteditor-w-11 cteditor-h-11 cteditor-mx-auto cteditor-mb-3 cteditor-rounded-xl cteditor-bg-gradient-to-b cteditor-from-gray-100 cteditor-to-white dark:cteditor-from-[#25252a] dark:cteditor-to-[#1a1a1e] cteditor-border cteditor-border-border dark:cteditor-border-white/10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-muted-foreground dark:cteditor-text-[#d1d5dc] cteditor-shadow-sm dark:cteditor-shadow-[inset_0_1px_0_0_rgba(255,255,255,.06)]`,I3t=`cteditor-grid cteditor-grid-cols-[28px_1fr_20px] cteditor-gap-2.5 cteditor-items-center cteditor-py-2 cteditor-px-2.5 cteditor-rounded-[10px] cteditor-bg-muted/30 dark:cteditor-bg-white/[0.025] cteditor-border cteditor-border-border dark:cteditor-border-white/5 cteditor-transition-colors hover:cteditor-bg-muted/50 dark:hover:cteditor-bg-white/5`,L3t=`cteditor-w-7 cteditor-h-7 cteditor-rounded-md cteditor-grid cteditor-place-items-center cteditor-font-mono cteditor-text-[9px] cteditor-font-bold cteditor-tracking-[0.02em] cteditor-bg-primary/10 dark:cteditor-bg-[rgba(99,82,232,.18)] cteditor-text-primary dark:cteditor-text-[#a99cff]`,R3t=`cteditor-text-[12.5px] cteditor-text-foreground dark:cteditor-text-white cteditor-font-medium cteditor-tracking-[-0.005em] cteditor-whitespace-nowrap cteditor-overflow-hidden cteditor-text-ellipsis cteditor-min-w-0`,z3t=`cteditor-block cteditor-h-full cteditor-bg-gradient-to-r cteditor-from-primary/80 cteditor-to-primary dark:cteditor-from-[#a99cff] dark:cteditor-to-[#6352e8] cteditor-rounded-full cteditor-shadow-sm dark:cteditor-shadow-[0_0_8px_rgba(99,82,232,.45)] cteditor-transition-all cteditor-duration-500`,B3t=({onClick:e})=>{let[t,n]=(0,Q.useState)(``),{apiKey:r}=G0(),{uploadFileToS3:i,progress:a,uploading:o,error:s}=Y8(r||void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=e=>M3t(e)||(e.size>N3t*1024*1024?`File size exceeds ${N3t}MB limit.`:null),g=e=>{let t=h(e);if(t){d(t),l(null);return}d(null),l(e)},_=e=>{let t=e.target.files;!t||t.length===0||(g(t[0]),e.target.value=``)},v=e=>{e.preventDefault(),e.stopPropagation(),p(!0)},y=e=>{e.preventDefault(),e.stopPropagation(),p(!1)},b=e=>{e.preventDefault(),e.stopPropagation(),p(!1);let t=e.dataTransfer.files;t&&t.length>0&&g(t[0])},x=()=>{m.current?.click()};return(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-3.5`,children:[(0,X.jsx)(`input`,{ref:m,type:`file`,className:`cteditor-hidden`,accept:`*/*`,onChange:_}),(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:x,onDragOver:v,onDragLeave:y,onDrop:b,onKeyDown:e=>e.key===`Enter`&&x(),className:`${P3t} ${f?`cteditor-bg-accent dark:cteditor-bg-[#16161a] cteditor-border-primary dark:cteditor-border-indigo-600`:`cteditor-bg-background dark:cteditor-bg-[#131316] cteditor-border-border dark:cteditor-border-white/10`}`,children:[(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-inset-0 cteditor-bg-[radial-gradient(120%_80%_at_50%_0%,rgba(99,82,232,.07),transparent_55%)] cteditor-pointer-events-none`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-z-10 cteditor-flex cteditor-flex-col cteditor-gap-2`,children:[(0,X.jsx)(`div`,{className:F3t,children:(0,X.jsx)(WUt,{size:22})}),(0,X.jsxs)(`h4`,{className:`cteditor-m-0 cteditor-mb-1 cteditor-text-base cteditor-font-semibold cteditor-tracking-[-0.005em] cteditor-text-foreground dark:cteditor-text-white`,children:[`Drop a file or `,(0,X.jsx)(`span`,{className:`cteditor-text-foreground dark:cteditor-text-white cteditor-border-b cteditor-border-border dark:cteditor-border-white/32 cteditor-pb-px`,children:`browse`})]}),(0,X.jsx)(`p`,{className:`cteditor-m-0 cteditor-text-[12.5px] cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:`PDF, images, docs, video · up to 20 MB each`})]})]}),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-text-[10.5px] cteditor-tracking-[0.14em] cteditor-uppercase cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-font-semibold cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-0.5`,children:[(0,X.jsx)(`span`,{children:o?`Uploading`:`Selected file`}),(0,X.jsxs)(`span`,{className:`cteditor-font-mono cteditor-tracking-normal cteditor-normal-case cteditor-text-[11px] cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:[`1 file · `,(c.size/(1024*1024)).toFixed(2),` MB`]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-gap-1.5`,children:(0,X.jsxs)(`div`,{className:I3t,children:[(0,X.jsx)(`div`,{className:L3t,children:c.name.split(`.`).pop()?.toUpperCase().substring(0,3)||`DOC`}),(0,X.jsxs)(`div`,{className:`cteditor-min-w-0`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-baseline cteditor-justify-between cteditor-gap-2.5 cteditor-min-w-0`,children:[(0,X.jsx)(`span`,{className:R3t,children:c.name}),(0,X.jsx)(`span`,{className:`cteditor-font-mono cteditor-text-[10.5px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-shrink-0`,children:o?`${a}%`:`${(c.size/(1024*1024)).toFixed(2)} MB`})]}),o&&(0,X.jsx)(`div`,{className:`cteditor-h-[3px] cteditor-rounded-full cteditor-bg-muted dark:cteditor-bg-white/5 cteditor-mt-[5px] cteditor-overflow-hidden`,children:(0,X.jsx)(`span`,{className:z3t,style:{width:`${a}%`}})})]}),o?(0,X.jsx)(`span`,{className:`cteditor-w-5`}):(0,X.jsx)(Q2,{variant:`ghost`,size:`icon`,className:`!cteditor-h-5 !cteditor-w-5 cteditor-bg-transparent hover:cteditor-bg-foreground/5`,onClick:()=>l(null),"aria-label":`Remove`,children:(0,X.jsx)(k2,{size:12,className:`!cteditor-size-3`})})]})})]}),c&&(0,X.jsx)(`div`,{className:`cteditor-mt-1 cteditor-pt-3.5 cteditor-border-t cteditor-border-border dark:cteditor-border-white/5 cteditor-flex cteditor-items-center cteditor-justify-between cteditor-gap-3`,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-flex cteditor-items-center cteditor-gap-2`,children:[(0,X.jsx)(`span`,{className:`cteditor-w-3.5 cteditor-h-3.5 cteditor-rounded-full cteditor-border-2 cteditor-border-border dark:cteditor-border-white/10 cteditor-border-t-primary dark:cteditor-border-t-[#a99cff] cteditor-animate-spin`}),`Uploading… `,(0,X.jsxs)(`span`,{className:`cteditor-text-muted-foreground dark:cteditor-text-white/60`,children:[Math.round(a),`%`]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-2 cteditor-items-center`,children:(0,X.jsx)(Q2,{disabled:!0,className:`cteditor-gap-2`,children:`Done`})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-flex cteditor-items-center cteditor-gap-2`,children:`Ready to upload`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-2 cteditor-items-center`,children:[(0,X.jsx)(Q2,{variant:`outline`,onClick:()=>l(null),children:`Cancel`}),(0,X.jsxs)(Q2,{className:`cteditor-gap-2`,onClick:async()=>{if(!(!c||o))try{let r=await i(c);if(!r)return;e({linkText:t||c.name,src:r,mimeType:c.type}),l(null),n(``)}catch(e){console.error(`Upload failed:`,e)}},children:[(0,X.jsx)(D2,{className:`!cteditor-size-3.5`}),` Upload 1 file`]})]})]})}),u&&(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-red-500/10 cteditor-border cteditor-border-red-500/20 cteditor-text-red-400`,children:[(0,X.jsx)(e2,{size:16,className:`cteditor-shrink-0 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-font-medium cteditor-m-0`,children:u})]}),s&&(s instanceof J8?(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-amber-500/10 cteditor-border cteditor-border-amber-500/20`,children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-mb-1`,children:[(0,X.jsx)(t2,{size:16,className:`cteditor-shrink-0 cteditor-text-amber-400 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-font-semibold cteditor-text-amber-400 cteditor-text-[13px] cteditor-m-0`,children:`Storage Quota Exceeded`})]}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-text-amber-400/90 cteditor-mt-1 cteditor-mb-0`,children:s.message}),s.details&&(0,X.jsxs)(`div`,{className:`cteditor-mt-2 cteditor-text-[11.5px] cteditor-text-amber-400/80 cteditor-space-y-0.5`,children:[(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`Used: `,s.details.currentUsage,` / `,s.details.maxStorage]}),(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`Available: `,s.details.availableStorage]}),(0,X.jsxs)(`p`,{className:`cteditor-m-0`,children:[`File size: `,s.details.requestedSize]})]})]}):(0,X.jsxs)(`div`,{className:`cteditor-mt-3 cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-p-3 cteditor-rounded-[10px] cteditor-bg-red-500/10 cteditor-border cteditor-border-red-500/20 cteditor-text-red-400`,children:[(0,X.jsx)(e2,{size:16,className:`cteditor-shrink-0 cteditor-opacity-80`}),(0,X.jsx)(`p`,{className:`cteditor-text-[12.5px] cteditor-font-medium cteditor-m-0`,children:s.message})]}))]})},e9=({activeEditor:e,onClose:t})=>(0,X.jsx)(x6,{open:!0,modal:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(S6,{className:`sm:cteditor-max-w-xl !cteditor-p-0 !cteditor-gap-0 [&>.closeDialog]:cteditor-top-5 [&>.closeDialog]:cteditor-right-5`,"aria-describedby":void 0,children:[(0,X.jsx)(C6,{className:`cteditor-p-5 cteditor-border-b cteditor-border-border dark:cteditor-border-white/5 cteditor-m-0 cteditor-space-y-0`,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-text-left`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-9 cteditor-h-9 cteditor-rounded-[8px] cteditor-border cteditor-border-border dark:cteditor-border-white/10 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-bg-muted/30 dark:cteditor-bg-white/5 cteditor-shrink-0`,children:(0,X.jsx)(g2,{size:16,className:`cteditor-text-muted-foreground dark:cteditor-text-white/70 cteditor-stroke-[1.5]`})}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-start cteditor-justify-center`,children:[(0,X.jsx)(T6,{className:`cteditor-text-[15px] cteditor-font-semibold cteditor-tracking-tight cteditor-text-foreground dark:cteditor-text-white cteditor-leading-tight cteditor-m-0`,children:`Add file to workspace`}),(0,X.jsx)(`p`,{className:`cteditor-text-[13px] cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-leading-tight cteditor-mt-0.5 cteditor-m-0`,children:`Private and secure • Indexed for AI context`})]})]})}),(0,X.jsx)(`div`,{className:`cteditor-p-5`,children:(0,X.jsx)(B3t,{onClick:n=>{e.dispatchCommand(T3t,n),t()}})})]})}),t9=di(`INSERT_ORNAMENT_DIVIDER_COMMAND`),n9=di(`INSERT_ASTERISM_COMMAND`),r9=di(`INSERT_LABELED_RULE_COMMAND`),i9=di(`INSERT_SECTION_HEADING_COMMAND`),a9=di(`INSERT_PULL_QUOTE_RULES_COMMAND`),V3t=/^\/\S*$/,H3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{if(!e.hasNodes([j8,P8,F8]))throw Error(`EditorialTypographyPlugin: editorial nodes not registered on editor`);return Gu(e.registerCommand(t9,e=>(dzt(B1(e)),!0),0),e.registerCommand(n9,e=>(dzt(V1(e)),!0),0),e.registerCommand(r9,e=>{let t=W1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(i9,e=>{let t=K1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(a9,e=>{let t=J1(e);return fzt(t,t.getFirstChild()),!0},0),e.registerCommand(Oc,e=>{let t=pzt();if(!t)return!1;let{fields:n,index:r,block:i}=t,a=e.shiftKey?r-1:r+1;return a>=0&&a<n.length?(e.preventDefault(),n[a].selectStart(),!0):(e.shiftKey||(e.preventDefault(),hzt(i)),!0)},1),e.registerCommand(Cc,e=>{let t=pzt();if(!t)return!1;let{fields:n,index:r,block:i}=t;return e&&e.preventDefault(),r<n.length-1?n[r+1].selectStart():hzt(i),!0},1),e.registerCommand(Tc,e=>{let t=pzt();if(!t)return!1;let{field:n,fields:r,index:i,block:a}=t;if(!mzt(n))return!1;if(i>0)return e.preventDefault(),r[i-1].selectEnd(),!0;if(e.preventDefault(),r.every(e=>e.getTextContent().trim()===``)){let e=a.getPreviousSibling();a.remove(),e&&`selectEnd`in e&&e.selectEnd()}return!0},1))},[e]),null},o9=di(`OPEN_DIVIDER_PICKER_COMMAND`),s9=[{id:`labeled-thin`,group:`Labeled rule`,label:`Thin`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--thin`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`thin`)},{id:`labeled-thick`,group:`Labeled rule`,label:`Thick`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--thick`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`thick`)},{id:`labeled-dashed`,group:`Labeled rule`,label:`Dashed`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--dashed`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`dashed`)},{id:`labeled-dotted`,group:`Labeled rule`,label:`Dotted`,preview:(0,X.jsx)(`div`,{className:`ed-labeled-rule ed-labeled-rule--dotted`,style:{width:150},children:(0,X.jsx)(`div`,{className:`ed-field ed-field--label`,children:`Label`})}),run:e=>e.dispatchCommand(r9,`dotted`)},{id:`ornament-star`,group:`Ornament`,label:`Star`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--star`,children:`✦ ✦ ✦`}),run:e=>e.dispatchCommand(t9,`star`)},{id:`ornament-flower`,group:`Ornament`,label:`Flower`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--flower`,children:`❋ ❋ ❋`}),run:e=>e.dispatchCommand(t9,`flower`)},{id:`ornament-diamond`,group:`Ornament`,label:`Diamond`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--diamond`,children:`◆ ◆ ◆`}),run:e=>e.dispatchCommand(t9,`diamond`)},{id:`ornament-dot`,group:`Ornament`,label:`Dot`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--dot`,children:`• • •`}),run:e=>e.dispatchCommand(t9,`dot`)},{id:`ornament-section`,group:`Ornament`,label:`Section mark`,preview:(0,X.jsx)(`div`,{className:`ed-ornament-divider ed-ornament-divider--section`,children:`§ § §`}),run:e=>e.dispatchCommand(t9,`section`)},{id:`asterism-asterism`,group:`Asterism`,label:`Asterism`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--asterism`,children:`⁂`}),run:e=>e.dispatchCommand(n9,`asterism`)},{id:`asterism-triple`,group:`Asterism`,label:`Triple star`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--triple-star`,children:`* * *`}),run:e=>e.dispatchCommand(n9,`triple-star`)},{id:`asterism-section`,group:`Asterism`,label:`Section mark`,preview:(0,X.jsx)(`div`,{className:`ed-asterism-divider ed-asterism-divider--section`,children:`§`}),run:e=>e.dispatchCommand(n9,`section`)}],U3t=({activeEditor:e,savedSelection:t,onClose:n})=>{let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(0),s=(0,Q.useRef)(null),c=(0,Q.useMemo)(()=>{let e=r.trim().toLowerCase();return e?s9.filter(t=>t.label.toLowerCase().includes(e)||t.group.toLowerCase().includes(e)):s9},[r]);(0,Q.useEffect)(()=>{o(e=>e>=c.length?0:e)},[c.length]),(0,Q.useEffect)(()=>{s.current?.querySelector(`[data-picker-index="${a}"]`)?.scrollIntoView({block:`nearest`})},[a]);let l=r=>{let i=t;n(),requestAnimationFrame(()=>{e.focus(),e.update(()=>{i&&Zi(i.clone()),r.run(e)})})},u=e=>{let t=e.target.tagName===`INPUT`;if(e.key===`ArrowDown`)e.preventDefault(),o(e=>Math.min(e+2,c.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),o(e=>Math.max(e-2,0));else if(e.key===`ArrowRight`&&!t)e.preventDefault(),o(e=>Math.min(e+1,c.length-1));else if(e.key===`ArrowLeft`&&!t)e.preventDefault(),o(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=c[a];t&&l(t)}},d=(0,Q.useMemo)(()=>{let e=[];return c.forEach((t,n)=>{let r=e[e.length-1];!r||r.group!==t.group?e.push({group:t.group,entries:[{item:t,index:n}]}):r.entries.push({item:t,index:n})}),e},[c]),f=new Set(s9.map(e=>e.group)).size;return(0,X.jsx)(x6,{open:!0,modal:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(S6,{className:`sm:cteditor-max-w-[520px] !cteditor-gap-3`,onKeyDown:u,children:[(0,X.jsxs)(C6,{children:[(0,X.jsx)(T6,{children:`Insert divider`}),(0,X.jsxs)(`p`,{className:`cteditor-text-xs cteditor-text-muted-foreground/70 !cteditor-mt-0.5`,children:[s9.length,` styles · `,f,` families`]})]}),(0,X.jsxs)(`div`,{className:`cteditor-relative`,children:[(0,X.jsx)(C2,{className:`cteditor-absolute cteditor-left-3 cteditor-top-1/2 -cteditor-translate-y-1/2 cteditor-size-3.5 cteditor-text-muted-foreground cteditor-pointer-events-none`}),(0,X.jsx)(N6,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Search dividers…`,className:`!cteditor-h-9 cteditor-pl-9`})]}),(0,X.jsxs)(`div`,{ref:s,className:`cteditor-max-h-[min(60vh,660px)] cteditor-overflow-y-auto cteditor-pr-1 -cteditor-mr-1`,children:[c.length===0&&(0,X.jsx)(`div`,{className:`cteditor-text-sm cteditor-text-muted-foreground cteditor-py-6 cteditor-text-center`,children:`No matching dividers`}),d.map(e=>(0,X.jsxs)(Q.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-px-0.5 cteditor-pt-3.5 cteditor-pb-2 first:cteditor-pt-0.5`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-[10px] cteditor-font-semibold cteditor-tracking-[0.16em] cteditor-uppercase cteditor-text-muted-foreground`,children:e.group}),(0,X.jsx)(`span`,{className:`cteditor-text-[10px] cteditor-text-muted-foreground/60`,children:e.entries.length}),(0,X.jsx)(`div`,{className:`cteditor-h-px cteditor-flex-1 cteditor-bg-border/60`})]}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-2 cteditor-gap-2`,children:e.entries.map(({item:e,index:t})=>{let n=t===a;return(0,X.jsxs)(`button`,{type:`button`,"data-picker-index":t,onMouseEnter:()=>o(t),onClick:()=>l(e),className:`cteditor-flex cteditor-flex-col cteditor-h-[72px] cteditor-w-full cteditor-text-left cteditor-rounded-[10px] cteditor-border cteditor-border-border/60 cteditor-px-3.5 cteditor-transition-colors `+(n?`cteditor-bg-[linear-gradient(180deg,rgba(184,132,56,0.10),rgba(184,132,56,0.03))] dark:cteditor-bg-[linear-gradient(180deg,rgba(230,185,107,0.10),rgba(230,185,107,0.03))]`:`cteditor-bg-foreground/[0.02]`),children:[(0,X.jsx)(`div`,{className:`ed-picker-preview cteditor-flex-1 cteditor-min-h-0 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-overflow-hidden cteditor-w-full`,children:e.preview}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-pb-2 cteditor-text-[11.5px] cteditor-leading-none `+(n?`cteditor-text-[#b88438] dark:cteditor-text-[#e6b96b] cteditor-font-semibold`:`cteditor-text-muted-foreground`),children:e.label})]},e.id)})})]},e.group))]})]})})},W3t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>e.registerCommand(o9,()=>{let t=null;return e.read(()=>{let e=W();e&&(t=e.clone())}),i(t),n(!0),!0},0),[e]),t?(0,X.jsx)(U3t,{activeEditor:e,savedSelection:r,onClose:()=>{n(!1),i(null)}}):null},c9=di(`INSERT_COLUMNS_COMMAND`),l9=di(`INSERT_BUTTON_BLOCK_COMMAND`),u9=di(`INSERT_FAQ_COMMAND`),G3t=/^\/\S*$/,K3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>Gu(e.registerCommand(c9,e=>{if(_zt())return!0;let t=$1(e);vzt(t),t.getNextSibling()===null&&t.insertAfter(Qs());let n=t.getChildren().filter(Z1)[0]?.getFirstChild();return n&&`selectStart`in n&&n.selectStart(),!0},0),e.registerCommand(l9,()=>{let e=a0(`Button`,``,`filled`);return vzt(e),e.getNextSibling()===null&&e.insertAfter(Qs()),!0},0),e.registerCommand(u9,()=>{let e=CLt();return vzt(e),e.getNextSibling()===null&&e.insertAfter(Qs()),!0},0)),[e]),null},d9=di(`INSERT_PATTERN_COMMAND`),f9=[{id:`hero`,name:`Hero`,description:`Heading + subtext + CTA button`},{id:`feature`,name:`Feature row`,description:`Two columns: copy + image`},{id:`three`,name:`Three-up`,description:`Three feature columns`},{id:`cta`,name:`CTA band`,description:`Closing line + button`}],q3t={hero:()=>[wzt(`A headline that sells the page`),Tzt(`One supporting sentence that explains the value in plain terms.`),a0(`Get started`,``,`filled`)],feature:()=>[Ezt(2,[b0(y0(`Feature name.`,`A short description of what it does and why it matters.`)),b0(y0(`Product preview.`,`Add a supporting image below.`),ELt())])],three:()=>[Ezt(3,[b0(y0(`Fast`,`Integrate in 10 minutes.`)),b0(y0(`Native`,`Built on Lexical.`)),b0(y0(`AI-ready`,`Per-block actions.`))])],cta:()=>[h1(),wzt(`Ready when you are`),a0(`Start free`,``,`filled`)]},J3t=/^\/\S*$/,Y3t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>Gu(e.registerCommand(d9,e=>{let t=q3t[e];return t?(Ozt(t()),!0):!1},0)),[e]),null},p9=({className:e})=>(0,X.jsx)(`span`,{className:`cteditor-shrink-0 cteditor-rounded cteditor-px-[5px] cteditor-py-[2px] cteditor-text-[8.5px] cteditor-font-bold cteditor-tracking-[0.08em] cteditor-font-geist cteditor-uppercase cteditor-leading-3 cteditor-text-[#1a1206] cteditor-bg-[linear-gradient(180deg,#f5db9e_0%,#e6b96b_55%,#b88438_100%)] cteditor-shadow-[0_1px_0_rgba(255,255,255,0.4)_inset,0_0_10px_-2px_rgba(230,185,107,0.55)]`+(e?` `+e:``),children:`NEW`}),X3t=({className:e})=>(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-relative cteditor-shrink-0 cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-[1.5px] cteditor-ring-background`+(e?` `+e:``),children:(0,X.jsx)(`span`,{className:`cteditor-absolute -cteditor-inset-[3px] cteditor-rounded-full cteditor-border-[1.5px] cteditor-border-solid cteditor-border-[#e6b96b] cteditor-animate-ping-slow`})}),Z3t={hero:(0,X.jsx)(S3,{}),feature:(0,X.jsx)(C3,{}),three:(0,X.jsx)(w3,{}),cta:(0,X.jsx)(T3,{})},Q3t=()=>{let[e,t]=(0,Q.useState)(null);return{show:e=>{t(e(()=>t(null)))},hide:()=>{t(null)},activeModal:e}},$3t=({enableHorizontalLine:e=!0,enableFileAttachments:t=!0,enableSignature:n=!0})=>{let[r]=Gd(),i=Q3t(),a=L4(),o=K0()?.editorConfig?.toolbarOptions,s=o?.enableEditorialDividers!==!1,c=o?.enableSectionHeading!==!1,l=o?.enablePullQuote!==!1,u=o?.enableColumns!==!1,d=o?.enableButtonBlock!==!1,f=o?.enableFaq!==!1,p=o?.enablePatterns!==!1,{isNew:m,markUsed:h}=s0(),g=e=>{let t=null;r.getEditorState().read(()=>{let e=W();e&&(t=e.clone())}),requestAnimationFrame(()=>{r.focus(),r.update(()=>{t&&Zi(t.clone()),e()})})},_=[{name:`Decorative Divider`,featureName:`Editorial Dividers`,icon:(0,X.jsx)(x3,{}),enabled:s,newKey:`styled-divider`,onClick:()=>r.dispatchCommand(o9,void 0)},{name:`Section Heading`,featureName:`Section Heading`,icon:(0,X.jsx)(o3,{}),enabled:c,newKey:`section-heading`,onClick:()=>g(()=>r.dispatchCommand(i9,void 0))},{name:`Pull Quote`,featureName:`Pull Quote`,icon:(0,X.jsx)(n3,{}),enabled:l,newKey:`pull-quote`,onClick:()=>g(()=>r.dispatchCommand(a9,void 0))}],v=[{name:`Columns`,featureName:`Columns`,icon:(0,X.jsx)(D3,{}),enabled:u,newKey:`columns`,onClick:()=>g(()=>r.dispatchCommand(c9,2))},{name:`Button`,featureName:`Button`,icon:(0,X.jsx)(uJt,{}),enabled:d,newKey:`button`,onClick:()=>g(()=>r.dispatchCommand(l9,void 0))},{name:`FAQ`,featureName:`FAQ`,icon:(0,X.jsx)(E3,{}),enabled:f,newKey:`faq`,onClick:()=>g(()=>r.dispatchCommand(u9,void 0))}],y=f9.map(e=>({name:e.name,featureName:`Patterns`,icon:Z3t[e.id],enabled:p,newKey:`pattern:${e.id}`,onClick:()=>g(()=>r.dispatchCommand(d9,e.id))})),b=[{label:`Editorial`,icon:(0,X.jsx)(a3,{}),items:_},{label:`Blocks`,icon:(0,X.jsx)(nJt,{}),items:v},{label:`Patterns`,icon:(0,X.jsx)(rJt,{}),items:y}],x=(e,t)=>e.enabled?(0,X.jsxs)($5,{className:m(e.newKey)?`hover:!cteditor-bg-yellow-500/10`:void 0,onClick:()=>{h(e.newKey),setTimeout(()=>e.onClick(),0)},children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),m(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-w-full cteditor-opacity-50 cteditor-cursor-not-allowed cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-gap-2`,children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),m(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`}),(0,X.jsx)(`div`,{className:`${m(e.newKey)?``:`cteditor-ml-auto`} [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.featureName,side:`right`})]})},t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`toolbar`,size:`icon-sm`,className:`cteditor-text-foreground/50`,children:(0,X.jsx)(c2,{className:`!cteditor-size-4`})})}),(0,X.jsxs)(Q5,{align:`start`,children:[[{name:`Horizontal Line`,icon:(0,X.jsx)(Z4,{}),enabled:e,onClick:()=>{let e=null;r.getEditorState().read(()=>{let t=W();t&&(e=t.clone())}),i.show(t=>(0,X.jsx)(S8,{activeEditor:r,onClose:t,savedSelection:e}))}},{name:`Upload File`,icon:(0,X.jsx)(c3,{}),enabled:t,onClick:()=>i.show(e=>(0,X.jsx)(e9,{activeEditor:r,onClose:e}))},{name:`Signature`,icon:(0,X.jsx)(Q4,{}),enabled:n,onClick:()=>i.show(e=>(0,X.jsx)(s5,{onClose:e}))}].map((e,t)=>e.enabled?(0,X.jsxs)($5,{onClick:()=>{setTimeout(()=>e.onClick(),0)},children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-w-full cteditor-opacity-50 cteditor-cursor-not-allowed cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-gap-2`,children:[(0,X.jsx)(`span`,{children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.name,side:`right`})]})},t)),b.some(e=>e.items.length>0)&&(0,X.jsx)(e7,{}),b.filter(e=>e.items.length>0).map(e=>(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{className:`!cteditor-text-[13px] [&_svg]:cteditor-size-3.5 !cteditor-py-1`,children:[(0,X.jsx)(`span`,{className:`[&>svg]:!cteditor-size-6`,children:e.icon}),(0,X.jsx)(`span`,{children:e.label}),e.items.some(e=>m(e.newKey))&&(0,X.jsx)(X3t,{className:`cteditor-ml-auto`})]}),(0,X.jsx)(U2t,{container:a,children:(0,X.jsx)(Z5,{className:`cteditor-border-foreground/10`,children:e.items.map((t,n)=>x(t,`${e.label}-${n}`))})})]},e.label))]})]}),i.activeModal]})},e6t=`cteditor-relative cteditor-flex cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-lg cteditor-px-2 cteditor-py-1 cteditor-text-[13px] cteditor-outline-none [&>svg]:cteditor-shrink-0`,t6t=`${e6t} cteditor-cursor-pointer cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground hover:cteditor-bg-foreground/5 data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50`,n6t=`${e6t} cteditor-opacity-50 cteditor-cursor-not-allowed`,r6t={hero:(0,X.jsx)(S3,{}),feature:(0,X.jsx)(C3,{}),three:(0,X.jsx)(w3,{}),cta:(0,X.jsx)(T3,{})},i6t=()=>{let[e,t]=(0,Q.useState)(null);return{show:e=>{t(e(()=>t(null)))},hide:()=>{t(null)},activeModal:e}},a6t=({enableHorizontalLine:e=!0,enableFileAttachments:t=!0,enableSignature:n=!0,enableImageUpload:r=!0})=>{let[i]=Gd(),a=i6t(),{isNew:o,markUsed:s}=s0(),c=W7,l=K0()?.editorConfig?.toolbarOptions,u=l?.enableEditorialDividers!==!1,d=l?.enableSectionHeading!==!1,f=l?.enablePullQuote!==!1,p=l?.enableColumns!==!1,m=l?.enableButtonBlock!==!1,h=l?.enableFaq!==!1,g=l?.enablePatterns!==!1,_=e=>{let t=null;i.getEditorState().read(()=>{let e=W();e&&(t=e.clone())}),requestAnimationFrame(()=>{i.focus(),i.update(()=>{t&&Zi(t.clone()),e()})})},v=[{name:`Decorative Divider`,featureName:`Editorial Dividers`,icon:(0,X.jsx)(x3,{}),enabled:u,newKey:`styled-divider`,onClick:()=>i.dispatchCommand(o9,void 0)},{name:`Section Heading`,featureName:`Section Heading`,icon:(0,X.jsx)(o3,{}),enabled:d,newKey:`section-heading`,onClick:()=>_(()=>i.dispatchCommand(i9,void 0))},{name:`Pull Quote`,featureName:`Pull Quote`,icon:(0,X.jsx)(n3,{}),enabled:f,newKey:`pull-quote`,onClick:()=>_(()=>i.dispatchCommand(a9,void 0))}],y=[{name:`Columns`,featureName:`Columns`,icon:(0,X.jsx)(D3,{}),enabled:p,newKey:`columns`,onClick:()=>_(()=>i.dispatchCommand(c9,2))},{name:`Button`,featureName:`Button`,icon:(0,X.jsx)(jUt,{size:16}),enabled:m,newKey:`button`,onClick:()=>_(()=>i.dispatchCommand(l9,void 0))},{name:`FAQ`,featureName:`FAQ`,icon:(0,X.jsx)(E3,{}),enabled:h,newKey:`faq`,onClick:()=>_(()=>i.dispatchCommand(u9,void 0))}],b=f9.map(e=>({name:e.name,featureName:`Patterns`,icon:r6t[e.id],enabled:g,newKey:`pattern:${e.id}`,onClick:()=>_(()=>i.dispatchCommand(d9,e.id))})),x=[{label:`EDITORIAL`,items:v},{label:`BLOCKS`,items:y},{label:`PATTERNS`,items:b}],S=(e,t)=>(0,X.jsx)(r6,{isEnabled:e.enabled,planAllows:e.enabled,featureName:e.featureName,variant:`inline`,children:(0,X.jsxs)(`button`,{type:`button`,className:`cteditor-relative cteditor-flex cteditor-w-full cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-text-accent-foreground [&>svg]:cteditor-shrink-0 `+(o(e.newKey)?`hover:!cteditor-bg-yellow-500/10`:`focus:cteditor-bg-foreground/5 hover:cteditor-bg-foreground/5`),onClick:()=>{s(e.newKey),setTimeout(()=>e.onClick(),0)},title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),o(e.newKey)&&(0,X.jsx)(p9,{className:`cteditor-ml-auto`})]})},t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:[[{name:`Horizontal Line`,icon:(0,X.jsx)(Z4,{}),enabled:e,onClick:()=>{let e=null;i.getEditorState().read(()=>{let t=W();t&&(e=t.clone())}),a.show(t=>(0,X.jsx)(S8,{activeEditor:i,onClose:t,savedSelection:e}))}},{name:`Image`,icon:(0,X.jsx)(m3,{}),enabled:r,onClick:()=>{a.show(e=>(0,X.jsx)($7,{activeEditor:i,onClose:e}))}},{name:`File`,icon:(0,X.jsx)(c3,{}),enabled:t,onClick:()=>a.show(e=>(0,X.jsx)(e9,{activeEditor:i,onClose:e}))},{name:`Signature`,icon:(0,X.jsx)(Q4,{}),enabled:n,onClick:()=>a.show(e=>(0,X.jsx)(s5,{onClose:e}))}].map((e,t)=>e.enabled?(0,X.jsxs)(`button`,{type:`button`,className:t6t,onClick:()=>setTimeout(()=>e.onClick(),0),title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name})]},t):(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(`div`,{className:n6t,title:e.name,children:[(0,X.jsx)(`span`,{className:`cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center`,children:e.icon}),(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto [&>svg]:cteditor-size-3.5 cteditor-text-muted-foreground`,children:(0,X.jsx)(v3,{})})]})}),(0,X.jsx)(X7,{featureName:e.name,side:`right`})]})},t)),x.filter(e=>e.items.length>0).map(e=>(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:[(0,X.jsxs)(`div`,{className:c.categoryHeader,children:[e.label,` `,(0,X.jsx)(`div`,{className:c.categoryHeaderLine})]}),e.items.map((t,n)=>S(t,`${e.label}-${n}`))]},e.label))]}),a.activeModal]})},m9=di(`INSERT_NOTE_PANEL_COMMAND`),o6t=[{type:`info`,label:`Info`,icon:_2,iconColor:`cteditor-text-blue-600 dark:cteditor-text-blue-400`,description:`Information panel`},{type:`warning`,label:`Warning`,icon:t2,iconColor:`cteditor-text-yellow-600 dark:cteditor-text-yellow-400`,description:`Warning panel`},{type:`error`,label:`Error`,icon:e2,iconColor:`cteditor-text-red-600 dark:cteditor-text-red-400`,description:`Error panel`},{type:`success`,label:`Success`,icon:o2,iconColor:`cteditor-text-green-600 dark:cteditor-text-green-400`,description:`Success panel`},{type:`note`,label:`Note`,icon:VUt,iconColor:`cteditor-text-gray-600 dark:cteditor-text-gray-400`,description:`General note panel`}],s6t=({className:e})=>{let[t]=Gd(),n=e=>{t.focus();try{t.dispatchCommand(m9,{type:e})}catch(e){console.error(`Error dispatching note panel command:`,e)}};return(0,X.jsxs)(q5,{children:[(0,X.jsx)(J5,{children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-text-foreground cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-rounded-lg !cteditor-py-1`,e),children:[(0,X.jsx)(nqt,{className:`btnIcon`}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-xs cteditor-text-left`,children:`Insert Note Panel`})]})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Note Panel`})})]})})}),(0,X.jsx)(Q5,{align:`start`,className:`cteditor-w-48`,children:o6t.map(e=>{let t=e.icon;return(0,X.jsxs)($5,{onClick:()=>n(e.type),className:`cteditor-flex cteditor-items-center !cteditor-gap-3 cteditor-cursor-pointer`,children:[(0,X.jsx)(`div`,{className:k$(`cteditor-flex-shrink-0`,e.iconColor),children:(0,X.jsx)(t,{size:16})}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1`,children:[(0,X.jsx)(`div`,{className:`cteditor-text-sm cteditor-font-medium`,children:e.label}),(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-text-muted-foreground`,children:e.description})]})]},e.type)})})]})},c6t=({open:e,onOpenChange:t,htmlContent:n,apiKey:r})=>(0,X.jsx)(x6,{open:e,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`!cteditor-max-w-[1320px] cteditor-w-full cteditor-flex cteditor-flex-col cteditor-p-0 cteditor-overflow-hidden `,children:[(0,X.jsxs)(C6,{className:`cteditor-flex-shrink-0 cteditor-border-b cteditor-border-dashed !cteditor-border-foreground/30 cteditor-pb-4`,children:[(0,X.jsx)(T6,{children:`Content Preview`}),(0,X.jsx)(E6,{className:`cteditor-text-sm cteditor-text-muted-foreground cteditor-text-[#525252]`,children:`Read-only · Final published output`})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1 cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-min-h-0 cteditor-max-h-[calc(100svh-195px)]`,children:(0,X.jsx)(ljt,{apiKey:r,enabled:e,children:(0,X.jsx)(`div`,{className:`cteditor-w-full cteditor-prose cteditor-max-w-none`,dangerouslySetInnerHTML:{__html:n},style:{wordWrap:`break-word`,overflowWrap:`break-word`}})})})]})}),h9=[{name:`common`,label:`Common`,chars:[`©`,`®`,`™`,`°`,`§`,`¶`,`†`,`‡`,`•`,`…`,`‰`,`‱`,`′`,`″`,`‴`,`¡`,`¿`,`‽`,`⁂`,`※`,`⁀`,`⁁`]},{name:`currency`,label:`Currency`,chars:[`€`,`£`,`¥`,`₹`,`₩`,`¢`,`$`,`₽`,`₺`,`₿`,`₫`,`₴`,`₦`,`₱`,`₲`,`₵`,`₸`,`₼`,`₾`,`฿`,`﷼`,`₡`,`₣`,`₤`]},{name:`math`,label:`Math`,chars:`±.×.÷.≠.≤.≥.≈.∞.√.∑.∏.∫.∂.∆.∇.∈.∉.∅.∩.∪.⊂.⊃.⊆.⊇.∀.∃.∄.∝.∧.∨.¬.⊕`.split(`.`)},{name:`arrows`,label:`Arrows`,chars:[`→`,`←`,`↑`,`↓`,`↔`,`↕`,`⇒`,`⇐`,`⇑`,`⇓`,`⇔`,`⇕`,`↗`,`↘`,`↙`,`↖`,`↪`,`↩`,`⟵`,`⟶`,`⟷`,`➜`,`➤`,`➔`]},{name:`latin`,label:`Latin`,chars:`À.Á.Â.Ã.Ä.Å.Æ.Ç.È.É.Ê.Ë.Ì.Í.Î.Ï.Ñ.Ò.Ó.Ô.Õ.Ö.Ø.Ù.Ú.Û.Ü.Ý.ß.à.á.â.ã.ä.å.æ.ç.è.é.ê.ë.ì.í.î.ï.ñ.ò.ó.ô.õ.ö.ø.ù.ú.û.ü`.split(`.`)},{name:`punctuation`,label:`Punctuation`,chars:[`—`,`–`,`―`,`‐`,`«`,`»`,`‹`,`›`,`“`,`”`,`‘`,`’`,`„`,`‟`,`‛`,`‚`,`⁃`,`‣`,`⁌`,`⁍`,`◦`,`▪`,`▸`,`▹`]},{name:`symbols`,label:`Symbols`,chars:`♠.♣.♥.♦.★.☆.✓.✗.✔.✘.♩.♪.♫.♬.☀.☁.☂.☃.⚡.❄.☎.✉.✂.✏.⚠.⛔.♻.⚙.☮.☯.⚖.⚗`.split(`.`)}],l6t=({size:e=18,className:t})=>(0,X.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:(0,X.jsx)(`path`,{d:`M7 19h4a6 6 0 1 1 2 0h4`})}),u6t=[`→`,`©`,`—`,`•`,`€`,`π`],d6t=`cteditor_recent_symbols`,f6t=({char:e,onHover:t,onPick:n})=>(0,X.jsx)(Q2,{variant:`ghost`,className:`!cteditor-h-9 cteditor-w-full cteditor-px-0 cteditor-rounded-md cteditor-border cteditor-border-transparent hover:cteditor-border-border dark:hover:cteditor-border-white/5 dark:hover:cteditor-bg-white/[0.04] cteditor-group`,onMouseEnter:()=>t(e),onFocus:()=>t(e),onClick:()=>n(e),children:(0,X.jsx)(`span`,{className:`cteditor-text-base cteditor-text-foreground dark:cteditor-text-white/90 cteditor-font-normal cteditor-leading-[normal]`,children:e})}),g9={scrollBtn:`cteditor-absolute cteditor-top-0 cteditor-bottom-0 cteditor-z-10 cteditor-flex cteditor-items-center cteditor-px-2 cteditor-cursor-pointer cteditor-text-muted-foreground dark:cteditor-text-white/60 hover:cteditor-text-foreground dark:hover:cteditor-text-white`,scrollLeft:`cteditor-left-0 cteditor-bg-gradient-to-r cteditor-from-popover dark:cteditor-from-[#0e0e11] cteditor-via-popover/80 dark:cteditor-via-[#0e0e11]/80 cteditor-to-transparent`,scrollRight:`cteditor-right-0 cteditor-bg-gradient-to-l cteditor-from-popover dark:cteditor-from-[#0e0e11] cteditor-via-popover/80 dark:cteditor-via-[#0e0e11]/80 cteditor-to-transparent`,tabBase:`cteditor-relative cteditor-px-3 cteditor-py-3 cteditor-text-xs cteditor-font-medium cteditor-whitespace-nowrap cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-cursor-pointer`,tabActive:`cteditor-text-foreground dark:cteditor-text-white`,tabInactive:`cteditor-text-muted-foreground dark:cteditor-text-white/50 hover:cteditor-text-foreground dark:hover:cteditor-text-white/80`,badgeBase:`cteditor-flex cteditor-items-center cteditor-justify-center cteditor-h-4.5 cteditor-px-1.5 cteditor-rounded-full cteditor-text-[10px] cteditor-font-semibold cteditor-transition-colors`,badgeActive:`cteditor-bg-muted dark:cteditor-bg-white/[0.15] cteditor-text-foreground dark:cteditor-text-white`,badgeInactive:`cteditor-bg-muted/50 dark:cteditor-bg-white/[0.08] cteditor-text-muted-foreground dark:cteditor-text-white/60`},_9={wrapper:`cteditor-mb-4`,header:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-1 cteditor-mb-2`,title:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-text-[10px] cteditor-font-medium cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-uppercase cteditor-tracking-widest`,count:`cteditor-text-[10px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/50`,container:`cteditor-flex cteditor-items-center cteditor-p-1 cteditor-bg-foreground/5 cteditor-border cteditor-border-foreground/20 cteditor-rounded-lg cteditor-px-1 cteditor-gap-1`,button:`cteditor-flex-1 !cteditor-h-8 cteditor-px-0 cteditor-font-normal hover:cteditor-bg-foreground/5 cteditor-border cteditor-border-transparent hover:cteditor-border-foreground/10`},v9={wrapper:`cteditor-p-2`,container:`cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-border cteditor-border-border dark:cteditor-border-white/5 cteditor-h-8 cteditor-rounded-md cteditor-bg-foreground/5`,icon:`cteditor-text-muted-foreground dark:cteditor-text-white/40 cteditor-shrink-0`,input:`cteditor-flex-1 cteditor-bg-transparent cteditor-border-none cteditor-outline-none cteditor-text-xs cteditor-text-foreground dark:cteditor-text-white placeholder:cteditor-text-muted-foreground dark:placeholder:cteditor-text-white/40`,clearBtn:`cteditor-text-muted-foreground dark:cteditor-text-white/40 hover:cteditor-text-foreground dark:hover:cteditor-text-white cteditor-shrink-0`,shortcut:`cteditor-text-[10px] cteditor-px-1.5 cteditor-py-0.5 cteditor-rounded-[4px] cteditor-bg-muted dark:cteditor-bg-white/10 cteditor-border cteditor-border-border/50 dark:cteditor-border-white/5 cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-font-mono cteditor-shrink-0`},y9={header:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-1 cteditor-mb-2`,title:`cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-uppercase cteditor-tracking-widest`,count:`cteditor-text-[10px] cteditor-font-semibold cteditor-text-muted-foreground/70 dark:cteditor-text-white/50`,emptyWrapper:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-8 cteditor-text-center`,emptyIcon:`cteditor-text-2xl cteditor-text-muted-foreground/50 dark:cteditor-text-white/20 cteditor-mb-2`,emptyTitle:`cteditor-text-[13px] cteditor-font-medium cteditor-text-foreground dark:cteditor-text-white cteditor-mb-1`,emptyText:`cteditor-text-[11px] cteditor-text-muted-foreground dark:cteditor-text-white/60 cteditor-max-w-[200px]`,emptyCode:`cteditor-font-mono cteditor-bg-muted dark:cteditor-bg-white/10 cteditor-px-1 cteditor-rounded`,grid:`cteditor-grid cteditor-grid-cols-8 cteditor-gap-0`},b9={wrapper:`cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-3 cteditor-py-2.5 cteditor-bg-muted/30 dark:cteditor-bg-[#141417] cteditor-border-t cteditor-border-border dark:cteditor-border-white/5`,contentBlock:`cteditor-flex cteditor-items-center cteditor-gap-3`,charBtn:`cteditor-rounded-lg dark:cteditor-bg-white/[0.05] dark:cteditor-border-white/10 cteditor-text-[15px] cteditor-shrink-0 cteditor-pointer-events-none`,textCol:`cteditor-flex cteditor-flex-col cteditor-justify-center`,titleActive:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground dark:cteditor-text-white/90 cteditor-leading-tight`,metaRowActive:`cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-text-[10px] cteditor-text-muted-foreground dark:cteditor-text-white/50 cteditor-mt-0.5 cteditor-font-mono`,dotActive:`cteditor-w-[3px] cteditor-h-[3px] cteditor-rounded-full cteditor-bg-border dark:cteditor-bg-white/20`,titleInactive:`cteditor-text-xs cteditor-font-medium cteditor-text-muted-foreground dark:cteditor-text-white/70 cteditor-leading-tight`,metaRowInactive:`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-text-[9px] cteditor-text-muted-foreground/70 dark:cteditor-text-white/40 cteditor-mt-0.5`,shortcutWrap:`cteditor-flex cteditor-items-center cteditor-gap-0.5`,kbd:`cteditor-font-sans cteditor-font-semibold cteditor-text-[9px] cteditor-leading-none`},x9=(0,Q.forwardRef)(({title:e,icon:t,onChange:n,className:r,...i},a)=>{let[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(`common`),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(u6t),v=(0,Q.useRef)(null),[y,b]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(d6t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&_(t)}}catch{}},[]);let[x,S]=(0,Q.useState)(!1),C=(0,Q.useCallback)(()=>{let e=v.current;e&&(b(e.scrollLeft>2),S(e.scrollLeft<e.scrollWidth-e.clientWidth-2))},[]);(0,Q.useEffect)(()=>{if(!o)return;let e=setTimeout(C,50);return()=>clearTimeout(e)},[o,C]);let w=(0,Q.useCallback)(e=>{let t=v.current;t&&t.scrollBy({left:e===`left`?-100:100,behavior:`smooth`})},[]),T=(0,Q.useCallback)(e=>{n&&n(e),h(e),s(!1),_(t=>{let n=[e,...t.filter(t=>t!==e)].slice(0,6);try{localStorage.setItem(d6t,JSON.stringify(n))}catch{}return n})},[n]),E=(0,Q.useMemo)(()=>{let e=u.trim().toLowerCase();return e?Array.from(new Set(h9.flatMap(e=>e.chars))).filter(t=>{let n=t.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`);return t===e||n.includes(e.toUpperCase())}).slice(0,60):h9.find(e=>e.name===c)?.chars||h9[0].chars},[c,u]),D=f||m,O=h9.find(e=>e.name===c)||h9[0];return(0,X.jsxs)(m8,{open:o,onOpenChange:s,modal:!1,children:[(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-rounded-sm hover:cteditor-bg-accent cteditor-flex cteditor-items-center cteditor-gap-2`,r),title:e,ref:a,...i,children:[(0,X.jsx)(`div`,{children:t}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-[13px] cteditor-text-left`,children:`Special Characters`})]})}),(0,X.jsxs)(g8,{className:`cteditor-w-[360px] !cteditor-p-0 !cteditor-z-[99999] cteditor-overflow-hidden cteditor-rounded-xl cteditor-bg-popover dark:cteditor-bg-[#131316] dark:cteditor-border-white/10 cteditor-shadow-xl cteditor-flex cteditor-flex-col`,sideOffset:5,children:[(0,X.jsx)(`div`,{className:v9.wrapper,children:(0,X.jsxs)(`div`,{className:v9.container,children:[(0,X.jsx)(C2,{size:15,className:v9.icon}),(0,X.jsx)(`input`,{autoFocus:!0,value:u,onChange:e=>d(e.target.value),placeholder:`Search 1,200+ symbols by name or codepoint...`,className:v9.input,spellCheck:!1}),u?(0,X.jsx)(`button`,{onClick:()=>d(``),className:v9.clearBtn,children:(0,X.jsx)(k2,{size:14})}):(0,X.jsx)(`kbd`,{className:v9.shortcut,children:`/`})]})}),!u&&(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-border-y cteditor-border-border dark:cteditor-border-white/10`,children:[y&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>w(`left`),className:k$(g9.scrollBtn,g9.scrollLeft),"aria-label":`Scroll left`,children:(0,X.jsx)(aUt,{size:12,strokeWidth:2.5})}),(0,X.jsx)(`div`,{ref:v,onScroll:C,className:`cteditor-flex cteditor-overflow-x-auto no-scrollbar cteditor-px-1`,children:h9.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(e.name),className:k$(g9.tabBase,c===e.name?g9.tabActive:g9.tabInactive),children:[e.label,(0,X.jsx)(`span`,{className:k$(g9.badgeBase,c===e.name?g9.badgeActive:g9.badgeInactive),children:e.chars.length}),c===e.name&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-bottom-0 cteditor-left-2 cteditor-right-2 cteditor-h-0.5 cteditor-bg-foreground dark:cteditor-bg-white cteditor-shadow-[0_-1px_6px_rgba(255,255,255,0.4)] cteditor-rounded-t-full`})]},e.name))}),x&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>w(`right`),className:k$(g9.scrollBtn,g9.scrollRight),"aria-label":`Scroll right`,children:(0,X.jsx)(l2,{size:12,strokeWidth:2.5})})]}),(0,X.jsxs)(`div`,{className:`cteditor-flex-1 cteditor-overflow-y-auto cteditor-max-h-[300px] cteditor-p-3`,onMouseLeave:()=>p(null),children:[!u&&(0,X.jsxs)(`div`,{className:_9.wrapper,children:[(0,X.jsxs)(`div`,{className:_9.header,children:[(0,X.jsxs)(`div`,{className:_9.title,children:[(0,X.jsx)(u2,{size:11}),` Recently used`]}),(0,X.jsx)(`span`,{className:_9.count,children:g.length})]}),(0,X.jsx)(`div`,{className:_9.container,children:g.map((e,t)=>(0,X.jsx)(Q2,{variant:`ghost`,className:_9.button,onMouseEnter:()=>p(e),onClick:()=>T(e),children:e},`recent-${t}`))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:y9.header,children:[(0,X.jsx)(`span`,{className:y9.title,children:u?`Results · "${u}"`:O.label}),(0,X.jsx)(`span`,{className:y9.count,children:E.length})]}),E.length===0?(0,X.jsxs)(`div`,{className:y9.emptyWrapper,children:[(0,X.jsx)(`div`,{className:y9.emptyIcon,children:`⌕`}),(0,X.jsx)(`div`,{className:y9.emptyTitle,children:`No matches`}),(0,X.jsxs)(`div`,{className:y9.emptyText,children:[`Try a different char or paste a Hex code like `,(0,X.jsx)(`code`,{className:y9.emptyCode,children:`2192`}),`.`]})]}):(0,X.jsx)(`div`,{className:y9.grid,children:E.map((e,t)=>(0,X.jsx)(f6t,{char:e,onHover:p,onPick:T},`list-${t}`))})]})]}),(0,X.jsx)(`div`,{className:b9.wrapper,children:D?(0,X.jsxs)(`div`,{className:b9.contentBlock,children:[(0,X.jsx)(Q2,{variant:`outline`,size:`icon-sm`,className:b9.charBtn,children:D}),(0,X.jsxs)(`div`,{className:b9.textCol,children:[(0,X.jsx)(`div`,{className:b9.titleActive,children:`Character`}),(0,X.jsxs)(`div`,{className:b9.metaRowActive,children:[(0,X.jsxs)(`span`,{children:[`U+`,D.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)]}),(0,X.jsx)(`span`,{className:b9.dotActive}),(0,X.jsxs)(`span`,{children:[`&#`,D.charCodeAt(0),`;`]})]})]})]}):(0,X.jsxs)(`div`,{className:b9.contentBlock,children:[(0,X.jsx)(Q2,{variant:`outline`,size:`icon-sm`,children:(0,X.jsx)(l6t,{className:`!cteditor-w-4`})}),(0,X.jsxs)(`div`,{className:b9.textCol,children:[(0,X.jsx)(`div`,{className:b9.titleInactive,children:`Hover a symbol for details`}),(0,X.jsxs)(`div`,{className:b9.metaRowInactive,children:[(0,X.jsx)(`span`,{children:`Click to insert at cursor`}),(0,X.jsx)(`span`,{className:`cteditor-opacity-50`,children:`·`}),(0,X.jsxs)(`span`,{className:b9.shortcutWrap,children:[(0,X.jsx)(`kbd`,{className:b9.kbd,children:`⌥`}),` to copy`]})]})]})]})})]})]})}),x9.displayName=`SpecialCharactersWidget`,p6t=Symbol.for(`react.lazy`),S9=Z.use,m6t=Symbol(`radix.slottable`),h6t=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jzt(`Primitive.${t}`),r=Z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,X.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),g6t=`Separator`,_6t=`horizontal`,v6t=[`horizontal`,`vertical`],y6t=Z.forwardRef((e,t)=>{let{decorative:n,orientation:r=_6t,...i}=e,a=Izt(r)?r:_6t,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,X.jsx)(h6t.div,{"data-orientation":a,...o,...i,ref:t})}),y6t.displayName=g6t,b6t=y6t,C9=Z.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,size:r=`default`,...i},a)=>(0,X.jsx)(b6t,{ref:a,decorative:n,orientation:t,className:k$(`cteditor-shrink-0 cteditor-bg-foreground/10`,t===`horizontal`?`cteditor-h-[1px] cteditor-w-full`:k$(`cteditor-w-[1px]`,r===`md`?`cteditor-h-6`:`cteditor-h-full`),e),...i})),C9.displayName=b6t.displayName,x6t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(eOt(),IDt)).then(e=>({default:e.HexColorPicker}))),S6t=[`#FFFFFF`,`#4A90E2`,`#7ED3F7`,`#50E3C2`,`#F5A623`,`#F08A8A`,`#BD10E0`,`#4A4A4A`,`#357ABD`,`#50B5FF`,`#00D084`,`#D0021B`,`#E25822`,`#9013FE`,`#000000`,`#1F4E79`,`#2E5984`,`#7ED321`,`#8B572A`,`#7F0000`,`#50327C`],C6t=[{color:`#ffeb3b`,label:`Yellow`},{color:`#a5d6a7`,label:`Green`},{color:`#90caf9`,label:`Blue`},{color:`#f48fb1`,label:`Pink`},{color:`#ce93d8`,label:`Purple`},{color:`#ffcc80`,label:`Orange`},{color:`#b2dfdb`,label:`Teal`},{color:`#ff8a80`,label:`Red`},{color:`#fff59d`,label:`Light Yellow`},{color:`#aed581`,label:`Light Green`},{color:`#81d4fa`,label:`Light Blue`},{color:`#f8bbd0`,label:`Light Pink`},{color:`#d1c4e9`,label:`Light Purple`},{color:`#ffab40`,label:`Deep Orange`},{color:`#8d6e63`,label:`Brown`},{color:`#90a4ae`,label:`Gray`},{color:`#e0e0e0`,label:`Light Gray`},{color:`#f5f5f5`,label:`White Smoke`},{color:`#eeeeee`,label:`Gainsboro`},{color:`#bdbdbd`,label:`Silver`}].map(e=>e.color),w6t=`ct-editor-recent-colors`,w9=({onTextColorChange:e,onBackgroundColorChange:t,currentTextColor:n=`#000`,currentBgColor:r,isHighlightActive:i=!1,onOpenChange:a,isActive:o=!1,showTextColorTab:s=!0,showBackgroundColorTab:c=!0,className:l})=>{let[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(s?`text`:`background`),[m,h]=(0,Q.useState)(`#000000`),[g,_]=(0,Q.useState)(`#ffeb3b`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)([]),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(w6t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(typeof t[0]==`string`?x(t.map(e=>({color:e,type:`background`}))):x(t))}}catch{}},[]),(0,Q.useEffect)(()=>{u||(y(!1),S.current=!1,C.current=0)},[u]),(0,Q.useEffect)(()=>{let e=()=>{S.current=!1};return document.addEventListener(`pointerup`,e),document.addEventListener(`pointercancel`,e),()=>{document.removeEventListener(`pointerup`,e),document.removeEventListener(`pointercancel`,e)}},[]);let w=(0,Q.useCallback)((e,t)=>{e!==`transparent`&&x(n=>{let r=n.filter(n=>!(n.color.toLowerCase()===e.toLowerCase()&&n.type===t)),i=[{color:e,type:t},...r].slice(0,7);try{localStorage.setItem(w6t,JSON.stringify(i))}catch{}return i})},[]),T=e=>/^#[0-9A-Fa-f]{6}$/.test(e),E=t=>{h(t),w(t,`text`),e(t)},D=e=>{e&&(_(e),w(e,`background`)),t(e)},O=n=>{f===`text`?(h(n),e(n)):(_(n),t(n))},k=e=>{let t=(`#`+e.target.value.replace(/^#/,``)).toUpperCase();/^#[0-9A-Fa-f]{0,6}$/.test(t)&&(t.length===7&&T(t)?f===`text`?E(t):D(t):f===`text`?h(t):_(t))},A=()=>{T(f===`text`?m:g)||(f===`text`?h(`#000000`):_(`#ffeb3b`))},j=f===`text`?m:g,M=s&&c;return(0,X.jsxs)(m8,{open:u,onOpenChange:e=>{!e&&S.current||!e&&Date.now()-C.current<150||(e&&(C.current=Date.now()),d(e),a?.(e))},modal:!1,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`ghost`,size:`icon-sm`,className:k$(`cteditor-relative`,o&&`cteditor-bg-foreground/10`,l),onMouseDown:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-[11px] cteditor-leading-none cteditor-font-semibold`,children:`A`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-[1px]`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:n||`#000`}}),(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:r&&r!==`#fff`&&r!==`transparent`?r:`#ffeb3b`}})]})]}),(0,X.jsx)(`span`,{className:`cteditor-flex-1 cteditor-text-xs cteditor-text-left`,children:`Colors`})]})})}),(0,X.jsx)($3,{children:`Colors`})]})}),(0,X.jsx)(g8,{className:`cteditor-w-auto cteditor-p-0 cteditor-border-none cteditor-shadow-lg cteditor-bg-transparent !cteditor-z-[99999]`,sideOffset:5,id:`unified-color-picker`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.react-colorful-wrapper`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`#unified-color-picker`))&&e.preventDefault()},children:(0,X.jsxs)(`div`,{className:`cteditor-bg-dropdown cteditor-rounded-xl cteditor-p-3 cteditor-shadow-2xl cteditor-border cteditor-border-foreground/10`,style:{width:`280px`},onMouseDown:e=>e.preventDefault(),children:[M&&(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-p-1 cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-mb-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:k$(`cteditor-flex-1 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-all`,f===`text`?`cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium cteditor-shadow-sm`:`cteditor-text-foreground/40 hover:cteditor-text-foreground/60`),onClick:()=>p(`text`),onMouseDown:e=>e.preventDefault(),children:[`Text`,(0,X.jsx)(`span`,{className:k$(`cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-text-[10px] cteditor-border cteditor-transition-colors`,f===`text`?`cteditor-bg-foreground/15 cteditor-border-foreground/20 cteditor-text-foreground`:`cteditor-bg-transparent cteditor-border-foreground/10 cteditor-text-foreground/30`),children:`A`})]}),(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-flex-1 cteditor-py-1 cteditor-rounded-md cteditor-text-xs cteditor-transition-all`,f===`background`?`cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium cteditor-shadow-sm`:`cteditor-text-foreground/40 hover:cteditor-text-foreground/60`),onClick:()=>p(`background`),onMouseDown:e=>e.preventDefault(),children:`Background`})]}),b.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground/50 cteditor-mb-2.5`,children:`Recently picked`}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-2.5`,children:b.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-w-5 cteditor-h-5 cteditor-rounded-full cteditor-border-2 cteditor-transition-all hover:cteditor-scale-110`,e.color.toLowerCase()===`#ffffff`?`cteditor-border-foreground/10`:`cteditor-border-transparent`),style:{backgroundColor:e.color},onClick:()=>{e.type===`text`?E(e.color):D(e.color)},onMouseDown:e=>e.preventDefault(),title:e.type===`text`?`Text: ${e.color}`:`Background: ${e.color}`},`${e.color}-${e.type}-${t}`))})]}),(0,X.jsxs)(`div`,{className:`cteditor-mb-1`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-font-medium cteditor-text-foreground/50 cteditor-mb-2.5`,children:`Colours`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-2.5 cteditor-mb-2.5`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-border cteditor-border-foreground/10 cteditor-shadow-sm`,style:{backgroundColor:T(j)?j:`#000000`}}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-bg-foreground/[0.03] cteditor-border cteditor-border-foreground/10 cteditor-rounded-md cteditor-px-3 cteditor-flex-1`,children:[(0,X.jsx)(`span`,{className:`cteditor-text-foreground/30 cteditor-text-sm cteditor-font-medium`,children:`#`}),(0,X.jsx)(`input`,{type:`text`,value:j.replace(`#`,``),onChange:k,onBlur:A,onMouseDown:e=>e.stopPropagation(),className:`cteditor-bg-transparent cteditor-text-foreground cteditor-text-sm cteditor-py-1 cteditor-h-7 cteditor-w-full cteditor-text-center focus:cteditor-outline-none cteditor-font-mono cteditor-tracking-wider`,maxLength:6,placeholder:`FFFFFF`})]})]}),(0,X.jsx)(`div`,{className:`cteditor-p-2.5 cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-bg-foreground/[0.01]`,children:(0,X.jsxs)(`div`,{className:`cteditor-grid cteditor-grid-cols-7 cteditor-gap-2`,children:[(f===`text`?S6t:C6t).map(e=>(0,X.jsx)(`button`,{type:`button`,className:k$(`cteditor-aspect-square cteditor-rounded cteditor-border hover:cteditor-scale-110 cteditor-transition-all`,j.toUpperCase()===e.toUpperCase()?`cteditor-border-primary cteditor-z-10`:`cteditor-border-foreground/5`),style:{backgroundColor:e},onClick:()=>{f===`text`?E(e):D(e)},onMouseDown:e=>e.preventDefault(),title:e},e)),f===`background`&&(0,X.jsx)(`button`,{type:`button`,className:`cteditor-aspect-square cteditor-rounded cteditor-border cteditor-border-foreground/5 hover:cteditor-scale-110 cteditor-transition-all cteditor-flex cteditor-items-center cteditor-justify-center cteditor-bg-background`,onClick:()=>D(null),onMouseDown:e=>e.preventDefault(),title:`Remove color`,children:(0,X.jsx)(k2,{className:`cteditor-size-3 cteditor-text-foreground/40`})})]})})]}),(0,X.jsx)(`div`,{className:`cteditor-mt-4`,children:(0,X.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>y(!v),className:`cteditor-text-[11px] cteditor-font-medium cteditor-text-foreground/40 hover:cteditor-text-foreground/60 cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-1.5`,children:[(0,X.jsx)(`span`,{children:v?`▼`:`▶`}),`Custom Picker`]})}),v&&(0,X.jsx)(`div`,{className:`cteditor-mt-3 cteditor-select-none [&>div]:cteditor-w-full [&>div>div]:cteditor-w-full`,onPointerDown:e=>{e.target.closest(`.react-colorful`)&&(S.current=!0)},onPointerUp:()=>{S.current=!1},onPointerLeave:()=>{S.current=!1},onPointerCancel:()=>{S.current=!1},style:{touchAction:`none`,userSelect:`none`,WebkitUserSelect:`none`},children:(0,X.jsx)(Q.Suspense,{fallback:(0,X.jsx)(`div`,{style:{width:`100%`,height:150},"aria-hidden":`true`}),children:(0,X.jsx)(x6t,{color:T(j)?j:`#000000`,onChange:O})})})]})})]})},T6t={blockFormat:{label:`Block Format`,keywords:[`paragraph`,`heading`,`h1`,`h2`,`h3`,`quote`,`blockquote`,`code`,`block`,`bullet`,`list`,`ordered`,`unordered`,`numbered`]},preview:{label:`Preview`,keywords:[`preview`,`view`,`render`,`eye`]},fontFamily:{label:`Font Family`,keywords:[`font`,`family`,`typeface`,`arial`,`times`]},fontSize:{label:`Font Size`,keywords:[`size`,`text size`,`bigger`,`smaller`]},alignMenu:{label:`Alignment`,keywords:[`align`,`left`,`center`,`right`,`justify`,`line height`,`line spacing`,`spacing`,`leading`]},inlineFormats:{label:`Strikethrough`,keywords:[`strikethrough`,`strike`,`strikeout`,`cross out`]},codeBlock:{label:`Code Block`,keywords:[`code`,`programming`,`syntax`]},formatTextMenu:{label:`Format Menu`,keywords:[`format`,`style`,`text`]},imageInsert:{label:`Insert Image`,keywords:[`image`,`picture`,`photo`,`insert`]},tableOptions:{label:`Table`,keywords:[`table`,`grid`,`rows`,`columns`]},chartInsert:{label:`Insert Chart`,keywords:[`chart`,`graph`,`visualization`,`data`]},equationInsert:{label:`Insert Equation`,keywords:[`equation`,`formula`,`math`,`latex`,`katex`]},link:{label:`Link`,keywords:[`link`,`url`,`hyperlink`,`anchor`]},colorPickers:{label:`Colors`,keywords:[`color`,`font color`,`background`,`highlight`,`marker`,`emphasis`]},emoji:{label:`Emoji`,keywords:[`emoji`,`emoticon`,`smiley`,`face`]},specialCharacters:{label:`Special Characters`,keywords:[`special`,`character`,`symbol`,`currency`,`math`,`arrow`,`latin`]},todo:{label:`Todo List`,keywords:[`todo`,`checklist`,`task`,`checkbox`]},signature:{label:`Signature`,keywords:[`signature`,`sign`,`draw`,`handwriting`]},notePanels:{label:`Note Panels`,keywords:[`note`,`panel`,`callout`,`info`,`warning`]},insertMenu:{label:`Insert Menu`,keywords:`insert.add.embed.horizontal.rule.divider.line.hr.file.attachment.attach.upload.signature.sign.columns.column.button.cta.faq.question.pattern.patterns.hero.feature.three-up.section.heading.pull.quote`.split(`.`)},editHorizontalRule:{label:`Edit Line`,keywords:[`edit`,`line`,`horizontal`,`rule`,`divider`,`thickness`,`color`,`style`]},autocomplete:{label:`Autocorrection`,keywords:[`autocomplete`,`autocorrect`,`spelling`,`grammar`]},inlineAutocomplete:{label:`Inline Autocomplete`,keywords:[`inline`,`autocomplete`,`ai`,`suggestion`,`ghost`,`complete`]},htmlView:{label:`HTML View`,keywords:[`html`,`code`,`source`,`view`]},htmlCanvas:{label:`HTML Canvas`,keywords:[`html`,`canvas`,`embed`,`iframe`,`web`,`website`]},aiOptions:{label:`AI Options`,keywords:[`ai`,`artificial intelligence`,`magic`,`generate`,`grammar`,`translate`,`simplify`]},actionBold:{label:`Bold`,keywords:[`bold`,`strong`,`ctrl+b`]},actionItalic:{label:`Italic`,keywords:[`italic`,`emphasis`,`ctrl+i`]},actionUnderline:{label:`Underline`,keywords:[`underline`,`ctrl+u`]},actionStrikethrough:{label:`Strikethrough`,keywords:[`strikethrough`,`strike`,`line through`]},actionSubscript:{label:`Subscript`,keywords:[`subscript`,`sub`]},actionSuperscript:{label:`Superscript`,keywords:[`superscript`,`sup`,`power`]},actionQuote:{label:`Block Quote`,keywords:[`quote`,`blockquote`,`quotation`]},actionBulletList:{label:`Bullet List`,keywords:[`bullet`,`list`,`unordered`,`ul`]},actionHorizontalRule:{label:`Horizontal Line`,keywords:[`horizontal`,`rule`,`divider`,`line`,`hr`,`separator`]},suggestFeature:{label:`Suggest a Feature`,keywords:[`suggest`,`feature`,`feedback`,`request`,`idea`]},reportBug:{label:`Report a Bug`,keywords:[`bug`,`report`,`issue`,`error`,`problem`,`fix`]}},E6t=[`actionBold`,`actionItalic`,`actionUnderline`,`actionStrikethrough`,`actionSubscript`,`actionSuperscript`,`actionQuote`,`actionBulletList`,`actionNumberedList`,`actionHorizontalRule`],D6t=({editable:e,enableUndoRedo:t=!0,enableTextFormatting:n=!0,enableAlignment:r=!0,enableFontControls:i=!0,enableTableOptions:a=!0,enableImageOptions:o=!0,enableInsertMenu:s=!0,enableColors:c=!0,enableClearOptions:l=!0,enableEmojiPicker:u=!0,enableSpecialCharacters:d=!0,enableDatePicker:f=!0,enableLinks:p=!0,enableFormatTextMenu:m=!0,enableCodeFormat:h=!0,enableAIChat:g=!0,enableTodoList:_=!0,enableHtmlViewToggle:v=!0,enableHtmlView:y=!0,enableNotePanels:b=!0,enableAutocompleteToggle:x=!0,enableInlineAutocompleteToggle:S=!0,enableHeadings:C=!0,enableLists:w=!0,enableBlockquote:T=!0,enableImageUpload:E=!0,enableWordCount:D=!0,enableCharts:O=!0,enableEquations:k=!0,enableAutoCorrection:A=!0,enablePdfExport:j=!0,enableDocExport:M=!0,enableSpeechToText:N=!0,enableComments:P=!0,enableMentions:F=!0,enableHorizontalLine:I=!0,enableFileAttachments:ee=!0,enableSignature:L=!0,enableEmbeds:te=!0,enableFormatPainter:R=!0,enableFeatureSuggestion:ne=!0,enableBugReport:re=!0,enablePreview:ie=!0,enableHtmlCanvas:ae=!0,fonts:z,editor:oe,activeEditor:se,setActiveEditor:B,fitToPage:ce=!1,isCommentOpen:le=!1,onToggleComment:ue,commentCount:de=0})=>{let[fe,pe]=(0,Q.useState)({undo:!0,redo:!0}),[me,he]=(0,Q.useState)(!1),[ge,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(!1),[Se,Ce]=(0,Q.useState)(!1),{isNew:we}=s0(),[Te,Ee]=(0,Q.useState)(!1),[De,Oe]=(0,Q.useState)(!1),[ke,Ae]=(0,Q.useState)(0),je=(0,Q.useRef)(null),Me=(0,Q.useRef)(null),[Ne,Pe]=(0,Q.useState)(new Set),[Fe,Ie]=(0,Q.useState)(!1),[Le,Re]=(0,Q.useState)(!1),[ze,Be]=(0,Q.useState)(!1),[Ve,He]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(!1),[Ge,Ke]=(0,Q.useState)(!1),[qe,Je]=(0,Q.useState)(!1),[Ye,Xe]=(0,Q.useState)(!1),[Ze,V]=(0,Q.useState)(!1),[Qe,H]=(0,Q.useState)(``),[$e,et]=(0,Q.useState)(``),tt=(0,Q.useRef)(null),nt=W7,{hasFormat:rt,isEditorEmpty:it,blockType:at,clearFormatting:ot}=k$t(),{clearEditorContent:st}=O$t(),{toolbarState:ct,updateToolbarState:lt}=$8(),ut=e=>{if(!$e.trim())return!0;let t=T6t[e];if(!t)return!1;let n=$e.toLowerCase(),r=e=>{let t=e.toLowerCase();return t.startsWith(n)||t.split(/\s+/).some(e=>e.startsWith(n))};return r(t.label)||t.keywords.some(e=>r(e))},dt=Array.from(Ne).some(e=>ut(e))||!!$e.trim()&&E6t.some(e=>ut(e)),{isHtmlView:ft,setIsHtmlView:pt,htmlContent:mt,setHtmlContent:ht}=F0(),{apiKey:gt,editorConfig:_t,planConfig:vt,isByokPlan:yt,byokApiKeys:bt}=G0(),xt=vt?.toolbarOptions,St=bt&&(bt.hasOpenaiKey||bt.hasAnthropicKey||bt.hasGrokKey||bt.hasGeminiKey),Ct=g===!0&&(xt?.enableAIChat??!0)&&(!yt||!!St),wt=yt&&!St,Tt=S===!0&&(xt?.enableInlineAutocompleteToggle??!0)&&(!yt||!!St),Et=yt&&!St,Dt=N&&(xt?.enableSpeechToText??!0)&&(!yt||!!bt?.hasAssemblyaiKey),Ot=yt&&!bt?.hasAssemblyaiKey,{shouldAutoShowFeedback:kt,markFeedbackSubmitted:At,markFeedbackDismissed:jt,totalLoads:Mt}=FLt(gt);(0,Q.useEffect)(()=>{kt&&!qe&&Je(!0)},[kt]);let Nt=e=>{Je(e),!e&&kt&&jt(Mt)};(0,Q.useEffect)(()=>{let e=()=>{if(!je.current||!Me.current)return;let e=Me.current.getBoundingClientRect(),t=Me.current.querySelectorAll(`[data-toolbar-item]`),n=new Set;t.forEach(t=>{if(t.getBoundingClientRect().right>e.right){let e=t.getAttribute(`data-toolbar-item`);e&&n.add(e)}}),Pe(n),xe(n.size>0)},t=()=>{je.current&&Me.current&&requestAnimationFrame(e)};t(),window.addEventListener(`resize`,t);let n=new ResizeObserver(t);return je.current&&n.observe(je.current),()=>{window.removeEventListener(`resize`,t),n.disconnect()}},[t,n,i,a,o,c,p,u,d,f,s,_,b,r,l,g,x,S,v,y]);let Pt=()=>{O6.warning(`Clear editor content?`,{description:`This will remove all content.`,action:{label:`OK`,onClick:()=>{st(),O6.success(`Editor cleared`)}},duration:8e3})},{onFontColorSelect:Ft,onHighlightColorSelect:It}=O1t(),[Lt,Rt]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>oe.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=W();Rt(U(e)&&!!id(e.anchor.getNode(),e=>e.getType()===`link`))})}),[oe]),(0,Q.useEffect)(()=>Gu(oe.registerCommand(Hc,e=>(pe(t=>({...t,undo:!e})),!1),S$t),oe.registerCommand(Vc,e=>(pe(t=>({...t,redo:!e})),!1),S$t)),[oe]);let zt=(0,Q.useCallback)(()=>{let e=W();lt(`isNodeSelection`,ts(e));let t=null;if(ts(e)){let n=e.getNodes()[0];g1(n)&&(t=n.getKey())}else if(U(e)){let n=e.anchor.getNode();if(g1(n))t=n.getKey();else{let e=n.getTopLevelElement();g1(e)&&(t=e.getKey())}}if(ye(t),U(e)){se!==oe&&Dee(se)?lt(`isImageCaption`,!!se.getRootElement()?.parentElement?.classList.contains(`image-caption-container`)):lt(`isImageCaption`,!1);let t=e.anchor.getNode(),n=t.getKey()===`root`?t:id(t,e=>{let t=e.getParent();return t!==null&&ja(t)});n===null&&(n=t.getTopLevelElementOrThrow());let r=n.getKey(),i=se.getElementByKey(r);lt(`isRTL`,hee(e));let a=e5(e),o=a.getParent();if(lt(`isLink`,Fp(o)||Fp(a)),Sp(id(a,Sp))?lt(`rootType`,`table`):lt(`rootType`,`root`),i!==null)if(_e(r),Fd(n)){let e=Yu(t,Rd);lt(`blockType`,e?e.getListType():n.getListType())}else{let e=Af(n)?n.getTag():n.getType();if(e in b$t&<(`blockType`,e),cd(n)){let e=n.getLanguage();lt(`codeLanguage`,e?Sd[e]||e:``);return}}lt(`fontColor`,Hu(e,`color`,`#000`)),lt(`bgColor`,Hu(e,`background-color`,`#fff`)),lt(`fontFamily`,Hu(e,`font-family`,`DM Sans`));let s;Fp(o)&&(s=id(a,e=>Ws(e)&&!e.isInline())),lt(`elementFormat`,Ws(s)?s.getFormatType():Ws(a)?a.getFormatType():o?.getFormatType()||`left`)}(U(e)||ep(e))&&(lt(`isBold`,e.hasFormat(`bold`)),lt(`isItalic`,e.hasFormat(`italic`)),lt(`isUnderline`,e.hasFormat(`underline`)),lt(`isStrikethrough`,e.hasFormat(`strikethrough`)),lt(`isSubscript`,e.hasFormat(`subscript`)),lt(`isSuperscript`,e.hasFormat(`superscript`)),lt(`isCode`,e.hasFormat(`code`)),lt(`isHighlight`,e.hasFormat(`highlight`)),lt(`fontSize`,Hu(e,`font-size`,`15px`)))},[se,oe,lt]);(0,Q.useEffect)(()=>oe.registerCommand(nc,(e,t)=>(B(t),zt(),!1),4),[oe,zt,B]),(0,Q.useEffect)(()=>{se.getEditorState().read(()=>{zt()})},[se,zt]);let Bt=e=>{se.update(()=>{xs([qo(e.emoji)])})},Vt=(0,Q.useCallback)(e=>{se.update(()=>{xs([qo(e)])})},[se]),Ht=(0,Q.useCallback)(()=>{oe.update(()=>{let e=W();if(U(e)){let t=!1;e.getNodes().forEach(e=>{let n=e.getParent();n&&n.getType()===`link`&&(t=!0)}),t?(he(!1),oe.dispatchCommand(Rp,null)):e.isCollapsed()?O6.error(`Please select some text first to create a link`):(oe.dispatchCommand(Rp,d0(`https://`)),he(!0))}})},[oe]),Ut=(0,Q.useCallback)(()=>{ve&&se.dispatchCommand(p6,{editingNodeKey:ve})},[se,ve]),Wt=(0,Q.useCallback)(()=>{oe.getEditorState().read(()=>{let e=W();if(U(e)){let t=e.getTextContent();oe.dispatchCommand(a5,t||void 0)}else oe.dispatchCommand(a5,void 0)})},[oe]),Gt=(0,Q.useCallback)(()=>{oe.dispatchCommand(Hd,void 0)},[oe]),Kt=(0,Q.useCallback)(()=>{pt(e=>{let t=!e;return t&&oe.update(()=>{ht(Dd(oe,null))}),t})},[oe,pt,ht]),qt=(0,Q.useCallback)(()=>{H(l0(se)),V(!0)},[se]),Jt=(0,Q.useCallback)(()=>{lt(`isAutocompleteEnabled`,!ct.isAutocompleteEnabled)},[lt,ct.isAutocompleteEnabled]),Yt=(0,Q.useCallback)(()=>{lt(`isInlineAutocompleteEnabled`,!ct.isInlineAutocompleteEnabled)},[lt,ct.isInlineAutocompleteEnabled]),Xt=(0,Q.useCallback)(()=>{oe.update(()=>{let e=W();if(U(e)){if(e.isCollapsed())Vu(e,()=>sd());else{let t=e.getTextContent(),n=sd();e.insertNodes([n]),e=W(),U(e)&&e.insertRawText(t)}let t=W();if(U(t)){let e=id(t.anchor.getNode(),cd);if(e){let t=Qs();e.insertAfter(t)}}}})},[oe]),Zt=(0,Q.useCallback)(()=>{Ie(!0)},[]),Qt=(0,Q.useCallback)(()=>{Ie(!1)},[]),$t=(0,Q.useCallback)(()=>{Re(!0)},[]);(0,Q.useCallback)(()=>{Re(!1)},[]);let en=(0,Q.useCallback)(e=>{oe.update(()=>{let t=F1(``,e);if(W()?xs([t]):Yi().append(t),!e){let e=Qs();t.insertAfter(e)}})},[oe]),tn=(0,Q.useCallback)(()=>{Be(!0)},[]),nn=(0,Q.useCallback)(e=>{let t=M1(e);oe.update(()=>{let n=N1(t,e);W()?xs([n]):Yi().append(n);let r=Qs();n.insertAfter(r)})},[oe]),rn=(0,Q.useCallback)(async()=>{try{Ee(!0),Ae(0);let e=O6.loading(`Preparing PDF export...`,{description:`Initializing export process`}),t=setInterval(()=>{Ae(n=>{let r=n+15;return r>=90?(clearInterval(t),90):(r>30&&r<=60?O6.loading(`Rendering content...`,{id:e,description:`Converting editor content to PDF format`}):r>60&&O6.loading(`Finalizing PDF...`,{id:e,description:`Almost done!`}),r)})},200),n=new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`);await xRt(se,`export-${n}.pdf`,gt||void 0),clearInterval(t),Ae(100),O6.success(`PDF exported successfully!`,{id:e,description:`File saved as export-${n}.pdf`,duration:4e3})}catch(e){console.error(`PDF export failed:`,e);let t=e instanceof Error?e.message:`Unknown error occurred`;O6.error(`Failed to export PDF`,{description:t,duration:5e3,action:{label:`Try Again`,onClick:()=>rn()}})}finally{Ee(!1),Ae(0)}},[se,gt]),an=(0,Q.useCallback)(async()=>{try{Oe(!0);let e=O6.loading(`Preparing DOC export...`,{description:`Converting to Word document`}),t=new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`);await TRt(se,`export-${t}.docx`,gt||void 0),O6.success(`Document exported successfully!`,{id:e,description:`File saved as export-${t}.docx`,duration:4e3})}catch(e){console.error(`DOC export failed:`,e);let t=e instanceof Error?e.message:`Unknown error occurred`;O6.error(`Failed to export document`,{description:t,duration:5e3,action:{label:`Try Again`,onClick:()=>an()}})}finally{Oe(!1)}},[se,gt]);return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(bFt,{}),(0,X.jsxs)(`div`,{ref:je,className:k$(nt.toolbarContainer,ce?`cteditor-bg-transparent cteditor-border-b`:`cteditor-bg-main-background cteditor-border cteditor-rounded-xl`),children:[(0,X.jsxs)(`div`,{ref:Me,className:nt.toolbarInnerContent,children:[(0,X.jsxs)(`div`,{"data-toolbar-item":`undoRedo`,className:k$(nt.controlGroup,`cteditor-flex-shrink-0`),children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,onClick:()=>se.dispatchCommand(mc,void 0),disabled:fe.undo,size:`icon-sm`,children:(0,X.jsx)(aqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Undo (Ctrl + Z)`})})]})}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:()=>se.dispatchCommand(hc,void 0),disabled:fe.redo,children:(0,X.jsx)(oqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Redo (Ctrl + Y)`})})]})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]}),(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,lockIconClassName:`cteditor-translate-x-0`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`blockFormat`,className:k$(nt.controlGroup,(se!==oe||ct.isNodeSelection||!(at===`paragraph`||/^h[1-6]$/.test(at)))&&`cteditor-opacity-40 cteditor-cursor-not-allowed cteditor-pointer-events-none`),children:(0,X.jsx)(o4t,{blockType:at,enableHeadings:C,enableLists:w,enableBlockquote:T})})}),(0,X.jsx)(r6,{isEnabled:i,planAllows:xt?.enableFontControls??!0,featureName:`Font Controls`,lockIconClassName:`cteditor-translate-x-0`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`fontControls`,className:nt.controlGroup,children:[(0,X.jsx)(`div`,{"data-toolbar-item":`fontFamily`,children:(0,X.jsx)(l3t,{fonts:z,activeEditor:se})}),(0,X.jsx)(`div`,{"data-toolbar-item":`fontSize`,children:(0,X.jsx)(Y7,{})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),(0,X.jsxs)(`div`,{className:`cteditor-flex`,children:[(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`inlineFormats`,className:nt.controlGroup,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:()=>se.dispatchCommand(pc,`bold`),className:k$(ct.isBold&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(q4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Bold (Ctrl + B)`})})]})})})}),m&&se===oe&&(0,X.jsx)(`div`,{"data-toolbar-item":`formatTextMenu`,children:(0,X.jsx)(h3t,{hasFormat:rt,blockType:at})}),se===oe&&(0,X.jsx)(r6,{isEnabled:c,planAllows:xt?.enableColors??!0,featureName:`Colors`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`colorPickers`,children:(0,X.jsx)(w9,{onTextColorChange:Ft,onBackgroundColorChange:It,currentTextColor:ct.fontColor,currentBgColor:ct.bgColor,isHighlightActive:ct.isHighlight,onOpenChange:Xe,isActive:Ye,showTextColorTab:c,showBackgroundColorTab:c,className:`[&>span]:cteditor-hidden`})})})]}),se===oe&&(0,X.jsx)(r6,{isEnabled:r,planAllows:xt?.enableAlignment??!0,featureName:`Alignment`,lockIconClassName:`cteditor-translate-x-0`,className:`cteditor-pr-1`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`alignMenu`,className:nt.controlGroup,children:[(0,X.jsx)(X2t,{enableLineHeight:i&&(xt?.enableFontControls??!0)}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:w,planAllows:xt?.enableLists??!0,featureName:`Lists`,lockIconClassName:`-cteditor-translate-x-1.5`,className:`cteditor-pr-1`,children:(0,X.jsxs)(`div`,{"data-toolbar-item":`listMenu`,className:nt.controlGroup,children:[(0,X.jsx)(n4t,{blockType:at}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:E,planAllows:xt?.enableImageUpload??!0,featureName:`Image Upload`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`imageInsert`,className:nt.controlGroup,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:Zt,className:` cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(t3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Image`})})]})})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:a,planAllows:xt?.enableTableOptions??!0,featureName:`Table Options`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(`div`,{"data-toolbar-item":`tableOptions`,className:nt.controlGroup,children:(0,X.jsx)(KLt,{isActive:ct.rootType===`table`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Add Table`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:O,planAllows:xt?.enableCharts??!0,featureName:`Charts`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`chartInsert`,variant:`ghost`,size:`icon-sm`,onClick:$t,className:`cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(r3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Chart`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:k,planAllows:xt?.enableEquations??!0,featureName:`Equations`,children:(0,X.jsxs)(q5,{children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`equationInsert`,variant:`ghost`,size:`icon-sm`,className:`cteditor-size-6 cteditor-flex-none`,children:(0,X.jsx)(i3,{})})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Equation`})})]})}),(0,X.jsxs)(Q5,{align:`start`,children:[(0,X.jsx)($5,{onClick:()=>en(!1),children:`Block equation`}),(0,X.jsx)($5,{onClick:()=>en(!0),children:`Inline equation`})]})]})}),se===oe&&(0,X.jsx)(r6,{isEnabled:p,planAllows:xt?.enableLinks??!0,featureName:`Links`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`link`,variant:`ghost`,size:`icon-sm`,onClick:Ht,className:k$(Lt?`cteditor-bg-accent`:`cteditor-text-foreground`),children:(0,X.jsx)(G4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert Link`})})]})})}),(0,X.jsx)(r6,{isEnabled:u,planAllows:xt?.enableEmojiPicker??!0,featureName:`Emoji Picker`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(V7,{"data-toolbar-item":`emoji`,icon:(0,X.jsx)(K4,{}),onChange:e=>{Bt(e)},className:`[&>span]:cteditor-hidden`},`emoji-picker`)}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Emoji picker`})})]})})}),(0,X.jsx)(r6,{isEnabled:d,planAllows:xt?.enableSpecialCharacters??!0,featureName:`Special Characters`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(x9,{"data-toolbar-item":`specialCharacters`,icon:(0,X.jsx)(zqt,{}),onChange:Vt,className:`[&>span]:cteditor-hidden`},`special-characters`)}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Special Characters`})})]})})}),se===oe&&(0,X.jsx)(r6,{isEnabled:b,planAllows:xt?.enableNotePanels??!0,featureName:`Note Panels`,children:(0,X.jsx)(`div`,{"data-toolbar-item":`notePanels`,children:(0,X.jsx)(s6t,{className:`[&>span]:cteditor-hidden`})})}),s&&se===oe&&(0,X.jsx)(`div`,{"data-toolbar-item":`insertMenu`,className:`-cteditor-ml-1.5`,children:(0,X.jsx)($3t,{enableHorizontalLine:I,enableFileAttachments:ee,enableSignature:L})}),se===oe&&ve&&(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`editHorizontalRule`,variant:`ghost`,size:`icon-sm`,onClick:Ut,disabled:!e,className:k$(`cteditor-bg-foreground/10`),children:(0,X.jsx)(Z4,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Edit horizontal line`})})]})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`}),(0,X.jsx)(r6,{isEnabled:Dt,planAllows:xt?.enableSpeechToText??!0,featureName:`Speech to Text`,lockIconClassName:`-cteditor-translate-x-1.5`,tooltipMessage:Ot?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:void 0,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-toolbar-item":`voiceTranscript`,className:k$(`cteditor-flex cteditor-items-center cteditor-gap-1 max-md:cteditor-hidden`,!Dt&&`cteditor-pr-2`),children:(0,X.jsx)(_1t,{editor:se,apiKey:gt??void 0})}),(0,X.jsx)(v1t,{}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`,className:`max-md:cteditor-hidden`})]})}),(0,X.jsx)(r6,{isEnabled:_t?.htmlViewOption??!1,planAllows:vt?.htmlViewOption??!0,featureName:`HTML View`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`htmlView`,variant:`ghost`,size:`icon-sm`,onClick:Kt,disabled:!e,className:k$(ft&&`cteditor-bg-foreground/20`),children:(0,X.jsx)(b3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ft?`Switch to Editor View`:`Switch to HTML View`})})]})})}),(0,X.jsx)(r6,{isEnabled:ae,planAllows:xt?.enableHtmlCanvas??!0,featureName:`HTML Canvas`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`htmlCanvas`,variant:`ghost`,size:`icon-sm`,onClick:tn,disabled:!e,children:(0,X.jsx)(h3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Insert HTML Canvas`})})]})})}),(0,X.jsx)(`div`,{"data-toolbar-item":`preview`,className:`cteditor-flex cteditor-items-center`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:qt,children:(0,X.jsx)(m2,{className:`!cteditor-size-3.5`})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`View Preview`})})]})})}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`}),(0,X.jsx)(r6,{isEnabled:x,planAllows:xt?.enableAutocompleteToggle??!0,featureName:`Autocomplete Toggle`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`autocomplete`,variant:`ghost`,size:`icon-sm`,onClick:Jt,disabled:!e,className:k$(ct.isAutocompleteEnabled&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(p3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ct.isAutocompleteEnabled?`Disable Autocorrection`:`Enable Autocorrection`})})]})})}),(0,X.jsx)(r6,{isEnabled:Tt,planAllows:xt?.enableInlineAutocompleteToggle??!0,featureName:`Inline Autocomplete`,tooltipMessage:Et?`Add at least one AI provider key in License Section > Manage API Keys to use Inline Autocomplete.`:void 0,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`inlineAutocomplete`,variant:`ghost`,size:`icon-sm`,onClick:Yt,disabled:!e,className:k$(ct.isInlineAutocompleteEnabled&&`cteditor-bg-foreground/10`),children:(0,X.jsx)(Rqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:ct.isInlineAutocompleteEnabled?`Disable Inline Autocomplete`:`Enable Inline Autocomplete`})})]})})}),(0,X.jsx)(r6,{isEnabled:j||M,planAllows:(xt?.enablePdfExport??!0)||(xt?.enableDocExport??!0),featureName:`Export`,children:(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(q5,{children:[(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsx)(Q2,{"data-toolbar-item":`export`,variant:`ghost`,size:`icon-sm`,disabled:Te||De,children:Te||De?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-animate-spin`}):(0,X.jsx)(d2,{className:`!cteditor-size-4`})})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:Te||De?`Exporting...`:`Export (PDF or DOC)`})})]}),(0,X.jsxs)(Q5,{align:`end`,children:[(0,X.jsxs)($5,{onClick:rn,disabled:!j||!(xt?.enablePdfExport??!0)||Te,children:[Te?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-mr-2 cteditor-animate-spin`}):(0,X.jsx)(Hqt,{}),Te?`Exporting PDF... ${ke}%`:`Export as PDF`]}),(0,X.jsxs)($5,{onClick:an,disabled:!M||!(xt?.enableDocExport??!0)||De,children:[De?(0,X.jsx)(y2,{className:`!cteditor-size-4 cteditor-mr-2 cteditor-animate-spin`}):(0,X.jsx)(Uqt,{}),De?`Exporting...`:`Export as DOC`]})]})]})})})]}),(0,X.jsx)(r6,{isEnabled:Ct,planAllows:xt?.enableAIChat??!0,featureName:`AI Chat`,lockIconClassName:`cteditor-absolute cteditor-top-2.5 cteditor-right-auto cteditor-left-1`,tooltipMessage:wt?`Add at least one AI provider key in License Section > Manage API Keys to use AI Chat.`:void 0,children:(0,X.jsx)(`div`,{"data-toolbar-item":`aiOptions`,className:k$(`cteditor-aiOption`,!g&&`[&>button>svg:first-child]:cteditor-opacity-0`),children:(0,X.jsxs)(q5,{modal:!1,children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`highlighted`,size:`sm`,className:`cteditor-px-2 !cteditor-gap-1 !cteditor-rounded-md cteditor-h-7.5 max-sm:!cteditor-gap-0`,children:[(0,X.jsx)(y3,{className:`aiSparkle !cteditor-size-4`}),(0,X.jsx)(`span`,{className:`max-sm:cteditor-hidden`,children:`AI`}),(0,X.jsx)(c2,{className:`!cteditor-size-4 cteditor-opacity-50`})]})}),(0,X.jsxs)(Q5,{className:`cteditor-w-[200px] cteditor-p-1.5`,children:[(0,X.jsxs)($5,{onClick:Wt,disabled:!e,children:[(0,X.jsx)(X4,{}),` AI Chat`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`REFINE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`SPELLING_GRAMMAR`}),children:[(0,X.jsx)(jqt,{}),` Fix Grammar`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`SIMPLIFY`}),children:[(0,X.jsx)(Pqt,{}),` Simplify`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`COMPLETE_SENTENCE`}),children:[(0,X.jsx)(Aqt,{}),` Complete Sentence`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`REWRITE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`MAKE_LONGER`}),children:[(0,X.jsx)(Mqt,{}),` Make Longer`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`MAKE_SHORTER`}),children:[(0,X.jsx)(Nqt,{}),` Make Shorter`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(S5,void 0),children:[(0,X.jsx)(kqt,{}),` Adjust Tone`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(x5,void 0),children:[(0,X.jsx)(uqt,{}),` Translate`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`EMOJIFY`}),children:[(0,X.jsx)(K4,{}),` Emojify`]}),(0,X.jsxs)(`div`,{className:nt.categoryHeader,children:[`GENERATE `,(0,X.jsx)(`div`,{className:nt.categoryHeaderLine})]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(a6,{type:`AI_RESPONSE`}),children:[(0,X.jsx)(f3,{}),` AI`]}),(0,X.jsxs)($5,{onClick:()=>oe.dispatchCommand(b5,void 0),children:[(0,X.jsx)(m3,{}),` Generate Image`]})]})]})})}),(0,X.jsx)(r6,{isEnabled:Dt,planAllows:xt?.enableSpeechToText??!0,featureName:`Speech to Text`,lockIconClassName:`-cteditor-translate-x-1.5`,tooltipMessage:Ot?`Add your AssemblyAI key in License Section > Manage API Keys to use voice transcription.`:void 0,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-toolbar-item":`voiceTranscript`,className:k$(`cteditor-flex cteditor-items-center cteditor-gap-1 md:cteditor-hidden`,!Dt&&`cteditor-pr-2`),children:(0,X.jsx)(_1t,{editor:se,apiKey:gt??void 0})}),(0,X.jsx)(v1t,{}),(0,X.jsx)(C9,{orientation:`vertical`,size:`md`,className:`md:cteditor-hidden`})]})}),(0,X.jsxs)(`div`,{"data-toolbar-item":`clearOptions`,className:k$(nt.controlGroup,`max-md:cteditor-hidden`),children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,onClick:ot,children:(0,X.jsx)(wqt,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Clear formatting`})})]})}),(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,disabled:it,onClick:Pt,children:(0,X.jsx)(s3,{})})}),(0,X.jsx)($3,{children:(0,X.jsx)(`p`,{children:`Clear editor`})})]})})]}),(0,X.jsx)(`div`,{className:`cteditor-ml-auto`,children:P&&ue&&(0,X.jsx)(i4t,{fitToPage:ce,isOpen:le,onClick:ue,commentCount:de})}),be&&(0,X.jsx)(`div`,{className:`cteditor-flex-shrink-0 cteditor-h-7`,children:(0,X.jsxs)(q5,{open:Se,onOpenChange:e=>{Ce(e),e||et(``)},children:[(0,X.jsx)(J5,{asChild:!0,children:(0,X.jsxs)(Q2,{variant:`secondary`,className:k$(nt.moreMenuTriggerButton,`cteditor-relative !cteditor-bg-foreground/[0.03] dark:!cteditor-bg-foreground/[0.02]`),children:[(0,X.jsx)(x2,{className:`!cteditor-size-4`}),(0,X.jsx)(c2,{className:`!cteditor-size-3 cteditor-opacity-50 `}),Ne.has(`insertMenu`)&&V$t.some(we)&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`cteditor-absolute cteditor-top-[3px] cteditor-right-[3px] cteditor-size-2 cteditor-rounded-full cteditor-bg-[radial-gradient(circle_at_35%_30%,#fbe3a8_0%,#e6b96b_45%,#b88438_100%)] cteditor-ring-[1.5px] cteditor-ring-background`,children:(0,X.jsx)(`span`,{className:`cteditor-absolute -cteditor-inset-[3px] cteditor-rounded-full cteditor-border-[1.5px] cteditor-border-solid cteditor-border-[#e6b96b] cteditor-animate-ping-slow`})})]})}),(0,X.jsxs)(Q5,{align:`end`,className:`cteditor-w-64 cteditor-max-h-[450px] cteditor-overflow-hidden cteditor-flex cteditor-flex-col`,onCloseAutoFocus:e=>e.preventDefault(),onPointerDownOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.emoji-picker-react`)||t.closest(`[data-voice-transcript]`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`[data-radix-popover-content]`)||t.closest(`[data-radix-dropdown-menu-content]`)||t.closest(`#emoji-picker`)||t.closest(`#highlight-color-picker`)||t.closest(`#color-picker`))&&e.preventDefault()},onInteractOutside:e=>{let t=e.target;(t.closest(`.react-colorful`)||t.closest(`.emoji-picker-react`)||t.closest(`[data-voice-transcript]`)||t.closest(`[data-radix-popper-content-wrapper]`)||t.closest(`[data-radix-popover-content]`)||t.closest(`[data-radix-dropdown-menu-content]`)||t.closest(`#emoji-picker`)||t.closest(`#highlight-color-picker`)||t.closest(`#color-picker`))&&e.preventDefault()},children:[(0,X.jsxs)(`div`,{className:`cteditor-sticky cteditor-top-0 cteditor-z-10 `,children:[(0,X.jsxs)(`div`,{className:W7.searchWrapper,children:[(0,X.jsx)(C2,{className:W7.searchIcon}),(0,X.jsx)(N6,{ref:tt,type:`text`,placeholder:`Search tools...`,value:$e,onChange:e=>et(e.target.value),onKeyDown:e=>e.stopPropagation(),className:W7.searchInput}),$e&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>et(``),className:W7.searchClearButton,children:(0,X.jsx)(s3,{className:W7.searchClearIcon})})]}),$e&&(0,X.jsx)(`p`,{className:nt.searchStatusText,children:dt?`Showing matching tools`:`No tools found`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`md:cteditor-hidden`,children:[(0,X.jsxs)($5,{onClick:ot,children:[(0,X.jsx)(wqt,{}),(0,X.jsx)(`span`,{children:`Clear formatting`})]}),(0,X.jsxs)($5,{onClick:Pt,disabled:it,children:[(0,X.jsx)(s3,{}),(0,X.jsx)(`span`,{children:`Clear editor`})]})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`}),!dt&&$e&&(0,X.jsxs)(`div`,{className:nt.searchEmptyStateContainer,children:[(0,X.jsx)(C2,{className:nt.searchEmptyStateIcon}),(0,X.jsx)(`p`,{className:nt.searchEmptyStateTitle,children:`No tools found`}),(0,X.jsx)(`p`,{className:nt.searchEmptyStateDescription,children:`Try a different search term`})]}),ut(`suggestFeature`)&&(0,X.jsxs)($5,{onClick:()=>We(!0),className:`sm:cteditor-hidden`,children:[(0,X.jsx)(Cqt,{}),(0,X.jsx)(`span`,{children:`Suggest a Feature`})]}),ut(`reportBug`)&&(0,X.jsxs)($5,{onClick:()=>Ke(!0),className:`sm:cteditor-hidden`,children:[(0,X.jsx)(Lqt,{}),(0,X.jsx)(`span`,{children:`Report a Bug`})]}),se===oe&&Ne.has(`blockFormat`)&&ut(`blockFormat`)&&(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(o4t,{blockType:at,enableHeadings:C,enableLists:w,enableBlockquote:T,triggerClassName:`cteditor-w-full dark:cteditor-bg-body/20 cteditor-bg-body cteditor-border-foreground/5 cteditor-border cteditor-h-7.5 !cteditor-rounded-md cteditor-justify-between cteditor-pe-3 `})})})})}),(Ne.has(`fontFamily`)||Ne.has(`fontSize`))&&(ut(`fontFamily`)||ut(`fontSize`))&&(0,X.jsx)(r6,{isEnabled:i,planAllows:xt?.enableFontControls??!0,featureName:`Font Controls`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(l3t,{fonts:z,activeEditor:se})})}),(0,X.jsx)($5,{asChild:!0,onSelect:e=>e.preventDefault(),children:(0,X.jsx)(`div`,{className:`cteditor-w-full [&>div]:cteditor-w-full [&>div]:cteditor-justify-between`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(Y7,{})})})]})}),se===oe&&Ne.has(`imageInsert`)&&ut(`imageInsert`)&&(0,X.jsx)(r6,{isEnabled:E,planAllows:xt?.enableImageUpload??!0,featureName:`Image Upload`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Zt,children:[(0,X.jsx)(t3,{}),`Insert Image`]})}),se===oe&&Ne.has(`tableOptions`)&&ut(`tableOptions`)&&(0,X.jsx)(r6,{isEnabled:a,planAllows:xt?.enableTableOptions??!0,featureName:`Table Options`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)($5,{asChild:!0,onSelect:()=>{oe.dispatchCommand(c5,void 0)},children:(0,X.jsxs)(`div`,{className:`cteditor-w-full [&>button]:cteditor-size-6 [&>button]:!cteditor-bg-transparent`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(KLt,{isActive:ct.rootType===`table`}),`Table`]})})})}),se===oe&&Ne.has(`chartInsert`)&&ut(`chartInsert`)&&(0,X.jsx)(r6,{isEnabled:O,planAllows:xt?.enableCharts??!0,featureName:`Charts`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:$t,children:[(0,X.jsx)(r3,{}),`Insert Chart`]})}),se===oe&&Ne.has(`equationInsert`)&&ut(`equationInsert`)&&(0,X.jsx)(r6,{isEnabled:k,planAllows:xt?.enableEquations??!0,featureName:`Equations`,variant:`inline`,children:(0,X.jsxs)(Y5,{children:[(0,X.jsxs)(X5,{children:[(0,X.jsx)(i3,{}),`Insert Equation`]}),(0,X.jsxs)(Z5,{children:[(0,X.jsx)($5,{onClick:()=>en(!1),children:`Block equation`}),(0,X.jsx)($5,{onClick:()=>en(!0),children:`Inline equation`})]})]})}),Ne.has(`preview`)&&ut(`preview`)&&(0,X.jsxs)($5,{onClick:qt,children:[(0,X.jsx)(Wqt,{}),`Preview`]}),Ne.has(`export`)&&ut(`export`)&&(j||M)&&(0,X.jsxs)(r6,{isEnabled:j||M,planAllows:(xt?.enablePdfExport??!0)||(xt?.enableDocExport??!0),featureName:`Export`,variant:`inline`,children:[(0,X.jsxs)($5,{onClick:rn,disabled:!j||!(xt?.enablePdfExport??!0)||Te,children:[(0,X.jsx)(Hqt,{}),Te?`Exporting PDF... ${ke}%`:`Export as PDF`]}),(0,X.jsxs)($5,{onClick:an,disabled:!M||!(xt?.enableDocExport??!0)||De,children:[(0,X.jsx)(Uqt,{}),De?`Exporting...`:`Export as DOC`]})]}),Ne.has(`inlineFormats`)&&ut(`inlineFormats`)&&(0,X.jsx)(r6,{isEnabled:n,planAllows:xt?.enableTextFormatting??!0,featureName:`Text Formatting`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`strikethrough`),children:[(0,X.jsx)(U4,{}),`Strikethrough`]})}),se===oe&&Ne.has(`codeBlock`)&&ut(`codeBlock`)&&(0,X.jsx)(r6,{isEnabled:h,planAllows:xt?.enableCodeFormat??!0,featureName:`Code Format`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Xt,children:[(0,X.jsx)(W4,{}),`Code Block`]})}),se===oe&&Ne.has(`formatTextMenu`)&&ut(`formatTextMenu`)&&(0,X.jsx)(r6,{isEnabled:m,planAllows:xt?.enableFormatTextMenu??!0,featureName:`Format Text Menu`,variant:`inline`,children:(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-1`,children:[(0,X.jsx)(`div`,{className:`cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2`,children:`Format`}),(0,X.jsx)(_3t,{hasFormat:rt,blockType:at}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),se===oe&&Ne.has(`colorPickers`)&&ut(`colorPickers`)&&(0,X.jsx)(r6,{isEnabled:c,planAllows:xt?.enableColors??!0,featureName:`Colors`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(w9,{className:k$(nt.dropdownItemTrigger,`[&>div]:cteditor-size-6`),onTextColorChange:e=>{Ft(e),Ce(!0)},onBackgroundColorChange:e=>{It(e),Ce(!0)},currentTextColor:ct.fontColor,currentBgColor:ct.bgColor,isHighlightActive:ct.isHighlight,onOpenChange:Xe,isActive:Ye,showTextColorTab:c,showBackgroundColorTab:c})})})}),se===oe&&Ne.has(`link`)&&ut(`link`)&&(0,X.jsx)(r6,{isEnabled:p,planAllows:xt?.enableLinks??!0,featureName:`Links`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Ht,children:[(0,X.jsx)(G4,{}),Lt?`Remove Link`:`Insert Link`]})}),Ne.has(`emoji`)&&ut(`emoji`)&&(0,X.jsx)(r6,{isEnabled:u,planAllows:xt?.enableEmojiPicker??!0,featureName:`Emoji Picker`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(V7,{className:nt.dropdownItemTrigger,icon:(0,X.jsx)(K4,{}),onChange:e=>{Bt(e),Ce(!0)}},`emoji-picker-dropdown`)})}),Ne.has(`specialCharacters`)&&ut(`specialCharacters`)&&(0,X.jsx)(r6,{isEnabled:d,planAllows:xt?.enableSpecialCharacters??!0,featureName:`Special Characters`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full`,children:(0,X.jsx)(x9,{className:nt.dropdownItemTrigger,icon:(0,X.jsx)(zqt,{}),onChange:e=>{Vt(e),Ce(!0)}},`special-characters-dropdown`)})}),se===oe&&Ne.has(`insertMenu`)&&ut(`insertMenu`)&&(0,X.jsx)(r6,{isEnabled:s,planAllows:xt?.enableInsertMenu??!0,featureName:`Insert Menu`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-w-full `,children:[(0,X.jsx)(`div`,{className:k$(nt.dropdownSectionLabel,`cteditor-pt-2`),children:`Insert Menu`}),(0,X.jsx)(a6t,{enableHorizontalLine:I,enableFileAttachments:ee,enableSignature:L,enableImageUpload:E})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),se===oe&&ve&&Ne.has(`editHorizontalRule`)&&ut(`editHorizontalRule`)&&(0,X.jsxs)($5,{onClick:Ut,children:[(0,X.jsx)(Z4,{}),`Edit Line`]}),se===oe&&Ne.has(`todo`)&&ut(`todo`)&&(0,X.jsx)(r6,{isEnabled:_,planAllows:xt?.enableTodoList??!0,featureName:`Todo List`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($5,{onClick:Gt,children:[(0,X.jsx)(tqt,{}),`Todo List`]})})}),se===oe&&Ne.has(`signature`)&&ut(`signature`)&&(0,X.jsx)(r6,{isEnabled:L,planAllows:xt?.enableSignature??!0,featureName:`Signature`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:()=>He(!0),children:[(0,X.jsx)(Q4,{}),`Signature`]})}),se===oe&&Ne.has(`notePanels`)&&ut(`notePanels`)&&(0,X.jsx)(r6,{isEnabled:b,planAllows:xt?.enableNotePanels??!0,featureName:`Note Panels`,variant:`inline`,children:(0,X.jsx)(`div`,{className:`cteditor-w-full [&>button]:cteditor-w-full`,children:(0,X.jsx)(s6t,{className:nt.dropdownItemTrigger})})}),r&&se===oe&&Ne.has(`alignMenu`)&&ut(`alignMenu`)&&(0,X.jsx)(r6,{isEnabled:r,planAllows:xt?.enableAlignment??!0,featureName:`Alignment`,variant:`inline`,children:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-2`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Align Menu`}),(0,X.jsx)(Z2t,{})]}),i&&(xt?.enableFontControls??!0)&&(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-2`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Line Height`}),(0,X.jsx)(J2t,{})]}),(0,X.jsx)(e7,{className:`!cteditor-bg-foreground/10`})]})}),Ne.has(`htmlView`)&&ut(`htmlView`)&&(0,X.jsx)(r6,{isEnabled:_t?.htmlViewOption??!1,planAllows:vt?.htmlViewOption??!0,featureName:`HTML View`,variant:`inline`,children:(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($5,{onClick:Kt,disabled:!e,children:[(0,X.jsx)(b3,{}),ft?`Switch to Editor View`:`Switch to HTML View`]})})}),Ne.has(`htmlCanvas`)&&ut(`htmlCanvas`)&&(0,X.jsx)(r6,{isEnabled:ae,planAllows:xt?.enableHtmlCanvas??!0,featureName:`HTML Canvas`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:tn,disabled:!e,children:[(0,X.jsx)(h3,{}),`Insert HTML Canvas`]})}),Ne.has(`autocomplete`)&&ut(`autocomplete`)&&(0,X.jsx)(r6,{isEnabled:x,planAllows:xt?.enableAutocompleteToggle??!0,featureName:`Autocomplete Toggle`,variant:`inline`,children:(0,X.jsxs)($5,{onClick:Jt,disabled:!e,children:[(0,X.jsx)(p3,{}),ct.isAutocompleteEnabled?`Disable Autocorrection`:`Enable Autocorrection`]})}),Ne.has(`inlineAutocomplete`)&&ut(`inlineAutocomplete`)&&(0,X.jsx)(r6,{isEnabled:Tt,planAllows:xt?.enableInlineAutocompleteToggle??!0,featureName:`Inline Autocomplete`,variant:`inline`,tooltipMessage:Et?`Add at least one AI provider key in License Section > Manage API Keys to use Inline Autocomplete.`:void 0,children:(0,X.jsxs)($5,{onClick:Yt,disabled:!e,children:[(0,X.jsx)(Rqt,{}),ct.isInlineAutocompleteEnabled?`Disable Inline Autocomplete`:`Enable Inline Autocomplete`]})}),$e.trim()&&E6t.some(e=>ut(e))&&(0,X.jsxs)(`div`,{className:`cteditor-w-full cteditor-pt-1`,children:[(0,X.jsx)(`div`,{className:nt.dropdownSectionLabel,children:`Quick Actions`}),ut(`actionBold`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`bold`),children:[(0,X.jsx)(q4,{}),` Bold`]}),ut(`actionItalic`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`italic`),children:[(0,X.jsx)(H4,{}),` Italic`]}),ut(`actionUnderline`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`underline`),children:[(0,X.jsx)(V4,{}),` Underline`]}),ut(`actionStrikethrough`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`strikethrough`),children:[(0,X.jsx)(U4,{}),` Strikethrough`]}),ut(`actionSubscript`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`subscript`),children:[(0,X.jsx)(J4,{}),` Subscript`]}),ut(`actionSuperscript`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(pc,`superscript`),children:[(0,X.jsx)(Y4,{}),` Superscript`]}),ut(`actionQuote`)&&(0,X.jsxs)($5,{onClick:()=>{se.update(()=>{let e=W();U(e)&&Vu(e,()=>Df())})},children:[(0,X.jsx)(lqt,{}),` Block Quote`]}),ut(`actionBulletList`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(Bd,void 0),children:[(0,X.jsx)(e3,{}),` Bullet List`]}),ut(`actionNumberedList`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(Vd,void 0),children:[(0,X.jsx)(e3,{}),` Numbered List`]}),ut(`actionHorizontalRule`)&&(0,X.jsxs)($5,{onClick:()=>se.dispatchCommand(mf,void 0),children:[(0,X.jsx)(Z4,{}),` Horizontal Line`]})]})]})]})]})})]}),Fe&&(0,X.jsx)($7,{activeEditor:se,onClose:Qt}),(0,X.jsx)(QRt,{open:Le,onOpenChange:Re,onInsert:nn}),(0,X.jsx)(x3t,{open:ze,onOpenChange:Be}),Ve&&(0,X.jsx)(s5,{onClose:()=>He(!1)}),(0,X.jsx)($Rt,{open:Ue,onOpenChange:We}),(0,X.jsx)(XRt,{open:Ge,onOpenChange:Ke}),(0,X.jsx)(ezt,{open:qe,onOpenChange:Nt,onFeedbackSubmitted:At}),(0,X.jsx)(c6t,{open:Ze,onOpenChange:V,htmlContent:Qe,apiKey:gt??void 0})]}):null},T9=48,O6t=20,k6t=1e3,A6t=typeof navigator<`u`&&/Android/i.test(navigator.userAgent),j6t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>bte(e),[e]),null},M6t=({anchorElem:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)([]),i=e??null,a=(0,Q.useRef)(``),o=(0,Q.useCallback)(()=>{if(!i){a.current!==``&&(a.current=``,r([]));return}let e=[];t.getEditorState().read(()=>{Yi().getChildren().forEach(t=>{e0(t)&&t.getChildren().forEach(t=>{Z1(t)&&e.push(t.getKey())})})});let n=i.getBoundingClientRect(),o=[];e.forEach(e=>{let r=t.getElementByKey(e);if(!r)return;let a=r.getBoundingClientRect();o.push({key:e,top:a.top-n.top+i.scrollTop,right:a.right-n.left+i.scrollLeft})});let s=o.map(e=>`${e.key}:${Math.round(e.top)}:${Math.round(e.right)}`).join(`|`);s!==a.current&&(a.current=s,r(o))},[t,i]);(0,Q.useEffect)(()=>t.registerUpdateListener(()=>o()),[t,o]),(0,Q.useEffect)(()=>{o()},[o]),(0,Q.useEffect)(()=>{let e=()=>o();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[o]),(0,Q.useEffect)(()=>{if(!i||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>o());return e.observe(i),()=>e.disconnect()},[i,o]);let s=(0,Q.useCallback)(e=>{t.update(()=>{let t=Ui(e);if(!Z1(t))return;let n=Qs();t.append(n),n.select();let r=W();U(r)&&r.insertText(`/`)})},[t]);return!i||n.length===0?null:N0.createPortal((0,X.jsx)(X.Fragment,{children:n.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`ed-col-add-btn`,title:`Add a block to this column`,onMouseDown:e=>e.preventDefault(),onClick:()=>s(e.key),style:{position:`absolute`,top:e.top+8,left:e.right-8,transform:`translateX(-100%)`,zIndex:1},children:[(0,X.jsx)(`span`,{style:{paddingRight:`4px`},children:`+`}),` block`]},e.key))}),i)},N6t=di(`INSERT_COMMENT_COMMAND`),P6t=di(`OPEN_COMMENT_MODAL`),F6t=di(`OPEN_COMMENT_SIDEBAR_COMMAND`),I6t=(e,t)=>{let n;return function(...r){clearTimeout(n),n=window.setTimeout(()=>e.apply(this,r),t)}},E9=({namespace:e})=>{let[t]=Gd(),n=(0,Q.useMemo)(()=>I6t(()=>{let n=JSON.stringify(t.getEditorState());localStorage.setItem(e,n)},500),[t,e]);return(0,Q.useEffect)(()=>t.registerUpdateListener(({dirtyElements:e,dirtyLeaves:t})=>{e.size===0&&t.size===0||n()}),[n,t]),null},L6t=({open:e,onOpenChange:t,oldImageUrl:n,newImageUrl:r,onReplace:i,onCancel:a})=>(0,X.jsx)(x6,{open:e,onOpenChange:t,children:(0,X.jsxs)(S6,{className:`sm:max-w-[800px] max-h-[90vh] overflow-y-auto`,children:[(0,X.jsxs)(C6,{children:[(0,X.jsxs)(T6,{className:`flex items-center gap-2 text-xl`,children:[(0,X.jsx)(`span`,{className:`text-2xl`,children:`🔄`}),`Compare Images`]}),(0,X.jsx)(E6,{className:`text-sm pt-1`,children:`Choose whether to replace the original image with the refined version.`})]}),(0,X.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-gray-700 dark:text-gray-300`,children:`Refined Image`}),(0,X.jsx)(`span`,{className:`text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400`,children:`New`})]}),(0,X.jsx)(`div`,{className:`relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600`,children:(0,X.jsx)(`img`,{src:r,alt:`Refined`,className:`w-full h-full object-contain`})})]})}),(0,X.jsx)(`div`,{className:`p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800`,children:(0,X.jsxs)(`p`,{className:`text-sm text-blue-800 dark:text-blue-200`,children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:`Note:`}),` Clicking "Replace" will update the image in your document. This action cannot be undone.`]})})]}),(0,X.jsxs)(w6,{className:`gap-2`,children:[(0,X.jsx)(Q2,{variant:`outline`,onClick:a,children:`Keep Original`}),(0,X.jsxs)(Q2,{onClick:i,className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,X.jsx)(`span`,{className:`mr-2`,children:`✓`}),`Replace Image`]})]})]})}),R6t=`/transform-image/`,D9={east:1,north:8,south:2,west:4},O9=new Set,k9=di(`RIGHT_CLICK_IMAGE_COMMAND`),A9=`application/x-editor-image-node-key`,z6t=Object.freeze(Object.defineProperty({__proto__:null,IMAGE_DRAG_DATA_TYPE:A9,RIGHT_CLICK_IMAGE_COMMAND:k9,default:rBt},Symbol.toStringTag,{value:`Module`})),B6t=[`image/`,`image/heic`,`image/heif`,`image/gif`,`image/webp`,`image/png`,`image/jpg`,`image/jpeg`,`image/svg+xml`],V6t=[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],H6t=1*1024*1024*1024,U6t=[`application/pdf`,`text/plain`,`text/csv`,`application/json`,`application/zip`,`application/x-zip-compressed`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],W6t=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}),G6t=`draggable-block-menu`,K6t={ornament:[{value:`star`,label:`✦`},{value:`flower`,label:`❋`},{value:`diamond`,label:`◆`},{value:`dot`,label:`•`},{value:`section`,label:`§`}],asterism:[{value:`asterism`,label:`⁂`},{value:`triple-star`,label:`✳`},{value:`section`,label:`§`}],labeled:[{value:`thin`,label:`Thin`},{value:`thick`,label:`Thick`},{value:`dashed`,label:`Dashed`},{value:`dotted`,label:`Dotted`}],section:[{value:`left`,label:(0,X.jsx)(r2,{size:15}),title:`Align left`},{value:`center`,label:(0,X.jsx)(n2,{size:15}),title:`Align center`},{value:`right`,label:(0,X.jsx)(i2,{size:15}),title:`Align right`}],pullquote:[{value:`full`,label:`Full`},{value:`short`,label:`Short`},{value:`none`,label:`None`}],columns:[],button:[{value:`filled`,label:`Filled`},{value:`outline`,label:`Outline`}]},q6t=()=>{let[e]=Gd(),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null),u=(0,Q.useRef)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=t?.key;(0,Q.useEffect)(()=>{m(!1)},[h]),(0,Q.useEffect)(()=>{let t=e.getRootElement();t&&c(t.closest(`.editor-scroller`)||t.parentElement||document.body)},[e]),(0,Q.useEffect)(()=>e.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=lBt(),t=e?`${e.key}:${e.variant}:${e.autoNumber??``}:${e.count??``}:${e.trackCount??``}:${e.hasWide??``}:${e.align??``}:${e.radius??``}:${e.textColor??``}:${e.bgColor??``}`:``;t!==u.current&&(u.current=t,n(e))})}),[e]);let g=(0,Q.useCallback)(()=>{if(!t||!s){i(null),o(null);return}let n=e.getElementByKey(t.key);if(!n){i(null),o(null);return}let r=n.getBoundingClientRect(),a=s.getBoundingClientRect(),c=s.scrollTop,u=s.scrollLeft,d=l.current?.offsetHeight||38,f=l.current?.offsetWidth||0,p=r.top-a.top+c,m=r.left-a.left+u;o({top:p,left:m,width:r.width,height:r.height});let h=p-d-8;h<c+4&&(h=p+r.height+8);let g=Math.max(8,m);f>0&&(g=Math.min(g,a.width+u-f-8),g=Math.max(8,g)),i({top:h,left:g})},[t,s,e]);(0,Q.useEffect)(()=>{g()},[g]),(0,Q.useEffect)(()=>{if(!t)return;let e=()=>g();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,g]),(0,Q.useEffect)(()=>{if(!t||typeof ResizeObserver>`u`)return;let n=e.getElementByKey(t.key);if(!n)return;let r=new ResizeObserver(()=>g());return r.observe(n),s&&r.observe(s),()=>r.disconnect()},[t,e,s,g]),(0,Q.useEffect)(()=>{if(t)return e.registerUpdateListener(()=>g())},[t,e,g]);let _=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e&&(t.type===`ornament`&&eLt(e)||t.type===`asterism`&&rLt(e)?e.setVariant(n):t.type===`labeled`&&G1(e)?e.setRuleStyle(n):t.type===`section`&&q1(e)?e.setAlign(n):t.type===`pullquote`&&Y1(e)?e.setRules(n):t.type===`button`&&o0(e)&&e.setVariant(n))})},[t,e]),v=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&e.setAlign(n)})},[t,e]),y=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&e.setRadius(n)})},[t,e]),b=(0,Q.useCallback)((n,r)=>{t&&e.update(()=>{let e=Ui(t.key);t.type===`button`&&o0(e)&&(n===`text`?e.setTextColor(r):e.setBgColor(r))})},[t,e]),x=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e0(e)&&(n===1?bzt(e):xzt(e))})},[t,e]),S=(0,Q.useCallback)(n=>{t&&e.update(()=>{let e=Ui(t.key);e0(e)&&n(e)})},[t,e]),C=(0,Q.useCallback)(e=>{f(!1),S(t=>Szt(t,e))},[S]);(0,Q.useEffect)(()=>{f(!1)},[t?.key,t?.count]),(0,Q.useEffect)(()=>{if(!d)return;let e=e=>{l.current?.contains(e.target)||f(!1)};return document.addEventListener(`mousedown`,e,!0),()=>document.removeEventListener(`mousedown`,e,!0)},[d]);let w=(0,Q.useCallback)(()=>{t&&e.update(()=>{let e=Ui(t.key);if(!e)return;let n=dBt(e,t.type);n&&e.insertAfter(n)})},[t,e]),T=(0,Q.useCallback)(()=>{t&&e.update(()=>{let e=Ui(t.key);q1(e)&&e.setAutoNumber(!e.getAutoNumber())})},[t,e]),E=(0,Q.useCallback)(()=>{t&&(e.update(()=>{Ui(t.key)?.remove()}),n(null),u.current=``)},[t,e]);if(!t||!r||!s)return null;let D=K6t[t.type],O=t.type===`ornament`||t.type===`asterism`,k=a!=null&&(t.type===`labeled`||t.type===`section`||t.type===`pullquote`||t.type===`columns`||t.type===`ornament`||t.type===`asterism`);return N0.createPortal((0,X.jsxs)(X.Fragment,{children:[k&&a&&(0,X.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,top:a.top-4,left:a.left-8,width:a.width+16,height:a.height+16,pointerEvents:`none`,border:`1px dashed var(--ed-accent-color, #ef9f27)`,backgroundColor:`color-mix(in srgb, var(--ed-accent-color, #ef9f27) 5%, transparent)`,borderRadius:12,opacity:.6,zIndex:1}}),(0,X.jsxs)(`div`,{ref:l,onMouseDown:e=>e.preventDefault(),style:{position:`absolute`,top:r.top,left:r.left,zIndex:1e3},className:`cteditor-flex cteditor-p-1 cteditor-align-middle cteditor-absolute cteditor-top-0 cteditor-left-0 cteditor-z-10 cteditor-rounded-lg cteditor-items-center cteditor-bg-accent cteditor-text-sm cteditor-border cteditor-border-foreground/10 cteditor-space-x-1`,children:[D.map(e=>(0,X.jsx)(`button`,{type:`button`,title:e.title||e.value,onClick:()=>_(e.value),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center disabled:cursor-not-allowed cteditor-transition-colors `+(O?`cteditor-size-6 cteditor-p-[2px] cteditor-text-base `:`cteditor-h-6 cteditor-px-2 cteditor-text-xs `)+(t.variant===e.value?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:e.label},e.value)),t.type===`button`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center`,children:[(0,X.jsxs)(`button`,{type:`button`,title:`Button alignment`,"aria-label":`Button alignment`,onClick:()=>m(e=>!e),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-6 cteditor-px-1 cteditor-gap-0.5 `+(p?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:[t.align===`center`?(0,X.jsx)(n2,{size:15}):t.align===`right`?(0,X.jsx)(i2,{size:15}):(0,X.jsx)(r2,{size:15}),(0,X.jsx)(c2,{size:13,className:`cteditor-opacity-50`})]}),p&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-left-0 cteditor-top-full cteditor-mt-1 cteditor-z-10 cteditor-min-w-max cteditor-rounded-xl cteditor-border cteditor-border-foreground/10 cteditor-bg-accent cteditor-p-1`,children:[[`left`,`Left Align`,r2],[`center`,`Center Align`,n2],[`right`,`Right Align`,i2]].map(([e,n,r])=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{v(e),m(!1)},className:`cteditor-border-0 cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-w-full cteditor-whitespace-nowrap cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-left cteditor-text-xs cteditor-text-foreground cteditor-cursor-pointer `+(t.align===e?`cteditor-bg-foreground/10 `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 `),children:[(0,X.jsx)(r,{size:14}),n]},e))})]}),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),[[`rounded`,aJt,`Rounded button`],[`square`,iJt,`Square button`],[`pill`,oJt,`Pill button`]].map(([e,n,r])=>(0,X.jsx)(`button`,{type:`button`,title:r,"aria-label":r,onClick:()=>y(e),className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 `+(t.radius===e?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:(0,X.jsx)(n,{className:`cteditor-size-4`})},e)),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsx)(w9,{onTextColorChange:e=>b(`text`,e),onBackgroundColorChange:e=>b(`bg`,e),currentTextColor:t.textColor??void 0,currentBgColor:t.bgColor??void 0,showTextColorTab:!0,showBackgroundColorTab:!0,className:`!cteditor-size-6 [&>span]:cteditor-hidden king`})]}),t.type===`section`&&(0,X.jsx)(`button`,{type:`button`,title:`Auto-number sections`,onClick:T,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center disabled:cursor-not-allowed cteditor-transition-colors cteditor-h-6 cteditor-px-2 cteditor-text-xs cteditor-font-mono `+(t.autoNumber?`cteditor-bg-foreground/10 cteditor-text-foreground `:`cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground `),children:`01`}),t.type===`columns`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,title:`Remove column`,disabled:(t.count??2)<=1,onClick:()=>x(-1),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-[7px] cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-text-foreground/70 hover:cteditor-bg-foreground/10 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:(0,X.jsx)(sJt,{className:`cteditor-size-[15px]`})}),(0,X.jsxs)(`span`,{className:`cteditor-min-w-[34px] cteditor-text-center cteditor-font-semibold cteditor-text-foreground cteditor-text-xs cteditor-inline-flex cteditor-items-center cteditor-justify-center cteditor-gap-[5px]`,children:[(0,X.jsx)(`span`,{children:t.count??2}),(0,X.jsx)(`small`,{className:`cteditor-text-[11.5px] cteditor-text-foreground/50 cteditor-font-medium cteditor-tracking-wider`,children:`Col`})]}),(0,X.jsx)(`button`,{type:`button`,title:`Add column`,disabled:(t.trackCount??2)>=3,onClick:()=>x(1),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-[7px] cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-text-foreground/70 hover:cteditor-bg-foreground/10 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:(0,X.jsx)(rqt,{className:`cteditor-size-[15px]`})})]}),(0,X.jsx)(`span`,{className:`cteditor-h-5 cteditor-w-px cteditor-bg-foreground/10 cteditor-flex-shrink-0`}),(0,X.jsxs)(`div`,{className:`cteditor-relative cteditor-flex cteditor-items-center`,children:[(0,X.jsxs)(`button`,{type:`button`,title:`Merge two columns into one wider column`,disabled:(t.count??2)<2,onClick:()=>{(t.count??2)<=2?C(0):f(e=>!e)},className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-md cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-[30px] cteditor-px-2 cteditor-text-xs cteditor-font-medium cteditor-gap-1 disabled:cursor-not-allowed disabled:cteditor-opacity-30 `+(d?`cteditor-bg-foreground/10 cteditor-text-foreground`:`cteditor-bg-transparent hover:cteditor-bg-foreground/5 cteditor-text-foreground/70 hover:cteditor-text-foreground`),children:[(0,X.jsx)(cJt,{className:`cteditor-size-5`}),(0,X.jsxs)(`span`,{children:[`Merge`,(t.count??2)>2?` ▾`:``]})]}),d&&(t.count??2)>2&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-left-0 cteditor-top-full cteditor-mt-1 cteditor-z-10 cteditor-min-w-max cteditor-rounded-xl cteditor-border cteditor-border-foreground/10 cteditor-bg-accent cteditor-p-1`,children:Array.from({length:(t.count??2)-1},(e,t)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>C(t),className:`cteditor-border-0 cteditor-bg-transparent cteditor-block cteditor-w-full cteditor-whitespace-nowrap cteditor-rounded-sm cteditor-px-2 cteditor-py-1 cteditor-text-left cteditor-text-xs cteditor-text-foreground hover:cteditor-bg-foreground/10`,children:[`Merge cols `,t+1,` & `,t+2]},t))})]}),(0,X.jsxs)(`button`,{type:`button`,title:`Split the merged column back into two`,disabled:!t.hasWide,onClick:()=>S(Czt),className:`cteditor-border-0 cteditor-flex cteditor-bg-transparent cteditor-rounded-md cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-h-[30px] cteditor-px-2 cteditor-text-xs cteditor-font-medium cteditor-gap-1 cteditor-text-foreground/70 hover:cteditor-bg-foreground/5 hover:cteditor-text-foreground disabled:cursor-not-allowed disabled:cteditor-opacity-30`,children:[(0,X.jsx)(lJt,{className:`cteditor-size-5`}),(0,X.jsx)(`span`,{children:`Split`})]})]}),(0,X.jsx)(`span`,{className:`cteditor-mx-0.5 cteditor-h-4 cteditor-w-px cteditor-bg-foreground/10`}),t.type!==`columns`&&(0,X.jsx)(`button`,{type:`button`,title:`Duplicate`,onClick:w,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-p-[2px] cteditor-bg-transparent hover:cteditor-bg-foreground/10 cteditor-text-foreground`,children:(0,X.jsx)(uUt,{size:14})}),(0,X.jsx)(`button`,{type:`button`,title:`Delete`,onClick:E,className:`cteditor-border-0 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-cursor-pointer cteditor-align-middle cteditor-items-center cteditor-justify-center cteditor-transition-colors cteditor-size-6 cteditor-p-[2px] cteditor-bg-transparent hover:cteditor-bg-red-500/10 hover:cteditor-text-red-500 cteditor-text-foreground`,children:(0,X.jsx)(T2,{size:14})})]})]}),s)},J6t=`cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-bg-accent cteditor-rounded-md cteditor-border cteditor-border-foreground/10 cteditor-p-0.5`,Y6t=`cteditor-size-7 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded cteditor-transition-colors cteditor-text-foreground`,X6t=`cteditor-bg-foreground/10`,Z6t=10,Q6t=5,$6t=10,e8t=5,t8t=[{color:`#000000`,label:`Black`},{color:`#ffff`,label:`White`},{color:`#6b7280`,label:`Gray`},{color:`#ca8a04`,label:`Yellow`},{color:`#ea580c`,label:`Orange`},{color:`#dc2626`,label:`Red`},{color:`#16a34a`,label:`Green`},{color:`#2563eb`,label:`Blue`},{color:`#9333ea`,label:`Purple`},{color:`#db2777`,label:`Pink`},{color:`#0d9488`,label:`Teal`}],n8t=[{color:`transparent`,label:`None`},{color:`#d1d5db`,label:`Gray`},{color:`#fef08a`,label:`Yellow`},{color:`#fed7aa`,label:`Orange`},{color:`#fecaca`,label:`Red`},{color:`#bbf7d0`,label:`Green`},{color:`#bfdbfe`,label:`Blue`},{color:`#e9d5ff`,label:`Purple`},{color:`#fbcfe8`,label:`Pink`},{color:`#99f6e4`,label:`Teal`}],r8t=`ct-editor-recent-highlight-colors`,i8t=({onHighlightChange:e,onTextColorChange:t,isActive:n=!1,currentHighlightColor:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{try{let e=localStorage.getItem(r8t);if(e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(typeof t[0]==`string`?s(t.map(e=>({color:e,type:`background`}))):s(t))}}catch(e){console.error(`Failed to load recent colors`,e)}},[]);let c=(0,Q.useCallback)((e,t)=>{e!==`transparent`&&s(n=>{let r=n.filter(n=>!(n.color===e&&n.type===t)),i=[{color:e,type:t},...r].slice(0,3);try{localStorage.setItem(r8t,JSON.stringify(i))}catch(e){console.error(`Failed to save recent colors`,e)}return i})},[]),l=t=>{t&&c(t,`background`),e(t)},u=e=>{e&&c(e,`text`),t?.(e)},d=({color:e,label:t,onClick:n,showX:r=!1,children:i})=>(0,X.jsxs)(`button`,{type:`button`,className:`cteditor-w-5 cteditor-h-5 cteditor-rounded cteditor-border cteditor-border-foreground/20 hover:cteditor-scale-110 cteditor-transition-transform cteditor-flex cteditor-items-center cteditor-justify-center`,style:{backgroundColor:e===`transparent`?`transparent`:e},onClick:n,title:t,children:[r&&(0,X.jsx)(k2,{className:`!cteditor-size-3.5 cteditor-text-foreground/50`}),i]});return(0,X.jsxs)(m8,{open:i,onOpenChange:a,modal:!1,children:[(0,X.jsx)(X3,{delayDuration:200,children:(0,X.jsxs)(Z3,{children:[(0,X.jsx)(Q3,{asChild:!0,children:(0,X.jsx)(h8,{asChild:!0,children:(0,X.jsx)(Q2,{variant:`ghost`,size:`icon-sm`,className:`cteditor-relative ${n?`cteditor-bg-foreground/10`:``}`,children:(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-[11px] cteditor-leading-none cteditor-font-semibold`,children:`A`}),(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-gap-[1px]`,children:[(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:`#000`}}),(0,X.jsx)(`div`,{className:`cteditor-w-[7px] cteditor-h-[2px] cteditor-rounded-sm`,style:{backgroundColor:r&&r!==`transparent`?r:`#ffeb3b`}})]})]})})})}),(0,X.jsx)($3,{children:`Colors`})]})}),(0,X.jsxs)(g8,{className:`cteditor-w-auto !cteditor-p-3 cteditor-border-none !cteditor-z-[99999]`,sideOffset:5,id:`floating-highlight-color-picker`,children:[o.length>0&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Recently used`}),(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-gap-1.5 [&>button]:cteditor-rounded-full`,children:o.map((e,t)=>(0,X.jsx)(d,{color:e.type===`text`?`transparent`:e.color,label:e.type===`text`?`Text: ${e.color}`:`Background: ${e.color}`,onClick:()=>e.type===`text`?u(e.color):l(e.color),children:e.type===`text`&&(0,X.jsx)(`span`,{className:`cteditor-font-bold cteditor-text-xs`,style:{color:e.color},children:`A`})},`${e.color}-${e.type}-${t}`))})]}),t&&(0,X.jsxs)(`div`,{className:`cteditor-mb-3`,children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Text color`}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-5 cteditor-gap-1.5`,children:t8t.map(({color:e,label:t})=>(0,X.jsx)(d,{color:e,label:t,onClick:()=>u(e),children:(0,X.jsx)(`span`,{className:`cteditor-font-bold cteditor-text-xs`,style:{color:e===`#000000`?`#fff`:e},children:`A`})},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`cteditor-text-xs cteditor-text-foreground/60 cteditor-mb-2`,children:`Background color`}),(0,X.jsx)(`div`,{className:`cteditor-grid cteditor-grid-cols-5 cteditor-gap-1.5`,children:n8t.map(({color:e,label:t})=>(0,X.jsx)(d,{color:e,label:t,onClick:()=>l(e===`transparent`?null:e),showX:e===`transparent`},e))})]})]})]})},j9=di(`TEXT_ENHANCE_COMMAND`),a8t=({children:e,trigger:t})=>{let[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return n&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]),(0,X.jsxs)(`div`,{ref:i,className:`cteditor-relative`,children:[(0,X.jsx)(`div`,{onClick:()=>r(!n),children:t}),n&&(0,X.jsx)(`div`,{className:`cteditor-absolute cteditor-top-full cteditor-left-0 cteditor-mt-2 cteditor-bg-dropdown cteditor-border cteditor-border-foreground/10 cteditor-text-foreground cteditor-rounded-xl ct-menu-shadow cteditor-z-50 cteditor-min-w-44 cteditor-p-1 improve-dropdown`,children:(0,X.jsx)(`div`,{className:`cteditor-flex cteditor-flex-col`,children:typeof e==`function`?e({close:()=>r(!1)}):e})})]})},M9=({children:e,onClick:t,className:n=``})=>(0,X.jsx)(`button`,{className:`cteditor-w-full cteditor-rounded-md cteditor-px-2 cteditor-py-1 cteditor-text-left cteditor-text-[13px] cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-transition-colors cteditor-duration-150 improve-dropdown-item block hover:cteditor-bg-foreground/5`+(n?` ${n}`:``),onClick:t,type:`button`,children:e}),o8t=()=>{let[e]=Gd(),{isHtmlView:t,setHtmlContent:n,setRawHtmlForApply:r,canUpdateFromEditor:i}=F0(),a=(0,Q.useRef)(``),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{t&&!c.current&&e.getEditorState().read(()=>{let t=Dd(e,null);a.current=t,r(t),n(sFt(t))}),c.current=t},[t,e,n,r]),(0,Q.useEffect)(()=>{if(t)return e.registerUpdateListener(({editorState:t,dirtyElements:c,dirtyLeaves:l})=>{if(s.current){s.current=!1;return}i&&(c.size>0||l.size>0)&&(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i&&t.read(()=>{let t=Dd(e,null);t!==a.current&&(a.current=t,r(t),n(sFt(t)))})},500))})},[e,t,n,r,i]),(0,Q.useEffect)(()=>(e._markAsHtmlUpdate=()=>{s.current=!0},()=>{delete e._markAsHtmlUpdate}),[e]),(0,Q.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),null},N9=`<div data-chart-loading="1"></div>`,s8t={SPELLING_GRAMMAR:`fix_grammar`,SIMPLIFY:`simplify`,COMPLETE_SENTENCE:`complete`,AI_RESPONSE:`general`,EMOJIFY:`emojify`,MAKE_LONGER:`make_longer`,MAKE_SHORTER:`make_shorter`,TRANSLATE:`translate`,ADJUST_TONE:`change_tone`,ENHANCE_WITH_AI:`enhance_with_ai`},P9=320,c8t=/^(---|___|\*\*\*)$/,F9=/^(#{1,6})\s$/,I9=/^(\*|-|\+)\s$/,L9=/^(\d+)[\.\)]\s$/,R9=/^\[(x|\s)?\]\s$/i,z9=/^>\s$/,l8t=/^```$/,u8t={Digit1:`h1`,Digit2:`h2`,Digit3:`h3`,Digit4:`h4`,Digit5:`h5`,Digit6:`h6`},d8t={KeyL:`left`,KeyE:`center`,KeyR:`right`,KeyJ:`justify`},f8t=8,p8t=400,B9=16,m8t=2,V9=[{id:`youtube`,label:`YouTube`,match:[`youtube.com`,`youtu.be`],tint:`cteditor-bg-red-500/12 cteditor-text-red-600 dark:cteditor-text-red-400`,accent:`cteditor-from-[#ff4d4d] cteditor-to-[#c62828]`},{id:`vimeo`,label:`Vimeo`,match:[`vimeo.com`],tint:`cteditor-bg-sky-500/12 cteditor-text-sky-700 dark:cteditor-text-sky-400`,accent:`cteditor-from-[#1ab7ea] cteditor-to-[#0d8ecf]`},{id:`loom`,label:`Loom`,match:[`loom.com`],tint:`cteditor-bg-violet-500/12 cteditor-text-violet-700 dark:cteditor-text-violet-300`,accent:`cteditor-from-[#7b61ff] cteditor-to-[#625df5]`},{id:`supercut`,label:`SuperCut`,match:[`supercut.video`],tint:`cteditor-bg-amber-500/12 cteditor-text-amber-700 dark:cteditor-text-amber-300`,accent:`cteditor-from-[#f59e0b] cteditor-to-[#d97706]`},{id:`jam`,label:`Jam`,match:[`jam.dev`],tint:`cteditor-bg-emerald-500/12 cteditor-text-emerald-700 dark:cteditor-text-emerald-300`,accent:`cteditor-from-[#10b981] cteditor-to-[#059669]`}],H9=class extends Eae{label;onSelect;enabled;featureName;planAllows;skipTriggerCleanup;newKey;constructor(e,t,n=!0,r,i=!0,a=!1,o){super(e),this.label=e,this.onSelect=t,this.enabled=n,this.featureName=r||e,this.planAllows=i,this.skipTriggerCleanup=a,this.newKey=o}},U9=!1,h8t=[`#d0021b`,`#f5a623`,`#f8e71c`,`#8b572a`,`#7ed321`,`#417505`,`#bd10e0`,`#9013fe`,`#4a90e2`,`#50e3c2`,`#b8e986`,`#000000`,`#4a4a4a`,`#9b9b9b`,`#ffffff`],g8t=24,_8t=2,v8t=[{value:`left`,label:`Left`,Icon:l3},{value:`center`,label:`Center`,Icon:u3},{value:`right`,label:`Right`,Icon:d3}],y8t=[{value:`top`,label:`Top`,Icon:Eqt},{value:`middle`,label:`Middle`,Icon:Dqt},{value:`bottom`,label:`Bottom`,Icon:Oqt}],W9=33,G9=50,b8t=80,K9=8,q9=16,J9=12,x8t=120*1e3,S8t=({licenseKey:e,syncIntervalMs:t=x8t})=>{let[n]=Gd(),r=(0,Q.useRef)({characters:0,words:0}),i=(0,Q.useRef)({characters:0,words:0}),a=(0,Q.useRef)(!1),o=(0,Q.useCallback)(async()=>{if(!e||a.current)return;let{characters:t,words:n}=i.current;if(!(t===0&&n===0)){a.current=!0;try{await B0.post(`/api/analytics/track-usage`,{licenseKey:e,characters:t,words:n}),i.current={characters:0,words:0}}catch(e){console.error(`Failed to sync usage stats:`,e)}finally{a.current=!1}}},[e]);return(0,Q.useEffect)(()=>{if(!e)return;let a=n.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=Yi().getTextContent(),t=e.trim().split(/\s+/).filter(e=>e.length>0).length,n=e.replace(/\s/g,``).length,a=Math.max(0,n-r.current.characters),o=Math.max(0,t-r.current.words);r.current={characters:n,words:t},(a>0||o>0)&&(i.current.characters+=a,i.current.words+=o)})}),s=setInterval(o,t),c=()=>{let{characters:t,words:n}=i.current;if(t>0||n>0){let r=JSON.stringify({licenseKey:e,characters:t,words:n}),i=B0.defaults.baseURL||``;navigator.sendBeacon(`${i}/api/analytics/track-usage`,new Blob([r],{type:`application/json`}))}},l=()=>{document.visibilityState===`hidden`&&o()};return window.addEventListener(`beforeunload`,c),document.addEventListener(`visibilitychange`,l),()=>{a(),clearInterval(s),o(),window.removeEventListener(`beforeunload`,c),document.removeEventListener(`visibilitychange`,l)}},[n,e,o,t]),null},C8t=di(`INSERT_VIDEO_COMMAND`),w8t=({captionsEnabled:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>{if(!t.hasNodes([D8]))throw Error(`VideoPlugin: VideoNode not registered on editor`);return Gu(t.registerCommand(C8t,t=>{let n=R1({...t,captionsEnabled:e});return xs([n]),ja(n.getParentOrThrow())&&Qu(n,Qs).selectEnd(),!0},0))},[e,t]),null},T8t=({size:e=14,className:t=``})=>(0,X.jsx)(`img`,{src:ajt(`LogoIcon.svg`),alt:`eddyter`,width:e,height:e,className:`cteditor-invert dark:cteditor-invert-0 ${t}`.trim(),loading:`eager`}),E8t=({isWordCountEnabled:e,fitToPage:t,enableFeatureSuggestion:n=!0,enableBugReport:r=!0})=>{let i=Gd()[0],a=K0()?.hideBranding??!1,[o,s]=(0,Q.useState)({words:0,characters:0}),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>i.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=Yi().getTextContent(),t=e.trim().split(/\s+/).filter(e=>e.length>0).length,n=e.replace(/\s/g,``).length;s({words:t,characters:n})})}),[i]);let f=`cteditor-pointer-events-auto cteditor-inline-flex cteditor-items-center cteditor-gap-1.5 cteditor-cursor-pointer cteditor-text-foreground/60 hover:cteditor-text-foreground cteditor-transition-colors [&>svg]:cteditor-size-3.5 cteditor-px-1 cteditor-py-1.5 max-sm:cteditor-hidden`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`wordCount cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-text-xs cteditor-text-foreground/70 cteditor-py-1 cteditor-px-3 cteditor-z-[5] cteditor-pointer-events-none ${t?`cteditor-fixed cteditor-bottom-2 cteditor-inset-x-0`:`cteditor-absolute cteditor-bottom-0 cteditor-inset-x-0`}`,children:[e&&(0,X.jsxs)(`div`,{className:`cteditor-flex cteditor-items-center cteditor-gap-3`,children:[(0,X.jsxs)(`span`,{children:[`Words: `,(0,X.jsx)(`b`,{className:`cteditor-font-semibold cteditor-tabular-nums`,children:o.words})]}),(0,X.jsxs)(`span`,{children:[`Characters:`,` `,(0,X.jsx)(`b`,{className:`cteditor-font-semibold cteditor-tabular-nums`,children:o.characters})]})]}),(0,X.jsx)(`div`,{className:`cteditor-flex-1`}),n&&(0,X.jsxs)(`button`,{type:`button`,className:f,onClick:()=>l(!0),children:[(0,X.jsx)(v2,{size:12}),`Suggest a Feature`]}),r&&(0,X.jsxs)(`button`,{type:`button`,className:f,onClick:()=>d(!0),children:[(0,X.jsx)(a2,{size:12}),`Report a Bug`]}),!a&&(0,X.jsxs)(`span`,{className:`cteditor-inline-flex cteditor-items-center cteditor-gap-1.5`,children:[(0,X.jsx)(T8t,{size:14,className:`cteditor-shrink-0`}),(0,X.jsx)(`span`,{className:`cteditor-font-medium cteditor-text-foreground/80`,children:`eddyter`})]}),(0,X.jsxs)(`span`,{className:`cteditor-text-[10px] cteditor-text-muted-foreground cteditor-font-mono`,children:[`v`,`1.4.21-beta.0`]})]}),n&&(0,X.jsx)($Rt,{open:c,onOpenChange:l}),r&&(0,X.jsx)(XRt,{open:u,onOpenChange:d})]})},D8t=({minHeight:e=150,maxHeight:t=null,transitionDuration:n=200}={})=>{let[r,i]=(0,Q.useState)(e),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let n=a.current;if(!n)return;let s=()=>{let a=n.scrollHeight,o=Math.max(e,Math.min(t??1/0,a));o!==r&&i(o)};s(),window.ResizeObserver&&(o.current=new ResizeObserver(()=>{s()}),o.current.observe(n));let c=new MutationObserver(()=>{s(),n.querySelectorAll(`img`).forEach(e=>{e.addEventListener(`load`,s,{once:!0})})});c.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let l=()=>s();return n.addEventListener(`input`,l),n.addEventListener(`load`,s,!0),()=>{o.current&&o.current.disconnect(),c.disconnect(),n.removeEventListener(`input`,l),n.removeEventListener(`load`,s,!0)}},[e,t,r]),{height:r,contentRef:a,style:{height:`${r}px`,transition:`height ${n}ms ease-in-out`,overflow:`auto`}}},O8t=()=>({contentEditable:k$(`cteditor-relative cteditor-min-h-[300px] cteditor-rounded-xl !cteditor-h-auto cteditor-resize-none !cteditor-outline-none cteditor-content cteditor-pt-5 cteditor-pb-12 cteditor-px-7`,`cteditor-text-foreground cteditor-border cteditor-border-foreground/10 cteditor-bg-card-content`,`cteditor-font-geist cteditor-text-base`,`cteditor-caret-[#3b82f6] cteditor-p-0 cteditor-transition-all cteditor-duration-200`,`cteditor-w-full `,`[&>hr]:cteditor-border-none [&>hr]:cteditor-h-[2px]`),placeholder:k$(`cteditor-absolute cteditor-top-7 cteditor-left-7 cteditor-text-sm cteditor-opacity-50`,`cteditor-overflow-hidden cteditor-text-ellipsis md:cteditor-whitespace-nowrap cteditor-max-w-[calc(100%-1.5rem)]`,`cteditor-select-none cteditor-pointer-events-none cteditor-inline-block`)}),k8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(JOt(),HOt))),A8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(rkt(),XOt))),j8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(hAt(),ikt))),M8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(yAt(),gAt))),N8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(wAt(),bAt))),P8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(NAt(),TAt))),F8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(YAt(),PAt))),I8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>($At(),XAt))),L8t=(0,Q.lazy)(()=>Promise.resolve().then(()=>(ijt(),ejt))),R8t=e=>{let[t]=Gd();return(0,X.jsx)(D6t,{...e,editor:t,activeEditor:t,setActiveEditor:e=>{}})},z8t=()=>{let{toolbarState:e}=$8();return!e.isAutocompleteEnabled&&!e.isGrammarCheckEnabled?null:(0,X.jsx)(Q.Suspense,{fallback:null,children:(0,X.jsx)(j8t,{minMatchLength:2,maxSuggestions:10,enableAI:e?.isAutocompleteEnabled??!0})})},B8t=({enabled:e})=>{let{updateToolbarState:t}=$8();return(0,Q.useEffect)(()=>{t(`isInlineAutocompleteEnabled`,!1)},[t]),null},V8t=({onChange:e,immediateExportRef:t,suppressRef:n})=>{let[r]=Gd(),i=(0,Q.useRef)(e),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{i.current=e},[e]);let o=(0,Q.useCallback)(()=>{if(!i.current||n?.current)return;let e=l0(r);i.current(e)},[r,n]),s=(0,Q.useCallback)(()=>{i.current&&(a.current&&clearTimeout(a.current),a.current=setTimeout(o,300))},[r,o]);return(0,Q.useEffect)(()=>{if(t)return t.current=()=>{a.current&&=(clearTimeout(a.current),null),o()},()=>{t.current=null}},[t,o]),(0,Q.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,X.jsx)(_f,{onChange:s,ignoreHistoryMergeTagChange:!1})},H8t=({immediateExportRef:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand(o6,()=>(e.current?.(),!0),0),[t,e]),null},U8t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{let t=e.getRootElement()?.closest(`.eddyter-scope`)??null;if(!t)return;let n=new MutationObserver(()=>{e.dispatchCommand(o6,void 0)});return n.observe(t,{attributes:!0,attributeFilter:[`class`]}),()=>n.disconnect()},[e]),null},W8t=({onOpen:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand(F6t,()=>(e(),!0),1),[t,e]),null},G8t=({onOpen:e})=>{let[t]=Gd();return(0,Q.useEffect)(()=>t.registerCommand($Yt,()=>(e(),!0),1),[t,e]),null},K8t=`p, h1, h2, h3, h4, h5, h6, li, blockquote`,q8t=({initialContent:e})=>{let[t]=Gd(),[n,r]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(n||!e)return;r(!0);let i=gRt(e);t.update(()=>{let e=new DOMParser().parseFromString(i,`text/html`),n=nHt(e.body),r=Ed(t,e);rHt(r,n);let a=Yi();a.clear();let o=[],s=[],c=()=>{if(s.length>0){let e=Qs();e.append(...s),o.push(e),s=[]}};for(let e of r)Ws(e)||Ks(e)?(c(),o.push(e)):s.push(e);c(),a.append(...o);for(let e of a.getAllTextNodes()){let t=e.getStyle();if(!t)continue;let n=QVt(t);n!==null&&(iHt(e)||e.setStyle(n))}let l=[],u=[],d=[],f=e=>{if(!e.startsWith(`__EDDYTER_CHART__`))return null;let t=e.slice(17).split(`::`);if(t.length!==2&&t.length!==4)return null;try{let e=decodeURIComponent(t[0]);if(!e)return null;let n,r=decodeURIComponent(t[1]);if(r)try{n=JSON.parse(r)}catch{n=void 0}let i,a;if(t.length===4){let e=Number(decodeURIComponent(t[2])),n=Number(decodeURIComponent(t[3]));i=Number.isFinite(e)&&e>0?e:void 0,a=Number.isFinite(n)&&n>0?n:void 0}return{html:e,metadata:n,width:i,height:a}}catch{return null}},p=e=>{if(!e.startsWith(`__EDDYTER_EMBED__`))return null;let t=e.slice(17).split(`::`);if(t.length<2)return null;let n=t[0]?.toLowerCase(),r=t[1]||``,i=n===`url`||n===`card`||n===`embed`?n:`embed`,a=t[2]?.toLowerCase(),o=t[3]?.toLowerCase(),s=Number(t[4]),c=Number(t[5]),l=a===`center`||a===`right`?a:`left`,u=o===`left`||o===`right`?o:`none`,d=Number.isFinite(s)&&s>0?s:560,f=Number.isFinite(c)&&c>0?c:315;try{let e=decodeURIComponent(r);return e?{url:e,displayType:i,alignment:l,position:u,width:d,height:f}:null}catch{return null}},m=e=>{if(!e.startsWith(`__EDDYTER_FILE__`))return null;let t=e.slice(16).split(`::`);if(t.length<3)return null;let n=t[0]?.toLowerCase(),r=t[1]||``,i=t[2]||``,a=Number(t[3]),o=n===`inline`?`inline`:`card`;try{let e=decodeURIComponent(r),t=decodeURIComponent(i);return!e||!t?null:{src:e,fileName:t,fileSize:Number.isFinite(a)&&a>0?a:void 0,displayType:o}}catch{return null}},h=e=>{let t=e.trim();if(!t)return null;try{let e=new URL(t),n=e.hostname.toLowerCase(),r=e.pathname;if(n.includes(`youtube.com`)){let t=e.searchParams.get(`v`);if(t)return`https://www.youtube.com/watch?v=${t}`;let n=r.match(/\/embed\/([a-zA-Z0-9_-]+)/i);if(n?.[1])return`https://www.youtube.com/watch?v=${n[1]}`}if(n.includes(`youtu.be`)){let e=r.split(`/`).filter(Boolean)[0];if(e)return`https://www.youtube.com/watch?v=${e}`}if(n.includes(`vimeo.com`)){let e=r.match(/\/video\/(\d+)/i);if(e?.[1])return`https://vimeo.com/${e[1]}`;let t=r.match(/\/(\d+)(?:\/)?$/);if(t?.[1])return`https://vimeo.com/${t[1]}`}if(n.includes(`loom.com`)){let e=r.match(/\/share\/([a-zA-Z0-9_-]+)/i);if(e?.[1])return`https://www.loom.com/share/${e[1]}`;let t=r.match(/\/embed\/([a-zA-Z0-9_-]+)/i);if(t?.[1])return`https://www.loom.com/share/${t[1]}`}if(n.includes(`supercut.video`)){let e=r.match(/\/embed\/([^/]+)\/([^/?#]+)/i);if(e?.[1]&&e?.[2])return`https://supercut.video/${e[1]}/${e[2]}`;let t=r.split(`/`).filter(Boolean);if(t.length>=2)return`https://supercut.video/${t[0]}/${t[1]}`}if(n.includes(`jam.dev`)){let e=r.match(/\/video\/([^/?#]+)/i);if(e?.[1])return`https://jam.dev/c/${e[1]}`;let t=r.match(/\/c\/([^/?#]+)/i);if(t?.[1])return`https://jam.dev/c/${t[1]}`}if(n.includes(`figma.com`)){if(r.includes(`/embed`)){let t=e.searchParams.get(`url`);if(t)return t}return t}}catch{return null}return null},g=e=>{if($s(e)){let t=e.getTextContent().trim(),n=f(t);if(n){let t=e.getParent();if(t&&Vf(t))return;d.push({node:e,html:n.html,metadata:n.metadata,width:n.width,height:n.height});return}let r=p(t);if(r){let t=e.getParent();if(t&&Vf(t))return;l.push({node:e,url:r.url,displayType:r.displayType,alignment:r.alignment,position:r.position,width:r.width,height:r.height});return}let i=m(t);if(i){let t=e.getParent();if(t&&Vf(t))return;u.push({node:e,src:i.src,fileName:i.fileName,fileSize:i.fileSize,displayType:i.displayType});return}let a=h(t);if(!a)return;let o=e.getParent();if(o&&Vf(o))return;let s=a.toLowerCase().includes(`figma.com`)?`card`:`embed`;l.push({node:e,url:a,displayType:s,alignment:`left`,position:`none`,width:560,height:315});return}if(Jo(e)){let t=e.getTextContent().trim(),n=m(t),r=p(t);if(!n&&!r)return;let i=e.getParent();if(!i||Vf(i))return;Nd(i)&&(n?u.push({node:e,src:n.src,fileName:n.fileName,fileSize:n.fileSize,displayType:n.displayType}):r&&l.push({node:e,url:r.url,displayType:r.displayType,alignment:r.alignment,position:r.position,width:r.width,height:r.height}));return}if(Ws(e)){e.getChildren().forEach(g);return}};a.getChildren().forEach(g),l.forEach(({node:e,url:t,displayType:n,alignment:r,position:i,width:a,height:o})=>{let s=f1(t,n,r,a,o,i);if(Jo(e)&&Nd(e.getParent())){let t=Qs();t.append(s),e.replace(t);return}e.replace(s)}),u.forEach(({node:e,src:t,fileName:n,fileSize:r,displayType:i})=>{let a=E1({src:t,fileName:n,fileSize:r,displayType:i});if(Jo(e)&&Nd(e.getParent())){let t=Qs();e.replace(t),t.append(a);return}e.replace(a)}),d.forEach(({node:e,html:t,metadata:n,width:r,height:i})=>{let a=t;if(n)try{a=M1(n)}catch{}let o=N1(a,n,r,i);if(Jo(e)&&Nd(e.getParent())){let t=Qs();e.replace(t),t.append(o);return}e.replace(o)}),a.getChildren().forEach(t=>{if(Sp(t)){let n=t.getChildren();if(n.length>0){let t=n[0];if(Uf(t)){let n=t.getChildren(),r=!1;e.querySelectorAll(`table`).forEach(e=>{let t=e.querySelector(`tr`);t&&t.querySelectorAll(`th`).length>0&&(r=!0)}),r&&n.forEach(e=>{Vf(e)&&e.setHeaderStyles(wp.COLUMN)})}}}}),a.selectEnd()}),requestAnimationFrame(()=>{let e=t.getRootElement();if(!e)return;let n=new DOMParser().parseFromString(i,`text/html`).querySelectorAll(`table`),r=e.querySelectorAll(`table`);r.forEach((e,t)=>{let r=n[t];if(!r)return;let i=r.style.getPropertyValue(`--table-odd-striping-color`),a=r.style.getPropertyValue(`--table-even-striping-color`),o=r.style.getPropertyValue(`--table-header-bg-color`),s=r.style.getPropertyValue(`--table-border-color`),c=r.style.getPropertyValue(`--table-border-size`),l=r.classList.contains(`has-header-row`),u=r.classList.contains(`table-custom-border`),d=r.classList.contains(`table-border-none`)||r.getAttribute(`data-border-none`)===`true`,f=e.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`)||e,p=e=>{if(!e)return``;if(e=e.trim().toLowerCase(),e.startsWith(`#`))return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e;if(e.includes(`rgb`)){let t=e.match(/\d+/g);if(t&&t.length>=3){let e=parseInt(t[0]),n=parseInt(t[1]),r=parseInt(t[2]);return`#${e.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}return e},m=p(i),h=p(a),g=Array.from(r.querySelectorAll(`tr`)),_=Array.from(e.querySelectorAll(`tr`));if(g.forEach((e,t)=>{let n=_[t];if(!n)return;let r=e.querySelectorAll(`td, th`),i=n.querySelectorAll(`td, th`);r.length===i.length&&r.forEach((e,t)=>{let n=i[t];if(!n)return;let r=e,a=r.style.backgroundColor,o=r.style.color;a&&n.style.setProperty(`background-color`,a,`important`),o&&n.style.setProperty(`color`,o,`important`)})}),i||a){let t=Array.from(e.querySelectorAll(`tr`));(l?t.slice(1):t).forEach(e=>{e.querySelectorAll(`td`).forEach(e=>{let t=e,n=t.style.backgroundColor,r=p(n);(r===m||r===h||!n)&&(t.style.removeProperty(`background-color`),t.style.removeProperty(`color`),e.querySelectorAll(`*`).forEach(e=>{e.style.removeProperty(`color`)}))})})}i&&(f.style.setProperty(`--table-odd-striping-color`,i),f.classList.add(`table-custom-odd-striping`)),a&&(f.style.setProperty(`--table-even-striping-color`,a),f.classList.add(`table-custom-even-striping`)),o&&(f.style.setProperty(`--table-header-bg-color`,o),e.style.setProperty(`--table-header-bg-color`,o)),(u||s||c)&&(f.classList.add(`table-custom-border`),e.classList.add(`table-custom-border`)),s&&(f.style.setProperty(`--table-border-color`,s),e.style.setProperty(`--table-border-color`,s)),c&&(f.style.setProperty(`--table-border-size`,c),e.style.setProperty(`--table-border-size`,c)),d?(f.classList.add(`table-border-none`),e.classList.add(`table-border-none`),e.setAttribute(`data-border-none`,`true`)):(f.classList.remove(`table-border-none`),e.classList.remove(`table-border-none`),e.removeAttribute(`data-border-none`)),l&&f.classList.add(`has-header-row`)});let a=QLt();if(a&&a.length>0&&r.length===a.length){let e=eRt(t);e.forEach((e,t)=>{XLt(e,a[t]!==!1)}),r.forEach((n,r)=>{let i=a[r]!==!1,o=n;o.setAttribute(`data-table-full-width`,i?`true`:`false`),i?(o.style.setProperty(`width`,`100%`,`important`),o.style.setProperty(`max-width`,`100%`,`important`),o.style.setProperty(`min-width`,`0`,`important`)):(o.style.removeProperty(`width`),o.style.removeProperty(`max-width`),o.style.removeProperty(`min-width`)),t.getEditorState().read(()=>{let a=Ui(e[r]);if(Sp(a)){let e=o.querySelector(`colgroup`),r=a.getColumnCount();if(e&&r>0){let s=e.querySelectorAll(`col`);if(i){let e=n.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`),i=t.getRootElement(),a=(e??i)?.clientWidth??0,c=Math.max(0,a-24);if(c>0){let e=Math.floor(c/r);o.style.setProperty(`width`,`${c}px`,`important`),s.forEach(t=>{t.style.setProperty(`width`,`${e}px`,`important`)})}else{let e=100/r;s.forEach(t=>{t.style.setProperty(`width`,`${e}%`,`important`)})}}else{let e=a.getColWidths();s.forEach((t,n)=>{let r=e?.[n],i=t;r==null?i.style.removeProperty(`width`):i.style.setProperty(`width`,`${r}px`,`important`)})}}}});let s=n.closest(`.PlaygroundEditorTheme__tableScrollableWrapper`);s&&(i?(s.classList.add(`table-full-width-active`),s.style.setProperty(`width`,`100%`,`important`),s.style.setProperty(`max-width`,`100%`,`important`),s.style.setProperty(`overflow-x`,`hidden`,`important`)):(s.classList.remove(`table-full-width-active`),s.style.removeProperty(`width`),s.style.removeProperty(`max-width`),s.style.removeProperty(`overflow-x`)))})}})},[t,e,n]),null},J8t=()=>{let[e]=Gd();return(0,Q.useEffect)(()=>{let t=()=>{let t=e.getRootElement();t&&e.getEditorState().read(()=>{t.querySelectorAll(`table`).forEach(e=>{e.querySelectorAll(`td, th`).forEach(e=>{let t=e,n=Object.keys(t).find(e=>e.startsWith(`__reactProps`))?t.__lexicalKey:void 0;if(n)try{let e=Ui(n);if(Vf(e)){let n=e.getBackgroundColor();if(n){let r=n.replace(`#`,``),i=parseInt(r.substr(0,2),16),a=parseInt(r.substr(2,2),16),o=parseInt(r.substr(4,2),16),s=(.299*i+.587*a+.114*o)/255>.5?`#000000`:`#FFFFFF`;t.style.setProperty(`background-color`,n,`important`),t.style.setProperty(`color`,s,`important`),t.style.setProperty(`border-color`,`#bbb`,`important`),t.querySelectorAll(`*`).forEach(e=>{e instanceof HTMLElement&&e.style.setProperty(`color`,s,`important`)}),e.getHeaderStyles()&&t.style.setProperty(`font-weight`,`600`,`important`)}}}catch{}})})})},n=e.registerUpdateListener(()=>{requestAnimationFrame(t)});return t(),()=>{n()}},[e]),null},Y8t=({config:e,defaultFontFamilies:t,mentionUserList:n,currentUser:r,initialContent:i,onChange:a,apiKey:o,toolbarConfig:s,contentClassName:c,editorStyle:l,floatingToolbarClassName:u,fitToPage:d=!1,documentId:f=null,documentIdIsFallback:p=!1,saveVersionApiRef:m})=>{let h=K0();h?.isPaidPlan;let g=!h?.isByokPlan||!!(h?.byokApiKeys?.hasOpenaiKey||h?.byokApiKeys?.hasAnthropicKey||h?.byokApiKeys?.hasGrokKey||h?.byokApiKeys?.hasGeminiKey),_=e.toolbarOptions.enableInlineAutocompleteToggle!==!1&&g,v={mode:s?.mode??(d?`static`:`sticky`),offset:typeof s?.offset==`number`?s.offset:20,zIndex:typeof s?.zIndex==`number`?s.zIndex:1e3},y=(0,Q.useRef)(null),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(null),S=O8t(),[C,w]=(0,Q.useState)(!1),{contentRef:T,style:E}=D8t({minHeight:150,maxHeight:typeof l?.maxHeight==`number`?l.maxHeight:void 0,transitionDuration:200}),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[ee,L]=(0,Q.useState)(0),[te,R]=(0,Q.useState)(!1),ne=e.toolbarOptions.enableVersionHistory!==!1,re=ne&&!!o,ie=(0,Q.useRef)(null),ae=m??ie,z=e=>{e!==null&&M(e)};return(0,Q.useEffect)(()=>{let e=()=>{let e=Iee&&window.matchMedia(`(max-width: 1025px)`).matches;e!==N&&P(e)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[N]),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(JUt,{currentUser:r,mentionUserList:n,children:(0,X.jsxs)(sne,{initialConfig:{...X8},children:[(0,X.jsx)(W8t,{onOpen:()=>I(!0)}),re&&(0,X.jsx)(G8t,{onOpen:()=>R(!0)}),(0,X.jsx)(YLt,{children:(0,X.jsx)(lHt,{children:(0,X.jsxs)(E$t,{children:[(0,X.jsxs)(`div`,{className:`main-container cteditor-flex cteditor-flex-col`,ref:x,children:[e.enableToolbar&&(0,X.jsx)(Vzt,{editorRef:x,mode:v.mode,topOffset:v.offset,zIndex:v.zIndex,floatingToolbarClassName:u,className:d?`cteditor-sticky cteditor-top-0 cteditor-z-50 `:``,children:(0,X.jsxs)(`div`,{className:`toolbar-content cteditor-flex cteditor-justify-between cteditor-items-center`,children:[(0,X.jsx)(R8t,{fitToPage:d,editable:!0,...e.toolbarOptions,fonts:t,isCommentOpen:F,onToggleComment:()=>I(!F),commentCount:ee}),re?(0,X.jsx)(ZYt,{fitToPage:d,isOpen:te,onClick:()=>R(!te)}):ne?null:(0,X.jsx)(r6,{isEnabled:!1,planAllows:!1,featureName:`Version History`,variant:`overlay`,children:(0,X.jsx)(ZYt,{fitToPage:d,isOpen:!1,onClick:()=>{}})})]})}),(0,X.jsxs)(`div`,{className:e.enableToolbar?`cteditor-relative editor-area cteditor-pt-1.5 ${d?`cteditor-text-foreground`:``}`.trim():`cteditor-relative ${d?`cteditor-text-foreground`:``}`.trim(),children:[(0,X.jsx)(Are,{contentEditable:(0,X.jsx)(`div`,{className:`editor-scroller`,children:(0,X.jsx)(`div`,{ref:z,className:`editor-anchor`,children:(0,X.jsx)($d,{ref:T,className:`eddyter-content-root ${S.contentEditable} ${c||``} ${d?` !cteditor-bg-transparent !cteditor-text-foreground !cteditor-border-none`:``}`.trim(),style:{tabSize:1,...E,...l}})})}),placeholder:(0,X.jsx)(OXt,{className:S.placeholder,children:(0,X.jsx)(OHt,{})}),ErrorBoundary:Ene}),(0,X.jsx)(E8t,{isWordCountEnabled:e.toolbarOptions.enableWordCount,fitToPage:d,enableFeatureSuggestion:e.toolbarOptions.enableFeatureSuggestion!==!1,enableBugReport:e.toolbarOptions.enableBugReport!==!1}),(0,X.jsx)(S8t,{licenseKey:o})]})]}),(0,X.jsxs)(Q.Suspense,{fallback:null,children:[e.toolbarOptions.enableMentions!==!1&&(0,X.jsx)(F8t,{userList:n}),e.toolbarOptions.enableNotePanels!==!1&&(0,X.jsx)(I8t,{}),e.toolbarOptions.enableComments===!0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N8t,{}),(0,X.jsx)(M8t,{})]})]}),(0,X.jsx)(J8t,{}),(0,X.jsx)(B8t,{enabled:_}),_&&(0,X.jsx)(PBt,{apiKey:o,debounceDelay:e.inlineAutocompleteOptions?.debounceDelay??400,minContextLength:e.inlineAutocompleteOptions?.minContextLength??10}),e.htmlViewOption===!0&&(0,X.jsx)(DXt,{}),e.toolbarOptions.enableAIChat===!0&&(0,X.jsxs)(Q.Suspense,{fallback:null,children:[(0,X.jsx)(k8t,{}),(0,X.jsx)(A8t,{apiKey:o}),(0,X.jsx)(L8t,{apiKey:o})]}),(0,X.jsx)(o8t,{}),re&&o&&(0,X.jsx)(ZNt,{apiKey:o,documentId:f,saveVersionApiRef:ae}),(0,X.jsx)(y3t,{}),(0,X.jsx)(Hzt,{}),e.toolbarOptions.enableCodeFormat!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j6t,{}),(0,X.jsx)(Wzt,{}),(0,X.jsx)(Gzt,{})]}),(0,X.jsx)(xVt,{}),(0,X.jsx)(iVt,{options:{headings:e.toolbarOptions.enableHeadings!==!1,lists:e.toolbarOptions.enableLists!==!1,blockquote:e.toolbarOptions.enableBlockquote!==!1,codeBlock:e.toolbarOptions.enableCodeFormat!==!1,todoList:e.toolbarOptions.enableTodoList!==!1,alignment:e.toolbarOptions.enableAlignment!==!1,links:e.toolbarOptions.enableLinks!==!1,horizontalRule:e.toolbarOptions.enableHorizontalLine!==!1,table:e.toolbarOptions.enableTableOptions!==!1,aiChat:e.toolbarOptions.enableAIChat!==!1,clearFormatting:e.toolbarOptions.enableClearOptions!==!1,fontSize:e.toolbarOptions.enableFontControls!==!1}}),(0,X.jsx)(H3t,{}),(0,X.jsx)(q6t,{}),(e.toolbarOptions.enableColumns!==!1||e.toolbarOptions.enableButtonBlock!==!1)&&(0,X.jsx)(K3t,{}),e.toolbarOptions.enableColumns!==!1&&(0,X.jsx)(M6t,{anchorElem:j??void 0}),e.toolbarOptions.enablePatterns!==!1&&(0,X.jsx)(Y3t,{}),(0,X.jsx)(W3t,{}),(0,X.jsx)(qBt,{}),e.toolbarOptions.enableAutoCorrection!==!1&&(0,X.jsx)(z8t,{}),(0,X.jsx)(V8t,{onChange:a,immediateExportRef:y,suppressRef:b}),(0,X.jsx)(H8t,{immediateExportRef:y}),(0,X.jsx)(U8t,{}),(0,X.jsx)(q8t,{initialContent:i}),(0,X.jsx)(sf,{}),(0,X.jsx)(E9,{namespace:X8.namespace}),e.toolbarOptions.enableLists!==!1&&(0,X.jsx)(Xne,{}),e.toolbarOptions.enableLinks!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(FBt,{hasLinkAttributes:!1}),(0,X.jsx)(IBt,{apiKey:o})]}),(0,X.jsx)(iBt,{}),(0,X.jsx)(oBt,{}),(0,X.jsx)(rFt,{}),(0,X.jsx)(pVt,{}),e.toolbarOptions.enableFileAttachments!==!1&&(0,X.jsx)(O3t,{}),e.toolbarOptions.enableHorizontalLine!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(qne,{}),(0,X.jsx)(VQt,{}),(0,X.jsx)(KQt,{})]}),e.toolbarOptions.enableTodoList!==!1&&(0,X.jsx)($te,{}),(e.toolbarOptions.enableImageUpload!==!1||e.toolbarOptions.enableImageOptions!==!1)&&(0,X.jsx)(S3t,{}),(0,X.jsx)(w8t,{captionsEnabled:!0}),e.toolbarOptions.enableSignature!==!1&&(0,X.jsx)(GLt,{}),e.toolbarOptions.enableTableOptions!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tie,{hasCellMerge:!0,hasCellBackgroundColor:!0,hasHorizontalScroll:!0}),(0,X.jsx)(qVt,{}),(0,X.jsx)(HVt,{})]}),e.toolbarOptions.enableEmbeds!==!1&&(0,X.jsx)(Q.Suspense,{fallback:null,children:(0,X.jsx)(P8t,{floatingAnchorElem:j??void 0})}),j&&(0,X.jsxs)(X.Fragment,{children:[e.toolbarOptions.enableDragHandle!==!1&&(0,X.jsx)(cBt,{anchorElem:j}),e.toolbarOptions.enableTableOptions!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(BVt,{anchorElem:j,cellMerge:!0,isSmallWidthViewport:N}),(0,X.jsx)(KVt,{anchorElem:j})]}),e.toolbarOptions.enableCodeFormat!==!1&&(0,X.jsx)(Rjt,{anchorElem:j}),e.toolbarOptions.enableLinks!==!1&&(0,X.jsx)(vBt,{anchorElem:j,isLinkEditMode:C,setIsLinkEditMode:w}),e.enableFloatingMenu&&(0,X.jsx)(wBt,{anchorElem:j,setIsLinkEditMode:w,features:e.floatingMenuOptions}),e.toolbarOptions.enableFileAttachments!==!1&&(0,X.jsx)(mBt,{anchorElem:j})]})]})})}),(0,X.jsx)(eqt,{isOpen:F,onClose:()=>I(!1),onCommentCountChange:L}),re&&o&&(0,X.jsx)(YYt,{isOpen:te,onClose:()=>R(!1),apiKey:o,documentId:f,documentIdIsFallback:p,suppressExportRef:b,boundsRef:x})]})})})},X8t=new Set([`Arial`,`Courier New`,`Georgia`,`Times New Roman`,`Verdana`,`Comic Sans MS`,`Tahoma`,`Helvetica`]),Z8t={Geist:`Geist:wght@400;500;600;700`,Poppins:`Poppins:wght@400;500;700`,Inter:`Inter:wght@400;500;700`,"DM Sans":`DM+Sans:wght@400;500;700`,Manrope:`Manrope:wght@400;500;700`,"Plus Jakarta Sans":`Plus+Jakarta+Sans:wght@400;500;700`,"Public Sans":`Public+Sans:wght@400;500;700`,Montserrat:`Montserrat:wght@400;500;700`,Raleway:`Raleway:wght@400;500;700`,Lora:`Lora:wght@400;500;700`,Merriweather:`Merriweather:wght@300;400;700;900`,"Playfair Display":`Playfair+Display:wght@400;500;700`,"Libre Baskerville":`Libre+Baskerville:wght@400;700`,"JetBrains Mono":`JetBrains+Mono:wght@400;500;700`,"Fira Code":`Fira+Code:wght@400;500;700`,"Bebas Neue":`Bebas+Neue`},Y9=!1,X9=({children:e,className:t=``,style:n,darkMode:r,floatingToolbarClassName:i=``})=>{let a=(0,Q.useSyncExternalStore)(sHt,oHt,()=>!1),o=r===void 0?a:r,[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{l.current&&c(l.current),aHt(q0.defaultFontFamilies)},[]),(0,X.jsx)(GKt,{value:{isDark:o},children:(0,X.jsx)(IKt,{value:{container:s},children:(0,X.jsxs)(`div`,{id:`ct-editor-f47ac10b`,className:`eddyter-scope cteditor-relative cteditor-w-full cteditor-max-w-full ${o?`dark cteditor-dark`:``} ${t}`.trim(),style:n,children:[e,(0,X.jsx)(`div`,{ref:l,id:`eddyter-portal-container`,className:`eddyter-scope cteditor-relative`})]})})})},vjt(),Q8t=async e=>{try{await B0.post(`/api/analytics/editor-load`,{licenseKey:e})}catch{}},Z9=`cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-3 cteditor-min-h-[200px] cteditor-p-5 cteditor-rounded-lg cteditor-text-sm cteditor-font-medium`,$8t=`${Z9} cteditor-border-main-secondary cteditor-bg-background`,e5t=`${Z9} cteditor-bg-red-50 cteditor-text-red-600 cteditor-border cteditor-border-red-200 dark:cteditor-bg-red-950/50 dark:cteditor-text-red-400 dark:cteditor-border-red-900/50`,t5t=`${Z9} cteditor-bg-background cteditor-border cteditor-border-main-secondary`,Q9=({size:e=28,className:t=``,animation:n})=>(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:32.833/30.67*e,viewBox:`0 0 30.670 32.833`,fill:`none`,className:t,"aria-hidden":`true`,children:[n===`pulse`&&(0,X.jsx)(`animate`,{attributeName:`opacity`,values:`1;0.35;1`,dur:`2s`,repeatCount:`indefinite`}),(0,X.jsx)(`path`,{d:`M 16.706 20.063 C 20.581 26.856 21.755 28.531 29.138 26.949 C 29.248 26.926 29.275 26.778 29.176 26.724 L 16.869 19.892 C 16.761 19.832 16.645 19.956 16.706 20.063 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 14.931 19.742 C 15.022 27.563 15.235 29.597 22.459 31.797 C 22.566 31.83 22.661 31.713 22.601 31.618 L 15.156 19.672 C 15.091 19.567 14.93 19.619 14.931 19.742 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 13.538 18.602 C 9.822 25.483 9.021 27.365 14.269 32.795 C 14.347 32.875 14.486 32.82 14.48 32.708 L 13.769 18.649 C 13.763 18.526 13.596 18.493 13.538 18.602 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 12.875 16.928 C 6.286 21.142 4.672 22.398 6.626 29.692 C 6.655 29.801 6.803 29.82 6.853 29.719 L 13.053 17.082 C 13.108 16.971 12.978 16.862 12.875 16.928 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 13.104 15.142 C 5.298 15.628 3.278 15.944 1.446 23.269 C 1.418 23.378 1.539 23.467 1.631 23.403 L 13.186 15.363 C 13.287 15.293 13.227 15.134 13.104 15.142 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 14.172 13.692 C 7.111 10.329 5.191 9.624 0.034 15.14 C -0.043 15.221 0.02 15.358 0.131 15.346 L 14.136 13.925 C 14.258 13.912 14.283 13.745 14.172 13.692 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 15.812 12.943 C 11.27 6.575 9.934 5.027 2.748 7.347 C 2.641 7.381 2.63 7.531 2.733 7.575 L 15.667 13.129 C 15.78 13.178 15.883 13.043 15.812 12.943 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 17.605 13.082 C 16.725 5.311 16.308 3.309 8.899 1.85 C 8.789 1.828 8.706 1.953 8.775 2.042 L 17.388 13.175 C 17.464 13.272 17.619 13.205 17.605 13.082 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.107 14.076 C 22.109 6.854 22.715 4.901 16.946 0.03 C 16.86 -0.043 16.727 0.027 16.744 0.138 L 18.872 14.052 C 18.891 14.174 19.059 14.19 19.107 14.076 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.937 15.674 C 26.067 10.816 27.545 9.403 24.865 2.344 C 24.825 2.239 24.675 2.235 24.636 2.34 L 19.744 15.539 C 19.701 15.654 19.84 15.75 19.937 15.674 Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{d:`M 19.89 17.474 C 27.607 16.202 29.585 15.684 30.668 8.211 C 30.684 8.1 30.555 8.024 30.47 8.097 L 19.787 17.262 C 19.693 17.342 19.769 17.494 19.89 17.474 Z`,fill:`currentColor`})]}),n5t={display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`10px 16px`,backgroundColor:`rgba(251, 191, 35, 0.06)`,color:`#fbbf23`,border:`1px solid #fbbf23`,borderRadius:6,fontSize:13,lineHeight:1.4,marginBottom:8},r5t={background:`none`,border:`none`,color:`#92400e`,cursor:`pointer`,padding:`2px 6px`,fontSize:18,lineHeight:1,opacity:.7,flexShrink:0},i5t=(0,Q.forwardRef)(({apiKey:e,initialContent:t,onChange:n,defaultFontFamilies:r=q0.defaultFontFamilies||[],mentionUserList:i=q0.mentionUserList||[],onAuthSuccess:a,onAuthError:o,customVerifyKey:s,enableReactNativeBridge:c=EHt(),onEditorReady:l,onFocus:u,onBlur:d,onHeightChange:f,mode:p=`edit`,containerClassName:m=``,className:h=``,style:g,contentClassName:_,editor:v,onPreviewClick:y,darkMode:b,toolbar:x,floatingToolbarClassName:S=``,fitToPage:C=!1,documentId:w},T)=>{let{isAuthenticated:E,isLoading:D,error:O,editorConfig:k,currentUser:A,verifyKey:j,paymentWarning:M,loadTracked:N}=G0(),P=(0,Q.useMemo)(()=>pjt(w),[w]),F=!w?.trim(),I=(0,Q.useRef)(null);(0,Q.useImperativeHandle)(T,()=>({saveVersion:async e=>I.current?I.current(e):{skipped:!0,reason:`unavailable`}}),[]);let ee=(x?.mode??(C?`static`:`sticky`))===`static`,L=v?.maxHeight??(C?`none`:600),te=ee?{maxHeight:L}:void 0,R=(0,Q.useRef)(a),ne=(0,Q.useRef)(o),re=h||m,ie=(0,Q.useRef)(!1),ae=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),[oe,se]=(0,Q.useState)(!1),B=DHt({enabled:c,onReady:l,onFocus:u,onBlur:d,onHeightChange:f});(0,Q.useEffect)(()=>{R.current=a,ne.current=o},[a,o]),(0,Q.useEffect)(()=>{!e||ie.current||(ie.current=!0,(async()=>{try{if(s){let t=await s(e);t.success?R.current?.():ne.current?.(t.message)}else await j(e)}catch(e){ne.current?.(e.message||`Failed to verify API key`)}})())},[e,s,j]),(0,Q.useEffect)(()=>{E&&(R.current?.(),B.notifyAuthSuccess()),O&&(ne.current?.(O),B.notifyAuthError(O))},[E,O,B]),(0,Q.useEffect)(()=>{E&&!ae.current&&e&&!N&&(ae.current=!0,Q8t(e)),E&&!z.current&&(z.current=!0,setTimeout(()=>{B.notifyReady()},100))},[E,e,B,N]);let ce=(0,Q.useCallback)(e=>{n?.(e),B.notifyContentChange(e)},[n,B]);return D?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,children:(0,X.jsxs)(`div`,{className:$8t,children:[(0,X.jsx)(Q9,{size:32,className:`cteditor-text-foreground`,animation:`pulse`}),(0,X.jsx)(`span`,{className:`cteditor-text-muted-foreground`,children:`Loading editor…`})]})}):O?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,children:(0,X.jsxs)(`div`,{className:e5t,children:[(0,X.jsx)(Q9,{size:28,animation:`pulse`}),(0,X.jsx)(`span`,{children:O})]})}):!E||!k?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:(0,X.jsxs)(`div`,{className:t5t,children:[(0,X.jsx)(Q9,{size:28,className:`cteditor-text-muted-foreground`,animation:`pulse`}),(0,X.jsx)(`span`,{className:`cteditor-text-muted-foreground`,children:`Please provide a valid API key to access the editor`})]})}):p===`preview`?(0,X.jsx)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:(0,X.jsx)(`div`,{className:re,style:te||g,onClick:y,dangerouslySetInnerHTML:{__html:t||``}})}):(0,X.jsx)(THt,{children:(0,X.jsxs)(X9,{darkMode:b,className:re,style:g,floatingToolbarClassName:S,children:[M&&!oe&&(0,X.jsxs)(`div`,{style:n5t,children:[(0,X.jsxs)(`span`,{children:[M.message,M.daysRemaining>0&&` (${M.daysRemaining} day${M.daysRemaining===1?``:`s`} remaining)`]}),(0,X.jsx)(`button`,{type:`button`,style:r5t,onClick:()=>se(!0),"aria-label":`Dismiss warning`,onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.7`},children:`✕`})]}),(0,X.jsx)(Y8t,{config:{...k,htmlViewOption:!0},apiKey:e,defaultFontFamilies:r,mentionUserList:i,currentUser:A,initialContent:t,onChange:ce,toolbarConfig:x,contentClassName:_,editorStyle:te,floatingToolbarClassName:S,fitToPage:C,documentId:P,documentIdIsFallback:F,saveVersionApiRef:I})]})})}),i5t.displayName=`ConfigurableEditorWithAuth`})),a5t=_();$9();var o5t=y(),s5t=typeof document>`u`?null:document.currentScript?.src??null;function c5t(){if(typeof document>`u`||document.getElementById(`eddyter-style`)||!s5t)return;let e=document.createElement(`link`);e.id=`eddyter-style`,e.rel=`stylesheet`,e.href=s5t.replace(/editor(\.iife)?\.js(\?.*)?$/,`style.css`),document.head.appendChild(e)}function l5t(e){c5t();let t=typeof e.container==`string`?document.querySelector(e.container):e.container;if(!(t instanceof HTMLElement))throw Error(`Invalid container`);let n=t.__eddyter__;if(n)return n;let r=(0,a5t.createRoot)(t),i=e,a=()=>{let{user:e,class:t,containerClass:n,contentClass:a,floatingToolbarClass:o,onReady:s,...c}=i,l=e||{id:`anonymous`,name:`Anonymous`};r.render((0,o5t.jsx)(bHt,{currentUser:l,nativeAppId:c.nativeAppId,clientType:c.clientType,children:(0,o5t.jsx)(i5t,{apiKey:c.apiKey,customVerifyKey:c.customVerifyKey,initialContent:c.initialContent,onChange:c.onChange,onEditorReady:s,onFocus:c.onFocus,onBlur:c.onBlur,onHeightChange:c.onHeightChange,onAuthSuccess:c.onAuthSuccess,onAuthError:c.onAuthError,onPreviewClick:c.onPreviewClick,mode:c.mode,darkMode:c.darkMode,className:t,containerClassName:n,contentClassName:a,floatingToolbarClassName:o,editor:c.editor,toolbar:c.toolbar,defaultFontFamilies:c.defaultFontFamilies,mentionUserList:c.mentionUserList,enableReactNativeBridge:c.enableReactNativeBridge,onExportFile:c.onExportFile})}))};a();let o={destroy(){r.unmount(),t.__eddyter__=null},update(e){i={...i,...e},a()}};return t.__eddyter__=o,o}s5t&&typeof window<`u`&&(window.Eddyter={init:l5t}),exports.init=l5t;
|