import{C as U}from"./Container-CEbFgC5b.js";import{P as k}from"./ProviderFilters-jQ88EZ2W.js";import{d as N,r as m,O as C,v as r,ae as B,c as w,a as P,b as s,t as l,u as y,$ as i,w as n,F as x,o as p,g as $,h as E,x as S,b4 as R,b5 as f,bJ as D,n as F,j,bt as G,z as O,f as Y,cf as o}from"./index-Bn2Tzsay.js";import{z as T}from"./index-CBho6rsP.js";import{V as q,a as J}from"./VRow-CNVApy9v.js";import{V as Q}from"./VBtn-BQk37KYJ.js";import{_ as H}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VContainer-CRIwFZfO.js";/* empty css              */import"./VTextField-fPA0WAHx.js";import"./VInput-C_1AW61Q.js";const K={class:"filters"},W={class:"pl-5 font-weight-medium"},X=N({__name:"AddProvider",setup(Z){const g=Y(),v=m([]),d=m(""),c=m([]),_=C(()=>{let e=Object.values(r.providerManifests);return e=e.filter(t=>!t.builtin&&t.type!=="core"),c.value.length>0&&(e=e.filter(t=>c.value.includes(t.type))),e.filter(t=>t.multi_instance||!v.value.find(a=>a.domain==t.domain)).sort((t,a)=>{const h=(t.name||r.providerManifests[t.domain].name).toUpperCase(),I=(a.name||r.providerManifests[a.domain].name).toUpperCase();return h>I?1:-1})}),u=C(()=>{if(!d.value)return _.value;const e=d.value.toLowerCase();return _.value.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))}),b=async function(){v.value=await r.getProviderConfigs()},V=function(e){if(e.depends_on&&!r.getProvider(e.depends_on)){const t=r.getProviderName(e.depends_on);confirm(i("settings.provider_depends_on_confirm",[e.name,t]))&&g.push(`/settings/addprovider/${e.depends_on}`);return}g.push(`/settings/addprovider/${e.domain}`)},A=function(e){return e&&e.length>150},L=function(e){return{[o.MUSIC]:"mdi-music",[o.PLAYER]:"mdi-speaker",[o.METADATA]:"mdi-file-code",[o.PLUGIN]:"mdi-puzzle"}[e]||"mdi-help-circle"},M=function(e){return T(e).with(o.MUSIC,()=>i("settings.music")).with(o.PLAYER,()=>i("settings.player")).with(o.METADATA,()=>i("settings.metadata")).with(o.PLUGIN,()=>i("settings.plugin")).otherwise(()=>i("settings.player"))},z=function(e){return T(e).with("stable",()=>"green").with("beta",()=>"blue").with("alpha",()=>"purple").with("experimental",()=>"orange").with("unmaintained",()=>"grey").with("deprecated",()=>"red").otherwise(()=>"green")};return B(()=>r.providers,e=>{e&&b()},{immediate:!0}),(e,t)=>(p(),w(x,null,[P("div",K,[s(k,{"onUpdate:search":t[0]||(t[0]=a=>d.value=a),"onUpdate:types":t[1]||(t[1]=a=>c.value=a)})]),P("div",W,l(y(i)("settings.providers_total",[u.value.length,u.value.length>1?"s":""])),1),s(U,{variant:"comfortable",class:"mt-4"},{default:n(()=>[s(q,null,{default:n(()=>[(p(!0),w(x,null,$(u.value,a=>(p(),E(J,{key:a.domain,cols:"12",md:"6",lg:"4",class:"d-flex"},{default:n(()=>[s(S,{class:"flex-fill rounded-lg","min-height":"200px",onClick:h=>V(a)},{prepend:n(()=>[s(O,{domain:a.domain,size:50,class:"listitem-media-thumb",style:{"margin-top":"5px","margin-bottom":"5px"}},null,8,["domain"])]),append:n(()=>[s(Q,{variant:"text",size:"small",icon:"",title:M(a.type)},{default:n(()=>[s(j,{icon:L(a.type)},null,8,["icon"])]),_:2},1032,["title"]),s(G,{size:"x-small",variant:"flat",class:"mx-1 text-uppercase",color:z(a.stage)},{default:n(()=>[f(l(y(i)(String(a.stage||"").toLowerCase())),1)]),_:2},1032,["color"])]),default:n(()=>[s(R,{class:"text-truncate"},{default:n(()=>[f(l(a.name),1)]),_:2},1024),s(D,{class:F(["provider-description",{"truncated-text":A(a.description)}])},{default:n(()=>[f(l(a.description),1)]),_:2},1032,["class"])]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1})]),_:1})],64))}}),ue=H(X,[["__scopeId","data-v-16cfc2f2"]]);export{ue as default};
