const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-dom-BT-HHJs9.js","assets/codemirror-core-DIzFijqu.js","assets/react-dom-Cfkhaq8h.css"])))=>i.map(i=>d[i]);
import{c as me,y as be,t as $e,_ as ve,T as Te}from"./index-tO5nu8Yv.js";import{h as o,j as a}from"./codemirror-core-DIzFijqu.js";import{by as he,D as xe,bz as G,bA as ye,bB as Oe,i as w,bC as ge,bD as Ce,H as Pe,r as C,x as Ae,v as _e,w as we,L as Re,m as je,A as De,bE as J}from"./react-dom-BT-HHJs9.js";import{m as Ee,g as Q,t as Ie,a as Ne}from"./chunk-WQVQ7P2I-bQ701xkJ.js";const Le=1500,X=500;let y={},ke=0,_=!1,m=null,O=null;function ze(e={}){let{delay:$=Le,closeDelay:d=X}=e,{isOpen:n,open:u,close:p}=he(e),r=o.useMemo(()=>`${++ke}`,[]),t=o.useRef(null),v=o.useRef(p),g=()=>{y[r]=b},T=()=>{for(let s in y)s!==r&&(y[s](!0),delete y[s])},h=()=>{t.current&&clearTimeout(t.current),t.current=null,T(),g(),_=!0,u(),m&&(clearTimeout(m),m=null),O&&(clearTimeout(O),O=null)},b=s=>{s||d<=0?(t.current&&clearTimeout(t.current),t.current=null,v.current()):t.current||(t.current=setTimeout(()=>{t.current=null,v.current()},d)),m&&(clearTimeout(m),m=null),_&&(O&&clearTimeout(O),O=setTimeout(()=>{delete y[r],O=null,_=!1},Math.max(X,d)))},l=()=>{T(),g(),!n&&!m&&!_?m=setTimeout(()=>{m=null,_=!0,h()},$):n||h()};return o.useEffect(()=>{v.current=p},[p]),o.useEffect(()=>()=>{t.current&&clearTimeout(t.current),y[r]&&delete y[r]},[r]),{isOpen:n,open:s=>{!s&&$>0&&!t.current?l():h()},close:b}}function Me(e){var $,d;const n=me(),[u,p]=xe(e,G.variantKeys),{ref:r,as:t,isOpen:v,content:g,children:T,defaultOpen:h,onOpenChange:b,isDisabled:l,trigger:s,shouldFlip:R=!0,containerPadding:j=12,placement:f="top",delay:z=0,closeDelay:M=500,showArrow:i=!1,offset:H=7,crossOffset:ee=0,isDismissable:te,shouldCloseOnBlur:oe=!0,portalContainer:le,isKeyboardDismissDisabled:se=!1,updatePositionDeps:U=[],shouldCloseOnInteractOutside:ae,className:ne,onClose:W,motionProps:re,classNames:P,...S}=u,ie=t||"div",V=(d=($=e==null?void 0:e.disableAnimation)!=null?$:n==null?void 0:n.disableAnimation)!=null?d:!1,A=ze({delay:z,closeDelay:M,isDisabled:l,defaultOpen:h,isOpen:v,onOpenChange:x=>{b==null||b(x),x||W==null||W()}}),D=o.useRef(null),E=o.useRef(null),I=o.useId(),c=A.isOpen&&!l;o.useImperativeHandle(r,()=>be(E));const{triggerProps:B,tooltipProps:ce}=ye({isDisabled:l,trigger:s},A,D),{tooltipProps:F}=Oe({isOpen:c,...w(u,ce)},A),{overlayProps:K,placement:N,updatePosition:de}=ge({isOpen:c,targetRef:D,placement:Ie(f),overlayRef:E,offset:i?H+3:H,crossOffset:ee,shouldFlip:R,containerPadding:j});$e(()=>{U.length&&de()},U);const{overlayProps:Y}=Ce({isOpen:c,onClose:A.close,isDismissable:te,shouldCloseOnBlur:oe,isKeyboardDismissDisabled:se,shouldCloseOnInteractOutside:ae},E),L=o.useMemo(()=>{var x,k,q;return G({...p,disableAnimation:V,radius:(x=e==null?void 0:e.radius)!=null?x:"md",size:(k=e==null?void 0:e.size)!=null?k:"md",shadow:(q=e==null?void 0:e.shadow)!=null?q:"sm"})},[Pe(p),V,e==null?void 0:e.radius,e==null?void 0:e.size,e==null?void 0:e.shadow]),ue=o.useCallback((x={},k=null)=>({...w(B,x),ref:Ee(k,D),"aria-describedby":c?I:void 0}),[B,c,I,A]),pe=o.useCallback(()=>({ref:E,"data-slot":"base","data-open":C(c),"data-arrow":C(i),"data-disabled":C(l),"data-placement":Q(N||"top",f),...w(F,Y,S),style:w(K.style,S.style,u.style),className:L.base({class:P==null?void 0:P.base}),id:I}),[L,c,i,l,N,f,F,Y,S,K,u,I]),fe=o.useCallback(()=>({"data-slot":"content","data-open":C(c),"data-arrow":C(i),"data-disabled":C(l),"data-placement":Q(N||"top",f),className:L.content({class:Ae(P==null?void 0:P.content,ne)})}),[L,c,i,l,N,f,P]);return{Component:ie,content:g,children:T,isOpen:c,triggerRef:D,showArrow:i,portalContainer:le,placement:f,disableAnimation:V,isDisabled:l,motionProps:re,getTooltipContentProps:fe,getTriggerProps:ue,getTooltipProps:pe}}var Se=()=>ve(()=>import("./react-dom-BT-HHJs9.js").then(e=>e.ck),__vite__mapDeps([0,1,2])).then(e=>e.default),Z=_e((e,$)=>{const{Component:d,children:n,content:u,isOpen:p,portalContainer:r,placement:t,disableAnimation:v,motionProps:g,getTriggerProps:T,getTooltipProps:h,getTooltipContentProps:b}=Me({...e,ref:$});let l;try{if(o.Children.count(n)!==1)throw new Error;if(!o.isValidElement(n))l=a.jsx("p",{...T(),children:n});else{const i=n;l=o.cloneElement(i,T(i.props,i.ref))}}catch{l=a.jsx("span",{}),we("Tooltip must have only one child node. Please, check your code.")}const{ref:s,id:R,style:j,...f}=h(),z=a.jsx("div",{ref:s,id:R,style:j,children:a.jsx(Re,{features:Se,children:a.jsx(je.div,{animate:"enter",exit:"exit",initial:"exit",variants:Te.scaleSpring,...w(g,f),style:{...Ne(t)},children:a.jsx(d,{...b(),children:u})})})});return a.jsxs(a.Fragment,{children:[l,v&&p?a.jsx(J,{portalContainer:r,children:a.jsx("div",{ref:s,id:R,style:j,...f,children:a.jsx(d,{...b(),children:u})})}):a.jsx(De,{children:p?a.jsx(J,{portalContainer:r,children:z}):null})]})});Z.displayName="HeroUI.Tooltip";var Be=Z;export{Be as t};
