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