import{c as x,a as s,h as g,d as K,C as se,R as le,aS as ue,D as ie,E as re,g as ce,r as M,F as de,aj as fe,G as ve,aT as ge,H as he,aU as me,w as A,aX as ye,aY as R,aZ as Be,x as Te,a_ as be,M as xe,a$ as Pe,T as Se,e as Ce,b0 as ke,b1 as qe,B as Ee}from"./index-D6xcdmSy.js";import{v as Oe,g as H,i as pe,j as we,k as Fe,p as Q,l as De,r as j,s as Me}from"./QItemLabel-BRceraJL.js";const Qe=x({name:"QBtnGroup",props:{unelevated:Boolean,outline:Boolean,flat:Boolean,rounded:Boolean,square:Boolean,push:Boolean,stretch:Boolean,glossy:Boolean,spread:Boolean},setup(e,{slots:l}){const u=s(()=>{const i=["unelevated","outline","flat","rounded","square","push","stretch","glossy"].filter(o=>e[o]===!0).map(o=>`q-btn-group--${o}`).join(" ");return`q-btn-group row no-wrap${i.length!==0?" "+i:""}`+(e.spread===!0?" q-btn-group--spread":" inline")});return()=>g("div",{class:u.value},K(l.default))}}),je=x({name:"QSpace",setup(){const e=g("div",{class:"q-space"});return()=>e}}),Ke=x({name:"QMenu",inheritAttrs:!1,props:{...pe,...re,...ie,...ue,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:H},self:{type:String,validator:H},offset:{type:Array,validator:Oe},scrollTarget:le,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...se,"click","escapeKey"],setup(e,{slots:l,emit:u,attrs:i}){let o=null,v,c,h;const P=ce(),{proxy:m}=P,{$q:a}=m,n=M(null),r=M(!1),$=s(()=>e.persistent!==!0&&e.noRouteDismiss!==!0),G=de(e,a),{registerTick:L,removeTick:W}=fe(),{registerTimeout:S}=ve(),{transitionProps:_,transitionStyle:U}=ge(e),{localScrollTarget:C,changeScrollEvent:I,unconfigureScrollTarget:X}=we(e,F),{anchorEl:d,canShow:Y}=Fe({showing:r}),{hide:k}=he({showing:r,canShow:Y,handleShow:V,handleHide:ee,hideOnRouteChange:$,processOnMount:!0}),{showPortal:q,hidePortal:E,renderPortal:Z}=me(P,n,oe,"menu"),y={anchorEl:d,innerRef:n,onClickOutside(t){if(e.persistent!==!0&&r.value===!0)return k(t),(t.type==="touchstart"||t.target.classList.contains("q-dialog__backdrop"))&&Ee(t),!0}},O=s(()=>Q(e.anchor||(e.cover===!0?"center middle":"bottom start"),a.lang.rtl)),z=s(()=>e.cover===!0?O.value:Q(e.self||"top start",a.lang.rtl)),J=s(()=>(e.square===!0?" q-menu--square":"")+(G.value===!0?" q-menu--dark q-dark":"")),N=s(()=>e.autoClose===!0?{onClick:te}:{}),p=s(()=>r.value===!0&&e.persistent!==!0);A(p,t=>{t===!0?(ye(T),De(y)):(R(T),j(y))});function B(){ke(()=>{let t=n.value;t&&t.contains(document.activeElement)!==!0&&(t=t.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||t.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||t.querySelector("[autofocus], [data-autofocus]")||t,t.focus({preventScroll:!0}))})}function V(t){if(o=e.noRefocus===!1?document.activeElement:null,Be(D),q(),F(),v=void 0,t!==void 0&&(e.touchPosition||e.contextMenu)){const b=Te(t);if(b.left!==void 0){const{top:ae,left:ne}=d.value.getBoundingClientRect();v={left:b.left-ne,top:b.top-ae}}}c===void 0&&(c=A(()=>a.screen.width+"|"+a.screen.height+"|"+e.self+"|"+e.anchor+"|"+a.lang.rtl,f)),e.noFocus!==!0&&document.activeElement.blur(),L(()=>{f(),e.noFocus!==!0&&B()}),S(()=>{a.platform.is.ios===!0&&(h=e.autoClose,n.value.click()),f(),q(!0),u("show",t)},e.transitionDuration)}function ee(t){W(),E(),w(!0),o!==null&&(t===void 0||t.qClickOutside!==!0)&&(((t?.type.indexOf("key")===0?o.closest('[tabindex]:not([tabindex^="-"])'):void 0)||o).focus(),o=null),S(()=>{E(!0),u("hide",t)},e.transitionDuration)}function w(t){v=void 0,c!==void 0&&(c(),c=void 0),(t===!0||r.value===!0)&&(be(D),X(),j(y),R(T)),t!==!0&&(o=null)}function F(){(d.value!==null||e.scrollTarget!==void 0)&&(C.value=xe(d.value,e.scrollTarget),I(C.value,f))}function te(t){h!==!0?(Pe(m,t),u("click",t)):h=!1}function D(t){p.value===!0&&e.noFocus!==!0&&qe(n.value,t.target)!==!0&&B()}function T(t){e.noEscDismiss!==!0&&(u("escapeKey"),k(t))}function f(){Me({targetEl:n.value,offset:e.offset,anchorEl:d.value,anchorOrigin:O.value,selfOrigin:z.value,absoluteOffset:v,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function oe(){return g(Se,_.value,()=>r.value===!0?g("div",{role:"menu",...i,ref:n,tabindex:-1,class:["q-menu q-position-engine scroll"+J.value,i.class],style:[i.style,U.value],...N.value},K(l.default)):null)}return Ce(w),Object.assign(m,{focus:B,updatePosition:f}),Z}});let Ae=!1;{const e=document.createElement("div");e.setAttribute("dir","rtl"),Object.assign(e.style,{width:"1px",height:"1px",overflow:"auto"});const l=document.createElement("div");Object.assign(l.style,{width:"1000px",height:"1px"}),document.body.appendChild(e),e.appendChild(l),e.scrollLeft=-1e3,Ae=e.scrollLeft>=0,e.remove()}export{Ke as Q,Qe as a,je as b,Ae as r};
