import{a as P,c as A,d as E,e as T,f as z,g as N,p as k,r as D}from"./chunk-Z5QZKKHL.js";import{a as O}from"./chunk-LIVIUXQS.js";import{b as x,d as M,j as w,o as I}from"./chunk-CVBVVN6Q.js";import"./chunk-LQ2OPIJL.js";import{Cb as v,Ka as i,Qa as p,R as l,T as C,Wa as u,_a as d,db as c,hb as e,ib as n,jb as _,lb as m,mb as b,ub as r,vb as S,wb as h}from"./chunk-MFMPTNOZ.js";import{d as y}from"./chunk-4CLCTAJ7.js";function q(a,s){if(a&1&&(e(0,"p",7),_(1,"app-icon",11),r(2),n()),a&2){let o=b();i(),d("size",16),i(),h(" ",o.error()," ")}}function F(a,s){a&1&&(e(0,"span"),r(1," Orders are held on the server and only released to a signed-in account. Signing out, or closing this tab, ends the session. "),n())}function R(a,s){a&1&&(e(0,"span"),r(1," No backend is configured, so this check runs in the browser and keeps the curious out and nothing more. Orders are only the ones placed on this device. "),n())}var L=class a{auth=l(w);router=l(M);route=l(x);seo=l(I);enforced=this.auth.enforced;identifierLabel=this.auth.identifierLabel;username=p("");password=p("");error=p(null);busy=p(!1);ngOnInit(){this.seo.apply({title:"Admin sign in",description:"Sign in to the TshirtLB admin.",path:"/admin/sign-in",noIndex:!0})}submit(){return y(this,null,function*(){this.error.set(null),this.busy.set(!0);let s=yield this.auth.signIn(this.username(),this.password());if(this.busy.set(!1),!s){this.error.set(this.auth.error()??`That ${this.identifierLabel().toLowerCase()} and password do not match.`),this.password.set("");return}let o=this.route.snapshot.queryParamMap.get("returnTo");this.router.navigateByUrl(o??"/admin")})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=C({type:a,selectors:[["app-admin-sign-in"]],standalone:!0,features:[v],decls:23,vars:10,consts:[[1,"container","page","signin"],[1,"signin__card",3,"ngSubmit"],[1,"pill"],[1,"signin__lede"],[1,"signin__field"],["name","username","required","",1,"input",3,"ngModelChange","type","autocomplete","ngModel"],["type","password","name","password","autocomplete","current-password","required","",1,"input",3,"ngModelChange","ngModel"],["role","alert",1,"signin__error"],["type","submit",1,"btn","btn--primary","btn--block",3,"disabled"],[1,"signin__warning"],["name","shield",3,"size"],["name","alert",3,"size"]],template:function(o,t){o&1&&(e(0,"div",0)(1,"form",1),m("ngSubmit",function(){return t.submit()}),e(2,"span",2),r(3,"Admin"),n(),e(4,"h1"),r(5,"Sign in"),n(),e(6,"p",3),r(7,"Orders carry customers' names, addresses and phone numbers."),n(),e(8,"label",4)(9,"span"),r(10),n(),e(11,"input",5),m("ngModelChange",function(g){return t.username.set(g)}),n()(),e(12,"label",4)(13,"span"),r(14,"Password"),n(),e(15,"input",6),m("ngModelChange",function(g){return t.password.set(g)}),n()(),u(16,q,3,2,"p",7),e(17,"button",8),r(18),n(),e(19,"p",9),_(20,"app-icon",10),u(21,F,2,0,"span")(22,R,2,0,"span"),n()()()),o&2&&(i(10),S(t.identifierLabel()),i(),d("type",t.enforced?"email":"text")("autocomplete",t.enforced?"email":"username")("ngModel",t.username()),i(4),d("ngModel",t.password()),i(),c(t.error()?16:-1),i(),d("disabled",t.busy()),i(),h(" ",t.busy()?"Checking\u2026":"Sign in"," "),i(2),d("size",16),i(),c(t.enforced?21:22))},dependencies:[D,N,P,A,E,k,z,T,O],styles:[".signin[_ngcontent-%COMP%]{display:grid;place-items:center;min-height:62vh}.signin__card[_ngcontent-%COMP%]{width:min(420px,100%);display:grid;gap:14px;padding:30px;border-radius:var(--r-lg);border:1px solid var(--line);background:var(--surface);box-shadow:0 18px 50px #11112214}.signin__card[_ngcontent-%COMP%]   h1[_ngcontent-%COMP%]{font-size:1.6rem;margin:0}.signin__lede[_ngcontent-%COMP%]{margin:-6px 0 4px;color:var(--muted);font-size:.9rem}.pill[_ngcontent-%COMP%]{justify-self:start}.signin__field[_ngcontent-%COMP%]{display:grid;gap:6px}.signin__field[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{font-size:.84rem;font-weight:600}.signin__error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:0;padding:10px 12px;border-radius:var(--r-md);background:#d052521a;color:#a33;font-size:.86rem}.signin__warning[_ngcontent-%COMP%]{display:flex;gap:10px;align-items:flex-start;margin:4px 0 0;font-size:.79rem;line-height:1.55;color:var(--muted)}.signin__warning[_ngcontent-%COMP%]   app-icon[_ngcontent-%COMP%]{flex:none;margin-top:1px}"],changeDetection:0})};export{L as AdminSignInComponent};
