import{l as N,a9 as $,r as D,L as a,ai as L,b as x,w as E,ac 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-ebe4cd91.js";import{L as R,_ as U,B as v}from"./ListItem-a20c73ec.js";import{C as j}from"./Container-1375a850.js";import{V as z,j as h}from"./VImg-b5692565.js";import{V as H}from"./VToolbar-76e5fae8.js";import"./VMenu-86ca5efe.js";import"./index-bda4e7b4.js";import"./VListItem-0df8c60b.js";/* empty css              */const J={style:{"margin-bottom":"10px"}},O={class:"line-clamp-1"},S={class:"line-clamp-1"},ne=N({__name:"Players",setup(Y){const p=$(),r=D([]),k=a.subscribe_multi([L.PLAYER_CONFIG_UPDATED],()=>{b()});x(k);const b=async function(){r.value=(await a.getPlayerConfigs()).sort((e,i)=>m(e).localeCompare(m(i)))},C=function(e){a.removePlayerConfig(e),r.value=r.value.filter(i=>i.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")},w=function(e){e.enabled=!e.enabled,a.savePlayerConfig(e.player_id,{enabled:e.enabled})},m=function(e){var i;return e.name||((i=a.players[e.player_id])==null?void 0:i.display_name)||e.default_name||e.player_id},A=function(e){window.open(e,"_blank")};return E(()=>a.players,e=>{e&&b()},{immediate:!0}),(e,i)=>{const B=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:V},{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,t=>G((l(),_(R,{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:()=>{w(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(()=>[o(U,{domain:t.provider,size:40,class:"listitem-media-thumb"},null,8,["domain"])]),title:n(()=>[g("div",O,d(m(t)),1)]),subtitle:n(()=>{var s;return[g("div",S,d(((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?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"])),[[B,()=>{u(t.player_id)}]])),128))]),_:1})])}}});export{ne as default};
