@clerk/elements 0.23.58 → 0.23.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OCDTPQFS.mjs → chunk-A5ZZN62M.mjs} +2 -2
- package/dist/{chunk-DKCDTPFJ.mjs → chunk-NQPTVXBS.mjs} +10 -1
- package/dist/chunk-NQPTVXBS.mjs.map +1 -0
- package/dist/react/common/index.js +6 -0
- package/dist/react/common/index.js.map +1 -1
- package/dist/react/common/index.mjs +1 -1
- package/dist/react/sign-in/index.js +3 -0
- package/dist/react/sign-in/index.js.map +1 -1
- package/dist/react/sign-in/index.mjs +2 -2
- package/dist/react/sign-up/index.mjs +2 -2
- package/package.json +4 -4
- package/dist/chunk-DKCDTPFJ.mjs.map +0 -1
- /package/dist/{chunk-OCDTPQFS.mjs.map → chunk-A5ZZN62M.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/react/common/index.ts","../../../src/react/common/form/field.tsx","../../../src/internals/machines/form/form.context.ts","../../../src/internals/machines/form/form.machine.ts","../../../src/internals/errors/index.ts","../../../src/internals/utils/inspector/index.ts","../../../src/react/common/form/hooks/use-field-feedback.ts","../../../src/react/common/form/hooks/use-field.ts","../../../src/react/common/form/hooks/use-field-context.ts","../../../src/react/common/form/types.ts","../../../src/react/common/form/hooks/use-field-state.ts","../../../src/react/common/form/hooks/use-global-errors.ts","../../../src/react/common/form/hooks/use-input.tsx","../../../src/react/hooks/use-password.hook.ts","../../../src/react/utils/generate-password-error-text.ts","../../../src/react/common/form/otp.tsx","../../../src/react/common/form/utils/enrich-field-state.ts","../../../src/react/common/form/utils/determine-input-type-from-name.ts","../../../src/react/common/form/hooks/use-previous.ts","../../../src/react/common/form/hooks/use-validity-state-context.ts","../../../src/react/common/form/field-error.tsx","../../../src/react/utils/is-react-fragment.ts","../../../src/react/common/form/field-state.tsx","../../../src/react/common/form/global-error.tsx","../../../src/react/common/form/input.tsx","../../../src/react/utils/create-context-from-actor-ref.ts","../../../src/react/sign-in/context/router.context.ts","../../../src/react/common/form/label.tsx","../../../src/react/common/form/submit.tsx","../../../src/react/common/connections.tsx","../../../src/react/hooks/use-third-party-provider.hook.ts","../../../src/utils/third-party-strategies.ts","../../../src/utils/clerk-js.ts","../../../src/react/sign-up/context/router.context.ts","../../../src/react/common/loading.tsx","../../../src/react/hooks/use-loading.hook.ts","../../../src/react/sign-in/step.tsx","../../../src/react/sign-up/step.tsx","../../../src/react/utils/map-scope-to-strategy.ts","../../../src/react/common/link.tsx"],"sourcesContent":["// Mark as a client-only package. This will error if you try to import it in a React Server Component.\nimport 'client-only';\n\nexport { Field, FieldError, FieldState, GlobalError, Input, Label, Submit } from '~/react/common/form';\nexport { Connection, Icon } from '~/react/common/connections';\nexport { Loading } from '~/react/common/loading';\nexport { Link } from '~/react/common/link';\n\nexport type {\n FormFieldErrorProps,\n FormErrorProps,\n FormErrorRenderProps,\n FormFieldProps,\n FormGlobalErrorProps,\n FormInputProps,\n FormProps,\n FormSubmitProps,\n} from '~/react/common/form';\nexport type { ConnectionProps, IconProps } from '~/react/common/connections';\nexport type { OTPInputSegmentStatus } from '~/react/common/form/otp';\n","import type { Autocomplete } from '@clerk/types';\nimport type { FormFieldProps as RadixFormFieldProps } from '@radix-ui/react-form';\nimport { Field as RadixField, ValidityState as RadixValidityState } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { useFormStore } from '~/internals/machines/form/form.context';\n\nimport { FieldContext, useField, useFieldState, ValidityStateContext } from './hooks';\nimport type { ClerkFieldId, FieldStates } from './types';\nimport { enrichFieldState } from './utils';\n\nconst DISPLAY_NAME = 'ClerkElementsField';\nconst DISPLAY_NAME_INNER = 'ClerkElementsFieldInner';\n\ntype FormFieldElement = React.ElementRef<typeof RadixField>;\nexport type FormFieldProps = Omit<RadixFormFieldProps, 'children'> & {\n name: Autocomplete<ClerkFieldId>;\n alwaysShow?: boolean;\n children: React.ReactNode | ((state: FieldStates) => React.ReactNode);\n};\n\n/**\n * Field is used to associate its child elements with a specific input. It automatically handles unique ID generation and associating the contained label and input elements.\n *\n * @param name - Give your `<Field>` a unique name inside the current form. If you choose one of the following names Clerk Elements will automatically set the correct type on the `<input />` element: `emailAddress`, `password`, `phoneNumber`, and `code`.\n * @param alwaysShow - Optional. When `true`, the field will always be renydered, regardless of its state. By default, a field is hidden if it's optional or if it's a filled-out required field.\n * @param {Function} children - A function that receives `state` as an argument. `state` is a union of `\"success\" | \"error\" | \"idle\" | \"warning\" | \"info\"`.\n *\n * @example\n * <Clerk.Field name=\"emailAddress\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input />\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"emailAddress\">\n * {(fieldState) => (\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input className={`text-${fieldState}`} />\n * )}\n * </Clerk.Field>\n */\nexport const Field = React.forwardRef<FormFieldElement, FormFieldProps>(({ alwaysShow, ...rest }, forwardedRef) => {\n const formRef = useFormStore();\n const formCtx = formRef.getSnapshot().context;\n // A field is marked as hidden if it's optional OR if it's a filled-out required field\n const isHiddenField = formCtx.progressive && Boolean(formCtx.hidden?.has(rest.name));\n\n // Only alwaysShow={true} should force behavior to render the field, on `undefined` or alwaysShow={false} the isHiddenField logic should take over\n const shouldHide = alwaysShow ? false : isHiddenField;\n\n return shouldHide ? null : (\n <FieldContext.Provider value={{ name: rest.name }}>\n <FieldInner\n {...rest}\n ref={forwardedRef}\n />\n </FieldContext.Provider>\n );\n});\n\nField.displayName = DISPLAY_NAME;\n\nconst FieldInner = React.forwardRef<FormFieldElement, FormFieldProps>((props, forwardedRef) => {\n const { children, ...rest } = props;\n const field = useField({ name: rest.name });\n const { state: fieldState } = useFieldState({ name: rest.name });\n\n return (\n <RadixField\n {...field.props}\n {...rest}\n ref={forwardedRef}\n >\n <RadixValidityState>\n {validity => {\n const enrichedFieldState = enrichFieldState(validity, fieldState);\n\n return (\n <ValidityStateContext.Provider value={validity}>\n {typeof children === 'function' ? children(enrichedFieldState) : children}\n </ValidityStateContext.Provider>\n );\n }}\n </RadixValidityState>\n </RadixField>\n );\n});\n\nFieldInner.displayName = DISPLAY_NAME_INNER;\n","import { createActorContext } from '@xstate/react';\nimport type { SnapshotFrom } from 'xstate';\n\nimport { FormMachine } from '~/internals/machines/form';\nimport { inspect } from '~/internals/utils/inspector';\n\nexport type SnapshotState = SnapshotFrom<typeof FormMachine>;\n\nconst FormMachineContext = createActorContext(FormMachine, { inspect });\n\nexport const FormStoreProvider = FormMachineContext.Provider;\nexport const useFormStore = FormMachineContext.useActorRef;\nexport const useFormSelector = FormMachineContext.useSelector;\n\n/**\n * Selects a global error, if it exists\n */\nexport const globalErrorsSelector = (state: SnapshotState) => state.context.errors;\n\n/**\n * Selects if a specific field has a value\n */\nexport const fieldValueSelector = (name: string | undefined) => (state: SnapshotState) =>\n name ? state.context.fields.get(name)?.value : '';\n\n/**\n * Selects if a specific field has a value\n */\nexport const fieldHasValueSelector = (name: string | undefined) => (state: SnapshotState) =>\n Boolean(fieldValueSelector(name)(state));\n\ntype MapValue<A> = A extends Map<any, infer V> ? V : never;\n\n/**\n * Selects field-specific feedback, if they exist\n *\n * We declare an explicit return type here because TypeScript's inference results in the subtype reduction of the\n * union used for feedback. Explicitly declaring the return type allows for all members of the union to be\n * included in the return type.\n */\nexport const fieldFeedbackSelector =\n (name: string | undefined) =>\n (state: SnapshotState): MapValue<SnapshotState['context']['fields']>['feedback'] | undefined =>\n name ? state.context.fields.get(name)?.feedback : undefined;\n","import { isClerkAPIResponseError, isKnownError, isMetamaskError } from '@clerk/shared/error';\nimport { snakeToCamel } from '@clerk/shared/underscore';\nimport type { ClerkAPIError } from '@clerk/types';\nimport type { MachineContext } from 'xstate';\nimport { assign, enqueueActions, setup } from 'xstate';\n\nimport { ClerkElementsError, ClerkElementsFieldError } from '~/internals/errors';\n\nimport type { FieldDetails, FormDefaultValues, FormFields } from './form.types';\n\nexport interface FormMachineContext extends MachineContext {\n defaultValues: FormDefaultValues;\n errors: ClerkElementsError[];\n fields: FormFields;\n hidden?: Set<string>;\n missing?: Set<string>;\n optional?: Set<string>;\n progressive: boolean;\n required?: Set<string>;\n}\n\nexport type FormMachineEvents =\n | { type: 'FIELD.ADD'; field: Pick<FieldDetails, 'name' | 'type' | 'value' | 'checked' | 'disabled'> }\n | { type: 'FIELD.REMOVE'; field: Pick<FieldDetails, 'name'> }\n | { type: 'FIELD.ENABLE'; field: Pick<FieldDetails, 'name'> }\n | { type: 'FIELD.DISABLE'; field: Pick<FieldDetails, 'name'> }\n | {\n type: 'MARK_AS_PROGRESSIVE';\n defaultValues: FormDefaultValues;\n missing: string[];\n optional: string[];\n required: string[];\n }\n | {\n type: 'PREFILL_DEFAULT_VALUES';\n defaultValues: FormDefaultValues;\n }\n | { type: 'UNMARK_AS_PROGRESSIVE' }\n | {\n type: 'FIELD.UPDATE';\n field: Pick<FieldDetails, 'name' | 'value' | 'checked' | 'disabled'>;\n }\n | { type: 'ERRORS.SET'; error: any }\n | { type: 'ERRORS.CLEAR' }\n | {\n type: 'FIELD.FEEDBACK.SET';\n field: Pick<FieldDetails, 'name' | 'feedback'>;\n }\n | {\n type: 'FIELD.FEEDBACK.CLEAR';\n field: Pick<FieldDetails, 'name'>;\n }\n | { type: 'FIELD.FEEDBACK.CLEAR.ALL' };\n\ntype FormMachineTypes = {\n events: FormMachineEvents;\n context: FormMachineContext;\n};\n\nexport type TFormMachine = typeof FormMachine;\n\n/**\n * A machine for managing form state.\n * This machine is used alongside our other, flow-specific machines and a reference to a spawned FormMachine actor is used in the flows to interact with the form state.\n */\nexport const FormMachine = setup({\n actions: {\n setGlobalErrors: assign({\n errors: (_, params: { errors: ClerkElementsError[] }) => [...params.errors],\n }),\n setFieldFeedback: assign({\n fields: ({ context }, params: Pick<FieldDetails, 'name' | 'feedback'>) => {\n if (!params.name) {\n throw new Error('Field name is required');\n }\n\n const fieldName = params.name;\n if (context.fields.has(fieldName)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n context.fields.get(fieldName)!.feedback = params.feedback;\n }\n\n return context.fields;\n },\n }),\n },\n types: {} as FormMachineTypes,\n}).createMachine({\n id: 'Form',\n context: () => ({\n defaultValues: new Map(),\n errors: [],\n fields: new Map(),\n progressive: false,\n }),\n on: {\n 'ERRORS.SET': {\n actions: enqueueActions(({ enqueue, event }) => {\n const isClerkAPIError = (err: any): err is ClerkAPIError => 'meta' in err;\n\n if (isKnownError(event.error)) {\n const fields: Record<string, ClerkElementsFieldError[]> = {};\n const globalErrors: ClerkElementsError[] = [];\n const errors = isClerkAPIResponseError(event.error) ? event.error?.errors : [event.error];\n\n for (const error of errors) {\n const name = isClerkAPIError(error) ? snakeToCamel(error.meta?.paramName) : null;\n\n if (!name || isMetamaskError(error)) {\n globalErrors.push(ClerkElementsError.fromAPIError(error));\n continue;\n }\n\n if (!fields[name]) {\n fields[name] = [];\n }\n\n fields[name]?.push(ClerkElementsFieldError.fromAPIError(error));\n }\n\n enqueue({\n type: 'setGlobalErrors',\n params: {\n errors: globalErrors,\n },\n });\n\n for (const field in fields) {\n enqueue({\n type: 'setFieldFeedback',\n params: {\n name: field,\n feedback: {\n type: 'error',\n message: fields[field][0],\n },\n },\n });\n }\n }\n }),\n },\n 'ERRORS.CLEAR': {\n actions: assign({\n errors: () => [],\n }),\n },\n 'FIELD.ADD': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n event.field.value = event.field.value || context.defaultValues.get(event.field.name) || undefined;\n\n context.fields.set(event.field.name, event.field);\n return context.fields;\n },\n }),\n },\n 'FIELD.UPDATE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.checked = event.field.checked;\n field.disabled = event.field.disabled ?? field.disabled;\n field.value = event.field.value;\n\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.DISABLE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.disabled = true;\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.ENABLE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.disabled = false;\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.REMOVE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n context.fields.delete(event.field.name);\n return context.fields;\n },\n }),\n },\n 'FIELD.FEEDBACK.SET': {\n actions: [\n {\n type: 'setFieldFeedback',\n params: ({ event }) => event.field,\n },\n ],\n },\n 'FIELD.FEEDBACK.CLEAR': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n if (context.fields.has(event.field.name)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n context.fields.get(event.field.name)!.feedback = undefined;\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.FEEDBACK.CLEAR.ALL': {\n actions: assign({\n fields: ({ context }) => {\n context.fields.forEach(field => {\n field.feedback = undefined;\n });\n\n return context.fields;\n },\n }),\n },\n MARK_AS_PROGRESSIVE: {\n actions: assign(({ event }) => {\n const missing = new Set(event.missing);\n\n return {\n defaultValues: event.defaultValues,\n hidden: new Set([...event.required.filter(f => !missing.has(f)), ...event.optional]),\n missing,\n optional: new Set(event.optional),\n progressive: true,\n required: new Set(event.required),\n };\n }),\n },\n UNMARK_AS_PROGRESSIVE: {\n actions: assign({\n defaultValues: new Map(),\n hidden: undefined,\n missing: undefined,\n optional: undefined,\n progressive: false,\n required: undefined,\n }),\n },\n PREFILL_DEFAULT_VALUES: {\n actions: assign(({ event }) => {\n return {\n defaultValues: event.defaultValues,\n };\n }),\n },\n },\n});\n","// eslint-disable-next-line no-restricted-imports\nimport type { MetamaskError } from '@clerk/shared';\nimport type { ClerkAPIError } from '@clerk/types';\n\nexport abstract class ClerkElementsErrorBase extends Error {\n clerkError = true;\n clerkElementsError = true;\n rawMessage: string;\n\n constructor(\n readonly code: string,\n message: string,\n ) {\n super(message);\n\n this.name = 'ClerkElementsError';\n this.rawMessage = message;\n }\n\n toString() {\n return `[${this.name}]\\nCode: ${this.code}\\nMessage: ${this.message}`;\n }\n}\n\nexport class ClerkElementsError extends ClerkElementsErrorBase {\n static fromAPIError(error: ClerkAPIError | MetamaskError) {\n return new ClerkElementsError(\n error.code.toString(),\n // @ts-expect-error - Expected that longMessage isn't a property of MetamaskError\n error.longMessage || error.message,\n );\n }\n\n constructor(code: string, message: string) {\n super(code, message);\n this.name = 'ClerkElementsError';\n }\n}\n\nexport class ClerkElementsRuntimeError extends ClerkElementsErrorBase {\n constructor(message: string) {\n super('elements_runtime_error', message);\n this.name = 'ClerkElementsRuntimeError';\n }\n}\n\nexport class ClerkElementsFieldError extends ClerkElementsErrorBase {\n static fromAPIError(error: ClerkAPIError) {\n return new ClerkElementsFieldError(error.code, error.longMessage || error.message);\n }\n\n constructor(code: string, message: string) {\n super(code, message);\n this.name = 'ClerkElementsFieldError';\n }\n\n get validityState() {\n return this.code;\n }\n\n get forceMatch() {\n return true;\n }\n\n matchFn = () => true;\n}\n","import type { InspectionEvent, Observer } from 'xstate';\n\nimport { getInspector as getBrowserInspector } from './browser';\nimport { getInspector as getConsoleInspector } from './console';\n\nexport let inspect: Observer<InspectionEvent> | undefined;\n\nif (__DEV__) {\n inspect = getBrowserInspector() ?? getConsoleInspector();\n}\n\nconst inspector = {\n inspect,\n};\n\nexport default inspector;\n","import { type FieldDetails, fieldFeedbackSelector, useFormSelector } from '~/internals/machines/form';\n\nexport function useFieldFeedback({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const feedback = useFormSelector(fieldFeedbackSelector(name));\n\n return {\n feedback,\n };\n}\n","import { type FieldDetails, fieldHasValueSelector, useFormSelector } from '~/internals/machines/form';\n\nimport { useFieldFeedback } from './use-field-feedback';\n\nexport function useField({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const hasValue = useFormSelector(fieldHasValueSelector(name));\n const { feedback } = useFieldFeedback({ name });\n\n const shouldBeHidden = false; // TODO: Implement clerk-js utils\n const hasError = feedback ? feedback.type === 'error' : false;\n\n return {\n hasValue,\n props: {\n 'data-hidden': shouldBeHidden ? true : undefined,\n serverInvalid: hasError,\n },\n };\n}\n","import * as React from 'react';\n\nimport type { FieldDetails } from '~/internals/machines/form';\n\nexport const FieldContext = React.createContext<Pick<FieldDetails, 'name'> | null>(null);\nexport const useFieldContext = () => React.useContext(FieldContext);\n","import type { HTMLInputTypeAttribute } from 'react';\n\nimport type { ClerkElementsError } from '~/internals/errors';\n\n/** Extracted relevant fields from @clerk/types */\nexport type ClerkFieldId =\n | 'code'\n | 'confirmPassword'\n | 'currentPassword'\n | 'backup_code' // special case of `code`\n | 'emailAddress'\n | 'firstName'\n | 'identifier'\n | 'lastName'\n | 'name'\n | 'newPassword'\n | 'password'\n | 'phoneNumber'\n | 'username'\n | 'legalAccepted';\n\n/**\n * Possible types for the Clerk input element, several 'special' input types are included.\n */\nexport type ClerkInputType = HTMLInputTypeAttribute | 'otp';\n\nexport const FIELD_STATES = {\n success: 'success',\n error: 'error',\n idle: 'idle',\n warning: 'warning',\n info: 'info',\n} as const;\n\nexport type FieldStates = (typeof FIELD_STATES)[keyof typeof FIELD_STATES];\n\nexport const FIELD_VALIDITY = {\n valid: 'valid',\n invalid: 'invalid',\n} as const;\n\nexport type FieldValidity = (typeof FIELD_VALIDITY)[keyof typeof FIELD_VALIDITY];\n\nexport type FormErrorRenderProps = Pick<ClerkElementsError, 'code' | 'message'>;\n\ntype FormErrorPropsAsChild = {\n asChild?: true | never;\n children?: React.ReactElement | ((error: FormErrorRenderProps) => React.ReactNode);\n code?: string;\n};\n\ntype FormErrorPropsStd = {\n asChild?: false;\n children: React.ReactNode;\n code: string;\n};\n\nexport type FormErrorProps<T> = Omit<T, 'asChild' | 'children'> & (FormErrorPropsStd | FormErrorPropsAsChild);\n","import { type FieldDetails, fieldHasValueSelector, useFormSelector } from '~/internals/machines/form';\n\nimport { FIELD_STATES, type FieldStates } from '../types';\nimport { useFieldFeedback } from './use-field-feedback';\n\n/**\n * Given a field name, determine the current state of the field\n */\nexport function useFieldState({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const { feedback } = useFieldFeedback({ name });\n const hasValue = useFormSelector(fieldHasValueSelector(name));\n\n /**\n * If hasValue is false, the state should be idle\n * The rest depends on the feedback type\n */\n let state: FieldStates = FIELD_STATES.idle;\n\n if (!hasValue) {\n state = FIELD_STATES.idle;\n }\n\n switch (feedback?.type) {\n case 'error':\n state = FIELD_STATES.error;\n break;\n case 'warning':\n state = FIELD_STATES.warning;\n break;\n case 'info':\n state = FIELD_STATES.info;\n break;\n case 'success':\n state = FIELD_STATES.success;\n break;\n default:\n break;\n }\n\n return {\n state,\n };\n}\n","import { globalErrorsSelector, useFormSelector } from '~/internals/machines/form';\n\nexport function useGlobalErrors() {\n const errors = useFormSelector(globalErrorsSelector);\n\n return {\n errors,\n };\n}\n","import { Control as RadixControl, type FormControlProps } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { ClerkElementsFieldError } from '~/internals/errors';\nimport { fieldValueSelector, useFormSelector, useFormStore } from '~/internals/machines/form';\nimport { usePassword } from '~/react/hooks/use-password.hook';\n\nimport type { FormInputProps } from '../index';\nimport { OTP_LENGTH_DEFAULT, OTPInput, type OTPInputProps } from '../otp';\nimport { determineInputTypeFromName, enrichFieldState } from '../utils';\nimport { useFieldContext } from './use-field-context';\nimport { useFieldState } from './use-field-state';\nimport { usePrevious } from './use-previous';\nimport { useValidityStateContext } from './use-validity-state-context';\n\n// TODO: DRY\ntype PasswordInputProps = Exclude<FormControlProps, 'type'> & {\n validatePassword?: boolean;\n};\n\nexport function useInput({\n name: inputName,\n value: providedValue,\n checked: providedChecked,\n onChange: onChangeProp,\n onBlur: onBlurProp,\n onFocus: onFocusProp,\n type: inputType,\n ...passthroughProps\n}: FormInputProps) {\n // Inputs can be used outside a <Field> wrapper if desired, so safely destructure here\n const fieldContext = useFieldContext();\n const rawName = inputName || fieldContext?.name;\n const name = rawName === 'backup_code' ? 'code' : rawName; // `backup_code` is a special case of `code`\n const { state: fieldState } = useFieldState({ name });\n const validity = useValidityStateContext();\n\n if (!rawName || !name) {\n throw new Error('Clerk: <Input /> must be wrapped in a <Field> component or have a name prop.');\n }\n\n const ref = useFormStore();\n const [hasPassedValiation, setHasPassedValidation] = React.useState(false);\n\n const { validatePassword } = usePassword({\n onValidationComplexity: hasPassed => setHasPassedValidation(hasPassed),\n onValidationSuccess: () => {\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: { name, feedback: { type: 'success', message: 'Your password meets all the necessary requirements.' } },\n });\n },\n onValidationError: (error, codes) => {\n if (error) {\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: {\n name,\n feedback: {\n type: 'error',\n message: new ClerkElementsFieldError('password-validation-error', error),\n codes,\n },\n },\n });\n }\n },\n onValidationWarning: (warning, codes) =>\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: { name, feedback: { type: 'warning', message: warning, codes } },\n }),\n onValidationInfo: (info, codes) => {\n // TODO: If input is not focused, make this info an error\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: {\n name,\n feedback: {\n type: 'info',\n message: info,\n codes,\n },\n },\n });\n },\n });\n\n const value = useFormSelector(fieldValueSelector(name));\n const prevValue = usePrevious(value);\n const hasValue = Boolean(value);\n const type = inputType ?? determineInputTypeFromName(rawName);\n let nativeFieldType = type;\n let shouldValidatePassword = false;\n\n if (type === 'password' || type === 'text') {\n shouldValidatePassword = Boolean((passthroughProps as PasswordInputProps).validatePassword);\n }\n\n if (nativeFieldType === 'otp' || nativeFieldType === 'backup_code') {\n nativeFieldType = 'text';\n }\n\n // Register the field in the machine context\n React.useEffect(() => {\n if (!name) {\n return;\n }\n\n ref.send({\n type: 'FIELD.ADD',\n field: { name, type: nativeFieldType, value: providedValue, checked: providedChecked },\n });\n\n return () => ref.send({ type: 'FIELD.REMOVE', field: { name } });\n }, [ref]); // eslint-disable-line react-hooks/exhaustive-deps\n\n React.useEffect(() => {\n if (!name) {\n return;\n }\n\n if (\n (type === 'checkbox' && providedChecked !== undefined) ||\n (type !== 'checkbox' && providedValue !== undefined)\n ) {\n ref.send({\n type: 'FIELD.UPDATE',\n field: { name, value: providedValue, checked: providedChecked },\n });\n }\n }, [name, type, ref, providedValue, providedChecked]);\n\n // Register the onChange handler for field updates to persist to the machine context\n const onChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n onChangeProp?.(event);\n if (!name) {\n return;\n }\n ref.send({ type: 'FIELD.UPDATE', field: { name, value: event.target.value, checked: event.target.checked } });\n if (shouldValidatePassword) {\n validatePassword(event.target.value);\n }\n },\n [ref, name, onChangeProp, shouldValidatePassword, validatePassword],\n );\n\n const onBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onBlurProp?.(event);\n if (shouldValidatePassword && event.target.value !== prevValue) {\n validatePassword(event.target.value);\n }\n },\n [onBlurProp, shouldValidatePassword, validatePassword, prevValue],\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onFocusProp?.(event);\n if (shouldValidatePassword && event.target.value !== prevValue) {\n validatePassword(event.target.value);\n }\n },\n [onFocusProp, shouldValidatePassword, validatePassword, prevValue],\n );\n\n // TODO: Implement clerk-js utils\n const shouldBeHidden = false;\n\n const Element = type === 'otp' ? OTPInput : RadixControl;\n\n let props = {};\n if (type === 'otp') {\n const p = passthroughProps as Omit<OTPInputProps, 'name' | 'value' | 'type'>;\n const length = p.length || OTP_LENGTH_DEFAULT;\n\n props = {\n 'data-otp-input': true,\n autoComplete: 'one-time-code',\n inputMode: 'numeric',\n pattern: `[0-9]{${length}}`,\n minLength: length,\n maxLength: length,\n // Enhanced naming for better password manager detection\n name: 'otp',\n id: 'otp-input',\n // Additional attributes for password manager compatibility\n 'data-testid': 'otp-input',\n role: 'textbox',\n 'aria-label': 'Enter verification code',\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n // Only accept numbers\n event.currentTarget.value = event.currentTarget.value.replace(/\\D+/g, '');\n onChange(event);\n },\n type: 'text',\n spellCheck: false,\n };\n } else if (type === 'backup_code') {\n props = {\n autoComplete: 'off',\n type: 'text',\n spellCheck: false,\n };\n } else if (type === 'password' && shouldValidatePassword) {\n props = {\n 'data-has-passed-validation': hasPassedValiation ? true : undefined,\n };\n }\n\n // Filter out invalid props that should not be passed through\n // @ts-expect-error - Doesn't know about type narrowing by type here\n const { validatePassword: _1, ...rest } = passthroughProps;\n\n return {\n Element,\n props: {\n type,\n value: value ?? '',\n onChange,\n onBlur,\n onFocus,\n 'data-hidden': shouldBeHidden ? true : undefined,\n 'data-has-value': hasValue ? true : undefined,\n 'data-state': enrichFieldState(validity, fieldState),\n ...props,\n ...rest,\n },\n };\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { noop } from '@clerk/shared/utils';\nimport type { PasswordSettingsData, PasswordValidation } from '@clerk/types';\nimport * as React from 'react';\n\nimport type { ErrorCodeOrTuple } from '../utils/generate-password-error-text';\nimport { generatePasswordErrorText } from '../utils/generate-password-error-text';\n\n// This hook should mimic the already existing usePassword hook in the clerk-js package\n// @see packages/clerk-js/src/ui/hooks/usePassword.ts\n\nexport type PasswordConfig = Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>;\n\ntype UsePasswordCallbacks = {\n onValidationError?: (error: string | undefined, codes: ErrorCodeOrTuple[]) => void;\n onValidationSuccess?: () => void;\n onValidationWarning?: (warning: string, codes: ErrorCodeOrTuple[]) => void;\n onValidationInfo?: (info: string, codes: ErrorCodeOrTuple[]) => void;\n onValidationComplexity?: (b: boolean) => void;\n};\n\nexport const usePassword = (callbacks?: UsePasswordCallbacks) => {\n const clerk = useClerk();\n const passwordSettings = clerk.__unstable__environment?.userSettings.passwordSettings as PasswordSettingsData;\n const { disable_hibp, min_zxcvbn_strength, show_zxcvbn, ...config } = passwordSettings || {};\n\n const {\n onValidationError = noop,\n onValidationSuccess = noop,\n onValidationWarning = noop,\n onValidationInfo = noop,\n onValidationComplexity,\n } = callbacks || {};\n\n const onValidate = React.useCallback(\n (res: PasswordValidation) => {\n /**\n * Failed complexity rules always have priority\n */\n if (res.complexity) {\n if (Object.values(res?.complexity).length > 0) {\n const { message, codes } = generatePasswordErrorText({\n config,\n failedValidations: res.complexity,\n });\n\n if (res.complexity?.min_length) {\n return onValidationInfo(message, codes);\n }\n return onValidationError(message, codes);\n }\n }\n\n /**\n * Failed strength\n */\n if (res?.strength?.state === 'fail') {\n const keys = res.strength.keys;\n const error = JSON.stringify(keys);\n return onValidationError(error, keys);\n }\n\n /**\n * Password meets all criteria but could be stronger\n */\n if (res?.strength?.state === 'pass') {\n const keys = res.strength.keys;\n const error = JSON.stringify(keys);\n return onValidationWarning(error, keys);\n }\n\n /**\n * Password meets all criteria and is strong\n */\n return onValidationSuccess();\n },\n [callbacks, config],\n );\n\n const validatePassword = React.useMemo(() => {\n return (password: string) => {\n return clerk.client.signUp.validatePassword(password, {\n onValidation: onValidate,\n onValidationComplexity,\n });\n };\n }, [onValidate]);\n\n return {\n validatePassword,\n };\n};\n","import type { Autocomplete, PasswordSettingsData } from '@clerk/types';\n\n// Copied from packages/clerk-js/src/ui/hooks/usePasswordComplexity.ts\n\ntype ComplexityErrors = {\n [key in keyof Partial<Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>>]?: boolean;\n};\n\nexport type ComplexityConfig = Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>;\n\nconst errorMessages: Record<keyof Omit<ComplexityErrors, 'allowed_special_characters'>, [string, string] | string> = {\n max_length: ['less than %length% characters', 'length'],\n min_length: ['%length% or more characters', 'length'],\n require_numbers: 'a number',\n require_lowercase: 'a lowercase letter',\n require_uppercase: 'an uppercase letter',\n require_special_char: 'a special character',\n};\n\nexport type ErrorMessagesKey = Autocomplete<keyof typeof errorMessages>;\nexport type ErrorCodeOrTuple = ErrorMessagesKey | [ErrorMessagesKey, Record<string, string | number>];\n\nconst createListFormat = (message: string[]) => {\n let messageWithPrefix: string;\n if ('ListFormat' in Intl) {\n const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });\n messageWithPrefix = formatter.format(message);\n } else {\n messageWithPrefix = message.join(', ');\n }\n\n return messageWithPrefix;\n};\n\ntype GeneratePasswordErrorTextProps = {\n config: ComplexityConfig;\n failedValidations: ComplexityErrors | undefined;\n};\n\n/**\n * This function builds a single entry in the error array returned from generatePasswordErrorText. It returns either a\n * string or a tuple containing the error code and relevant entries from the instance's password complexity conrfig.\n * @param key The string respresentation of a possible error during password validation\n * @param config The instance's password complexity configuration\n * @returns The error code or a tuple containing the error code and relevant entries from the config\n */\nfunction buildErrorTuple(key: ErrorMessagesKey, config: ComplexityConfig): ErrorCodeOrTuple {\n switch (key) {\n case 'max_length':\n return [key, { max_length: config.max_length }];\n case 'min_length':\n return [key, { min_length: config.min_length }];\n case 'require_special_char':\n return [key, { allowed_special_characters: config.allowed_special_characters }];\n default:\n return key;\n }\n}\n\nexport const generatePasswordErrorText = ({ config, failedValidations }: GeneratePasswordErrorTextProps) => {\n const codes: ErrorCodeOrTuple[] = [];\n\n if (!failedValidations || Object.keys(failedValidations).length === 0) {\n return {\n codes,\n message: '',\n };\n }\n\n // show min length error first by itself\n const hasMinLengthError = failedValidations?.min_length || false;\n\n const messages = Object.entries(failedValidations)\n .filter(k => (hasMinLengthError ? k[0] === 'min_length' : true))\n .filter(([, v]) => !!v)\n .map(([k]) => {\n const entry = k as keyof typeof errorMessages;\n const errorTuple = buildErrorTuple(entry, config);\n codes.push(errorTuple);\n const errorKey = errorMessages[entry];\n\n if (Array.isArray(errorKey)) {\n const [msg, replaceValue] = errorKey;\n return msg.replace(`%${replaceValue}%`, config[k as keyof ComplexityConfig] as string);\n }\n return errorKey;\n });\n\n const messageWithPrefix = createListFormat(messages);\n\n return {\n codes,\n message: `Your password must contain ${messageWithPrefix}.`,\n };\n};\n","import { Control as RadixControl } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport type { FormControlProps } from '~/react/common/form';\n\nexport type OTPInputProps = Exclude<\n FormControlProps,\n 'type' | 'autoComplete' | 'minLength' | 'maxLength' | 'inputMode' | 'pattern' | 'spellCheck'\n> & {\n render?: (props: { value: string; status: OTPInputSegmentStatus; index: number }) => React.ReactNode;\n length?: number;\n autoSubmit?: boolean;\n passwordManagerOffset?: number;\n};\n\ntype SelectionRange = readonly [start: number | null, end: number | null];\nconst ZERO: SelectionRange = [0, 0];\nconst OUTSIDE: SelectionRange = [-1, -1];\n\nexport const OTP_LENGTH_DEFAULT = 6;\nconst PASSWORD_MANAGER_OFFSET_DEFAULT = 40;\n\n/**\n * The status of a single segment element in the OTP input\n */\nexport type OTPInputSegmentStatus = 'none' | 'cursor' | 'selected' | 'hovered';\n\n/**\n * If the render prop is provided, a custom segmented input will be rendered. Otherwise a standard input will be rendered.\n */\nexport const OTPInput = React.forwardRef<HTMLInputElement, OTPInputProps>(function OTPInput(props, ref) {\n const { render, length, autoSubmit, ...rest } = props;\n const hasRenderProp = typeof render !== 'undefined';\n\n if (hasRenderProp) {\n return (\n <OTPInputSegmented\n {...rest}\n ref={ref}\n render={render}\n length={length}\n autoSubmit={autoSubmit}\n />\n );\n }\n\n return (\n <OTPInputStandard\n {...rest}\n ref={ref}\n length={length}\n autoSubmit={autoSubmit}\n />\n );\n});\n\n/**\n * Standard `<input />` element that receives the same props as the OTPInput component except for the render prop.\n */\nconst OTPInputStandard = React.forwardRef<HTMLInputElement, Omit<OTPInputProps, 'render'>>(\n function OTPInput(props, ref) {\n const { length = OTP_LENGTH_DEFAULT, autoSubmit = false, ...rest } = props;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n // This ensures we can access innerRef internally while still exposing it via the ref prop\n React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement, []);\n\n // Fire the requestSubmit callback when the input has the required length and autoSubmit is enabled\n React.useEffect(() => {\n if (String(props.value).length === length && autoSubmit) {\n innerRef.current?.form?.requestSubmit();\n }\n }, [props.value, length, autoSubmit]);\n\n return (\n <RadixControl\n ref={innerRef}\n {...rest}\n data-otp-input-standard\n />\n );\n },\n);\n\n/**\n * A custom input component to handle accepting OTP codes. An invisible input element is used to capture input and handle native input\n * interactions, while the provided render prop is used to visually render the input's contents.\n */\nconst OTPInputSegmented = React.forwardRef<HTMLInputElement, Required<Pick<OTPInputProps, 'render'>> & OTPInputProps>(\n function OTPInput(props, ref) {\n const {\n className: userProvidedClassName,\n render,\n length = OTP_LENGTH_DEFAULT,\n autoSubmit = false,\n passwordManagerOffset = PASSWORD_MANAGER_OFFSET_DEFAULT,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n const [selectionRange, setSelectionRange] = React.useState<SelectionRange>(props.autoFocus ? ZERO : OUTSIDE);\n const [isHovering, setIsHovering] = React.useState(false);\n\n const isFocused = () => document.activeElement === innerRef.current;\n\n // This ensures we can access innerRef internally while still exposing it via the ref prop\n React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement, []);\n\n /**\n * A layout effect is used here to avoid any perceived visual lag when changing the selection\n * This effect ensures that when deleting characters from the input the selection is updated\n */\n React.useLayoutEffect(() => {\n if (document.activeElement !== innerRef.current) {\n return;\n }\n setSelectionRange(cur => selectionRangeUpdater(cur, innerRef));\n }, [props.value]);\n\n /**\n * Attach a selectionchange handler on the document during the capture phase to the selection range is updated\n * immediately.\n *\n * One concrete example, if using onSelect on the input, the handler wouldn't fire when pressing cmd + left/right arrow.\n */\n React.useEffect(() => {\n function onSelectionChange() {\n if (!isFocused()) {\n return;\n }\n setSelectionRange(cur => selectionRangeUpdater(cur, innerRef));\n }\n\n document.addEventListener('selectionchange', onSelectionChange, { capture: true });\n return () => document.removeEventListener('selectionchange', onSelectionChange);\n }, []);\n\n // Fire the requestSubmit callback when the input has the required length and autoSubmit is enabled\n React.useEffect(() => {\n if (String(props.value).length === length && autoSubmit) {\n innerRef.current?.form?.requestSubmit();\n }\n }, [props.value, length, autoSubmit]);\n\n return (\n <div\n data-otp-input-wrapper\n style={wrapperStyle}\n >\n {/* We can't target pseudo-elements with the style prop, so we inject a tag here */}\n <style>{`\n input[data-otp-input-segmented]::selection {\n color: transparent;\n background-color: transparent;\n }\n `}</style>\n <RadixControl\n data-otp-input-segmented\n ref={innerRef}\n {...rest}\n onFocus={event => {\n // Place the caret at the end of the current value\n if (innerRef.current) {\n const start = Math.min(innerRef.current.value.length, length - 1);\n const end = innerRef.current.value.length;\n innerRef.current.setSelectionRange(start, end);\n setSelectionRange([start, end]);\n }\n rest?.onFocus?.(event);\n }}\n onBlur={event => {\n setSelectionRange([-1, -1]);\n rest?.onBlur?.(event);\n }}\n onMouseOver={event => {\n if (!isFocused()) {\n setIsHovering(true);\n }\n props.onMouseOver?.(event);\n }}\n onMouseLeave={event => {\n setIsHovering(false);\n props.onMouseLeave?.(event);\n }}\n style={{\n ...inputStyle,\n clipPath: `inset(0 calc(1ch + ${passwordManagerOffset}px) 0 0)`,\n width: `calc(100% + 1ch + ${passwordManagerOffset}px)`,\n }}\n />\n <div\n className={userProvidedClassName}\n aria-hidden\n style={segmentWrapperStyle}\n >\n {Array.from({ length }).map((_, i) => {\n const isHovered = isHovering && !isFocused();\n const isCursor = selectionRange[0] === selectionRange[1] && selectionRange[0] === i;\n const isSelected = (selectionRange[0] ?? -1) <= i && (selectionRange[1] ?? -1) > i;\n\n return (\n <React.Fragment key={`otp-segment-${i}`}>\n {render({\n value: String(props.value)[i] || '',\n status: isHovered ? 'hovered' : isCursor ? 'cursor' : isSelected ? 'selected' : 'none',\n index: i,\n })}\n </React.Fragment>\n );\n })}\n </div>\n </div>\n );\n },\n);\n\n/**\n * Handle updating the input selection range to ensure a single character is selected when moving the cursor, or if the input value changes.\n */\nfunction selectionRangeUpdater(cur: SelectionRange, inputRef: React.RefObject<HTMLInputElement>) {\n let updated: [number, number, HTMLInputElement['selectionDirection']] = [\n inputRef.current?.selectionStart ?? 0,\n inputRef.current?.selectionEnd ?? 0,\n inputRef.current?.selectionDirection ?? null,\n ];\n\n // Abort unnecessary updates\n if (cur[0] === updated[0] && cur[1] === updated[1]) {\n return cur;\n }\n\n // ensures that forward selection works properly when landing on the first character\n if (updated[0] === 0 && updated[1] === 1) {\n updated[2] = 'forward';\n }\n\n // When moving the selection, we want to select either the previous or next character instead of only moving the cursor.\n // If the start and end indices are the same, it means only the cursor has moved and we need to make a decision on which character to select.\n if (updated[0] === updated[1]) {\n if (updated[0] > 0 && cur[0] === updated[0] && cur[1] === updated[0] + 1) {\n updated = [updated[0] - 1, updated[1], 'backward'];\n } else if (typeof inputRef.current?.value[updated[0]] !== 'undefined') {\n updated = [updated[0], updated[1] + 1, 'backward'];\n } else if (updated[0] >= OTP_LENGTH_DEFAULT) {\n updated = [updated[0] - 1, updated[1], 'backward'];\n }\n }\n\n inputRef.current?.setSelectionRange(updated[0], updated[1], updated[2] ?? undefined);\n\n return [updated[0], updated[1]] satisfies SelectionRange;\n}\n\nconst wrapperStyle = {\n position: 'relative',\n userSelect: 'none',\n} satisfies React.CSSProperties;\n\nconst inputStyle = {\n display: 'block',\n background: 'transparent',\n opacity: 0,\n outline: 'transparent solid 0px',\n appearance: 'none',\n color: 'transparent',\n position: 'absolute',\n inset: 0,\n caretColor: 'transparent',\n border: '0px solid transparent',\n // width is handled inline\n height: '100%',\n letterSpacing: '-1rem',\n} satisfies React.CSSProperties;\n\nconst segmentWrapperStyle = {\n zIndex: 1,\n pointerEvents: 'none',\n} satisfies React.CSSProperties;\n","import { FIELD_STATES, type FieldStates } from '../types';\n\n/**\n * Radix can return the ValidityState object, which contains the validity of the field. We need to merge this with our existing fieldState.\n * When the ValidityState is valid: false, the fieldState should be overriden. Otherwise, it shouldn't change at all.\n * @see https://www.radix-ui.com/primitives/docs/components/form#validitystate\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n */\nexport function enrichFieldState(validity: ValidityState | undefined, fieldState: FieldStates) {\n return validity?.valid === false ? FIELD_STATES.error : fieldState;\n}\n","import type { Autocomplete } from '@clerk/types';\nimport type { FormFieldProps as RadixFormFieldProps } from '@radix-ui/react-form';\n\nimport type { ClerkFieldId, FieldStates } from '../types';\n\n// TODO: Move this to a shared location\ntype FormFieldProps = Omit<RadixFormFieldProps, 'children'> & {\n name: Autocomplete<ClerkFieldId>;\n alwaysShow?: boolean;\n children: React.ReactNode | ((state: FieldStates) => React.ReactNode);\n};\n\nexport function determineInputTypeFromName(name: FormFieldProps['name']) {\n if (name === 'password' || name === 'confirmPassword' || name === 'currentPassword' || name === 'newPassword') {\n return 'password' as const;\n }\n if (name === 'emailAddress') {\n return 'email' as const;\n }\n if (name === 'phoneNumber') {\n return 'tel' as const;\n }\n if (name === 'code') {\n return 'otp' as const;\n }\n if (name === 'backup_code') {\n return 'backup_code' as const;\n }\n\n return 'text' as const;\n}\n","import * as React from 'react';\n\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = React.useRef<T>();\n\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import * as React from 'react';\n\nexport const ValidityStateContext = React.createContext<ValidityState | undefined>(undefined);\nexport const useValidityStateContext = () => React.useContext(ValidityStateContext);\n","import type { FormMessageProps as RadixFormMessageProps } from '@radix-ui/react-form';\nimport { FormMessage as RadixFormMessage } from '@radix-ui/react-form';\nimport { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport { isReactFragment } from '~/react/utils/is-react-fragment';\n\nimport { useFieldContext, useFieldFeedback } from './hooks';\nimport type { FormErrorProps } from './types';\n\nconst DISPLAY_NAME = 'ClerkElementsFieldError';\n\nexport type FormFieldErrorProps = FormErrorProps<RadixFormMessageProps & { name?: string }>;\ntype FormFieldErrorElement = React.ElementRef<typeof RadixFormMessage>;\n\n/**\n * FieldError renders error messages associated with a specific field. By default, the error's message will be rendered in an unstyled `<span>`. Optionally, the `children` prop accepts a function to completely customize rendering.\n *\n * @param {string} [name] - Used to target a specific field by name when rendering outside of a `<Field>` component.\n * @param {Function} [children] - A function that receives `message` and `code` as arguments.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.FieldError />\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.FieldError>\n * {({ message, code }) => (\n * <span data-error-code={code}>{message}</span>\n * )}\n * </Clerk.FieldError>\n * </Clerk.Field>\n */\nexport const FieldError = React.forwardRef<FormFieldErrorElement, FormFieldErrorProps>(\n ({ asChild = false, children, code, name, ...rest }, forwardedRef) => {\n const fieldContext = useFieldContext();\n const rawFieldName = fieldContext?.name || name;\n const fieldName = rawFieldName === 'backup_code' ? 'code' : rawFieldName;\n const { feedback } = useFieldFeedback({ name: fieldName });\n\n if (!(feedback?.type === 'error')) {\n return null;\n }\n\n const error = feedback.message;\n\n if (!error) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'span';\n const child = typeof children === 'function' ? children(error) : children;\n\n // const forceMatch = code ? error.code === code : undefined; // TODO: Re-add when Radix Form is updated\n\n if (isReactFragment(child)) {\n throw new ClerkElementsRuntimeError('<FieldError /> cannot render a Fragment as a child.');\n }\n\n return (\n <RadixFormMessage\n data-error-code={error.code}\n // forceMatch={forceMatch}\n {...rest}\n ref={forwardedRef}\n asChild\n >\n <Comp>{child || error.message}</Comp>\n </RadixFormMessage>\n );\n },\n);\n\nFieldError.displayName = DISPLAY_NAME;\n","import * as React from 'react';\n\nexport function isReactFragment(node: React.ReactNode) {\n return React.isValidElement(node) && node.type === React.Fragment;\n}\n","import { ClerkElementsFieldError } from '~/internals/errors';\nimport type { ErrorCodeOrTuple } from '~/react/utils/generate-password-error-text';\n\nimport { useFieldContext, useFieldFeedback, useFieldState, useValidityStateContext } from './hooks';\nimport type { FieldStates } from './types';\nimport { enrichFieldState } from './utils';\n\ntype FieldStateRenderFn = {\n children: (state: {\n state: FieldStates;\n message: string | undefined;\n codes: ErrorCodeOrTuple[] | undefined;\n }) => React.ReactNode;\n};\n\nconst DISPLAY_NAME = 'ClerkElementsFieldState';\n\n/**\n * Programmatically access the state of the wrapping `<Field>`. Useful for implementing animations when direct access to the state value is necessary.\n *\n * @param {Function} children - A function that receives `state`, `message`, and `codes` as an argument. `state` will is a union of `\"success\" | \"error\" | \"idle\" | \"warning\" | \"info\"`. `message` will be the corresponding message, e.g. error message. `codes` will be an array of keys that were used to generate the password validation messages. This prop is only available when the field is of type `password` and has `validatePassword` set to `true`.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.FieldState>\n * {({ state }) => (\n * <Clerk.Input className={`text-${state}`} />\n * )}\n * </Clerk.FieldState>\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"password\">\n * <Clerk.Label>Password</Clerk.Label>\n * <Clerk.Input validatePassword />\n * <Clerk.FieldState>\n * {({ state, message, codes }) => (\n * <pre>Field state: {state}</pre>\n * <pre>Field msg: {message}</pre>\n * <pre>Pwd keys: {codes.join(', ')}</pre>\n * )}\n * </Clerk.FieldState>\n * </Clerk.Field>\n */\nexport function FieldState({ children }: FieldStateRenderFn) {\n const field = useFieldContext();\n const { feedback } = useFieldFeedback({ name: field?.name });\n const { state } = useFieldState({ name: field?.name });\n const validity = useValidityStateContext();\n\n const message = feedback?.message instanceof ClerkElementsFieldError ? feedback.message.message : feedback?.message;\n const codes = feedback?.codes;\n\n const fieldState = { state: enrichFieldState(validity, state), message, codes };\n\n return children(fieldState);\n}\n\nFieldState.displayName = DISPLAY_NAME;\n","import { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport { isReactFragment } from '~/react/utils/is-react-fragment';\n\nimport { useGlobalErrors } from './hooks';\nimport type { FormErrorProps } from './types';\n\nconst DISPLAY_NAME = 'ClerkElementsGlobalError';\n\ntype FormGlobalErrorElement = React.ElementRef<'div'>;\nexport type FormGlobalErrorProps = FormErrorProps<React.ComponentPropsWithoutRef<'div'>>;\n\n/**\n * Used to render errors that are returned from Clerk's API, but that are not associated with a specific form field. By default, will render the error's message wrapped in a `<div>`. Optionally, the `children` prop accepts a function to completely customize rendering. Must be placed **inside** components like `<SignIn>`/`<SignUp>` to have access to the underlying form state.\n *\n * @param {string} [code] - Forces the message with the matching code to be shown. This is useful when using server-side validation.\n * @param {Function} [children] - A function that receives `message` and `code` as arguments.\n * @param {boolean} [asChild] - If `true`, `<GlobalError>` will render as its child element, passing along any necessary props.\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError />\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError code=\"user_locked\">Your custom error message.</Clerk.GlobalError>\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError>\n * {({ message, code }) => (\n * <span data-error-code={code}>{message}</span>\n * )}\n * </Clerk.GlobalError>\n * </SignIn.Root>\n */\nexport const GlobalError = React.forwardRef<FormGlobalErrorElement, FormGlobalErrorProps>(\n ({ asChild = false, children, code, ...rest }, forwardedRef) => {\n const { errors } = useGlobalErrors();\n\n const error = errors?.[0];\n\n if (!error || (code && error.code !== code)) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'div';\n const child = typeof children === 'function' ? children(error) : children;\n\n if (isReactFragment(child)) {\n throw new ClerkElementsRuntimeError('<GlobalError /> cannot render a Fragment as a child.');\n }\n\n return (\n <Comp\n role='alert'\n {...rest}\n ref={forwardedRef}\n >\n {child || error.message}\n </Comp>\n );\n },\n);\n\nGlobalError.displayName = DISPLAY_NAME;\n","import { logger } from '@clerk/shared/logger';\nimport { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\nimport type {\n Control as RadixControl,\n FormControlProps,\n FormControlProps as RadixFormControlProps,\n} from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { SignInRouterCtx } from '~/react/sign-in/context';\nimport { useSignInPasskeyAutofill } from '~/react/sign-in/context/router.context';\n\nimport { useInput } from './hooks';\nimport type { OTPInputProps } from './otp';\n\nconst DISPLAY_NAME = 'ClerkElementsInput';\nconst DISPLAY_NAME_PASSKEYS_AUTOFILL = 'ClerkElementsInputWithPasskeyAutofill';\n\ntype PasswordInputProps = Exclude<FormControlProps, 'type'> & {\n validatePassword?: boolean;\n};\n\nexport type FormInputProps =\n | RadixFormControlProps\n | ({ type: 'otp'; render: OTPInputProps['render'] } & Omit<OTPInputProps, 'asChild'>)\n | ({ type: 'otp'; render?: undefined } & OTPInputProps)\n // Usecase: Toggle the visibility of the password input, therefore 'password' and 'text' are allowed\n | ({ type: 'password' | 'text' } & PasswordInputProps);\n\n/**\n * Handles rendering of `<input>` elements within Clerk's flows. Supports special `type` prop values to render input types that are unique to authentication and user management flows. Additional props will be passed through to the `<input>` element.\n *\n * @param {boolean} [asChild] - If true, `<Input />` will render as its child element, passing along any necessary props.\n * @param {string} [name] - Used to target a specific field by name when rendering outside of a `<Field>` component.\n *\n * @example\n * <Clerk.Field name=\"identifier\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input type=\"email\" autoComplete=\"email\" className=\"emailInput\" />\n * </Clerk.Field>\n *\n * @param {Number} [length] - The length of the OTP input. Defaults to 6.\n * @param {Number} [passwordManagerOffset] - Password managers place their icon inside an `<input />`. This default behaviour is not desirable when you use the render prop to display N distinct element. With this prop you can increase the width of the `<input />` so that the icon is rendered outside the OTP inputs.\n * @param {string} [type] - Type of control to render. Supports a special `'otp'` type for one-time password inputs. If the wrapping `<Field>` component has `name='code'`, the type will default to `'otp'`. With the `'otp'` type, the input will have a pattern and length set to 6 by default and render a single `<input />` element.\n *\n * @example\n * <Clerk.Field name=\"code\">\n * <Clerk.Label>Email code</Clerk.Label>\n * <Clerk.Input type=\"otp\" />\n * </Clerk.Field>\n *\n * @param {Function} [render] - Optionally, you can use a render prop that controls how each individual character is rendered. If no `render` prop is provided, a single text `<input />` will be rendered.\n *\n * @example\n * <Clerk.Field name=\"code\">\n * <Clerk.Label>Email code</Clerk.Label>\n * <Clerk.Input\n * type=\"otp\"\n * render={({ value, status }) => <span data-status={status}>{value}</span>}\n * />\n * </Clerk.Field>\n */\nexport const Input = React.forwardRef<React.ElementRef<typeof RadixControl>, FormInputProps>(\n (props: FormInputProps, forwardedRef) => {\n const clerk = useClerk();\n const field = useInput(props);\n\n const hasPasskeyAutofillProp = Boolean(field.props.autoComplete?.includes('webauthn'));\n const allowedTypeForPasskey = (['text', 'email', 'tel'] as FormInputProps['type'][]).includes(field.props.type);\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n\n clerk.telemetry?.record(\n eventComponentMounted('Elements_Input', {\n type: props.type ?? false,\n // @ts-expect-error - Depending on type the props can be different\n render: Boolean(props?.render),\n // @ts-expect-error - Depending on type the props can be different\n asChild: Boolean(props?.asChild),\n // @ts-expect-error - Depending on type the props can be different\n validatePassword: Boolean(props?.validatePassword),\n }),\n );\n\n if (signInRouterRef && hasPasskeyAutofillProp && allowedTypeForPasskey) {\n return (\n <InputWithPasskeyAutofill\n ref={forwardedRef}\n {...props}\n />\n );\n }\n\n if (hasPasskeyAutofillProp && !allowedTypeForPasskey) {\n logger.warnOnce(\n `<Input autoComplete=\"webauthn\"> can only be used with <Input type=\"text\"> or <Input type=\"email\">`,\n );\n } else if (hasPasskeyAutofillProp) {\n logger.warnOnce(\n `<Input autoComplete=\"webauthn\"> can only be used inside <SignIn> in order to trigger a sign-in attempt, otherwise it will be ignored.`,\n );\n }\n\n return (\n <field.Element\n ref={forwardedRef}\n {...field.props}\n />\n );\n },\n);\n\nInput.displayName = DISPLAY_NAME;\n\nconst InputWithPasskeyAutofill = React.forwardRef<React.ElementRef<typeof RadixControl>, FormInputProps>(\n (props: FormInputProps, forwardedRef) => {\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n const passkeyAutofillSupported = useSignInPasskeyAutofill();\n\n React.useEffect(() => {\n if (passkeyAutofillSupported) {\n signInRouterRef?.send({ type: 'AUTHENTICATE.PASSKEY.AUTOFILL' });\n }\n }, [passkeyAutofillSupported, signInRouterRef]);\n\n const field = useInput(props);\n return (\n <field.Element\n ref={forwardedRef}\n {...field.props}\n />\n );\n },\n);\n\nInputWithPasskeyAutofill.displayName = DISPLAY_NAME_PASSKEYS_AUTOFILL;\n","import { useSelector as useSelectorUnbound } from '@xstate/react';\nimport * as React from 'react';\nimport type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\n/**\n * Creates a context and hooks for a given actor ref.\n\n * @example\n * const SignInRouterCtx = createContextFromActorRef<typeof SignInRouterMachine>('SignInRouterCtx')\n *\n * const Parent = () => {\n * const ref = useActorRef(SignInRouterMachine, { input: { basePath: '/sign-in' } });\n *\n * return (\n * <SignInRouterCtx.Provider ref={ref}>\n * <Child />\n * </SignInRouterCtx>\n * )\n * }\n *\n * const Child = () => {\n * const ref = SignInRouterCtx.useActorRef();\n * const status = SignInRouterCtx.useSelector(state => state.context.clerk);\n\n * const handleClick = useCallback(() => ref.send({ type: 'NEXT' }), [ref]);\n *\n * return <button onClick={handleClick}>;\n * }\n */\n\nexport function createContextFromActorRef<TMachine extends AnyStateMachine, TRef = ActorRefFrom<TMachine>>(\n displayName: string,\n) {\n const ReactContext = React.createContext<TRef | null>(null);\n const OriginalProvider = ReactContext.Provider;\n\n function Provider({ children, actorRef }: { children: React.ReactNode; actorRef: TRef }) {\n return React.createElement(\n OriginalProvider,\n {\n value: actorRef,\n },\n children,\n );\n }\n\n Provider.displayName = displayName;\n\n function useContext(allowMissingActor?: false | undefined): TRef;\n function useContext(allowMissingActor: true): TRef | null;\n function useContext(allowMissingActor: boolean = false): TRef | null {\n const actorRef = React.useContext(ReactContext);\n\n if (!allowMissingActor && !actorRef) {\n throw new Error(\n `You used a hook from \"${Provider.displayName}\" but it's not inside a <${Provider.displayName}.Provider> component.`,\n );\n }\n\n return actorRef;\n }\n\n function useSelector<T>(selector: (snapshot: SnapshotFrom<TRef>) => T, compare?: (a: T, b: T) => boolean): T {\n const actor = useContext();\n return useSelectorUnbound(actor as AnyActorRef, selector, compare);\n }\n\n return {\n Provider,\n useActorRef: useContext,\n useSelector,\n };\n}\n","import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\nimport type {\n TSignInFirstFactorMachine,\n TSignInResetPasswordMachine,\n TSignInRouterMachine,\n TSignInSecondFactorMachine,\n TSignInStartMachine,\n} from '~/internals/machines/sign-in';\nimport { createContextFromActorRef } from '~/react/utils/create-context-from-actor-ref';\n\nexport type SnapshotState = SnapshotFrom<TSignInRouterMachine>;\n\nexport const SignInRouterCtx: ReturnType<typeof createContextFromActorRef<TSignInRouterMachine>> =\n createContextFromActorRef<TSignInRouterMachine>('SignInRouterCtx');\n\nfunction useSignInStep<M extends AnyStateMachine, T = ActorRefFrom<M>>(name: string) {\n return SignInRouterCtx.useSelector(state => state.children[name] as AnyActorRef) as T;\n}\n\nexport const useSignInStartStep = () => useSignInStep<TSignInStartMachine>('start');\nexport const useSignInFirstFactorStep = () => useSignInStep<TSignInFirstFactorMachine>('firstFactor');\nexport const useSignInSecondFactorStep = () => useSignInStep<TSignInSecondFactorMachine>('secondFactor');\nexport const useSignInResetPasswordStep = () => useSignInStep<TSignInResetPasswordMachine>('resetPassword');\n\nexport const useSignInPasskeyAutofill = () =>\n SignInRouterCtx.useSelector(state => state.context.webAuthnAutofillSupport);\n","import { Label as RadixLabel } from '@radix-ui/react-form';\n\nconst DISPLAY_NAME = 'ClerkElementsLabel';\n\n/**\n * Renders a `<label>` element that is automatically associated with its sibling `<Input />` inside of a `<Field>`. Additional props will be passed through to the `<label>` element.\n *\n * @param {boolean} [asChild] - If true, `<Label />` will render as its child element, passing along any necessary props.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input />\n * </Clerk.Field>\n */\nexport const Label = RadixLabel;\n\nLabel.displayName = DISPLAY_NAME;\n","import type { FormSubmitProps as RadixFormSubmitProps } from '@radix-ui/react-form';\nimport { Submit as RadixSubmit } from '@radix-ui/react-form';\nimport type { SetRequired } from 'type-fest';\n\nconst DISPLAY_NAME = 'ClerkElementsSubmit';\n\nexport type FormSubmitProps = SetRequired<RadixFormSubmitProps, 'children'>;\ntype FormSubmitComponent = React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;\n\n/**\n * A `<button type=\"submit\">` element.\n *\n * @param {boolean} [asChild] - When `true`, the component will render its child and passes all props to it.\n */\nexport const Submit = RadixSubmit as FormSubmitComponent;\n\nSubmit.displayName = DISPLAY_NAME;\n","import type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext } from 'react';\n\nimport type { ThirdPartyProvider } from '~/utils/third-party-strategies';\n\nimport { useThirdPartyProvider } from '../hooks';\nimport { SignInRouterCtx } from '../sign-in/context';\nimport { SignUpRouterCtx } from '../sign-up/context';\n\nexport type UseThirdPartyProviderReturn =\n | (ThirdPartyProvider & {\n events: {\n authenticate: (event: React.MouseEvent<Element>) => void;\n };\n })\n | null;\n\nexport const ConnectionContext = createContext<ThirdPartyProvider | null>(null);\nexport const useConnectionContext = () => {\n const ctx = useContext(ConnectionContext);\n\n if (!ctx) {\n throw new Error('useConnectionContext must be used within <Clerk.Connection>');\n }\n\n return ctx;\n};\n\nexport interface ConnectionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n name: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy;\n}\n\n/**\n * Renders a social connection button based on the provided name. If your instance does not have the social connection enabled, this component will throw an error in development.\n *\n * **Tip:** You can use the `<Icon />` component to render the social connection icon.\n *\n * @param {boolean} [asChild] - If true, `<Connection />` will render as its child element, passing along any necessary props.\n * @param {OAuthProvider | Web3Provider} name - The name of the social connection to render.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name=\"start\">\n * <Clerk.Connection name=\"google\">\n * Sign in with Google\n * </Clerk.Connection>\n * </SignIn.Step>\n * </SignIn.Root>\n */\nexport function Connection({ asChild, name, ...rest }: ConnectionProps) {\n const signInRef = SignInRouterCtx.useActorRef(true);\n const signUpRef = SignUpRouterCtx.useActorRef(true);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const provider = useThirdPartyProvider((signInRef || signUpRef)!, name);\n\n if (!provider) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'button';\n const defaultProps = asChild ? {} : { type: 'button' as const };\n\n return (\n <ConnectionContext.Provider value={provider}>\n <Comp\n onClick={provider.events.authenticate}\n {...defaultProps}\n {...rest}\n />\n </ConnectionContext.Provider>\n );\n}\n\nexport interface IconProps extends Omit<React.HTMLAttributes<HTMLImageElement>, 'src'> {\n asChild?: boolean;\n}\n\n/**\n * `<Icon>` **must** be used inside `<Connection>`. By default, `<Icon>` will render as an `<img>` element with the `src` pointing to the logo of the currently used `<Connection>`.\n *\n * @param {boolean} [asChild] - If true, `<Icon />` will render as its child element, passing along any necessary props.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name=\"start\">\n * <Clerk.Connection name=\"google\">\n * <Clerk.Icon />\n * Sign in with Google\n * </Clerk.Connection>\n * </SignIn.Step>\n * </SignIn.Root>\n */\nexport function Icon({ asChild, ...rest }: IconProps) {\n const { iconUrl, name } = useConnectionContext();\n\n const Comp = asChild ? Slot : 'img';\n return (\n <Comp\n alt={`${name} logo`}\n src={iconUrl}\n {...rest}\n />\n );\n}\n","import { useClerk } from '@clerk/shared/react';\nimport type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport type React from 'react';\nimport { useCallback } from 'react';\nimport type { ActorRef } from 'xstate';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport type { SignInRouterEvents } from '~/internals/machines/sign-in';\nimport type { SignUpRouterEvents } from '~/internals/machines/sign-up';\nimport type { UseThirdPartyProviderReturn } from '~/react/common/connections';\nimport {\n getEnabledThirdPartyProviders,\n isAuthenticatableOauthStrategy,\n isEnterpriseSSOStrategy,\n isSamlStrategy,\n isWeb3Strategy,\n providerToDisplayData,\n} from '~/utils/third-party-strategies';\n\nconst useIsProviderEnabled = (\n provider: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy,\n): boolean | null => {\n const clerk = useClerk();\n\n // null indicates we don't know for sure\n if (!clerk.loaded) {\n return null;\n }\n\n if (provider === 'saml' || provider === 'enterprise_sso') {\n return (\n clerk.__unstable__environment?.userSettings.saml.enabled ??\n clerk.__unstable__environment?.userSettings.enterpriseSSO.enabled ??\n false\n );\n }\n\n const data = getEnabledThirdPartyProviders(clerk.__unstable__environment);\n\n return (\n isAuthenticatableOauthStrategy(provider, data.authenticatableOauthStrategies) ||\n isWeb3Strategy(provider, data.web3Strategies)\n );\n};\n\nexport const useThirdPartyProvider = <\n TActor extends ActorRef<any, SignInRouterEvents> | ActorRef<any, SignUpRouterEvents>,\n>(\n ref: TActor,\n provider: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy,\n): UseThirdPartyProviderReturn => {\n const isProviderEnabled = useIsProviderEnabled(provider);\n const isSaml = isSamlStrategy(provider);\n const isEnterpriseSSO = isEnterpriseSSOStrategy(provider);\n const details =\n isEnterpriseSSO || isSaml\n ? {\n name: 'SSO',\n strategy: provider,\n }\n : providerToDisplayData[provider];\n\n const authenticate = useCallback(\n (event: React.MouseEvent<Element>) => {\n if (!isProviderEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (isSaml) {\n return ref.send({ type: 'AUTHENTICATE.SAML' });\n }\n\n if (isEnterpriseSSO) {\n return ref.send({ type: 'AUTHENTICATE.ENTERPRISE_SSO' });\n }\n\n if (provider === 'metamask') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_metamask_signature' });\n }\n\n if (provider === 'coinbase_wallet') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_coinbase_wallet_signature' });\n }\n\n if (provider === 'okx_wallet') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_okx_wallet_signature' });\n }\n\n return ref.send({ type: 'AUTHENTICATE.OAUTH', strategy: `oauth_${provider}` });\n },\n [provider, isProviderEnabled, isSaml, isEnterpriseSSO, ref],\n );\n\n if (isProviderEnabled === false) {\n const dashboardPath = `https://dashboard.clerk.com/last-active?path=/user-authentication/${provider === 'metamask' ? 'web3' : 'social-connections'}`;\n\n throw new ClerkElementsRuntimeError(\n `You have used <Connection name=\"${provider}\"> which isn't enabled for your project. Enable ${details.name} in your Clerk dashboard: ${dashboardPath}`,\n );\n }\n\n return {\n events: {\n authenticate,\n },\n ...details,\n };\n};\n","// c.f. vendor/clerk-js/src/ui/hooks/useEnabledThirdPartyProviders.tsx [Modified]\n\nimport { iconImageUrl } from '@clerk/shared/constants';\nimport { OAUTH_PROVIDERS } from '@clerk/shared/oauth';\nimport { WEB3_PROVIDERS } from '@clerk/shared/web3';\nimport type {\n EnterpriseSSOStrategy,\n EnvironmentResource,\n OAuthProvider,\n OAuthStrategy,\n SamlStrategy,\n Web3Provider,\n Web3Strategy,\n} from '@clerk/types';\n\nimport { fromEntries } from './clerk-js';\n\nexport type ThirdPartyStrategy =\n | {\n id: Web3Strategy | OAuthStrategy;\n iconUrl: string;\n name: string;\n }\n | {\n strategy: SamlStrategy | EnterpriseSSOStrategy;\n iconUrl?: never;\n name: string;\n };\n\nexport type ThirdPartyProvider =\n | {\n strategy: Web3Strategy | OAuthStrategy;\n iconUrl: string;\n name: string;\n }\n | {\n strategy: SamlStrategy | EnterpriseSSOStrategy;\n iconUrl?: never;\n name: string;\n };\n\ntype ThirdPartyStrategyToDataMap = {\n [k in Web3Strategy | OAuthStrategy]: ThirdPartyStrategy;\n};\n\ntype ThirdPartyProviderToDataMap = {\n [k in Web3Provider | OAuthProvider]: ThirdPartyProvider;\n};\n\nexport interface EnabledThirdPartyProviders {\n authenticatableOauthStrategies: OAuthStrategy[];\n providerToDisplayData: ThirdPartyProviderToDataMap;\n strategies: (Web3Strategy | OAuthStrategy)[];\n strategyToDisplayData: ThirdPartyStrategyToDataMap;\n web3Strategies: Web3Strategy[];\n}\n\nconst oauthStrategies = OAUTH_PROVIDERS.map(p => p.strategy);\n\nexport const providerToDisplayData: ThirdPartyProviderToDataMap = fromEntries(\n [...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {\n return [p.provider, { iconUrl: iconImageUrl(p.provider), name: p.name, strategy: p.strategy }];\n }),\n) as ThirdPartyProviderToDataMap;\n\nconst strategyToDisplayData: ThirdPartyStrategyToDataMap = fromEntries(\n [...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {\n return [p.strategy, { iconUrl: iconImageUrl(p.provider), id: p.provider, name: p.name }];\n }),\n) as ThirdPartyStrategyToDataMap;\n\nexport function isSamlStrategy(strategy: any): strategy is SamlStrategy {\n return strategy === 'saml';\n}\n\nexport function isEnterpriseSSOStrategy(strategy: any): strategy is EnterpriseSSOStrategy {\n return strategy === 'enterprise_sso';\n}\n\nexport function isWeb3Strategy(\n strategy: any,\n available: EnabledThirdPartyProviders['web3Strategies'],\n): strategy is Web3Strategy {\n return available.includes(strategy.startsWith('web3_') ? strategy : `web3_${strategy}_signature`);\n}\n\nexport function isAuthenticatableOauthStrategy(\n strategy: any,\n available: EnabledThirdPartyProviders['authenticatableOauthStrategies'],\n): strategy is OAuthStrategy {\n return available.includes(strategy.startsWith('oauth_') ? strategy : `oauth_${strategy}`);\n}\n\nconst emptyThirdPartyProviders: EnabledThirdPartyProviders = {\n authenticatableOauthStrategies: [],\n providerToDisplayData: {} as any,\n strategies: [],\n strategyToDisplayData: {} as any,\n web3Strategies: [],\n};\n\nexport const getEnabledThirdPartyProviders = (\n environment: EnvironmentResource | undefined | null,\n): EnabledThirdPartyProviders => {\n if (!environment?.userSettings) {\n return emptyThirdPartyProviders;\n }\n\n const { socialProviderStrategies, web3FirstFactors, authenticatableSocialStrategies } = environment.userSettings;\n\n // Filter out any OAuth strategies that are not yet known, they are not included in our types.\n const knownSocialProviderStrategies = socialProviderStrategies.filter(s => oauthStrategies.includes(s));\n const knownAuthenticatableSocialStrategies = authenticatableSocialStrategies.filter(s => oauthStrategies.includes(s));\n\n return {\n authenticatableOauthStrategies: [...knownAuthenticatableSocialStrategies],\n providerToDisplayData: providerToDisplayData,\n strategies: [...knownSocialProviderStrategies, ...web3FirstFactors],\n strategyToDisplayData: strategyToDisplayData,\n web3Strategies: web3FirstFactors,\n };\n};\n","// Pulled from `clerk-js/src/ui/utils/fromEntries.ts\nexport const fromEntries = (iterable: Iterable<any>) => {\n return [...iterable].reduce((obj, [key, val]) => {\n obj[key] = val;\n return obj;\n }, {});\n};\n","import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\nimport {\n type TSignUpContinueMachine,\n type TSignUpRouterMachine,\n type TSignUpStartMachine,\n type TSignUpVerificationMachine,\n} from '~/internals/machines/sign-up';\nimport { createContextFromActorRef } from '~/react/utils/create-context-from-actor-ref';\n\nexport type SnapshotState = SnapshotFrom<TSignUpRouterMachine>;\n\nexport const SignUpRouterCtx: ReturnType<typeof createContextFromActorRef<TSignUpRouterMachine>> =\n createContextFromActorRef<TSignUpRouterMachine>('SignUpRouterCtx');\n\nfunction useSignUpStep<M extends AnyStateMachine, T = ActorRefFrom<M>>(name: string) {\n return SignUpRouterCtx.useSelector(state => state.children[name] as AnyActorRef) as T;\n}\n\nexport const useSignUpStartStep = () => useSignUpStep<TSignUpStartMachine>('start');\nexport const useSignUpContinueStep = () => useSignUpStep<TSignUpContinueMachine>('continue');\nexport const useSignUpVerificationStep = () => useSignUpStep<TSignUpVerificationMachine>('verification');\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\nimport type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport { useSelector } from '@xstate/react';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport type { ActorSignIn, ActorSignUp } from '~/react/hooks/use-loading.hook';\nimport { useLoading } from '~/react/hooks/use-loading.hook';\nimport { SignInRouterCtx } from '~/react/sign-in/context';\nimport type { TSignInStep } from '~/react/sign-in/step';\nimport { SIGN_IN_STEPS } from '~/react/sign-in/step';\nimport { SignUpRouterCtx } from '~/react/sign-up/context';\nimport type { TSignUpStep } from '~/react/sign-up/step';\nimport { SIGN_UP_STEPS } from '~/react/sign-up/step';\nimport { isProviderStrategyScope, mapScopeToStrategy } from '~/react/utils/map-scope-to-strategy';\n\ntype Strategy = OAuthProvider | SamlStrategy | EnterpriseSSOStrategy | Web3Provider;\ntype LoadingScope<T extends TSignInStep | TSignUpStep> =\n | 'global'\n | `step:${T}`\n | `provider:${Strategy}`\n | 'submit'\n | 'passkey'\n | undefined;\n\ntype LoadingProps = {\n scope?: LoadingScope<TSignInStep | TSignUpStep>;\n children: (isLoading: boolean) => React.ReactNode;\n};\n\nfunction isSignInScope(scope: LoadingScope<TSignInStep | TSignUpStep>): scope is LoadingScope<TSignInStep> {\n if (!scope) {\n return true;\n }\n\n if (scope.startsWith('step:')) {\n return Object.prototype.hasOwnProperty.call(SIGN_IN_STEPS, scope.replace('step:', ''));\n }\n\n return true;\n}\n\nfunction isSignUpScope(scope: LoadingScope<TSignInStep | TSignUpStep>): scope is LoadingScope<TSignUpStep> {\n if (!scope) {\n return true;\n }\n\n if (scope.startsWith('step:')) {\n return Object.prototype.hasOwnProperty.call(SIGN_UP_STEPS, scope.replace('step:', ''));\n }\n\n return true;\n}\n\n/**\n * Access the loading state of a chosen scope. Scope can refer to a step, a provider, or the global loading state. The global loading state is `true` when any of the other scopes are loading.\n *\n * @param scope - Optional. Specify which loading state to access. Can be a step, a provider, or the global loading state. If `<Loading>` is used outside a `<Step>`, the scope will default to \"global\". If used inside a `<Step>` the scope will default to the current step. For external authentication providers, the scope needs to be manually defined in the format of `provider:<provider name>`\n * @param {Function} children - A function that receives `isLoading` as an argument. `isLoading` is a boolean that indicates if the current scope is loading or not.\n *\n * @example\n * <SignIn.Root>\n * <Clerk.Loading>\n * {(isLoading) => isLoading && \"Global loading...\"}\n * </Clerk.Loading>\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Step name=\"start\">\n * <Clerk.Action submit>\n * <Clerk.Loading>\n * {(isLoading) => isLoading ? \"Start is loading...\" : \"Submit\"}\n * </Clerk.Loading>\n * </Clerk.Action>\n * </SignIn.Step>\n *\n * @example\n * <SignIn.Step name=\"start\">\n * <Clerk.Loading scope=\"provider:google\">\n * {(isLoading) => (\n * <Clerk.Connection name=\"google\" disabled={isLoading}>\n * {isLoading ? \"Loading...\" : \"Continue with Google\"}\n * </Clerk.Connection>\n * )}\n * </Clerk.Loading>\n * </SignIn.Step>\n */\nexport function Loading({ children, scope }: LoadingProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_Loading', { scope: scope ?? false }));\n\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n const signUpRouterRef = SignUpRouterCtx.useActorRef(true);\n\n // One of the two routers must be defined. Otherwise, the component is used outside of a <SignIn> or <SignUp> component.\n // An error is thrown in this case. Depending on which router is defined, the following flow will be either for sign-in or sign-up.\n if (!signInRouterRef && !signUpRouterRef) {\n throw new ClerkElementsRuntimeError(`<Loading> must be used within a <SignIn> or <SignUp> component.`);\n }\n\n if (signInRouterRef) {\n if (isSignInScope(scope)) {\n return (\n <SignInLoading\n scope={scope}\n routerRef={signInRouterRef}\n >\n {children}\n </SignInLoading>\n );\n } else {\n throw new ClerkElementsRuntimeError(`Invalid scope \"${scope}\" used for <Loading> inside <SignIn>.`);\n }\n }\n\n if (signUpRouterRef) {\n if (isSignUpScope(scope)) {\n return (\n <SignUpLoading\n scope={scope}\n routerRef={signUpRouterRef}\n >\n {children}\n </SignUpLoading>\n );\n } else {\n throw new ClerkElementsRuntimeError(`Invalid scope \"${scope}\" used for <Loading> inside <SignUp>.`);\n }\n }\n\n throw new ClerkElementsRuntimeError('Invalid state for <Loading>. Please open an issue.');\n}\n\ntype SignInLoadingProps = {\n scope?: LoadingScope<TSignInStep>;\n children: (isLoading: boolean) => React.ReactNode;\n routerRef: ActorSignIn;\n};\n\nfunction SignInLoading({ children, scope, routerRef }: SignInLoadingProps) {\n const [isLoading, { step: loadingStep, strategy, action }] = useLoading(routerRef);\n const tags = useSelector(routerRef, s => s.tags);\n\n const isStepLoading = (step: TSignInStep) => isLoading && loadingStep === step;\n const isInferredStepLoading = (step: TSignInStep) => tags.has(`step:${step}`) && isStepLoading(step);\n\n let loadingResult = false;\n\n if (scope === 'global') {\n // Global Loading Scope\n loadingResult = isLoading;\n } else if (scope && isProviderStrategyScope(scope)) {\n // Provider-Specific Loading Scope\n loadingResult = isLoading && loadingStep === undefined && strategy === mapScopeToStrategy(scope);\n } else if (scope) {\n // Specified Loading Scope\n loadingResult = isStepLoading(scope.replace('step:', '') as TSignInStep) || scope === action;\n } else {\n // Inferred Loading Scope\n loadingResult =\n isInferredStepLoading('start') ||\n isInferredStepLoading('verifications') ||\n isInferredStepLoading('choose-strategy') ||\n isInferredStepLoading('forgot-password') ||\n isInferredStepLoading('reset-password');\n }\n\n return children(loadingResult);\n}\n\ntype SignUpLoadingProps = {\n scope?: LoadingScope<TSignUpStep>;\n children: (isLoading: boolean) => React.ReactNode;\n routerRef: ActorSignUp;\n};\n\nfunction SignUpLoading({ children, scope, routerRef }: SignUpLoadingProps) {\n const [isLoading, { step: loadingStep, strategy, action }] = useLoading(routerRef);\n const tags = useSelector(routerRef, s => s.tags);\n\n const isStepLoading = (step: TSignUpStep) => isLoading && loadingStep === step;\n const isInferredStepLoading = (step: TSignUpStep) => tags.has(`step:${step}`) && isStepLoading(step);\n\n let loadingResult = false;\n\n if (scope === 'global') {\n // Global Loading Scope\n loadingResult = isLoading;\n } else if (scope && isProviderStrategyScope(scope)) {\n // Provider-Specific Loading Scope\n loadingResult = isLoading && loadingStep === undefined && strategy === mapScopeToStrategy(scope);\n } else if (scope) {\n loadingResult = isStepLoading(scope.replace('step:', '') as TSignUpStep) || scope === action;\n } else {\n // Inferred Loading Scope\n loadingResult =\n isInferredStepLoading('start') || isInferredStepLoading('continue') || isInferredStepLoading('verifications');\n }\n\n return children(loadingResult);\n}\n","import { useSelector } from '@xstate/react';\nimport type { ActorRefFrom, SnapshotFrom } from 'xstate';\n\nimport type { SignInRouterLoadingContext, TSignInRouterMachine } from '~/internals/machines/sign-in';\nimport type { SignUpRouterLoadingContext, TSignUpRouterMachine } from '~/internals/machines/sign-up';\n\nexport type ActorSignIn = ActorRefFrom<TSignInRouterMachine>;\nexport type ActorSignUp = ActorRefFrom<TSignUpRouterMachine>;\n\ntype LoadingContext<T> = T extends ActorSignIn ? SignInRouterLoadingContext : SignUpRouterLoadingContext;\ntype UseLoadingReturn<T> = [\n isLoading: boolean,\n { step: LoadingContext<T>['step']; strategy: LoadingContext<T>['strategy']; action: LoadingContext<T>['action'] },\n];\n\nconst selectLoading = <T extends SnapshotFrom<TSignInRouterMachine> | SnapshotFrom<TSignUpRouterMachine>>(\n snapshot: T,\n) => snapshot?.context?.loading;\nconst compareLoadingValue = <T extends SignInRouterLoadingContext | SignUpRouterLoadingContext>(prev: T, next: T) =>\n prev?.isLoading === next?.isLoading;\n\n/**\n * Generic hook to check the loading state inside the context of a machine. Should only be used with `SignInRouterCtx` or `SignUpRouterCtx`.\n *\n * @param actor - The actor reference of the machine\n *\n * @example\n * const ref = SignInRouterCtx.useActorRef();\n *\n * useLoading(ref);\n */\nexport function useLoading<TActor extends ActorSignIn | ActorSignUp>(actor: TActor): UseLoadingReturn<TActor> {\n const loadingCtx = useSelector(actor, selectLoading, compareLoadingValue) as LoadingContext<TActor>;\n\n if (!loadingCtx) {\n return [false, { step: undefined, strategy: undefined, action: undefined }];\n }\n\n return [loadingCtx.isLoading, { step: loadingCtx.step, strategy: loadingCtx.strategy, action: loadingCtx.action }];\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\n\nimport { SignInChooseSession, type SignInChooseSessionProps } from './choose-session';\nimport { SignInChooseStrategy, type SignInChooseStrategyProps, SignInForgotPassword } from './choose-strategy';\nimport { SignInResetPassword, type SignInResetPasswordProps } from './reset-password';\nimport type { SignInSSOCallbackProps } from './sso-callback';\nimport { SignInSSOCallback } from './sso-callback';\nimport { SignInStart, type SignInStartProps } from './start';\nimport { SignInVerifications, type SignInVerificationsProps } from './verifications';\n\nexport const SIGN_IN_STEPS = {\n start: 'start',\n verifications: 'verifications',\n 'choose-strategy': 'choose-strategy',\n 'choose-session': 'choose-session',\n 'forgot-password': 'forgot-password',\n 'reset-password': 'reset-password',\n 'sso-callback': 'sso-callback',\n} as const;\n\nexport type TSignInStep = (typeof SIGN_IN_STEPS)[keyof typeof SIGN_IN_STEPS];\ntype StepWithProps<N extends TSignInStep, T> = { name: N } & T;\n\nexport type SignInStepProps =\n | StepWithProps<'start', SignInStartProps>\n | StepWithProps<'verifications', SignInVerificationsProps>\n | StepWithProps<'choose-strategy' | 'forgot-password', SignInChooseStrategyProps>\n | StepWithProps<'reset-password', SignInResetPasswordProps>\n | StepWithProps<'choose-session', SignInChooseSessionProps>\n | StepWithProps<'sso-callback', SignInSSOCallbackProps>;\n\n/**\n * Render different steps of the sign-in flow. Initially the `'start'` step is rendered. Once a sign-in attempt has been created, `'verifications'` will be displayed. If during that verification step the user decides to choose a different method of signing in or verifying, the `'choose-strategy'` step will be displayed.\n *\n * You typically want to place fields like username, password, or social providers in the `'start'` step. The `'verifications'` step is used to verify the user's credentials like password or MFA. Once the user has been verified, the sign-in attempt will be completed.\n *\n * @param {string} name - Step name. Use `'start'`, `'verifications'`, `'choose-strategy'`, `'reset-password'`, or `'forgot-password'`.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name='start' />\n * <SignIn.Step name='verifications' />\n * <SignIn.Step name='choose-strategy' />\n * <SignIn.Step name='forgot-password' />\n * <SignIn.Step name='reset-password' />\n * <SignIn.Step name='choose-session' />\n * </SignIn.Root>\n */\nexport function SignInStep(props: SignInStepProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_SignInStep', { name: props.name }));\n\n switch (props.name) {\n case SIGN_IN_STEPS.start:\n return <SignInStart {...props} />;\n case SIGN_IN_STEPS.verifications:\n return <SignInVerifications {...props} />;\n case SIGN_IN_STEPS['choose-strategy']:\n return <SignInChooseStrategy {...props} />;\n case SIGN_IN_STEPS['forgot-password']:\n return <SignInForgotPassword {...props} />;\n case SIGN_IN_STEPS['reset-password']:\n return <SignInResetPassword {...props} />;\n case SIGN_IN_STEPS['choose-session']:\n return <SignInChooseSession {...props} />;\n case SIGN_IN_STEPS['sso-callback']:\n return <SignInSSOCallback {...props} />;\n default:\n throw new ClerkElementsRuntimeError(`Invalid step name. Use: ${Object.keys(SIGN_IN_STEPS).join(',')}.`);\n }\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\n\nimport type { SignUpContinueProps } from './continue';\nimport { SignUpContinue } from './continue';\nimport type { SignUpRestrictedProps } from './restricted';\nimport { SignUpRestricted } from './restricted';\nimport type { SignUpStartProps } from './start';\nimport { SignUpStart } from './start';\nimport type { SignUpVerificationsProps } from './verifications';\nimport { SignUpVerifications } from './verifications';\n\nexport const SIGN_UP_STEPS = {\n start: 'start',\n continue: 'continue',\n verifications: 'verifications',\n restricted: 'restricted',\n} as const;\n\nexport type TSignUpStep = (typeof SIGN_UP_STEPS)[keyof typeof SIGN_UP_STEPS];\ntype StepWithProps<N extends TSignUpStep, T> = { name: N } & T;\n\nexport type SignUpStepProps =\n | StepWithProps<'start', SignUpStartProps>\n | StepWithProps<'continue', SignUpContinueProps>\n | StepWithProps<'verifications', SignUpVerificationsProps>\n | StepWithProps<'restricted', SignUpRestrictedProps>;\n\n/**\n * Render different steps of the sign-up flow. Initially the `'start'` step is rendered. Optionally, you can render additional fields in the `'continue'` step. Once a sign-up attempt has been created, `'verifications'` will be displayed.\n *\n * You typically want to place fields like username, password, or social providers in the `'start'` step. The `'continue'` step can hold inputs for username, first name/last name or other metadata. The `'verifications'` step is used to verify the user's information like an email verification. Once the user has been verified, the sign-up attempt will be completed.\n *\n * @param {string} name - Step name. Use `'start'`, `'continue'`, or `'verifications'`.\n *\n * @example\n * <SignUp.Root>\n * <SignUp.Step name='start' />\n * <SignUp.Step name='continue' />\n * <SignUp.Step name='verifications' />\n * </SignUp.Root>\n */\nexport function SignUpStep(props: SignUpStepProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_SignUpStep', { name: props.name }));\n\n switch (props.name) {\n case SIGN_UP_STEPS.start:\n return <SignUpStart {...props} />;\n case SIGN_UP_STEPS.continue:\n return <SignUpContinue {...props} />;\n case SIGN_UP_STEPS.verifications:\n return <SignUpVerifications {...props} />;\n case SIGN_UP_STEPS.restricted:\n return <SignUpRestricted {...props} />;\n default:\n throw new ClerkElementsRuntimeError(\n `Invalid step name. Use 'start', 'continue', 'verifications', or 'restricted'.`,\n );\n }\n}\n","import type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, SignInStrategy, Web3Provider } from '@clerk/types';\n\ntype Strategy = OAuthProvider | SamlStrategy | EnterpriseSSOStrategy | Web3Provider;\n\nexport function isProviderStrategyScope(value: string): value is Strategy {\n return value.startsWith('provider:');\n}\n\nexport function mapScopeToStrategy<T extends `provider:${Strategy}`>(scope: T): SignInStrategy {\n if (scope === 'provider:metamask') {\n return 'web3_metamask_signature';\n }\n if (scope === 'provider:coinbase_wallet') {\n return 'web3_coinbase_wallet_signature';\n }\n if (scope === 'provider:okx_wallet') {\n return 'web3_okx_wallet_signature';\n }\n\n if (scope === 'provider:saml') {\n return 'saml';\n }\n\n if (scope === 'provider:enterprise_sso') {\n return 'enterprise_sso';\n }\n\n const scopeWithoutPrefix = scope.replace('provider:', '') as OAuthProvider;\n\n return `oauth_${scopeWithoutPrefix}`;\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { useClerkRouter } from '@clerk/shared/router';\nimport type { ClerkOptions } from '@clerk/types';\nimport React from 'react';\n\ntype Destination = 'sign-in' | 'sign-up';\nexport interface LinkProps extends Omit<React.HTMLAttributes<HTMLAnchorElement>, 'children'> {\n navigate: Destination;\n children: React.ReactNode | ((props: { url: string }) => React.ReactNode);\n}\n\nconst paths: Record<Destination, keyof Pick<ClerkOptions, 'signInUrl' | 'signUpUrl'>> = {\n 'sign-in': 'signInUrl',\n 'sign-up': 'signUpUrl',\n};\n\n/**\n * The `<Link>` component is used to navigate between sign-in and sign-up flows.\n *\n * @param {Destination} navigate - The destination to navigate to.\n *\n * @example\n * ```tsx\n * <Link navigate=\"sign-in\">Sign in</Link>\n * ```\n * @example\n * ```tsx\n * <Link navigate=\"sign-in\">\n * {({ url }) => (\n * <NextLink href={url}>Sign in</NextLink>\n * )}\n * </Link>\n */\n\nexport function Link({ navigate, children, ...rest }: LinkProps) {\n const router = useClerkRouter();\n const clerk = useClerk();\n const destinationUrl = router.makeDestinationUrlWithPreservedQueryParameters(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clerk.__internal_getOption(paths[navigate])!,\n );\n\n if (typeof children === 'function') {\n return children({ url: destinationUrl });\n }\n\n return (\n <a\n onClick={e => {\n if (router) {\n e.preventDefault();\n router.push(destinationUrl);\n }\n }}\n href={destinationUrl}\n {...rest}\n >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EAAE,KAAK,cAAc,IAAI;AAEnG,MAAI,gBAAgB;AAEpB,MAAI,UAAU,UAAU;AAEtB,oBAAgB;AAAA,EAClB,WAAW,SAAS,wBAAwB,KAAK,GAAG;AAElD,oBAAgB,aAAa,gBAAgB,UAAa,aAAa,mBAAmB,KAAK;AAAA,EACjG,WAAW,OAAO;AAChB,oBAAgB,cAAc,MAAM,QAAQ,SAAS,EAAE,CAAgB,KAAK,UAAU;AAAA,EACxF,OAAO;AAEL,oBACE,sBAAsB,OAAO,KAAK,sBAAsB,UAAU,KAAK,sBAAsB,eAAe;AAAA,EAChH;AAEA,SAAO,SAAS,aAAa;AAC/B;;;AK1MA,IAAAC,iBAAyB;AACzB,IAAAC,iBAA+B;AA8C3B,IAAAC,uBAAA;AApCJ,IAAM,QAAkF;AAAA,EACtF,WAAW;AAAA,EACX,WAAW;AACb;AAoBO,SAAS,KAAK,EAAE,UAAU,UAAU,GAAG,KAAK,GAAc;AAC/D,QAAM,aAAS,+BAAe;AAC9B,QAAM,YAAQ,yBAAS;AACvB,QAAM,iBAAiB,OAAO;AAAA;AAAA,IAE5B,MAAM,qBAAqB,MAAM,QAAQ,CAAC;AAAA,EAC5C;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,SAAS,EAAE,KAAK,eAAe,CAAC;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,OAAK;AACZ,YAAI,QAAQ;AACV,YAAE,eAAe;AACjB,iBAAO,KAAK,cAAc;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,MAAM;AAAA,MACL,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":["import_react_form","React","import_react_form","React","import_react","React","_a","React","OTPInput","RadixControl","React","React","RadixControl","import_jsx_runtime","RadixField","RadixValidityState","import_react_form","React","React","import_jsx_runtime","DISPLAY_NAME","RadixFormMessage","DISPLAY_NAME","import_react_slot","React","import_jsx_runtime","DISPLAY_NAME","import_react","React","import_react","React","useContext","useSelector","useSelectorUnbound","import_jsx_runtime","DISPLAY_NAME","import_react_form","DISPLAY_NAME","RadixLabel","import_react_form","DISPLAY_NAME","RadixSubmit","import_react_slot","import_react","import_react","import_jsx_runtime","import_react","import_telemetry","import_react","import_react","import_telemetry","import_jsx_runtime","import_react","import_telemetry","import_jsx_runtime","import_jsx_runtime","import_react","import_router","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/react/common/index.ts","../../../src/react/common/form/field.tsx","../../../src/internals/machines/form/form.context.ts","../../../src/internals/machines/form/form.machine.ts","../../../src/internals/errors/index.ts","../../../src/internals/utils/inspector/index.ts","../../../src/react/common/form/hooks/use-field-feedback.ts","../../../src/react/common/form/hooks/use-field.ts","../../../src/react/common/form/hooks/use-field-context.ts","../../../src/react/common/form/types.ts","../../../src/react/common/form/hooks/use-field-state.ts","../../../src/react/common/form/hooks/use-global-errors.ts","../../../src/react/common/form/hooks/use-input.tsx","../../../src/react/hooks/use-password.hook.ts","../../../src/react/utils/generate-password-error-text.ts","../../../src/react/common/form/otp.tsx","../../../src/react/common/form/utils/enrich-field-state.ts","../../../src/react/common/form/utils/determine-input-type-from-name.ts","../../../src/react/common/form/hooks/use-previous.ts","../../../src/react/common/form/hooks/use-validity-state-context.ts","../../../src/react/common/form/field-error.tsx","../../../src/react/utils/is-react-fragment.ts","../../../src/react/common/form/field-state.tsx","../../../src/react/common/form/global-error.tsx","../../../src/react/common/form/input.tsx","../../../src/react/utils/create-context-from-actor-ref.ts","../../../src/react/sign-in/context/router.context.ts","../../../src/react/common/form/label.tsx","../../../src/react/common/form/submit.tsx","../../../src/react/common/connections.tsx","../../../src/react/hooks/use-third-party-provider.hook.ts","../../../src/utils/third-party-strategies.ts","../../../src/utils/clerk-js.ts","../../../src/react/sign-up/context/router.context.ts","../../../src/react/common/loading.tsx","../../../src/react/hooks/use-loading.hook.ts","../../../src/react/sign-in/step.tsx","../../../src/react/sign-up/step.tsx","../../../src/react/utils/map-scope-to-strategy.ts","../../../src/react/common/link.tsx"],"sourcesContent":["// Mark as a client-only package. This will error if you try to import it in a React Server Component.\nimport 'client-only';\n\nexport { Field, FieldError, FieldState, GlobalError, Input, Label, Submit } from '~/react/common/form';\nexport { Connection, Icon } from '~/react/common/connections';\nexport { Loading } from '~/react/common/loading';\nexport { Link } from '~/react/common/link';\n\nexport type {\n FormFieldErrorProps,\n FormErrorProps,\n FormErrorRenderProps,\n FormFieldProps,\n FormGlobalErrorProps,\n FormInputProps,\n FormProps,\n FormSubmitProps,\n} from '~/react/common/form';\nexport type { ConnectionProps, IconProps } from '~/react/common/connections';\nexport type { OTPInputSegmentStatus } from '~/react/common/form/otp';\n","import type { Autocomplete } from '@clerk/types';\nimport type { FormFieldProps as RadixFormFieldProps } from '@radix-ui/react-form';\nimport { Field as RadixField, ValidityState as RadixValidityState } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { useFormStore } from '~/internals/machines/form/form.context';\n\nimport { FieldContext, useField, useFieldState, ValidityStateContext } from './hooks';\nimport type { ClerkFieldId, FieldStates } from './types';\nimport { enrichFieldState } from './utils';\n\nconst DISPLAY_NAME = 'ClerkElementsField';\nconst DISPLAY_NAME_INNER = 'ClerkElementsFieldInner';\n\ntype FormFieldElement = React.ElementRef<typeof RadixField>;\nexport type FormFieldProps = Omit<RadixFormFieldProps, 'children'> & {\n name: Autocomplete<ClerkFieldId>;\n alwaysShow?: boolean;\n children: React.ReactNode | ((state: FieldStates) => React.ReactNode);\n};\n\n/**\n * Field is used to associate its child elements with a specific input. It automatically handles unique ID generation and associating the contained label and input elements.\n *\n * @param name - Give your `<Field>` a unique name inside the current form. If you choose one of the following names Clerk Elements will automatically set the correct type on the `<input />` element: `emailAddress`, `password`, `phoneNumber`, and `code`.\n * @param alwaysShow - Optional. When `true`, the field will always be renydered, regardless of its state. By default, a field is hidden if it's optional or if it's a filled-out required field.\n * @param {Function} children - A function that receives `state` as an argument. `state` is a union of `\"success\" | \"error\" | \"idle\" | \"warning\" | \"info\"`.\n *\n * @example\n * <Clerk.Field name=\"emailAddress\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input />\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"emailAddress\">\n * {(fieldState) => (\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input className={`text-${fieldState}`} />\n * )}\n * </Clerk.Field>\n */\nexport const Field = React.forwardRef<FormFieldElement, FormFieldProps>(({ alwaysShow, ...rest }, forwardedRef) => {\n const formRef = useFormStore();\n const formCtx = formRef.getSnapshot().context;\n // A field is marked as hidden if it's optional OR if it's a filled-out required field\n const isHiddenField = formCtx.progressive && Boolean(formCtx.hidden?.has(rest.name));\n\n // Only alwaysShow={true} should force behavior to render the field, on `undefined` or alwaysShow={false} the isHiddenField logic should take over\n const shouldHide = alwaysShow ? false : isHiddenField;\n\n return shouldHide ? null : (\n <FieldContext.Provider value={{ name: rest.name }}>\n <FieldInner\n {...rest}\n ref={forwardedRef}\n />\n </FieldContext.Provider>\n );\n});\n\nField.displayName = DISPLAY_NAME;\n\nconst FieldInner = React.forwardRef<FormFieldElement, FormFieldProps>((props, forwardedRef) => {\n const { children, ...rest } = props;\n const field = useField({ name: rest.name });\n const { state: fieldState } = useFieldState({ name: rest.name });\n\n return (\n <RadixField\n {...field.props}\n {...rest}\n ref={forwardedRef}\n >\n <RadixValidityState>\n {validity => {\n const enrichedFieldState = enrichFieldState(validity, fieldState);\n\n return (\n <ValidityStateContext.Provider value={validity}>\n {typeof children === 'function' ? children(enrichedFieldState) : children}\n </ValidityStateContext.Provider>\n );\n }}\n </RadixValidityState>\n </RadixField>\n );\n});\n\nFieldInner.displayName = DISPLAY_NAME_INNER;\n","import { createActorContext } from '@xstate/react';\nimport type { SnapshotFrom } from 'xstate';\n\nimport { FormMachine } from '~/internals/machines/form';\nimport { inspect } from '~/internals/utils/inspector';\n\nexport type SnapshotState = SnapshotFrom<typeof FormMachine>;\n\nconst FormMachineContext = createActorContext(FormMachine, { inspect });\n\nexport const FormStoreProvider = FormMachineContext.Provider;\nexport const useFormStore = FormMachineContext.useActorRef;\nexport const useFormSelector = FormMachineContext.useSelector;\n\n/**\n * Selects a global error, if it exists\n */\nexport const globalErrorsSelector = (state: SnapshotState) => state.context.errors;\n\n/**\n * Selects if a specific field has a value\n */\nexport const fieldValueSelector = (name: string | undefined) => (state: SnapshotState) =>\n name ? state.context.fields.get(name)?.value : '';\n\n/**\n * Selects if a specific field has a value\n */\nexport const fieldHasValueSelector = (name: string | undefined) => (state: SnapshotState) =>\n Boolean(fieldValueSelector(name)(state));\n\ntype MapValue<A> = A extends Map<any, infer V> ? V : never;\n\n/**\n * Selects field-specific feedback, if they exist\n *\n * We declare an explicit return type here because TypeScript's inference results in the subtype reduction of the\n * union used for feedback. Explicitly declaring the return type allows for all members of the union to be\n * included in the return type.\n */\nexport const fieldFeedbackSelector =\n (name: string | undefined) =>\n (state: SnapshotState): MapValue<SnapshotState['context']['fields']>['feedback'] | undefined =>\n name ? state.context.fields.get(name)?.feedback : undefined;\n","import { isClerkAPIResponseError, isKnownError, isMetamaskError } from '@clerk/shared/error';\nimport { snakeToCamel } from '@clerk/shared/underscore';\nimport type { ClerkAPIError } from '@clerk/types';\nimport type { MachineContext } from 'xstate';\nimport { assign, enqueueActions, setup } from 'xstate';\n\nimport { ClerkElementsError, ClerkElementsFieldError } from '~/internals/errors';\n\nimport type { FieldDetails, FormDefaultValues, FormFields } from './form.types';\n\nexport interface FormMachineContext extends MachineContext {\n defaultValues: FormDefaultValues;\n errors: ClerkElementsError[];\n fields: FormFields;\n hidden?: Set<string>;\n missing?: Set<string>;\n optional?: Set<string>;\n progressive: boolean;\n required?: Set<string>;\n}\n\nexport type FormMachineEvents =\n | { type: 'FIELD.ADD'; field: Pick<FieldDetails, 'name' | 'type' | 'value' | 'checked' | 'disabled'> }\n | { type: 'FIELD.REMOVE'; field: Pick<FieldDetails, 'name'> }\n | { type: 'FIELD.ENABLE'; field: Pick<FieldDetails, 'name'> }\n | { type: 'FIELD.DISABLE'; field: Pick<FieldDetails, 'name'> }\n | {\n type: 'MARK_AS_PROGRESSIVE';\n defaultValues: FormDefaultValues;\n missing: string[];\n optional: string[];\n required: string[];\n }\n | {\n type: 'PREFILL_DEFAULT_VALUES';\n defaultValues: FormDefaultValues;\n }\n | { type: 'UNMARK_AS_PROGRESSIVE' }\n | {\n type: 'FIELD.UPDATE';\n field: Pick<FieldDetails, 'name' | 'value' | 'checked' | 'disabled'>;\n }\n | { type: 'ERRORS.SET'; error: any }\n | { type: 'ERRORS.CLEAR' }\n | {\n type: 'FIELD.FEEDBACK.SET';\n field: Pick<FieldDetails, 'name' | 'feedback'>;\n }\n | {\n type: 'FIELD.FEEDBACK.CLEAR';\n field: Pick<FieldDetails, 'name'>;\n }\n | { type: 'FIELD.FEEDBACK.CLEAR.ALL' };\n\ntype FormMachineTypes = {\n events: FormMachineEvents;\n context: FormMachineContext;\n};\n\nexport type TFormMachine = typeof FormMachine;\n\n/**\n * A machine for managing form state.\n * This machine is used alongside our other, flow-specific machines and a reference to a spawned FormMachine actor is used in the flows to interact with the form state.\n */\nexport const FormMachine = setup({\n actions: {\n setGlobalErrors: assign({\n errors: (_, params: { errors: ClerkElementsError[] }) => [...params.errors],\n }),\n setFieldFeedback: assign({\n fields: ({ context }, params: Pick<FieldDetails, 'name' | 'feedback'>) => {\n if (!params.name) {\n throw new Error('Field name is required');\n }\n\n const fieldName = params.name;\n if (context.fields.has(fieldName)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n context.fields.get(fieldName)!.feedback = params.feedback;\n }\n\n return context.fields;\n },\n }),\n },\n types: {} as FormMachineTypes,\n}).createMachine({\n id: 'Form',\n context: () => ({\n defaultValues: new Map(),\n errors: [],\n fields: new Map(),\n progressive: false,\n }),\n on: {\n 'ERRORS.SET': {\n actions: enqueueActions(({ enqueue, event }) => {\n const isClerkAPIError = (err: any): err is ClerkAPIError => 'meta' in err;\n\n if (isKnownError(event.error)) {\n const fields: Record<string, ClerkElementsFieldError[]> = {};\n const globalErrors: ClerkElementsError[] = [];\n const errors = isClerkAPIResponseError(event.error) ? event.error?.errors : [event.error];\n\n for (const error of errors) {\n const name = isClerkAPIError(error) ? snakeToCamel(error.meta?.paramName) : null;\n\n if (!name || isMetamaskError(error)) {\n globalErrors.push(ClerkElementsError.fromAPIError(error));\n continue;\n }\n\n if (!fields[name]) {\n fields[name] = [];\n }\n\n fields[name]?.push(ClerkElementsFieldError.fromAPIError(error));\n }\n\n enqueue({\n type: 'setGlobalErrors',\n params: {\n errors: globalErrors,\n },\n });\n\n for (const field in fields) {\n enqueue({\n type: 'setFieldFeedback',\n params: {\n name: field,\n feedback: {\n type: 'error',\n message: fields[field][0],\n },\n },\n });\n }\n }\n }),\n },\n 'ERRORS.CLEAR': {\n actions: assign({\n errors: () => [],\n }),\n },\n 'FIELD.ADD': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n event.field.value = event.field.value || context.defaultValues.get(event.field.name) || undefined;\n\n context.fields.set(event.field.name, event.field);\n return context.fields;\n },\n }),\n },\n 'FIELD.UPDATE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.checked = event.field.checked;\n field.disabled = event.field.disabled ?? field.disabled;\n field.value = event.field.value;\n\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.DISABLE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.disabled = true;\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.ENABLE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n const field = context.fields.get(event.field.name);\n\n if (field) {\n field.disabled = false;\n context.fields.set(event.field.name, field);\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.REMOVE': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n\n context.fields.delete(event.field.name);\n return context.fields;\n },\n }),\n },\n 'FIELD.FEEDBACK.SET': {\n actions: [\n {\n type: 'setFieldFeedback',\n params: ({ event }) => event.field,\n },\n ],\n },\n 'FIELD.FEEDBACK.CLEAR': {\n actions: assign({\n fields: ({ context, event }) => {\n if (!event.field.name) {\n throw new Error('Field name is required');\n }\n if (context.fields.has(event.field.name)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n context.fields.get(event.field.name)!.feedback = undefined;\n }\n\n return context.fields;\n },\n }),\n },\n 'FIELD.FEEDBACK.CLEAR.ALL': {\n actions: assign({\n fields: ({ context }) => {\n context.fields.forEach(field => {\n field.feedback = undefined;\n });\n\n return context.fields;\n },\n }),\n },\n MARK_AS_PROGRESSIVE: {\n actions: assign(({ event }) => {\n const missing = new Set(event.missing);\n\n return {\n defaultValues: event.defaultValues,\n hidden: new Set([...event.required.filter(f => !missing.has(f)), ...event.optional]),\n missing,\n optional: new Set(event.optional),\n progressive: true,\n required: new Set(event.required),\n };\n }),\n },\n UNMARK_AS_PROGRESSIVE: {\n actions: assign({\n defaultValues: new Map(),\n hidden: undefined,\n missing: undefined,\n optional: undefined,\n progressive: false,\n required: undefined,\n }),\n },\n PREFILL_DEFAULT_VALUES: {\n actions: assign(({ event }) => {\n return {\n defaultValues: event.defaultValues,\n };\n }),\n },\n },\n});\n","// eslint-disable-next-line no-restricted-imports\nimport type { MetamaskError } from '@clerk/shared';\nimport type { ClerkAPIError } from '@clerk/types';\n\nexport abstract class ClerkElementsErrorBase extends Error {\n clerkError = true;\n clerkElementsError = true;\n rawMessage: string;\n\n constructor(\n readonly code: string,\n message: string,\n ) {\n super(message);\n\n this.name = 'ClerkElementsError';\n this.rawMessage = message;\n }\n\n toString() {\n return `[${this.name}]\\nCode: ${this.code}\\nMessage: ${this.message}`;\n }\n}\n\nexport class ClerkElementsError extends ClerkElementsErrorBase {\n static fromAPIError(error: ClerkAPIError | MetamaskError) {\n return new ClerkElementsError(\n error.code.toString(),\n // @ts-expect-error - Expected that longMessage isn't a property of MetamaskError\n error.longMessage || error.message,\n );\n }\n\n constructor(code: string, message: string) {\n super(code, message);\n this.name = 'ClerkElementsError';\n }\n}\n\nexport class ClerkElementsRuntimeError extends ClerkElementsErrorBase {\n constructor(message: string) {\n super('elements_runtime_error', message);\n this.name = 'ClerkElementsRuntimeError';\n }\n}\n\nexport class ClerkElementsFieldError extends ClerkElementsErrorBase {\n static fromAPIError(error: ClerkAPIError) {\n return new ClerkElementsFieldError(error.code, error.longMessage || error.message);\n }\n\n constructor(code: string, message: string) {\n super(code, message);\n this.name = 'ClerkElementsFieldError';\n }\n\n get validityState() {\n return this.code;\n }\n\n get forceMatch() {\n return true;\n }\n\n matchFn = () => true;\n}\n","import type { InspectionEvent, Observer } from 'xstate';\n\nimport { getInspector as getBrowserInspector } from './browser';\nimport { getInspector as getConsoleInspector } from './console';\n\nexport let inspect: Observer<InspectionEvent> | undefined;\n\nif (__DEV__) {\n inspect = getBrowserInspector() ?? getConsoleInspector();\n}\n\nconst inspector = {\n inspect,\n};\n\nexport default inspector;\n","import { type FieldDetails, fieldFeedbackSelector, useFormSelector } from '~/internals/machines/form';\n\nexport function useFieldFeedback({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const feedback = useFormSelector(fieldFeedbackSelector(name));\n\n return {\n feedback,\n };\n}\n","import { type FieldDetails, fieldHasValueSelector, useFormSelector } from '~/internals/machines/form';\n\nimport { useFieldFeedback } from './use-field-feedback';\n\nexport function useField({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const hasValue = useFormSelector(fieldHasValueSelector(name));\n const { feedback } = useFieldFeedback({ name });\n\n const shouldBeHidden = false; // TODO: Implement clerk-js utils\n const hasError = feedback ? feedback.type === 'error' : false;\n\n return {\n hasValue,\n props: {\n 'data-hidden': shouldBeHidden ? true : undefined,\n serverInvalid: hasError,\n },\n };\n}\n","import * as React from 'react';\n\nimport type { FieldDetails } from '~/internals/machines/form';\n\nexport const FieldContext = React.createContext<Pick<FieldDetails, 'name'> | null>(null);\nexport const useFieldContext = () => React.useContext(FieldContext);\n","import type { HTMLInputTypeAttribute } from 'react';\n\nimport type { ClerkElementsError } from '~/internals/errors';\n\n/** Extracted relevant fields from @clerk/types */\nexport type ClerkFieldId =\n | 'code'\n | 'confirmPassword'\n | 'currentPassword'\n | 'backup_code' // special case of `code`\n | 'emailAddress'\n | 'firstName'\n | 'identifier'\n | 'lastName'\n | 'name'\n | 'newPassword'\n | 'password'\n | 'phoneNumber'\n | 'username'\n | 'legalAccepted';\n\n/**\n * Possible types for the Clerk input element, several 'special' input types are included.\n */\nexport type ClerkInputType = HTMLInputTypeAttribute | 'otp';\n\nexport const FIELD_STATES = {\n success: 'success',\n error: 'error',\n idle: 'idle',\n warning: 'warning',\n info: 'info',\n} as const;\n\nexport type FieldStates = (typeof FIELD_STATES)[keyof typeof FIELD_STATES];\n\nexport const FIELD_VALIDITY = {\n valid: 'valid',\n invalid: 'invalid',\n} as const;\n\nexport type FieldValidity = (typeof FIELD_VALIDITY)[keyof typeof FIELD_VALIDITY];\n\nexport type FormErrorRenderProps = Pick<ClerkElementsError, 'code' | 'message'>;\n\ntype FormErrorPropsAsChild = {\n asChild?: true | never;\n children?: React.ReactElement | ((error: FormErrorRenderProps) => React.ReactNode);\n code?: string;\n};\n\ntype FormErrorPropsStd = {\n asChild?: false;\n children: React.ReactNode;\n code: string;\n};\n\nexport type FormErrorProps<T> = Omit<T, 'asChild' | 'children'> & (FormErrorPropsStd | FormErrorPropsAsChild);\n","import { type FieldDetails, fieldHasValueSelector, useFormSelector } from '~/internals/machines/form';\n\nimport { FIELD_STATES, type FieldStates } from '../types';\nimport { useFieldFeedback } from './use-field-feedback';\n\n/**\n * Given a field name, determine the current state of the field\n */\nexport function useFieldState({ name }: Partial<Pick<FieldDetails, 'name'>>) {\n const { feedback } = useFieldFeedback({ name });\n const hasValue = useFormSelector(fieldHasValueSelector(name));\n\n /**\n * If hasValue is false, the state should be idle\n * The rest depends on the feedback type\n */\n let state: FieldStates = FIELD_STATES.idle;\n\n if (!hasValue) {\n state = FIELD_STATES.idle;\n }\n\n switch (feedback?.type) {\n case 'error':\n state = FIELD_STATES.error;\n break;\n case 'warning':\n state = FIELD_STATES.warning;\n break;\n case 'info':\n state = FIELD_STATES.info;\n break;\n case 'success':\n state = FIELD_STATES.success;\n break;\n default:\n break;\n }\n\n return {\n state,\n };\n}\n","import { globalErrorsSelector, useFormSelector } from '~/internals/machines/form';\n\nexport function useGlobalErrors() {\n const errors = useFormSelector(globalErrorsSelector);\n\n return {\n errors,\n };\n}\n","import { Control as RadixControl, type FormControlProps } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { ClerkElementsFieldError } from '~/internals/errors';\nimport { fieldValueSelector, useFormSelector, useFormStore } from '~/internals/machines/form';\nimport { usePassword } from '~/react/hooks/use-password.hook';\n\nimport type { FormInputProps } from '../index';\nimport { OTP_LENGTH_DEFAULT, OTPInput, type OTPInputProps } from '../otp';\nimport { determineInputTypeFromName, enrichFieldState } from '../utils';\nimport { useFieldContext } from './use-field-context';\nimport { useFieldState } from './use-field-state';\nimport { usePrevious } from './use-previous';\nimport { useValidityStateContext } from './use-validity-state-context';\n\n// TODO: DRY\ntype PasswordInputProps = Exclude<FormControlProps, 'type'> & {\n validatePassword?: boolean;\n};\n\nexport function useInput({\n name: inputName,\n value: providedValue,\n checked: providedChecked,\n onChange: onChangeProp,\n onBlur: onBlurProp,\n onFocus: onFocusProp,\n type: inputType,\n ...passthroughProps\n}: FormInputProps) {\n // Inputs can be used outside a <Field> wrapper if desired, so safely destructure here\n const fieldContext = useFieldContext();\n const rawName = inputName || fieldContext?.name;\n const name = rawName === 'backup_code' ? 'code' : rawName; // `backup_code` is a special case of `code`\n const { state: fieldState } = useFieldState({ name });\n const validity = useValidityStateContext();\n\n if (!rawName || !name) {\n throw new Error('Clerk: <Input /> must be wrapped in a <Field> component or have a name prop.');\n }\n\n const ref = useFormStore();\n const [hasPassedValiation, setHasPassedValidation] = React.useState(false);\n\n const { validatePassword } = usePassword({\n onValidationComplexity: hasPassed => setHasPassedValidation(hasPassed),\n onValidationSuccess: () => {\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: { name, feedback: { type: 'success', message: 'Your password meets all the necessary requirements.' } },\n });\n },\n onValidationError: (error, codes) => {\n if (error) {\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: {\n name,\n feedback: {\n type: 'error',\n message: new ClerkElementsFieldError('password-validation-error', error),\n codes,\n },\n },\n });\n }\n },\n onValidationWarning: (warning, codes) =>\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: { name, feedback: { type: 'warning', message: warning, codes } },\n }),\n onValidationInfo: (info, codes) => {\n // TODO: If input is not focused, make this info an error\n ref.send({\n type: 'FIELD.FEEDBACK.SET',\n field: {\n name,\n feedback: {\n type: 'info',\n message: info,\n codes,\n },\n },\n });\n },\n });\n\n const value = useFormSelector(fieldValueSelector(name));\n const prevValue = usePrevious(value);\n const hasValue = Boolean(value);\n const type = inputType ?? determineInputTypeFromName(rawName);\n let nativeFieldType = type;\n let shouldValidatePassword = false;\n\n if (type === 'password' || type === 'text') {\n shouldValidatePassword = Boolean((passthroughProps as PasswordInputProps).validatePassword);\n }\n\n if (nativeFieldType === 'otp' || nativeFieldType === 'backup_code') {\n nativeFieldType = 'text';\n }\n\n // Register the field in the machine context\n React.useEffect(() => {\n if (!name) {\n return;\n }\n\n ref.send({\n type: 'FIELD.ADD',\n field: { name, type: nativeFieldType, value: providedValue, checked: providedChecked },\n });\n\n return () => ref.send({ type: 'FIELD.REMOVE', field: { name } });\n }, [ref]); // eslint-disable-line react-hooks/exhaustive-deps\n\n React.useEffect(() => {\n if (!name) {\n return;\n }\n\n if (\n (type === 'checkbox' && providedChecked !== undefined) ||\n (type !== 'checkbox' && providedValue !== undefined)\n ) {\n ref.send({\n type: 'FIELD.UPDATE',\n field: { name, value: providedValue, checked: providedChecked },\n });\n }\n }, [name, type, ref, providedValue, providedChecked]);\n\n // Register the onChange handler for field updates to persist to the machine context\n const onChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n onChangeProp?.(event);\n if (!name) {\n return;\n }\n ref.send({ type: 'FIELD.UPDATE', field: { name, value: event.target.value, checked: event.target.checked } });\n if (shouldValidatePassword) {\n validatePassword(event.target.value);\n }\n },\n [ref, name, onChangeProp, shouldValidatePassword, validatePassword],\n );\n\n const onBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onBlurProp?.(event);\n if (shouldValidatePassword && event.target.value !== prevValue) {\n validatePassword(event.target.value);\n }\n },\n [onBlurProp, shouldValidatePassword, validatePassword, prevValue],\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onFocusProp?.(event);\n if (shouldValidatePassword && event.target.value !== prevValue) {\n validatePassword(event.target.value);\n }\n },\n [onFocusProp, shouldValidatePassword, validatePassword, prevValue],\n );\n\n // TODO: Implement clerk-js utils\n const shouldBeHidden = false;\n\n const Element = type === 'otp' ? OTPInput : RadixControl;\n\n let props = {};\n if (type === 'otp') {\n const p = passthroughProps as Omit<OTPInputProps, 'name' | 'value' | 'type'>;\n const length = p.length || OTP_LENGTH_DEFAULT;\n\n props = {\n 'data-otp-input': true,\n autoComplete: 'one-time-code',\n inputMode: 'numeric',\n pattern: `[0-9]{${length}}`,\n minLength: length,\n maxLength: length,\n // Enhanced naming for better password manager detection\n name: 'otp',\n id: 'otp-input',\n // Additional attributes for password manager compatibility\n 'data-testid': 'otp-input',\n role: 'textbox',\n 'aria-label': 'Enter verification code',\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n // Only accept numbers\n event.currentTarget.value = event.currentTarget.value.replace(/\\D+/g, '');\n onChange(event);\n },\n type: 'text',\n spellCheck: false,\n };\n } else if (type === 'backup_code') {\n props = {\n autoComplete: 'off',\n type: 'text',\n spellCheck: false,\n };\n } else if (type === 'password' && shouldValidatePassword) {\n props = {\n 'data-has-passed-validation': hasPassedValiation ? true : undefined,\n };\n }\n\n // Filter out invalid props that should not be passed through\n // @ts-expect-error - Doesn't know about type narrowing by type here\n const { validatePassword: _1, ...rest } = passthroughProps;\n\n return {\n Element,\n props: {\n type,\n value: value ?? '',\n onChange,\n onBlur,\n onFocus,\n 'data-hidden': shouldBeHidden ? true : undefined,\n 'data-has-value': hasValue ? true : undefined,\n 'data-state': enrichFieldState(validity, fieldState),\n ...props,\n ...rest,\n },\n };\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { noop } from '@clerk/shared/utils';\nimport type { PasswordSettingsData, PasswordValidation } from '@clerk/types';\nimport * as React from 'react';\n\nimport type { ErrorCodeOrTuple } from '../utils/generate-password-error-text';\nimport { generatePasswordErrorText } from '../utils/generate-password-error-text';\n\n// This hook should mimic the already existing usePassword hook in the clerk-js package\n// @see packages/clerk-js/src/ui/hooks/usePassword.ts\n\nexport type PasswordConfig = Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>;\n\ntype UsePasswordCallbacks = {\n onValidationError?: (error: string | undefined, codes: ErrorCodeOrTuple[]) => void;\n onValidationSuccess?: () => void;\n onValidationWarning?: (warning: string, codes: ErrorCodeOrTuple[]) => void;\n onValidationInfo?: (info: string, codes: ErrorCodeOrTuple[]) => void;\n onValidationComplexity?: (b: boolean) => void;\n};\n\nexport const usePassword = (callbacks?: UsePasswordCallbacks) => {\n const clerk = useClerk();\n const passwordSettings = clerk.__unstable__environment?.userSettings.passwordSettings as PasswordSettingsData;\n const { disable_hibp, min_zxcvbn_strength, show_zxcvbn, ...config } = passwordSettings || {};\n\n const {\n onValidationError = noop,\n onValidationSuccess = noop,\n onValidationWarning = noop,\n onValidationInfo = noop,\n onValidationComplexity,\n } = callbacks || {};\n\n const onValidate = React.useCallback(\n (res: PasswordValidation) => {\n /**\n * Failed complexity rules always have priority\n */\n if (res.complexity) {\n if (Object.values(res?.complexity).length > 0) {\n const { message, codes } = generatePasswordErrorText({\n config,\n failedValidations: res.complexity,\n });\n\n if (res.complexity?.min_length) {\n return onValidationInfo(message, codes);\n }\n return onValidationError(message, codes);\n }\n }\n\n /**\n * Failed strength\n */\n if (res?.strength?.state === 'fail') {\n const keys = res.strength.keys;\n const error = JSON.stringify(keys);\n return onValidationError(error, keys);\n }\n\n /**\n * Password meets all criteria but could be stronger\n */\n if (res?.strength?.state === 'pass') {\n const keys = res.strength.keys;\n const error = JSON.stringify(keys);\n return onValidationWarning(error, keys);\n }\n\n /**\n * Password meets all criteria and is strong\n */\n return onValidationSuccess();\n },\n [callbacks, config],\n );\n\n const validatePassword = React.useMemo(() => {\n return (password: string) => {\n return clerk.client.signUp.validatePassword(password, {\n onValidation: onValidate,\n onValidationComplexity,\n });\n };\n }, [onValidate]);\n\n return {\n validatePassword,\n };\n};\n","import type { Autocomplete, PasswordSettingsData } from '@clerk/types';\n\n// Copied from packages/clerk-js/src/ui/hooks/usePasswordComplexity.ts\n\ntype ComplexityErrors = {\n [key in keyof Partial<Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>>]?: boolean;\n};\n\nexport type ComplexityConfig = Omit<PasswordSettingsData, 'disable_hibp' | 'min_zxcvbn_strength' | 'show_zxcvbn'>;\n\nconst errorMessages: Record<keyof Omit<ComplexityErrors, 'allowed_special_characters'>, [string, string] | string> = {\n max_length: ['less than %length% characters', 'length'],\n min_length: ['%length% or more characters', 'length'],\n require_numbers: 'a number',\n require_lowercase: 'a lowercase letter',\n require_uppercase: 'an uppercase letter',\n require_special_char: 'a special character',\n};\n\nexport type ErrorMessagesKey = Autocomplete<keyof typeof errorMessages>;\nexport type ErrorCodeOrTuple = ErrorMessagesKey | [ErrorMessagesKey, Record<string, string | number>];\n\nconst createListFormat = (message: string[]) => {\n let messageWithPrefix: string;\n if ('ListFormat' in Intl) {\n const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });\n messageWithPrefix = formatter.format(message);\n } else {\n messageWithPrefix = message.join(', ');\n }\n\n return messageWithPrefix;\n};\n\ntype GeneratePasswordErrorTextProps = {\n config: ComplexityConfig;\n failedValidations: ComplexityErrors | undefined;\n};\n\n/**\n * This function builds a single entry in the error array returned from generatePasswordErrorText. It returns either a\n * string or a tuple containing the error code and relevant entries from the instance's password complexity conrfig.\n * @param key The string respresentation of a possible error during password validation\n * @param config The instance's password complexity configuration\n * @returns The error code or a tuple containing the error code and relevant entries from the config\n */\nfunction buildErrorTuple(key: ErrorMessagesKey, config: ComplexityConfig): ErrorCodeOrTuple {\n switch (key) {\n case 'max_length':\n return [key, { max_length: config.max_length }];\n case 'min_length':\n return [key, { min_length: config.min_length }];\n case 'require_special_char':\n return [key, { allowed_special_characters: config.allowed_special_characters }];\n default:\n return key;\n }\n}\n\nexport const generatePasswordErrorText = ({ config, failedValidations }: GeneratePasswordErrorTextProps) => {\n const codes: ErrorCodeOrTuple[] = [];\n\n if (!failedValidations || Object.keys(failedValidations).length === 0) {\n return {\n codes,\n message: '',\n };\n }\n\n // show min length error first by itself\n const hasMinLengthError = failedValidations?.min_length || false;\n\n const messages = Object.entries(failedValidations)\n .filter(k => (hasMinLengthError ? k[0] === 'min_length' : true))\n .filter(([, v]) => !!v)\n .map(([k]) => {\n const entry = k as keyof typeof errorMessages;\n const errorTuple = buildErrorTuple(entry, config);\n codes.push(errorTuple);\n const errorKey = errorMessages[entry];\n\n if (Array.isArray(errorKey)) {\n const [msg, replaceValue] = errorKey;\n return msg.replace(`%${replaceValue}%`, config[k as keyof ComplexityConfig] as string);\n }\n return errorKey;\n });\n\n const messageWithPrefix = createListFormat(messages);\n\n return {\n codes,\n message: `Your password must contain ${messageWithPrefix}.`,\n };\n};\n","import { Control as RadixControl } from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport type { FormControlProps } from '~/react/common/form';\n\nexport type OTPInputProps = Exclude<\n FormControlProps,\n 'type' | 'autoComplete' | 'minLength' | 'maxLength' | 'inputMode' | 'pattern' | 'spellCheck'\n> & {\n render?: (props: { value: string; status: OTPInputSegmentStatus; index: number }) => React.ReactNode;\n length?: number;\n autoSubmit?: boolean;\n passwordManagerOffset?: number;\n};\n\ntype SelectionRange = readonly [start: number | null, end: number | null];\nconst ZERO: SelectionRange = [0, 0];\nconst OUTSIDE: SelectionRange = [-1, -1];\n\nexport const OTP_LENGTH_DEFAULT = 6;\nconst PASSWORD_MANAGER_OFFSET_DEFAULT = 40;\n\n/**\n * The status of a single segment element in the OTP input\n */\nexport type OTPInputSegmentStatus = 'none' | 'cursor' | 'selected' | 'hovered';\n\n/**\n * If the render prop is provided, a custom segmented input will be rendered. Otherwise a standard input will be rendered.\n */\nexport const OTPInput = React.forwardRef<HTMLInputElement, OTPInputProps>(function OTPInput(props, ref) {\n const { render, length, autoSubmit, ...rest } = props;\n const hasRenderProp = typeof render !== 'undefined';\n\n if (hasRenderProp) {\n return (\n <OTPInputSegmented\n {...rest}\n ref={ref}\n render={render}\n length={length}\n autoSubmit={autoSubmit}\n />\n );\n }\n\n return (\n <OTPInputStandard\n {...rest}\n ref={ref}\n length={length}\n autoSubmit={autoSubmit}\n />\n );\n});\n\n/**\n * Standard `<input />` element that receives the same props as the OTPInput component except for the render prop.\n */\nconst OTPInputStandard = React.forwardRef<HTMLInputElement, Omit<OTPInputProps, 'render'>>(\n function OTPInput(props, ref) {\n const { length = OTP_LENGTH_DEFAULT, autoSubmit = false, ...rest } = props;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n // This ensures we can access innerRef internally while still exposing it via the ref prop\n React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement, []);\n\n // Fire the requestSubmit callback when the input has the required length and autoSubmit is enabled\n React.useEffect(() => {\n if (String(props.value).length === length && autoSubmit) {\n innerRef.current?.form?.requestSubmit();\n }\n }, [props.value, length, autoSubmit]);\n\n return (\n <RadixControl\n ref={innerRef}\n {...rest}\n data-otp-input-standard\n />\n );\n },\n);\n\n/**\n * A custom input component to handle accepting OTP codes. An invisible input element is used to capture input and handle native input\n * interactions, while the provided render prop is used to visually render the input's contents.\n */\nconst OTPInputSegmented = React.forwardRef<HTMLInputElement, Required<Pick<OTPInputProps, 'render'>> & OTPInputProps>(\n function OTPInput(props, ref) {\n const {\n className: userProvidedClassName,\n render,\n length = OTP_LENGTH_DEFAULT,\n autoSubmit = false,\n passwordManagerOffset = PASSWORD_MANAGER_OFFSET_DEFAULT,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n const [selectionRange, setSelectionRange] = React.useState<SelectionRange>(props.autoFocus ? ZERO : OUTSIDE);\n const [isHovering, setIsHovering] = React.useState(false);\n\n const isFocused = () => document.activeElement === innerRef.current;\n\n // This ensures we can access innerRef internally while still exposing it via the ref prop\n React.useImperativeHandle(ref, () => innerRef.current as HTMLInputElement, []);\n\n /**\n * A layout effect is used here to avoid any perceived visual lag when changing the selection\n * This effect ensures that when deleting characters from the input the selection is updated\n */\n React.useLayoutEffect(() => {\n if (document.activeElement !== innerRef.current) {\n return;\n }\n setSelectionRange(cur => selectionRangeUpdater(cur, innerRef));\n }, [props.value]);\n\n /**\n * Attach a selectionchange handler on the document during the capture phase to the selection range is updated\n * immediately.\n *\n * One concrete example, if using onSelect on the input, the handler wouldn't fire when pressing cmd + left/right arrow.\n */\n React.useEffect(() => {\n function onSelectionChange() {\n if (!isFocused()) {\n return;\n }\n setSelectionRange(cur => selectionRangeUpdater(cur, innerRef));\n }\n\n document.addEventListener('selectionchange', onSelectionChange, { capture: true });\n return () => document.removeEventListener('selectionchange', onSelectionChange);\n }, []);\n\n // Fire the requestSubmit callback when the input has the required length and autoSubmit is enabled\n React.useEffect(() => {\n if (String(props.value).length === length && autoSubmit) {\n innerRef.current?.form?.requestSubmit();\n }\n }, [props.value, length, autoSubmit]);\n\n return (\n <div\n data-otp-input-wrapper\n style={wrapperStyle}\n >\n {/* We can't target pseudo-elements with the style prop, so we inject a tag here */}\n <style>{`\n input[data-otp-input-segmented]::selection {\n color: transparent;\n background-color: transparent;\n }\n `}</style>\n <RadixControl\n data-otp-input-segmented\n ref={innerRef}\n {...rest}\n onFocus={event => {\n // Place the caret at the end of the current value\n if (innerRef.current) {\n const start = Math.min(innerRef.current.value.length, length - 1);\n const end = innerRef.current.value.length;\n innerRef.current.setSelectionRange(start, end);\n setSelectionRange([start, end]);\n }\n rest?.onFocus?.(event);\n }}\n onBlur={event => {\n setSelectionRange([-1, -1]);\n rest?.onBlur?.(event);\n }}\n onMouseOver={event => {\n if (!isFocused()) {\n setIsHovering(true);\n }\n props.onMouseOver?.(event);\n }}\n onMouseLeave={event => {\n setIsHovering(false);\n props.onMouseLeave?.(event);\n }}\n style={{\n ...inputStyle,\n clipPath: `inset(0 calc(1ch + ${passwordManagerOffset}px) 0 0)`,\n width: `calc(100% + 1ch + ${passwordManagerOffset}px)`,\n }}\n />\n <div\n className={userProvidedClassName}\n aria-hidden\n style={segmentWrapperStyle}\n >\n {Array.from({ length }).map((_, i) => {\n const isHovered = isHovering && !isFocused();\n const isCursor = selectionRange[0] === selectionRange[1] && selectionRange[0] === i;\n const isSelected = (selectionRange[0] ?? -1) <= i && (selectionRange[1] ?? -1) > i;\n\n return (\n <React.Fragment key={`otp-segment-${i}`}>\n {render({\n value: String(props.value)[i] || '',\n status: isHovered ? 'hovered' : isCursor ? 'cursor' : isSelected ? 'selected' : 'none',\n index: i,\n })}\n </React.Fragment>\n );\n })}\n </div>\n </div>\n );\n },\n);\n\n/**\n * Handle updating the input selection range to ensure a single character is selected when moving the cursor, or if the input value changes.\n */\nfunction selectionRangeUpdater(cur: SelectionRange, inputRef: React.RefObject<HTMLInputElement>) {\n let updated: [number, number, HTMLInputElement['selectionDirection']] = [\n inputRef.current?.selectionStart ?? 0,\n inputRef.current?.selectionEnd ?? 0,\n inputRef.current?.selectionDirection ?? null,\n ];\n\n // Abort unnecessary updates\n if (cur[0] === updated[0] && cur[1] === updated[1]) {\n return cur;\n }\n\n // ensures that forward selection works properly when landing on the first character\n if (updated[0] === 0 && updated[1] === 1) {\n updated[2] = 'forward';\n }\n\n // When moving the selection, we want to select either the previous or next character instead of only moving the cursor.\n // If the start and end indices are the same, it means only the cursor has moved and we need to make a decision on which character to select.\n if (updated[0] === updated[1]) {\n if (updated[0] > 0 && cur[0] === updated[0] && cur[1] === updated[0] + 1) {\n updated = [updated[0] - 1, updated[1], 'backward'];\n } else if (typeof inputRef.current?.value[updated[0]] !== 'undefined') {\n updated = [updated[0], updated[1] + 1, 'backward'];\n } else if (updated[0] >= OTP_LENGTH_DEFAULT) {\n updated = [updated[0] - 1, updated[1], 'backward'];\n }\n }\n\n inputRef.current?.setSelectionRange(updated[0], updated[1], updated[2] ?? undefined);\n\n return [updated[0], updated[1]] satisfies SelectionRange;\n}\n\nconst wrapperStyle = {\n position: 'relative',\n userSelect: 'none',\n} satisfies React.CSSProperties;\n\nconst inputStyle = {\n display: 'block',\n background: 'transparent',\n opacity: 0,\n outline: 'transparent solid 0px',\n appearance: 'none',\n color: 'transparent',\n position: 'absolute',\n inset: 0,\n caretColor: 'transparent',\n border: '0px solid transparent',\n // width is handled inline\n height: '100%',\n letterSpacing: '-1rem',\n} satisfies React.CSSProperties;\n\nconst segmentWrapperStyle = {\n zIndex: 1,\n pointerEvents: 'none',\n} satisfies React.CSSProperties;\n","import { FIELD_STATES, type FieldStates } from '../types';\n\n/**\n * Radix can return the ValidityState object, which contains the validity of the field. We need to merge this with our existing fieldState.\n * When the ValidityState is valid: false, the fieldState should be overriden. Otherwise, it shouldn't change at all.\n * @see https://www.radix-ui.com/primitives/docs/components/form#validitystate\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n */\nexport function enrichFieldState(validity: ValidityState | undefined, fieldState: FieldStates) {\n return validity?.valid === false ? FIELD_STATES.error : fieldState;\n}\n","import type { Autocomplete } from '@clerk/types';\nimport type { FormFieldProps as RadixFormFieldProps } from '@radix-ui/react-form';\n\nimport type { ClerkFieldId, FieldStates } from '../types';\n\n// TODO: Move this to a shared location\ntype FormFieldProps = Omit<RadixFormFieldProps, 'children'> & {\n name: Autocomplete<ClerkFieldId>;\n alwaysShow?: boolean;\n children: React.ReactNode | ((state: FieldStates) => React.ReactNode);\n};\n\nexport function determineInputTypeFromName(name: FormFieldProps['name']) {\n if (name === 'password' || name === 'confirmPassword' || name === 'currentPassword' || name === 'newPassword') {\n return 'password' as const;\n }\n if (name === 'emailAddress') {\n return 'email' as const;\n }\n if (name === 'phoneNumber') {\n return 'tel' as const;\n }\n if (name === 'code') {\n return 'otp' as const;\n }\n if (name === 'backup_code') {\n return 'backup_code' as const;\n }\n\n return 'text' as const;\n}\n","import * as React from 'react';\n\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = React.useRef<T>();\n\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import * as React from 'react';\n\nexport const ValidityStateContext = React.createContext<ValidityState | undefined>(undefined);\nexport const useValidityStateContext = () => React.useContext(ValidityStateContext);\n","import type { FormMessageProps as RadixFormMessageProps } from '@radix-ui/react-form';\nimport { FormMessage as RadixFormMessage } from '@radix-ui/react-form';\nimport { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport { isReactFragment } from '~/react/utils/is-react-fragment';\n\nimport { useFieldContext, useFieldFeedback } from './hooks';\nimport type { FormErrorProps } from './types';\n\nconst DISPLAY_NAME = 'ClerkElementsFieldError';\n\nexport type FormFieldErrorProps = FormErrorProps<RadixFormMessageProps & { name?: string }>;\ntype FormFieldErrorElement = React.ElementRef<typeof RadixFormMessage>;\n\n/**\n * FieldError renders error messages associated with a specific field. By default, the error's message will be rendered in an unstyled `<span>`. Optionally, the `children` prop accepts a function to completely customize rendering.\n *\n * @param {string} [name] - Used to target a specific field by name when rendering outside of a `<Field>` component.\n * @param {Function} [children] - A function that receives `message` and `code` as arguments.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.FieldError />\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.FieldError>\n * {({ message, code }) => (\n * <span data-error-code={code}>{message}</span>\n * )}\n * </Clerk.FieldError>\n * </Clerk.Field>\n */\nexport const FieldError = React.forwardRef<FormFieldErrorElement, FormFieldErrorProps>(\n ({ asChild = false, children, code, name, ...rest }, forwardedRef) => {\n const fieldContext = useFieldContext();\n const rawFieldName = fieldContext?.name || name;\n const fieldName = rawFieldName === 'backup_code' ? 'code' : rawFieldName;\n const { feedback } = useFieldFeedback({ name: fieldName });\n\n if (!(feedback?.type === 'error')) {\n return null;\n }\n\n const error = feedback.message;\n\n if (!error) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'span';\n const child = typeof children === 'function' ? children(error) : children;\n\n // const forceMatch = code ? error.code === code : undefined; // TODO: Re-add when Radix Form is updated\n\n if (isReactFragment(child)) {\n throw new ClerkElementsRuntimeError('<FieldError /> cannot render a Fragment as a child.');\n }\n\n return (\n <RadixFormMessage\n data-error-code={error.code}\n // forceMatch={forceMatch}\n {...rest}\n ref={forwardedRef}\n asChild\n >\n <Comp>{child || error.message}</Comp>\n </RadixFormMessage>\n );\n },\n);\n\nFieldError.displayName = DISPLAY_NAME;\n","import * as React from 'react';\n\nexport function isReactFragment(node: React.ReactNode) {\n return React.isValidElement(node) && node.type === React.Fragment;\n}\n","import { ClerkElementsFieldError } from '~/internals/errors';\nimport type { ErrorCodeOrTuple } from '~/react/utils/generate-password-error-text';\n\nimport { useFieldContext, useFieldFeedback, useFieldState, useValidityStateContext } from './hooks';\nimport type { FieldStates } from './types';\nimport { enrichFieldState } from './utils';\n\ntype FieldStateRenderFn = {\n children: (state: {\n state: FieldStates;\n message: string | undefined;\n codes: ErrorCodeOrTuple[] | undefined;\n }) => React.ReactNode;\n};\n\nconst DISPLAY_NAME = 'ClerkElementsFieldState';\n\n/**\n * Programmatically access the state of the wrapping `<Field>`. Useful for implementing animations when direct access to the state value is necessary.\n *\n * @param {Function} children - A function that receives `state`, `message`, and `codes` as an argument. `state` will is a union of `\"success\" | \"error\" | \"idle\" | \"warning\" | \"info\"`. `message` will be the corresponding message, e.g. error message. `codes` will be an array of keys that were used to generate the password validation messages. This prop is only available when the field is of type `password` and has `validatePassword` set to `true`.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.FieldState>\n * {({ state }) => (\n * <Clerk.Input className={`text-${state}`} />\n * )}\n * </Clerk.FieldState>\n * </Clerk.Field>\n *\n * @example\n * <Clerk.Field name=\"password\">\n * <Clerk.Label>Password</Clerk.Label>\n * <Clerk.Input validatePassword />\n * <Clerk.FieldState>\n * {({ state, message, codes }) => (\n * <pre>Field state: {state}</pre>\n * <pre>Field msg: {message}</pre>\n * <pre>Pwd keys: {codes.join(', ')}</pre>\n * )}\n * </Clerk.FieldState>\n * </Clerk.Field>\n */\nexport function FieldState({ children }: FieldStateRenderFn) {\n const field = useFieldContext();\n const { feedback } = useFieldFeedback({ name: field?.name });\n const { state } = useFieldState({ name: field?.name });\n const validity = useValidityStateContext();\n\n const message = feedback?.message instanceof ClerkElementsFieldError ? feedback.message.message : feedback?.message;\n const codes = feedback?.codes;\n\n const fieldState = { state: enrichFieldState(validity, state), message, codes };\n\n return children(fieldState);\n}\n\nFieldState.displayName = DISPLAY_NAME;\n","import { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport { isReactFragment } from '~/react/utils/is-react-fragment';\n\nimport { useGlobalErrors } from './hooks';\nimport type { FormErrorProps } from './types';\n\nconst DISPLAY_NAME = 'ClerkElementsGlobalError';\n\ntype FormGlobalErrorElement = React.ElementRef<'div'>;\nexport type FormGlobalErrorProps = FormErrorProps<React.ComponentPropsWithoutRef<'div'>>;\n\n/**\n * Used to render errors that are returned from Clerk's API, but that are not associated with a specific form field. By default, will render the error's message wrapped in a `<div>`. Optionally, the `children` prop accepts a function to completely customize rendering. Must be placed **inside** components like `<SignIn>`/`<SignUp>` to have access to the underlying form state.\n *\n * @param {string} [code] - Forces the message with the matching code to be shown. This is useful when using server-side validation.\n * @param {Function} [children] - A function that receives `message` and `code` as arguments.\n * @param {boolean} [asChild] - If `true`, `<GlobalError>` will render as its child element, passing along any necessary props.\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError />\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError code=\"user_locked\">Your custom error message.</Clerk.GlobalError>\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Root>\n * <Clerk.GlobalError>\n * {({ message, code }) => (\n * <span data-error-code={code}>{message}</span>\n * )}\n * </Clerk.GlobalError>\n * </SignIn.Root>\n */\nexport const GlobalError = React.forwardRef<FormGlobalErrorElement, FormGlobalErrorProps>(\n ({ asChild = false, children, code, ...rest }, forwardedRef) => {\n const { errors } = useGlobalErrors();\n\n const error = errors?.[0];\n\n if (!error || (code && error.code !== code)) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'div';\n const child = typeof children === 'function' ? children(error) : children;\n\n if (isReactFragment(child)) {\n throw new ClerkElementsRuntimeError('<GlobalError /> cannot render a Fragment as a child.');\n }\n\n return (\n <Comp\n role='alert'\n {...rest}\n ref={forwardedRef}\n >\n {child || error.message}\n </Comp>\n );\n },\n);\n\nGlobalError.displayName = DISPLAY_NAME;\n","import { logger } from '@clerk/shared/logger';\nimport { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\nimport type {\n Control as RadixControl,\n FormControlProps,\n FormControlProps as RadixFormControlProps,\n} from '@radix-ui/react-form';\nimport * as React from 'react';\n\nimport { SignInRouterCtx } from '~/react/sign-in/context';\nimport { useSignInPasskeyAutofill } from '~/react/sign-in/context/router.context';\n\nimport { useInput } from './hooks';\nimport type { OTPInputProps } from './otp';\n\nconst DISPLAY_NAME = 'ClerkElementsInput';\nconst DISPLAY_NAME_PASSKEYS_AUTOFILL = 'ClerkElementsInputWithPasskeyAutofill';\n\ntype PasswordInputProps = Exclude<FormControlProps, 'type'> & {\n validatePassword?: boolean;\n};\n\nexport type FormInputProps =\n | RadixFormControlProps\n | ({ type: 'otp'; render: OTPInputProps['render'] } & Omit<OTPInputProps, 'asChild'>)\n | ({ type: 'otp'; render?: undefined } & OTPInputProps)\n // Usecase: Toggle the visibility of the password input, therefore 'password' and 'text' are allowed\n | ({ type: 'password' | 'text' } & PasswordInputProps);\n\n/**\n * Handles rendering of `<input>` elements within Clerk's flows. Supports special `type` prop values to render input types that are unique to authentication and user management flows. Additional props will be passed through to the `<input>` element.\n *\n * @param {boolean} [asChild] - If true, `<Input />` will render as its child element, passing along any necessary props.\n * @param {string} [name] - Used to target a specific field by name when rendering outside of a `<Field>` component.\n *\n * @example\n * <Clerk.Field name=\"identifier\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input type=\"email\" autoComplete=\"email\" className=\"emailInput\" />\n * </Clerk.Field>\n *\n * @param {Number} [length] - The length of the OTP input. Defaults to 6.\n * @param {Number} [passwordManagerOffset] - Password managers place their icon inside an `<input />`. This default behaviour is not desirable when you use the render prop to display N distinct element. With this prop you can increase the width of the `<input />` so that the icon is rendered outside the OTP inputs.\n * @param {string} [type] - Type of control to render. Supports a special `'otp'` type for one-time password inputs. If the wrapping `<Field>` component has `name='code'`, the type will default to `'otp'`. With the `'otp'` type, the input will have a pattern and length set to 6 by default and render a single `<input />` element.\n *\n * @example\n * <Clerk.Field name=\"code\">\n * <Clerk.Label>Email code</Clerk.Label>\n * <Clerk.Input type=\"otp\" />\n * </Clerk.Field>\n *\n * @param {Function} [render] - Optionally, you can use a render prop that controls how each individual character is rendered. If no `render` prop is provided, a single text `<input />` will be rendered.\n *\n * @example\n * <Clerk.Field name=\"code\">\n * <Clerk.Label>Email code</Clerk.Label>\n * <Clerk.Input\n * type=\"otp\"\n * render={({ value, status }) => <span data-status={status}>{value}</span>}\n * />\n * </Clerk.Field>\n */\nexport const Input = React.forwardRef<React.ElementRef<typeof RadixControl>, FormInputProps>(\n (props: FormInputProps, forwardedRef) => {\n const clerk = useClerk();\n const field = useInput(props);\n\n const hasPasskeyAutofillProp = Boolean(field.props.autoComplete?.includes('webauthn'));\n const allowedTypeForPasskey = (['text', 'email', 'tel'] as FormInputProps['type'][]).includes(field.props.type);\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n\n clerk.telemetry?.record(\n eventComponentMounted('Elements_Input', {\n type: props.type ?? false,\n // @ts-expect-error - Depending on type the props can be different\n render: Boolean(props?.render),\n // @ts-expect-error - Depending on type the props can be different\n asChild: Boolean(props?.asChild),\n // @ts-expect-error - Depending on type the props can be different\n validatePassword: Boolean(props?.validatePassword),\n }),\n );\n\n if (signInRouterRef && hasPasskeyAutofillProp && allowedTypeForPasskey) {\n return (\n <InputWithPasskeyAutofill\n ref={forwardedRef}\n {...props}\n />\n );\n }\n\n if (hasPasskeyAutofillProp && !allowedTypeForPasskey) {\n logger.warnOnce(\n `<Input autoComplete=\"webauthn\"> can only be used with <Input type=\"text\"> or <Input type=\"email\">`,\n );\n } else if (hasPasskeyAutofillProp) {\n logger.warnOnce(\n `<Input autoComplete=\"webauthn\"> can only be used inside <SignIn> in order to trigger a sign-in attempt, otherwise it will be ignored.`,\n );\n }\n\n return (\n <field.Element\n ref={forwardedRef}\n {...field.props}\n />\n );\n },\n);\n\nInput.displayName = DISPLAY_NAME;\n\nconst InputWithPasskeyAutofill = React.forwardRef<React.ElementRef<typeof RadixControl>, FormInputProps>(\n (props: FormInputProps, forwardedRef) => {\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n const passkeyAutofillSupported = useSignInPasskeyAutofill();\n\n React.useEffect(() => {\n if (passkeyAutofillSupported) {\n signInRouterRef?.send({ type: 'AUTHENTICATE.PASSKEY.AUTOFILL' });\n }\n }, [passkeyAutofillSupported, signInRouterRef]);\n\n const field = useInput(props);\n return (\n <field.Element\n ref={forwardedRef}\n {...field.props}\n />\n );\n },\n);\n\nInputWithPasskeyAutofill.displayName = DISPLAY_NAME_PASSKEYS_AUTOFILL;\n","import { useSelector as useSelectorUnbound } from '@xstate/react';\nimport * as React from 'react';\nimport type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\n/**\n * Creates a context and hooks for a given actor ref.\n\n * @example\n * const SignInRouterCtx = createContextFromActorRef<typeof SignInRouterMachine>('SignInRouterCtx')\n *\n * const Parent = () => {\n * const ref = useActorRef(SignInRouterMachine, { input: { basePath: '/sign-in' } });\n *\n * return (\n * <SignInRouterCtx.Provider ref={ref}>\n * <Child />\n * </SignInRouterCtx>\n * )\n * }\n *\n * const Child = () => {\n * const ref = SignInRouterCtx.useActorRef();\n * const status = SignInRouterCtx.useSelector(state => state.context.clerk);\n\n * const handleClick = useCallback(() => ref.send({ type: 'NEXT' }), [ref]);\n *\n * return <button onClick={handleClick}>;\n * }\n */\n\nexport function createContextFromActorRef<TMachine extends AnyStateMachine, TRef = ActorRefFrom<TMachine>>(\n displayName: string,\n) {\n const ReactContext = React.createContext<TRef | null>(null);\n const OriginalProvider = ReactContext.Provider;\n\n function Provider({ children, actorRef }: { children: React.ReactNode; actorRef: TRef }) {\n return React.createElement(\n OriginalProvider,\n {\n value: actorRef,\n },\n children,\n );\n }\n\n Provider.displayName = displayName;\n\n function useContext(allowMissingActor?: false | undefined): TRef;\n function useContext(allowMissingActor: true): TRef | null;\n function useContext(allowMissingActor: boolean = false): TRef | null {\n const actorRef = React.useContext(ReactContext);\n\n if (!allowMissingActor && !actorRef) {\n throw new Error(\n `You used a hook from \"${Provider.displayName}\" but it's not inside a <${Provider.displayName}.Provider> component.`,\n );\n }\n\n return actorRef;\n }\n\n function useSelector<T>(selector: (snapshot: SnapshotFrom<TRef>) => T, compare?: (a: T, b: T) => boolean): T {\n const actor = useContext();\n return useSelectorUnbound(actor as AnyActorRef, selector, compare);\n }\n\n return {\n Provider,\n useActorRef: useContext,\n useSelector,\n };\n}\n","import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\nimport type {\n TSignInFirstFactorMachine,\n TSignInResetPasswordMachine,\n TSignInRouterMachine,\n TSignInSecondFactorMachine,\n TSignInStartMachine,\n} from '~/internals/machines/sign-in';\nimport { createContextFromActorRef } from '~/react/utils/create-context-from-actor-ref';\n\nexport type SnapshotState = SnapshotFrom<TSignInRouterMachine>;\n\nexport const SignInRouterCtx: ReturnType<typeof createContextFromActorRef<TSignInRouterMachine>> =\n createContextFromActorRef<TSignInRouterMachine>('SignInRouterCtx');\n\nfunction useSignInStep<M extends AnyStateMachine, T = ActorRefFrom<M>>(name: string) {\n return SignInRouterCtx.useSelector(state => state.children[name] as AnyActorRef) as T;\n}\n\nexport const useSignInStartStep = () => useSignInStep<TSignInStartMachine>('start');\nexport const useSignInFirstFactorStep = () => useSignInStep<TSignInFirstFactorMachine>('firstFactor');\nexport const useSignInSecondFactorStep = () => useSignInStep<TSignInSecondFactorMachine>('secondFactor');\nexport const useSignInResetPasswordStep = () => useSignInStep<TSignInResetPasswordMachine>('resetPassword');\n\nexport const useSignInPasskeyAutofill = () =>\n SignInRouterCtx.useSelector(state => state.context.webAuthnAutofillSupport);\n","import { Label as RadixLabel } from '@radix-ui/react-form';\n\nconst DISPLAY_NAME = 'ClerkElementsLabel';\n\n/**\n * Renders a `<label>` element that is automatically associated with its sibling `<Input />` inside of a `<Field>`. Additional props will be passed through to the `<label>` element.\n *\n * @param {boolean} [asChild] - If true, `<Label />` will render as its child element, passing along any necessary props.\n *\n * @example\n * <Clerk.Field name=\"email\">\n * <Clerk.Label>Email</Clerk.Label>\n * <Clerk.Input />\n * </Clerk.Field>\n */\nexport const Label = RadixLabel;\n\nLabel.displayName = DISPLAY_NAME;\n","import type { FormSubmitProps as RadixFormSubmitProps } from '@radix-ui/react-form';\nimport { Submit as RadixSubmit } from '@radix-ui/react-form';\nimport type { SetRequired } from 'type-fest';\n\nconst DISPLAY_NAME = 'ClerkElementsSubmit';\n\nexport type FormSubmitProps = SetRequired<RadixFormSubmitProps, 'children'>;\ntype FormSubmitComponent = React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;\n\n/**\n * A `<button type=\"submit\">` element.\n *\n * @param {boolean} [asChild] - When `true`, the component will render its child and passes all props to it.\n */\nexport const Submit = RadixSubmit as FormSubmitComponent;\n\nSubmit.displayName = DISPLAY_NAME;\n","import type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext } from 'react';\n\nimport type { ThirdPartyProvider } from '~/utils/third-party-strategies';\n\nimport { useThirdPartyProvider } from '../hooks';\nimport { SignInRouterCtx } from '../sign-in/context';\nimport { SignUpRouterCtx } from '../sign-up/context';\n\nexport type UseThirdPartyProviderReturn =\n | (ThirdPartyProvider & {\n events: {\n authenticate: (event: React.MouseEvent<Element>) => void;\n };\n })\n | null;\n\nexport const ConnectionContext = createContext<ThirdPartyProvider | null>(null);\nexport const useConnectionContext = () => {\n const ctx = useContext(ConnectionContext);\n\n if (!ctx) {\n throw new Error('useConnectionContext must be used within <Clerk.Connection>');\n }\n\n return ctx;\n};\n\nexport interface ConnectionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n name: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy;\n}\n\n/**\n * Renders a social connection button based on the provided name. If your instance does not have the social connection enabled, this component will throw an error in development.\n *\n * **Tip:** You can use the `<Icon />` component to render the social connection icon.\n *\n * @param {boolean} [asChild] - If true, `<Connection />` will render as its child element, passing along any necessary props.\n * @param {OAuthProvider | Web3Provider} name - The name of the social connection to render.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name=\"start\">\n * <Clerk.Connection name=\"google\">\n * Sign in with Google\n * </Clerk.Connection>\n * </SignIn.Step>\n * </SignIn.Root>\n */\nexport function Connection({ asChild, name, ...rest }: ConnectionProps) {\n const signInRef = SignInRouterCtx.useActorRef(true);\n const signUpRef = SignUpRouterCtx.useActorRef(true);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const provider = useThirdPartyProvider((signInRef || signUpRef)!, name);\n\n if (!provider) {\n return null;\n }\n\n const Comp = asChild ? Slot : 'button';\n const defaultProps = asChild ? {} : { type: 'button' as const };\n\n return (\n <ConnectionContext.Provider value={provider}>\n <Comp\n onClick={provider.events.authenticate}\n {...defaultProps}\n {...rest}\n />\n </ConnectionContext.Provider>\n );\n}\n\nexport interface IconProps extends Omit<React.HTMLAttributes<HTMLImageElement>, 'src'> {\n asChild?: boolean;\n}\n\n/**\n * `<Icon>` **must** be used inside `<Connection>`. By default, `<Icon>` will render as an `<img>` element with the `src` pointing to the logo of the currently used `<Connection>`.\n *\n * @param {boolean} [asChild] - If true, `<Icon />` will render as its child element, passing along any necessary props.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name=\"start\">\n * <Clerk.Connection name=\"google\">\n * <Clerk.Icon />\n * Sign in with Google\n * </Clerk.Connection>\n * </SignIn.Step>\n * </SignIn.Root>\n */\nexport function Icon({ asChild, ...rest }: IconProps) {\n const { iconUrl, name } = useConnectionContext();\n\n const Comp = asChild ? Slot : 'img';\n return (\n <Comp\n alt={`${name} logo`}\n src={iconUrl}\n {...rest}\n />\n );\n}\n","import { useClerk } from '@clerk/shared/react';\nimport type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport type React from 'react';\nimport { useCallback } from 'react';\nimport type { ActorRef } from 'xstate';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport type { SignInRouterEvents } from '~/internals/machines/sign-in';\nimport type { SignUpRouterEvents } from '~/internals/machines/sign-up';\nimport type { UseThirdPartyProviderReturn } from '~/react/common/connections';\nimport {\n getEnabledThirdPartyProviders,\n isAuthenticatableOauthStrategy,\n isEnterpriseSSOStrategy,\n isSamlStrategy,\n isWeb3Strategy,\n providerToDisplayData,\n} from '~/utils/third-party-strategies';\n\nconst useIsProviderEnabled = (\n provider: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy,\n): boolean | null => {\n const clerk = useClerk();\n\n // null indicates we don't know for sure\n if (!clerk.loaded) {\n return null;\n }\n\n if (provider === 'saml' || provider === 'enterprise_sso') {\n return (\n clerk.__unstable__environment?.userSettings.saml.enabled ??\n clerk.__unstable__environment?.userSettings.enterpriseSSO.enabled ??\n false\n );\n }\n\n const data = getEnabledThirdPartyProviders(clerk.__unstable__environment);\n\n return (\n isAuthenticatableOauthStrategy(provider, data.authenticatableOauthStrategies) ||\n isWeb3Strategy(provider, data.web3Strategies)\n );\n};\n\nexport const useThirdPartyProvider = <\n TActor extends ActorRef<any, SignInRouterEvents> | ActorRef<any, SignUpRouterEvents>,\n>(\n ref: TActor,\n provider: OAuthProvider | Web3Provider | SamlStrategy | EnterpriseSSOStrategy,\n): UseThirdPartyProviderReturn => {\n const isProviderEnabled = useIsProviderEnabled(provider);\n const isSaml = isSamlStrategy(provider);\n const isEnterpriseSSO = isEnterpriseSSOStrategy(provider);\n const details =\n isEnterpriseSSO || isSaml\n ? {\n name: 'SSO',\n strategy: provider,\n }\n : providerToDisplayData[provider];\n\n const authenticate = useCallback(\n (event: React.MouseEvent<Element>) => {\n if (!isProviderEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (isSaml) {\n return ref.send({ type: 'AUTHENTICATE.SAML' });\n }\n\n if (isEnterpriseSSO) {\n return ref.send({ type: 'AUTHENTICATE.ENTERPRISE_SSO' });\n }\n\n if (provider === 'base') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_base_signature' });\n }\n\n if (provider === 'metamask') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_metamask_signature' });\n }\n\n if (provider === 'coinbase_wallet') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_coinbase_wallet_signature' });\n }\n\n if (provider === 'okx_wallet') {\n return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_okx_wallet_signature' });\n }\n\n return ref.send({ type: 'AUTHENTICATE.OAUTH', strategy: `oauth_${provider}` });\n },\n [provider, isProviderEnabled, isSaml, isEnterpriseSSO, ref],\n );\n\n if (isProviderEnabled === false) {\n const dashboardPath = `https://dashboard.clerk.com/last-active?path=/user-authentication/${provider === 'metamask' ? 'web3' : 'social-connections'}`;\n\n throw new ClerkElementsRuntimeError(\n `You have used <Connection name=\"${provider}\"> which isn't enabled for your project. Enable ${details.name} in your Clerk dashboard: ${dashboardPath}`,\n );\n }\n\n return {\n events: {\n authenticate,\n },\n ...details,\n };\n};\n","// c.f. vendor/clerk-js/src/ui/hooks/useEnabledThirdPartyProviders.tsx [Modified]\n\nimport { iconImageUrl } from '@clerk/shared/constants';\nimport { OAUTH_PROVIDERS } from '@clerk/shared/oauth';\nimport { WEB3_PROVIDERS } from '@clerk/shared/web3';\nimport type {\n EnterpriseSSOStrategy,\n EnvironmentResource,\n OAuthProvider,\n OAuthStrategy,\n SamlStrategy,\n Web3Provider,\n Web3Strategy,\n} from '@clerk/types';\n\nimport { fromEntries } from './clerk-js';\n\nexport type ThirdPartyStrategy =\n | {\n id: Web3Strategy | OAuthStrategy;\n iconUrl: string;\n name: string;\n }\n | {\n strategy: SamlStrategy | EnterpriseSSOStrategy;\n iconUrl?: never;\n name: string;\n };\n\nexport type ThirdPartyProvider =\n | {\n strategy: Web3Strategy | OAuthStrategy;\n iconUrl: string;\n name: string;\n }\n | {\n strategy: SamlStrategy | EnterpriseSSOStrategy;\n iconUrl?: never;\n name: string;\n };\n\ntype ThirdPartyStrategyToDataMap = {\n [k in Web3Strategy | OAuthStrategy]: ThirdPartyStrategy;\n};\n\ntype ThirdPartyProviderToDataMap = {\n [k in Web3Provider | OAuthProvider]: ThirdPartyProvider;\n};\n\nexport interface EnabledThirdPartyProviders {\n authenticatableOauthStrategies: OAuthStrategy[];\n providerToDisplayData: ThirdPartyProviderToDataMap;\n strategies: (Web3Strategy | OAuthStrategy)[];\n strategyToDisplayData: ThirdPartyStrategyToDataMap;\n web3Strategies: Web3Strategy[];\n}\n\nconst oauthStrategies = OAUTH_PROVIDERS.map(p => p.strategy);\n\nexport const providerToDisplayData: ThirdPartyProviderToDataMap = fromEntries(\n [...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {\n return [p.provider, { iconUrl: iconImageUrl(p.provider), name: p.name, strategy: p.strategy }];\n }),\n) as ThirdPartyProviderToDataMap;\n\nconst strategyToDisplayData: ThirdPartyStrategyToDataMap = fromEntries(\n [...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {\n return [p.strategy, { iconUrl: iconImageUrl(p.provider), id: p.provider, name: p.name }];\n }),\n) as ThirdPartyStrategyToDataMap;\n\nexport function isSamlStrategy(strategy: any): strategy is SamlStrategy {\n return strategy === 'saml';\n}\n\nexport function isEnterpriseSSOStrategy(strategy: any): strategy is EnterpriseSSOStrategy {\n return strategy === 'enterprise_sso';\n}\n\nexport function isWeb3Strategy(\n strategy: any,\n available: EnabledThirdPartyProviders['web3Strategies'],\n): strategy is Web3Strategy {\n return available.includes(strategy.startsWith('web3_') ? strategy : `web3_${strategy}_signature`);\n}\n\nexport function isAuthenticatableOauthStrategy(\n strategy: any,\n available: EnabledThirdPartyProviders['authenticatableOauthStrategies'],\n): strategy is OAuthStrategy {\n return available.includes(strategy.startsWith('oauth_') ? strategy : `oauth_${strategy}`);\n}\n\nconst emptyThirdPartyProviders: EnabledThirdPartyProviders = {\n authenticatableOauthStrategies: [],\n providerToDisplayData: {} as any,\n strategies: [],\n strategyToDisplayData: {} as any,\n web3Strategies: [],\n};\n\nexport const getEnabledThirdPartyProviders = (\n environment: EnvironmentResource | undefined | null,\n): EnabledThirdPartyProviders => {\n if (!environment?.userSettings) {\n return emptyThirdPartyProviders;\n }\n\n const { socialProviderStrategies, web3FirstFactors, authenticatableSocialStrategies } = environment.userSettings;\n\n // Filter out any OAuth strategies that are not yet known, they are not included in our types.\n const knownSocialProviderStrategies = socialProviderStrategies.filter(s => oauthStrategies.includes(s));\n const knownAuthenticatableSocialStrategies = authenticatableSocialStrategies.filter(s => oauthStrategies.includes(s));\n\n return {\n authenticatableOauthStrategies: [...knownAuthenticatableSocialStrategies],\n providerToDisplayData: providerToDisplayData,\n strategies: [...knownSocialProviderStrategies, ...web3FirstFactors],\n strategyToDisplayData: strategyToDisplayData,\n web3Strategies: web3FirstFactors,\n };\n};\n","// Pulled from `clerk-js/src/ui/utils/fromEntries.ts\nexport const fromEntries = (iterable: Iterable<any>) => {\n return [...iterable].reduce((obj, [key, val]) => {\n obj[key] = val;\n return obj;\n }, {});\n};\n","import type { ActorRefFrom, AnyActorRef, AnyStateMachine, SnapshotFrom } from 'xstate';\n\nimport {\n type TSignUpContinueMachine,\n type TSignUpRouterMachine,\n type TSignUpStartMachine,\n type TSignUpVerificationMachine,\n} from '~/internals/machines/sign-up';\nimport { createContextFromActorRef } from '~/react/utils/create-context-from-actor-ref';\n\nexport type SnapshotState = SnapshotFrom<TSignUpRouterMachine>;\n\nexport const SignUpRouterCtx: ReturnType<typeof createContextFromActorRef<TSignUpRouterMachine>> =\n createContextFromActorRef<TSignUpRouterMachine>('SignUpRouterCtx');\n\nfunction useSignUpStep<M extends AnyStateMachine, T = ActorRefFrom<M>>(name: string) {\n return SignUpRouterCtx.useSelector(state => state.children[name] as AnyActorRef) as T;\n}\n\nexport const useSignUpStartStep = () => useSignUpStep<TSignUpStartMachine>('start');\nexport const useSignUpContinueStep = () => useSignUpStep<TSignUpContinueMachine>('continue');\nexport const useSignUpVerificationStep = () => useSignUpStep<TSignUpVerificationMachine>('verification');\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\nimport type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, Web3Provider } from '@clerk/types';\nimport { useSelector } from '@xstate/react';\nimport * as React from 'react';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\nimport type { ActorSignIn, ActorSignUp } from '~/react/hooks/use-loading.hook';\nimport { useLoading } from '~/react/hooks/use-loading.hook';\nimport { SignInRouterCtx } from '~/react/sign-in/context';\nimport type { TSignInStep } from '~/react/sign-in/step';\nimport { SIGN_IN_STEPS } from '~/react/sign-in/step';\nimport { SignUpRouterCtx } from '~/react/sign-up/context';\nimport type { TSignUpStep } from '~/react/sign-up/step';\nimport { SIGN_UP_STEPS } from '~/react/sign-up/step';\nimport { isProviderStrategyScope, mapScopeToStrategy } from '~/react/utils/map-scope-to-strategy';\n\ntype Strategy = OAuthProvider | SamlStrategy | EnterpriseSSOStrategy | Web3Provider;\ntype LoadingScope<T extends TSignInStep | TSignUpStep> =\n | 'global'\n | `step:${T}`\n | `provider:${Strategy}`\n | 'submit'\n | 'passkey'\n | undefined;\n\ntype LoadingProps = {\n scope?: LoadingScope<TSignInStep | TSignUpStep>;\n children: (isLoading: boolean) => React.ReactNode;\n};\n\nfunction isSignInScope(scope: LoadingScope<TSignInStep | TSignUpStep>): scope is LoadingScope<TSignInStep> {\n if (!scope) {\n return true;\n }\n\n if (scope.startsWith('step:')) {\n return Object.prototype.hasOwnProperty.call(SIGN_IN_STEPS, scope.replace('step:', ''));\n }\n\n return true;\n}\n\nfunction isSignUpScope(scope: LoadingScope<TSignInStep | TSignUpStep>): scope is LoadingScope<TSignUpStep> {\n if (!scope) {\n return true;\n }\n\n if (scope.startsWith('step:')) {\n return Object.prototype.hasOwnProperty.call(SIGN_UP_STEPS, scope.replace('step:', ''));\n }\n\n return true;\n}\n\n/**\n * Access the loading state of a chosen scope. Scope can refer to a step, a provider, or the global loading state. The global loading state is `true` when any of the other scopes are loading.\n *\n * @param scope - Optional. Specify which loading state to access. Can be a step, a provider, or the global loading state. If `<Loading>` is used outside a `<Step>`, the scope will default to \"global\". If used inside a `<Step>` the scope will default to the current step. For external authentication providers, the scope needs to be manually defined in the format of `provider:<provider name>`\n * @param {Function} children - A function that receives `isLoading` as an argument. `isLoading` is a boolean that indicates if the current scope is loading or not.\n *\n * @example\n * <SignIn.Root>\n * <Clerk.Loading>\n * {(isLoading) => isLoading && \"Global loading...\"}\n * </Clerk.Loading>\n * </SignIn.Root>\n *\n * @example\n * <SignIn.Step name=\"start\">\n * <Clerk.Action submit>\n * <Clerk.Loading>\n * {(isLoading) => isLoading ? \"Start is loading...\" : \"Submit\"}\n * </Clerk.Loading>\n * </Clerk.Action>\n * </SignIn.Step>\n *\n * @example\n * <SignIn.Step name=\"start\">\n * <Clerk.Loading scope=\"provider:google\">\n * {(isLoading) => (\n * <Clerk.Connection name=\"google\" disabled={isLoading}>\n * {isLoading ? \"Loading...\" : \"Continue with Google\"}\n * </Clerk.Connection>\n * )}\n * </Clerk.Loading>\n * </SignIn.Step>\n */\nexport function Loading({ children, scope }: LoadingProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_Loading', { scope: scope ?? false }));\n\n const signInRouterRef = SignInRouterCtx.useActorRef(true);\n const signUpRouterRef = SignUpRouterCtx.useActorRef(true);\n\n // One of the two routers must be defined. Otherwise, the component is used outside of a <SignIn> or <SignUp> component.\n // An error is thrown in this case. Depending on which router is defined, the following flow will be either for sign-in or sign-up.\n if (!signInRouterRef && !signUpRouterRef) {\n throw new ClerkElementsRuntimeError(`<Loading> must be used within a <SignIn> or <SignUp> component.`);\n }\n\n if (signInRouterRef) {\n if (isSignInScope(scope)) {\n return (\n <SignInLoading\n scope={scope}\n routerRef={signInRouterRef}\n >\n {children}\n </SignInLoading>\n );\n } else {\n throw new ClerkElementsRuntimeError(`Invalid scope \"${scope}\" used for <Loading> inside <SignIn>.`);\n }\n }\n\n if (signUpRouterRef) {\n if (isSignUpScope(scope)) {\n return (\n <SignUpLoading\n scope={scope}\n routerRef={signUpRouterRef}\n >\n {children}\n </SignUpLoading>\n );\n } else {\n throw new ClerkElementsRuntimeError(`Invalid scope \"${scope}\" used for <Loading> inside <SignUp>.`);\n }\n }\n\n throw new ClerkElementsRuntimeError('Invalid state for <Loading>. Please open an issue.');\n}\n\ntype SignInLoadingProps = {\n scope?: LoadingScope<TSignInStep>;\n children: (isLoading: boolean) => React.ReactNode;\n routerRef: ActorSignIn;\n};\n\nfunction SignInLoading({ children, scope, routerRef }: SignInLoadingProps) {\n const [isLoading, { step: loadingStep, strategy, action }] = useLoading(routerRef);\n const tags = useSelector(routerRef, s => s.tags);\n\n const isStepLoading = (step: TSignInStep) => isLoading && loadingStep === step;\n const isInferredStepLoading = (step: TSignInStep) => tags.has(`step:${step}`) && isStepLoading(step);\n\n let loadingResult = false;\n\n if (scope === 'global') {\n // Global Loading Scope\n loadingResult = isLoading;\n } else if (scope && isProviderStrategyScope(scope)) {\n // Provider-Specific Loading Scope\n loadingResult = isLoading && loadingStep === undefined && strategy === mapScopeToStrategy(scope);\n } else if (scope) {\n // Specified Loading Scope\n loadingResult = isStepLoading(scope.replace('step:', '') as TSignInStep) || scope === action;\n } else {\n // Inferred Loading Scope\n loadingResult =\n isInferredStepLoading('start') ||\n isInferredStepLoading('verifications') ||\n isInferredStepLoading('choose-strategy') ||\n isInferredStepLoading('forgot-password') ||\n isInferredStepLoading('reset-password');\n }\n\n return children(loadingResult);\n}\n\ntype SignUpLoadingProps = {\n scope?: LoadingScope<TSignUpStep>;\n children: (isLoading: boolean) => React.ReactNode;\n routerRef: ActorSignUp;\n};\n\nfunction SignUpLoading({ children, scope, routerRef }: SignUpLoadingProps) {\n const [isLoading, { step: loadingStep, strategy, action }] = useLoading(routerRef);\n const tags = useSelector(routerRef, s => s.tags);\n\n const isStepLoading = (step: TSignUpStep) => isLoading && loadingStep === step;\n const isInferredStepLoading = (step: TSignUpStep) => tags.has(`step:${step}`) && isStepLoading(step);\n\n let loadingResult = false;\n\n if (scope === 'global') {\n // Global Loading Scope\n loadingResult = isLoading;\n } else if (scope && isProviderStrategyScope(scope)) {\n // Provider-Specific Loading Scope\n loadingResult = isLoading && loadingStep === undefined && strategy === mapScopeToStrategy(scope);\n } else if (scope) {\n loadingResult = isStepLoading(scope.replace('step:', '') as TSignUpStep) || scope === action;\n } else {\n // Inferred Loading Scope\n loadingResult =\n isInferredStepLoading('start') || isInferredStepLoading('continue') || isInferredStepLoading('verifications');\n }\n\n return children(loadingResult);\n}\n","import { useSelector } from '@xstate/react';\nimport type { ActorRefFrom, SnapshotFrom } from 'xstate';\n\nimport type { SignInRouterLoadingContext, TSignInRouterMachine } from '~/internals/machines/sign-in';\nimport type { SignUpRouterLoadingContext, TSignUpRouterMachine } from '~/internals/machines/sign-up';\n\nexport type ActorSignIn = ActorRefFrom<TSignInRouterMachine>;\nexport type ActorSignUp = ActorRefFrom<TSignUpRouterMachine>;\n\ntype LoadingContext<T> = T extends ActorSignIn ? SignInRouterLoadingContext : SignUpRouterLoadingContext;\ntype UseLoadingReturn<T> = [\n isLoading: boolean,\n { step: LoadingContext<T>['step']; strategy: LoadingContext<T>['strategy']; action: LoadingContext<T>['action'] },\n];\n\nconst selectLoading = <T extends SnapshotFrom<TSignInRouterMachine> | SnapshotFrom<TSignUpRouterMachine>>(\n snapshot: T,\n) => snapshot?.context?.loading;\nconst compareLoadingValue = <T extends SignInRouterLoadingContext | SignUpRouterLoadingContext>(prev: T, next: T) =>\n prev?.isLoading === next?.isLoading;\n\n/**\n * Generic hook to check the loading state inside the context of a machine. Should only be used with `SignInRouterCtx` or `SignUpRouterCtx`.\n *\n * @param actor - The actor reference of the machine\n *\n * @example\n * const ref = SignInRouterCtx.useActorRef();\n *\n * useLoading(ref);\n */\nexport function useLoading<TActor extends ActorSignIn | ActorSignUp>(actor: TActor): UseLoadingReturn<TActor> {\n const loadingCtx = useSelector(actor, selectLoading, compareLoadingValue) as LoadingContext<TActor>;\n\n if (!loadingCtx) {\n return [false, { step: undefined, strategy: undefined, action: undefined }];\n }\n\n return [loadingCtx.isLoading, { step: loadingCtx.step, strategy: loadingCtx.strategy, action: loadingCtx.action }];\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\n\nimport { SignInChooseSession, type SignInChooseSessionProps } from './choose-session';\nimport { SignInChooseStrategy, type SignInChooseStrategyProps, SignInForgotPassword } from './choose-strategy';\nimport { SignInResetPassword, type SignInResetPasswordProps } from './reset-password';\nimport type { SignInSSOCallbackProps } from './sso-callback';\nimport { SignInSSOCallback } from './sso-callback';\nimport { SignInStart, type SignInStartProps } from './start';\nimport { SignInVerifications, type SignInVerificationsProps } from './verifications';\n\nexport const SIGN_IN_STEPS = {\n start: 'start',\n verifications: 'verifications',\n 'choose-strategy': 'choose-strategy',\n 'choose-session': 'choose-session',\n 'forgot-password': 'forgot-password',\n 'reset-password': 'reset-password',\n 'sso-callback': 'sso-callback',\n} as const;\n\nexport type TSignInStep = (typeof SIGN_IN_STEPS)[keyof typeof SIGN_IN_STEPS];\ntype StepWithProps<N extends TSignInStep, T> = { name: N } & T;\n\nexport type SignInStepProps =\n | StepWithProps<'start', SignInStartProps>\n | StepWithProps<'verifications', SignInVerificationsProps>\n | StepWithProps<'choose-strategy' | 'forgot-password', SignInChooseStrategyProps>\n | StepWithProps<'reset-password', SignInResetPasswordProps>\n | StepWithProps<'choose-session', SignInChooseSessionProps>\n | StepWithProps<'sso-callback', SignInSSOCallbackProps>;\n\n/**\n * Render different steps of the sign-in flow. Initially the `'start'` step is rendered. Once a sign-in attempt has been created, `'verifications'` will be displayed. If during that verification step the user decides to choose a different method of signing in or verifying, the `'choose-strategy'` step will be displayed.\n *\n * You typically want to place fields like username, password, or social providers in the `'start'` step. The `'verifications'` step is used to verify the user's credentials like password or MFA. Once the user has been verified, the sign-in attempt will be completed.\n *\n * @param {string} name - Step name. Use `'start'`, `'verifications'`, `'choose-strategy'`, `'reset-password'`, or `'forgot-password'`.\n *\n * @example\n * <SignIn.Root>\n * <SignIn.Step name='start' />\n * <SignIn.Step name='verifications' />\n * <SignIn.Step name='choose-strategy' />\n * <SignIn.Step name='forgot-password' />\n * <SignIn.Step name='reset-password' />\n * <SignIn.Step name='choose-session' />\n * </SignIn.Root>\n */\nexport function SignInStep(props: SignInStepProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_SignInStep', { name: props.name }));\n\n switch (props.name) {\n case SIGN_IN_STEPS.start:\n return <SignInStart {...props} />;\n case SIGN_IN_STEPS.verifications:\n return <SignInVerifications {...props} />;\n case SIGN_IN_STEPS['choose-strategy']:\n return <SignInChooseStrategy {...props} />;\n case SIGN_IN_STEPS['forgot-password']:\n return <SignInForgotPassword {...props} />;\n case SIGN_IN_STEPS['reset-password']:\n return <SignInResetPassword {...props} />;\n case SIGN_IN_STEPS['choose-session']:\n return <SignInChooseSession {...props} />;\n case SIGN_IN_STEPS['sso-callback']:\n return <SignInSSOCallback {...props} />;\n default:\n throw new ClerkElementsRuntimeError(`Invalid step name. Use: ${Object.keys(SIGN_IN_STEPS).join(',')}.`);\n }\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { eventComponentMounted } from '@clerk/shared/telemetry';\n\nimport { ClerkElementsRuntimeError } from '~/internals/errors';\n\nimport type { SignUpContinueProps } from './continue';\nimport { SignUpContinue } from './continue';\nimport type { SignUpRestrictedProps } from './restricted';\nimport { SignUpRestricted } from './restricted';\nimport type { SignUpStartProps } from './start';\nimport { SignUpStart } from './start';\nimport type { SignUpVerificationsProps } from './verifications';\nimport { SignUpVerifications } from './verifications';\n\nexport const SIGN_UP_STEPS = {\n start: 'start',\n continue: 'continue',\n verifications: 'verifications',\n restricted: 'restricted',\n} as const;\n\nexport type TSignUpStep = (typeof SIGN_UP_STEPS)[keyof typeof SIGN_UP_STEPS];\ntype StepWithProps<N extends TSignUpStep, T> = { name: N } & T;\n\nexport type SignUpStepProps =\n | StepWithProps<'start', SignUpStartProps>\n | StepWithProps<'continue', SignUpContinueProps>\n | StepWithProps<'verifications', SignUpVerificationsProps>\n | StepWithProps<'restricted', SignUpRestrictedProps>;\n\n/**\n * Render different steps of the sign-up flow. Initially the `'start'` step is rendered. Optionally, you can render additional fields in the `'continue'` step. Once a sign-up attempt has been created, `'verifications'` will be displayed.\n *\n * You typically want to place fields like username, password, or social providers in the `'start'` step. The `'continue'` step can hold inputs for username, first name/last name or other metadata. The `'verifications'` step is used to verify the user's information like an email verification. Once the user has been verified, the sign-up attempt will be completed.\n *\n * @param {string} name - Step name. Use `'start'`, `'continue'`, or `'verifications'`.\n *\n * @example\n * <SignUp.Root>\n * <SignUp.Step name='start' />\n * <SignUp.Step name='continue' />\n * <SignUp.Step name='verifications' />\n * </SignUp.Root>\n */\nexport function SignUpStep(props: SignUpStepProps) {\n const clerk = useClerk();\n\n clerk.telemetry?.record(eventComponentMounted('Elements_SignUpStep', { name: props.name }));\n\n switch (props.name) {\n case SIGN_UP_STEPS.start:\n return <SignUpStart {...props} />;\n case SIGN_UP_STEPS.continue:\n return <SignUpContinue {...props} />;\n case SIGN_UP_STEPS.verifications:\n return <SignUpVerifications {...props} />;\n case SIGN_UP_STEPS.restricted:\n return <SignUpRestricted {...props} />;\n default:\n throw new ClerkElementsRuntimeError(\n `Invalid step name. Use 'start', 'continue', 'verifications', or 'restricted'.`,\n );\n }\n}\n","import type { EnterpriseSSOStrategy, OAuthProvider, SamlStrategy, SignInStrategy, Web3Provider } from '@clerk/types';\n\ntype Strategy = OAuthProvider | SamlStrategy | EnterpriseSSOStrategy | Web3Provider;\n\nexport function isProviderStrategyScope(value: string): value is Strategy {\n return value.startsWith('provider:');\n}\n\nexport function mapScopeToStrategy<T extends `provider:${Strategy}`>(scope: T): SignInStrategy {\n if (scope === 'provider:metamask') {\n return 'web3_metamask_signature';\n }\n\n if (scope === 'provider:coinbase_wallet') {\n return 'web3_coinbase_wallet_signature';\n }\n\n if (scope === 'provider:base') {\n return 'web3_base_signature';\n }\n\n if (scope === 'provider:okx_wallet') {\n return 'web3_okx_wallet_signature';\n }\n\n if (scope === 'provider:saml') {\n return 'saml';\n }\n\n if (scope === 'provider:enterprise_sso') {\n return 'enterprise_sso';\n }\n\n const scopeWithoutPrefix = scope.replace('provider:', '') as OAuthProvider;\n\n return `oauth_${scopeWithoutPrefix}`;\n}\n","import { useClerk } from '@clerk/shared/react';\nimport { useClerkRouter } from '@clerk/shared/router';\nimport type { ClerkOptions } from '@clerk/types';\nimport React from 'react';\n\ntype Destination = 'sign-in' | 'sign-up';\nexport interface LinkProps extends Omit<React.HTMLAttributes<HTMLAnchorElement>, 'children'> {\n navigate: Destination;\n children: React.ReactNode | ((props: { url: string }) => React.ReactNode);\n}\n\nconst paths: Record<Destination, keyof Pick<ClerkOptions, 'signInUrl' | 'signUpUrl'>> = {\n 'sign-in': 'signInUrl',\n 'sign-up': 'signUpUrl',\n};\n\n/**\n * The `<Link>` component is used to navigate between sign-in and sign-up flows.\n *\n * @param {Destination} navigate - The destination to navigate to.\n *\n * @example\n * ```tsx\n * <Link navigate=\"sign-in\">Sign in</Link>\n * ```\n * @example\n * ```tsx\n * <Link navigate=\"sign-in\">\n * {({ url }) => (\n * <NextLink href={url}>Sign in</NextLink>\n * )}\n * </Link>\n */\n\nexport function Link({ navigate, children, ...rest }: LinkProps) {\n const router = useClerkRouter();\n const clerk = useClerk();\n const destinationUrl = router.makeDestinationUrlWithPreservedQueryParameters(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clerk.__internal_getOption(paths[navigate])!,\n );\n\n if (typeof children === 'function') {\n return children({ url: destinationUrl });\n }\n\n return (\n <a\n onClick={e => {\n if (router) {\n e.preventDefault();\n router.push(destinationUrl);\n }\n }}\n href={destinationUrl}\n {...rest}\n >\n {children}\n </a>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAO;;;ACCP,IAAAA,qBAAyE;AACzE,IAAAC,SAAuB;;;ACHvB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AU;AAEtB,oBAAgB;AAAA,EAClB,WAAW,SAAS,wBAAwB,KAAK,GAAG;AAElD,oBAAgB,aAAa,gBAAgB,UAAa,aAAa,mBAAmB,KAAK;AAAA,EACjG,WAAW,OAAO;AAChB,oBAAgB,cAAc,MAAM,QAAQ,SAAS,EAAE,CAAgB,KAAK,UAAU;AAAA,EACxF,OAAO;AAEL,oBACE,sBAAsB,OAAO,KAAK,sBAAsB,UAAU,KAAK,sBAAsB,eAAe;AAAA,EAChH;AAEA,SAAO,SAAS,aAAa;AAC/B;;;AK1MA,IAAAC,iBAAyB;AACzB,IAAAC,iBAA+B;AA8C3B,IAAAC,uBAAA;AApCJ,IAAM,QAAkF;AAAA,EACtF,WAAW;AAAA,EACX,WAAW;AACb;AAoBO,SAAS,KAAK,EAAE,UAAU,UAAU,GAAG,KAAK,GAAc;AAC/D,QAAM,aAAS,+BAAe;AAC9B,QAAM,YAAQ,yBAAS;AACvB,QAAM,iBAAiB,OAAO;AAAA;AAAA,IAE5B,MAAM,qBAAqB,MAAM,QAAQ,CAAC;AAAA,EAC5C;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,SAAS,EAAE,KAAK,eAAe,CAAC;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,OAAK;AACZ,YAAI,QAAQ;AACV,YAAE,eAAe;AACjB,iBAAO,KAAK,cAAc;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,MAAM;AAAA,MACL,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":["import_react_form","React","import_react_form","React","import_react","React","_a","React","OTPInput","RadixControl","React","React","RadixControl","import_jsx_runtime","RadixField","RadixValidityState","import_react_form","React","React","import_jsx_runtime","DISPLAY_NAME","RadixFormMessage","DISPLAY_NAME","import_react_slot","React","import_jsx_runtime","DISPLAY_NAME","import_react","React","import_react","React","useContext","useSelector","useSelectorUnbound","import_jsx_runtime","DISPLAY_NAME","import_react_form","DISPLAY_NAME","RadixLabel","import_react_form","DISPLAY_NAME","RadixSubmit","import_react_slot","import_react","import_react","import_jsx_runtime","import_react","import_telemetry","import_react","import_react","import_telemetry","import_jsx_runtime","import_react","import_telemetry","import_jsx_runtime","import_jsx_runtime","import_react","import_router","import_jsx_runtime"]}
|