import{d as B,ak as E,r as N,K as S,c as n,h as f,f as p,w as d,b as a,u as r,W as m,t,g as o,j as s,e as v}from"./index-CQHe9KB5.js";import{V as T,E as h}from"./EditConfig-AZVCCrA4.js";import{b as I,V as j,a as y}from"./VCardText-BC98CPwQ.js";import{V as C}from"./VList-SeV0eskX.js";import{V as D}from"./VTextField-DJj81lxi.js";import"./VExpansionPanels-DmXKIn9D.js";import"./VListItem-932LEcae.js";import"./VCheckboxBtn-WpBm-DQx.js";import"./VMenu-C_g4AWFG.js";import"./VAlert-CgwdfNK_.js";import"./VForm-BU9Fi69d.js";import"./VVirtualScroll-qRehF0qb.js";import"./VCard-BBArKN8n.js";import"./VSpacer-BB-V2OH5.js";/* empty css              */import"./VDialog-pSjwSbGd.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const U={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},F=["href"],le=B({__name:"EditPlayer",props:{playerId:{}},setup(P){const M=E(),e=N(),b=P;S(()=>b.playerId,async l=>{l&&(e.value=await a.getPlayerConfig(l))},{immediate:!0});const w=async function(l){l.enabled=e.value.enabled,l.name=e.value.name||null,a.savePlayerConfig(b.playerId,l),M.push({name:"playersettings"})};return(l,i)=>(n(),f("section",null,[p(I,null,{default:d(()=>{var g,V,_;return[e.value&&r(a).getProviderManifest(e.value.provider).domain in r(a).providerManifests?(n(),f("div",U,[p(j,null,{default:d(()=>[m(t(l.$t("settings.config_player",[e.value.name||r(a).players[e.value.player_id].name])),1)]),_:1}),p(y,null,{default:d(()=>[o("b",null,t(l.$t("settings.player_id"))+": ",1),m(t(e.value.player_id),1)]),_:1}),p(y,null,{default:d(()=>{var u,c,k,$;return[o("b",null,t(l.$t("settings.player_provider"))+": ",1),m(t((u=r(a).getProviderManifest(e.value.provider))==null?void 0:u.name)+" ( "+t((c=r(a).getProviderManifest(e.value.provider))==null?void 0:c.description)+") ",1),(k=r(a).getProviderManifest(e.value.provider))!=null&&k.documentation?(n(),f("a",{key:0,href:($=r(a).getProviderManifest(e.value.provider))==null?void 0:$.documentation,target:"_blank"},t(l.$t("settings.check_docs")),9,F)):s("",!0)]}),_:1}),r(a).players[e.value.player_id]?(n(),v(y,{key:0},{default:d(()=>[o("b",null,t(l.$t("settings.player_model"))+": ",1),m(t(r(a).players[e.value.player_id].device_info.manufacturer)+" / "+t(r(a).players[e.value.player_id].device_info.model),1)]),_:1})):s("",!0),(g=r(a).players[e.value.player_id])!=null&&g.device_info.address?(n(),v(y,{key:1},{default:d(()=>[o("b",null,t(l.$t("settings.player_address"))+": ",1),m(t(r(a).players[e.value.player_id].device_info.address),1)]),_:1})):s("",!0),r(a).players[e.value.player_id]?(n(),v(y,{key:2},{default:d(()=>[o("b",null,t(l.$t("settings.player_type_label"))+": ",1),m(t(l.$t(`player_type.${r(a).players[e.value.player_id].type}`)),1)]),_:1})):s("",!0),i[2]||(i[2]=o("br",null,null,-1)),p(C),i[3]||(i[3]=o("br",null,null,-1)),i[4]||(i[4]=o("br",null,null,-1)),"name"in e.value?(n(),v(D,{key:3,modelValue:e.value.name,"onUpdate:modelValue":i[0]||(i[0]=u=>e.value.name=u),placeholder:(V=e.value)==null?void 0:V.name,label:l.$t("settings.player_name"),variant:"outlined",clearable:"",class:"configcolumnleft",style:{"margin-right":"25px"}},null,8,["modelValue","placeholder","label"])):s("",!0),"enabled"in e.value?(n(),v(T,{key:4,modelValue:e.value.enabled,"onUpdate:modelValue":i[1]||(i[1]=u=>e.value.enabled=u),label:l.$t("settings.enable_player"),color:"primary",disabled:(_=r(a).getProviderManifest(e.value.provider))==null?void 0:_.builtin},null,8,["modelValue","label","disabled"])):s("",!0)])):s("",!0),i[5]||(i[5]=o("br",null,null,-1)),p(C),e.value?(n(),v(h,{key:1,disabled:!e.value.enabled,"config-entries":Object.values(e.value.values),onSubmit:w},null,8,["disabled","config-entries"])):s("",!0)]}),_:1})]))}});export{le as default};
