import{l as $,a6 as D,r as E,H as a,ao as L,b as T,w as x,af as I,v as l,A as b,j as i,y as n,N as y,J as r,F,B as G,R as M,x as m,q as c,I as f,D as R}from"./index-dcf0de03.js";import{L as j,_ as U,B as g}from"./ListItem-6dad7331.js";import{C as v}from"./Container-d623752d.js";import{V as q,j as h}from"./VBtn-a0da5efe.js";import{V as z}from"./VToolbar-dfba6de4.js";import{b as H}from"./VMenu-3bdd1b96.js";import"./VListItem-943ee224.js";/* empty css              */import"./index-0afee102.js";const J={style:{"margin-bottom":"10px"}},O={class:"line-clamp-1"},S={class:"line-clamp-1"},ie=$({__name:"Players",setup(Y){const p=D(),d=E([]),k=a.subscribe_multi([L.PLAYER_CONFIG_UPDATED],()=>{_()});T(k);const _=async function(){d.value=await a.getPlayerConfigs()},C=function(e){a.removePlayerConfig(e),d.value=d.value.filter(o=>o.player_id!=e)},u=function(e){e in a.players&&p.push(`/settings/editplayer/${e}`)},P=function(e){e in a.players&&p.push("/settings/editprovider/ugp")},V=function(){p.push("/settings/editprovider/ugp")},B=function(e){e.enabled=!e.enabled,a.savePlayerConfig(e.player_id,{enabled:e.enabled})},w=function(e){var o;return e.name||((o=a.players[e.player_id])==null?void 0:o.display_name)||e.default_name||e.player_id},A=function(e){window.open(e,"_blank")};return x(()=>a.players,e=>{e&&_()},{immediate:!0}),(e,o)=>{const N=I("hold");return l(),b("div",J,[i(z,{density:"compact",class:"titlebar",color:"transparent",style:{height:"55px"}},{title:n(()=>[y(r(e.$t("settings.settings"))+" | "+r(e.$t("settings.players")),1)]),append:n(()=>[i(q,{color:"accent",variant:"outlined",onClick:V},{default:n(()=>[y(r(e.$t("settings.add_group_player")),1)]),_:1})]),_:1}),i(H),i(v,null,{default:n(()=>[i(v,null,{default:n(()=>[(l(!0),b(F,null,G(d.value,t=>M((l(),m(j,{key:t.player_id,link:"","context-menu-items":[{label:"settings.configure",labelArgs:[],action:()=>{u(t.player_id)},icon:"mdi-cog"},{label:"settings.edit_group_members",labelArgs:[],action:()=>{P(t.player_id)},icon:"mdi-speaker-multiple",hide:t.provider!="ugp"},{label:t.enabled?"settings.disable":"settings.enable",labelArgs:[],action:()=>{B(t)},icon:"mdi-cancel"},{label:"settings.documentation",labelArgs:[],action:()=>{A(c(a).providerManifests[t.provider].documentation)},icon:"mdi-bookshelf",disabled:!c(a).providerManifests[t.provider].documentation},{label:"settings.delete",labelArgs:[],action:()=>{C(t.player_id)},icon:"mdi-delete"}],onClick:s=>u(t.player_id)},{prepend:n(()=>[i(U,{domain:t.provider,size:40,class:"listitem-media-thumb"},null,8,["domain"])]),title:n(()=>[f("div",O,r(w(t)),1)]),subtitle:n(()=>{var s;return[f("div",S,r(((s=c(a).providers[t.provider])==null?void 0:s.name)||t.provider),1)]}),append:n(()=>{var s;return[t.enabled?(s=c(a).players[t.player_id])!=null&&s.available?R("",!0):(l(),m(g,{key:1,icon:"",title:e.$t("settings.player_not_available")},{default:n(()=>[i(h,{icon:"mdi-timer-sand"})]),_:1},8,["title"])):(l(),m(g,{key:0,icon:"",title:e.$t("settings.player_disabled")},{default:n(()=>[i(h,{icon:"mdi-cancel"})]),_:1},8,["title"]))]}),_:2},1032,["context-menu-items","onClick"])),[[N,()=>{u(t.player_id)}]])),128))]),_:1})]),_:1})])}}});export{ie as default};
