import{n as e,r as t,t as n}from"./CZOV-l7L.js";import{t as r}from"./BSIYWW2I.js";import{t as i}from"./Cng2q01m.js";import{t as a}from"./DT-usFzy.js";import{t as o}from"./xyjSbjQ0.js";import{$n as s,Bn as c,Cn as l,Dn as u,En as d,Ln as f,Nn as p,Rt as m,Vt as h,ar as g,bn as _,cn as v,cr as y,jn as b,ln as x,r as S,wn as C,xn as w,zn as T}from"./B-6m3w3Q.js";import"./V3hK-wJL.js";import"./2W2NPnGu.js";import"./CkauhQRm.js";import{t as E}from"./Dj0MGxUL.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=p({__name:`setup`,setup(p){let{t:H}=m();v({title:l(()=>H(`setup`))});let U=x(),W=h(),G=s(null);function K(e){W.removeEndpoint(e)}function q(e,t){W.updateEndpoint(e,{label:t})}let J=s(null);return E(J,l({get:()=>W.endpointList,set:e=>W.setEndpointList(e)}),{handle:`.drag-handle`,animation:150,watchElement:!0}),f(async()=>{await G.value?.autoLogin(U.query,{tryDefault:!1})}),(s,l)=>{let f=t,p=e,m=n,h=i;return T(),u(`div`,D,[C(`div`,O,[b(f,{class:`mb-6`}),b(p,{class:`mb-6`}),b(m,{class:`mb-6`}),C(`div`,k,[C(`div`,A,[C(`div`,j,[b(g(o),{size:32})]),l[2]||=C(`h1`,{class:`text-3xl font-bold tracking-wide text-base-content uppercase sm:text-4xl`},[C(`span`,null,`metacube`),C(`span`,{class:`text-base-content/40`},`(`),C(`a`,{class:`text-primary no-underline transition-colors duration-200 hover:text-primary/80`,href:`https://github.com/metacubex/metacubexd`,target:`_blank`},` xd `),C(`span`,{class:`text-base-content/40`},`)`)],-1)]),C(`p`,M,y(g(H)(`setupDescription`)),1)]),b(h,{ref_key:`connectForm`,ref:G,"submit-label":g(H)(`add`)},null,8,[`submit-label`]),g(W).endpointList.length>0?(T(),u(`div`,N,[C(`h3`,P,y(g(H)(`savedEndpoints`)),1),C(`div`,{ref_key:`endpointListRef`,ref:J,class:`flex flex-col gap-3`},[(T(!0),u(w,null,c(g(W).endpointList,e=>(T(),u(`div`,{key:e.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:t=>g(G)?.selectEndpoint(e.id)},[b(g(r),{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:l[0]||=_(()=>{},[`stop`])}),C(`div`,I,[b(g(o),{size:16})]),C(`div`,L,[C(`div`,R,[b(g(a),{class:`shrink-0 text-base-content/30 transition-colors duration-200 group-hover:text-base-content/50`,size:12}),C(`input`,{value:e.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:e.url,onClick:l[1]||=_(()=>{},[`stop`]),onInput:t=>q(e.id,t.target.value)},null,40,z)]),e.label?(T(),u(`span`,B,y(e.url),1)):d(``,!0)]),C(`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:_(t=>K(e.id),[`stop`])},[b(g(S),{size:14})],8,V)],8,F))),128))],512)])):d(``,!0)])])}}});export{H as default};