import{av as k,bK as D,bL as $,H as r,J as V,aD as C,aB as m,ax as I,x as t,d as g,aQ as U,bM as A,bN as L,K as y,bc as c,aI as T,aO as N,aM as h,aL as v,bp as w,au as x}from"./index-C-Ivu3jU.js";import{T as H}from"./Toolbar-CLPRlZ-4.js";import{V as K}from"./VDialog-BZuFHdVP.js";import{V as p}from"./VTextField-Bkx949P5.js";const O={style:{padding:"15px"}},P=k({__name:"AddManualLink",props:D({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(f){const d=$(f,"modelValue"),B=f,o=r(""),n=r(""),s=r(""),i=r(!1),l=r();V(()=>d.value,e=>{e!=null&&(x.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,B.type==h.RADIO?v.getRadio(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}):v.getTrack(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}))},M=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}]),v.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(I(),C(K,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=u=>d.value=u),transition:"dialog-bottom-transition"},{default:m(()=>[t(N,null,{default:m(()=>[t(H,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(U),a[5]||(a[5]=g("br",null,null,-1)),g("div",O,[t(p,{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(p,{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(p,{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(A,null,{default:m(()=>[t(L),t(y,{variant:"outlined",onClick:a[3]||(a[3]=u=>d.value=!1)},{default:m(()=>[c(T(e.$t("cancel")),1)]),_:1}),t(y,{variant:"flat",color:"primary",disabled:i.value,onClick:M},{default:m(()=>[c(T(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{P as _};
