import{p as w,O as V,o as D,aD as b,b4 as O,av as k,a_ as x,b5 as L,b6 as j,n as B,u as R,b7 as T,a$ as A,aR as P,ax as C,J as I,ac as N,aT as K,D as S,G as $,b3 as z,b8 as G}from"./index.86ff0207.js";const J=(t,f,e)=>t==null||f==null?-1:t.toString().toLocaleLowerCase().indexOf(f.toString().toLocaleLowerCase()),_=w({customFilter:Function,customKeyFilter:Object,filterKeys:[Array,String],filterMode:{type:String,default:"intersection"},noFilter:Boolean},"filter");function Q(t,f,e){var v,l,s;const r=[],d=(v=e==null?void 0:e.default)!=null?v:J,n=e!=null&&e.filterKeys?k(e.filterKeys):!1,m=Object.keys((l=e==null?void 0:e.customKeyFilter)!=null?l:{}).length;if(!(t!=null&&t.length))return r;e:for(let c=0;c<t.length;c++){const a=t[c],o={},i={};let u=-1;if(f&&!(e!=null&&e.noFilter)){if(typeof a=="object"){const h=n||Object.keys(a);for(const F of h){const E=x(a,F,a),M=(s=e==null?void 0:e.customKeyFilter)==null?void 0:s[F];if(u=M?M(E,f,a):d(E,f,a),u!==-1&&u!==!1)M?o[F]=u:i[F]=u;else if((e==null?void 0:e.filterMode)==="every")continue e}}else u=d(a,f,a),u!==-1&&u!==!1&&(i.title=u);const g=Object.keys(i).length,y=Object.keys(o).length;if(!g&&!y||(e==null?void 0:e.filterMode)==="union"&&y!==m&&!g||(e==null?void 0:e.filterMode)==="intersection"&&(y!==m||!g))continue}r.push({index:c,matches:{...i,...o}})}return r}function H(t,f,e,r){const d=V([]),n=V(new Map),m=D(()=>r!=null&&r.transform?b(f).map(r==null?void 0:r.transform):b(f));O(()=>{const l=typeof e=="function"?e():b(e),s=typeof l!="string"&&typeof l!="number"?"":String(l),c=Q(m.value,s,{customKeyFilter:t.customKeyFilter,default:t.customFilter,filterKeys:t.filterKeys,filterMode:t.filterMode,noFilter:t.noFilter}),a=b(f),o=[],i=new Map;c.forEach(u=>{let{index:g,matches:y}=u;const h=a[g];o.push(h),i.set(h.value,y)}),d.value=o,n.value=i});function v(l){return n.value.get(l.value)}return{filteredItems:d,filteredMatches:n,getMatches:v}}const U=w({fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...L({origin:"center center",scrollStrategy:"block",transition:{component:j},zIndex:2400})},"VDialog"),X=B()({name:"VDialog",props:U(),emits:{"update:modelValue":t=>!0},setup(t,f){let{slots:e}=f;const r=R(t,"modelValue"),{scopeId:d}=T(),n=V();function m(l){var a,o;const s=l.relatedTarget,c=l.target;if(s!==c&&((a=n.value)==null?void 0:a.contentEl)&&((o=n.value)==null?void 0:o.globalTop)&&![document,n.value.contentEl].includes(c)&&!n.value.contentEl.contains(c)){const i=G(n.value.contentEl);if(!i.length)return;const u=i[0],g=i[i.length-1];s===u?g.focus():u.focus()}}A&&P(()=>r.value&&t.retainFocus,l=>{l?document.addEventListener("focusin",m):document.removeEventListener("focusin",m)},{immediate:!0}),P(r,async l=>{var s,c;await C(),l?(s=n.value.contentEl)==null||s.focus({preventScroll:!0}):(c=n.value.activatorEl)==null||c.focus({preventScroll:!0})});const v=D(()=>I({"aria-haspopup":"dialog","aria-expanded":String(r.value)},t.activatorProps));return N(()=>{const[l]=K.filterProps(t);return S(K,I({ref:n,class:["v-dialog",{"v-dialog--fullscreen":t.fullscreen,"v-dialog--scrollable":t.scrollable},t.class],style:t.style},l,{modelValue:r.value,"onUpdate:modelValue":s=>r.value=s,"aria-modal":"true",activatorProps:v.value,role:"dialog"},d),{activator:e.activator,default:function(){for(var s=arguments.length,c=new Array(s),a=0;a<s;a++)c[a]=arguments[a];return S($,{root:"VDialog"},{default:()=>{var o;return[(o=e.default)==null?void 0:o.call(e,...c)]}})}})}),z({},n)}});export{X as V,_ as m,H as u};
