import{r as e,h as i}from"./p-083180bf.js";import{k as r,f as o,n as t}from"./p-a7fc1e02.js";import{d as a,J as n,I as s,o as c,X as l,i as d}from"./p-d0993bb9.js";import{c as m}from"./p-c1086930.js";import{g as u}from"./p-9ec99ced.js";import{e as h,p as f}from"./p-0797a946.js";import{S as p,V as y,a as v}from"./p-38c7775a.js";const g=a.gql`
  query checkUserVerification {
    viewer {
      ... on User {
        id
        accountId
        email
        emailVerified
        managedIdentity {
          email
          emailVerified
        }
      }
    }
  }
`,V=class{constructor(i){e(this,i),this.general_verifyEmailHeader="Verify your email",this.general_verifyEmailDescription="To get your cash paid out directly to your bank account, please complete your account setup",this.emailStep_verifyEmailHeaderText="Start by verifying your email. We’ll send you a code through our referral provider, impact.com.",this.emailStep_sendCodeErrorHeader="There was an error sending your code.",this.emailStep_sendCodeErrorDescription="Please try again. If this problem continues, contact our program support team.",this.emailStep_emailLabel="Email",this.emailStep_sendCodeText="Send code",this.emailStep_emailValidationErrorText="Please enter a valid email",this.codeStep_verifyCodeHeaderText="Enter the code sent to {email} from our referral provider, impact.com.",this.codeStep_reverifyCodeHeaderText="Enter the code sent to {email} from our referral provider, impact.com.",this.codeStep_resendCodeText="Didn't receive your code? {resendCodeLink}",this.codeStep_resendCodeLabel="Resend code",this.codeStep_codeResentSuccessfullyText="Another code has been sent to {email}",this.codeStep_invalidCodeText="Please check your code and try again. If you’re still having trouble, try resending your code.",this.codeStep_verifyText="Verify",this.codeStep_networkErrorMessage="An error occurred while verifying your email. Please refresh the page and try again.",this.stateController="{}",t(this)}disconnectedCallback(){}getStepTextProps(e){const i=u(this);return h(i,e)}render(){const e=d()?function(e){const[i,r]=s({namespace:p,initialValue:!1}),[o,t]=s({namespace:y,initialValue:void 0}),a=c(v),n=f(e.stateController),l=Object.keys(n).reduce(((e,i)=>"sqm-widget-verification"===i?{...e,...n[i]}:{...e,[`${i}_stateController`]:n[i]}),{});return m({showCode:i,onVerification:()=>{a(!0)},loading:!1},l||{},{arrayMerge:(e,i)=>i})}(this):function(){const e=n(),[i,t]=s({namespace:p,initialValue:!1}),[a,d]=s({namespace:y,initialValue:null==e?void 0:e.email}),m=c(v),[u,h]=r(!0),[f]=l(g);return o((()=>{(async()=>{var e,i,r;try{const o=await f({});if(!o||o instanceof Error)throw new Error;((null===(e=null==o?void 0:o.viewer)||void 0===e?void 0:e.emailVerified)||(null===(r=null===(i=null==o?void 0:o.viewer)||void 0===i?void 0:i.managedIdentity)||void 0===r?void 0:r.emailVerified))&&m(!0)}catch(e){console.error("Could not fetch user information:",e)}finally{h(!1)}})()}),[]),{showCode:i,onVerification:()=>{m(!0)},loading:u}}();if(e.loading)return i("sl-spinner",null);const t=this.getStepTextProps("general_");return i("div",null,i("h3",{style:{fontSize:"24px",margin:"0"}},t.verifyEmailHeader),i("p",{style:{color:"var(--sl-color-neutral-500)",fontSize:"var(--sl-font-size-medium)",margin:"0"}},t.verifyEmailDescription),e.showCode?i("sqm-code-verification",Object.assign({onVerification:e.onVerification},this.getStepTextProps("codeStep_"),h(e,"sqm-code-verification_"))):i("sqm-email-verification",Object.assign({},this.getStepTextProps("emailStep_"),h(e,"sqm-email-verification_"))))}};export{V as sqm_widget_verification}