import { r as registerInstance, h as h$1 } from './index-38ad4957.js';
import { n as h } from './dom-context-hooks.module-50442785.js';
import { i as isDemo, s as setUserIdentity } from './index.module-b23fdad8.js';
import './jsonpointer-388a7082.js';
import { c as cjs } from './cjs-bdfb4486.js';
import './JSS-67b5cff8.js';
import './mixins-f750863a.js';
import './useRegistrationFormState-2c090c38.js';
import { E as EmailRegistrationView } from './email-registration-view-4cdb4129.js';
import { u as useInstantAccessRegistration } from './useInstantAccessRegistration-69fefed0.js';

const InstantAccessRegistration = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.ignored = true;
    /**
     * @uiName Email field label
     */
    this.emailLabel = "Email";
    /**
     * @uiName First name field label
     */
    this.firstNameLabel = "First Name";
    /**
     * @uiName Last name field label
     */
    this.lastNameLabel = "Last Name";
    /**
     * @uiName Register button text
     */
    this.registerLabel = "Start Referring";
    /**
     * Require your participants to enter their first and last name.
     *
     * @uiName Include name fields
     */
    this.includeName = false;
    /**
     * @uiName Hide border
     * @uiGroup Card style
     */
    this.hideBorder = false;
    /**
     * Display this message when a required field has not been filled out.
     *
     * @uiName Required field message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.requiredFieldErrorMessage = "Cannot be empty";
    /**
     * Display this message when the given email is invalid.
     *
     * @uiName Invalid email message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.invalidEmailErrorMessage = "Please enter a valid email address";
    /**
     * Display this message when the form submission unexpectedly fails.
     *
     * @uiName Network error message
     * @uiWidget textArea
     * @uiGroup Error messages
     */
    this.networkErrorMessage = "There was a problem signing you in. Please wait a moment and try again. If this problem continues, contact Support for help resolving this issue.";
    /**
     * @uiName Top padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingTop = "large";
    /**
     * @uiName Right padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingRight = "large";
    /**
     * @uiName Bottom padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingBottom = "large";
    /**
     * @uiName Left padding
     * @uiGroup Card style
     * @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
     * @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
     */
    this.paddingLeft = "large";
    /**
     * @uiName Background color
     * @uiWidget color
     * @uiGroup Card style
     * @uiType string
     */
    this.backgroundColor = "var(--sqm-portal-background)";
    /**
     * @undocumented
     * @uiType boolean
     */
    this.includeCookies = false;
    h(this);
  }
  disconnectedCallback() { }
  render() {
    const { states, callbacks } = isDemo()
      ? useRegistrationDemo(this)
      : useInstantAccessRegistration(this);
    const content = {
      emailLabel: this.emailLabel,
      registerLabel: this.registerLabel,
      firstNameLabel: this.firstNameLabel,
      lastNameLabel: this.lastNameLabel,
      includeName: this.includeName,
      hideBorder: this.hideBorder,
      invalidEmailErrorMessage: this.invalidEmailErrorMessage,
      requiredFieldErrorMessage: this.requiredFieldErrorMessage,
      paddingTop: this.paddingTop,
      paddingBottom: this.paddingBottom,
      paddingLeft: this.paddingLeft,
      paddingRight: this.paddingRight,
      backgroundColor: this.backgroundColor,
      // slots
      topSlot: h$1("slot", { name: "top" }),
      bottomSlot: h$1("slot", { name: "bottom" }),
    };
    return (h$1(EmailRegistrationView, { states: states, callbacks: callbacks, content: content }));
  }
};
function useRegistrationDemo(props) {
  const submit = async (_event) => {
    setUserIdentity({
      id: "referrer@example.com",
      accountId: "referrer@example.com",
      jwt: "eyJraWQiOiJlNjI2NzQxNy1jMzZlLTRlM2EtYjM5NS1lYTFmY2YyNmU3YzIiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjbVZtWlhKeVpYSkFaWGhoYlhCc1pTNWpiMjA9OmNtVm1aWEp5WlhKQVpYaGhiWEJzWlM1amIyMD1AdGVzdF9heGJndGF0dzF0Y2NwOnVzZXJzIiwicGFzc3dvcmRsZXNzIjp0cnVlLCJpc3MiOiJodHRwczovL3N0YWdpbmcucmVmZXJyYWxzYWFzcXVhdGNoLmNvbS8iLCJleHAiOjE2ODA4ODU5MTksImlhdCI6MTY4MDc5OTUxOX0.kjmTVVf_BTb-uMNKnadLyNLxMFwpkefsY02O3iAfBVIJJZZfeZMwunPlKsS3Vbp28aYRClBjH5Wj4pYxDn23D0CdZx8KNCqiJ8yF6149O9SPMkRseoJkliqS6LyvMOEDjGDkuLfcC8_hq1AHBXFt5BdCtWOk1gwf_5R9A0w5gXEIvprBzbNDLbuo88bVAlrmFNvfttXXryrpUeruMal7cBKuy02YblBrB4kKoyJiprU5GLEjciBA4A56u8TwQc0kbsPf2YcQaJsY_IvkC7S1u4sPyObpq6iF6Ed8UYHAo6nU5KjZXyVtoUyeIS11mf_6OtDO6LyMNHV2FtEUUDdPCg",
    });
  };
  return cjs({
    states: {
      loading: false,
      error: "",
    },
    callbacks: {
      submit,
    },
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
}

export { InstantAccessRegistration as sqm_instant_access_registration };
