import{$i as e,Ai as t,Mr as n,Oi as r,Qr as i,S as a,Si as o,V as s,Wi as c,Xi as l,_i as u,di as d,ei as f,fi as p,hi as m,it as h,ji as g,kr as _,mi as v,o as y,vi as b,wi as x}from"./CzLxtfx3.js";import"./BOiKBO6X.js";import"./ZsVqGyZo.js";import"./BZM52nSu.js";import{t as S}from"./CfpioOBn.js";import{n as C,r as w,t as T}from"./Bz7haK6E.js";import{t as E}from"./NOGl-rn5.js";var D={class:`flex h-full items-center justify-center overflow-y-auto bg-base-100 p-4`},O={class:`animate-spring-up mx-auto w-full max-w-md`},k={class:`mb-8 text-center`},A={class:`mb-4`},j={class:`mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-box bg-primary/12 text-primary`},M={class:`text-[0.9375rem] text-base-content/80`},N={key:0,class:`mt-6`},P={class:`mb-3 text-[0.8125rem] font-semibold tracking-widest text-base-content/70 uppercase`},F=[`onClick`],I={class:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-base-300 text-base-content/60`},L={class:`flex min-w-0 flex-1 flex-col gap-0.5`},R={class:`flex items-center gap-1.5`},z=[`value`,`placeholder`,`onInput`],B={key:0,class:`overflow-hidden pl-[1.125rem] text-[0.6875rem] text-ellipsis whitespace-nowrap text-base-content/50`},V=[`onClick`],H=x({__name:`setup`,setup(x){let{t:H}=_();i({title:v(()=>H(`setup`))});let U=f(),W=n(),G=c(null);function K(e){W.removeEndpoint(e)}function q(e,t){W.updateEndpoint(e,{label:t})}let J=c(null);return S(J,v({get:()=>W.endpointList,set:e=>W.setEndpointList(e)}),{handle:`.drag-handle`,animation:150,watchElement:!0}),r(async()=>{await G.value?.autoLogin(U.query,{tryDefault:!1})}),(n,r)=>{let i=w,c=C,f=T,_=E;return t(),b(`div`,D,[m(`div`,O,[o(i,{class:`mb-6`}),o(c,{class:`mb-6`}),o(f,{class:`mb-6`}),m(`div`,k,[m(`div`,A,[m(`div`,j,[o(l(a),{size:32})]),r[2]||=m(`h1`,{class:`text-3xl font-bold tracking-wide text-base-content uppercase sm:text-4xl`},[m(`span`,null,`metacube`),m(`span`,{class:`text-base-content/40`},`(`),m(`a`,{class:`text-primary no-underline transition-colors duration-200 hover:text-primary/80`,href:`https://github.com/metacubex/metacubexd`,target:`_blank`},` xd `),m(`span`,{class:`text-base-content/40`},`)`)],-1)]),m(`p`,M,e(l(H)(`setupDescription`)),1)]),o(_,{ref_key:`connectForm`,ref:G,"submit-label":l(H)(`add`)},null,8,[`submit-label`]),l(W).endpointList.length>0?(t(),b(`div`,N,[m(`h3`,P,e(l(H)(`savedEndpoints`)),1),m(`div`,{ref_key:`endpointListRef`,ref:J,class:`flex flex-col gap-3`},[(t(!0),b(p,null,g(l(W).endpointList,n=>(t(),b(`div`,{key:n.id,class:`group flex cursor-pointer items-center gap-2 rounded-xl border border-base-content/10 bg-base-200 p-3 transition-colors duration-200 hover:border-base-content/20 hover:bg-base-300`,onClick:e=>l(G)?.selectEndpoint(n.id)},[o(l(h),{class:`drag-handle shrink-0 cursor-grab text-base-content/30 transition-colors duration-200 hover:text-base-content/60 active:cursor-grabbing`,size:16,onClick:r[0]||=d(()=>{},[`stop`])}),m(`div`,I,[o(l(a),{size:16})]),m(`div`,L,[m(`div`,R,[o(l(s),{class:`shrink-0 text-base-content/30 transition-colors duration-200 group-hover:text-base-content/50`,size:12}),m(`input`,{value:n.label,type:`text`,class:`min-w-0 flex-1 border-none bg-transparent p-0 text-[0.8125rem] font-medium text-base-content transition-colors duration-200 placeholder:text-base-content/60 focus:outline-none`,placeholder:n.url,onClick:r[1]||=d(()=>{},[`stop`]),onInput:e=>q(n.id,e.target.value)},null,40,z)]),n.label?(t(),b(`span`,B,e(n.url),1)):u(``,!0)]),m(`button`,{class:`flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-base-content/50 transition-all duration-200 hover:bg-error/15 hover:text-error`,onClick:d(e=>K(n.id),[`stop`])},[o(l(y),{size:14})],8,V)],8,F))),128))],512)])):u(``,!0)])])}}});export{H as default};