import{d as $,r as P,v as t,a$ as I,q as U,O as h,bg as g,ch as _,aU as V,ae as w,c,b as d,w as o,bJ as L,o as i,e as u,a as s,h as p,u as r,b4 as M,b5 as y,t as n,b6 as v,cg as B,y as E,f as N}from"./index-Bn2Tzsay.js";import{E as O}from"./EditConfig-C3k2Tp_5.js";import{V as G}from"./VTextField-fPA0WAHx.js";import{V as R}from"./VSwitch-CO9p2KhR.js";import"./VForm-DEMT2Ugv.js";import"./VInput-C_1AW61Q.js";import"./VExpansionPanels-DxWEyLfJ.js";import"./VAlert-Bj5fXNhB.js";import"./VBtn-BQk37KYJ.js";import"./VSlider-DnweLLtQ.js";import"./VVirtualScroll-B56qZ1Y0.js";import"./VDialog-DRfRMr5_.js";import"./VSpacer-ygjaGObn.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},te=$({__name:"EditPlayer",props:{playerId:{}},setup(k){const D=N(),e=P(),f=k,b=P(!1);(async()=>{if(f.playerId)try{b.value=(await t.getDSPConfig(f.playerId)).enabled}catch(a){console.error("Error fetching DSP config:",a)}})();const S=t.subscribe(I.PLAYER_DSP_CONFIG_UPDATED,a=>{b.value=a.data.enabled});U(S);const C=h(()=>{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});w(()=>f.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(f.playerId,a),D.push({name:"playersettings"})};return(a,l)=>(i(),c("section",null,[d(L,null,{default:o(()=>[e.value&&r(t).getProviderManifest(e.value.provider).domain in r(t).providerManifests?(i(),c("div",q,[d(M,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(v,null,{default:o(()=>[s("b",null,n(a.$t("settings.player_id"))+": ",1),y(n(e.value.player_id),1)]),_:1}),d(v,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]=m=>r(B)(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(v,{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(v,{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(v,{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(G,{key:3,modelValue:e.value.name,"onUpdate:modelValue":l[1]||(l[1]=m=>e.value.name=m),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]=m=>e.value.enabled=m),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(O,{key:1,disabled:!e.value.enabled,"config-entries":C.value,onSubmit:T},null,8,["disabled","config-entries"])):u("",!0)]),_:1})]))}});export{te as default};
