import{h as T,af as q,k as s,ag as R,m as x,E as _,bk as N,ac as k,v as m,o as y,w as g,x as C,g as t,ab as H,H as I,b as K,ae as L,ad as E,bl as $,aT as M}from"./BzhixHsn.js";import{a as A,P as V}from"./Bp3-KBkO.js";import{i as D}from"./CCA1r4XF.js";const j="tooltip.open",[S,U]=k("TooltipRoot");var z=T({__name:"TooltipRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},delayDuration:{type:Number,required:!1,default:void 0},disableHoverableContent:{type:Boolean,required:!1,default:void 0},disableClosingTrigger:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:void 0}},emits:["update:open"],setup(r,{emit:l}){const e=r,d=l;q();const o=D(),i=s(()=>e.disableHoverableContent??o.disableHoverableContent.value),u=s(()=>e.disableClosingTrigger??o.disableClosingTrigger.value),p=s(()=>e.disabled??o.disabled.value),h=s(()=>e.delayDuration??o.delayDuration.value),B=s(()=>e.ignoreNonKeyboardFocus??o.ignoreNonKeyboardFocus.value),n=R(e,"open",d,{defaultValue:e.defaultOpen,passive:e.open===void 0});x(n,v=>{o.onClose&&(v?(o.onOpen(),document.dispatchEvent(new CustomEvent(j))):o.onClose())});const c=_(!1),b=_(),P=s(()=>n.value?c.value?"delayed-open":"instant-open":"closed"),{start:O,stop:f}=N(()=>{c.value=!0,n.value=!0},h,{immediate:!1});function a(){f(),c.value=!1,n.value=!0}function w(){f(),n.value=!1}function F(){O()}return U({contentId:"",open:n,stateAttribute:P,trigger:b,onTriggerChange(v){b.value=v},onTriggerEnter(){o.isOpenDelayed.value?F():a()},onTriggerLeave(){i.value?w():f()},onOpen:a,onClose:w,disableHoverableContent:i,disableClosingTrigger:u,disabled:p,ignoreNonKeyboardFocus:B}),(v,W)=>(y(),m(t(A),null,{default:g(()=>[C(v.$slots,"default",{open:t(n)})]),_:3}))}}),G=z,J=T({__name:"TooltipTrigger",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(r){const l=r,e=S(),d=D();e.contentId||=H(void 0,"reka-tooltip-content");const{forwardRef:o,currentElement:i}=q(),u=_(!1),p=_(!1),h=s(()=>e.disabled.value?{}:{click:f,focus:P,pointermove:c,pointerleave:b,pointerdown:n,blur:O});I(()=>{e.onTriggerChange(i.value)});function B(){setTimeout(()=>{u.value=!1},1)}function n(){e.open&&!e.disableClosingTrigger.value&&e.onClose(),u.value=!0,document.addEventListener("pointerup",B,{once:!0})}function c(a){a.pointerType!=="touch"&&!p.value&&!d.isPointerInTransitRef.value&&(e.onTriggerEnter(),p.value=!0)}function b(){e.onTriggerLeave(),p.value=!1}function P(a){u.value||e.ignoreNonKeyboardFocus.value&&!a.target.matches?.(":focus-visible")||e.onOpen()}function O(){e.onClose()}function f(){e.disableClosingTrigger.value||e.onClose()}return(a,w)=>(y(),m(t(V),{"as-child":"",reference:a.reference},{default:g(()=>[K(t(L),E({ref:t(o),"aria-describedby":t(e).open.value?t(e).contentId:void 0,"data-state":t(e).stateAttribute.value,as:a.as,"as-child":l.asChild,"data-grace-area-trigger":""},$(h.value)),{default:g(()=>[C(a.$slots,"default")]),_:3},16,["aria-describedby","data-state","as","as-child"])]),_:3},8,["reference"]))}}),Q=J;const ee=T({__name:"Tooltip",props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:["update:open"],setup(r,{emit:l}){const o=M(r,l);return(i,u)=>(y(),m(t(G),E({"data-slot":"tooltip"},t(o)),{default:g(()=>[C(i.$slots,"default")]),_:3},16))}}),oe=T({__name:"TooltipTrigger",props:{reference:{},asChild:{type:Boolean},as:{}},setup(r){const l=r;return(e,d)=>(y(),m(t(Q),E({"data-slot":"tooltip-trigger"},l),{default:g(()=>[C(e.$slots,"default")]),_:3},16))}});export{j as T,ee as _,oe as a,S as i};
