import{d as k,aj as h,r as m,z as $,b as t,N,c as V,g as b,f as a,w as o,u as v,Y as c,t as p,j as U,i as s}from"./index-103db515.js";import{V as w,a as B}from"./VCardText-1a59cac1.js";import{V as P}from"./VList-cac73f62.js";import{V as T,a as j}from"./VForm-f2e1d3c9.js";import{V as S}from"./VTextField-73438668.js";import{s as y}from"./VListItem-ab7a82e2.js";import"./VCheckboxBtn-19bafbc9.js";import"./VMenu-482e7fbc.js";import"./VVirtualScroll-b23fb9a8.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=s("br",null,null,-1),F=s("br",null,null,-1),G=s("br",null,null,-1),z=s("br",null,null,-1),A=s("br",null,null,-1),L=k({__name:"AddGroupPlayer",props:{provider:{}},setup(_){const f=h(),n=m(""),i=m([]),u=m(!1),d=_,g=$(()=>Object.values(t.players).filter(e=>{var l;return d.provider.startsWith("ugp")||((l=t.getProvider(e.provider))==null?void 0:l.instance_id)==d.provider&&e.can_sync_with.length}).sort((e,l)=>e.display_name.toUpperCase()>l.display_name.toUpperCase()?1:-1).map(e=>({title:e.display_name,value:e.player_id})));N(()=>d.provider,async e=>{n.value="",u.value=!1,i.value=[]},{immediate:!0});const C=async function(){t.createPlayerGroup(d.provider,n.value,i.value),f.push({name:"playersettings"})};return(e,l)=>(V(),b("section",null,[a(B,null,{default:o(()=>[e.provider&&e.provider in v(t).providers?(V(),b("div",q,[a(w,null,{default:o(()=>[c(p(e.$t("settings.add_group_player"))+" ("+p(v(t).providers[e.provider].name)+") ",1)]),_:1}),D,a(P),F,G,a(T,{ref:"form",modelValue:u.value,"onUpdate:modelValue":l[2]||(l[2]=r=>u.value=r),style:{"margin-right":"10px"}},{default:o(()=>[a(S,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=r=>n.value=r),label:e.$t("settings.player_name"),variant:"outlined",clearable:"",required:""},null,8,["modelValue","label"]),a(j,{modelValue:i.value,"onUpdate:modelValue":l[1]||(l[1]=r=>i.value=r),clearable:"",multiple:"",items:g.value,label:e.$t("settings.group_members"),required:""},null,8,["modelValue","items","label"]),z,a(y,{block:"",color:"primary",disabled:!u.value,onClick:C},{default:o(()=>[c(p(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),A,a(y,{block:"",onClick:l[3]||(l[3]=r=>v(f).back())},{default:o(()=>[c(p(e.$t("close")),1)]),_:1})])):U("",!0)]),_:1})]))}});export{L as default};
