import{M,a as v,I as $,s as C}from"./index-Cc0s9xHj.js";import{T as D}from"./Toolbar-CpDb2XyG.js";import{d as U,b4 as I,b5 as A,w as V,G as h,H as r,J as t,e as g,r as m,a2 as y,a4 as c,b as w}from"./lucide-C_a_D9Y7.js";import{o as N,e as H,l as f,T as L,U as R,m as T,a as S}from"./vuetify-CvGbteJu.js";const F={style:{padding:"15px"}},W=U({__name:"AddManualLink",props:I({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const d=A(p,"modelValue"),k=p,u=m(""),s=m(""),n=m(""),i=m(!1),l=m();V(()=>d.value,e=>{e!=null&&(C.dialogActive=e),e==!1&&(u.value="",s.value="",n.value="",l.value=void 0)},{immediate:!0}),V(()=>l.value,e=>{if(e){s.value||(s.value=e.name);for(const a of e.metadata.images||[])if(a.type=="thumb"){n.value=a.path;break}}});const b=()=>{!u.value||!["http","rtsp"].some(e=>u.value.startsWith(e))||(i.value=!0,k.type==M.RADIO?v.getRadio(u.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}):v.getTrack(u.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=s.value||l.value.name,delete l.value.sort_name,n.value&&(l.value.metadata.images=[{type:$.THUMB,path:n.value,provider:"builtin",remotely_accessible:!0}]),v.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(w(),h(N,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=o=>d.value=o),transition:"dialog-bottom-transition"},{default:r(()=>[t(S,null,{default:r(()=>[t(D,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(H),a[5]||(a[5]=g("br",null,null,-1)),g("div",F,[t(f,{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=o=>u.value=o),variant:"outlined",label:e.$t("enter_url"),disabled:i.value,onBlur:b},null,8,["modelValue","label","disabled"]),t(f,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=o=>s.value=o),variant:"outlined",label:e.$t("enter_name"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(f,{modelValue:n.value,"onUpdate:modelValue":a[2]||(a[2]=o=>n.value=o),variant:"outlined",label:e.$t("image_url"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(L,null,{default:r(()=>[t(R),t(T,{variant:"outlined",onClick:a[3]||(a[3]=o=>d.value=!1)},{default:r(()=>[y(c(e.$t("cancel")),1)]),_:1}),t(T,{variant:"flat",color:"primary",disabled:i.value,onClick:B},{default:r(()=>[y(c(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{W as _};
