import{a7 as e,aV as a,aX as o,a as t,Q as s,a9 as n,g as l,aK as i,aL as r,ah as u,aM as c,h as d,aN as f,aO as v,aP as p,aQ as g,aR as h,w as m,b3 as b,b4 as q,b5 as y,b6 as x,aj as B,T as S,f as k,b7 as E,b8 as O,b9 as w,ba as C,aU as P}from"./index.3938ccd1.js";import{f as T,v as R,a as D,b as Q,c as j,r as F,s as H,p as M,e as K}from"./position-engine.8dde9dbe.js";const L=["ul","ol"];var W=e({name:"QList",props:{...a,bordered:Boolean,dense:Boolean,separator:Boolean,padding:Boolean,tag:{type:String,default:"div"}},setup(e,{slots:a}){const i=l(),r=o(e,i.proxy.$q),u=t((()=>L.includes(e.tag)?null:"list")),c=t((()=>"q-list"+(!0===e.bordered?" q-list--bordered":"")+(!0===e.dense?" q-list--dense":"")+(!0===e.separator?" q-list--separator":"")+(!0===r.value?" q-list--dark":"")+(!0===e.padding?" q-list--padding":"")));return()=>s(e.tag,{class:c.value,role:u.value},n(a.default))}}),A=e({name:"QMenu",inheritAttrs:!1,props:{...T,...i,...a,...r,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:R},self:{type:String,validator:R},offset:{type:Array,validator:D},scrollTarget:u,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...c,"click","escapeKey"],setup(e,{slots:a,emit:i,attrs:r}){let u,c,T,R=null;const D=l(),{proxy:L}=D,{$q:W}=L,A=d(null),$=d(!1),_=t((()=>!0!==e.persistent&&!0!==e.noRouteDismiss)),N=o(e,W),{registerTick:U,removeTick:V}=f(),{registerTimeout:X}=v(),{transitionProps:z,transitionStyle:G}=p(e),{localScrollTarget:I,changeScrollEvent:J,unconfigureScrollTarget:Y}=Q(e,ve),{anchorEl:Z,canShow:ee}=j({showing:$}),{hide:ae}=g({showing:$,canShow:ee,handleShow:function(a){if(R=!1===e.noRefocus?document.activeElement:null,b(ge),oe(),ve(),u=void 0,void 0!==a&&(e.touchPosition||e.contextMenu)){const e=q(a);if(void 0!==e.left){const{top:a,left:o}=Z.value.getBoundingClientRect();u={left:e.left-o,top:e.top-a}}}void 0===c&&(c=m((()=>W.screen.width+"|"+W.screen.height+"|"+e.self+"|"+e.anchor+"|"+W.lang.rtl),me));!0!==e.noFocus&&document.activeElement.blur();U((()=>{me(),!0!==e.noFocus&&de()})),X((()=>{!0===W.platform.is.ios&&(T=e.autoClose,A.value.click()),me(),oe(!0),i("show",a)}),e.transitionDuration)},handleHide:function(a){V(),te(),fe(!0),null===R||void 0!==a&&!0===a.qClickOutside||(((0===(null==a?void 0:a.type.indexOf("key"))?R.closest('[tabindex]:not([tabindex^="-"])'):void 0)||R).focus(),R=null);X((()=>{te(!0),i("hide",a)}),e.transitionDuration)},hideOnRouteChange:_,processOnMount:!0}),{showPortal:oe,hidePortal:te,renderPortal:se}=h(D,A,(function(){return s(S,z.value,(()=>!0===$.value?s("div",{role:"menu",...r,ref:A,tabindex:-1,class:["q-menu q-position-engine scroll"+re.value,r.class],style:[r.style,G.value],...ue.value},n(a.default)):null))}),"menu"),ne={anchorEl:Z,innerRef:A,onClickOutside(a){if(!0!==e.persistent&&!0===$.value)return ae(a),("touchstart"===a.type||a.target.classList.contains("q-dialog__backdrop"))&&P(a),!0}},le=t((()=>M(e.anchor||(!0===e.cover?"center middle":"bottom start"),W.lang.rtl))),ie=t((()=>!0===e.cover?le.value:M(e.self||"top start",W.lang.rtl))),re=t((()=>(!0===e.square?" q-menu--square":"")+(!0===N.value?" q-menu--dark q-dark":""))),ue=t((()=>!0===e.autoClose?{onClick:pe}:{})),ce=t((()=>!0===$.value&&!0!==e.persistent));function de(){E((()=>{let e=A.value;e&&!0!==e.contains(document.activeElement)&&(e=e.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||e.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||e.querySelector("[autofocus], [data-autofocus]")||e,e.focus({preventScroll:!0}))}))}function fe(e){u=void 0,void 0!==c&&(c(),c=void 0),!0!==e&&!0!==$.value||(y(ge),Y(),F(ne),x(he)),!0!==e&&(R=null)}function ve(){null===Z.value&&void 0===e.scrollTarget||(I.value=B(Z.value,e.scrollTarget),J(I.value,me))}function pe(e){!0!==T?(O(L,e),i("click",e)):T=!1}function ge(a){!0===ce.value&&!0!==e.noFocus&&!0!==C(A.value,a.target)&&de()}function he(a){!0!==e.noEscDismiss&&(i("escapeKey"),ae(a))}function me(){H({targetEl:A.value,offset:e.offset,anchorEl:Z.value,anchorOrigin:le.value,selfOrigin:ie.value,absoluteOffset:u,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}return m(ce,(e=>{!0===e?(w(he),K(ne)):(x(he),F(ne))})),k(fe),Object.assign(L,{focus:de,updatePosition:me}),se}});export{W as Q,A as a};
