import{v as M,aa as w,r as B,w as N,y as n,E as f,l as o,A as s,x as t,R as p,N as r,B as i,I as d,z as m,L as l}from"./index-20675090.js";import{V as I,_ as S}from"./EditConfig.vue_vue_type_style_index_0_lang-bba99577.js";import{a as T,V as E}from"./VCardText-5e149cd1.js";import{a as v}from"./VCard-30020028.js";import{V as k}from"./forwardRefs-67412654.js";import{V as D}from"./VTextField-8bb22937.js";import"./VExpansionPanel-3eeaf95b.js";import"./VCheckboxBtn-bbfa74a1.js";import"./VSlideGroup-14bb6bf6.js";import"./VMenu-ae4158ef.js";import"./VForm-61bfc237.js";/* empty css              */import"./VDialog-d7f48b87.js";import"./VSelect-114025f3.js";import"./VVirtualScroll-b47ffb64.js";const R={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},U=["href"],j=i("br",null,null,-1),z=i("br",null,null,-1),A=i("br",null,null,-1),F=i("br",null,null,-1),le=M({__name:"EditPlayer",props:{playerId:{}},setup($){const P=w(),e=B(),_=$;N(()=>_.playerId,async a=>{a&&(e.value=await l.getPlayerConfig(a))},{immediate:!0});const C=async function(a){a.enabled=e.value.enabled,a.name=e.value.name||null,l.savePlayerConfig(_.playerId,a),P.push({name:"playersettings"})};return(a,y)=>(n(),f("section",null,[o(E,null,{default:s(()=>{var c,b;return[e.value&&t(l).getProviderManifest(e.value.provider).domain in t(l).providerManifests?(n(),f("div",R,[o(T,null,{default:s(()=>[p(r(a.$t("settings.config_player",[e.value.name||t(l).players[e.value.player_id].name])),1)]),_:1}),o(v,null,{default:s(()=>[i("b",null,r(a.$t("settings.player_id"))+": ",1),p(r(e.value.player_id),1)]),_:1}),o(v,null,{default:s(()=>{var u,g,V,h;return[i("b",null,r(a.$t("settings.player_provider"))+": ",1),p(r((u=t(l).getProviderManifest(e.value.provider))==null?void 0:u.name)+" ( "+r((g=t(l).getProviderManifest(e.value.provider))==null?void 0:g.description)+") ",1),(V=t(l).getProviderManifest(e.value.provider))!=null&&V.documentation?(n(),f("a",{key:0,href:(h=t(l).getProviderManifest(e.value.provider))==null?void 0:h.documentation,target:"_blank"},r(a.$t("settings.check_docs")),9,U)):d("",!0)]}),_:1}),t(l).players[e.value.player_id]?(n(),m(v,{key:0},{default:s(()=>[i("b",null,r(a.$t("settings.player_model"))+": ",1),p(r(t(l).players[e.value.player_id].device_info.manufacturer)+" / "+r(t(l).players[e.value.player_id].device_info.model),1)]),_:1})):d("",!0),t(l).players[e.value.player_id]?(n(),m(v,{key:1},{default:s(()=>[i("b",null,r(a.$t("settings.player_address"))+": ",1),p(r(t(l).players[e.value.player_id].device_info.address),1)]),_:1})):d("",!0),o(v,null,{default:s(()=>[i("b",null,r(a.$t("settings.player_type_label"))+": ",1),p(r(a.$t(`player_type.${t(l).players[e.value.player_id].type}`)),1)]),_:1}),j,o(k),z,A,"name"in e.value?(n(),m(D,{key:2,modelValue:e.value.name,"onUpdate:modelValue":y[0]||(y[0]=u=>e.value.name=u),placeholder:(c=e.value)==null?void 0:c.name,label:a.$t("settings.player_name"),variant:"outlined",clearable:""},null,8,["modelValue","placeholder","label"])):d("",!0),"enabled"in e.value?(n(),m(I,{key:3,modelValue:e.value.enabled,"onUpdate:modelValue":y[1]||(y[1]=u=>e.value.enabled=u),label:a.$t("settings.enable_player"),color:"primary",disabled:(b=t(l).getProviderManifest(e.value.provider))==null?void 0:b.builtin},null,8,["modelValue","label","disabled"])):d("",!0)])):d("",!0),F,o(k),e.value?(n(),m(S,{key:1,disabled:!e.value.enabled,"config-entries":Object.values(e.value.values),onSubmit:C},null,8,["disabled","config-entries"])):d("",!0)]}),_:1})]))}});export{le as default};
