import{a6 as e,aJ as a,aK as t,ag as o,aL as i,h as n,a as s,aM as l,aN as r,aO as u,aP as c,aQ as d,w as p,f as h,aR as f,aS as v,ai as m,Q as g,T as y,g as b,a8 as w,aT as S}from"./index.9313841a.js";import{u as T,v as x,a as E,b as H,c as O,r as P,s as j,d as k,p as q,e as D}from"./position-engine.57eefbc7.js";var L=e({name:"QTooltip",inheritAttrs:!1,props:{...T,...a,...t,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null},transitionShow:{...t.transitionShow,default:"jump-down"},transitionHide:{...t.transitionHide,default:"jump-up"},anchor:{type:String,default:"bottom middle",validator:x},self:{type:String,default:"top middle",validator:x},offset:{type:Array,default:()=>[14,14],validator:E},scrollTarget:o,delay:{type:Number,default:0},hideDelay:{type:Number,default:0},persistent:Boolean},emits:[...i],setup(e,{slots:a,emit:t,attrs:o}){let i,T;const x=b(),{proxy:{$q:E}}=x,L=n(null),Q=n(!1),A=s((()=>q(e.anchor,E.lang.rtl))),C=s((()=>q(e.self,E.lang.rtl))),M=s((()=>!0!==e.persistent)),{registerTick:N,removeTick:R}=l(),{registerTimeout:W}=r(),{transitionProps:_,transitionStyle:B}=u(e),{localScrollTarget:J,changeScrollEvent:K,unconfigureScrollTarget:V}=H(e,ae),{anchorEl:$,canShow:z,anchorEvents:F}=O({showing:Q,configureAnchorEl:function(){if(!0===e.noParentEvent||null===$.value)return;const a=!0===E.platform.is.mobile?[[$.value,"touchstart","delayShow","passive"]]:[[$.value,"mouseenter","delayShow","passive"],[$.value,"mouseleave","delayHide","passive"]];v(F,"anchor",a)}}),{show:G,hide:I}=c({showing:Q,canShow:z,handleShow:function(a){U(),N((()=>{T=new MutationObserver((()=>ee())),T.observe(L.value,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),ee(),ae()})),void 0===i&&(i=p((()=>E.screen.width+"|"+E.screen.height+"|"+e.self+"|"+e.anchor+"|"+E.lang.rtl),ee));W((()=>{U(!0),t("show",a)}),e.transitionDuration)},handleHide:function(a){R(),X(),Z(),W((()=>{X(!0),t("hide",a)}),e.transitionDuration)},hideOnRouteChange:M,processOnMount:!0});Object.assign(F,{delayShow:function(a){if(!0===E.platform.is.mobile){k(),document.body.classList.add("non-selectable");const e=$.value,a=["touchmove","touchcancel","touchend","click"].map((a=>[e,a,"delayHide","passiveCapture"]));v(F,"tooltipTemp",a)}W((()=>{G(a)}),e.delay)},delayHide:function(a){!0===E.platform.is.mobile&&(f(F,"tooltipTemp"),k(),setTimeout((()=>{document.body.classList.remove("non-selectable")}),10));W((()=>{I(a)}),e.hideDelay)}});const{showPortal:U,hidePortal:X,renderPortal:Y}=d(x,L,(function(){return g(y,_.value,te)}),"tooltip");if(!0===E.platform.is.mobile){const a={anchorEl:$,innerRef:L,onClickOutside:e=>(I(e),e.target.classList.contains("q-dialog__backdrop")&&S(e),!0)},t=s((()=>null===e.modelValue&&!0!==e.persistent&&!0===Q.value));p(t,(e=>{(!0===e?D:P)(a)})),h((()=>{P(a)}))}function Z(){void 0!==T&&(T.disconnect(),T=void 0),void 0!==i&&(i(),i=void 0),V(),f(F,"tooltipTemp")}function ee(){j({targetEl:L.value,offset:e.offset,anchorEl:$.value,anchorOrigin:A.value,selfOrigin:C.value,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function ae(){if(null!==$.value||void 0!==e.scrollTarget){J.value=m($.value,e.scrollTarget);const a=!0===e.noParentEvent?ee:I;K(J.value,a)}}function te(){return!0===Q.value?g("div",{...o,ref:L,class:["q-tooltip q-tooltip--style q-position-engine no-pointer-events",o.class],style:[o.style,B.value],role:"tooltip"},w(a.default)):null}return h(Z),Object.assign(x.proxy,{updatePosition:ee}),Y}});export{L as Q};
