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