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