import{d as I,i as P,m as t,a_ as $,l as U,N as w,bf as g,ch as _,aU as V,ad as L,c,b as d,w as o,bI as M,o as i,q as u,a as s,e as p,u as r,b3 as N,b4 as y,t as n,b5 as f,cg as h,p as E,bJ as B}from"./index-BLuBzgcR.js";import{E as G}from"./EditConfig-BXS2Ap2c.js";import{V as O}from"./VTextField-BRzkPyuL.js";import{V as R}from"./VSwitch-D4nwfxN1.js";import"./VForm-ChQquqpb.js";import"./VInput-S8c2HXsf.js";import"./VExpansionPanels-BWCnJP-B.js";import"./VAlert-Du-laR0E.js";import"./VBtn-i8gedOhv.js";import"./VSlider-bRJnej6Z.js";import"./VVirtualScroll-JP5E3DQw.js";import"./VDialog-CUNnqGJy.js";import"./VSpacer-FdmIBMIx.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},te=I({__name:"EditPlayer",props:{playerId:{}},setup(k){const D=B(),e=P(),m=k,b=P(!1);(async()=>{if(m.playerId)try{b.value=(await t.getDSPConfig(m.playerId)).enabled}catch(a){console.error("Error fetching DSP config:",a)}})();const S=t.subscribe($.PLAYER_DSP_CONFIG_UPDATED,a=>{b.value=a.data.enabled});U(S);const C=w(()=>{if(!e.value)return[];const a=Object.values(e.value.values),l=t.players[e.value.player_id];return l&&l.type!==g.GROUP?a.push({key:"dsp_settings",type:_.DSP_SETTINGS,label:"",default_value:b.value,required:!1,category:"audio"}):l&&l.type===g.GROUP&&l.supported_features.includes(V.MULTI_DEVICE_DSP)?a.push({key:"dsp_note_multi_device_group",type:_.LABEL,label:"You can configure the DSP for each player individually.",default_value:null,required:!1,category:"audio"}):l&&l.type===g.GROUP&&!l.supported_features.includes(V.MULTI_DEVICE_DSP)&&a.push({key:"dsp_note_multi_device_group_not_supported",type:_.LABEL,label:"This group type does not support DSP when playing to multiple devices.",default_value:null,required:!1,category:"audio"}),a});L(()=>m.playerId,async a=>{a&&(e.value=await t.getPlayerConfig(a))},{immediate:!0});const T=async function(a){delete a.dsp_settings,a.enabled=e.value.enabled,a.name=e.value.name||null,t.savePlayerConfig(m.playerId,a),D.push({name:"playersettings"})};return(a,l)=>(i(),c("section",null,[d(M,null,{default:o(()=>[e.value&&r(t).getProviderManifest(e.value.provider).domain in r(t).providerManifests?(i(),c("div",q,[d(N,null,{default:o(()=>[y(n(a.$t("settings.config_player",[e.value.name||r(t).players[e.value.player_id]?.name||e.value.default_name])),1)]),_:1}),d(f,null,{default:o(()=>[s("b",null,n(a.$t("settings.player_id"))+": ",1),y(n(e.value.player_id),1)]),_:1}),d(f,null,{default:o(()=>[s("b",null,n(a.$t("settings.player_provider"))+": ",1),y(n(r(t).getProviderManifest(e.value.provider)?.name)+" ",1),r(t).getProviderManifest(e.value.provider)?.documentation?(i(),c("a",{key:0,onClick:l[0]||(l[0]=v=>r(h)(r(t).getProviderManifest(e.value.provider)?.documentation))}," ["+n(a.$t("settings.check_docs"))+"]",1)):u("",!0)]),_:1}),r(t).players[e.value.player_id]?(i(),p(f,{key:0},{default:o(()=>[s("b",null,n(a.$t("settings.player_model"))+": ",1),y(n(r(t).players[e.value.player_id].device_info.manufacturer)+" / "+n(r(t).players[e.value.player_id].device_info.model),1)]),_:1})):u("",!0),r(t).players[e.value.player_id]?.device_info.ip_address?(i(),p(f,{key:1},{default:o(()=>[s("b",null,n(a.$t("settings.player_address"))+": ",1),y(n(r(t).players[e.value.player_id].device_info.ip_address),1)]),_:1})):u("",!0),r(t).players[e.value.player_id]?(i(),p(f,{key:2},{default:o(()=>[s("b",null,n(a.$t("settings.player_type_label"))+": ",1),y(n(a.$t(`player_type.${r(t).players[e.value.player_id].type}`)),1)]),_:1})):u("",!0),l[3]||(l[3]=s("br",null,null,-1)),d(E),l[4]||(l[4]=s("br",null,null,-1)),l[5]||(l[5]=s("br",null,null,-1)),"name"in e.value?(i(),p(O,{key:3,modelValue:e.value.name,"onUpdate:modelValue":l[1]||(l[1]=v=>e.value.name=v),placeholder:e.value?.name,label:a.$t("settings.player_name"),variant:"outlined",clearable:"",class:"configcolumnleft",style:{"margin-right":"25px"}},null,8,["modelValue","placeholder","label"])):u("",!0),"enabled"in e.value?(i(),p(R,{key:4,modelValue:e.value.enabled,"onUpdate:modelValue":l[2]||(l[2]=v=>e.value.enabled=v),label:a.$t("settings.enable_player"),color:"primary",disabled:r(t).getProviderManifest(e.value.provider)?.builtin},null,8,["modelValue","label","disabled"])):u("",!0)])):u("",!0),l[6]||(l[6]=s("br",null,null,-1)),d(E),e.value?(i(),p(G,{key:1,disabled:!e.value.enabled,"config-entries":C.value,onSubmit:T},null,8,["disabled","config-entries"])):u("",!0)]),_:1})]))}});export{te as default};
