import{b as te,u as ae,aa as oe,aX as T,q as ne,g as ie,j as E,d as f,aY as se,t as le,aZ as re,v as ue,a_ as ce,k,m as C,a$ as x,b0 as H,ac as de,h as q,ap as fe,e as he,aE as ve}from"./app-DzAYC6xy.js";import{v as me,a as A,u as ge,p as j,b as Te,c as pe,r as D,s as ye,d as be}from"./position-engine-BoHh6ymb.js";import{c as M}from"./selection-vu7NfHfB.js";const Oe=te({name:"QTooltip",inheritAttrs:!1,props:{...ge,...ne,...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:A},self:{type:String,default:"top middle",validator:A},offset:{type:Array,default:()=>[14,14],validator:me},scrollTarget:oe,delay:{type:Number,default:0},hideDelay:{type:Number,default:0},persistent:Boolean},emits:[...ae],setup(e,{slots:L,emit:p,attrs:h}){let i,s;const v=ie(),{proxy:{$q:a}}=v,l=E(null),c=E(!1),Q=f(()=>j(e.anchor,a.lang.rtl)),W=f(()=>j(e.self,a.lang.rtl)),_=f(()=>e.persistent!==!0),{registerTick:B,removeTick:N}=se(),{registerTimeout:d}=le(),{transitionProps:R,transitionStyle:$}=re(e),{localScrollTarget:y,changeScrollEvent:I,unconfigureScrollTarget:U}=Te(e,w),{anchorEl:o,canShow:V,anchorEvents:r}=pe({showing:c,configureAnchorEl:J}),{show:X,hide:m}=ue({showing:c,canShow:V,handleShow:Z,handleHide:z,hideOnRouteChange:_,processOnMount:!0});Object.assign(r,{delayShow:F,delayHide:G});const{showPortal:b,hidePortal:S,renderPortal:Y}=ce(v,l,ee,"tooltip");if(a.platform.is.mobile===!0){const t={anchorEl:o,innerRef:l,onClickOutside(n){return m(n),n.target.classList.contains("q-dialog__backdrop")&&ve(n),!0}},g=f(()=>e.modelValue===null&&e.persistent!==!0&&c.value===!0);k(g,n=>{(n===!0?be:D)(t)}),C(()=>{D(t)})}function Z(t){b(),B(()=>{s=new MutationObserver(()=>u()),s.observe(l.value,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),u(),w()}),i===void 0&&(i=k(()=>a.screen.width+"|"+a.screen.height+"|"+e.self+"|"+e.anchor+"|"+a.lang.rtl,u)),d(()=>{b(!0),p("show",t)},e.transitionDuration)}function z(t){N(),S(),P(),d(()=>{S(!0),p("hide",t)},e.transitionDuration)}function P(){s!==void 0&&(s.disconnect(),s=void 0),i!==void 0&&(i(),i=void 0),U(),x(r,"tooltipTemp")}function u(){ye({targetEl:l.value,offset:e.offset,anchorEl:o.value,anchorOrigin:Q.value,selfOrigin:W.value,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function F(t){if(a.platform.is.mobile===!0){M(),document.body.classList.add("non-selectable");const g=o.value,n=["touchmove","touchcancel","touchend","click"].map(O=>[g,O,"delayHide","passiveCapture"]);H(r,"tooltipTemp",n)}d(()=>{X(t)},e.delay)}function G(t){a.platform.is.mobile===!0&&(x(r,"tooltipTemp"),M(),setTimeout(()=>{document.body.classList.remove("non-selectable")},10)),d(()=>{m(t)},e.hideDelay)}function J(){if(e.noParentEvent===!0||o.value===null)return;const t=a.platform.is.mobile===!0?[[o.value,"touchstart","delayShow","passive"]]:[[o.value,"mouseenter","delayShow","passive"],[o.value,"mouseleave","delayHide","passive"]];H(r,"anchor",t)}function w(){if(o.value!==null||e.scrollTarget!==void 0){y.value=de(o.value,e.scrollTarget);const t=e.noParentEvent===!0?u:m;I(y.value,t)}}function K(){return c.value===!0?q("div",{...h,ref:l,class:["q-tooltip q-tooltip--style q-position-engine no-pointer-events",h.class],style:[h.style,$.value],role:"tooltip"},he(L.default)):null}function ee(){return q(fe,R.value,K)}return C(P),Object.assign(v.proxy,{updatePosition:u}),Y}});export{Oe as Q};
