import{l as $,a8 as C,r as M,w,v as i,B as f,j as s,y as o,q as t,O as d,K as r,z as n,G as u,x as p,J as l}from"./index-e5db0b73.js";import{V as B,_ as N}from"./EditConfig.vue_vue_type_style_index_0_lang-0800e29c.js";import{c as S,b as m,V as T}from"./VCard-c9b9f4e9.js";import{V as g}from"./VImg-7a057c50.js";import{V as I}from"./VTextField-46667b30.js";import"./VExpansionPanel-671eca9e.js";import"./VCheckboxBtn-46446b67.js";import"./VMenu-d9833a31.js";import"./VVirtualScroll-01555b84.js";import"./VDialog-cda0f95b.js";const P={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},j=["href"],D=n("br",null,null,-1),E=n("br",null,null,-1),O=n("br",null,null,-1),U=n("br",null,null,-1),Q=$({__name:"EditPlayer",props:{playerId:{}},setup(V){const _=V,h=C(),e=M();w(()=>_.playerId,async a=>{a&&(e.value=await l.getPlayerConfig(a))},{immediate:!0});const k=async function(a){a.enabled=e.value.enabled,a.name=e.value.name||null,l.savePlayerConfig(_.playerId,a),h.push({name:"playersettings"})};return(a,v)=>(i(),f("section",null,[s(T,null,{default:o(()=>{var c,b;return[e.value&&e.value.provider in t(l).providerManifests?(i(),f("div",P,[s(S,null,{default:o(()=>[d(r(a.$t("settings.config_player",[e.value.name||t(l).players[e.value.player_id].name])),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_id"))+": ",1),d(r(e.value.player_id),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_provider"))+": ",1),d(r(t(l).providerManifests[e.value.provider].name)+" ( "+r(t(l).providerManifests[e.value.provider].description)+") ",1),t(l).providerManifests[e.value.provider].documentation?(i(),f("a",{key:0,href:t(l).providerManifests[e.value.provider].documentation,target:"_blank"},r(a.$t("settings.check_docs")),9,j)):u("",!0)]),_:1}),t(l).players[e.value.player_id]?(i(),p(m,{key:0},{default:o(()=>[n("b",null,r(a.$t("settings.player_model"))+": ",1),d(r(t(l).players[e.value.player_id].device_info.manufacturer)+" / "+r(t(l).players[e.value.player_id].device_info.model),1)]),_:1})):u("",!0),t(l).players[e.value.player_id]?(i(),p(m,{key:1},{default:o(()=>[n("b",null,r(a.$t("settings.player_address"))+": ",1),d(r(t(l).players[e.value.player_id].device_info.address),1)]),_:1})):u("",!0),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_type_label"))+": ",1),d(r(a.$t(`player_type.${t(l).players[e.value.player_id].type}`)),1)]),_:1}),D,s(g),E,O,"name"in e.value?(i(),p(I,{key:2,modelValue:e.value.name,"onUpdate:modelValue":v[0]||(v[0]=y=>e.value.name=y),placeholder:(c=e.value)==null?void 0:c.name,label:a.$t("settings.player_name"),variant:"outlined",clearable:""},null,8,["modelValue","placeholder","label"])):u("",!0),"enabled"in e.value?(i(),p(B,{key:3,modelValue:e.value.enabled,"onUpdate:modelValue":v[1]||(v[1]=y=>e.value.enabled=y),label:a.$t("settings.enable_player"),color:"primary",disabled:(b=t(l).providerManifests[e.value.provider])==null?void 0:b.builtin},null,8,["modelValue","label","disabled"])):u("",!0)])):u("",!0),U,s(g),e.value?(i(),p(N,{key:1,disabled:!e.value.enabled,"config-entries":Object.values(e.value.values),onSubmit:k},null,8,["disabled","config-entries"])):u("",!0)]}),_:1})]))}});export{Q as default};
