import{ay as M,c4 as $,c5 as C,J as r,L as V,aI as D,aA as U,aG as v,o as t,aT as A,E as c,aV as I,bU as m,c6 as N,c7 as h,M as y,bi as g,aN as T,aS as L,aQ as S,aP as f,bv as w,ax as P}from"./index-D-FY8Yx2.js";import{T as R}from"./Toolbar-CxAnowGj.js";const x={style:{padding:"15px"}},G=M({__name:"AddManualLink",props:$({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const d=C(p,"modelValue"),k=p,o=r(""),n=r(""),s=r(""),i=r(!1),l=r();V(()=>d.value,e=>{e!=null&&(P.dialogActive=e),e==!1&&(o.value="",n.value="",s.value="",l.value=void 0)},{immediate:!0}),V(()=>l.value,e=>{if(e){n.value||(n.value=e.name);for(const a of e.metadata.images||[])if(a.type=="thumb"){s.value=a.path;break}}});const b=()=>{!o.value||!["http","rtsp"].some(e=>o.value.startsWith(e))||(i.value=!0,k.type==S.RADIO?f.getRadio(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}):f.getTrack(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}))},B=function(){b(),l.value&&(l.value.name=n.value||l.value.name,delete l.value.sort_name,s.value&&(l.value.metadata.images=[{type:w.THUMB,path:s.value,provider:"builtin",remotely_accessible:!0}]),f.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(U(),D(L,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=u=>d.value=u),transition:"dialog-bottom-transition"},{default:v(()=>[t(A,null,{default:v(()=>[t(R,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(I),a[5]||(a[5]=c("br",null,null,-1)),c("div",x,[t(m,{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=u=>o.value=u),variant:"outlined",label:e.$t("enter_url"),disabled:i.value,onBlur:b},null,8,["modelValue","label","disabled"]),t(m,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=u=>n.value=u),variant:"outlined",label:e.$t("enter_name"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(m,{modelValue:s.value,"onUpdate:modelValue":a[2]||(a[2]=u=>s.value=u),variant:"outlined",label:e.$t("image_url"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(N,null,{default:v(()=>[t(h),t(y,{variant:"outlined",onClick:a[3]||(a[3]=u=>d.value=!1)},{default:v(()=>[g(T(e.$t("cancel")),1)]),_:1}),t(y,{variant:"flat",color:"primary",disabled:i.value,onClick:B},{default:v(()=>[g(T(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{G as _};
