import{I as e,M as t,N as n,P as r,r as i,t as a}from"./jsx-runtime-BciRPUQx.js";import{n as o}from"./warning-CmTaXbvT.js";import{a as s,t as c}from"./Form-DOpuqsbh.js";var l={container:`_container_nv67c_1`,logo:`_logo_nv67c_13`,title:`_title_nv67c_17`,alert:`_alert_nv67c_25`},u=e(r(),1),d=a(),f=n(function({loaderData:e,actionData:n}){var r=n||e;let[a,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(``),[h,g]=(0,u.useState)(``),_=t().state==`submitting`;var v=!1,y=`Register`;return _?(v=!0,y=`Registering...`):a==``?(v=!0,y=`Username is required`):p===``?(v=!0,y=`Password is required`):p!=h&&(v=!0,y=`Passwords must match`),(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i,{className:l.container,method:`POST`,children:[(0,d.jsx)(`img`,{className:l.logo,src:`/logo.svg`}),(0,d.jsx)(`div`,{className:l.title,children:`Nzb DAV`}),r.error&&(0,d.jsx)(o,{className:l.alert,variant:`danger`,children:r.error}),!r.error&&(0,d.jsxs)(o,{className:l.alert,variant:`warning`,children:[(0,d.jsx)(`p`,{style:{marginBottom:`5px`},children:`Welcome!`}),`Register your admin account.`]}),(0,d.jsx)(c.Control,{autoFocus:!0,name:`username`,type:`text`,placeholder:`Username`,value:a,onChange:e=>f(e.currentTarget.value)}),(0,d.jsx)(c.Control,{name:`password`,type:`password`,placeholder:`Password`,value:p,onChange:e=>m(e.currentTarget.value)}),(0,d.jsx)(c.Control,{type:`password`,placeholder:`Confirm Password`,value:h,onChange:e=>g(e.currentTarget.value)}),(0,d.jsx)(s,{type:`submit`,variant:`primary`,disabled:v,children:y})]})})});export{f as default};