@voilabs/mark 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -125,7 +125,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
125
125
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
126
126
  `)},qw=0,_n=[];function Kw(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(qw++)[0],s=v.useState(Df)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=pw([e.lockRef.current],(e.shards||[]).map(Oc),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var x=Co(g),S=n.current,k="deltaX"in g?g.deltaX:S[0]-x[0],y="deltaY"in g?g.deltaY:S[1]-x[1],A,w=g.target,C=Math.abs(k)>Math.abs(y)?"h":"v";if("touches"in g&&C==="h"&&w.type==="range")return!1;var T=window.getSelection(),I=T&&T.anchorNode,O=I?I===w||I.contains(w):!1;if(O)return!1;var j=Rc(C,w);if(!j)return!0;if(j?A=C:(A=C==="v"?"h":"v",j=Rc(C,w)),!j)return!1;if(!r.current&&"changedTouches"in g&&(k||y)&&(r.current=A),!A)return!0;var D=r.current||A;return Hw(D,b,g,D==="h"?k:y)},[]),l=v.useCallback(function(g){var b=g;if(!(!_n.length||_n[_n.length-1]!==s)){var x="deltaY"in b?Nc(b):Co(b),S=t.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&Ww(A.delta,x)})[0];if(S&&S.should){b.cancelable&&b.preventDefault();return}if(!S){var k=(i.current.shards||[]).map(Oc).filter(Boolean).filter(function(A){return A.contains(b.target)}),y=k.length>0?a(b,k[0]):!i.current.noIsolation;y&&b.cancelable&&b.preventDefault()}}},[]),c=v.useCallback(function(g,b,x,S){var k={name:g,delta:b,target:x,should:S,shadowParent:Uw(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(y){return y!==k})},1)},[]),u=v.useCallback(function(g){n.current=Co(g),r.current=void 0},[]),d=v.useCallback(function(g){c(g.type,Nc(g),g.target,a(g,e.lockRef.current))},[]),f=v.useCallback(function(g){c(g.type,Co(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return _n.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,zn),document.addEventListener("touchmove",l,zn),document.addEventListener("touchstart",u,zn),function(){_n=_n.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,zn),document.removeEventListener("touchmove",l,zn),document.removeEventListener("touchstart",u,zn)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(s,{styles:Vw(o)}):null,p?v.createElement(Dw,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Uw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Gw=kw(Lf,Kw);var $a=v.forwardRef(function(e,t){return v.createElement(ks,St({},e,{ref:t,sideCar:Gw}))});$a.classNames=ks.classNames;var Vi=["Enter"," "],Xw=["ArrowDown","PageUp","Home"],$f=["ArrowUp","PageDown","End"],Jw=[...Xw,...$f],Yw={ltr:[...Vi,"ArrowRight"],rtl:[...Vi,"ArrowLeft"]},Qw={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gr="Menu",[Pr,Zw,ek]=Gd(Gr),[In,Ff]=sr(Gr,[ek,ws,Tf]),Xr=ws(),Bf=Tf(),[Hf,an]=In(Gr),[tk,Jr]=In(Gr),Wf=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=Xr(t),[l,c]=v.useState(null),u=v.useRef(!1),d=Ot(s),f=Xd(o);return v.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(ja,{...a,children:h.jsx(Hf,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(tk,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:i,children:r})})})};Wf.displayName=Gr;var nk="MenuAnchor",Fa=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Xr(n);return h.jsx(za,{...o,...r,ref:t})});Fa.displayName=nk;var Ba="MenuPortal",[rk,Vf]=In(Ba,{forceMount:void 0}),qf=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=an(Ba,t);return h.jsx(rk,{scope:t,forceMount:n,children:h.jsx(On,{present:n||s.open,children:h.jsx(_a,{asChild:!0,container:o,children:r})})})};qf.displayName=Ba;var lt="MenuContent",[ok,Ha]=In(lt),Kf=v.forwardRef((e,t)=>{const n=Vf(lt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=an(lt,e.__scopeMenu),i=Jr(lt,e.__scopeMenu);return h.jsx(Pr.Provider,{scope:e.__scopeMenu,children:h.jsx(On,{present:r||s.open,children:h.jsx(Pr.Slot,{scope:e.__scopeMenu,children:i.modal?h.jsx(sk,{...o,ref:t}):h.jsx(ik,{...o,ref:t})})})})}),sk=v.forwardRef((e,t)=>{const n=an(lt,e.__scopeMenu),r=v.useRef(null),o=De(t,r);return v.useEffect(()=>{const s=r.current;if(s)return Of(s)},[]),h.jsx(Wa,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ae(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ik=v.forwardRef((e,t)=>{const n=an(lt,e.__scopeMenu);return h.jsx(Wa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ak=Or("MenuContent.ScrollLock"),Wa=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=e,b=an(lt,n),x=Jr(lt,n),S=Xr(n),k=Bf(n),y=Zw(n),[A,w]=v.useState(null),C=v.useRef(null),T=De(t,C,b.onContentChange),I=v.useRef(0),O=v.useRef(""),j=v.useRef(0),D=v.useRef(null),F=v.useRef("right"),B=v.useRef(0),N=m?$a:v.Fragment,$=m?{as:ak,allowPinchZoom:!0}:void 0,V=R=>{const z=O.current+R,W=y().filter(H=>!H.disabled),re=document.activeElement,se=W.find(H=>H.ref.current===re)?.textValue,le=W.map(H=>H.textValue),te=xk(le,z,se),G=W.find(H=>H.textValue===te)?.ref.current;(function H(J){O.current=J,window.clearTimeout(I.current),J!==""&&(I.current=window.setTimeout(()=>H(""),1e3))})(z),G&&setTimeout(()=>G.focus())};v.useEffect(()=>()=>window.clearTimeout(I.current),[]),Qd();const _=v.useCallback(R=>F.current===D.current?.side&&wk(R,D.current?.area),[]);return h.jsx(ok,{scope:n,searchRef:O,onItemEnter:v.useCallback(R=>{_(R)&&R.preventDefault()},[_]),onItemLeave:v.useCallback(R=>{_(R)||(C.current?.focus(),w(null))},[_]),onTriggerLeave:v.useCallback(R=>{_(R)&&R.preventDefault()},[_]),pointerGraceTimerRef:j,onPointerGraceIntentChange:v.useCallback(R=>{D.current=R},[]),children:h.jsx(N,{...$,children:h.jsx(Ea,{asChild:!0,trapped:o,onMountAutoFocus:ae(s,R=>{R.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:h.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(lw,{asChild:!0,...k,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:w,onEntryFocus:ae(l,R=>{x.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(kf,{role:"menu","aria-orientation":"vertical","data-state":cp(b.open),"data-radix-menu-content":"",dir:x.dir,...S,...g,ref:T,style:{outline:"none",...g.style},onKeyDown:ae(g.onKeyDown,R=>{const W=R.target.closest("[data-radix-menu-content]")===R.currentTarget,re=R.ctrlKey||R.altKey||R.metaKey,se=R.key.length===1;W&&(R.key==="Tab"&&R.preventDefault(),!re&&se&&V(R.key));const le=C.current;if(R.target!==le||!Jw.includes(R.key))return;R.preventDefault();const G=y().filter(H=>!H.disabled).map(H=>H.ref.current);$f.includes(R.key)&&G.reverse(),bk(G)}),onBlur:ae(e.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(I.current),O.current="")}),onPointerMove:ae(e.onPointerMove,Lr(R=>{const z=R.target,W=B.current!==R.clientX;if(R.currentTarget.contains(z)&&W){const re=R.clientX>B.current?"right":"left";F.current=re,B.current=R.clientX}}))})})})})})})});Kf.displayName=lt;var lk="MenuGroup",Va=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Ie.div,{role:"group",...r,ref:t})});Va.displayName=lk;var ck="MenuLabel",Uf=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Ie.div,{...r,ref:t})});Uf.displayName=ck;var ts="MenuItem",Ic="menu.itemSelect",Cs=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=v.useRef(null),i=Jr(ts,e.__scopeMenu),a=Ha(ts,e.__scopeMenu),l=De(t,s),c=v.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(Ic,{bubbles:!0,cancelable:!0});d.addEventListener(Ic,p=>r?.(p),{once:!0}),Ud(d,f),f.defaultPrevented?c.current=!1:i.onClose()}};return h.jsx(Gf,{...o,ref:l,disabled:n,onClick:ae(e.onClick,u),onPointerDown:d=>{e.onPointerDown?.(d),c.current=!0},onPointerUp:ae(e.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:ae(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Vi.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Cs.displayName=ts;var Gf=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Ha(ts,n),a=Bf(n),l=v.useRef(null),c=De(t,l),[u,d]=v.useState(!1),[f,p]=v.useState("");return v.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[s.children]),h.jsx(Pr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:h.jsx(cw,{asChild:!0,...a,focusable:!r,children:h.jsx(Ie.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:ae(e.onPointerMove,Lr(m=>{r?i.onItemLeave(m):(i.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ae(e.onPointerLeave,Lr(m=>i.onItemLeave(m))),onFocus:ae(e.onFocus,()=>d(!0)),onBlur:ae(e.onBlur,()=>d(!1))})})})}),uk="MenuCheckboxItem",Xf=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return h.jsx(ep,{scope:e.__scopeMenu,checked:n,children:h.jsx(Cs,{role:"menuitemcheckbox","aria-checked":ns(n)?"mixed":n,...o,ref:t,"data-state":Ua(n),onSelect:ae(o.onSelect,()=>r?.(ns(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xf.displayName=uk;var Jf="MenuRadioGroup",[dk,fk]=In(Jf,{value:void 0,onValueChange:()=>{}}),Yf=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Ot(r);return h.jsx(dk,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(Va,{...o,ref:t})})});Yf.displayName=Jf;var Qf="MenuRadioItem",Zf=v.forwardRef((e,t)=>{const{value:n,...r}=e,o=fk(Qf,e.__scopeMenu),s=n===o.value;return h.jsx(ep,{scope:e.__scopeMenu,checked:s,children:h.jsx(Cs,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Ua(s),onSelect:ae(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Zf.displayName=Qf;var qa="MenuItemIndicator",[ep,pk]=In(qa,{checked:!1}),tp=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=pk(qa,n);return h.jsx(On,{present:r||ns(s.checked)||s.checked===!0,children:h.jsx(Ie.span,{...o,ref:t,"data-state":Ua(s.checked)})})});tp.displayName=qa;var hk="MenuSeparator",np=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Ie.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});np.displayName=hk;var mk="MenuArrow",rp=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Xr(n);return h.jsx(Cf,{...o,...r,ref:t})});rp.displayName=mk;var Ka="MenuSub",[gk,op]=In(Ka),sp=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:o}=e,s=an(Ka,t),i=Xr(t),[a,l]=v.useState(null),[c,u]=v.useState(null),d=Ot(o);return v.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(ja,{...i,children:h.jsx(Hf,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(gk,{scope:t,contentId:Yn(),triggerId:Yn(),trigger:a,onTriggerChange:l,children:n})})})};sp.displayName=Ka;var yr="MenuSubTrigger",ip=v.forwardRef((e,t)=>{const n=an(yr,e.__scopeMenu),r=Jr(yr,e.__scopeMenu),o=op(yr,e.__scopeMenu),s=Ha(yr,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.jsx(Fa,{asChild:!0,...c,children:h.jsx(Gf,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":cp(n.open),...e,ref:ms(t,o.onTriggerChange),onClick:d=>{e.onClick?.(d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ae(e.onPointerMove,Lr(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ae(e.onPointerLeave,Lr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const p=n.content?.dataset.side,m=p==="right",g=m?-5:5,b=f[m?"left":"right"],x=f[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+g,y:d.clientY},{x:b,y:f.top},{x,y:f.top},{x,y:f.bottom},{x:b,y:f.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ae(e.onKeyDown,d=>{const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||Yw[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});ip.displayName=yr;var ap="MenuSubContent",lp=v.forwardRef((e,t)=>{const n=Vf(lt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=an(lt,e.__scopeMenu),i=Jr(lt,e.__scopeMenu),a=op(ap,e.__scopeMenu),l=v.useRef(null),c=De(t,l);return h.jsx(Pr.Provider,{scope:e.__scopeMenu,children:h.jsx(On,{present:r||s.open,children:h.jsx(Pr.Slot,{scope:e.__scopeMenu,children:h.jsx(Wa,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{i.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ae(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ae(e.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:ae(e.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=Qw[i.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});lp.displayName=ap;function cp(e){return e?"open":"closed"}function ns(e){return e==="indeterminate"}function Ua(e){return ns(e)?"indeterminate":e?"checked":"unchecked"}function bk(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xk(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=yk(e,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function vk(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],l=t[i],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function wk(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return vk(n,t)}function Lr(e){return t=>t.pointerType==="mouse"?e(t):void 0}var kk=Wf,Ck=Fa,Sk=qf,Tk=Kf,Ak=Va,Ek=Uf,Mk=Cs,Rk=Xf,Nk=Yf,Ok=Zf,Ik=tp,Pk=np,Lk=rp,Dk=sp,jk=ip,zk=lp,Ss="DropdownMenu",[_k]=sr(Ss,[Ff]),ze=Ff(),[$k,up]=_k(Ss),dp=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,l=ze(t),c=v.useRef(null),[u,d]=gs({prop:o,defaultProp:s??!1,onChange:i,caller:Ss});return h.jsx($k,{scope:t,triggerId:Yn(),triggerRef:c,contentId:Yn(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(kk,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};dp.displayName=Ss;var fp="DropdownMenuTrigger",pp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=up(fp,n),i=ze(n);return h.jsx(Ck,{asChild:!0,...i,children:h.jsx(Ie.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:ms(t,s.triggerRef),onPointerDown:ae(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ae(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});pp.displayName=fp;var Fk="DropdownMenuPortal",hp=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ze(t);return h.jsx(Sk,{...r,...n})};hp.displayName=Fk;var mp="DropdownMenuContent",gp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=up(mp,n),s=ze(n),i=v.useRef(!1);return h.jsx(Tk,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ae(e.onCloseAutoFocus,a=>{i.current||o.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ae(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(i.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)"}})});gp.displayName=mp;var Bk="DropdownMenuGroup",Hk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Ak,{...o,...r,ref:t})});Hk.displayName=Bk;var Wk="DropdownMenuLabel",bp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Ek,{...o,...r,ref:t})});bp.displayName=Wk;var Vk="DropdownMenuItem",yp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Mk,{...o,...r,ref:t})});yp.displayName=Vk;var qk="DropdownMenuCheckboxItem",xp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Rk,{...o,...r,ref:t})});xp.displayName=qk;var Kk="DropdownMenuRadioGroup",Uk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Nk,{...o,...r,ref:t})});Uk.displayName=Kk;var Gk="DropdownMenuRadioItem",vp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Ok,{...o,...r,ref:t})});vp.displayName=Gk;var Xk="DropdownMenuItemIndicator",wp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Ik,{...o,...r,ref:t})});wp.displayName=Xk;var Jk="DropdownMenuSeparator",kp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Pk,{...o,...r,ref:t})});kp.displayName=Jk;var Yk="DropdownMenuArrow",Qk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(Lk,{...o,...r,ref:t})});Qk.displayName=Yk;var Zk=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:o,defaultOpen:s}=e,i=ze(t),[a,l]=gs({prop:r,defaultProp:s??!1,onChange:o,caller:"DropdownMenuSub"});return h.jsx(Dk,{...i,open:a,onOpenChange:l,children:n})},eC="DropdownMenuSubTrigger",Cp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(jk,{...o,...r,ref:t})});Cp.displayName=eC;var tC="DropdownMenuSubContent",Sp=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ze(n);return h.jsx(zk,{...o,...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)"}})});Sp.displayName=tC;var nC=dp,rC=pp,Tp=hp,Ap=gp,Ep=bp,Mp=yp,Rp=xp,Np=vp,Op=wp,Ip=kp,oC=Zk,Pp=Cp,Lp=Sp;const Dp=nC,jp=rC,Pc=({children:e,...t})=>{const n=qr();return h.jsx(Tp,{container:n??void 0,...t,children:e})},Lc=oC,qi=v.forwardRef(({className:e,inset:t,children:n,...r},o)=>{const s=We(),i=Ve();return h.jsxs(Pp,{ref:o,className:M("flex cursor-default select-none items-center rounded-full px-2 py-1.5 text-sm outline-none transition-colors gap-2",s==="dark"?"focus:bg-neutral-800 data-[state=open]:bg-neutral-800 text-neutral-300":"focus:bg-neutral-100 data-[state=open]:bg-neutral-100 text-neutral-700",t&&"pl-8",i?.dropdownSubTrigger,e),...r,children:[n,h.jsx(q.ChevronRight,{className:M("ml-auto h-4 w-4",i?.dropdownSubTriggerChevron)})]})});qi.displayName=Pp.displayName;const Ki=v.forwardRef(({className:e,...t},n)=>{const r=We(),o=Ve();return h.jsx(Lp,{ref:n,className:M("z-[99999] min-w-[8rem] overflow-hidden rounded-3xl border p-1.5 shadow-lg backdrop-blur-xl animate-in fade-in zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95",r==="dark"?"bg-neutral-900/95 border-neutral-800 shadow-black/50 text-neutral-200":"bg-white/95 border-neutral-200/60 text-neutral-700",o?.dropdownSubContent,e),...t})});Ki.displayName=Lp.displayName;const Ga=v.forwardRef(({className:e,sideOffset:t=8,...n},r)=>{const o=We(),s=Ve(),i=qr();return h.jsx(Tp,{container:i??void 0,children:h.jsx(Ap,{ref:r,sideOffset:t,className:M("z-[99999] min-w-[12rem] overflow-hidden rounded-3xl border p-1.5 shadow-xl backdrop-blur-xl animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",o==="dark"?"bg-neutral-900/95 border-neutral-800 shadow-black/50 text-neutral-200":"bg-white/95 border-neutral-200/60 text-neutral-700",s?.dropdownContent,e),...n})})});Ga.displayName=Ap.displayName;const Ke=v.forwardRef(({className:e,inset:t,...n},r)=>{const o=We(),s=Ve();return h.jsx(Mp,{ref:r,className:M("relative flex cursor-pointer select-none items-center rounded-full px-3 py-2 text-sm outline-none transition-colors gap-2 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o==="dark"?"focus:bg-neutral-800 focus:text-neutral-100 text-neutral-300":"focus:bg-neutral-100 focus:text-neutral-900 text-neutral-600",t&&"pl-8",s?.dropdownItem,e),...n})});Ke.displayName=Mp.displayName;const sC=v.forwardRef(({className:e,children:t,checked:n,...r},o)=>{const s=We(),i=Ve();return h.jsxs(Rp,{ref:o,className:M("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s==="dark"?"focus:bg-neutral-800 focus:text-neutral-100 text-neutral-300":"focus:bg-neutral-100 focus:text-neutral-900 text-neutral-600",i?.dropdownCheckboxItem,e),checked:n,...r,children:[h.jsx("span",{className:M("absolute left-2 flex h-3.5 w-3.5 items-center justify-center",i?.dropdownIndicator),children:h.jsx(Op,{children:h.jsx(q.Check,{className:"h-4 w-4"})})}),t]})});sC.displayName=Rp.displayName;const iC=v.forwardRef(({className:e,children:t,...n},r)=>{const o=We(),s=Ve();return h.jsxs(Np,{ref:r,className:M("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o==="dark"?"focus:bg-neutral-800 focus:text-neutral-100 text-neutral-300":"focus:bg-neutral-100 focus:text-neutral-900 text-neutral-600",s?.dropdownRadioItem,e),...n,children:[h.jsx("span",{className:M("absolute left-2 flex h-3.5 w-3.5 items-center justify-center",s?.dropdownIndicator),children:h.jsx(Op,{children:h.jsx(q.Circle,{className:"h-2 w-2 fill-current"})})}),t]})});iC.displayName=Np.displayName;const aC=v.forwardRef(({className:e,inset:t,...n},r)=>{const o=Ve();return h.jsx(Ep,{ref:r,className:M("px-3 py-1.5 text-xs font-semibold text-neutral-500",t&&"pl-8",o?.dropdownLabel,e),...n})});aC.displayName=Ep.displayName;const xr=v.forwardRef(({className:e,...t},n)=>{const r=We(),o=Ve();return h.jsx(Ip,{ref:n,className:M("-mx-1 my-1 h-px",r==="dark"?"bg-neutral-800":"bg-neutral-200/60",o?.dropdownSeparator,e),...t})});xr.displayName=Ip.displayName;const zp=({className:e,...t})=>{const n=Ve();return h.jsx("span",{className:M("ml-auto text-xs tracking-widest opacity-60",n?.dropdownShortcut,e),...t})};zp.displayName="DropdownMenuShortcut";const Dc=({trigger:e,items:t,value:n,onSelect:r,align:o="start"})=>{const s=We(),i=Ve();return h.jsxs(Dp,{children:[h.jsx(jp,{asChild:!0,children:e}),h.jsx(Ga,{align:o,children:t.map(a=>h.jsxs(Ke,{onSelect:()=>r(a.value),className:M("gap-2 px-3 py-2 rounded-full",n===a.value&&(s==="dark"?"bg-neutral-800 text-neutral-100":"bg-neutral-100 text-neutral-900"),n===a.value&&i?.dropdownItemActive,i?.dropdownItem),children:[a.icon&&h.jsx("span",{className:M("flex items-center justify-center w-5 h-5 shrink-0",i?.dropdownItemIcon),children:a.icon}),h.jsx("span",{className:M("flex-1 font-medium",i?.dropdownItemLabel),children:a.label}),a.shortcut&&h.jsx(zp,{children:a.shortcut}),n===a.value&&h.jsx(q.Check,{className:M("ml-auto size-3.5 shrink-0",s==="dark"?"text-neutral-400":"text-neutral-500",i?.dropdownItemCheck)})]},a.value))})]})};var Ts="Popover",[_p]=sr(Ts,[ws]),Yr=ws(),[lC,ln]=_p(Ts),$p=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,a=Yr(t),l=v.useRef(null),[c,u]=v.useState(!1),[d,f]=gs({prop:r,defaultProp:o??!1,onChange:s,caller:Ts});return h.jsx(ja,{...a,children:h.jsx(lC,{scope:t,contentId:Yn(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:i,children:n})})};$p.displayName=Ts;var Fp="PopoverAnchor",cC=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ln(Fp,n),s=Yr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return v.useEffect(()=>(i(),()=>a()),[i,a]),h.jsx(za,{...s,...r,ref:t})});cC.displayName=Fp;var Bp="PopoverTrigger",Hp=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ln(Bp,n),s=Yr(n),i=De(t,o.triggerRef),a=h.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Up(o.open),...r,ref:i,onClick:ae(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:h.jsx(za,{asChild:!0,...s,children:a})});Hp.displayName=Bp;var Xa="PopoverPortal",[uC,dC]=_p(Xa,{forceMount:void 0}),Wp=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=ln(Xa,t);return h.jsx(uC,{scope:t,forceMount:n,children:h.jsx(On,{present:n||s.open,children:h.jsx(_a,{asChild:!0,container:o,children:r})})})};Wp.displayName=Xa;var Zn="PopoverContent",Vp=v.forwardRef((e,t)=>{const n=dC(Zn,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=ln(Zn,e.__scopePopover);return h.jsx(On,{present:r||s.open,children:s.modal?h.jsx(pC,{...o,ref:t}):h.jsx(hC,{...o,ref:t})})});Vp.displayName=Zn;var fC=Or("PopoverContent.RemoveScroll"),pC=v.forwardRef((e,t)=>{const n=ln(Zn,e.__scopePopover),r=v.useRef(null),o=De(t,r),s=v.useRef(!1);return v.useEffect(()=>{const i=r.current;if(i)return Of(i)},[]),h.jsx($a,{as:fC,allowPinchZoom:!0,children:h.jsx(qp,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ae(e.onCloseAutoFocus,i=>{i.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ae(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ae(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),hC=v.forwardRef((e,t)=>{const n=ln(Zn,e.__scopePopover),r=v.useRef(!1),o=v.useRef(!1);return h.jsx(qp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),qp=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=ln(Zn,n),p=Yr(n);return Qd(),h.jsx(Ea,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:h.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:h.jsx(kf,{"data-state":Up(f.open),role:"dialog",id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Kp="PopoverClose",mC=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ln(Kp,n);return h.jsx(Ie.button,{type:"button",...r,ref:t,onClick:ae(e.onClick,()=>o.onOpenChange(!1))})});mC.displayName=Kp;var gC="PopoverArrow",bC=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Yr(n);return h.jsx(Cf,{...o,...r,ref:t})});bC.displayName=gC;function Up(e){return e?"open":"closed"}var yC=$p,xC=Hp,vC=Wp,wC=Vp;const Lo=({trigger:e,children:t,align:n="start",side:r="bottom",open:o,onOpenChange:s})=>{const i=We(),a=Ve(),l=qr();return h.jsxs(yC,{open:o,onOpenChange:s,children:[h.jsx(xC,{asChild:!0,children:e}),h.jsx(vC,{container:l??void 0,children:h.jsx(wC,{align:n,side:r,sideOffset:8,className:M("z-50 rounded-3xl border p-1.5 shadow-xl backdrop-blur-xl outline-none","animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",i==="dark"?"bg-neutral-900/95 border-neutral-800 shadow-black/50":"bg-white/95 border-neutral-200/60",a?.popoverContent),children:t})})]})},kC=[{label:"Thin (100)",value:"100"},{label:"Light (300)",value:"300"},{label:"Normal (400)",value:"400"},{label:"Medium (500)",value:"500"},{label:"Semi Bold (600)",value:"600"},{label:"Bold (700)",value:"700"},{label:"Extra Bold (800)",value:"800"},{label:"Black (900)",value:"900"}],CC=[{label:"Default",value:""},{label:"Inter",value:"Inter, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:"Times New Roman, Times, serif"},{label:"Courier New",value:"Courier New, Courier, monospace"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Verdana",value:"Verdana, Geneva, sans-serif"}],SC=({style:e,baseStyle:t,anchorX:n,anchorY:r,classNames:o,onSave:s,onReset:i,onClose:a})=>{const l=Vr(),u=We()==="dark",d=K.useRef(null),[f,p]=K.useState(e.label),[m,g]=K.useState(e.fontSize??""),[b,x]=K.useState(e.fontWeight??""),[S,k]=K.useState(e.fontStyle??"normal"),[y,A]=K.useState(e.fontFamily??""),[w,C]=K.useState(e.color??""),[T,I]=K.useState(e.letterSpacing??""),[O,j]=K.useState(e.lineHeight??""),[D,F]=K.useState(e.textTransform??"none");K.useEffect(()=>{const W=se=>{d.current&&!d.current.contains(se.target)&&a()},re=se=>{se.key==="Escape"&&a()};return document.addEventListener("mousedown",W),document.addEventListener("keydown",re),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",re)}},[a]);const[B,N]=K.useState({x:n,y:r});K.useEffect(()=>{const W=d.current;if(!W)return;const re=W.getBoundingClientRect(),se=window.innerWidth,le=window.innerHeight;let te=n,G=r;te+re.width>se-12&&(te=se-re.width-12),G+re.height>le-12&&(G=le-re.height-12),te<12&&(te=12),G<12&&(G=12),N({x:te,y:G})},[n,r]);const $=()=>{const W={label:f||e.label,...m?{fontSize:m}:{},...b?{fontWeight:b}:{},fontStyle:S,...y?{fontFamily:y}:{},...w?{color:w}:{},...T?{letterSpacing:T}:{},...O?{lineHeight:O}:{},...D&&D!=="none"?{textTransform:D}:{}};s(e.id,W),a()},V=()=>{i(e.id),a()},_=M("w-full rounded-lg border px-2.5 py-1.5 text-sm outline-none transition-colors",u?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-sky-500":"bg-white border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-sky-400"),R=M("block text-xs font-medium mb-1",u?"text-neutral-400":"text-neutral-500"),z={fontFamily:y||"inherit",fontSize:Math.min(parseInt(m||"14px"),20)+"px",fontWeight:b||"inherit",fontStyle:S,color:w||"inherit",letterSpacing:T||"inherit",lineHeight:O||"1.4",textTransform:D??"none"};return h.jsxs("div",{ref:d,style:{left:B.x,top:B.y,position:"fixed",zIndex:9999},className:M("w-72 rounded-2xl border shadow-2xl shadow-black/20 overflow-hidden",u?"bg-neutral-900 border-white/10 text-neutral-100":"bg-white border-neutral-200 text-neutral-900",o?.styleEditPopover),onContextMenu:W=>W.preventDefault(),children:[h.jsxs("div",{className:M("flex items-center justify-between px-4 py-3 border-b",u?"border-white/8 bg-white/[0.03]":"border-neutral-100 bg-neutral-50"),children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest opacity-40 mb-1",children:l.editStyle}),h.jsx("p",{className:"truncate text-sm font-medium",style:z,children:f||e.label})]}),h.jsx("button",{type:"button",onClick:a,className:M("ml-3 flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs transition-colors",u?"hover:bg-white/10 text-neutral-400":"hover:bg-neutral-200 text-neutral-500"),children:"✕"})]}),h.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleName}),h.jsx("input",{type:"text",value:f,onChange:W=>p(W.target.value),className:M(_,o?.styleEditInput),placeholder:e.label})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleFontSize}),h.jsx("input",{type:"text",value:m,onChange:W=>g(W.target.value),className:M(_,o?.styleEditInput),placeholder:"16px"})]}),h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleFontWeight}),h.jsxs("select",{value:b,onChange:W=>x(W.target.value),className:M(_,"cursor-pointer",o?.styleEditInput),children:[h.jsx("option",{value:"",children:"Default"}),kC.map(W=>h.jsx("option",{value:W.value,children:W.label},W.value))]})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleFontFamily}),h.jsx("select",{value:y,onChange:W=>A(W.target.value),className:M(_,"cursor-pointer",o?.styleEditInput),children:CC.map(W=>h.jsx("option",{value:W.value,children:W.label},W.value||"__default__"))})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleFontStyle}),h.jsxs("select",{value:S,onChange:W=>k(W.target.value),className:M(_,"cursor-pointer",o?.styleEditInput),children:[h.jsx("option",{value:"normal",children:"Normal"}),h.jsx("option",{value:"italic",children:"Italic"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleTextTransform}),h.jsxs("select",{value:D??"none",onChange:W=>F(W.target.value),className:M(_,"cursor-pointer",o?.styleEditInput),children:[h.jsx("option",{value:"none",children:"None"}),h.jsx("option",{value:"uppercase",children:"UPPERCASE"}),h.jsx("option",{value:"capitalize",children:"Capitalize"}),h.jsx("option",{value:"lowercase",children:"lowercase"})]})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleColor}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"color",value:w||"#000000",onChange:W=>C(W.target.value),className:"h-8 w-8 shrink-0 cursor-pointer rounded-lg border-0 bg-transparent p-0"}),h.jsx("input",{type:"text",value:w,onChange:W=>C(W.target.value),placeholder:"#000000",className:M(_,"flex-1",o?.styleEditInput)})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleLetterSpacing}),h.jsx("input",{type:"text",value:T,onChange:W=>I(W.target.value),placeholder:"0.05em",className:M(_,o?.styleEditInput)})]}),h.jsxs("div",{children:[h.jsx("label",{className:R,children:l.styleLineHeight}),h.jsx("input",{type:"text",value:O,onChange:W=>j(W.target.value),placeholder:"1.6",className:M(_,o?.styleEditInput)})]})]})]}),h.jsxs("div",{className:M("flex items-center gap-2 px-4 py-3 border-t",u?"border-white/8":"border-neutral-100"),children:[h.jsx("button",{type:"button",onClick:V,className:M("flex-1 rounded-xl py-1.5 text-sm transition-colors",u?"bg-white/[0.06] text-neutral-300 hover:bg-white/10":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200",o?.styleEditResetButton),children:l.resetStyle}),h.jsx("button",{type:"button",onClick:$,className:M("flex-1 rounded-xl py-1.5 text-sm font-medium transition-colors","bg-sky-500 text-white hover:bg-sky-400",o?.styleEditSaveButton),children:l.saveStyle})]})]})},TC=({styles:e,baseStyles:t,editor:n,theme:r,classNames:o,activeStyle:s,onApply:i,onSave:a,onReset:l,keepEditorSelection:c})=>{const u=r==="dark",[d,f]=K.useState(null),p=qr(),m=(g,b)=>{g.preventDefault(),g.stopPropagation(),f({style:b,x:g.clientX,y:g.clientY})};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:M("flex items-stretch gap-0 overflow-x-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",o?.styleBar),children:e.map((g,b)=>{const x=s?.id===g.id,S=g.preview??g.label,k=b===0,y=b===e.length-1,A=parseInt(g.fontSize??"13",10),w=Math.min(isNaN(A)?13:A,15),C={fontFamily:g.fontFamily??"inherit",fontSize:w+"px",fontWeight:g.fontWeight??"inherit",fontStyle:g.fontStyle??"normal",color:x?u?"#38bdf8":"#0369a1":g.color??(u?"#d4d4d4":"#404040"),letterSpacing:g.letterSpacing??"inherit",textTransform:g.textTransform??"none",lineHeight:"1",whiteSpace:"nowrap"};return h.jsxs("button",{type:"button",onMouseDown:c,onClick:()=>i(g),onContextMenu:T=>m(T,g),title:`${g.label} — Right-click to edit`,className:M("relative flex h-[52px] min-w-[88px] shrink-0 select-none flex-col items-center justify-center","cursor-pointer border-y border-r px-2 transition-all duration-100",k&&"border-l",k&&"rounded-l",y&&"rounded-r",u?"border-white/10":"border-neutral-200",u?"hover:bg-white/5":"hover:bg-sky-50/60",x?u?"bg-sky-500/10 border-b-sky-400/70":"bg-sky-50 border-b-sky-400":"",o?.styleBarItem,x&&o?.styleBarItemActive),children:[x&&h.jsx("span",{className:M("absolute bottom-0 left-0 right-0 h-0.5 rounded-b",u?"bg-sky-400":"bg-sky-500")}),h.jsx("span",{style:C,className:"max-w-full overflow-hidden px-1 text-center leading-none",children:S}),h.jsx("span",{className:M("mt-1.5 max-w-full truncate px-1 text-center text-[9px] leading-none",x?u?"text-sky-400/80":"text-sky-600/80":u?"text-neutral-500":"text-neutral-400"),children:g.label})]},g.id)})}),d&&p&&Qi.createPortal(h.jsx(SC,{style:d.style,baseStyle:t.find(g=>g.id===d.style.id)??d.style,anchorX:d.x,anchorY:d.y,classNames:o,onSave:a,onReset:l,onClose:()=>f(null)}),p)]})},Gp="voilabs-editor-style-overrides";function AC(){try{const e=typeof localStorage<"u"?localStorage.getItem(Gp):null;return e?JSON.parse(e):{}}catch{return{}}}function jc(e){try{typeof localStorage<"u"&&localStorage.setItem(Gp,JSON.stringify(e))}catch{}}function EC(e){const[t,n]=K.useState(AC),r=K.useCallback((i,a)=>{n(l=>{const c={...l,[i]:{...l[i]??{},...a}};return jc(c),c})},[]),o=K.useCallback(i=>{n(a=>{const l={...a};return delete l[i],jc(l),l})},[]);return{effectiveStyles:e.map(i=>({...i,...t[i.id]??{}})),overrides:t,saveOverride:r,resetOverride:o}}const MC=e=>[{label:e.heading1,value:"h1",icon:h.jsx(q.Heading1,{size:14})},{label:e.heading2,value:"h2",icon:h.jsx(q.Heading2,{size:14})},{label:e.heading3,value:"h3",icon:h.jsx(q.Heading3,{size:14})},{label:e.heading4,value:"h4",icon:h.jsx(q.Heading4,{size:14})},{label:e.heading5,value:"h5",icon:h.jsx(q.Heading5,{size:14})}],RC=e=>[{label:e.bulletList,value:"bullet",icon:h.jsx(q.List,{size:14})},{label:e.numberedList,value:"ordered",icon:h.jsx(q.ListOrdered,{size:14})},{label:e.slashTaskList,value:"task",icon:h.jsx(q.ListChecks,{size:14})}],si=[{labelKey:"highlightYellow",backgroundColor:"#fef08a",textColor:"#713f12"},{labelKey:"highlightAmber",backgroundColor:"#fde68a",textColor:"#78350f"},{labelKey:"highlightOrange",backgroundColor:"#fed7aa",textColor:"#7c2d12"},{labelKey:"highlightRed",backgroundColor:"#fecaca",textColor:"#7f1d1d"},{labelKey:"highlightPink",backgroundColor:"#fbcfe8",textColor:"#831843"},{labelKey:"highlightPurple",backgroundColor:"#ddd6fe",textColor:"#4c1d95"},{labelKey:"highlightBlue",backgroundColor:"#bfdbfe",textColor:"#1e3a8a"},{labelKey:"highlightCyan",backgroundColor:"#a5f3fc",textColor:"#164e63"},{labelKey:"highlightTeal",backgroundColor:"#99f6e4",textColor:"#134e4a"},{labelKey:"highlightGreen",backgroundColor:"#bbf7d0",textColor:"#14532d"},{labelKey:"highlightLime",backgroundColor:"#d9f99d",textColor:"#365314"},{labelKey:"highlightSlate",backgroundColor:"#334155",textColor:"#f8fafc"}],Do={px:{min:8,max:96,step:1,defaultValue:16},rem:{min:.5,max:6,step:.1,defaultValue:1}},Gn="16px",NC=e=>{if(!e)return null;const t=e.trim().match(/^(\d+(?:\.\d+)?)(px|rem)?$/i);if(!t)return null;const n=Number.parseFloat(t[1]);return Number.isFinite(n)?{value:n,unit:t[2]?.toLowerCase()??"px"}:null},ft=e=>{const t=NC(e);if(!t)return null;const n=Do[t.unit],r=Math.min(n.max,Math.max(n.min,t.value));return{value:t.unit==="px"?Math.round(r):Math.round(r*100)/100,unit:t.unit}},rs=e=>`${e.unit==="px"?`${Math.round(e.value)}`:`${Number(e.value.toFixed(2))}`}${e.unit}`,OC=e=>{if(typeof window>"u")return Gn;const{from:t}=e.state.selection,{node:n}=e.view.domAtPos(t),r=n instanceof HTMLElement?n:n.parentElement,o=r?.closest("span,p,h1,h2,h3,h4,h5,h6,li,blockquote,code,pre")??r;if(!o)return Gn;const s=window.getComputedStyle(o).fontSize,i=ft(s);return i?rs(i):Gn},zc=e=>{if(!e)return"";const t=e.getAttributes("textStyle").fontSize,n=ft(t);return n?rs(n):OC(e)},So=/[\p{L}\p{N}_'-]/u,dr=e=>{if(!e)return"";const t=e.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return`#${t.slice(1).split("").map(r=>r+r).join("")}`;const n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/);return n?`#${n.slice(1,4).map(r=>Number(r).toString(16).padStart(2,"0")).join("")}`:t},IC=e=>{const{selection:t}=e.state;if(!t.empty)return null;const{$from:n}=t;if(!n.parent.isTextblock)return null;const r=n.parent.textBetween(0,n.parent.content.size,`
127
127
  `,`
128
- `);if(!r)return null;const o=n.parentOffset,s=o>0&&So.test(r[o-1]??"")?o-1:o;if(!So.test(r[s]??""))return null;let i=s,a=s+1;for(;i>0&&So.test(r[i-1]??"");)i-=1;for(;a<r.length&&So.test(r[a]??"");)a+=1;return{from:n.start()+i,to:n.start()+a}},Xp=({editor:e,onUpload:t,disableVideoUpload:n,disableImageUpload:r,classNames:o,styles:s,onThemeChange:i,showThemeToggle:a=!0})=>{const l=K.useRef(null),c=We(),u=Vr(),d=i0(),f=s??d??[],{effectiveStyles:p,saveOverride:m,resetOverride:g}=EC(f),[b,x]=K.useState(!1),[S,k]=K.useState(""),[y,A]=K.useState(!1),[w,C]=K.useState(""),[T,I]=K.useState(""),[O,j]=K.useState(""),[D,F]=K.useState(!1),[,B]=K.useState(0),N=MC(u),$=RC(u);if(K.useEffect(()=>{if(!e)return;const L=e.view.dom,ne=E=>{const ee=(E.target instanceof Element?E.target:null)?.closest("a[href]"),fe=ee&&L.contains(ee);fe&&(E.preventDefault(),E.stopPropagation()),setTimeout(()=>{e.isDestroyed||(fe||e.isActive("link"))&&(k(e.getAttributes("link").href??ee?.getAttribute("href")??""),x(!0))},0)};return L.addEventListener("click",ne),()=>L.removeEventListener("click",ne)},[e]),K.useEffect(()=>{if(!e)return;const L=()=>{B(E=>E+1),C(zc(e));const ne=e.getAttributes("textStyle").fontFamily??"";I(ne)};return L(),e.on("selectionUpdate",L),e.on("transaction",L),e.on("update",L),()=>{e.off("selectionUpdate",L),e.off("transaction",L),e.off("update",L)}},[e]),!e)return null;const V=L=>{L.preventDefault()},_=()=>{for(let L=1;L<=5;L++)if(e.isActive("heading",{level:L}))return`h${L}`;return null},R=()=>e.isActive("bulletList")?"bullet":e.isActive("orderedList")?"ordered":e.isActive("taskList")?"task":null,z=L=>{const ne=parseInt(L.replace("h",""));e.chain().focus().toggleHeading({level:ne}).run()},W=L=>{L==="bullet"&&e.chain().focus().toggleBulletList().run(),L==="ordered"&&e.chain().focus().toggleOrderedList().run(),L==="task"&&e.chain().focus().toggleTaskList().run()},re=()=>{S.trim()?J().setLink({href:S}).run():J().unsetLink().run(),x(!1),k("")},se=L=>{J().setColor(L.textColor).setHighlight({color:L.backgroundColor}).run(),A(!1)},le=()=>{const L=dr(e.getAttributes("highlight").color),ne=si.some(U=>dr(U.backgroundColor)===L),E=J().unsetHighlight();ne&&E.unsetColor(),E.run(),A(!1)},te=(L=w)=>{const ne=ft(L);if(!ne)return;const E=rs(ne);J().setFontSize(E).run(),C(E)},G=L=>{const ne=e.getAttributes("textStyle").fontSize,E=ft(w)??ft(ne)??ft(Gn);if(!E)return;const U=ft(`${E.value+L*Do[E.unit].step}${E.unit}`);if(!U)return;const ee=rs(U);J().setFontSize(ee).run(),C(ee)},H=()=>{J().unsetFontSize().run(),C("")},J=()=>{const L=e.chain().focus(),ne=IC(e);return ne?L.setTextSelection(ne):L},oe=L=>{let ne=e.chain().focus();if(L.id==="normal"){ne.clearNodes().unsetAllMarks().setParagraph().run();return}L.type==="heading"&&L.level?ne=ne.setHeading({level:L.level}):L.type==="blockquote"?ne=ne.setBlockquote():ne=ne.setParagraph();const E={};L.fontFamily&&(E.fontFamily=L.fontFamily),L.fontSize&&(E.fontSize=L.fontSize),L.fontWeight&&(E.fontWeight=L.fontWeight),L.fontStyle&&(E.fontStyle=L.fontStyle),L.letterSpacing&&(E.letterSpacing=L.letterSpacing),L.lineHeight&&(E.lineHeight=L.lineHeight),L.textTransform&&(E.textTransform=L.textTransform),Object.keys(E).length>0&&(ne=ne.setMark("textStyle",E)),L.color&&(ne=ne.setColor(L.color)),ne.run()},ge=()=>{if(!p.length)return null;const{$from:L}=e.state.selection,ne=L.parent;return p.find(E=>E.type==="heading"&&E.level?ne.type.name==="heading"&&ne.attrs.level===E.level:E.type==="blockquote"?e.isActive("blockquote"):ne.type.name==="paragraph")??null},Ce=L=>{L?J().setFontFamily(L).run():J().unsetFontFamily().run(),I(L),F(!1),j("")},ve=[{label:"Default",value:""},{label:"Inter",value:"Inter, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:"Times New Roman, Times, serif"},{label:"Courier New",value:"Courier New, Courier, monospace"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Impact",value:"Impact, fantasy"}],we=O.trim()?ve.filter(L=>L.label.toLowerCase().includes(O.toLowerCase())):ve,Ee=e.getAttributes("textStyle").fontFamily??"",st=ve.find(L=>L.value===Ee)?.label??(Ee?Ee.split(",")[0].trim():""),Xe=async L=>{const ne=L.target.files?.[0];if(!(!ne||!t)){try{const{url:E}=await t(ne);ne.type.startsWith("video/")?e.chain().focus().setNode("video",{src:E}).run():e.chain().focus().setAdvancedImage({src:E}).run()}catch(E){console.error("Upload failed:",E)}l.current&&(l.current.value="")}},qe=()=>{i?.(c==="dark"?"light":"dark")},ye=({isActive:L,onClick:ne,tooltip:E,disabled:U=!1,children:ee})=>h.jsx(kt,{content:E,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:ne,disabled:U,"aria-label":E,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",!U&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),L&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),L&&o?.toolbarButtonActive,U&&"opacity-30 cursor-not-allowed",U&&o?.toolbarButtonDisabled,o?.toolbarButton),children:h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:ee})})}),Re=()=>h.jsx("span",{className:M("shrink-0 w-[1px] h-4 mx-1",c==="dark"?"bg-white/10":"bg-black/8",o?.toolbarSeparator)}),Pe=_(),Te=Pe?N.find(L=>L.value===Pe)?.label??u.heading:u.heading,_e=R(),Dt=_e?$.find(L=>L.value===_e)?.label??u.list:u.list,Vt=(L,ne,E)=>h.jsxs("button",{type:"button",onMouseDown:V,className:M("flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-full px-2.5 text-sm font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",E&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),E&&o?.toolbarTriggerActive,o?.toolbarTrigger),children:[h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarTriggerIcon),children:ne}),h.jsx("span",{className:M("hidden sm:inline max-w-[72px] truncate",o?.toolbarTriggerLabel),children:L}),h.jsx(q.ChevronDown,{size:12,className:M("opacity-50 shrink-0",o?.toolbarTriggerChevron)})]}),un=e.getAttributes("textStyle").fontSize,xe=ft(w)??ft(un)??ft(Gn),Je=xe?Do[xe.unit]:Do.px,qt=!!ft(un),to=dr(e.getAttributes("highlight").color),no=si.find(L=>dr(L.backgroundColor)===to),dn=e.isActive("highlight");return h.jsx("div",{className:M("relative z-20 shrink-0 border-b backdrop-blur-md transition-all",c==="dark"?"bg-neutral-900/95 border-white/8 text-neutral-400":"bg-white/95 border-black/6 text-neutral-500",o?.toolbar),children:h.jsxs("div",{className:M("flex w-full items-center gap-2 overflow-x-auto px-3 py-2 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",o?.toolbarInner),children:[h.jsx(Lo,{trigger:h.jsxs("button",{type:"button",onMouseDown:V,"aria-label":u.fontFamily,className:M("flex h-8 min-w-[100px] max-w-[140px] shrink-0 cursor-pointer items-center justify-between gap-1.5 rounded-full px-3 text-sm font-medium transition-colors",c==="dark"?"bg-white/[0.06] text-neutral-200 hover:bg-white/10":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200",Ee&&(c==="dark"?"ring-1 ring-white/20":"ring-1 ring-black/10"),o?.toolbarFontFamilyTrigger),children:[h.jsx("span",{className:"truncate",style:{fontFamily:Ee||"inherit"},children:st||u.fontFamily}),h.jsx(q.ChevronDown,{size:12,className:"shrink-0 opacity-50"})]}),open:D,onOpenChange:L=>{F(L),L||j("")},align:"start",children:h.jsxs("div",{className:M("flex flex-col w-52",o?.toolbarFontFamilyPopover),children:[h.jsx("div",{className:"mb-1.5",children:h.jsx("input",{type:"text",placeholder:"Search fonts...",value:O,onChange:L=>j(L.target.value),autoFocus:!0,className:M("w-full rounded-full border px-3 py-1.5 text-sm outline-none transition-colors",c==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",o?.toolbarFontFamilySearch)})}),h.jsxs("div",{className:M("flex flex-col gap-0.5 max-h-96 overflow-y-auto",o?.toolbarFontFamilyList),children:[we.map(L=>{const ne=(T||"")===L.value;return h.jsxs("button",{type:"button",onMouseDown:V,onClick:()=>Ce(L.value),className:M("flex w-full cursor-pointer items-center gap-2 rounded-full px-3 py-2 text-sm text-left transition-colors",c==="dark"?ne?"bg-white/15 text-neutral-100":"text-neutral-300 hover:bg-white/8 hover:text-neutral-100":ne?"bg-black/8 text-neutral-900":"text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900",o?.toolbarFontFamilyItem,ne&&o?.toolbarFontFamilyItemActive),children:[h.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-[10px]",style:{opacity:ne?1:0},children:"✓"}),h.jsx("span",{style:{fontFamily:L.value||"inherit"},children:L.label})]},L.value||"__default__")}),we.length===0&&h.jsx("p",{className:M("px-3 py-2 text-sm",c==="dark"?"text-neutral-500":"text-neutral-400"),children:u.noResults})]})]})}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{onClick:()=>e.chain().focus().undo().run(),disabled:!e.can().undo(),tooltip:u.undo,children:h.jsx(q.Undo2,{size:16})}),h.jsx(ye,{onClick:()=>e.chain().focus().redo().run(),disabled:!e.can().redo(),tooltip:u.redo,children:h.jsx(q.Redo2,{size:16})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(Dc,{trigger:Vt(Te,h.jsx(q.Type,{size:14}),!!Pe),items:N,value:_()??void 0,onSelect:z}),h.jsx(Dc,{trigger:Vt(Dt,h.jsx(q.List,{size:14}),!!_e),items:$,value:R()??void 0,onSelect:W}),h.jsx(ye,{isActive:e.isActive("blockquote"),onClick:()=>e.chain().focus().toggleBlockquote().run(),tooltip:u.quote,children:h.jsx(q.Quote,{size:16})}),h.jsx(ye,{isActive:e.isActive("codeBlock"),onClick:()=>e.chain().focus().toggleCodeBlock().run(),tooltip:u.codeBlock,children:h.jsx(q.Code2,{size:16})})]}),h.jsx(Re,{}),h.jsx("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:h.jsxs("div",{className:M("flex h-8 shrink-0 items-stretch overflow-hidden rounded-full text-sm font-medium transition-colors",c==="dark"?" text-neutral-200":" text-neutral-700",qt&&o?.toolbarFontSizeControlActive,o?.toolbarFontSizeControl),children:[h.jsx(kt,{content:u.decreaseFontSize,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>G(-1),disabled:!xe||xe.value<=Je.min,"aria-label":u.decreaseFontSize,className:M("flex w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-colors",c==="dark"?"border-white/5 text-neutral-400":"border-black/4 text-neutral-500",xe&&xe.value>Je.min&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),(!xe||xe.value<=Je.min)&&"cursor-not-allowed opacity-30",(!xe||xe.value<=Je.min)&&o?.toolbarButtonDisabled,o?.toolbarFontSizeStepButton),children:h.jsx(q.Minus,{size:14})})}),h.jsxs("label",{className:"flex items-center",children:[h.jsx("span",{className:"sr-only",children:u.fontSize}),h.jsx("input",{type:"text",inputMode:"decimal","aria-label":u.fontSize,value:w,placeholder:Gn,onChange:L=>C(L.target.value),onBlur:()=>{w.trim()?te():qt&&H()},onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),w.trim()?te():qt&&H()),L.key==="Escape"&&C(zc(e))},className:M("h-full w-15 bg-transparent px-2 text-center outline-none",c==="dark"?"placeholder:text-neutral-500":"placeholder:text-neutral-400",o?.toolbarFontSizeInput)})]}),h.jsx(kt,{content:u.increaseFontSize,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>G(1),disabled:!xe||xe.value>=Je.max,"aria-label":u.increaseFontSize,className:M("flex w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-colors",c==="dark"?"border-white/5 text-neutral-400":"border-black/4 text-neutral-500",xe&&xe.value<Je.max&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),(!xe||xe.value>=Je.max)&&"cursor-not-allowed opacity-30",(!xe||xe.value>=Je.max)&&o?.toolbarButtonDisabled,o?.toolbarFontSizeStepButton),children:h.jsx(q.Plus,{size:14})})})]})}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive("bold"),onClick:()=>J().toggleBold().run(),tooltip:u.bold,children:h.jsx(q.Bold,{size:16})}),h.jsx(ye,{isActive:e.isActive("italic"),onClick:()=>J().toggleItalic().run(),tooltip:u.italic,children:h.jsx(q.Italic,{size:16})}),h.jsx(ye,{isActive:e.isActive("strike"),onClick:()=>J().toggleStrike().run(),tooltip:u.strikethrough,children:h.jsx(q.Strikethrough,{size:16})}),h.jsx(ye,{isActive:e.isActive("code"),onClick:()=>J().toggleCode().run(),tooltip:u.inlineCode,children:h.jsx(q.Code,{size:16})}),h.jsx(ye,{isActive:e.isActive("underline"),onClick:()=>J().toggleUnderline().run(),tooltip:u.underline,children:h.jsx(q.Underline,{size:16})}),h.jsx(Lo,{trigger:h.jsxs("button",{type:"button",onMouseDown:V,"aria-label":u.highlight,className:M("relative flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900",dn&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),dn&&o?.toolbarButtonActive,o?.toolbarButton,o?.toolbarHighlightButton),children:[h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:h.jsx(q.Highlighter,{size:16})}),h.jsx("span",{className:M("absolute bottom-1 h-0.5 w-4 rounded-full",dn?"opacity-100":c==="dark"?"bg-neutral-600 opacity-70":"bg-neutral-300 opacity-80",o?.toolbarHighlightIndicator),style:no?{backgroundColor:no.backgroundColor}:void 0})]}),open:y,onOpenChange:A,align:"start",children:h.jsxs("div",{className:M("flex w-48 flex-col gap-2",o?.toolbarHighlightPopoverBody),children:[h.jsx("p",{className:M("text-xs font-semibold",c==="dark"?"text-neutral-400":"text-neutral-500",o?.toolbarHighlightPopoverLabel),children:u.highlightPalette}),h.jsx("div",{className:M("grid grid-cols-4 gap-1.5",o?.toolbarHighlightGrid),children:si.map(L=>{const ne=dr(L.backgroundColor)===to;return h.jsx(kt,{content:u[L.labelKey],children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>se(L),"aria-label":`${u.highlight}: ${u[L.labelKey]}`,className:M("flex h-9 w-9 cursor-pointer items-center justify-center rounded-full border text-sm font-bold transition-transform duration-150","hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",c==="dark"?"border-white/15":"border-black/10",ne&&(c==="dark"?"ring-2 ring-white/70":"ring-2 ring-neutral-900/70"),ne&&o?.toolbarHighlightSwatchActive,o?.toolbarHighlightSwatch),style:{backgroundColor:L.backgroundColor,color:L.textColor},children:"A"})},L.backgroundColor)})}),h.jsx("button",{type:"button",onMouseDown:V,onClick:le,disabled:!dn,className:M("h-8 rounded-full px-3 text-xs font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 disabled:text-neutral-600":"text-neutral-600 hover:bg-black/6 disabled:text-neutral-300",!dn&&"cursor-not-allowed",o?.toolbarHighlightClearButton),children:u.clearHighlight})]})}),h.jsx(Lo,{trigger:h.jsx("button",{type:"button",onMouseDown:V,"aria-label":u.link,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900",e.isActive("link")&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),e.isActive("link")&&o?.toolbarButtonActive,o?.toolbarButton,o?.toolbarLinkButton),children:h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:h.jsx(q.Link,{size:16})})}),open:b,onOpenChange:L=>{x(L),L&&k(e.getAttributes("link").href??"")},align:"start",children:h.jsxs("div",{className:M("flex flex-col gap-2 w-64",o?.toolbarLinkPopoverBody),children:[h.jsx("p",{className:M("text-xs font-semibold",c==="dark"?"text-neutral-400":"text-neutral-500",o?.toolbarLinkPopoverLabel),children:u.insertLink}),h.jsx("input",{type:"url",placeholder:u.linkPlaceholder,value:S,onChange:L=>k(L.target.value),onKeyDown:L=>L.key==="Enter"&&re(),autoFocus:!0,className:M("w-full px-3 py-2 text-sm rounded-xl border outline-none transition-colors",c==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",o?.toolbarLinkInput)}),h.jsxs("div",{className:M("flex gap-2",o?.toolbarLinkActions),children:[h.jsx("button",{type:"button",onMouseDown:V,onClick:re,className:M("flex-1 py-1.5 text-sm font-medium rounded-full transition-colors",c==="dark"?"bg-neutral-700 hover:bg-neutral-600 text-neutral-100":"bg-neutral-900 hover:bg-neutral-700 text-white",o?.toolbarLinkApplyButton),children:u.apply}),e.isActive("link")&&h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>{e.chain().focus().unsetLink().run(),x(!1)},className:M("px-3 py-1.5 text-sm rounded-full transition-colors",c==="dark"?"text-neutral-400 hover:bg-white/10":"text-neutral-500 hover:bg-black/6",o?.toolbarLinkUnlinkButton),children:h.jsx(q.Unlink,{size:14})})]})]})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive("superscript"),onClick:()=>J().toggleSuperscript().run(),tooltip:u.superscript,children:h.jsx(q.Superscript,{size:16})}),h.jsx(ye,{isActive:e.isActive("subscript"),onClick:()=>J().toggleSubscript().run(),tooltip:u.subscript,children:h.jsx(q.Subscript,{size:16})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive({textAlign:"left"}),onClick:()=>e.chain().focus().setTextAlign("left").run(),tooltip:u.alignLeft,children:h.jsx(q.AlignLeft,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"center"}),onClick:()=>e.chain().focus().setTextAlign("center").run(),tooltip:u.alignCenter,children:h.jsx(q.AlignCenter,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"right"}),onClick:()=>e.chain().focus().setTextAlign("right").run(),tooltip:u.alignRight,children:h.jsx(q.AlignRight,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"justify"}),onClick:()=>e.chain().focus().setTextAlign("justify").run(),tooltip:u.alignJustify,children:h.jsx(q.AlignJustify,{size:16})})]}),(!r||!n)&&t&&h.jsxs(h.Fragment,{children:[h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx("input",{type:"file",ref:l,className:M("hidden",o?.toolbarFileInput),accept:!r&&!n?"image/*,video/*":r?"video/*":"image/*",onChange:Xe}),h.jsx(kt,{content:u.uploadMedia,children:h.jsxs("button",{type:"button",onMouseDown:V,onClick:()=>l.current?.click(),className:M("flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-full px-3 text-sm font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",o?.toolbarUploadButton),children:[h.jsx(q.Upload,{size:14,className:o?.toolbarUploadIcon}),h.jsx("span",{className:M("hidden sm:inline",o?.toolbarUploadLabel),children:u.upload})]})})]})]}),h.jsx(Re,{}),h.jsx(TC,{styles:p,baseStyles:f,editor:e,theme:c,classNames:o,activeStyle:ge(),onApply:oe,onSave:m,onReset:g,keepEditorSelection:V}),h.jsx("div",{className:"ml-auto shrink-0"}),a&&h.jsx("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-100",o?.toolbarGroup),children:h.jsx(kt,{content:c==="dark"?u.lightTheme:u.darkTheme,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:qe,"aria-label":u.toggleTheme,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",o?.toolbarButton),children:c==="dark"?h.jsx(q.Sun,{size:16}):h.jsx(q.Moon,{size:16})})})})]})})};function PC(e){var t;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:a}=e,l=r&&!o,c=P.escapeForRegEx(n),u=new RegExp(`\\s${c}$`),d=i?"^":"",f=o?"":c,p=l?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),m=((t=a.nodeBefore)==null?void 0:t.isText)&&a.nodeBefore.text;if(!m)return null;const g=a.pos-m.length,b=Array.from(m.matchAll(p)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const x=b.input.slice(Math.max(0,b.index-1),b.index),S=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!S)return null;const k=g+b.index;let y=k+b[0].length;return l&&u.test(m.slice(y-1,y+1))&&(b[0]+=" ",y+=1),k<a.pos&&y>=a.pos?{range:{from:k,to:y},query:b[0].slice(n.length),text:b[0]}:null}function LC(e){return e.docChanged?e.steps.some(t=>{const n=t.slice;if(!n?.content)return!1;const r=n.content.textBetween(0,n.content.size,`
128
+ `);if(!r)return null;const o=n.parentOffset,s=o>0&&So.test(r[o-1]??"")?o-1:o;if(!So.test(r[s]??""))return null;let i=s,a=s+1;for(;i>0&&So.test(r[i-1]??"");)i-=1;for(;a<r.length&&So.test(r[a]??"");)a+=1;return{from:n.start()+i,to:n.start()+a}},Xp=({editor:e,onUpload:t,disableVideoUpload:n,disableImageUpload:r,classNames:o,styles:s,onThemeChange:i,showThemeToggle:a=!0})=>{const l=K.useRef(null),c=We(),u=Vr(),d=i0(),f=s??d??[],{effectiveStyles:p,saveOverride:m,resetOverride:g}=EC(f),[b,x]=K.useState(!1),[S,k]=K.useState(""),[y,A]=K.useState(!1),[w,C]=K.useState(""),[T,I]=K.useState(""),[O,j]=K.useState(""),[D,F]=K.useState(!1),[,B]=K.useState(0),N=MC(u),$=RC(u);if(K.useEffect(()=>{if(!e)return;const L=e.view.dom,ne=E=>{const ee=(E.target instanceof Element?E.target:null)?.closest("a[href]"),fe=ee&&L.contains(ee);fe&&(E.preventDefault(),E.stopPropagation()),setTimeout(()=>{e.isDestroyed||(fe||e.isActive("link"))&&(k(e.getAttributes("link").href??ee?.getAttribute("href")??""),x(!0))},0)};return L.addEventListener("click",ne),()=>L.removeEventListener("click",ne)},[e]),K.useEffect(()=>{if(!e)return;const L=()=>{B(E=>E+1),C(zc(e));const ne=e.getAttributes("textStyle").fontFamily??"";I(ne)};return L(),e.on("selectionUpdate",L),e.on("transaction",L),e.on("update",L),()=>{e.off("selectionUpdate",L),e.off("transaction",L),e.off("update",L)}},[e]),!e)return null;const V=L=>{L.preventDefault()},_=()=>{for(let L=1;L<=5;L++)if(e.isActive("heading",{level:L}))return`h${L}`;return null},R=()=>e.isActive("bulletList")?"bullet":e.isActive("orderedList")?"ordered":e.isActive("taskList")?"task":null,z=L=>{const ne=parseInt(L.replace("h",""));e.chain().focus().toggleHeading({level:ne}).run()},W=L=>{L==="bullet"&&e.chain().focus().toggleBulletList().run(),L==="ordered"&&e.chain().focus().toggleOrderedList().run(),L==="task"&&e.chain().focus().toggleTaskList().run()},re=()=>{S.trim()?J().setLink({href:S}).run():J().unsetLink().run(),x(!1),k("")},se=L=>{J().setColor(L.textColor).setHighlight({color:L.backgroundColor}).run(),A(!1)},le=()=>{const L=dr(e.getAttributes("highlight").color),ne=si.some(U=>dr(U.backgroundColor)===L),E=J().unsetHighlight();ne&&E.unsetColor(),E.run(),A(!1)},te=(L=w)=>{const ne=ft(L);if(!ne)return;const E=rs(ne);J().setFontSize(E).run(),C(E)},G=L=>{const ne=e.getAttributes("textStyle").fontSize,E=ft(w)??ft(ne)??ft(Gn);if(!E)return;const U=ft(`${E.value+L*Do[E.unit].step}${E.unit}`);if(!U)return;const ee=rs(U);J().setFontSize(ee).run(),C(ee)},H=()=>{J().unsetFontSize().run(),C("")},J=()=>{const L=e.chain().focus(),ne=IC(e);return ne?L.setTextSelection(ne):L},oe=L=>{let ne=e.chain().focus();if(L.id==="normal"){ne.clearNodes().unsetAllMarks().setParagraph().run();return}L.type==="heading"&&L.level?ne=ne.setHeading({level:L.level}):L.type==="blockquote"?ne=ne.setBlockquote():ne=ne.setParagraph();const E={};L.fontFamily&&(E.fontFamily=L.fontFamily),L.fontSize&&(E.fontSize=L.fontSize),L.fontWeight&&(E.fontWeight=L.fontWeight),L.fontStyle&&(E.fontStyle=L.fontStyle),L.letterSpacing&&(E.letterSpacing=L.letterSpacing),L.lineHeight&&(E.lineHeight=L.lineHeight),L.textTransform&&(E.textTransform=L.textTransform),Object.keys(E).length>0&&(ne=ne.setMark("textStyle",E)),L.color&&(ne=ne.setColor(L.color)),ne.run()},ge=()=>{if(!p.length)return null;const{$from:L}=e.state.selection,ne=L.parent;return p.find(E=>E.type==="heading"&&E.level?ne.type.name==="heading"&&ne.attrs.level===E.level:E.type==="blockquote"?e.isActive("blockquote"):ne.type.name==="paragraph")??null},Ce=L=>{L?J().setFontFamily(L).run():J().unsetFontFamily().run(),I(L),F(!1),j("")},ve=[{label:"Default",value:""},{label:"Inter",value:"Inter, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:"Times New Roman, Times, serif"},{label:"Courier New",value:"Courier New, Courier, monospace"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Impact",value:"Impact, fantasy"}],we=O.trim()?ve.filter(L=>L.label.toLowerCase().includes(O.toLowerCase())):ve,Ee=e.getAttributes("textStyle").fontFamily??"",st=ve.find(L=>L.value===Ee)?.label??(Ee?Ee.split(",")[0].trim():""),Xe=async L=>{const ne=L.target.files?.[0];if(!ne||!t)return;const E=ne.type.startsWith("video/"),U=ne.type.startsWith("image/");if(E&&n||U&&r||!E&&!U){l.current&&(l.current.value="");return}try{const{url:ee}=await t(ne);E?e.chain().focus().setVideo({src:ee}).run():e.chain().focus().setAdvancedImage({src:ee}).run()}catch(ee){console.error("Upload failed:",ee)}l.current&&(l.current.value="")},qe=()=>{i?.(c==="dark"?"light":"dark")},ye=({isActive:L,onClick:ne,tooltip:E,disabled:U=!1,children:ee})=>h.jsx(kt,{content:E,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:ne,disabled:U,"aria-label":E,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",!U&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),L&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),L&&o?.toolbarButtonActive,U&&"opacity-30 cursor-not-allowed",U&&o?.toolbarButtonDisabled,o?.toolbarButton),children:h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:ee})})}),Re=()=>h.jsx("span",{className:M("shrink-0 w-[1px] h-4 mx-1",c==="dark"?"bg-white/10":"bg-black/8",o?.toolbarSeparator)}),Pe=_(),Te=Pe?N.find(L=>L.value===Pe)?.label??u.heading:u.heading,_e=R(),Dt=_e?$.find(L=>L.value===_e)?.label??u.list:u.list,Vt=(L,ne,E)=>h.jsxs("button",{type:"button",onMouseDown:V,className:M("flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-full px-2.5 text-sm font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",E&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),E&&o?.toolbarTriggerActive,o?.toolbarTrigger),children:[h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarTriggerIcon),children:ne}),h.jsx("span",{className:M("hidden sm:inline max-w-[72px] truncate",o?.toolbarTriggerLabel),children:L}),h.jsx(q.ChevronDown,{size:12,className:M("opacity-50 shrink-0",o?.toolbarTriggerChevron)})]}),un=e.getAttributes("textStyle").fontSize,xe=ft(w)??ft(un)??ft(Gn),Je=xe?Do[xe.unit]:Do.px,qt=!!ft(un),to=dr(e.getAttributes("highlight").color),no=si.find(L=>dr(L.backgroundColor)===to),dn=e.isActive("highlight");return h.jsx("div",{className:M("relative z-20 shrink-0 border-b backdrop-blur-md transition-all",c==="dark"?"bg-neutral-900/95 border-white/8 text-neutral-400":"bg-white/95 border-black/6 text-neutral-500",o?.toolbar),children:h.jsxs("div",{className:M("flex w-full items-center gap-2 overflow-x-auto px-3 py-2 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",o?.toolbarInner),children:[h.jsx(Lo,{trigger:h.jsxs("button",{type:"button",onMouseDown:V,"aria-label":u.fontFamily,className:M("flex h-8 min-w-[100px] max-w-[140px] shrink-0 cursor-pointer items-center justify-between gap-1.5 rounded-full px-3 text-sm font-medium transition-colors",c==="dark"?"bg-white/[0.06] text-neutral-200 hover:bg-white/10":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200",Ee&&(c==="dark"?"ring-1 ring-white/20":"ring-1 ring-black/10"),o?.toolbarFontFamilyTrigger),children:[h.jsx("span",{className:"truncate",style:{fontFamily:Ee||"inherit"},children:st||u.fontFamily}),h.jsx(q.ChevronDown,{size:12,className:"shrink-0 opacity-50"})]}),open:D,onOpenChange:L=>{F(L),L||j("")},align:"start",children:h.jsxs("div",{className:M("flex flex-col w-52",o?.toolbarFontFamilyPopover),children:[h.jsx("div",{className:"mb-1.5",children:h.jsx("input",{type:"text",placeholder:"Search fonts...",value:O,onChange:L=>j(L.target.value),autoFocus:!0,className:M("w-full rounded-full border px-3 py-1.5 text-sm outline-none transition-colors",c==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",o?.toolbarFontFamilySearch)})}),h.jsxs("div",{className:M("flex flex-col gap-0.5 max-h-96 overflow-y-auto",o?.toolbarFontFamilyList),children:[we.map(L=>{const ne=(T||"")===L.value;return h.jsxs("button",{type:"button",onMouseDown:V,onClick:()=>Ce(L.value),className:M("flex w-full cursor-pointer items-center gap-2 rounded-full px-3 py-2 text-sm text-left transition-colors",c==="dark"?ne?"bg-white/15 text-neutral-100":"text-neutral-300 hover:bg-white/8 hover:text-neutral-100":ne?"bg-black/8 text-neutral-900":"text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900",o?.toolbarFontFamilyItem,ne&&o?.toolbarFontFamilyItemActive),children:[h.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-[10px]",style:{opacity:ne?1:0},children:"✓"}),h.jsx("span",{style:{fontFamily:L.value||"inherit"},children:L.label})]},L.value||"__default__")}),we.length===0&&h.jsx("p",{className:M("px-3 py-2 text-sm",c==="dark"?"text-neutral-500":"text-neutral-400"),children:u.noResults})]})]})}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{onClick:()=>e.chain().focus().undo().run(),disabled:!e.can().undo(),tooltip:u.undo,children:h.jsx(q.Undo2,{size:16})}),h.jsx(ye,{onClick:()=>e.chain().focus().redo().run(),disabled:!e.can().redo(),tooltip:u.redo,children:h.jsx(q.Redo2,{size:16})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(Dc,{trigger:Vt(Te,h.jsx(q.Type,{size:14}),!!Pe),items:N,value:_()??void 0,onSelect:z}),h.jsx(Dc,{trigger:Vt(Dt,h.jsx(q.List,{size:14}),!!_e),items:$,value:R()??void 0,onSelect:W}),h.jsx(ye,{isActive:e.isActive("blockquote"),onClick:()=>e.chain().focus().toggleBlockquote().run(),tooltip:u.quote,children:h.jsx(q.Quote,{size:16})}),h.jsx(ye,{isActive:e.isActive("codeBlock"),onClick:()=>e.chain().focus().toggleCodeBlock().run(),tooltip:u.codeBlock,children:h.jsx(q.Code2,{size:16})})]}),h.jsx(Re,{}),h.jsx("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:h.jsxs("div",{className:M("flex h-8 shrink-0 items-stretch overflow-hidden rounded-full text-sm font-medium transition-colors",c==="dark"?" text-neutral-200":" text-neutral-700",qt&&o?.toolbarFontSizeControlActive,o?.toolbarFontSizeControl),children:[h.jsx(kt,{content:u.decreaseFontSize,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>G(-1),disabled:!xe||xe.value<=Je.min,"aria-label":u.decreaseFontSize,className:M("flex w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-colors",c==="dark"?"border-white/5 text-neutral-400":"border-black/4 text-neutral-500",xe&&xe.value>Je.min&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),(!xe||xe.value<=Je.min)&&"cursor-not-allowed opacity-30",(!xe||xe.value<=Je.min)&&o?.toolbarButtonDisabled,o?.toolbarFontSizeStepButton),children:h.jsx(q.Minus,{size:14})})}),h.jsxs("label",{className:"flex items-center",children:[h.jsx("span",{className:"sr-only",children:u.fontSize}),h.jsx("input",{type:"text",inputMode:"decimal","aria-label":u.fontSize,value:w,placeholder:Gn,onChange:L=>C(L.target.value),onBlur:()=>{w.trim()?te():qt&&H()},onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),w.trim()?te():qt&&H()),L.key==="Escape"&&C(zc(e))},className:M("h-full w-15 bg-transparent px-2 text-center outline-none",c==="dark"?"placeholder:text-neutral-500":"placeholder:text-neutral-400",o?.toolbarFontSizeInput)})]}),h.jsx(kt,{content:u.increaseFontSize,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>G(1),disabled:!xe||xe.value>=Je.max,"aria-label":u.increaseFontSize,className:M("flex w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-colors",c==="dark"?"border-white/5 text-neutral-400":"border-black/4 text-neutral-500",xe&&xe.value<Je.max&&(c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),(!xe||xe.value>=Je.max)&&"cursor-not-allowed opacity-30",(!xe||xe.value>=Je.max)&&o?.toolbarButtonDisabled,o?.toolbarFontSizeStepButton),children:h.jsx(q.Plus,{size:14})})})]})}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive("bold"),onClick:()=>J().toggleBold().run(),tooltip:u.bold,children:h.jsx(q.Bold,{size:16})}),h.jsx(ye,{isActive:e.isActive("italic"),onClick:()=>J().toggleItalic().run(),tooltip:u.italic,children:h.jsx(q.Italic,{size:16})}),h.jsx(ye,{isActive:e.isActive("strike"),onClick:()=>J().toggleStrike().run(),tooltip:u.strikethrough,children:h.jsx(q.Strikethrough,{size:16})}),h.jsx(ye,{isActive:e.isActive("code"),onClick:()=>J().toggleCode().run(),tooltip:u.inlineCode,children:h.jsx(q.Code,{size:16})}),h.jsx(ye,{isActive:e.isActive("underline"),onClick:()=>J().toggleUnderline().run(),tooltip:u.underline,children:h.jsx(q.Underline,{size:16})}),h.jsx(Lo,{trigger:h.jsxs("button",{type:"button",onMouseDown:V,"aria-label":u.highlight,className:M("relative flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900",dn&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),dn&&o?.toolbarButtonActive,o?.toolbarButton,o?.toolbarHighlightButton),children:[h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:h.jsx(q.Highlighter,{size:16})}),h.jsx("span",{className:M("absolute bottom-1 h-0.5 w-4 rounded-full",dn?"opacity-100":c==="dark"?"bg-neutral-600 opacity-70":"bg-neutral-300 opacity-80",o?.toolbarHighlightIndicator),style:no?{backgroundColor:no.backgroundColor}:void 0})]}),open:y,onOpenChange:A,align:"start",children:h.jsxs("div",{className:M("flex w-48 flex-col gap-2",o?.toolbarHighlightPopoverBody),children:[h.jsx("p",{className:M("text-xs font-semibold",c==="dark"?"text-neutral-400":"text-neutral-500",o?.toolbarHighlightPopoverLabel),children:u.highlightPalette}),h.jsx("div",{className:M("grid grid-cols-4 gap-1.5",o?.toolbarHighlightGrid),children:si.map(L=>{const ne=dr(L.backgroundColor)===to;return h.jsx(kt,{content:u[L.labelKey],children:h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>se(L),"aria-label":`${u.highlight}: ${u[L.labelKey]}`,className:M("flex h-9 w-9 cursor-pointer items-center justify-center rounded-full border text-sm font-bold transition-transform duration-150","hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",c==="dark"?"border-white/15":"border-black/10",ne&&(c==="dark"?"ring-2 ring-white/70":"ring-2 ring-neutral-900/70"),ne&&o?.toolbarHighlightSwatchActive,o?.toolbarHighlightSwatch),style:{backgroundColor:L.backgroundColor,color:L.textColor},children:"A"})},L.backgroundColor)})}),h.jsx("button",{type:"button",onMouseDown:V,onClick:le,disabled:!dn,className:M("h-8 rounded-full px-3 text-xs font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 disabled:text-neutral-600":"text-neutral-600 hover:bg-black/6 disabled:text-neutral-300",!dn&&"cursor-not-allowed",o?.toolbarHighlightClearButton),children:u.clearHighlight})]})}),h.jsx(Lo,{trigger:h.jsx("button",{type:"button",onMouseDown:V,"aria-label":u.link,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-400":"text-neutral-500",c==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900",e.isActive("link")&&(c==="dark"?"bg-white/15 text-neutral-100":"bg-black/8 text-neutral-900"),e.isActive("link")&&o?.toolbarButtonActive,o?.toolbarButton,o?.toolbarLinkButton),children:h.jsx("span",{className:M("flex items-center justify-center",o?.toolbarButtonIcon),children:h.jsx(q.Link,{size:16})})}),open:b,onOpenChange:L=>{x(L),L&&k(e.getAttributes("link").href??"")},align:"start",children:h.jsxs("div",{className:M("flex flex-col gap-2 w-64",o?.toolbarLinkPopoverBody),children:[h.jsx("p",{className:M("text-xs font-semibold",c==="dark"?"text-neutral-400":"text-neutral-500",o?.toolbarLinkPopoverLabel),children:u.insertLink}),h.jsx("input",{type:"url",placeholder:u.linkPlaceholder,value:S,onChange:L=>k(L.target.value),onKeyDown:L=>L.key==="Enter"&&re(),autoFocus:!0,className:M("w-full px-3 py-2 text-sm rounded-xl border outline-none transition-colors",c==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",o?.toolbarLinkInput)}),h.jsxs("div",{className:M("flex gap-2",o?.toolbarLinkActions),children:[h.jsx("button",{type:"button",onMouseDown:V,onClick:re,className:M("flex-1 py-1.5 text-sm font-medium rounded-full transition-colors",c==="dark"?"bg-neutral-700 hover:bg-neutral-600 text-neutral-100":"bg-neutral-900 hover:bg-neutral-700 text-white",o?.toolbarLinkApplyButton),children:u.apply}),e.isActive("link")&&h.jsx("button",{type:"button",onMouseDown:V,onClick:()=>{e.chain().focus().unsetLink().run(),x(!1)},className:M("px-3 py-1.5 text-sm rounded-full transition-colors",c==="dark"?"text-neutral-400 hover:bg-white/10":"text-neutral-500 hover:bg-black/6",o?.toolbarLinkUnlinkButton),children:h.jsx(q.Unlink,{size:14})})]})]})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive("superscript"),onClick:()=>J().toggleSuperscript().run(),tooltip:u.superscript,children:h.jsx(q.Superscript,{size:16})}),h.jsx(ye,{isActive:e.isActive("subscript"),onClick:()=>J().toggleSubscript().run(),tooltip:u.subscript,children:h.jsx(q.Subscript,{size:16})})]}),h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx(ye,{isActive:e.isActive({textAlign:"left"}),onClick:()=>e.chain().focus().setTextAlign("left").run(),tooltip:u.alignLeft,children:h.jsx(q.AlignLeft,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"center"}),onClick:()=>e.chain().focus().setTextAlign("center").run(),tooltip:u.alignCenter,children:h.jsx(q.AlignCenter,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"right"}),onClick:()=>e.chain().focus().setTextAlign("right").run(),tooltip:u.alignRight,children:h.jsx(q.AlignRight,{size:16})}),h.jsx(ye,{isActive:e.isActive({textAlign:"justify"}),onClick:()=>e.chain().focus().setTextAlign("justify").run(),tooltip:u.alignJustify,children:h.jsx(q.AlignJustify,{size:16})})]}),(!r||!n)&&t&&h.jsxs(h.Fragment,{children:[h.jsx(Re,{}),h.jsxs("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-50",o?.toolbarGroup),children:[h.jsx("input",{type:"file",ref:l,className:M("hidden",o?.toolbarFileInput),accept:!r&&!n?"image/*,video/*":r?"video/*":"image/*",onChange:Xe}),h.jsx(kt,{content:u.uploadMedia,children:h.jsxs("button",{type:"button",onMouseDown:V,onClick:()=>l.current?.click(),className:M("flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-full px-3 text-sm font-medium transition-colors",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",o?.toolbarUploadButton),children:[h.jsx(q.Upload,{size:14,className:o?.toolbarUploadIcon}),h.jsx("span",{className:M("hidden sm:inline",o?.toolbarUploadLabel),children:u.upload})]})})]})]}),h.jsx(Re,{}),h.jsx(TC,{styles:p,baseStyles:f,editor:e,theme:c,classNames:o,activeStyle:ge(),onApply:oe,onSave:m,onReset:g,keepEditorSelection:V}),h.jsx("div",{className:"ml-auto shrink-0"}),a&&h.jsx("div",{className:M("flex shrink-0 items-center gap-0.5 rounded-full p-0.5",c==="dark"?"bg-white/[0.06]":"bg-neutral-100",o?.toolbarGroup),children:h.jsx(kt,{content:c==="dark"?u.lightTheme:u.darkTheme,children:h.jsx("button",{type:"button",onMouseDown:V,onClick:qe,"aria-label":u.toggleTheme,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors duration-150",c==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",o?.toolbarButton),children:c==="dark"?h.jsx(q.Sun,{size:16}):h.jsx(q.Moon,{size:16})})})})]})})};function PC(e){var t;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:a}=e,l=r&&!o,c=P.escapeForRegEx(n),u=new RegExp(`\\s${c}$`),d=i?"^":"",f=o?"":c,p=l?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),m=((t=a.nodeBefore)==null?void 0:t.isText)&&a.nodeBefore.text;if(!m)return null;const g=a.pos-m.length,b=Array.from(m.matchAll(p)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const x=b.input.slice(Math.max(0,b.index-1),b.index),S=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!S)return null;const k=g+b.index;let y=k+b[0].length;return l&&u.test(m.slice(y-1,y+1))&&(b[0]+=" ",y+=1),k<a.pos&&y>=a.pos?{range:{from:k,to:y},query:b[0].slice(n.length),text:b[0]}:null}function LC(e){return e.docChanged?e.steps.some(t=>{const n=t.slice;if(!n?.content)return!1;const r=n.content.textBetween(0,n.content.size,`
129
129
  `);return/\s/.test(r)}):!1}var DC=new ds("suggestion");function jC({pluginKey:e=DC,editor:t,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=PC,shouldShow:b,shouldResetDismissed:x}){let S;const k=p?.(),y=r&&!o,A=()=>{const O=t.state.selection.$anchor.pos,j=t.view.coordsAtPos(O),{top:D,right:F,bottom:B,left:N}=j;try{return new DOMRect(N,D,F-N,B-D)}catch{return null}},w=(O,j)=>j?()=>{const D=e.getState(t.state),F=D?.decorationId,B=O.dom.querySelector(`[data-decoration-id="${F}"]`);return B?.getBoundingClientRect()||null}:A,C=({match:O,dismissedRange:j,state:D,transaction:F})=>x?.({editor:t,state:D,range:j,match:O,transaction:F,allowSpaces:y})?!1:y?O.range.from===j.from:O.range.from===j.from&&!LC(F);function T(O,j){var D;try{const B=e.getState(O.state),N=B?.decorationId?O.dom.querySelector(`[data-decoration-id="${B.decorationId}"]`):null,$={editor:t,range:B?.range||{from:0,to:0},query:B?.query||null,text:B?.text||null,items:[],command:V=>d({editor:t,range:B?.range||{from:0,to:0},props:V}),decorationNode:N,clientRect:w(O,N)};(D=k?.onExit)==null||D.call(k,$)}catch{}const F=O.state.tr.setMeta(j,{exit:!0});O.dispatch(F)}const I=new ha({key:e,view(){return{update:async(O,j)=>{var D,F,B,N,$,V,_;const R=(D=this.key)==null?void 0:D.getState(j),z=(F=this.key)==null?void 0:F.getState(O.state),W=R.active&&z.active&&R.range.from!==z.range.from,re=!R.active&&z.active,se=R.active&&!z.active,le=!re&&!se&&R.query!==z.query,te=re||W&&le,G=le||W,H=se||W&&le;if(!te&&!G&&!H)return;const J=H&&!te?R:z,oe=O.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);S={editor:t,range:J.range,query:J.query,text:J.text,items:[],command:ge=>d({editor:t,range:J.range,props:ge}),decorationNode:oe,clientRect:w(O,oe)},te&&((B=k?.onBeforeStart)==null||B.call(k,S)),G&&((N=k?.onBeforeUpdate)==null||N.call(k,S)),(G||te)&&(S.items=await f({editor:t,query:J.query})),H&&(($=k?.onExit)==null||$.call(k,S)),G&&((V=k?.onUpdate)==null||V.call(k,S)),te&&((_=k?.onStart)==null||_.call(k,S))},destroy:()=>{var O;S&&((O=k?.onExit)==null||O.call(k,S))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(O,j,D,F){const{isEditable:B}=t,{composing:N}=t.view,{selection:$}=O,{empty:V,from:_}=$,R={...j},z=O.getMeta(e);if(z&&z.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R.dismissedRange=j.active?{...j.range}:j.dismissedRange,R;if(R.composing=N,O.docChanged&&R.dismissedRange!==null&&(R.dismissedRange={from:O.mapping.map(R.dismissedRange.from),to:O.mapping.map(R.dismissedRange.to)}),B&&(V||t.view.composing)){(_<j.range.from||_>j.range.to)&&!N&&!j.composing&&(R.active=!1);const W=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:i,$position:$.$from}),re=`id_${Math.floor(Math.random()*4294967295)}`;W&&m({editor:t,state:F,range:W.range,isActive:j.active})&&(!b||b({editor:t,range:W.range,query:W.query,text:W.text,transaction:O}))?(R.dismissedRange!==null&&!C({match:W,dismissedRange:R.dismissedRange,state:F,transaction:O})&&(R.dismissedRange=null),R.dismissedRange===null?(R.active=!0,R.decorationId=j.decorationId?j.decorationId:re,R.range=W.range,R.query=W.query,R.text=W.text):R.active=!1):(W||(R.dismissedRange=null),R.active=!1)}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(O,j){var D,F;const{active:B,range:N}=I.getState(O.state);if(!B)return!1;if(j.key==="Escape"||j.key==="Esc"){const V=I.getState(O.state);return(D=k?.onKeyDown)==null||D.call(k,{view:O,event:j,range:V.range}),T(O,e),!0}return((F=k?.onKeyDown)==null?void 0:F.call(k,{view:O,event:j,range:N}))||!1},decorations(O){const{active:j,range:D,decorationId:F,query:B}=I.getState(O);if(!j)return null;const N=!B?.length,$=[l];return N&&$.push(u),Se.create(O.doc,[tt.inline(D.from,D.to,{nodeName:a,class:$.join(" "),"data-decoration-id":F,"data-decoration-content":c})])}}});return I}var zC=jC,Ue="top",ut="bottom",dt="right",Ge="left",Ja="auto",Qr=[Ue,ut,dt,Ge],er="start",Dr="end",_C="clippingParents",Jp="viewport",fr="popper",$C="reference",_c=Qr.reduce(function(e,t){return e.concat([t+"-"+er,t+"-"+Dr])},[]),Yp=[].concat(Qr,[Ja]).reduce(function(e,t){return e.concat([t,t+"-"+er,t+"-"+Dr])},[]),FC="beforeRead",BC="read",HC="afterRead",WC="beforeMain",VC="main",qC="afterMain",KC="beforeWrite",UC="write",GC="afterWrite",XC=[FC,BC,HC,WC,VC,qC,KC,UC,GC];function It(e){return e?(e.nodeName||"").toLowerCase():null}function ot(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function An(e){var t=ot(e).Element;return e instanceof t||e instanceof Element}function ct(e){var t=ot(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ya(e){if(typeof ShadowRoot>"u")return!1;var t=ot(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function JC(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!ct(s)||!It(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var a=o[i];a===!1?s.removeAttribute(i):s.setAttribute(i,a===!0?"":a)}))})}function YC(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=i.reduce(function(l,c){return l[c]="",l},{});!ct(o)||!It(o)||(Object.assign(o.style,a),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const Qp={name:"applyStyles",enabled:!0,phase:"write",fn:JC,effect:YC,requires:["computeStyles"]};function Rt(e){return e.split("-")[0]}var vn=Math.max,os=Math.min,tr=Math.round;function Ui(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Zp(){return!/^((?!chrome|android).)*safari/i.test(Ui())}function nr(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&ct(e)&&(o=e.offsetWidth>0&&tr(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&tr(r.height)/e.offsetHeight||1);var i=An(e)?ot(e):window,a=i.visualViewport,l=!Zp()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/o,u=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/o,f=r.height/s;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function Qa(e){var t=nr(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function eh(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ya(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Bt(e){return ot(e).getComputedStyle(e)}function QC(e){return["table","td","th"].indexOf(It(e))>=0}function cn(e){return((An(e)?e.ownerDocument:e.document)||window.document).documentElement}function As(e){return It(e)==="html"?e:e.assignedSlot||e.parentNode||(Ya(e)?e.host:null)||cn(e)}function $c(e){return!ct(e)||Bt(e).position==="fixed"?null:e.offsetParent}function ZC(e){var t=/firefox/i.test(Ui()),n=/Trident/i.test(Ui());if(n&&ct(e)){var r=Bt(e);if(r.position==="fixed")return null}var o=As(e);for(Ya(o)&&(o=o.host);ct(o)&&["html","body"].indexOf(It(o))<0;){var s=Bt(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Zr(e){for(var t=ot(e),n=$c(e);n&&QC(n)&&Bt(n).position==="static";)n=$c(n);return n&&(It(n)==="html"||It(n)==="body"&&Bt(n).position==="static")?t:n||ZC(e)||t}function Za(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kr(e,t,n){return vn(e,os(t,n))}function eS(e,t,n){var r=kr(e,t,n);return r>n?n:r}function th(){return{top:0,right:0,bottom:0,left:0}}function nh(e){return Object.assign({},th(),e)}function rh(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var tS=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,nh(typeof t!="number"?t:rh(t,Qr))};function nS(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,a=Rt(n.placement),l=Za(a),c=[Ge,dt].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!i)){var d=tS(o.padding,n),f=Qa(s),p=l==="y"?Ue:Ge,m=l==="y"?ut:dt,g=n.rects.reference[u]+n.rects.reference[l]-i[l]-n.rects.popper[u],b=i[l]-n.rects.reference[l],x=Zr(s),S=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,k=g/2-b/2,y=d[p],A=S-f[u]-d[m],w=S/2-f[u]/2+k,C=kr(y,w,A),T=l;n.modifiersData[r]=(t={},t[T]=C,t.centerOffset=C-w,t)}}function rS(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||eh(t.elements.popper,o)&&(t.elements.arrow=o))}const oS={name:"arrow",enabled:!0,phase:"main",fn:nS,effect:rS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function rr(e){return e.split("-")[1]}var sS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function iS(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:tr(n*o)/o||0,y:tr(r*o)/o||0}}function Fc(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=i.x,p=f===void 0?0:f,m=i.y,g=m===void 0?0:m,b=typeof u=="function"?u({x:p,y:g}):{x:p,y:g};p=b.x,g=b.y;var x=i.hasOwnProperty("x"),S=i.hasOwnProperty("y"),k=Ge,y=Ue,A=window;if(c){var w=Zr(n),C="clientHeight",T="clientWidth";if(w===ot(n)&&(w=cn(n),Bt(w).position!=="static"&&a==="absolute"&&(C="scrollHeight",T="scrollWidth")),w=w,o===Ue||(o===Ge||o===dt)&&s===Dr){y=ut;var I=d&&w===A&&A.visualViewport?A.visualViewport.height:w[C];g-=I-r.height,g*=l?1:-1}if(o===Ge||(o===Ue||o===ut)&&s===Dr){k=dt;var O=d&&w===A&&A.visualViewport?A.visualViewport.width:w[T];p-=O-r.width,p*=l?1:-1}}var j=Object.assign({position:a},c&&sS),D=u===!0?iS({x:p,y:g},ot(n)):{x:p,y:g};if(p=D.x,g=D.y,l){var F;return Object.assign({},j,(F={},F[y]=S?"0":"",F[k]=x?"0":"",F.transform=(A.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",F))}return Object.assign({},j,(t={},t[y]=S?g+"px":"",t[k]=x?p+"px":"",t.transform="",t))}function aS(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Rt(t.placement),variation:rr(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Fc(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Fc(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const lS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:aS,data:{}};var To={passive:!0};function cS(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,a=i===void 0?!0:i,l=ot(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,To)}),a&&l.addEventListener("resize",n.update,To),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,To)}),a&&l.removeEventListener("resize",n.update,To)}}const uS={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cS,data:{}};var dS={left:"right",right:"left",bottom:"top",top:"bottom"};function jo(e){return e.replace(/left|right|bottom|top/g,function(t){return dS[t]})}var fS={start:"end",end:"start"};function Bc(e){return e.replace(/start|end/g,function(t){return fS[t]})}function el(e){var t=ot(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function tl(e){return nr(cn(e)).left+el(e).scrollLeft}function pS(e,t){var n=ot(e),r=cn(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;var c=Zp();(c||!c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:i,x:a+tl(e),y:l}}function hS(e){var t,n=cn(e),r=el(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=vn(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=vn(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+tl(e),l=-r.scrollTop;return Bt(o||n).direction==="rtl"&&(a+=vn(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:a,y:l}}function nl(e){var t=Bt(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function oh(e){return["html","body","#document"].indexOf(It(e))>=0?e.ownerDocument.body:ct(e)&&nl(e)?e:oh(As(e))}function Cr(e,t){var n;t===void 0&&(t=[]);var r=oh(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=ot(r),i=o?[s].concat(s.visualViewport||[],nl(r)?r:[]):r,a=t.concat(i);return o?a:a.concat(Cr(As(i)))}function Gi(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function mS(e,t){var n=nr(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Hc(e,t,n){return t===Jp?Gi(pS(e,n)):An(t)?mS(t,n):Gi(hS(cn(e)))}function gS(e){var t=Cr(As(e)),n=["absolute","fixed"].indexOf(Bt(e).position)>=0,r=n&&ct(e)?Zr(e):e;return An(r)?t.filter(function(o){return An(o)&&eh(o,r)&&It(o)!=="body"}):[]}function bS(e,t,n,r){var o=t==="clippingParents"?gS(e):[].concat(t),s=[].concat(o,[n]),i=s[0],a=s.reduce(function(l,c){var u=Hc(e,c,r);return l.top=vn(u.top,l.top),l.right=os(u.right,l.right),l.bottom=os(u.bottom,l.bottom),l.left=vn(u.left,l.left),l},Hc(e,i,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function sh(e){var t=e.reference,n=e.element,r=e.placement,o=r?Rt(r):null,s=r?rr(r):null,i=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(o){case Ue:l={x:i,y:t.y-n.height};break;case ut:l={x:i,y:t.y+t.height};break;case dt:l={x:t.x+t.width,y:a};break;case Ge:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var c=o?Za(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case er:l[c]=l[c]-(t[u]/2-n[u]/2);break;case Dr:l[c]=l[c]+(t[u]/2-n[u]/2);break}}return l}function jr(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,a=n.boundary,l=a===void 0?_C:a,c=n.rootBoundary,u=c===void 0?Jp:c,d=n.elementContext,f=d===void 0?fr:d,p=n.altBoundary,m=p===void 0?!1:p,g=n.padding,b=g===void 0?0:g,x=nh(typeof b!="number"?b:rh(b,Qr)),S=f===fr?$C:fr,k=e.rects.popper,y=e.elements[m?S:f],A=bS(An(y)?y:y.contextElement||cn(e.elements.popper),l,u,i),w=nr(e.elements.reference),C=sh({reference:w,element:k,placement:o}),T=Gi(Object.assign({},k,C)),I=f===fr?T:w,O={top:A.top-I.top+x.top,bottom:I.bottom-A.bottom+x.bottom,left:A.left-I.left+x.left,right:I.right-A.right+x.right},j=e.modifiersData.offset;if(f===fr&&j){var D=j[o];Object.keys(O).forEach(function(F){var B=[dt,ut].indexOf(F)>=0?1:-1,N=[Ue,ut].indexOf(F)>=0?"y":"x";O[F]+=D[N]*B})}return O}function yS(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?Yp:l,u=rr(r),d=u?a?_c:_c.filter(function(m){return rr(m)===u}):Qr,f=d.filter(function(m){return c.indexOf(m)>=0});f.length===0&&(f=d);var p=f.reduce(function(m,g){return m[g]=jr(e,{placement:g,boundary:o,rootBoundary:s,padding:i})[Rt(g)],m},{});return Object.keys(p).sort(function(m,g){return p[m]-p[g]})}function xS(e){if(Rt(e)===Ja)return[];var t=jo(e);return[Bc(e),t,Bc(t)]}function vS(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,g=n.allowedAutoPlacements,b=t.options.placement,x=Rt(b),S=x===b,k=l||(S||!m?[jo(b)]:xS(b)),y=[b].concat(k).reduce(function(le,te){return le.concat(Rt(te)===Ja?yS(t,{placement:te,boundary:u,rootBoundary:d,padding:c,flipVariations:m,allowedAutoPlacements:g}):te)},[]),A=t.rects.reference,w=t.rects.popper,C=new Map,T=!0,I=y[0],O=0;O<y.length;O++){var j=y[O],D=Rt(j),F=rr(j)===er,B=[Ue,ut].indexOf(D)>=0,N=B?"width":"height",$=jr(t,{placement:j,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),V=B?F?dt:Ge:F?ut:Ue;A[N]>w[N]&&(V=jo(V));var _=jo(V),R=[];if(s&&R.push($[D]<=0),a&&R.push($[V]<=0,$[_]<=0),R.every(function(le){return le})){I=j,T=!1;break}C.set(j,R)}if(T)for(var z=m?3:1,W=function(te){var G=y.find(function(H){var J=C.get(H);if(J)return J.slice(0,te).every(function(oe){return oe})});if(G)return I=G,"break"},re=z;re>0;re--){var se=W(re);if(se==="break")break}t.placement!==I&&(t.modifiersData[r]._skip=!0,t.placement=I,t.reset=!0)}}const wS={name:"flip",enabled:!0,phase:"main",fn:vS,requiresIfExists:["offset"],data:{_skip:!1}};function Wc(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Vc(e){return[Ue,dt,ut,Ge].some(function(t){return e[t]>=0})}function kS(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=jr(t,{elementContext:"reference"}),a=jr(t,{altBoundary:!0}),l=Wc(i,r),c=Wc(a,o,s),u=Vc(l),d=Vc(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const CS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:kS};function SS(e,t,n){var r=Rt(e),o=[Ge,Ue].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],a=s[1];return i=i||0,a=(a||0)*o,[Ge,dt].indexOf(r)>=0?{x:a,y:i}:{x:i,y:a}}function TS(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=Yp.reduce(function(u,d){return u[d]=SS(d,t.rects,s),u},{}),a=i[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=i}const AS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:TS};function ES(e){var t=e.state,n=e.name;t.modifiersData[n]=sh({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const MS={name:"popperOffsets",enabled:!0,phase:"read",fn:ES,data:{}};function RS(e){return e==="x"?"y":"x"}function NS(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,b=jr(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),x=Rt(t.placement),S=rr(t.placement),k=!S,y=Za(x),A=RS(y),w=t.modifiersData.popperOffsets,C=t.rects.reference,T=t.rects.popper,I=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,O=typeof I=="number"?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),j=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(w){if(s){var F,B=y==="y"?Ue:Ge,N=y==="y"?ut:dt,$=y==="y"?"height":"width",V=w[y],_=V+b[B],R=V-b[N],z=p?-T[$]/2:0,W=S===er?C[$]:T[$],re=S===er?-T[$]:-C[$],se=t.elements.arrow,le=p&&se?Qa(se):{width:0,height:0},te=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:th(),G=te[B],H=te[N],J=kr(0,C[$],le[$]),oe=k?C[$]/2-z-J-G-O.mainAxis:W-J-G-O.mainAxis,ge=k?-C[$]/2+z+J+H+O.mainAxis:re+J+H+O.mainAxis,Ce=t.elements.arrow&&Zr(t.elements.arrow),ve=Ce?y==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,we=(F=j?.[y])!=null?F:0,Ee=V+oe-we-ve,st=V+ge-we,Xe=kr(p?os(_,Ee):_,V,p?vn(R,st):R);w[y]=Xe,D[y]=Xe-V}if(a){var qe,ye=y==="x"?Ue:Ge,Re=y==="x"?ut:dt,Pe=w[A],Te=A==="y"?"height":"width",_e=Pe+b[ye],Dt=Pe-b[Re],Vt=[Ue,Ge].indexOf(x)!==-1,un=(qe=j?.[A])!=null?qe:0,xe=Vt?_e:Pe-C[Te]-T[Te]-un+O.altAxis,Je=Vt?Pe+C[Te]+T[Te]-un-O.altAxis:Dt,qt=p&&Vt?eS(xe,Pe,Je):kr(p?xe:_e,Pe,p?Je:Dt);w[A]=qt,D[A]=qt-Pe}t.modifiersData[r]=D}}const OS={name:"preventOverflow",enabled:!0,phase:"main",fn:NS,requiresIfExists:["offset"]};function IS(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function PS(e){return e===ot(e)||!ct(e)?el(e):IS(e)}function LS(e){var t=e.getBoundingClientRect(),n=tr(t.width)/e.offsetWidth||1,r=tr(t.height)/e.offsetHeight||1;return n!==1||r!==1}function DS(e,t,n){n===void 0&&(n=!1);var r=ct(t),o=ct(t)&&LS(t),s=cn(t),i=nr(e,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((It(t)!=="body"||nl(s))&&(a=PS(t)),ct(t)?(l=nr(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=tl(s))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function jS(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&o(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function zS(e){var t=jS(e);return XC.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function _S(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function $S(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var qc={placement:"bottom",modifiers:[],strategy:"absolute"};function Kc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function FS(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?qc:o;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},qc,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],f=!1,p={state:u,setOptions:function(x){var S=typeof x=="function"?x(u.options):x;g(),u.options=Object.assign({},s,u.options,S),u.scrollParents={reference:An(a)?Cr(a):a.contextElement?Cr(a.contextElement):[],popper:Cr(l)};var k=zS($S([].concat(r,u.options.modifiers)));return u.orderedModifiers=k.filter(function(y){return y.enabled}),m(),p.update()},forceUpdate:function(){if(!f){var x=u.elements,S=x.reference,k=x.popper;if(Kc(S,k)){u.rects={reference:DS(S,Zr(k),u.options.strategy==="fixed"),popper:Qa(k)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(O){return u.modifiersData[O.name]=Object.assign({},O.data)});for(var y=0;y<u.orderedModifiers.length;y++){if(u.reset===!0){u.reset=!1,y=-1;continue}var A=u.orderedModifiers[y],w=A.fn,C=A.options,T=C===void 0?{}:C,I=A.name;typeof w=="function"&&(u=w({state:u,options:T,name:I,instance:p})||u)}}}},update:_S(function(){return new Promise(function(b){p.forceUpdate(),b(u)})}),destroy:function(){g(),f=!0}};if(!Kc(a,l))return p;p.setOptions(c).then(function(b){!f&&c.onFirstUpdate&&c.onFirstUpdate(b)});function m(){u.orderedModifiers.forEach(function(b){var x=b.name,S=b.options,k=S===void 0?{}:S,y=b.effect;if(typeof y=="function"){var A=y({state:u,name:x,instance:p,options:k}),w=function(){};d.push(A||w)}})}function g(){d.forEach(function(b){return b()}),d=[]}return p}}var BS=[uS,MS,lS,Qp,AS,wS,OS,oS,CS],HS=FS({defaultModifiers:BS}),WS="tippy-box",ih="tippy-content",VS="tippy-backdrop",ah="tippy-arrow",lh="tippy-svg-arrow",mn={passive:!0,capture:!0},ch=function(){return document.body};function qS(e,t){return{}.hasOwnProperty.call(e,t)}function ii(e,t,n){if(Array.isArray(e)){var r=e[t];return r??(Array.isArray(n)?n[t]:n)}return e}function rl(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function uh(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Uc(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function KS(e,t){var n=Object.assign({},e);return t.forEach(function(r){delete n[r]}),n}function US(e){return e.split(/\s+/).filter(Boolean)}function Wn(e){return[].concat(e)}function Gc(e,t){e.indexOf(t)===-1&&e.push(t)}function GS(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function XS(e){return e.split("-")[0]}function ss(e){return[].slice.call(e)}function Xc(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function Sr(){return document.createElement("div")}function zr(e){return["Element","Fragment"].some(function(t){return rl(e,t)})}function JS(e){return rl(e,"NodeList")}function YS(e){return rl(e,"MouseEvent")}function QS(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function ZS(e){return zr(e)?[e]:JS(e)?ss(e):Array.isArray(e)?e:ss(document.querySelectorAll(e))}function ai(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function Jc(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function e1(e){var t,n=Wn(e),r=n[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function t1(e,t){var n=t.clientX,r=t.clientY;return e.every(function(o){var s=o.popperRect,i=o.popperState,a=o.props,l=a.interactiveBorder,c=XS(i.placement),u=i.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,g=s.top-r+d>l,b=r-s.bottom-f>l,x=s.left-n+p>l,S=n-s.right-m>l;return g||b||x||S})}function li(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){e[r](o,n)})}function Yc(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Ct={isTouch:!1},Qc=0;function n1(){Ct.isTouch||(Ct.isTouch=!0,window.performance&&document.addEventListener("mousemove",dh))}function dh(){var e=performance.now();e-Qc<20&&(Ct.isTouch=!1,document.removeEventListener("mousemove",dh)),Qc=e}function r1(){var e=document.activeElement;if(QS(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function o1(){document.addEventListener("touchstart",n1,mn),window.addEventListener("blur",r1)}var s1=typeof window<"u"&&typeof document<"u",i1=s1?!!window.msCrypto:!1;function $n(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Zc(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function a1(e){return Zc(`
130
130
  %ctippy.js
131
131
 
@@ -146,6 +146,6 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
146
146
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
147
147
 
148
148
  `,`1) content: element.innerHTML
149
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=o.reduce(function(l,c){var u=c&&g1(c,r);return u&&l.push(u),l},[]);return zr(e)?a[0]:a}eo.defaultProps=et;eo.setDefaultProps=f1;eo.currentInput=Ct;Object.assign({},Qp,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});eo.setDefaultProps({render:gh});const bh=K.forwardRef(({items:e,command:t,classNames:n,noResults:r},o)=>{const[s,i]=K.useState(0),a=We(),l=Vr(),c=Ve(),u=n??c,d=r??l.noResults;K.useEffect(()=>{i(0)},[e]);const f=p=>{const m=e[p];m&&t(m)};return K.useImperativeHandle(o,()=>({onKeyDown:p=>e.length?p.key==="ArrowUp"?(p.preventDefault(),i(m=>(m+e.length-1)%e.length),!0):p.key==="ArrowDown"?(p.preventDefault(),i(m=>(m+1)%e.length),!0):p.key==="Enter"?(p.preventDefault(),f(s),!0):!1:!1})),h.jsx("div",{className:M("z-[9999] min-w-[14rem] overflow-hidden rounded-3xl border p-1.5 shadow-xl backdrop-blur-xl space-y-1 animate-in fade-in zoom-in-95",a==="dark"?"bg-neutral-900/95 border-neutral-800 shadow-black/50 text-neutral-200":"bg-white/95 border-neutral-200/60 text-neutral-700",u?.slashCommandMenu),children:e.length?e.map((p,m)=>h.jsxs("button",{type:"button",onClick:()=>f(m),"aria-selected":s===m,className:M("relative flex w-full cursor-pointer select-none items-center rounded-full px-3 py-2 text-sm outline-none transition-colors gap-2",s===m?a==="dark"?"bg-neutral-800 text-neutral-100":"bg-neutral-100 text-neutral-900":a==="dark"?"text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100":"text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900",s===m&&u?.slashCommandItemActive,u?.slashCommandItem),children:[h.jsx("div",{className:M("flex h-6 w-6 items-center justify-center rounded-sm mr-2",a==="dark"?"bg-neutral-800 border border-neutral-700":"bg-white border border-neutral-200 shadow-sm",u?.slashCommandIcon),children:h.jsx(p.icon,{className:"size-4"})}),h.jsx("span",{className:M("font-medium",u?.slashCommandTitle),children:p.title})]},p.title)):h.jsxs("div",{className:M("flex items-center px-2 py-1.5 text-sm text-neutral-500",u?.slashCommandEmpty),children:[h.jsx(q.Ban,{className:M("mr-2 size-4",u?.slashCommandEmptyIcon)}),d]})})});bh.displayName="CommandsList";const b1=async({editor:e,range:t,onRequestImage:n,onInsertLocalImageFile:r,imageSlashFallback:o="prompt-url",translations:s})=>{const i=s||Xn;let a=null;if(n)a=await n({editor:e,range:t});else if(o==="prompt-url"){const c=window.prompt(i.imageUrlPrompt)?.trim();a=c?{kind:"url",src:c}:null}if(!a)return;if(a.kind==="file"){if(!r)return;e.chain().focus().deleteRange(t).run();const c={editor:e,range:t,file:a.file,...a.alt?{alt:a.alt}:{},...a.title?{title:a.title}:{}};await r(c);return}const l={src:a.src,...a.alt?{alt:a.alt}:{},...a.title?{title:a.title}:{}};e.chain().focus().deleteRange(t).setNode("image",l).run()},y1=e=>{const t=e.translations||Xn;return[{title:t.text,icon:q.Pilcrow,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setParagraph().run()},{title:t.heading1,icon:q.Heading1,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:1}).run()},{title:t.heading2,icon:q.Heading2,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:2}).run()},{title:t.heading3,icon:q.Heading3,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:3}).run()},{title:t.bulletList,icon:q.List,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleBulletList().run()},{title:t.numberedList,icon:q.ListOrdered,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleOrderedList().run()},{title:t.image,icon:q.Image,command:({editor:n,range:r})=>{b1({editor:n,range:r,onRequestImage:e.onRequestImage??null,onInsertLocalImageFile:e.onInsertLocalImageFile??null,imageSlashFallback:e.imageSlashFallback??"prompt-url",translations:e.translations})}},{title:t.table,icon:q.Table,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:t.quote,icon:q.Quote,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleBlockquote().run()},{title:t.code,icon:q.Code,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()}]},x1=(e={})=>({items:({query:t,editor:n})=>{const r=n.isActive("tableCell")||n.isActive("tableHeader"),o=e.translations||Xn;return y1(e).filter(s=>!r||s.title===o.image).filter(s=>e.enableImages!==!1||s.title!==o.image).filter(s=>s.title.toLowerCase().includes(t.toLowerCase())).slice(0,10)},render:()=>{let t=null,n=null,r=!1,o=0;const s=c=>({...c,classNames:e.classNames,noResults:(e.translations||Xn).noResults}),i=c=>{if(!c.clientRect||!n)return;const u=()=>c.clientRect?.()??new DOMRect(0,0,0,0);n.setProps({getReferenceClientRect:u})},a=c=>{if(!r){if(!t){if(t=new Tr.ReactRenderer(bh,{props:s(c),editor:c.editor}),!c.clientRect)return;const u=()=>c.clientRect?.()??new DOMRect(0,0,0,0);n=eo(Jo()??document.body,{getReferenceClientRect:u,appendTo:()=>Jo()??document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"});return}t.updateProps(s(c)),i(c)}},l=c=>{const u=++o;queueMicrotask(()=>{r||u!==o||a(c)})};return{onStart:c=>{l(c)},onUpdate:c=>{l(c)},onKeyDown:({event:c})=>c.key==="Escape"&&n?(n.hide(),!0):t?.ref?.onKeyDown(c)??!1,onExit:()=>{r=!0,o+=1,n&&n.destroy(),t?.destroy()}}}}),v1=P.Extension.create({name:"slash-commands",addOptions(){return{onRequestImage:null,onInsertLocalImageFile:null,enableImages:!0,imageSlashFallback:"prompt-url"}},addProseMirrorPlugins(){const e=x1({onRequestImage:this.options.onRequestImage,onInsertLocalImageFile:this.options.onInsertLocalImageFile,enableImages:this.options.enableImages,imageSlashFallback:this.options.imageSlashFallback,translations:this.options.translations,classNames:this.options.classNames});return[zC({editor:this.editor,char:"/",command:({editor:t,range:n,props:r})=>{r.command({editor:t,range:n})},...e})]}}),w1=e=>{const{node:t,updateAttributes:n,deleteNode:r,selected:o}=e,{src:s,width:i,height:a,rotation:l,objectFit:c="contain",objectPosition:u="50% 50%",isUploading:d}=t.attrs,f=We(),p=Ve(),m=Vr(),[g,b]=K.useState(!1),[x,S]=K.useState({x:0,y:0}),[k,y]=K.useState(1),[A,w]=K.useState(null),[C,T]=K.useState(!1),[I,O]=K.useState(!1),[j,D]=K.useState(""),F=K.useRef(null),B=K.useRef(null),N=K.useRef(null),$=typeof t.attrs.alt=="string"&&t.attrs.alt.trim()?t.attrs.alt:m.imageAlt,V=()=>{if(F.current&&N.current===null){const{naturalWidth:H,naturalHeight:J}=F.current;H>0&&J>0&&(N.current=H/J)}},_=()=>{D(typeof t.attrs.alt=="string"?t.attrs.alt:"")};K.useEffect(()=>{_()},[t.attrs.alt]),K.useEffect(()=>{!o&&I&&O(!1)},[o,I]);const R=(H,J)=>{H.preventDefault(),H.stopPropagation();const oe=H.clientX,ge=H.clientY,Ce=B.current?.offsetWidth??300,ve=B.current?.offsetHeight??200,we=N.current??Ce/ve,Ee=H.shiftKey,st=qe=>{const ye=qe.clientX-oe,Re=qe.clientY-ge;if(qe.shiftKey||Ee){let Te=Math.max(80,Ce+ye),_e=J==="right"?ve:Math.max(60,ve+Re);n({width:`${Te}px`,height:J==="right"?a:`${_e}px`,objectFit:"cover"})}else if(J==="bottom"){const Te=Math.max(60,ve+Re),_e=Te*we;n({width:`${Math.round(_e)}px`,height:`${Math.round(Te)}px`,objectFit:"contain"})}else{const Te=Math.max(80,Ce+ye),_e=Te/we;n({width:`${Math.round(Te)}px`,height:`${Math.round(_e)}px`,objectFit:"contain"})}},Xe=()=>{document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",Xe)};document.addEventListener("mousemove",st),document.addEventListener("mouseup",Xe)},z=H=>{if(!H.ctrlKey||c!=="cover")return;H.preventDefault(),H.stopPropagation(),T(!0);const J=H.clientX,oe=H.clientY,ge=(u||"50% 50%").split(" "),Ce=parseFloat(ge[0])??50,ve=parseFloat(ge[1])??50,we=B.current?.offsetWidth??300,Ee=B.current?.offsetHeight??200,st=qe=>{const ye=qe.clientX-J,Re=qe.clientY-oe,Pe=Math.max(0,Math.min(100,Ce-ye/we*100)),Te=Math.max(0,Math.min(100,ve-Re/Ee*100));n({objectPosition:`${Pe.toFixed(1)}% ${Te.toFixed(1)}%`})},Xe=()=>{T(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",Xe)};document.addEventListener("mousemove",st),document.addEventListener("mouseup",Xe)},W=K.useCallback((H,J)=>{w(J)},[]),re=async()=>{try{const H=await S1(s,A,l);n({src:H,rotation:0}),b(!1)}catch(H){console.error(H),b(!1)}},se=()=>{const H=((l||0)+90)%360;n({rotation:H})},le=()=>{const H=j.trim();n({alt:H||null}),O(!1)},te=()=>{n({alt:null}),D(""),O(!1)},G=c==="cover";return h.jsxs(Tr.NodeViewWrapper,{className:M("relative block max-w-full my-4",p?.imageNodeWrapper),"data-drag-handle":!0,children:[h.jsx("div",{ref:B,className:M("relative group ring-2 transition-all inline-block max-w-full",o?"ring-blue-500":"ring-transparent",g&&"ring-0",p?.imageContainer),style:{width:i,minWidth:80},children:g?h.jsxs("div",{className:M("relative",p?.imageCropArea),style:{width:"100%",height:"400px",backgroundColor:"#333"},children:[h.jsx(Oh,{image:s,crop:x,zoom:k,rotation:l,aspect:4/3,onCropChange:S,onRotationChange:H=>n({rotation:H}),onZoomChange:y,onCropComplete:W}),h.jsxs("div",{className:M("absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 p-2 rounded-xl shadow-lg z-10",f==="dark"?"bg-neutral-800":"bg-white",p?.imageCropToolbar),children:[h.jsx("button",{onClick:()=>b(!1),title:m.cancel,"aria-label":m.cancel,className:M("p-2 text-red-500 rounded-full",f==="dark"?"hover:bg-neutral-700":"hover:bg-neutral-100",p?.imageCropButton,p?.imageCropCancelButton),children:h.jsx(q.X,{size:16})}),h.jsx("button",{onClick:re,title:m.apply,"aria-label":m.apply,className:M("p-2 text-green-500 rounded-full",f==="dark"?"hover:bg-neutral-700":"hover:bg-neutral-100",p?.imageCropButton,p?.imageCropApplyButton),children:h.jsx(q.Check,{size:16})})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:M("relative w-full",G&&"overflow-hidden",p?.imageFrame),style:{height:a==="auto"?void 0:a},children:[h.jsx("img",{ref:F,src:s,alt:$,onLoad:V,onMouseDown:z,className:M("block max-w-full rounded select-none",G&&"w-full h-full",C&&"cursor-grabbing",!C&&G&&"cursor-grab",d&&"opacity-50 blur-[2px] grayscale-[0.5]",p?.imageElement),style:{width:G?"100%":i,height:G?"100%":a,objectFit:G?"cover":void 0,objectPosition:G?u:void 0,transform:l?`rotate(${l}deg)`:void 0,transition:o?"none":"transform 0.2s, filter 0.2s, opacity 0.2s"}}),d&&h.jsx("div",{className:M("absolute inset-0 flex items-center justify-center z-10 pointer-events-none",p?.imageLoadingOverlay),children:h.jsx("div",{className:M("flex items-center justify-center p-3 rounded-2xl shadow-xl backdrop-blur-md",f==="dark"?"bg-black/50":"bg-white/60",p?.imageLoadingBox),children:h.jsx(q.Loader2,{className:M("w-8 h-8 animate-spin",f==="dark"?"text-white":"text-neutral-800",p?.imageLoadingIcon)})})}),o&&G&&!d&&h.jsx("div",{className:M("absolute inset-0 flex items-end justify-center pb-2 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity",p?.imagePanHintOverlay),children:h.jsx("span",{className:M("text-[10px] px-2 py-0.5 rounded-full font-medium",f==="dark"?"bg-black/60 text-neutral-300":"bg-white/80 text-neutral-500",p?.imagePanHint),children:m.imagePanHint})})]}),o&&h.jsxs("div",{className:M("absolute top-2 right-2 flex items-center gap-1 backdrop-blur border p-1 rounded-xl shadow-sm opacity-0 group-hover:opacity-100 transition-opacity z-10",f==="dark"?"bg-neutral-800/90 border-neutral-700":"bg-white/90 border-neutral-200",p?.imageToolbar),children:[h.jsx("button",{type:"button",onClick:se,title:m.rotate,"aria-label":m.rotate,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton),children:h.jsx(q.RotateCw,{size:14})}),h.jsx("button",{type:"button",onClick:()=>b(!0),title:m.crop,"aria-label":m.crop,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton),children:h.jsx(q.Crop,{size:14})}),h.jsx(Lo,{open:I,onOpenChange:H=>{O(H),H&&_()},align:"end",side:"bottom",trigger:h.jsx("button",{type:"button",title:m.altText,"aria-label":m.altText,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton,p?.imageAltButton),children:h.jsx(q.Type,{size:14})}),children:h.jsxs("div",{className:M("flex w-56 flex-col gap-2",p?.imageAltPopover),children:[h.jsx("label",{className:M("text-xs font-semibold",f==="dark"?"text-neutral-400":"text-neutral-500",p?.imageAltLabel),children:m.altText}),h.jsx("input",{type:"text",value:j,placeholder:m.altTextPlaceholder,onChange:H=>D(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),le()),H.key==="Escape"&&(H.preventDefault(),_(),O(!1))},autoFocus:!0,className:M("w-full rounded-xl border px-3 py-2 text-sm outline-none transition-colors",f==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",p?.imageAltInput)}),h.jsxs("div",{className:M("flex gap-2",p?.imageAltActions),children:[h.jsx("button",{type:"button",onClick:le,className:M("flex-1 rounded-full py-1.5 text-sm font-medium transition-colors",f==="dark"?"bg-neutral-700 hover:bg-neutral-600 text-neutral-100":"bg-neutral-900 hover:bg-neutral-700 text-white",p?.imageAltApplyButton),children:m.apply}),h.jsx("button",{type:"button",onClick:te,disabled:!j.trim(),className:M("rounded-full px-3 py-1.5 text-sm transition-colors",f==="dark"?"text-neutral-400 hover:bg-white/10 disabled:text-neutral-600":"text-neutral-500 hover:bg-black/6 disabled:text-neutral-300",!j.trim()&&"cursor-not-allowed",p?.imageAltClearButton),children:m.clearAltText})]})]})}),h.jsx("span",{className:M("w-[1px] h-3 mx-0.5",f==="dark"?"bg-neutral-600":"bg-neutral-300",p?.imageToolbarSeparator)}),h.jsx("button",{type:"button",onClick:r,title:m.delete,"aria-label":m.delete,className:M("p-1.5 rounded-full text-red-500",f==="dark"?"hover:bg-red-900/20":"hover:bg-red-50",p?.imageToolbarButton,p?.imageDeleteButton),children:h.jsx(q.Trash2,{size:14})})]}),o&&h.jsxs(h.Fragment,{children:[h.jsx("div",{onMouseDown:H=>R(H,"right"),className:M("absolute top-1/2 -right-2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-e-resize -translate-y-1/2 shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleRight)}),h.jsx("div",{onMouseDown:H=>R(H,"bottom"),className:M("absolute -bottom-2 left-1/2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-s-resize -translate-x-1/2 shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleBottom)}),h.jsx("div",{onMouseDown:H=>R(H,"bottom-right"),className:M("absolute -bottom-2 -right-2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-se-resize shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleBottomRight)})]})]})}),o&&!g&&h.jsx("div",{className:M("mt-1 flex items-center gap-2",p?.imageModeBadge),children:h.jsx("span",{className:M("text-[10px] font-medium",f==="dark"?"text-neutral-500":"text-neutral-400",p?.imageModeText),children:G?m.imageFrameModeHint:m.imageNaturalModeHint})})]})},k1=e=>new Promise((t,n)=>{const r=new Image;r.addEventListener("load",()=>t(r)),r.addEventListener("error",n),r.setAttribute("crossOrigin","anonymous"),r.src=e});function yh(e){return e*Math.PI/180}function C1(e,t,n){const r=yh(n);return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}async function S1(e,t,n=0,r={horizontal:!1,vertical:!1}){const o=await k1(e),s=document.createElement("canvas"),i=s.getContext("2d");if(!i)return"";const a=yh(n),{width:l,height:c}=C1(o.width,o.height,n);s.width=l,s.height=c,i.translate(l/2,c/2),i.rotate(a),i.scale(r.horizontal?-1:1,r.vertical?-1:1),i.translate(-o.width/2,-o.height/2),i.drawImage(o,0,0);const u=document.createElement("canvas"),d=u.getContext("2d");return d?(u.width=t.width,u.height=t.height,d.drawImage(s,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise(f=>{u.toBlob(p=>{p&&f(URL.createObjectURL(p))},"image/png")})):""}const T1=e=>e?e.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]"):"",A1=e=>e?e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'):"",E1=e=>{if(!e)return"";const t=e.trim();return t?/[\s()]/.test(t)?`<${t}>`:t.replace(/\\/g,"\\\\").replace(/\)/g,"\\)"):""},xh=P.Node.create({name:"image",addOptions(){return{inline:!1,allowBase64:!0,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},rotation:{default:0},objectFit:{default:"contain"},objectPosition:{default:"50% 50%"},isUploading:{default:!1}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",P.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>{const n=typeof e.href=="string"&&e.href||typeof e.src=="string"&&e.src||"";return t.createNode("image",{src:n,alt:typeof e.text=="string"&&e.text||typeof e.alt=="string"&&e.alt||null,title:typeof e.title=="string"?e.title:null})},renderMarkdown:e=>{const t=E1(typeof e.attrs?.src=="string"?e.attrs.src:null);if(!t)return"";const n=T1(typeof e.attrs?.alt=="string"?e.attrs.alt:null),r=A1(typeof e.attrs?.title=="string"?e.attrs.title:null);return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addCommands(){return{setAdvancedImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addNodeView(){return Tr.ReactNodeViewRenderer(w1)}}),M1=e=>{const t=e.trim();return t?/^\d+(\.\d+)?$/.test(t)?`${t}px`:/^\d+(\.\d+)?px$/.test(t)?t:/^\d+(\.\d+)?rem$/i.test(t)?t.toLowerCase():null:null},vh=P.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize||null,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>{const n=M1(e);return n?t().setMark("textStyle",{fontSize:n}).run():!1},unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),R1=P.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily?.replace(/['"]/g,"").trim()||null,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),N1=P.Extension.create({name:"textStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontWeight:{default:null,parseHTML:e=>e.style.fontWeight||null,renderHTML:e=>e.fontWeight?{style:`font-weight: ${e.fontWeight}`}:{}},fontStyle:{default:null,parseHTML:e=>e.style.fontStyle||null,renderHTML:e=>e.fontStyle?{style:`font-style: ${e.fontStyle}`}:{}},letterSpacing:{default:null,parseHTML:e=>e.style.letterSpacing||null,renderHTML:e=>e.letterSpacing?{style:`letter-spacing: ${e.letterSpacing}`}:{}},lineHeight:{default:null,parseHTML:e=>e.style.lineHeight||null,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}},textTransform:{default:null,parseHTML:e=>e.style.textTransform||null,renderHTML:e=>e.textTransform?{style:`text-transform: ${e.textTransform}`}:{}}}}]}}),ui=e=>e?e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"",wh=P.Node.create({name:"video",addOptions(){return{allowBase64:!1,HTMLAttributes:{}}},group:"block",draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},controls:{default:!0},width:{default:"100%"}}},parseHTML(){return[{tag:"video",getAttrs:e=>{if(!(e instanceof HTMLElement))return!1;const t=e.querySelector("source[src]"),n=e.getAttribute("src")??t?.getAttribute("src")??null;return n?{src:n,title:e.getAttribute("title"),width:e.getAttribute("width")??"100%",controls:e.hasAttribute("controls")}:!1}}]},renderHTML({HTMLAttributes:e}){return["video",P.mergeAttributes(this.options.HTMLAttributes,e,{controls:!0})]},renderMarkdown:e=>{const t=typeof e.attrs?.src=="string"?e.attrs.src.trim():"";if(!t)return"";const n=typeof e.attrs?.title=="string"?e.attrs.title.trim():"",r=typeof e.attrs?.width=="string"?e.attrs.width.trim():"";return`<video ${[`src="${ui(t)}"`,"controls",n?`title="${ui(n)}"`:"",r?`width="${ui(r)}"`:""].filter(Boolean).join(" ")}></video>`},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),O1=({editor:e})=>{const t=We(),n=Vr(),r=Ve(),o=K.useRef(null),[s,i]=K.useState(null);K.useEffect(()=>{if(!e||!e.view||typeof document>"u")return;let w;const C=T=>{if(!e.isEditable)return;const I=o.current;if(!I||!I.parentElement||I.dataset.dropdownOpen==="true")return;if(I.contains(T.target)){clearTimeout(w);return}const D=e.view.dom.getBoundingClientRect();if(!(T.clientX>=D.left-60&&T.clientX<=D.right&&T.clientY>=D.top&&T.clientY<=D.bottom)){w=setTimeout(()=>{I.classList.add("opacity-0","pointer-events-none")},150);return}clearTimeout(w);const B=e.view.posAtCoords({left:T.clientX,top:T.clientY});if(!B)return;const N=e.state.doc.resolve(B.pos);let $=N.depth;for(;$>1;)$--;const V=$>0?N.before($):N.pos,_=e.view.nodeDOM(V);if(_ instanceof HTMLElement){const R=_.getBoundingClientRect(),z=I.parentElement.getBoundingClientRect(),W=48,re=8;I.style.left=`${R.left-z.left-W-re}px`;const se=R.top-z.top+Math.min(R.height/2-12,4);I.style.top=`${se}px`,I.classList.remove("opacity-0","pointer-events-none")}};return document.addEventListener("mousemove",C),()=>{document.removeEventListener("mousemove",C),clearTimeout(w)}},[e]);const a=()=>{if(!o.current||!o.current.parentElement)return null;const w=o.current.getBoundingClientRect(),C={left:w.left+80,top:w.top+w.height/2},T=e.view.posAtCoords(C);if(T){const I=e.state.doc.resolve(T.pos);let O=I.depth;for(;O>1;)O--;const j=O>0?I.before(O):I.pos,D=e.state.doc.nodeAt(j);if(D){const F=D.type.name==="paragraph"||D.type.name==="heading",B=D.type.name==="image"||D.type.name==="advancedImage",N={pos:j,node:D,isText:F,isImage:B};return i(N),N}}return i(null),null},l=w=>{w.stopPropagation(),w.preventDefault(),a();const C=o.current?.getBoundingClientRect();if(!C)return;const T={left:C.left+80,top:C.top+C.height/2},I=e.view.posAtCoords(T);if(I){const O=e.state.doc.resolve(I.pos);let j=O.depth;for(;j>1;)j--;const D=j>0?O.before(j):O.pos,F=e.state.doc.nodeAt(D);if(F){const B=D+F.nodeSize;e.chain().insertContentAt(B,{type:"paragraph"}).focus(B+1).insertContent("/").run();return}}e.chain().focus().insertContent("/").run()},c=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().insertContentAt(w+C.nodeSize,C.toJSON()).run()},u=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().deleteRange({from:w,to:w+C.nodeSize}).run()},d=()=>{if(!s)return;const{pos:w,node:C}=s,T=e.state.doc.slice(w,w+C.nodeSize),I=T.content.textBetween(0,T.content.size,`
149
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=o.reduce(function(l,c){var u=c&&g1(c,r);return u&&l.push(u),l},[]);return zr(e)?a[0]:a}eo.defaultProps=et;eo.setDefaultProps=f1;eo.currentInput=Ct;Object.assign({},Qp,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});eo.setDefaultProps({render:gh});const bh=K.forwardRef(({items:e,command:t,classNames:n,noResults:r},o)=>{const[s,i]=K.useState(0),a=We(),l=Vr(),c=Ve(),u=n??c,d=r??l.noResults;K.useEffect(()=>{i(0)},[e]);const f=p=>{const m=e[p];m&&t(m)};return K.useImperativeHandle(o,()=>({onKeyDown:p=>e.length?p.key==="ArrowUp"?(p.preventDefault(),i(m=>(m+e.length-1)%e.length),!0):p.key==="ArrowDown"?(p.preventDefault(),i(m=>(m+1)%e.length),!0):p.key==="Enter"?(p.preventDefault(),f(s),!0):!1:!1})),h.jsx("div",{className:M("z-[9999] min-w-[14rem] overflow-hidden rounded-3xl border p-1.5 shadow-xl backdrop-blur-xl space-y-1 animate-in fade-in zoom-in-95",a==="dark"?"bg-neutral-900/95 border-neutral-800 shadow-black/50 text-neutral-200":"bg-white/95 border-neutral-200/60 text-neutral-700",u?.slashCommandMenu),children:e.length?e.map((p,m)=>h.jsxs("button",{type:"button",onClick:()=>f(m),"aria-selected":s===m,className:M("relative flex w-full cursor-pointer select-none items-center rounded-full px-3 py-2 text-sm outline-none transition-colors gap-2",s===m?a==="dark"?"bg-neutral-800 text-neutral-100":"bg-neutral-100 text-neutral-900":a==="dark"?"text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100":"text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900",s===m&&u?.slashCommandItemActive,u?.slashCommandItem),children:[h.jsx("div",{className:M("flex h-6 w-6 items-center justify-center rounded-sm mr-2",a==="dark"?"bg-neutral-800 border border-neutral-700":"bg-white border border-neutral-200 shadow-sm",u?.slashCommandIcon),children:h.jsx(p.icon,{className:"size-4"})}),h.jsx("span",{className:M("font-medium",u?.slashCommandTitle),children:p.title})]},p.title)):h.jsxs("div",{className:M("flex items-center px-2 py-1.5 text-sm text-neutral-500",u?.slashCommandEmpty),children:[h.jsx(q.Ban,{className:M("mr-2 size-4",u?.slashCommandEmptyIcon)}),d]})})});bh.displayName="CommandsList";const b1=async({editor:e,range:t,onRequestImage:n,onInsertLocalImageFile:r,imageSlashFallback:o="prompt-url",translations:s})=>{const i=s||Xn;let a=null;if(n)a=await n({editor:e,range:t});else if(o==="prompt-url"){const c=window.prompt(i.imageUrlPrompt)?.trim();a=c?{kind:"url",src:c}:null}if(!a)return;if(a.kind==="file"){if(!r)return;e.chain().focus().deleteRange(t).run();const c={editor:e,range:t,file:a.file,...a.alt?{alt:a.alt}:{},...a.title?{title:a.title}:{}};await r(c);return}const l={src:a.src,...a.alt?{alt:a.alt}:{},...a.title?{title:a.title}:{}};e.chain().focus().deleteRange(t).setAdvancedImage(l).run()},y1=e=>{const t=e.translations||Xn;return[{title:t.text,icon:q.Pilcrow,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setParagraph().run()},{title:t.heading1,icon:q.Heading1,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:1}).run()},{title:t.heading2,icon:q.Heading2,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:2}).run()},{title:t.heading3,icon:q.Heading3,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).setHeading({level:3}).run()},{title:t.bulletList,icon:q.List,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleBulletList().run()},{title:t.numberedList,icon:q.ListOrdered,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleOrderedList().run()},{title:t.image,icon:q.Image,command:({editor:n,range:r})=>{b1({editor:n,range:r,onRequestImage:e.onRequestImage??null,onInsertLocalImageFile:e.onInsertLocalImageFile??null,imageSlashFallback:e.imageSlashFallback??"prompt-url",translations:e.translations})}},{title:t.table,icon:q.Table,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:t.quote,icon:q.Quote,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleBlockquote().run()},{title:t.code,icon:q.Code,command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()}]},x1=(e={})=>({items:({query:t,editor:n})=>{const r=n.isActive("tableCell")||n.isActive("tableHeader"),o=e.translations||Xn;return y1(e).filter(s=>!r||s.title===o.image).filter(s=>e.enableImages!==!1||s.title!==o.image).filter(s=>s.title.toLowerCase().includes(t.toLowerCase())).slice(0,10)},render:()=>{let t=null,n=null,r=!1,o=0;const s=c=>({...c,classNames:e.classNames,noResults:(e.translations||Xn).noResults}),i=c=>{if(!c.clientRect||!n)return;const u=()=>c.clientRect?.()??new DOMRect(0,0,0,0);n.setProps({getReferenceClientRect:u})},a=c=>{if(!r){if(!t){if(t=new Tr.ReactRenderer(bh,{props:s(c),editor:c.editor}),!c.clientRect)return;const u=()=>c.clientRect?.()??new DOMRect(0,0,0,0);n=eo(Jo()??document.body,{getReferenceClientRect:u,appendTo:()=>Jo()??document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"});return}t.updateProps(s(c)),i(c)}},l=c=>{const u=++o;queueMicrotask(()=>{r||u!==o||a(c)})};return{onStart:c=>{l(c)},onUpdate:c=>{l(c)},onKeyDown:({event:c})=>c.key==="Escape"&&n?(n.hide(),!0):t?.ref?.onKeyDown(c)??!1,onExit:()=>{r=!0,o+=1,n&&n.destroy(),t?.destroy()}}}}),v1=P.Extension.create({name:"slash-commands",addOptions(){return{onRequestImage:null,onInsertLocalImageFile:null,enableImages:!0,imageSlashFallback:"prompt-url"}},addProseMirrorPlugins(){const e=x1({onRequestImage:this.options.onRequestImage,onInsertLocalImageFile:this.options.onInsertLocalImageFile,enableImages:this.options.enableImages,imageSlashFallback:this.options.imageSlashFallback,translations:this.options.translations,classNames:this.options.classNames});return[zC({editor:this.editor,char:"/",command:({editor:t,range:n,props:r})=>{r.command({editor:t,range:n})},...e})]}}),w1=e=>{const{node:t,updateAttributes:n,deleteNode:r,selected:o}=e,{src:s,width:i,height:a,rotation:l,objectFit:c="contain",objectPosition:u="50% 50%",isUploading:d}=t.attrs,f=We(),p=Ve(),m=Vr(),[g,b]=K.useState(!1),[x,S]=K.useState({x:0,y:0}),[k,y]=K.useState(1),[A,w]=K.useState(null),[C,T]=K.useState(!1),[I,O]=K.useState(!1),[j,D]=K.useState(""),F=K.useRef(null),B=K.useRef(null),N=K.useRef(null),$=typeof t.attrs.alt=="string"&&t.attrs.alt.trim()?t.attrs.alt:m.imageAlt,V=()=>{if(F.current&&N.current===null){const{naturalWidth:H,naturalHeight:J}=F.current;H>0&&J>0&&(N.current=H/J)}},_=()=>{D(typeof t.attrs.alt=="string"?t.attrs.alt:"")};K.useEffect(()=>{_()},[t.attrs.alt]),K.useEffect(()=>{!o&&I&&O(!1)},[o,I]);const R=(H,J)=>{H.preventDefault(),H.stopPropagation();const oe=H.clientX,ge=H.clientY,Ce=B.current?.offsetWidth??300,ve=B.current?.offsetHeight??200,we=N.current??Ce/ve,Ee=H.shiftKey,st=qe=>{const ye=qe.clientX-oe,Re=qe.clientY-ge;if(qe.shiftKey||Ee){let Te=Math.max(80,Ce+ye),_e=J==="right"?ve:Math.max(60,ve+Re);n({width:`${Te}px`,height:J==="right"?a:`${_e}px`,objectFit:"cover"})}else if(J==="bottom"){const Te=Math.max(60,ve+Re),_e=Te*we;n({width:`${Math.round(_e)}px`,height:`${Math.round(Te)}px`,objectFit:"contain"})}else{const Te=Math.max(80,Ce+ye),_e=Te/we;n({width:`${Math.round(Te)}px`,height:`${Math.round(_e)}px`,objectFit:"contain"})}},Xe=()=>{document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",Xe)};document.addEventListener("mousemove",st),document.addEventListener("mouseup",Xe)},z=H=>{if(!H.ctrlKey||c!=="cover")return;H.preventDefault(),H.stopPropagation(),T(!0);const J=H.clientX,oe=H.clientY,ge=(u||"50% 50%").split(" "),Ce=parseFloat(ge[0])??50,ve=parseFloat(ge[1])??50,we=B.current?.offsetWidth??300,Ee=B.current?.offsetHeight??200,st=qe=>{const ye=qe.clientX-J,Re=qe.clientY-oe,Pe=Math.max(0,Math.min(100,Ce-ye/we*100)),Te=Math.max(0,Math.min(100,ve-Re/Ee*100));n({objectPosition:`${Pe.toFixed(1)}% ${Te.toFixed(1)}%`})},Xe=()=>{T(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",Xe)};document.addEventListener("mousemove",st),document.addEventListener("mouseup",Xe)},W=K.useCallback((H,J)=>{w(J)},[]),re=async()=>{try{const H=await S1(s,A,l);n({src:H,rotation:0}),b(!1)}catch(H){console.error(H),b(!1)}},se=()=>{const H=((l||0)+90)%360;n({rotation:H})},le=()=>{const H=j.trim();n({alt:H||null}),O(!1)},te=()=>{n({alt:null}),D(""),O(!1)},G=c==="cover";return h.jsxs(Tr.NodeViewWrapper,{className:M("relative block max-w-full my-4",p?.imageNodeWrapper),"data-drag-handle":!0,children:[h.jsx("div",{ref:B,className:M("relative group ring-2 transition-all inline-block max-w-full",o?"ring-blue-500":"ring-transparent",g&&"ring-0",p?.imageContainer),style:{width:i,minWidth:80},children:g?h.jsxs("div",{className:M("relative",p?.imageCropArea),style:{width:"100%",height:"400px",backgroundColor:"#333"},children:[h.jsx(Oh,{image:s,crop:x,zoom:k,rotation:l,aspect:4/3,onCropChange:S,onRotationChange:H=>n({rotation:H}),onZoomChange:y,onCropComplete:W}),h.jsxs("div",{className:M("absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 p-2 rounded-xl shadow-lg z-10",f==="dark"?"bg-neutral-800":"bg-white",p?.imageCropToolbar),children:[h.jsx("button",{onClick:()=>b(!1),title:m.cancel,"aria-label":m.cancel,className:M("p-2 text-red-500 rounded-full",f==="dark"?"hover:bg-neutral-700":"hover:bg-neutral-100",p?.imageCropButton,p?.imageCropCancelButton),children:h.jsx(q.X,{size:16})}),h.jsx("button",{onClick:re,title:m.apply,"aria-label":m.apply,className:M("p-2 text-green-500 rounded-full",f==="dark"?"hover:bg-neutral-700":"hover:bg-neutral-100",p?.imageCropButton,p?.imageCropApplyButton),children:h.jsx(q.Check,{size:16})})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:M("relative w-full",G&&"overflow-hidden",p?.imageFrame),style:{height:a==="auto"?void 0:a},children:[h.jsx("img",{ref:F,src:s,alt:$,onLoad:V,onMouseDown:z,className:M("block max-w-full rounded select-none",G&&"w-full h-full",C&&"cursor-grabbing",!C&&G&&"cursor-grab",d&&"opacity-50 blur-[2px] grayscale-[0.5]",p?.imageElement),style:{width:G?"100%":i,height:G?"100%":a,objectFit:G?"cover":void 0,objectPosition:G?u:void 0,transform:l?`rotate(${l}deg)`:void 0,transition:o?"none":"transform 0.2s, filter 0.2s, opacity 0.2s"}}),d&&h.jsx("div",{className:M("absolute inset-0 flex items-center justify-center z-10 pointer-events-none",p?.imageLoadingOverlay),children:h.jsx("div",{className:M("flex items-center justify-center p-3 rounded-2xl shadow-xl backdrop-blur-md",f==="dark"?"bg-black/50":"bg-white/60",p?.imageLoadingBox),children:h.jsx(q.Loader2,{className:M("w-8 h-8 animate-spin",f==="dark"?"text-white":"text-neutral-800",p?.imageLoadingIcon)})})}),o&&G&&!d&&h.jsx("div",{className:M("absolute inset-0 flex items-end justify-center pb-2 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity",p?.imagePanHintOverlay),children:h.jsx("span",{className:M("text-[10px] px-2 py-0.5 rounded-full font-medium",f==="dark"?"bg-black/60 text-neutral-300":"bg-white/80 text-neutral-500",p?.imagePanHint),children:m.imagePanHint})})]}),o&&h.jsxs("div",{className:M("absolute top-2 right-2 flex items-center gap-1 backdrop-blur border p-1 rounded-xl shadow-sm opacity-0 group-hover:opacity-100 transition-opacity z-10",f==="dark"?"bg-neutral-800/90 border-neutral-700":"bg-white/90 border-neutral-200",p?.imageToolbar),children:[h.jsx("button",{type:"button",onClick:se,title:m.rotate,"aria-label":m.rotate,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton),children:h.jsx(q.RotateCw,{size:14})}),h.jsx("button",{type:"button",onClick:()=>b(!0),title:m.crop,"aria-label":m.crop,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton),children:h.jsx(q.Crop,{size:14})}),h.jsx(Lo,{open:I,onOpenChange:H=>{O(H),H&&_()},align:"end",side:"bottom",trigger:h.jsx("button",{type:"button",title:m.altText,"aria-label":m.altText,className:M("p-1.5 rounded-full",f==="dark"?"hover:bg-neutral-700 text-neutral-300":"hover:bg-neutral-100 text-neutral-600",p?.imageToolbarButton,p?.imageAltButton),children:h.jsx(q.Type,{size:14})}),children:h.jsxs("div",{className:M("flex w-56 flex-col gap-2",p?.imageAltPopover),children:[h.jsx("label",{className:M("text-xs font-semibold",f==="dark"?"text-neutral-400":"text-neutral-500",p?.imageAltLabel),children:m.altText}),h.jsx("input",{type:"text",value:j,placeholder:m.altTextPlaceholder,onChange:H=>D(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),le()),H.key==="Escape"&&(H.preventDefault(),_(),O(!1))},autoFocus:!0,className:M("w-full rounded-xl border px-3 py-2 text-sm outline-none transition-colors",f==="dark"?"bg-neutral-800 border-neutral-700 text-neutral-100 placeholder:text-neutral-500 focus:border-neutral-500":"bg-neutral-50 border-neutral-200 text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-400",p?.imageAltInput)}),h.jsxs("div",{className:M("flex gap-2",p?.imageAltActions),children:[h.jsx("button",{type:"button",onClick:le,className:M("flex-1 rounded-full py-1.5 text-sm font-medium transition-colors",f==="dark"?"bg-neutral-700 hover:bg-neutral-600 text-neutral-100":"bg-neutral-900 hover:bg-neutral-700 text-white",p?.imageAltApplyButton),children:m.apply}),h.jsx("button",{type:"button",onClick:te,disabled:!j.trim(),className:M("rounded-full px-3 py-1.5 text-sm transition-colors",f==="dark"?"text-neutral-400 hover:bg-white/10 disabled:text-neutral-600":"text-neutral-500 hover:bg-black/6 disabled:text-neutral-300",!j.trim()&&"cursor-not-allowed",p?.imageAltClearButton),children:m.clearAltText})]})]})}),h.jsx("span",{className:M("w-[1px] h-3 mx-0.5",f==="dark"?"bg-neutral-600":"bg-neutral-300",p?.imageToolbarSeparator)}),h.jsx("button",{type:"button",onClick:r,title:m.delete,"aria-label":m.delete,className:M("p-1.5 rounded-full text-red-500",f==="dark"?"hover:bg-red-900/20":"hover:bg-red-50",p?.imageToolbarButton,p?.imageDeleteButton),children:h.jsx(q.Trash2,{size:14})})]}),o&&h.jsxs(h.Fragment,{children:[h.jsx("div",{onMouseDown:H=>R(H,"right"),className:M("absolute top-1/2 -right-2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-e-resize -translate-y-1/2 shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleRight)}),h.jsx("div",{onMouseDown:H=>R(H,"bottom"),className:M("absolute -bottom-2 left-1/2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-s-resize -translate-x-1/2 shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleBottom)}),h.jsx("div",{onMouseDown:H=>R(H,"bottom-right"),className:M("absolute -bottom-2 -right-2 w-3.5 h-3.5 bg-white border-2 border-blue-500 rounded-full cursor-se-resize shadow z-20",p?.imageResizeHandle,p?.imageResizeHandleBottomRight)})]})]})}),o&&!g&&h.jsx("div",{className:M("mt-1 flex items-center gap-2",p?.imageModeBadge),children:h.jsx("span",{className:M("text-[10px] font-medium",f==="dark"?"text-neutral-500":"text-neutral-400",p?.imageModeText),children:G?m.imageFrameModeHint:m.imageNaturalModeHint})})]})},k1=e=>new Promise((t,n)=>{const r=new Image;r.addEventListener("load",()=>t(r)),r.addEventListener("error",n),r.setAttribute("crossOrigin","anonymous"),r.src=e});function yh(e){return e*Math.PI/180}function C1(e,t,n){const r=yh(n);return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}async function S1(e,t,n=0,r={horizontal:!1,vertical:!1}){const o=await k1(e),s=document.createElement("canvas"),i=s.getContext("2d");if(!i)return"";const a=yh(n),{width:l,height:c}=C1(o.width,o.height,n);s.width=l,s.height=c,i.translate(l/2,c/2),i.rotate(a),i.scale(r.horizontal?-1:1,r.vertical?-1:1),i.translate(-o.width/2,-o.height/2),i.drawImage(o,0,0);const u=document.createElement("canvas"),d=u.getContext("2d");return d?(u.width=t.width,u.height=t.height,d.drawImage(s,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise(f=>{u.toBlob(p=>{p&&f(URL.createObjectURL(p))},"image/png")})):""}const T1=e=>e?e.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]"):"",A1=e=>e?e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'):"",E1=e=>{if(!e)return"";const t=e.trim();return t?/[\s()]/.test(t)?`<${t}>`:t.replace(/\\/g,"\\\\").replace(/\)/g,"\\)"):""},xh=P.Node.create({name:"image",addOptions(){return{inline:!1,allowBase64:!0,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},rotation:{default:0},objectFit:{default:"contain"},objectPosition:{default:"50% 50%"},isUploading:{default:!1}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",P.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>{const n=typeof e.href=="string"&&e.href||typeof e.src=="string"&&e.src||"";return t.createNode("image",{src:n,alt:typeof e.text=="string"&&e.text||typeof e.alt=="string"&&e.alt||null,title:typeof e.title=="string"?e.title:null})},renderMarkdown:e=>{const t=E1(typeof e.attrs?.src=="string"?e.attrs.src:null);if(!t)return"";const n=T1(typeof e.attrs?.alt=="string"?e.attrs.alt:null),r=A1(typeof e.attrs?.title=="string"?e.attrs.title:null);return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addCommands(){return{setAdvancedImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addNodeView(){return Tr.ReactNodeViewRenderer(w1)}}),M1=e=>{const t=e.trim();return t?/^\d+(\.\d+)?$/.test(t)?`${t}px`:/^\d+(\.\d+)?px$/.test(t)?t:/^\d+(\.\d+)?rem$/i.test(t)?t.toLowerCase():null:null},vh=P.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize||null,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>{const n=M1(e);return n?t().setMark("textStyle",{fontSize:n}).run():!1},unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),R1=P.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily?.replace(/['"]/g,"").trim()||null,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),N1=P.Extension.create({name:"textStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontWeight:{default:null,parseHTML:e=>e.style.fontWeight||null,renderHTML:e=>e.fontWeight?{style:`font-weight: ${e.fontWeight}`}:{}},fontStyle:{default:null,parseHTML:e=>e.style.fontStyle||null,renderHTML:e=>e.fontStyle?{style:`font-style: ${e.fontStyle}`}:{}},letterSpacing:{default:null,parseHTML:e=>e.style.letterSpacing||null,renderHTML:e=>e.letterSpacing?{style:`letter-spacing: ${e.letterSpacing}`}:{}},lineHeight:{default:null,parseHTML:e=>e.style.lineHeight||null,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}},textTransform:{default:null,parseHTML:e=>e.style.textTransform||null,renderHTML:e=>e.textTransform?{style:`text-transform: ${e.textTransform}`}:{}}}}]}}),ui=e=>e?e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"",wh=P.Node.create({name:"video",addOptions(){return{allowBase64:!1,HTMLAttributes:{}}},group:"block",draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},controls:{default:!0},width:{default:"100%"}}},parseHTML(){return[{tag:"video",getAttrs:e=>{if(!(e instanceof HTMLElement))return!1;const t=e.querySelector("source[src]"),n=e.getAttribute("src")??t?.getAttribute("src")??null;return n?{src:n,title:e.getAttribute("title"),width:e.getAttribute("width")??"100%",controls:e.hasAttribute("controls")}:!1}}]},renderHTML({HTMLAttributes:e}){return["video",P.mergeAttributes(this.options.HTMLAttributes,e,{controls:!0})]},renderMarkdown:e=>{const t=typeof e.attrs?.src=="string"?e.attrs.src.trim():"";if(!t)return"";const n=typeof e.attrs?.title=="string"?e.attrs.title.trim():"",r=typeof e.attrs?.width=="string"?e.attrs.width.trim():"";return`<video ${[`src="${ui(t)}"`,"controls",n?`title="${ui(n)}"`:"",r?`width="${ui(r)}"`:""].filter(Boolean).join(" ")}></video>`},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),O1=({editor:e})=>{const t=We(),n=Vr(),r=Ve(),o=K.useRef(null),[s,i]=K.useState(null);K.useEffect(()=>{if(!e||!e.view||typeof document>"u")return;let w;const C=T=>{if(!e.isEditable)return;const I=o.current;if(!I||!I.parentElement||I.dataset.dropdownOpen==="true")return;if(I.contains(T.target)){clearTimeout(w);return}const D=e.view.dom.getBoundingClientRect();if(!(T.clientX>=D.left-60&&T.clientX<=D.right&&T.clientY>=D.top&&T.clientY<=D.bottom)){w=setTimeout(()=>{I.classList.add("opacity-0","pointer-events-none")},150);return}clearTimeout(w);const B=e.view.posAtCoords({left:T.clientX,top:T.clientY});if(!B)return;const N=e.state.doc.resolve(B.pos);let $=N.depth;for(;$>1;)$--;const V=$>0?N.before($):N.pos,_=e.view.nodeDOM(V);if(_ instanceof HTMLElement){const R=_.getBoundingClientRect(),z=I.parentElement.getBoundingClientRect(),W=48,re=8;I.style.left=`${R.left-z.left-W-re}px`;const se=R.top-z.top+Math.min(R.height/2-12,4);I.style.top=`${se}px`,I.classList.remove("opacity-0","pointer-events-none")}};return document.addEventListener("mousemove",C),()=>{document.removeEventListener("mousemove",C),clearTimeout(w)}},[e]);const a=()=>{if(!o.current||!o.current.parentElement)return null;const w=o.current.getBoundingClientRect(),C={left:w.left+80,top:w.top+w.height/2},T=e.view.posAtCoords(C);if(T){const I=e.state.doc.resolve(T.pos);let O=I.depth;for(;O>1;)O--;const j=O>0?I.before(O):I.pos,D=e.state.doc.nodeAt(j);if(D){const F=D.type.name==="paragraph"||D.type.name==="heading",B=D.type.name==="image"||D.type.name==="advancedImage",N={pos:j,node:D,isText:F,isImage:B};return i(N),N}}return i(null),null},l=w=>{w.stopPropagation(),w.preventDefault(),a();const C=o.current?.getBoundingClientRect();if(!C)return;const T={left:C.left+80,top:C.top+C.height/2},I=e.view.posAtCoords(T);if(I){const O=e.state.doc.resolve(I.pos);let j=O.depth;for(;j>1;)j--;const D=j>0?O.before(j):O.pos,F=e.state.doc.nodeAt(D);if(F){const B=D+F.nodeSize;e.chain().insertContentAt(B,{type:"paragraph"}).focus(B+1).insertContent("/").run();return}}e.chain().focus().insertContent("/").run()},c=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().insertContentAt(w+C.nodeSize,C.toJSON()).run()},u=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().deleteRange({from:w,to:w+C.nodeSize}).run()},d=()=>{if(!s)return;const{pos:w,node:C}=s,T=e.state.doc.slice(w,w+C.nodeSize),I=T.content.textBetween(0,T.content.size,`
150
150
  `,`
151
- `);navigator.clipboard.writeText(I)},f=()=>{if(!s)return;const{node:w}=s;let C=w.attrs.id;C||(C=`block-${Math.random().toString(36).substr(2,9)}`,e.chain().setNodeSelection(s.pos).updateAttributes(w.type.name,{id:C}).run());const T=new URL(window.location.href);T.hash=C,navigator.clipboard.writeText(T.toString())},p=()=>{if(!s?.isImage)return;const w=s.node.attrs.src;if(!w)return;const C=document.createElement("a");C.href=w,C.download="image.png",document.body.appendChild(C),C.click(),document.body.removeChild(C)},m=(w,C)=>{s&&e.chain().setNodeSelection(s.pos).toggleNode(w,w,C?{level:C}:{}).run()},g=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().setTextSelection({from:w,to:w+C.nodeSize}).unsetAllMarks().run()},[b,x]=K.useState(!1),S=w=>{o.current&&(o.current.dataset.dropdownOpen=w?"true":"false"),w&&a(),x(w)},k=w=>{const C=a()||s;if(!C){w.preventDefault();return}const T=e.view;e.commands.setNodeSelection(C.pos);const I=T.state.selection.content();let O=null,j="";try{const F=typeof T.serializeForClipboard=="function"?T.serializeForClipboard(I):T.__serializeForClipboard?.(T,I);F&&(O=F.dom,j=F.text)}catch(F){console.error("Failed to serialize node for drag",F)}if(!O){w.preventDefault();return}w.dataTransfer.clearData(),w.dataTransfer.setData("text/html",O.innerHTML),w.dataTransfer.setData("text/plain",j),w.dataTransfer.effectAllowed="copyMove";const D=T.nodeDOM(C.pos);D instanceof HTMLElement&&w.dataTransfer.setDragImage(D,0,0),T.dragging={slice:I,move:!0}};let y="",A="";return s?.node&&s.node.descendants(w=>{w.isText&&w.marks&&w.marks.forEach(C=>{C.type.name==="textStyle"&&C.attrs.color&&!y&&(y=C.attrs.color),C.type.name==="highlight"&&C.attrs.color&&!A&&(A=C.attrs.color)})}),h.jsxs("div",{ref:o,className:M("absolute z-50 flex items-center transition-[opacity,top] duration-150 gap-1 opacity-0 pointer-events-none",r?.dragHandleRoot),children:[h.jsx("button",{className:M("p-1 rounded-md bg-transparent transition-colors pointer-events-auto",t==="dark"?"hover:bg-neutral-800 text-neutral-400 hover:text-neutral-100":"hover:bg-neutral-100 text-neutral-400 hover:text-neutral-900",r?.dragHandleAddButton),title:n.addBlockBelow,onClick:l,children:h.jsx(q.Plus,{className:"w-4 h-4"})}),h.jsxs(Dp,{open:b,onOpenChange:S,children:[h.jsxs("div",{className:"relative flex",children:[h.jsx(jp,{asChild:!0,children:h.jsx("div",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-0"})}),h.jsx("button",{className:M("p-1 rounded-md bg-transparent transition-colors cursor-grab active:cursor-grabbing pointer-events-auto",t==="dark"?"hover:bg-neutral-800 text-neutral-400 hover:text-neutral-100":"hover:bg-neutral-100 text-neutral-400 hover:text-neutral-900",r?.dragHandleMenuButton),title:n.options,draggable:!0,onDragStart:k,onClick:()=>S(!0),children:h.jsx(q.GripVertical,{className:"w-4 h-4"})})]}),h.jsxs(Ga,{className:M("w-56",r?.dragHandleMenuContent),align:"start",children:[s?.isText&&h.jsxs(h.Fragment,{children:[h.jsxs(Lc,{children:[h.jsxs(qi,{children:[h.jsx(q.Type,{className:"w-4 h-4"}),n.turnInto]}),h.jsx(Pc,{children:h.jsxs(Ki,{className:M("w-48",r?.dragHandleSubContent),children:[h.jsxs(Ke,{onClick:()=>m("paragraph"),children:[h.jsx(q.Type,{className:"w-4 h-4"})," ",n.text,s.node.type.name==="paragraph"&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",1),children:[h.jsx(q.Heading1,{className:"w-4 h-4"})," ",n.heading1,s.node.type.name==="heading"&&s.node.attrs.level===1&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",2),children:[h.jsx(q.Heading2,{className:"w-4 h-4"})," ",n.heading2,s.node.type.name==="heading"&&s.node.attrs.level===2&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",3),children:[h.jsx(q.Heading3,{className:"w-4 h-4"})," ",n.heading3,s.node.type.name==="heading"&&s.node.attrs.level===3&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]})]})})]}),h.jsxs(Lc,{children:[h.jsxs(qi,{children:[h.jsx(q.Palette,{className:"w-4 h-4"}),n.color]}),h.jsx(Pc,{children:h.jsxs(Ki,{className:M("w-64 max-h-80 overflow-y-auto",r?.dragHandleSubContent),children:[h.jsx("div",{className:M("px-2 py-1.5 text-xs font-semibold text-neutral-500 uppercase tracking-wider",r?.dragHandleColorSectionLabel),children:n.textColor}),[{label:n.defaultText,color:""},{label:n.grayText,color:"#6b7280"},{label:n.brownText,color:"#78350f"},{label:n.orangeText,color:"#f97316"},{label:n.yellowText,color:"#eab308"},{label:n.greenText,color:"#22c55e"},{label:n.blueText,color:"#3b82f6"},{label:n.purpleText,color:"#a855f7"},{label:n.pinkText,color:"#ec4899"},{label:n.redText,color:"#ef4444"}].map(w=>h.jsxs(Ke,{onClick:()=>{if(s){const C=e.chain().setNodeSelection(s.pos);w.color?C.setColor(w.color).run():C.unsetColor().run()}},children:[h.jsx("div",{className:M("font-bold flex items-center justify-center text-[14px]",r?.dragHandleColorTextPreview),style:{color:w.color||"inherit"},children:"A"}),w.label,y===w.color&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]},w.label)),h.jsx(xr,{}),h.jsx("div",{className:M("px-2 py-1.5 text-xs font-semibold text-neutral-500 uppercase tracking-wider",r?.dragHandleColorSectionLabel),children:n.background}),[{label:n.defaultBackground,color:""},{label:n.grayBackground,color:"#f3f4f6"},{label:n.brownBackground,color:"#fef3c7"},{label:n.orangeBackground,color:"#ffedd5"},{label:n.yellowBackground,color:"#fef08a"},{label:n.greenBackground,color:"#dcfce7"},{label:n.blueBackground,color:"#dbeafe"},{label:n.purpleBackground,color:"#f3e8ff"},{label:n.pinkBackground,color:"#fce7f3"},{label:n.redBackground,color:"#fee2e2"}].map(w=>h.jsxs(Ke,{onClick:()=>{if(s){const C=e.chain().setNodeSelection(s.pos);w.color?C.setHighlight({color:w.color}).run():C.unsetHighlight().run()}},children:[h.jsx("div",{className:M("w-4 h-4 rounded-full border",t==="dark"?"border-neutral-700/20":"border-neutral-200/20",r?.dragHandleColorSwatch),style:{backgroundColor:w.color||"transparent"}}),w.label,A===w.color&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]},w.label))]})})]}),h.jsxs(Ke,{onClick:g,children:[h.jsx(q.RotateCcw,{className:"w-4 h-4"}),n.resetFormatting]}),h.jsx(xr,{})]}),s?.isImage&&h.jsxs(h.Fragment,{children:[h.jsxs(Ke,{onClick:p,children:[h.jsx(q.Download,{className:"w-4 h-4"}),n.download]}),h.jsx(xr,{})]}),h.jsxs(Ke,{onClick:c,children:[h.jsx(q.Copy,{className:"w-4 h-4"}),n.duplicateNode]}),h.jsxs(Ke,{onClick:d,children:[h.jsx(q.Copy,{className:"w-4 h-4"}),n.copyToClipboard]}),h.jsxs(Ke,{onClick:f,children:[h.jsx(q.Link,{className:"w-4 h-4"}),n.copyAnchorLink]}),h.jsx(xr,{}),h.jsxs(Ke,{className:M(t==="dark"?"text-red-400 focus:bg-red-950/30":"text-red-600 focus:bg-red-50",r?.dragHandleDeleteItem),onClick:u,children:[h.jsx(q.Trash2,{className:"w-4 h-4"}),n.delete]})]})]})]})},kh=[{id:"normal",label:"Normal text",type:"paragraph"},{id:"title",label:"Title",preview:"Title",type:"heading",level:1,fontSize:"36px",fontWeight:"700",letterSpacing:"-0.025em"},{id:"subtitle",label:"Subtitle",preview:"Subtitle",type:"paragraph",fontSize:"18px",fontWeight:"400",fontStyle:"normal",color:"#737373"},{id:"heading1",label:"Heading 1",preview:"Heading 1",type:"heading",level:1,fontSize:"30px",fontWeight:"600"},{id:"heading2",label:"Heading 2",preview:"Heading 2",type:"heading",level:2,fontSize:"24px",fontWeight:"600"},{id:"heading3",label:"Heading 3",preview:"Heading 3",type:"heading",level:3,fontSize:"20px",fontWeight:"600"},{id:"quote",label:"Quote",preview:"Quote",type:"blockquote",fontSize:"18px",fontStyle:"italic",color:"#525252"},{id:"caption",label:"Caption",preview:"Caption",type:"paragraph",fontSize:"12px",fontWeight:"400",color:"#737373",letterSpacing:"0.025em"}],I1=/^(#{1,6}\s|[*_]{1,2}\S|^[-*+]\s|^\d+\.\s|^>\s|^```|^!\[|^\[)/m,di="&nbsp;",fi=" ",pr=50,hr=200,ru=10,is="VOILABS_REACT_EDITOR_THEME",Ch=e=>{if(!e)return null;const t=decodeURIComponent(e).trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="dark"||t==="light"?t:null},P1=()=>typeof document>"u"?null:document.cookie.split(";").map(t=>t.trim()).filter(t=>t.startsWith(`${is}=`)).map(t=>{const[,...n]=t.split("=");return Ch(n.join("="))}).filter(Boolean).at(-1)??null,L1=()=>{if(typeof window>"u")return null;try{return Ch(window.localStorage.getItem(is))}catch{return null}},pi=()=>P1()??L1(),D1=e=>{if(typeof document<"u"&&(document.cookie=`${is}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`),typeof window<"u")try{window.localStorage.setItem(is,e)}catch{}},j1=e=>e==="dark"?{backgroundColor:"#171717",color:"#f5f5f5",colorScheme:"dark"}:{backgroundColor:"#ffffff",color:"#171717",colorScheme:"light"},z1=e=>e==="dark"?{backgroundColor:"rgba(23, 23, 23, 0.95)",color:"#a3a3a3",colorScheme:"dark"}:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"#737373",colorScheme:"light"},_1=e=>{const t=e.trim();return t?t.split(/\s+/).length:0};function $1(e){if(!e)return!1;const t=e.trim();return t.startsWith("<")?!1:I1.test(t)}function F1(e,t){return e==="html"?"html":e==="markdown"||t&&$1(t)?"markdown":"html"}const hi=(e,t)=>{const n=t.parseInline(e);return e.length===1&&e[0].type==="text"&&(e[0].raw===di||e[0].text===di||e[0].raw===fi||e[0].text===fi)&&n.length===1&&n[0].type==="text"&&(n[0].text===di||n[0].text===fi)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,n)},ou=(e,t)=>{if(t==="start"){let r=0;for(;r<e.length&&e[r]?.type==="br";)r+=1;return e.slice(r)}let n=e.length;for(;n>0&&e[n-1]?.type==="br";)n-=1;return e.slice(0,n)},B1=Em.extend({parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);if(!n.some(a=>a.type==="image"))return hi(n,t);const r=[];let o=[],s=0;const i=a=>{let l=ou(o,"start");a&&(l=ou(l,"end")),o=[],l.length!==0&&r.push(hi(l,t))};for(;s<n.length;){const a=n[s];if(a?.type==="image"){i(!0);const l=t.parseChildren([a]);for(Array.isArray(l)?r.push(...l):l&&r.push(l),s+=1;s<n.length&&n[s]?.type==="br";)s+=1;continue}o.push(a),s+=1}return i(!1),r.length>0?r:hi(n,t)}}),H1=({value:e,onChange:t,format:n,theme:r="auto",onUpload:o,disableVideoUpload:s,disableImageUpload:i,classNames:a,translations:l,styles:c})=>{const u={...Xn,...l},d=c??kh,f=K.useRef(null),p=r==="dark"||r==="light"?r:null,m=!p,[g,b]=K.useState(p??"auto"),[x,S]=K.useState(!1),[k,y]=K.useState(0),[A,w]=K.useState(100),[C,T]=K.useState(!1),I=Tr.useEditor({extensions:[Ah.configure({paragraph:!1,dropcursor:{color:"#0ea5e9",width:3,class:"rounded-full transition-all duration-100 ease-in-out"}}),Nh,B1,Rh.configure({types:["heading","paragraph"]}),Mh.configure({placeholder:({node:N})=>N.type.name==="heading"?`${u.placeholderHeading} ${N.attrs.level}`:N.type.name==="blockquote"?u.placeholderQuote:u.placeholder}),Eh.configure({openOnClick:!1}),xh,wh,Um,Nd,vh,R1,N1,Od,Ym.configure({multicolor:!0}),Zm,tg,Cu,ku.configure({nested:!0,HTMLAttributes:{class:M("flex items-start gap-3 my-2 group","[&>div]:flex-auto [&>div]:min-w-0 [&>div>p]:m-0","data-[checked='true']:[&>div]:line-through data-[checked='true']:[&>div]:opacity-50 data-[checked='true']:[&>div]:transition-all data-[checked='true']:[&>div]:duration-300","[&>label]:flex-none [&>label]:pt-[5px] [&>label]:select-none [&>label]:cursor-pointer","[&_input[type='checkbox']]:appearance-none [&_input[type='checkbox']]:m-0","[&_input[type='checkbox']]:w-[18px] [&_input[type='checkbox']]:h-[18px]","[&_input[type='checkbox']]:border-2 [&_input[type='checkbox']]:rounded-[5px]","[&_input[type='checkbox']]:transition-all [&_input[type='checkbox']]:duration-200","[&_input[type='checkbox']]:flex [&_input[type='checkbox']]:items-center [&_input[type='checkbox']]:justify-center","[&_input[type='checkbox']]:border-neutral-300 dark:[&_input[type='checkbox']]:border-neutral-600","[&_input[type='checkbox']]:bg-white dark:[&_input[type='checkbox']]:bg-neutral-800","hover:[&_input[type='checkbox']]:border-sky-400 dark:hover:[&_input[type='checkbox']]:border-sky-500","[&_input[type='checkbox']:checked]:bg-sky-500 [&_input[type='checkbox']:checked]:border-sky-500","[&_input[type='checkbox']:checked:after]:content-['']","[&_input[type='checkbox']:checked:after]:block","[&_input[type='checkbox']:checked:after]:w-[4px]","[&_input[type='checkbox']:checked:after]:h-[8px]","[&_input[type='checkbox']:checked:after]:border-white","[&_input[type='checkbox']:checked:after]:border-r-2","[&_input[type='checkbox']:checked:after]:border-b-2","[&_input[type='checkbox']:checked:after]:rotate-45","[&_input[type='checkbox']:checked:after]:-mt-[2px]")}}),Md,ax,ix,sx,Am.configure({markedOptions:{breaks:!0,gfm:!0}}),v1.configure({enableImages:!i,translations:u,classNames:a,onRequestImage:o?async({editor:N,range:$})=>new Promise(V=>{const _=document.createElement("input");_.type="file",_.accept="image/*",_.onchange=async()=>{_.files?.length?V({kind:"file",file:_.files[0]}):V(null)},_.click()}):null,onInsertLocalImageFile:o?async({editor:N,range:$,file:V})=>{N.chain().focus().deleteRange($).run();const{url:_}=await o(V);N.chain().focus().setAdvancedImage({src:_}).run()}:null})],editorProps:{handleDrop:(N,$,V,_)=>{if(_||!o||i||!$.dataTransfer?.files?.length)return!1;const z=Array.from($.dataTransfer.files).filter(se=>se.type.startsWith("image/"));if(z.length===0)return!1;$.preventDefault();const W=N.posAtCoords({left:$.clientX,top:$.clientY}),re=W?W.pos:N.state.selection.from;return z.forEach(async se=>{const le=URL.createObjectURL(se),{tr:te}=N.state,G=N.state.schema.nodes.image.create({src:le,isUploading:!0});te.insert(re,G),N.dispatch(te);try{const{url:H}=await o(se);let J=null;N.state.doc.descendants((oe,ge)=>{if(oe.type.name==="image"&&oe.attrs.src===le)return J=ge,!1}),J!==null&&N.dispatch(N.state.tr.setNodeMarkup(J,void 0,{...N.state.doc.nodeAt(J)?.attrs,src:H,isUploading:!1}))}catch{let J=null;N.state.doc.descendants((oe,ge)=>{if(oe.type.name==="image"&&oe.attrs.src===le)return J=ge,!1}),J!==null&&N.dispatch(N.state.tr.delete(J,J+1))}}),!0},handlePaste:(N,$,V)=>{if(!o||i||!$.clipboardData?.files?.length)return!1;const R=Array.from($.clipboardData.files).filter(W=>W.type.startsWith("image/"));if(R.length===0)return!1;$.preventDefault();const z=N.state.selection.from;return R.forEach(async W=>{const re=URL.createObjectURL(W),{tr:se}=N.state,le=N.state.schema.nodes.image.create({src:re,isUploading:!0});se.insert(z,le),N.dispatch(se);try{const{url:te}=await o(W);let G=null;N.state.doc.descendants((H,J)=>{if(H.type.name==="image"&&H.attrs.src===re)return G=J,!1}),G!==null&&N.dispatch(N.state.tr.setNodeMarkup(G,void 0,{...N.state.doc.nodeAt(G)?.attrs,src:te,isUploading:!1}))}catch{let G=null;N.state.doc.descendants((H,J)=>{if(H.type.name==="image"&&H.attrs.src===re)return G=J,!1}),G!==null&&N.dispatch(N.state.tr.delete(G,G+1))}}),!0}},onUpdate:({editor:N})=>{t&&t(N.getMarkdown())}});K.useEffect(()=>{if(p){b(p);return}const N=pi();N&&b(N)},[p]),K.useEffect(()=>{if(p||pi()||typeof window>"u")return;const N=window.matchMedia?.("(prefers-color-scheme: dark)");if(!N)return;const $=V=>{pi()||b(V.matches?"dark":"light")};return N.addEventListener("change",$),()=>{N.removeEventListener("change",$)}},[p]),K.useEffect(()=>{(async()=>{if(e&&I&&!x)try{const N=F1(n,e);await I.commands.setContent(e,{contentType:N}),S(!0)}catch(N){console.error(N)}})()},[e,I]),K.useEffect(()=>{if(!I)return;const N=()=>{y(_1(I.getText()))};return N(),I.on("update",N),I.on("transaction",N),()=>{I.off("update",N),I.off("transaction",N)}},[I]),K.useEffect(()=>{if(typeof document>"u")return;const N=()=>{if(!document.fullscreenElement){T(!1);return}document.fullscreenElement===f.current&&T(!0)};return document.addEventListener("fullscreenchange",N),()=>{document.removeEventListener("fullscreenchange",N)}},[]);const O=N=>{w($=>Math.min(hr,Math.max(pr,$+N)))},j=()=>{const N=!C;if(T(N),!(typeof document>"u")){if(N){f.current?.requestFullscreen?.().catch(()=>{});return}document.fullscreenElement&&document.exitFullscreen?.().catch(()=>{})}},D=N=>{p||(b(N),D1(N))},F=j1(g),B=z1(g);return h.jsx(Fn.Provider,{children:h.jsx(Wr.Provider,{value:{theme:g,translations:u,classNames:a,styles:d},children:h.jsxs("div",{ref:f,"data-theme":g,"data-voilabs-react-editor-theme":g,style:F,className:M("flex h-[100dvh] min-h-0 max-h-[100dvh] flex-col overflow-hidden relative antialiased transition-colors",a?.root,g==="dark"&&"dark",g==="dark"?"bg-neutral-900 text-neutral-100":"bg-white text-neutral-900",C&&"fixed inset-0 z-[9998] h-screen w-screen rounded-none"),children:[h.jsx(Xp,{editor:I,onUpload:o,disableVideoUpload:s,disableImageUpload:i,classNames:a,translations:l,styles:d,onThemeChange:D,showThemeToggle:m}),h.jsx("div",{style:F,className:M("w-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden",C&&"min-h-0",a?.content,a?.contentScroller,a?.editorContent,g==="dark"?"bg-neutral-900":"bg-white"),children:h.jsxs("div",{style:{...F,zoom:A/100},className:M("w-full max-w-4xl mx-auto px-4 py-8 relative",a?.contentInner,g==="dark"?"bg-neutral-900 text-neutral-100":"bg-white text-neutral-900"),children:[I&&h.jsx(O1,{editor:I}),h.jsx(Tr.EditorContent,{editor:I,className:M("w-full prose max-w-none p-0! m-0!","prose-p:my-1.5 prose-p:leading-7","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-3xl prose-h1:mt-8 prose-h1:mb-3","prose-h2:text-2xl prose-h2:mt-6 prose-h2:mb-2","prose-h3:text-xl prose-h3:mt-5 prose-h3:mb-2","prose-h4:text-lg prose-h4:mt-4 prose-h4:mb-1.5","prose-h5:text-base prose-h5:mt-3 prose-h5:mb-1","prose-input[type='checkbox']:w-5","prose-a:text-blue-500 prose-a:no-underline hover:prose-a:underline prose-a:font-normal","[&_ul]:px-4 [&_ol]:px-4","[&_ul]:m-[1.25rem_1rem_1.25rem_0.4rem] [&_ol]:m-[1.25rem_1rem_1.25rem_0.4rem]","[&_li_p]:my-[0.25em]","prose-blockquote:border-l-2 prose-blockquote:my-4 prose-blockquote:py-0.5 prose-blockquote:not-italic","prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-sm prose-code:before:content-none prose-code:after:content-none","prose-pre:rounded-xl prose-pre:my-4","prose-img:max-w-full prose-img:rounded-lg prose-img:my-3","[&_video]:max-w-full [&_video]:w-full [&_video]:rounded-lg [&_video]:my-3","[&>.tiptap]:outline-none [&>.tiptap]:min-h-[400px]","[&>.tiptap>*:first-child]:mt-0 [&>.tiptap>*:last-child]:mb-0","[&_mark]:rounded [&_mark]:px-0.5","[&_ul[data-type='taskList']]:list-none [&_ul[data-type='taskList']]:ml-0 [&_ul[data-type='taskList']]:p-0","[&_ul[data-type='taskList']_ul[data-type='taskList']]:m-0","[&_li[data-type='taskItem']]:flex [&_li[data-type='taskItem']]:items-start [&_li[data-type='taskItem']]:mb-2.5","[&_li[data-type='taskItem']>label]:flex [&_li[data-type='taskItem']>label]:items-center [&_li[data-type='taskItem']>label]:justify-center [&_li[data-type='taskItem']>label]:flex-none [&_li[data-type='taskItem']>label]:mr-2 [&_li[data-type='taskItem']>label]:select-none [&_li[data-type='taskItem']>label]:pt-[5px]","[&_li[data-type='taskItem']>label>input]:appearance-none [&_li[data-type='taskItem']>label>input]:m-0 [&_li[data-type='taskItem']>label>input]:w-[18px] [&_li[data-type='taskItem']>label>input]:h-[18px] [&_li[data-type='taskItem']>label>input]:rounded-[5px] [&_li[data-type='taskItem']>label>input]:border-2 [&_li[data-type='taskItem']>label>input]:transition-all [&_li[data-type='taskItem']>label>input]:cursor-pointer [&_li[data-type='taskItem']>label>input]:flex [&_li[data-type='taskItem']>label>input]:items-center [&_li[data-type='taskItem']>label>input]:justify-center",g==="dark"?"[&_li[data-type='taskItem']>label>input]:border-neutral-700 [&_li[data-type='taskItem']>label>input]:bg-neutral-800 hover:[&_li[data-type='taskItem']>label>input]:border-sky-500/50":"[&_li[data-type='taskItem']>label>input]:border-neutral-300 [&_li[data-type='taskItem']>label>input]:bg-white hover:[&_li[data-type='taskItem']>label>input]:border-sky-400","[&_li[data-type='taskItem'][data-checked='true']>label>input]:bg-sky-500 [&_li[data-type='taskItem'][data-checked='true']>label>input]:border-sky-500","[&_li[data-type='taskItem'][data-checked='true']>label>input]:after:content-[''] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:block [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:w-[4px] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:h-[8px] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-white [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-r-2 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-b-2 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:rotate-45 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:-mt-[2px]","[&_li[data-type='taskItem']>div]:flex-auto [&_li[data-type='taskItem']>div]:min-w-0 [&_li[data-type='taskItem']>div>p]:m-0","[&_li[data-type='taskItem'][data-checked='true']>div]:opacity-40 [&_li[data-type='taskItem'][data-checked='true']>div]:line-through [&_li[data-type='taskItem'][data-checked='true']>div]:transition-all [&_li[data-type='taskItem'][data-checked='true']>div]:duration-300","[&_.node-advancedImage]:block [&_.node-advancedImage]:max-w-full",a?.prose,g==="dark"?"prose-invert [&>.tiptap]:text-neutral-100 [&>.tiptap_*::selection]:bg-blue-500/30 [&_mark]:bg-yellow-400/20 [&_mark]:text-yellow-200":"[&>.tiptap]:text-neutral-900 [&>.tiptap_*::selection]:bg-blue-200/40 [&_mark]:bg-yellow-200 [&_mark]:text-yellow-900",g==="dark"?"[&_p.is-empty::before]:text-neutral-600":"[&_p.is-empty::before]:text-neutral-400","[&_p.is-empty::before]:content-[attr(data-placeholder)]","[&_p.is-empty::before]:float-left","[&_p.is-empty::before]:h-0","[&_p.is-empty::before]:pointer-events-none")})]})}),h.jsxs("div",{style:B,className:M("flex shrink-0 items-center justify-between gap-3 border-t px-4 py-2 text-xs font-medium backdrop-blur-md",a?.footer,g==="dark"?"border-white/8 bg-neutral-900/95 text-neutral-400":"border-black/6 bg-white/95 text-neutral-500"),children:[h.jsxs("div",{className:M("min-w-0 truncate",a?.footerWordCount),children:[k," ",k===1?u.word:u.words]}),h.jsxs("div",{className:M("flex items-center gap-1",a?.footerControls),children:[h.jsxs("div",{className:M("flex items-center gap-0.5",a?.footerZoomGroup),children:[h.jsx(kt,{content:u.zoomOut,children:h.jsx("button",{type:"button",onClick:()=>O(-ru),disabled:A<=pr,"aria-label":u.zoomOut,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400":"text-neutral-500",A>pr&&(g==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),A<=pr&&"cursor-not-allowed opacity-30",A<=pr&&a?.footerButtonDisabled,a?.footerButton,a?.footerZoomButton),children:h.jsx(q.Minus,{size:14})})}),h.jsx(kt,{content:u.resetZoom,children:h.jsxs("button",{type:"button",onClick:()=>w(100),"aria-label":u.resetZoom,className:M("h-8 min-w-14 rounded-full px-2 text-center tabular-nums transition-colors",g==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",a?.footerButton,a?.footerZoomValue),children:[A,"%"]})}),h.jsx(kt,{content:u.zoomIn,children:h.jsx("button",{type:"button",onClick:()=>O(ru),disabled:A>=hr,"aria-label":u.zoomIn,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400":"text-neutral-500",A<hr&&(g==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),A>=hr&&"cursor-not-allowed opacity-30",A>=hr&&a?.footerButtonDisabled,a?.footerButton,a?.footerZoomButton),children:h.jsx(q.Plus,{size:14})})})]}),h.jsx(kt,{content:C?u.exitFullscreen:u.fullscreen,children:h.jsx("button",{type:"button",onClick:j,"aria-label":C?u.exitFullscreen:u.fullscreen,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400 hover:bg-white/10 hover:text-neutral-100":"text-neutral-500 hover:bg-black/6 hover:text-neutral-900",a?.footerButton,a?.footerFullscreenButton),children:C?h.jsx(q.Minimize2,{size:14}):h.jsx(q.Maximize2,{size:14})})})]})]})]})})})};exports.AdvancedImage=xh;exports.DEFAULT_PARAGRAPH_STYLES=kh;exports.Editor=H1;exports.FontSize=vh;exports.Toolbar=Xp;exports.Video=wh;
151
+ `);navigator.clipboard.writeText(I)},f=()=>{if(!s)return;const{node:w}=s;let C=w.attrs.id;C||(C=`block-${Math.random().toString(36).substr(2,9)}`,e.chain().setNodeSelection(s.pos).updateAttributes(w.type.name,{id:C}).run());const T=new URL(window.location.href);T.hash=C,navigator.clipboard.writeText(T.toString())},p=()=>{if(!s?.isImage)return;const w=s.node.attrs.src;if(!w)return;const C=document.createElement("a");C.href=w,C.download="image.png",document.body.appendChild(C),C.click(),document.body.removeChild(C)},m=(w,C)=>{s&&e.chain().setNodeSelection(s.pos).toggleNode(w,w,C?{level:C}:{}).run()},g=()=>{if(!s)return;const{pos:w,node:C}=s;e.chain().setTextSelection({from:w,to:w+C.nodeSize}).unsetAllMarks().run()},[b,x]=K.useState(!1),S=w=>{o.current&&(o.current.dataset.dropdownOpen=w?"true":"false"),w&&a(),x(w)},k=w=>{const C=a()||s;if(!C){w.preventDefault();return}const T=e.view;e.commands.setNodeSelection(C.pos);const I=T.state.selection.content();let O=null,j="";try{const F=typeof T.serializeForClipboard=="function"?T.serializeForClipboard(I):T.__serializeForClipboard?.(T,I);F&&(O=F.dom,j=F.text)}catch(F){console.error("Failed to serialize node for drag",F)}if(!O){w.preventDefault();return}w.dataTransfer.clearData(),w.dataTransfer.setData("text/html",O.innerHTML),w.dataTransfer.setData("text/plain",j),w.dataTransfer.effectAllowed="copyMove";const D=T.nodeDOM(C.pos);D instanceof HTMLElement&&w.dataTransfer.setDragImage(D,0,0),T.dragging={slice:I,move:!0}};let y="",A="";return s?.node&&s.node.descendants(w=>{w.isText&&w.marks&&w.marks.forEach(C=>{C.type.name==="textStyle"&&C.attrs.color&&!y&&(y=C.attrs.color),C.type.name==="highlight"&&C.attrs.color&&!A&&(A=C.attrs.color)})}),h.jsxs("div",{ref:o,className:M("absolute z-50 flex items-center transition-[opacity,top] duration-150 gap-1 opacity-0 pointer-events-none",r?.dragHandleRoot),children:[h.jsx("button",{className:M("p-1 rounded-md bg-transparent transition-colors pointer-events-auto",t==="dark"?"hover:bg-neutral-800 text-neutral-400 hover:text-neutral-100":"hover:bg-neutral-100 text-neutral-400 hover:text-neutral-900",r?.dragHandleAddButton),title:n.addBlockBelow,onClick:l,children:h.jsx(q.Plus,{className:"w-4 h-4"})}),h.jsxs(Dp,{open:b,onOpenChange:S,children:[h.jsxs("div",{className:"relative flex",children:[h.jsx(jp,{asChild:!0,children:h.jsx("div",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-0"})}),h.jsx("button",{className:M("p-1 rounded-md bg-transparent transition-colors cursor-grab active:cursor-grabbing pointer-events-auto",t==="dark"?"hover:bg-neutral-800 text-neutral-400 hover:text-neutral-100":"hover:bg-neutral-100 text-neutral-400 hover:text-neutral-900",r?.dragHandleMenuButton),title:n.options,draggable:!0,onDragStart:k,onClick:()=>S(!0),children:h.jsx(q.GripVertical,{className:"w-4 h-4"})})]}),h.jsxs(Ga,{className:M("w-56",r?.dragHandleMenuContent),align:"start",children:[s?.isText&&h.jsxs(h.Fragment,{children:[h.jsxs(Lc,{children:[h.jsxs(qi,{children:[h.jsx(q.Type,{className:"w-4 h-4"}),n.turnInto]}),h.jsx(Pc,{children:h.jsxs(Ki,{className:M("w-48",r?.dragHandleSubContent),children:[h.jsxs(Ke,{onClick:()=>m("paragraph"),children:[h.jsx(q.Type,{className:"w-4 h-4"})," ",n.text,s.node.type.name==="paragraph"&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",1),children:[h.jsx(q.Heading1,{className:"w-4 h-4"})," ",n.heading1,s.node.type.name==="heading"&&s.node.attrs.level===1&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",2),children:[h.jsx(q.Heading2,{className:"w-4 h-4"})," ",n.heading2,s.node.type.name==="heading"&&s.node.attrs.level===2&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]}),h.jsxs(Ke,{onClick:()=>m("heading",3),children:[h.jsx(q.Heading3,{className:"w-4 h-4"})," ",n.heading3,s.node.type.name==="heading"&&s.node.attrs.level===3&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]})]})})]}),h.jsxs(Lc,{children:[h.jsxs(qi,{children:[h.jsx(q.Palette,{className:"w-4 h-4"}),n.color]}),h.jsx(Pc,{children:h.jsxs(Ki,{className:M("w-64 max-h-80 overflow-y-auto",r?.dragHandleSubContent),children:[h.jsx("div",{className:M("px-2 py-1.5 text-xs font-semibold text-neutral-500 uppercase tracking-wider",r?.dragHandleColorSectionLabel),children:n.textColor}),[{label:n.defaultText,color:""},{label:n.grayText,color:"#6b7280"},{label:n.brownText,color:"#78350f"},{label:n.orangeText,color:"#f97316"},{label:n.yellowText,color:"#eab308"},{label:n.greenText,color:"#22c55e"},{label:n.blueText,color:"#3b82f6"},{label:n.purpleText,color:"#a855f7"},{label:n.pinkText,color:"#ec4899"},{label:n.redText,color:"#ef4444"}].map(w=>h.jsxs(Ke,{onClick:()=>{if(s){const C=e.chain().setNodeSelection(s.pos);w.color?C.setColor(w.color).run():C.unsetColor().run()}},children:[h.jsx("div",{className:M("font-bold flex items-center justify-center text-[14px]",r?.dragHandleColorTextPreview),style:{color:w.color||"inherit"},children:"A"}),w.label,y===w.color&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]},w.label)),h.jsx(xr,{}),h.jsx("div",{className:M("px-2 py-1.5 text-xs font-semibold text-neutral-500 uppercase tracking-wider",r?.dragHandleColorSectionLabel),children:n.background}),[{label:n.defaultBackground,color:""},{label:n.grayBackground,color:"#f3f4f6"},{label:n.brownBackground,color:"#fef3c7"},{label:n.orangeBackground,color:"#ffedd5"},{label:n.yellowBackground,color:"#fef08a"},{label:n.greenBackground,color:"#dcfce7"},{label:n.blueBackground,color:"#dbeafe"},{label:n.purpleBackground,color:"#f3e8ff"},{label:n.pinkBackground,color:"#fce7f3"},{label:n.redBackground,color:"#fee2e2"}].map(w=>h.jsxs(Ke,{onClick:()=>{if(s){const C=e.chain().setNodeSelection(s.pos);w.color?C.setHighlight({color:w.color}).run():C.unsetHighlight().run()}},children:[h.jsx("div",{className:M("w-4 h-4 rounded-full border",t==="dark"?"border-neutral-700/20":"border-neutral-200/20",r?.dragHandleColorSwatch),style:{backgroundColor:w.color||"transparent"}}),w.label,A===w.color&&h.jsx(q.Check,{className:M("ml-auto w-4 h-4",r?.dragHandleCheckIcon)})]},w.label))]})})]}),h.jsxs(Ke,{onClick:g,children:[h.jsx(q.RotateCcw,{className:"w-4 h-4"}),n.resetFormatting]}),h.jsx(xr,{})]}),s?.isImage&&h.jsxs(h.Fragment,{children:[h.jsxs(Ke,{onClick:p,children:[h.jsx(q.Download,{className:"w-4 h-4"}),n.download]}),h.jsx(xr,{})]}),h.jsxs(Ke,{onClick:c,children:[h.jsx(q.Copy,{className:"w-4 h-4"}),n.duplicateNode]}),h.jsxs(Ke,{onClick:d,children:[h.jsx(q.Copy,{className:"w-4 h-4"}),n.copyToClipboard]}),h.jsxs(Ke,{onClick:f,children:[h.jsx(q.Link,{className:"w-4 h-4"}),n.copyAnchorLink]}),h.jsx(xr,{}),h.jsxs(Ke,{className:M(t==="dark"?"text-red-400 focus:bg-red-950/30":"text-red-600 focus:bg-red-50",r?.dragHandleDeleteItem),onClick:u,children:[h.jsx(q.Trash2,{className:"w-4 h-4"}),n.delete]})]})]})]})},kh=[{id:"normal",label:"Normal text",type:"paragraph"},{id:"title",label:"Title",preview:"Title",type:"heading",level:1,fontSize:"36px",fontWeight:"700",letterSpacing:"-0.025em"},{id:"subtitle",label:"Subtitle",preview:"Subtitle",type:"paragraph",fontSize:"18px",fontWeight:"400",fontStyle:"normal",color:"#737373"},{id:"heading1",label:"Heading 1",preview:"Heading 1",type:"heading",level:1,fontSize:"30px",fontWeight:"600"},{id:"heading2",label:"Heading 2",preview:"Heading 2",type:"heading",level:2,fontSize:"24px",fontWeight:"600"},{id:"heading3",label:"Heading 3",preview:"Heading 3",type:"heading",level:3,fontSize:"20px",fontWeight:"600"},{id:"quote",label:"Quote",preview:"Quote",type:"blockquote",fontSize:"18px",fontStyle:"italic",color:"#525252"},{id:"caption",label:"Caption",preview:"Caption",type:"paragraph",fontSize:"12px",fontWeight:"400",color:"#737373",letterSpacing:"0.025em"}],I1=/^(#{1,6}\s|[*_]{1,2}\S|^[-*+]\s|^\d+\.\s|^>\s|^```|^!\[|^\[)/m,di="&nbsp;",fi=" ",pr=50,hr=200,ru=10,is="VOILABS_REACT_EDITOR_THEME",Ch=e=>{if(!e)return null;const t=decodeURIComponent(e).trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="dark"||t==="light"?t:null},P1=()=>typeof document>"u"?null:document.cookie.split(";").map(t=>t.trim()).filter(t=>t.startsWith(`${is}=`)).map(t=>{const[,...n]=t.split("=");return Ch(n.join("="))}).filter(Boolean).at(-1)??null,L1=()=>{if(typeof window>"u")return null;try{return Ch(window.localStorage.getItem(is))}catch{return null}},pi=()=>P1()??L1(),D1=e=>{if(typeof document<"u"&&(document.cookie=`${is}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`),typeof window<"u")try{window.localStorage.setItem(is,e)}catch{}},j1=e=>e==="dark"?{backgroundColor:"#171717",color:"#f5f5f5",colorScheme:"dark"}:{backgroundColor:"#ffffff",color:"#171717",colorScheme:"light"},z1=e=>e==="dark"?{backgroundColor:"rgba(23, 23, 23, 0.95)",color:"#a3a3a3",colorScheme:"dark"}:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"#737373",colorScheme:"light"},_1=e=>{const t=e.trim();return t?t.split(/\s+/).length:0};function $1(e){if(!e)return!1;const t=e.trim();return t.startsWith("<")?!1:I1.test(t)}function F1(e,t){return e==="html"?"html":e==="markdown"||t&&$1(t)?"markdown":"html"}const hi=(e,t)=>{const n=t.parseInline(e);return e.length===1&&e[0].type==="text"&&(e[0].raw===di||e[0].text===di||e[0].raw===fi||e[0].text===fi)&&n.length===1&&n[0].type==="text"&&(n[0].text===di||n[0].text===fi)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,n)},ou=(e,t)=>{if(t==="start"){let r=0;for(;r<e.length&&e[r]?.type==="br";)r+=1;return e.slice(r)}let n=e.length;for(;n>0&&e[n-1]?.type==="br";)n-=1;return e.slice(0,n)},B1=Em.extend({parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);if(!n.some(a=>a.type==="image"))return hi(n,t);const r=[];let o=[],s=0;const i=a=>{let l=ou(o,"start");a&&(l=ou(l,"end")),o=[],l.length!==0&&r.push(hi(l,t))};for(;s<n.length;){const a=n[s];if(a?.type==="image"){i(!0);const l=t.parseChildren([a]);for(Array.isArray(l)?r.push(...l):l&&r.push(l),s+=1;s<n.length&&n[s]?.type==="br";)s+=1;continue}o.push(a),s+=1}return i(!1),r.length>0?r:hi(n,t)}}),H1=({value:e,onChange:t,format:n,theme:r="auto",onUpload:o,disableVideoUpload:s,disableImageUpload:i,classNames:a,translations:l,styles:c})=>{const u={...Xn,...l},d=c??kh,f=K.useRef(null),p=r==="dark"||r==="light"?r:null,m=!p,[g,b]=K.useState(p??"auto"),[x,S]=K.useState(!1),[k,y]=K.useState(0),[A,w]=K.useState(100),[C,T]=K.useState(!1),I=Tr.useEditor({extensions:[Ah.configure({paragraph:!1,dropcursor:{color:"#0ea5e9",width:3,class:"rounded-full transition-all duration-100 ease-in-out"}}),Nh,B1,Rh.configure({types:["heading","paragraph"]}),Mh.configure({placeholder:({node:N})=>N.type.name==="heading"?`${u.placeholderHeading} ${N.attrs.level}`:N.type.name==="blockquote"?u.placeholderQuote:u.placeholder}),Eh.configure({openOnClick:!1}),xh,wh,Um,Nd,vh,R1,N1,Od,Ym.configure({multicolor:!0}),Zm,tg,Cu,ku.configure({nested:!0,HTMLAttributes:{class:M("flex items-start gap-3 my-2 group","[&>div]:flex-auto [&>div]:min-w-0 [&>div>p]:m-0","data-[checked='true']:[&>div]:line-through data-[checked='true']:[&>div]:opacity-50 data-[checked='true']:[&>div]:transition-all data-[checked='true']:[&>div]:duration-300","[&>label]:flex-none [&>label]:pt-[5px] [&>label]:select-none [&>label]:cursor-pointer","[&_input[type='checkbox']]:appearance-none [&_input[type='checkbox']]:m-0","[&_input[type='checkbox']]:w-[18px] [&_input[type='checkbox']]:h-[18px]","[&_input[type='checkbox']]:border-2 [&_input[type='checkbox']]:rounded-[5px]","[&_input[type='checkbox']]:transition-all [&_input[type='checkbox']]:duration-200","[&_input[type='checkbox']]:flex [&_input[type='checkbox']]:items-center [&_input[type='checkbox']]:justify-center","[&_input[type='checkbox']]:border-neutral-300 dark:[&_input[type='checkbox']]:border-neutral-600","[&_input[type='checkbox']]:bg-white dark:[&_input[type='checkbox']]:bg-neutral-800","hover:[&_input[type='checkbox']]:border-sky-400 dark:hover:[&_input[type='checkbox']]:border-sky-500","[&_input[type='checkbox']:checked]:bg-sky-500 [&_input[type='checkbox']:checked]:border-sky-500","[&_input[type='checkbox']:checked:after]:content-['']","[&_input[type='checkbox']:checked:after]:block","[&_input[type='checkbox']:checked:after]:w-[4px]","[&_input[type='checkbox']:checked:after]:h-[8px]","[&_input[type='checkbox']:checked:after]:border-white","[&_input[type='checkbox']:checked:after]:border-r-2","[&_input[type='checkbox']:checked:after]:border-b-2","[&_input[type='checkbox']:checked:after]:rotate-45","[&_input[type='checkbox']:checked:after]:-mt-[2px]")}}),Md,ax,ix,sx,Am.configure({markedOptions:{breaks:!0,gfm:!0}}),v1.configure({enableImages:!i,translations:u,classNames:a,onRequestImage:o?async({editor:N,range:$})=>new Promise(V=>{const _=document.createElement("input");_.type="file",_.accept="image/*",_.onchange=async()=>{_.files?.length?V({kind:"file",file:_.files[0]}):V(null)},_.click()}):null,onInsertLocalImageFile:o?async({editor:N,range:$,file:V})=>{N.chain().focus().deleteRange($).run();const{url:_}=await o(V);N.chain().focus().setAdvancedImage({src:_}).run()}:null})],editorProps:{handleDrop:(N,$,V,_)=>{if(_||!o||i||!$.dataTransfer?.files?.length)return!1;const z=Array.from($.dataTransfer.files).filter(se=>se.type.startsWith("image/"));if(z.length===0)return!1;$.preventDefault();const W=N.posAtCoords({left:$.clientX,top:$.clientY}),re=W?W.pos:N.state.selection.from;return z.forEach(async se=>{const le=URL.createObjectURL(se),{tr:te}=N.state,G=N.state.schema.nodes.image.create({src:le,isUploading:!0});te.insert(re,G),N.dispatch(te);try{const{url:H}=await o(se);let J=null;N.state.doc.descendants((oe,ge)=>{if(oe.type.name==="image"&&oe.attrs.src===le)return J=ge,!1}),J!==null&&N.dispatch(N.state.tr.setNodeMarkup(J,void 0,{...N.state.doc.nodeAt(J)?.attrs,src:H,isUploading:!1}))}catch{let J=null;N.state.doc.descendants((oe,ge)=>{if(oe.type.name==="image"&&oe.attrs.src===le)return J=ge,!1}),J!==null&&N.dispatch(N.state.tr.delete(J,J+1))}}),!0},handlePaste:(N,$,V)=>{if(!o||i||!$.clipboardData?.files?.length)return!1;const R=Array.from($.clipboardData.files).filter(W=>W.type.startsWith("image/"));if(R.length===0)return!1;$.preventDefault();const z=N.state.selection.from;return R.forEach(async W=>{const re=URL.createObjectURL(W),{tr:se}=N.state,le=N.state.schema.nodes.image.create({src:re,isUploading:!0});se.insert(z,le),N.dispatch(se);try{const{url:te}=await o(W);let G=null;N.state.doc.descendants((H,J)=>{if(H.type.name==="image"&&H.attrs.src===re)return G=J,!1}),G!==null&&N.dispatch(N.state.tr.setNodeMarkup(G,void 0,{...N.state.doc.nodeAt(G)?.attrs,src:te,isUploading:!1}))}catch{let G=null;N.state.doc.descendants((H,J)=>{if(H.type.name==="image"&&H.attrs.src===re)return G=J,!1}),G!==null&&N.dispatch(N.state.tr.delete(G,G+1))}}),!0}},onUpdate:({editor:N})=>{t&&t(N.getMarkdown())}});K.useEffect(()=>{if(p){b(p);return}const N=pi();N&&b(N)},[p]),K.useEffect(()=>{if(p||pi()||typeof window>"u")return;const N=window.matchMedia?.("(prefers-color-scheme: dark)");if(!N)return;const $=V=>{pi()||b(V.matches?"dark":"light")};return N.addEventListener("change",$),()=>{N.removeEventListener("change",$)}},[p]),K.useEffect(()=>{(async()=>{if(e&&I&&!x)try{const N=F1(n,e);await I.commands.setContent(e,{contentType:N}),S(!0)}catch(N){console.error(N)}})()},[e,I]),K.useEffect(()=>{if(!I)return;const N=()=>{y(_1(I.getText()))};return N(),I.on("update",N),I.on("transaction",N),()=>{I.off("update",N),I.off("transaction",N)}},[I]),K.useEffect(()=>{if(typeof document>"u")return;const N=()=>{if(!document.fullscreenElement){T(!1);return}document.fullscreenElement===f.current&&T(!0)};return document.addEventListener("fullscreenchange",N),()=>{document.removeEventListener("fullscreenchange",N)}},[]);const O=N=>{w($=>Math.min(hr,Math.max(pr,$+N)))},j=()=>{const N=!C;if(T(N),!(typeof document>"u")){if(N){f.current?.requestFullscreen?.().catch(()=>{});return}document.fullscreenElement&&document.exitFullscreen?.().catch(()=>{})}},D=N=>{p||(b(N),D1(N))},F=j1(g),B=z1(g);return h.jsx(Fn.Provider,{children:h.jsx(Wr.Provider,{value:{theme:g,translations:u,classNames:a,styles:d},children:h.jsxs("div",{ref:f,"data-theme":g,"data-voilabs-react-editor-theme":g,style:F,className:M("flex h-[100dvh] min-h-0 max-h-[100dvh] flex-col overflow-hidden relative antialiased transition-colors",a?.root,g==="dark"&&"dark",g==="dark"?"bg-neutral-900 text-neutral-100":"bg-white text-neutral-900",C&&"fixed inset-0 z-[9998] h-screen w-screen rounded-none"),children:[h.jsx(Xp,{editor:I,onUpload:o,disableVideoUpload:s,disableImageUpload:i,classNames:a,translations:l,styles:d,onThemeChange:D,showThemeToggle:m}),h.jsx("div",{style:F,className:M("w-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden",C&&"min-h-0",a?.content,a?.contentScroller,a?.editorContent,g==="dark"?"bg-neutral-900":"bg-white"),children:h.jsxs("div",{style:{...F,zoom:A/100},className:M("w-full max-w-4xl mx-auto px-4 py-8 relative",a?.contentInner,g==="dark"?"bg-neutral-900 text-neutral-100":"bg-white text-neutral-900"),children:[I&&h.jsx(O1,{editor:I}),h.jsx(Tr.EditorContent,{editor:I,className:M("w-full prose max-w-none p-0! m-0!","prose-p:my-1.5 prose-p:leading-7","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-3xl prose-h1:mt-8 prose-h1:mb-3","prose-h2:text-2xl prose-h2:mt-6 prose-h2:mb-2","prose-h3:text-xl prose-h3:mt-5 prose-h3:mb-2","prose-h4:text-lg prose-h4:mt-4 prose-h4:mb-1.5","prose-h5:text-base prose-h5:mt-3 prose-h5:mb-1","prose-input[type='checkbox']:w-5","prose-a:text-blue-500 prose-a:no-underline hover:prose-a:underline prose-a:font-normal","[&_ul]:px-4 [&_ol]:px-4","[&_ul]:m-[1.25rem_1rem_1.25rem_0.4rem] [&_ol]:m-[1.25rem_1rem_1.25rem_0.4rem]","[&_li_p]:my-[0.25em]","prose-blockquote:border-l-2 prose-blockquote:my-4 prose-blockquote:py-0.5 prose-blockquote:not-italic","prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-sm prose-code:before:content-none prose-code:after:content-none","prose-pre:rounded-xl prose-pre:my-4","prose-img:max-w-full prose-img:rounded-lg prose-img:my-3","[&_video]:max-w-full [&_video]:w-full [&_video]:aspect-video [&_video]:h-auto [&_video]:object-contain [&_video]:bg-black [&_video]:rounded-lg [&_video]:my-3","[&>.tiptap]:outline-none [&>.tiptap]:min-h-[400px]","[&>.tiptap>*:first-child]:mt-0 [&>.tiptap>*:last-child]:mb-0","[&_mark]:rounded [&_mark]:px-0.5","[&_ul[data-type='taskList']]:list-none [&_ul[data-type='taskList']]:ml-0 [&_ul[data-type='taskList']]:p-0","[&_ul[data-type='taskList']_ul[data-type='taskList']]:m-0","[&_li[data-type='taskItem']]:flex [&_li[data-type='taskItem']]:items-start [&_li[data-type='taskItem']]:mb-2.5","[&_li[data-type='taskItem']>label]:flex [&_li[data-type='taskItem']>label]:items-center [&_li[data-type='taskItem']>label]:justify-center [&_li[data-type='taskItem']>label]:flex-none [&_li[data-type='taskItem']>label]:mr-2 [&_li[data-type='taskItem']>label]:select-none [&_li[data-type='taskItem']>label]:pt-[5px]","[&_li[data-type='taskItem']>label>input]:appearance-none [&_li[data-type='taskItem']>label>input]:m-0 [&_li[data-type='taskItem']>label>input]:w-[18px] [&_li[data-type='taskItem']>label>input]:h-[18px] [&_li[data-type='taskItem']>label>input]:rounded-[5px] [&_li[data-type='taskItem']>label>input]:border-2 [&_li[data-type='taskItem']>label>input]:transition-all [&_li[data-type='taskItem']>label>input]:cursor-pointer [&_li[data-type='taskItem']>label>input]:flex [&_li[data-type='taskItem']>label>input]:items-center [&_li[data-type='taskItem']>label>input]:justify-center",g==="dark"?"[&_li[data-type='taskItem']>label>input]:border-neutral-700 [&_li[data-type='taskItem']>label>input]:bg-neutral-800 hover:[&_li[data-type='taskItem']>label>input]:border-sky-500/50":"[&_li[data-type='taskItem']>label>input]:border-neutral-300 [&_li[data-type='taskItem']>label>input]:bg-white hover:[&_li[data-type='taskItem']>label>input]:border-sky-400","[&_li[data-type='taskItem'][data-checked='true']>label>input]:bg-sky-500 [&_li[data-type='taskItem'][data-checked='true']>label>input]:border-sky-500","[&_li[data-type='taskItem'][data-checked='true']>label>input]:after:content-[''] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:block [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:w-[4px] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:h-[8px] [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-white [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-r-2 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:border-b-2 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:rotate-45 [&_li[data-type='taskItem'][data-checked='true']>label>input]:after:-mt-[2px]","[&_li[data-type='taskItem']>div]:flex-auto [&_li[data-type='taskItem']>div]:min-w-0 [&_li[data-type='taskItem']>div>p]:m-0","[&_li[data-type='taskItem'][data-checked='true']>div]:opacity-40 [&_li[data-type='taskItem'][data-checked='true']>div]:line-through [&_li[data-type='taskItem'][data-checked='true']>div]:transition-all [&_li[data-type='taskItem'][data-checked='true']>div]:duration-300","[&_.node-advancedImage]:block [&_.node-advancedImage]:max-w-full",a?.prose,g==="dark"?"prose-invert [&>.tiptap]:text-neutral-100 [&>.tiptap_*::selection]:bg-blue-500/30 [&_mark]:bg-yellow-400/20 [&_mark]:text-yellow-200":"[&>.tiptap]:text-neutral-900 [&>.tiptap_*::selection]:bg-blue-200/40 [&_mark]:bg-yellow-200 [&_mark]:text-yellow-900",g==="dark"?"[&_p.is-empty::before]:text-neutral-600":"[&_p.is-empty::before]:text-neutral-400","[&_p.is-empty::before]:content-[attr(data-placeholder)]","[&_p.is-empty::before]:float-left","[&_p.is-empty::before]:h-0","[&_p.is-empty::before]:pointer-events-none")})]})}),h.jsxs("div",{style:B,className:M("flex shrink-0 items-center justify-between gap-3 border-t px-4 py-2 text-xs font-medium backdrop-blur-md",a?.footer,g==="dark"?"border-white/8 bg-neutral-900/95 text-neutral-400":"border-black/6 bg-white/95 text-neutral-500"),children:[h.jsxs("div",{className:M("min-w-0 truncate",a?.footerWordCount),children:[k," ",k===1?u.word:u.words]}),h.jsxs("div",{className:M("flex items-center gap-1",a?.footerControls),children:[h.jsxs("div",{className:M("flex items-center gap-0.5",a?.footerZoomGroup),children:[h.jsx(kt,{content:u.zoomOut,children:h.jsx("button",{type:"button",onClick:()=>O(-ru),disabled:A<=pr,"aria-label":u.zoomOut,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400":"text-neutral-500",A>pr&&(g==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),A<=pr&&"cursor-not-allowed opacity-30",A<=pr&&a?.footerButtonDisabled,a?.footerButton,a?.footerZoomButton),children:h.jsx(q.Minus,{size:14})})}),h.jsx(kt,{content:u.resetZoom,children:h.jsxs("button",{type:"button",onClick:()=>w(100),"aria-label":u.resetZoom,className:M("h-8 min-w-14 rounded-full px-2 text-center tabular-nums transition-colors",g==="dark"?"text-neutral-300 hover:bg-white/10 hover:text-neutral-100":"text-neutral-600 hover:bg-black/6 hover:text-neutral-900",a?.footerButton,a?.footerZoomValue),children:[A,"%"]})}),h.jsx(kt,{content:u.zoomIn,children:h.jsx("button",{type:"button",onClick:()=>O(ru),disabled:A>=hr,"aria-label":u.zoomIn,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400":"text-neutral-500",A<hr&&(g==="dark"?"hover:bg-white/10 hover:text-neutral-100":"hover:bg-black/6 hover:text-neutral-900"),A>=hr&&"cursor-not-allowed opacity-30",A>=hr&&a?.footerButtonDisabled,a?.footerButton,a?.footerZoomButton),children:h.jsx(q.Plus,{size:14})})})]}),h.jsx(kt,{content:C?u.exitFullscreen:u.fullscreen,children:h.jsx("button",{type:"button",onClick:j,"aria-label":C?u.exitFullscreen:u.fullscreen,className:M("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors",g==="dark"?"text-neutral-400 hover:bg-white/10 hover:text-neutral-100":"text-neutral-500 hover:bg-black/6 hover:text-neutral-900",a?.footerButton,a?.footerFullscreenButton),children:C?h.jsx(q.Minimize2,{size:14}):h.jsx(q.Maximize2,{size:14})})})]})]})]})})})};exports.AdvancedImage=xh;exports.DEFAULT_PARAGRAPH_STYLES=kh;exports.Editor=H1;exports.FontSize=vh;exports.Toolbar=Xp;exports.Video=wh;