import{l as R,p as $,y as I,r as k,h as N,aj as H,P as w,ai as M,a4 as y,m as o,a1 as O,B as U,o as W,R as C,E as x,K as z,F as j,w as s,t as V,q,M as G,G as _,S as J,I as P,H as p,J as B,$ as A,ay as K}from"./index-Cp3-A7ao.js";import{m as Q,b as X,a as L}from"./VOverlay-BvbqXTj9.js";import{f as Y}from"./forwardRefs-o1fhiqtU.js";import{u as Z}from"./scopeId-BFshC2jm.js";import{a as ee,t as te}from"./transition-BAtvBeuS.js";import{V as ae,e as S,b as T,a as ne}from"./VCard-D5wKeDng.js";import{a as D}from"./VBtn-DJBHxlTa.js";import"./VImg-tOz2PgiP.js";import"./VProgressCircular-DvjORuMu.js";import"./resizeObserver-BoHHG32A.js";const oe=$({fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...Q({origin:"center center",scrollStrategy:"block",transition:{component:X},zIndex:2400})},"VDialog"),le=R()({name:"VDialog",props:oe(),emits:{"update:modelValue":e=>!0,afterEnter:()=>!0,afterLeave:()=>!0},setup(e,E){let{emit:d,slots:r}=E;const f=I(e,"modelValue"),{scopeId:b}=Z(),t=k();function n(a){var c,v;const u=a.relatedTarget,m=a.target;if(u!==m&&((c=t.value)!=null&&c.contentEl)&&((v=t.value)!=null&&v.globalTop)&&![document,t.value.contentEl].includes(m)&&!t.value.contentEl.contains(m)){const i=M(t.value.contentEl);if(!i.length)return;const g=i[0],F=i[i.length-1];u===g?F.focus():g.focus()}}N(()=>{document.removeEventListener("focusin",n)}),H&&w(()=>f.value&&e.retainFocus,a=>{a?document.addEventListener("focusin",n):document.removeEventListener("focusin",n)},{immediate:!0});function l(){var a;d("afterEnter"),(a=t.value)!=null&&a.contentEl&&!t.value.contentEl.contains(document.activeElement)&&t.value.contentEl.focus({preventScroll:!0})}function h(){d("afterLeave")}return w(f,async a=>{var u;a||(await O(),(u=t.value.activatorEl)==null||u.focus({preventScroll:!0}))}),ee(()=>{const a=L.filterProps(e),u=y({"aria-haspopup":"dialog"},e.activatorProps),m=y({tabindex:-1},e.contentProps);return o(L,y({ref:t,class:["v-dialog",{"v-dialog--fullscreen":e.fullscreen,"v-dialog--scrollable":e.scrollable},e.class],style:e.style},a,{modelValue:f.value,"onUpdate:modelValue":c=>f.value=c,"aria-modal":"true",activatorProps:u,contentProps:m,height:e.fullscreen?void 0:e.height,width:e.fullscreen?void 0:e.width,maxHeight:e.fullscreen?void 0:e.maxHeight,maxWidth:e.fullscreen?void 0:e.maxWidth,role:"dialog",onAfterEnter:l,onAfterLeave:h},b),{activator:r.activator,default:function(){for(var c=arguments.length,v=new Array(c),i=0;i<c;i++)v[i]=arguments[i];return o(te,{root:"VDialog"},{default:()=>{var g;return[(g=r.default)==null?void 0:g.call(r,...v)]}})}})}),Y({},t)}}),se={class:"bg-background pa-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4"},re={class:""},Ee=U({__name:"Devices",setup(e){const E=K(),d=k(),r=k(!1),f=async function(t){await C.deleteDevice(t),d.value=await C.getAllDevices(!1),r.value=!0},b=function(t){E.push(`/settings/editdevice/${t}`)};return W(async()=>{d.value=await C.getAllDevices(!1)}),(t,n)=>(V(),x("div",se,[(V(!0),x(z,null,j(d.value,(l,h)=>(V(),x("div",{key:h},[l.id!="9c0e0865-f3b0-488f-8d3f-b3b0cdda5de7"?(V(),q(T,{key:0,class:"ma-4 elevation-2 max-w-sm"},{default:s(()=>[o(ae,null,{default:s(()=>[_("span",{class:J(["mdi pr-2",l.icon])},null,2),_("span",re,P(l.name),1)]),_:2},1024),o(S,null,{default:s(()=>[o(D,{class:"ma-2",onClick:a=>b(l.id)},{default:s(()=>[p(P(B(A)("settings.edit_action")),1)]),_:2},1032,["onClick"]),o(D,{class:"ma-2",onClick:a=>f(l.id)},{default:s(()=>[p(P(B(A)("settings.delete_action")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)):G("",!0)]))),128)),o(le,{modelValue:r.value,"onUpdate:modelValue":n[1]||(n[1]=l=>r.value=l),width:"auto"},{default:s(()=>[o(T,null,{default:s(()=>[o(ne,null,{default:s(()=>n[2]||(n[2]=[p(" Please remove the device manually from the config file. ")])),_:1}),o(S,null,{default:s(()=>[o(D,{color:"primary",block:"",onClick:n[0]||(n[0]=l=>r.value=!1)},{default:s(()=>n[3]||(n[3]=[p(" Close ")])),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]))}});export{Ee as default};
