1import{a as x,b as g,n as f,m as v,r as m,j as e,B as j,t as i,s as b}from"./index-CC7LeppY.js";import{I as o}from"./input-CP1rm5Jz.js";import{L as d}from"./label-BDrGmM36.js";import{S as w}from"./shield-check-DsVj7jnw.js";import{L as N}from"./loader-circle-DNIotRoX.js";const y=x({method:"POST"}).handler(g("209cacee6454da568868b3f17365ea48de2e5e56834b7822a92b8b3bd52ca74a"));function P(){const n=f(),u=v(y),[l,c]=m.useState(!1),[s,r]=m.useState({fullName:"",email:"",password:"",accessCode:""}),h=async a=>{a.preventDefault(),c(!0);try{const t=await u({data:s});if(!t.ok){i.error(t.error);return}const{error:p}=await b.auth.signInWithPassword({email:s.email,password:s.password});if(p){i.success("Admin konts izveidots. LÅ«dzu pieslÄdzies."),n({to:"/auth",search:{mode:"login"}});return}i.success("Admin konts izveidots!"),n({to:"/admin"})}catch(t){i.error(t?.message??"Kļūda")}finally{c(!1)}};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-6 py-16",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-soft",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(w,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Admin reÄ£istrÄcija"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"SlÄgta lapa â nepiecieÅ¡ams piekļuves kods."}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(d,{htmlFor:"fullName",children:"Pilns vÄrds"}),e.jsx(o,{id:"fullName",required:!0,value:s.fullName,onChange:a=>r({...s,fullName:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"email",children:"E-pasts"}),e.jsx(o,{id:"email",type:"email",required:!0,value:s.email,onChange:a=>r({...s,email:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"password",children:"Parole"}),e.jsx(o,{id:"password",type:"password",required:!0,minLength:8,value:s.password,onChange:a=>r({...s,password:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"accessCode",children:"Piekļuves kods"}),e.jsx(o,{id:"accessCode",type:"password",required:!0,value:s.accessCode,onChange:a=>r({...s,accessCode:a.target.value})})]}),e.jsxs(j,{type:"submit",disabled:l,className:"w-full bg-gradient-primary hover:opacity-90 shadow-elegant",children:[l&&e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}),"Izveidot admin kontu"]})]})]})})}export{P as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.