1import{_ as z}from"./DVOtnF_7.js";import{_ as G}from"./0YUUeL8P.js";import{a as H,_ as J}from"./DKzv7V9T.js";import{d as Q,u as X,T as Y,U as Z,n as y,v as ee,B as te,a as oe,o as l,c as r,b as o,t as m,f as e,w as C,e as f,y as _,h as S,l as b,k as ie,i as d,q as I,D as ae}from"#entry";import{u as se,c as T,e as ne,r as le}from"./B_pBNuoR.js";import{u as re}from"./D8-0ebai.js";import"./BzGpl2MF.js";import"./Cit9z4Mz.js";import"./mPLiycdw.js";const de={class:"id-content-wrapper"},ue={class:"id-content-wrapper__small-form stack"},ce={class:"stack"},me={key:0},pe={key:0,class:"text-field-error-message text-field-error-message--stacked"},fe=["disabled"],ge={key:1},ve={key:0,class:"incorrect-password text-field-error-message text-field-error-message--stacked"},_e={class:"stack"},be=["disabled"],ke={key:2},we={key:3},ye=Q({__name:"index",setup(Se){const h=X(),{isLoaded:U,isSignedIn:B,error:u,loading:p,pendingSecondFactor:q,login:P,submitSecondFactor:R,submitEmailStep:$}=re(),F=Y(),s=d("email"),i=d(""),g=d(""),v=d(""),V=d("SLOW_TRACK_NEW"),x=d(void 0),E=d(void 0),L=I(()=>({email:{required:T.withMessage("Email address is required",le),email:T.withMessage("Please enter a valid email address",ne)}})),k=se(L,{email:i}),M=new URLSearchParams(h.hash.replace(/^#\/?/,"")),c=I(()=>h.query.redirect_url||M.get("redirect_url")||"/");Z(()=>{if(U.value&&B.value){const a=c.value.startsWith("http"),t=a?F.value.buildUrlWithAuth(c.value):c.value;y(t,{external:a})}}),ee(i,()=>{u.value=""}),te(()=>{const a=sessionStorage.getItem("prefillEmail");a&&(i.value=a,sessionStorage.removeItem("prefillEmail"))});async function N(){if(i.value=i.value.trim(),await k.value.email.$validate(),k.value.email.$error)return;const a=await $(i.value);a&&(a.outcome==="registered"?s.value="password":a.outcome==="migrated"?(sessionStorage.setItem("migrationEmail",i.value),sessionStorage.setItem("migrationRedirect",c.value),await y("/id/password-reset-required")):(V.value=a.track,a.town&&(x.value=a.town),a.country&&(E.value=a.country),s.value="register"))}function W(){i.value&&sessionStorage.setItem("prefillEmail",i.value),y("/id/forgot-password")}async function A(){await P(i.value,g.value,c.value)&&(s.value="second-factor")}async function D(){await R(v.value)}return oe({title:"ESI.info | Login",ogTitle:"ESI.info | Login",description:"ESI.info supports better decisions for civil engineering, landscaping, building, interior design and industrial engineering projects in the UK.",ogDescription:"ESI.info supports better decisions for civil engineering, landscaping, building, interior design and industrial engineering projects in the UK."}),(a,t)=>{const w=z,K=G,j=H,O=J;return l(),r("div",de,[o("div",ue,[o("h1",null,m(e(s)==="register"?"Register to get free access to all of our tools and resources":"Sign in for free access to all resources and tools"),1),o("div",ce,[o("div",null,[e(s)==="email"?(l(),r("div",me,[o("form",{onSubmit:C(N,["prevent"])},[f(w,{id:"login-email-address",modelValue:e(i),"onUpdate:modelValue":t[0]||(t[0]=n=>_(i)?i.value=n:null),label:"Email",stacked:!0,"validator-wrapper":{fieldToValidate:"email",validator:e(k)}},null,8,["modelValue","validator-wrapper"]),t[7]||(t[7]=o("div",{id:"clerk-captcha"},null,-1)),e(u)?(l(),r("p",pe,[t[6]||(t[6]=o("i",{class:"fa-light fa-triangle-exclamation"},null,-1)),S("  "+m(e(u)),1)])):b("",!0),o("button",{class:"button button--primary button--large button--full-width button--centered",disabled:e(p)},m(e(p)?"Checkingâ¦":"Continue"),9,fe)],32)])):e(s)==="password"?(l(),r("div",ge,[o("form",{onSubmit:C(A,["prevent"])},[f(w,{id:"login-email-address",modelValue:e(i),"onUpdate:modelValue":t[1]||(t[1]=n=>_(i)?i.value=n:null),label:"Email",stacked:!0},null,8,["modelValue"]),f(w,{id:"login-password",modelValue:e(g),"onUpdate:modelValue":t[2]||(t[2]=n=>_(g)?g.value=n:null),label:"Password",stacked:!0,masked:!0},null,8,["modelValue"]),e(u)?(l(),r("p",ve,[t[8]||(t[8]=o("i",{class:"fa-light fa-triangle-exclamation"},null,-1)),S("  "+m(e(u)),1)])):b("",!0),o("div",_e,[o("div",{class:"flex-row"},[o("div",{class:"aside"},[o("button",{type:"button",class:"link",onClick:W}," Forgot password? ")])]),o("div",null,[o("button",{class:"button button--primary button--large button--full-width button--centered",disabled:e(p)},m(e(p)?"Signing inâ¦":"Sign in"),9,be)]),o("div",null,[o("button",{type:"button",class:"link",onClick:t[3]||(t[3]=n=>s.value="email")}," Back ")])])],32)])):e(s)==="second-factor"?(l(),r("div",ke,[t[10]||(t[10]=o("h2",{class:"h3"},"Check your email",-1)),o("p",null,[t[9]||(t[9]=S(" We sent a code to ",-1)),o("strong",null,m(e(q)?.safeIdentifier),1)]),f(K,{id:"login-ver
1ify-code",modelValue:e(v),"onUpdate:modelValue":t[4]||(t[4]=n=>_(v)?v.value=n:null),label:"Verification code",error:e(u),loading:e(p),onSubmit:D},null,8,["modelValue","error","loading"])])):e(s)==="register"?(l(),r("div",we,[f(j,{email:e(i),"redirect-to":e(c),track:e(V),"initial-town":e(x),"initial-country":e(E),onBack:t[5]||(t[5]=n=>s.value="email")},null,8,["email","redirect-to","track","initial-town","initial-country"])])):b("",!0)])]),e(s)==="email"||e(s)==="register"?(l(),ie(O,{key:0})):b("",!0)])])}}}),qe=ae(ye,[["__scopeId","data-v-a761919b"]]);export{qe as default};
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.